diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index e41ee9ce69..02e55416e3 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -161,19 +161,7 @@ bool gui_application::Init() { welcome_dialog* welcome = new welcome_dialog(m_gui_settings, false); - bool use_dark_theme = false; - - connect(welcome, &QDialog::accepted, this, [&]() - { - use_dark_theme = welcome->does_user_want_dark_theme(); - }); - welcome->exec(); - - if (use_dark_theme) - { - m_gui_settings->SetValue(gui::m_currentStylesheet, "Darker Style by TheMitoSan"); - } } // Check maxfiles diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index 98835431b5..7a3b3535a3 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -87,10 +87,11 @@ namespace gui return q_string_pair(path, title.simplified()); // simplified() forces single line text } - const QString Settings = "CurrentSettings"; + const QString Settings = "CurrentSettings"; const QString DefaultStylesheet = "default"; - const QString NoStylesheet = "none"; - const QString NativeStylesheet = "native"; + const QString NoStylesheet = "none"; + const QString NativeStylesheet = "native"; + const QString DarkStylesheet = "Darker Style by TheMitoSan"; const QString main_window = "main_window"; const QString game_list = "GameList"; diff --git a/rpcs3/rpcs3qt/qt_utils.h b/rpcs3/rpcs3qt/qt_utils.h index 11e4341927..fbac5270f5 100644 --- a/rpcs3/rpcs3qt/qt_utils.h +++ b/rpcs3/rpcs3qt/qt_utils.h @@ -150,11 +150,13 @@ namespace gui static inline Qt::ColorScheme color_scheme() { + // use the QGuiApplication's properties to report the default GUI color scheme return QGuiApplication::styleHints()->colorScheme(); } static inline bool dark_mode_active() { + // "true" if the default GUI color scheme is dark. "false" otherwise return color_scheme() == Qt::ColorScheme::Dark; } diff --git a/rpcs3/rpcs3qt/welcome_dialog.cpp b/rpcs3/rpcs3qt/welcome_dialog.cpp index 0dce4ecd4c..00860f58a5 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.cpp +++ b/rpcs3/rpcs3qt/welcome_dialog.cpp @@ -22,10 +22,11 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool setWindowFlag(Qt::WindowCloseButtonHint, is_manual_show); ui->okay->setEnabled(is_manual_show); - ui->i_have_read->setChecked(is_manual_show); ui->i_have_read->setEnabled(!is_manual_show); + ui->i_have_read->setChecked(is_manual_show); ui->do_not_show->setEnabled(!is_manual_show); ui->do_not_show->setChecked(!m_gui_settings->GetValue(gui::ib_show_welcome).toBool()); + ui->use_dark_theme->setEnabled(!is_manual_show); ui->use_dark_theme->setChecked(gui::utils::dark_mode_active()); ui->icon_label->load(QStringLiteral(":/rpcs3.svg")); ui->label_3->setText(tr( @@ -76,7 +77,7 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool layout()->setSizeConstraint(QLayout::SetFixedSize); - connect(this, &QDialog::finished, this, [this]() + connect(this, &QDialog::accepted, this, [this]() { if (ui->create_desktop_shortcut->isChecked()) { @@ -88,7 +89,10 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool gui::utils::create_shortcut("RPCS3", "", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::applications); } - m_user_wants_dark_theme = ui->use_dark_theme->isChecked(); + if (ui->use_dark_theme->isChecked() && ui->use_dark_theme->isEnabled()) // if checked and also on initial welcome dialog + { + m_gui_settings->SetValue(gui::m_currentStylesheet, gui::DarkStylesheet); + } }); } diff --git a/rpcs3/rpcs3qt/welcome_dialog.h b/rpcs3/rpcs3qt/welcome_dialog.h index 6e32117e2c..3f04cfdb9f 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.h +++ b/rpcs3/rpcs3qt/welcome_dialog.h @@ -17,12 +17,7 @@ public: explicit welcome_dialog(std::shared_ptr gui_settings, bool is_manual_show, QWidget* parent = nullptr); ~welcome_dialog(); - bool does_user_want_dark_theme() const - { - return m_user_wants_dark_theme; - } private: std::unique_ptr ui; std::shared_ptr m_gui_settings; - bool m_user_wants_dark_theme = false; };