Status system reworked
This commit is contained in:
1 parent
33567db5a3
commit
a29ba6e4d2
18 files changed
+326
-345
No files matched your search
+13
-9
@@ -12,34 +12,38 @@
|
||||
// How taken an account is, judged by its tasks:
|
||||
// Free - only Done, Frozen or Uploading tasks, or no tasks
|
||||
// Taken - has a Prompt task (and nothing Busy)
|
||||
// Busy - has a Testing, Limit reset or Wait task, or a wait nothing else shows
|
||||
// Busy - has a Testing, Limit reset or Wait task, or is waiting itself
|
||||
enum class AccountLevel { Busy, Taken, Free };
|
||||
|
||||
std::string accountLevelName(AccountLevel level); // "busy", "taken", "free"
|
||||
|
||||
enum class WaitState { None, Waiting, LimitReset };
|
||||
// An account waits from the moment it hits its limit until the wait time; after
|
||||
// that it is not waiting any more (its Wait tasks are then Limit reset).
|
||||
enum class WaitState { None, Waiting };
|
||||
|
||||
// A task as the user sees it: the status is computed from the stored status,
|
||||
// the account's wait and the current time.
|
||||
struct TaskInfo {
|
||||
std::string name;
|
||||
std::optional<std::string> account;
|
||||
Status status; // as shown (Wait / Limit reset come from the account)
|
||||
Status status; // as shown (a Wait task becomes Limit reset when its account's wait ends)
|
||||
Status storedStatus; // what is saved underneath
|
||||
// What the panel shows: "Wait 16:30", "Limit reset", "Testing (account-waiting)"...
|
||||
std::string statusLabel;
|
||||
// Prompt / Testing while its account waits: shown as they are, with
|
||||
// "(account-waiting)" appended.
|
||||
bool accountWaiting = false;
|
||||
std::string notes;
|
||||
std::size_t noteLines = 0;
|
||||
// Set to Testing / Prompt while its account waits: it shows its own status
|
||||
// and ignores the wait, while the account's other tasks keep following it.
|
||||
bool overridesWait = false;
|
||||
};
|
||||
|
||||
struct AccountInfo {
|
||||
std::string name;
|
||||
AccountLevel level = AccountLevel::Free;
|
||||
WaitState waitState = WaitState::None;
|
||||
std::time_t waitUntil = 0; // when the wait ends (or ended); 0 if none
|
||||
// True when the account has a wait that none of its tasks shows (it has no
|
||||
// tasks, or only Done / Frozen / Uploading ones). It still makes the account Busy.
|
||||
std::time_t waitUntil = 0; // when the wait ends; 0 if it is not waiting
|
||||
// True when the account is waiting but none of its tasks is set to Wait
|
||||
// (e.g. it has no tasks). It still makes the account Busy.
|
||||
bool waitListed = false;
|
||||
std::vector<std::string> tasks; // tasks at the account's level (Free: its Uploading/Frozen/Done ones)
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user