2018-05-06 18:49:43 +02:00
|
|
|
#include <MacTypes.h>
|
|
|
|
#include <Windows.h>
|
|
|
|
#include <TextUtils.h>
|
|
|
|
|
2018-05-19 14:55:27 +02:00
|
|
|
#include "Window.h"
|
|
|
|
|
2018-05-06 18:49:43 +02:00
|
|
|
enum class AppStatus
|
|
|
|
{
|
|
|
|
empty = 0,
|
2018-05-08 02:37:25 +02:00
|
|
|
readyModem = 1,
|
|
|
|
readyPrinter,
|
|
|
|
downloading,
|
|
|
|
upgrading,
|
|
|
|
running,
|
|
|
|
uploading
|
2018-05-06 18:49:43 +02:00
|
|
|
};
|
|
|
|
|
2018-05-19 14:55:27 +02:00
|
|
|
class StatusDisplay : public Window
|
2018-05-06 18:49:43 +02:00
|
|
|
{
|
|
|
|
WindowPtr statusWindow;
|
|
|
|
Str255 statusString = "\p";
|
|
|
|
AppStatus status = AppStatus::empty;
|
|
|
|
int progressDone, progressTotal = 0;
|
|
|
|
long freeMem;
|
2018-05-07 22:39:24 +02:00
|
|
|
long startTime;
|
|
|
|
long speed = -1;
|
|
|
|
long timeRemaining = -1;
|
2018-05-08 02:15:05 +02:00
|
|
|
int errorCount = -1;
|
2018-05-06 18:49:43 +02:00
|
|
|
|
|
|
|
RgnHandle background;
|
|
|
|
Rect statusRect;
|
|
|
|
Rect progressRect;
|
2018-05-07 22:39:24 +02:00
|
|
|
|
|
|
|
static const int nValues = 7;
|
|
|
|
Rect valueRects[nValues];
|
|
|
|
short columnWidths[6];
|
|
|
|
|
2018-05-17 00:38:55 +02:00
|
|
|
PixPatHandle progressBg, progressFg;
|
|
|
|
|
2018-05-07 22:39:24 +02:00
|
|
|
enum class Stat : short;
|
|
|
|
|
|
|
|
void DrawValue(Stat stat, ConstStr255Param str);
|
|
|
|
void DrawValue(Stat stat, long val);
|
2018-05-14 23:58:11 +02:00
|
|
|
void Inval(const Rect& r);
|
2018-05-07 22:39:24 +02:00
|
|
|
|
2018-05-06 18:49:43 +02:00
|
|
|
public:
|
|
|
|
StatusDisplay();
|
|
|
|
~StatusDisplay();
|
|
|
|
|
|
|
|
WindowPtr GetWindow() { return statusWindow; }
|
2018-05-19 14:55:27 +02:00
|
|
|
virtual void Update() override;
|
2018-05-06 18:49:43 +02:00
|
|
|
|
|
|
|
void Idle();
|
|
|
|
|
|
|
|
void SetStatus(AppStatus s);
|
|
|
|
void SetProgress(int done = 0, int total = 0);
|
|
|
|
void SetStatus(AppStatus stat, int done, int total);
|
2018-05-07 22:39:24 +02:00
|
|
|
void SetErrorCount(int errorCount);
|
2018-05-06 18:49:43 +02:00
|
|
|
};
|