Public Access
Fn+p saves the screen as it is to /screenshots, as the Shell's `screenshot` does, from anywhere: text fields, dialogs and the help panel included. The key never reaches an App. It refuses on Settings > Debug Console, which shows the token: a picture of that page is a copy of the token in a file (App::showsSecret). `key shot` presses it over the consoles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
81 lines
2.4 KiB
C++
81 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "app.h"
|
|
#include "app_manager.h"
|
|
#include "dialog_model.h"
|
|
#include "event_bus.h"
|
|
#include "line_editor.h"
|
|
#include "list_model.h"
|
|
#include "services/battery_service.h"
|
|
#include "services/clock_service.h"
|
|
#include "services/storage_service.h"
|
|
#include "apps/debug_console_page.h"
|
|
#include "apps/firmware_page.h"
|
|
#include "apps/wifi_settings_page.h"
|
|
#include "settings_menu.h"
|
|
#include "ui/theme.h"
|
|
|
|
namespace roro {
|
|
|
|
struct SettingsAppDeps {
|
|
Settings& settings;
|
|
EventBus& bus;
|
|
AppManager& apps;
|
|
BatteryService& battery;
|
|
StorageService& storage;
|
|
ClockService& clock;
|
|
WifiService& wifi;
|
|
SavedNetworks& savedNetworks;
|
|
UpdateService& update;
|
|
};
|
|
|
|
// Settings: every user-facing setting, plus the Wi-Fi, Firmware, Debug Console and About pages.
|
|
class SettingsApp : public App {
|
|
public:
|
|
explicit SettingsApp(const SettingsAppDeps& deps)
|
|
: d_(deps),
|
|
menu_(deps.settings),
|
|
wifiPage_(deps.settings, deps.savedNetworks, deps.wifi, deps.bus),
|
|
firmwarePage_(deps.update, deps.wifi, deps.storage),
|
|
debugPage_(deps.settings, deps.wifi) {}
|
|
void onEnter() override;
|
|
bool onKey(const KeyEvent& e) override;
|
|
void update(uint32_t nowMs) override;
|
|
bool textEntryActive() const override {
|
|
return page_ == Page::Text || (page_ == Page::Wifi && wifiPage_.textEntryActive()) ||
|
|
(page_ == Page::Debug && debugPage_.textEntryActive());
|
|
}
|
|
void draw(Canvas& c) override;
|
|
void help(std::vector<KeyHelp>& out) const override;
|
|
const char* helpTitle() const override;
|
|
bool showsSecret() const override { return page_ == Page::Debug; } // the Debug Console's token
|
|
|
|
private:
|
|
enum class Page { Menu, Text, Choice, About, Wifi, Firmware, Debug };
|
|
|
|
bool onMenuKey(const KeyEvent& e);
|
|
bool onTextKey(const KeyEvent& e);
|
|
bool onChoiceKey(const KeyEvent& e);
|
|
bool onAboutKey(const KeyEvent& e);
|
|
void warn(const std::string& text);
|
|
std::vector<std::string> aboutLines() const;
|
|
|
|
SettingsAppDeps d_;
|
|
SettingsMenu menu_;
|
|
WifiSettingsPage wifiPage_;
|
|
FirmwarePage firmwarePage_;
|
|
DebugConsolePage debugPage_;
|
|
Page page_ = Page::Menu;
|
|
ListModel list_{theme::kContent.h / theme::kLineHeight};
|
|
ListModel choices_{theme::kContent.h / theme::kLineHeight};
|
|
LineEditor editor_{39};
|
|
int editingRow_ = 0;
|
|
uint32_t lastRefreshMs_ = 0;
|
|
};
|
|
|
|
} // namespace roro
|