fix(ui): apply the saved appearance settings at startup
Low-spec mode, theme effects, blur, UI and noise opacity and the console scanline reached the live effects state only once the Settings page or the first-run wizard was opened. "Effects off" and low-spec therefore reverted at every launch, and the animated defaults kept the main loop busy (91% of a core on an idle Lite wallet whose effects were saved off). - App::applyVisualSettings(): one low-spec-aware path from the saved prefs to the effects state, used at startup (after the skin, since setActiveSkin reloads the effect config), by the low-spec hotkey, the wizard and the Settings page. - Low-spec stays a runtime-only override. The Settings page shows the overrides but persists the real prefs from its snapshot, and opening it under low-spec no longer turns theme effects and blur back on. Unticking a low-spec in the wizard that was loaded rather than ticked there now restores the saved prefs. - Theme effects on/off always pairs with reduced transparency (the rainbow, shimmer and glare layers), as at startup and in the hotkeys. - kAcrylicMaxBlur moves to imgui_acrylic.h, so startup clamps blur values saved in the old 0-4 range the way the slider does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+39
-21
@@ -491,6 +491,12 @@ bool App::init()
|
||||
skinMgr.setActiveSkin(skinId);
|
||||
}
|
||||
|
||||
// Apply the saved appearance prefs (low-spec, theme effects, blur, opacity, noise). Until now they
|
||||
// only took effect once the Settings page or wizard was opened, so "effects off" / low-spec reverted
|
||||
// at every launch and the animated defaults kept the main loop rendering continuously. After the
|
||||
// skin, because setActiveSkin reloads the effect config (not the enabled flag).
|
||||
applyVisualSettings();
|
||||
|
||||
// Apply saved language
|
||||
std::string lang = settings_->getLanguage();
|
||||
if (!lang.empty()) {
|
||||
@@ -583,6 +589,31 @@ bool App::init()
|
||||
// ============================================================================
|
||||
// Pre-frame: font atlas rebuilds (must run BEFORE ImGui::NewFrame)
|
||||
// ============================================================================
|
||||
void App::applyVisualSettings()
|
||||
{
|
||||
if (!settings_) return;
|
||||
namespace fx = ui::effects;
|
||||
const bool lowSpec = settings_->getLowSpecMode();
|
||||
fx::setLowSpecMode(lowSpec);
|
||||
if (lowSpec) {
|
||||
// Low-spec overrides the heavy effects at runtime only; the saved prefs stay as they are so
|
||||
// turning low-spec off restores them.
|
||||
fx::ImGuiAcrylic::ApplyBlurAmount(0.0f);
|
||||
fx::ImGuiAcrylic::SetUIOpacity(1.0f);
|
||||
fx::ThemeEffects::instance().setEnabled(false);
|
||||
fx::ThemeEffects::instance().setReducedTransparency(true);
|
||||
ui::ConsoleTab::s_scanline_enabled = false;
|
||||
} else {
|
||||
const bool effects = settings_->getThemeEffectsEnabled();
|
||||
fx::ImGuiAcrylic::ApplyBlurAmount(std::min(settings_->getBlurMultiplier(), fx::kAcrylicMaxBlur));
|
||||
fx::ImGuiAcrylic::SetUIOpacity(settings_->getUIOpacity());
|
||||
fx::ThemeEffects::instance().setEnabled(effects);
|
||||
fx::ThemeEffects::instance().setReducedTransparency(!effects);
|
||||
ui::ConsoleTab::s_scanline_enabled = settings_->getScanlineEnabled();
|
||||
}
|
||||
fx::ImGuiAcrylic::SetNoiseOpacity(settings_->getNoiseOpacity());
|
||||
}
|
||||
|
||||
void App::preFrame()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
@@ -1465,28 +1496,15 @@ void App::handleGlobalShortcuts()
|
||||
// (checked BEFORE Ctrl+Down so it doesn't also trigger theme effects)
|
||||
if (io.KeyCtrl && io.KeyShift && !io.WantTextInput && ImGui::IsKeyPressed(ImGuiKey_DownArrow)) {
|
||||
bool newLow = !ui::effects::isLowSpecMode();
|
||||
ui::effects::setLowSpecMode(newLow);
|
||||
if (newLow) {
|
||||
// Disable all heavy effects at runtime (don't overwrite saved prefs)
|
||||
ui::effects::ImGuiAcrylic::ApplyBlurAmount(0.0f);
|
||||
ui::effects::ImGuiAcrylic::SetUIOpacity(1.0f);
|
||||
ui::effects::ThemeEffects::instance().setEnabled(false);
|
||||
ui::effects::ThemeEffects::instance().setReducedTransparency(true);
|
||||
if (settings_) {
|
||||
settings_->setLowSpecMode(true);
|
||||
settings_->setWindowOpacity(1.0f);
|
||||
settings_->save();
|
||||
}
|
||||
if (settings_) {
|
||||
// Persist the mode (and the opaque window low-spec implies) but not the effect prefs:
|
||||
// applyVisualSettings overrides them at runtime, so turning low-spec off restores them.
|
||||
settings_->setLowSpecMode(newLow);
|
||||
if (newLow) settings_->setWindowOpacity(1.0f);
|
||||
settings_->save();
|
||||
applyVisualSettings();
|
||||
} else {
|
||||
// Restore effect settings from saved preferences
|
||||
if (settings_) {
|
||||
settings_->setLowSpecMode(false);
|
||||
settings_->save();
|
||||
ui::effects::ImGuiAcrylic::ApplyBlurAmount(settings_->getBlurMultiplier());
|
||||
ui::effects::ImGuiAcrylic::SetUIOpacity(settings_->getUIOpacity());
|
||||
ui::effects::ThemeEffects::instance().setEnabled(settings_->getThemeEffectsEnabled());
|
||||
ui::effects::ThemeEffects::instance().setReducedTransparency(!settings_->getThemeEffectsEnabled());
|
||||
}
|
||||
ui::effects::setLowSpecMode(newLow);
|
||||
}
|
||||
ui::Notifications::instance().info(newLow ? TR("appx_low_spec_mode_enabled") : TR("appx_low_spec_mode_disabled"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user