FIX:fixed appconfig is not saved when switching dark mode

Change-Id: I77fc3808309a23497000c34b6047a359d12c4622
This commit is contained in:
tao wang 2022-11-29 22:29:44 +08:00 committed by Lane.Wei
parent 4a5c473058
commit eca5897a25
22 changed files with 84 additions and 26 deletions

View file

@ -386,7 +386,7 @@ wxBoxSizer *PreferencesDialog::create_item_backup_input(wxString title, wxWindow
input_title->Wrap(-1);
auto input = new ::TextInput(parent, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, DESIGN_INPUT_SIZE, wxTE_PROCESS_ENTER);
StateColor input_bg(std::pair<wxColour, int>(wxColour("#F0F0F1"), StateColor::Disabled));
StateColor input_bg(std::pair<wxColour, int>(wxColour("#F0F0F1"), StateColor::Disabled), std::pair<wxColour, int>(*wxWHITE, StateColor::Enabled));
input->SetBackgroundColor(input_bg);
input->GetTextCtrl()->SetValue(app_config->get(param));
@ -840,8 +840,11 @@ wxWindow* PreferencesDialog::create_general_page()
auto item_downloads = create_item_downloads(page,50,"download_path");
//dark mode
#ifdef _WIN32
auto title_darkmode = create_item_title(_L("Dark Mode"), page, _L("Dark Mode"));
auto item_darkmode = create_item_darkmode_checkbox(_L("Enable Dark mode"), page,_L("Enable Dark mode"), 50, "dark_color_mode");
#endif
sizer_page->Add(title_general_settings, 0, wxEXPAND, 0);
sizer_page->Add(item_language, 0, wxTOP, FromDIP(3));
@ -863,8 +866,10 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(title_downloads, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_downloads, 0, wxEXPAND, FromDIP(3));
#ifdef _WIN32
sizer_page->Add(title_darkmode, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_darkmode, 0, wxEXPAND, FromDIP(3));
#endif
page->SetSizer(sizer_page);