35 lines
897 B
C++
35 lines
897 B
C++
#pragma once
|
|
|
|
#include <ctime>
|
|
#include <set>
|
|
#include <string>
|
|
|
|
#include "Database.h"
|
|
#include "Status.h"
|
|
|
|
enum class AccountLevel { Busy, Free };
|
|
|
|
struct DisplaySettings {
|
|
bool showTasks = true; // auto-print the task table after each change
|
|
bool showAccounts = true; // auto-print the account table after each change
|
|
std::set<StatusKind> hiddenTaskLevels;
|
|
std::set<AccountLevel> hiddenAccountLevels;
|
|
};
|
|
|
|
// Builds the computed views. The status shown is derived from the stored
|
|
// status and the current time, never copied straight from the database.
|
|
class Display {
|
|
public:
|
|
explicit Display(const Database& db);
|
|
|
|
DisplaySettings& settings();
|
|
const DisplaySettings& settings() const;
|
|
|
|
std::string renderTasks(std::time_t now) const;
|
|
std::string renderAccounts(std::time_t now) const;
|
|
|
|
private:
|
|
const Database& db_;
|
|
DisplaySettings settings_;
|
|
};
|