feat(console): persist accent toggle + add monochrome-text toggle
Persist the two console output display preferences and add a second toolbar toggle for monochrome text. - Persistence: new Settings fields console_line_accents / console_text_color (both default true, matching the ConsoleTab statics so an upgrade re-save can't flip visible behavior). Restored into the statics at startup in the App constructor, and saved from a diff-and-save after the console renders (only when a value actually changed — save() is disk I/O). The startup restore also fixes a pre-existing bug: scanline was only synced from settings when the Settings page or first-run wizard ran, so an existing wallet ignored a saved scanline preference on launch. - Monochrome text: a new toolbar toggle (FORMAT_COLOR_TEXT, dimmed when off) next to the accent toggle. channelTextColor() early-returns the neutral COLOR_RESULT for every channel (and JSON syntax role) when off, leaving the left accent bars independent. COLOR_RESULT is contrast-floored per theme, so text stays readable on light and dark terminals. Adds console_toggle_text_color to the English source + all 8 translations. Verified: both toggles independent, persistence round-trips across restart, monochrome readable on light + dark skins. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
18
src/app.cpp
18
src/app.cpp
@@ -307,6 +307,13 @@ bool App::init()
|
||||
// Apply verbose logging preference from saved settings
|
||||
util::Logger::instance().setVerbose(settings_->getVerboseLogging());
|
||||
|
||||
// Restore console display preferences into the ConsoleTab statics at startup. These are the only
|
||||
// startup restore for these toggles — the Settings page / first-run wizard also sync scanline, but
|
||||
// only when visited, so without this an existing wallet would ignore a saved preference on launch.
|
||||
ui::ConsoleTab::s_scanline_enabled = settings_->getScanlineEnabled();
|
||||
ui::ConsoleTab::s_line_accents_enabled = settings_->getConsoleLineAccents();
|
||||
ui::ConsoleTab::s_line_text_color_enabled = settings_->getConsoleTextColor();
|
||||
|
||||
// Apply saved user font scale so fonts are correct on first reload
|
||||
{
|
||||
float fs = settings_->getFontScale();
|
||||
@@ -1786,6 +1793,17 @@ void App::render()
|
||||
console_exec_ = std::make_unique<ui::FullNodeConsoleExecutor>(this);
|
||||
}
|
||||
console_tab_.render(*console_exec_);
|
||||
// Persist the console toolbar toggles (ConsoleTab has no settings pointer). Save only when
|
||||
// a value actually changed — this runs every frame the console is visible and save() is
|
||||
// disk I/O — and only here in the Console case where these statics can change.
|
||||
if (settings_) {
|
||||
if (ui::ConsoleTab::s_line_accents_enabled != settings_->getConsoleLineAccents() ||
|
||||
ui::ConsoleTab::s_line_text_color_enabled != settings_->getConsoleTextColor()) {
|
||||
settings_->setConsoleLineAccents(ui::ConsoleTab::s_line_accents_enabled);
|
||||
settings_->setConsoleTextColor(ui::ConsoleTab::s_line_text_color_enabled);
|
||||
settings_->save();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ui::NavPage::Settings:
|
||||
ui::RenderSettingsPage(this);
|
||||
|
||||
Reference in New Issue
Block a user