1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Welcome Dialog: Add ability to set Dark Theme

This commit is contained in:
Eladash 2023-09-16 22:27:21 +03:00 committed by Elad Ashkenazi
parent 1e1d6f6437
commit ecb45ef6df
4 changed files with 31 additions and 0 deletions

View File

@ -135,10 +135,19 @@ bool gui_application::Init()
// Create connects to propagate events throughout Gui.
InitializeConnects();
bool set_dark_theme = false;
if (m_gui_settings->GetValue(gui::ib_show_welcome).toBool())
{
welcome_dialog* welcome = new welcome_dialog(m_gui_settings, false);
welcome->exec();
if (welcome->does_user_want_dark_theme())
{
m_gui_settings->SetValue(gui::m_currentStylesheet, "Darker Style by TheMitoSan");
}
m_gui_settings->sync();
}
// Check maxfiles

View File

@ -10,6 +10,13 @@
#include <QPushButton>
#include <QCheckBox>
#include <QSvgWidget>
#include <QStyleHints>
#include <QGuiApplication>
static bool recommend_dark_theme()
{
return QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark;
}
welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool is_manual_show, QWidget* parent)
: QDialog(parent)
@ -26,6 +33,7 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
ui->i_have_read->setEnabled(!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->setChecked(recommend_dark_theme());
ui->icon_label->load(QStringLiteral(":/rpcs3.svg"));
ui->label_3->setText(tr(
R"(
@ -85,6 +93,8 @@ 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();
});
}

View File

@ -17,7 +17,12 @@ 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;
};

View File

@ -198,6 +198,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="use_dark_theme">
<property name="text">
<string>Use Dark Theme (Can Be Configured Later)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">