#pragma once #include #include #include "cleanup_plan.h" #include "dialog_model.h" #include "key_help.h" #include "event_bus.h" #include "key_event.h" #include "list_model.h" #include "services/clock_service.h" #include "services/storage_service.h" #include "ui/canvas.h" #include "ui/theme.h" namespace roro { // Storage → Maintenance: card usage, Storage Clean-up (category → age → confirm) and erasing the card. class MaintenancePage { public: MaintenancePage(StorageService& storage, ClockService& clock, EventBus& bus) : storage_(storage), clock_(clock), bus_(bus) {} void enter(); bool onKey(const KeyEvent& e); // false: leave the page void draw(Canvas& c); void help(std::vector& out) const; private: enum class View { Main, Categories, Ages }; enum Row { kCard, kLogs, kCaptures, kCleanUp, kErase, kRows }; CleanupPlan planFor(int age) const; uint64_t categoryBytes(int category) const; void warn(const char* text); StorageService& storage_; ClockService& clock_; EventBus& bus_; View view_ = View::Main; ListModel main_{theme::kContent.h / theme::kLineHeight}; ListModel categories_{theme::kContent.h / theme::kLineHeight}; ListModel ages_{theme::kContent.h / theme::kLineHeight}; std::vector> listing_; bool haveListing_ = false; std::unique_ptr dialog_; CleanupPlan pending_; }; } // namespace roro