FIX:optimized some ui for macos

Change-Id: I0451edc06d9dadfef3b9d1087bb863b4666bb276
This commit is contained in:
tao wang 2022-12-12 16:34:40 +08:00 committed by Lane.Wei
parent 5c9c72ee72
commit 8713c5ccc4
6 changed files with 15 additions and 3 deletions

View file

@ -2130,6 +2130,7 @@ bool GUI_App::on_init_inner()
// initialize label colors and fonts
init_label_colours();
init_fonts();
wxGetApp().Update_dark_mode_flag();
#ifdef _MSW_DARK_MODE
@ -2721,8 +2722,9 @@ void GUI_App::UpdateDarkUI(wxWindow* window, bool highlited/* = false*/, bool ju
return;
}
if (m_is_dark_mode != dark_mode() )
m_is_dark_mode = dark_mode();
/*if (m_is_dark_mode != dark_mode() )
m_is_dark_mode = dark_mode();*/
if (m_is_dark_mode) {
@ -2778,6 +2780,11 @@ void GUI_App::UpdateDarkUIWin(wxWindow* win)
update_dark_children_ui(win);
}
void GUI_App::Update_dark_mode_flag()
{
m_is_dark_mode = dark_mode();
}
void GUI_App::UpdateDlgDarkUI(wxDialog* dlg)
{
#ifdef __WINDOWS__

View file

@ -324,6 +324,7 @@ public:
// update color mode for window
void UpdateDarkUI(wxWindow *window, bool highlited = false, bool just_font = false);
void UpdateDarkUIWin(wxWindow* win);
void Update_dark_mode_flag();
// update color mode for whole dialog including all children
void UpdateDlgDarkUI(wxDialog* dlg);
void UpdateFrameDarkUI(wxFrame* dlg);

View file

@ -273,6 +273,7 @@ void update_dark_config()
wxSystemAppearance app = wxSystemSettings::GetAppearance();
GUI::wxGetApp().app_config->set("dark_color_mode", app.IsDark() ? "1" : "0");
GUI::wxGetApp().app_config->save();
wxGetApp().Update_dark_mode_flag();
}

View file

@ -1911,7 +1911,7 @@ static wxMenu* generate_help_menu()
static void add_common_publish_menu_items(wxMenu* publish_menu, MainFrame* mainFrame)
{
#ifdef __APPLE__ || __LINUX__
#ifndef __WINDOWS__
append_menu_item(publish_menu, wxID_ANY, _L("Upload Models"), _L("Upload Models"),
[](wxCommandEvent&) {
if (!wxGetApp().getAgent()) {

View file

@ -491,6 +491,7 @@ wxBoxSizer* PreferencesDialog::create_item_darkmode_checkbox(wxString title, wxW
checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, checkbox, param](wxCommandEvent& e) {
app_config->set(param, checkbox->GetValue() ? "1" : "0");
app_config->save();
wxGetApp().Update_dark_mode_flag();
//dark mode
#ifdef _MSW_DARK_MODE

View file

@ -113,6 +113,8 @@ ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_AN
//Param
m_AutotestToken = "";
wxGetApp().UpdateDlgDarkUI(this);
}
ZUserLogin::~ZUserLogin() {