Your branch is up to date with 'origin/main'. Accounts: the account panel now sorts from most free to least free. Fewer Busy tasks come first, and ties go alphabetically. Tasks: they now sort by status, then account A–Z, then wait time, then task name. Status order: Limit reset, Testing, Prompt, Wait, Uploading, Frozen, Done. Account order: it ignores case. Tasks with no account come last in their status group. Wait time: it only matters among tasks that have the same status and the same account. Changes to be committed: modified: README.md modified: include/Status.h modified: include/StringUtil.h modified: src/Display.cpp modified: src/Status.cpp modified: src/StringUtil.cpp
42 lines
1.5 KiB
C++
42 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <ctime>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// Prompt: free to accept prompts.
|
|
// LimitReset: computed - a Wait whose time has passed (can also be set by hand).
|
|
enum class StatusKind { Prompt, LimitReset, Testing, Wait, Uploading, Frozen, Done };
|
|
|
|
struct Status {
|
|
StatusKind kind = StatusKind::Prompt;
|
|
std::time_t waitUntil = 0; // only meaningful when kind == Wait
|
|
};
|
|
|
|
namespace StatusUtil {
|
|
|
|
Status make(StatusKind kind);
|
|
|
|
// User input such as "testing" or "wait 16:30". A wait time that has already
|
|
// passed today is taken to mean tomorrow.
|
|
std::optional<Status> parse(const std::string& text, std::time_t now);
|
|
|
|
// Database representation, e.g. "testing" or "wait 2026-10-17T16:30".
|
|
std::string serialize(const Status& status);
|
|
std::optional<Status> deserialize(const std::string& text);
|
|
|
|
// The status shown to the user: an expired wait becomes LimitReset.
|
|
Status effective(const Status& status, std::time_t now);
|
|
|
|
std::string label(const Status& status); // "Prompt", "Limit reset", "Wait 16:30", ...
|
|
std::string kindName(StatusKind kind); // lowercase token: "prompt", "limit-reset", ...
|
|
std::vector<StatusKind> allKinds();
|
|
// Accepts "limit-reset", "limit_reset", "limitreset", "reset"; "available" is an
|
|
// old name for "prompt".
|
|
std::optional<StatusKind> kindFromName(const std::string& name);
|
|
int rank(StatusKind kind); // task sort priority, lowest first
|
|
bool isBusy(StatusKind kind); // does this status hold the account?
|
|
|
|
} // namespace StatusUtil
|