mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-15 22:21:25 +00:00
fix dark theme switching on initial welcome dialog (#16373)
This commit is contained in:
parent
05d12f68ad
commit
24655fd975
@ -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
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,11 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> 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> 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> 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,7 @@ public:
|
||||
explicit welcome_dialog(std::shared_ptr<gui_settings> 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::welcome_dialog> ui;
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
bool m_user_wants_dark_theme = false;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user