| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#ifndef H_FREAC_JOB |
| 14 |
#define H_FREAC_JOB |
| 15 |
|
| 16 |
#include <boca.h> |
| 17 |
|
| 18 |
using namespace smooth; |
| 19 |
using namespace smooth::GUI; |
| 20 |
|
| 21 |
namespace freac |
| 22 |
{ |
| 23 |
abstract class Job : public ListEntry |
| 24 |
{ |
| 25 |
private: |
| 26 |
Text *progressLabel; |
| 27 |
Progressbar *progress; |
| 28 |
EditBox *progressValue; |
| 29 |
|
| 30 |
Text *timeLabel; |
| 31 |
EditBox *timeValue; |
| 32 |
|
| 33 |
Hotspot *closeHotspot; |
| 34 |
|
| 35 |
UnsignedInt64 startTicks; |
| 36 |
Int previousSecondsLeft; |
| 37 |
|
| 38 |
static Array<Job *> scheduled; |
| 39 |
static Array<Job *> planned; |
| 40 |
static Array<Job *> running; |
| 41 |
|
| 42 |
static Array<Job *> all; |
| 43 |
|
| 44 |
static Threads::Mutex mutex; |
| 45 |
protected: |
| 46 |
BoCA::Config *configuration; |
| 47 |
|
| 48 |
Array<String> errors; |
| 49 |
Array<String> warnings; |
| 50 |
|
| 51 |
Bool waiting; |
| 52 |
Bool abort; |
| 53 |
public: |
| 54 |
Job(); |
| 55 |
virtual ~Job(); |
| 56 |
|
| 57 |
static String SecondsToString(UnsignedInt); |
| 58 |
|
| 59 |
virtual Int Paint(Int); |
| 60 |
|
| 61 |
Int Schedule(); |
| 62 |
|
| 63 |
Int RunPrecheck(); |
| 64 |
Int Run(); |
| 65 |
|
| 66 |
Int RequestAbort(); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
virtual Error Precheck(); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
virtual Bool ReadyToRun(); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
virtual Error Perform() = 0; |
| 81 |
accessors: |
| 82 |
Int SetText(const String &); |
| 83 |
|
| 84 |
Int SetProgress(Int); |
| 85 |
Int GetProgress() const; |
| 86 |
|
| 87 |
Bool IsWaiting() const { return waiting; } |
| 88 |
|
| 89 |
const Array<String> &GetErrors() const { return errors; } |
| 90 |
const Array<String> &GetWarnings() const { return warnings; } |
| 91 |
|
| 92 |
static const Array<Job *> &GetScheduledJobs() { return scheduled; } |
| 93 |
static const Array<Job *> &GetPlannedJobs() { return planned; } |
| 94 |
static const Array<Job *> &GetRunningJobs() { return running; } |
| 95 |
|
| 96 |
static const Array<Job *> &GetAllJobs() { return all; } |
| 97 |
slots: |
| 98 |
Void OnChangeSize(const Size &); |
| 99 |
|
| 100 |
Void OnDoubleClick(); |
| 101 |
Void OnClickToClose(); |
| 102 |
signals: |
| 103 |
static Signal0<Void> onChange; |
| 104 |
|
| 105 |
Signal0<Void> onRun; |
| 106 |
Signal0<Void> onFinish; |
| 107 |
|
| 108 |
static Signal1<Void, Job *> onPlanJob; |
| 109 |
static Signal1<Void, Job *> onRunJob; |
| 110 |
static Signal1<Void, Job *> onFinishJob; |
| 111 |
}; |
| 112 |
}; |
| 113 |
|
| 114 |
#endif |