welcome dialog's logic provided only on one connect

This commit is contained in:
digant 2024-12-05 22:08:55 +01:00
parent fa40175644
commit 32afdf22f1
3 changed files with 5 additions and 17 deletions

View file

@ -161,15 +161,6 @@ bool gui_application::Init()
{
welcome_dialog* welcome = new welcome_dialog(m_gui_settings, false);
connect(welcome, &QDialog::finished, this, [&]()
{
if (welcome->use_dark_theme())
{
m_gui_settings->SetValue(gui::m_currentStylesheet, gui::DarkStylesheet);
}
});
// welcome dialog is auto-flagged (in its constructor) as WA_DeleteOnClose, so its pointer is no more usable after welcome->exec()
welcome->exec();
}

View file

@ -15,7 +15,6 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
: QDialog(parent)
, ui(new Ui::welcome_dialog)
, m_gui_settings(std::move(gui_settings))
, m_use_dark_theme(gui::utils::dark_mode_active())
{
ui->setupUi(this);
@ -28,7 +27,7 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
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(m_use_dark_theme);
ui->use_dark_theme->setChecked(gui::utils::dark_mode_active());
ui->icon_label->load(QStringLiteral(":/rpcs3.svg"));
ui->label_3->setText(tr(
R"(
@ -90,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_use_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);
}
});
}

View file

@ -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 use_dark_theme() const
{
return m_use_dark_theme;
}
private:
std::unique_ptr<Ui::welcome_dialog> ui;
std::shared_ptr<gui_settings> m_gui_settings;
bool m_use_dark_theme;
};