mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-06 09:22:35 +00:00
Unify System (Dark) and System (Light) into a single theme
To update the icon color you have to switch to another theme then back to System
This commit is contained in:
parent
54927a8967
commit
b6f5751b23
@ -115,8 +115,7 @@ void MainWindow::CreateActions() {
|
||||
m_theme_act_group->addAction(ui->setThemeBlue);
|
||||
m_theme_act_group->addAction(ui->setThemeViolet);
|
||||
m_theme_act_group->addAction(ui->setThemeGruvbox);
|
||||
m_theme_act_group->addAction(ui->setThemeSystemDark);
|
||||
m_theme_act_group->addAction(ui->setThemeSystemLight);
|
||||
m_theme_act_group->addAction(ui->setThemeSystem);
|
||||
}
|
||||
|
||||
void MainWindow::AddUiWidgets() {
|
||||
@ -565,12 +564,12 @@ void MainWindow::CreateConnects() {
|
||||
isIconBlack = false;
|
||||
}
|
||||
});
|
||||
connect(ui->setThemeSystemDark, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::SystemDark, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::SystemDark));
|
||||
connect(ui->setThemeSystem, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::System, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::System));
|
||||
|
||||
bool isSystemDarkMode;
|
||||
#ifdef __linux__
|
||||
#ifdef __linux__
|
||||
const QPalette defaultPalette;
|
||||
const auto text = defaultPalette.color(QPalette::WindowText);
|
||||
const auto window = defaultPalette.color(QPalette::Window);
|
||||
@ -579,31 +578,23 @@ void MainWindow::CreateConnects() {
|
||||
} else {
|
||||
isSystemDarkMode = false;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if(QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark) {
|
||||
isSystemDarkMode = true;
|
||||
} else {
|
||||
isSystemDarkMode = false;
|
||||
}
|
||||
#endif
|
||||
if(isSystemDarkMode) {
|
||||
#endif
|
||||
if (isSystemDarkMode) {
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
}
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
}
|
||||
} else {
|
||||
if (!isIconBlack) {
|
||||
SetUiIcons(true);
|
||||
isIconBlack = true;
|
||||
SetUiIcons(true);
|
||||
isIconBlack = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(ui->setThemeSystemLight, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::SystemLight, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::SystemLight));
|
||||
if (!isIconBlack) {
|
||||
SetUiIcons(true);
|
||||
isIconBlack = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -984,14 +975,32 @@ void MainWindow::SetLastUsedTheme() {
|
||||
isIconBlack = false;
|
||||
SetUiIcons(false);
|
||||
break;
|
||||
case Theme::SystemDark:
|
||||
ui->setThemeSystemDark->setChecked(true);
|
||||
isIconBlack = false;
|
||||
SetUiIcons(false);
|
||||
break;
|
||||
case Theme::SystemLight:
|
||||
ui->setThemeLight->setChecked(true);
|
||||
isIconBlack = true;
|
||||
case Theme::System:
|
||||
ui->setThemeSystem->setChecked(true);
|
||||
bool isSystemDarkMode;
|
||||
#ifdef __linux__
|
||||
const QPalette defaultPalette;
|
||||
const auto text = defaultPalette.color(QPalette::WindowText);
|
||||
const auto window = defaultPalette.color(QPalette::Window);
|
||||
if (text.lightness() > window.lightness()) {
|
||||
isSystemDarkMode = true;
|
||||
} else {
|
||||
isSystemDarkMode = false;
|
||||
}
|
||||
#else
|
||||
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark) {
|
||||
isSystemDarkMode = true;
|
||||
} else {
|
||||
isSystemDarkMode = false;
|
||||
}
|
||||
#endif
|
||||
if (isSystemDarkMode = true) {
|
||||
isIconBlack = false;
|
||||
SetUiIcons(false);
|
||||
} else if (isSystemDarkMode = false) {
|
||||
isIconBlack = true;
|
||||
SetUiIcons(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -151,16 +151,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
|
||||
themePalette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
qApp->setPalette(themePalette);
|
||||
break;
|
||||
case Theme::SystemDark:
|
||||
mw_searchbar->setStyleSheet("QLineEdit {"
|
||||
"border: 1px solid;"
|
||||
"border-radius: 4px; padding: 5px; }"
|
||||
"QLineEdit:focus {"
|
||||
"border: 1px solid; }");
|
||||
qApp->setPalette(s_system_palette);
|
||||
qApp->setStyleSheet(QString());
|
||||
break;
|
||||
case Theme::SystemLight:
|
||||
case Theme::System:
|
||||
mw_searchbar->setStyleSheet("QLineEdit {"
|
||||
"border: 1px solid;"
|
||||
"border-radius: 4px; padding: 5px; }"
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QStyleFactory>
|
||||
#include <QWidget>
|
||||
|
||||
enum class Theme : int { Dark, Light, Green, Blue, Violet, Gruvbox, SystemDark, SystemLight };
|
||||
enum class Theme : int { Dark, Light, Green, Blue, Violet, Gruvbox, System };
|
||||
|
||||
class WindowThemes : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -37,8 +37,7 @@ public:
|
||||
QAction* setThemeBlue;
|
||||
QAction* setThemeViolet;
|
||||
QAction* setThemeGruvbox;
|
||||
QAction* setThemeSystemDark;
|
||||
QAction* setThemeSystemLight;
|
||||
QAction* setThemeSystem;
|
||||
QWidget* centralWidget;
|
||||
QLineEdit* mw_searchbar;
|
||||
QPushButton* playButton;
|
||||
@ -164,12 +163,9 @@ public:
|
||||
setThemeGruvbox = new QAction(MainWindow);
|
||||
setThemeGruvbox->setObjectName("setThemeGruvbox");
|
||||
setThemeGruvbox->setCheckable(true);
|
||||
setThemeSystemDark = new QAction(MainWindow);
|
||||
setThemeSystemDark->setObjectName("setThemeSystemDark");
|
||||
setThemeSystemDark->setCheckable(true);
|
||||
setThemeSystemLight = new QAction(MainWindow);
|
||||
setThemeSystemLight->setObjectName("setThemeSystemLight");
|
||||
setThemeSystemLight->setCheckable(true);
|
||||
setThemeSystem = new QAction(MainWindow);
|
||||
setThemeSystem->setObjectName("setThemeSystem");
|
||||
setThemeSystem->setCheckable(true);
|
||||
centralWidget = new QWidget(MainWindow);
|
||||
centralWidget->setObjectName("centralWidget");
|
||||
sizePolicy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth());
|
||||
@ -295,8 +291,7 @@ public:
|
||||
menuThemes->addAction(setThemeBlue);
|
||||
menuThemes->addAction(setThemeViolet);
|
||||
menuThemes->addAction(setThemeGruvbox);
|
||||
menuThemes->addAction(setThemeSystemDark);
|
||||
menuThemes->addAction(setThemeSystemLight);
|
||||
menuThemes->addAction(setThemeSystem);
|
||||
menuGame_List_Icons->addAction(setIconSizeTinyAct);
|
||||
menuGame_List_Icons->addAction(setIconSizeSmallAct);
|
||||
menuGame_List_Icons->addAction(setIconSizeMediumAct);
|
||||
@ -384,10 +379,8 @@ public:
|
||||
setThemeBlue->setText(QCoreApplication::translate("MainWindow", "Blue", nullptr));
|
||||
setThemeViolet->setText(QCoreApplication::translate("MainWindow", "Violet", nullptr));
|
||||
setThemeGruvbox->setText("Gruvbox");
|
||||
setThemeSystemDark->setText(
|
||||
QCoreApplication::translate("MainWindow", "System (Dark)", nullptr));
|
||||
setThemeSystemLight->setText(
|
||||
QCoreApplication::translate("MainWindow", "System (Light)", nullptr));
|
||||
setThemeSystem->setText(
|
||||
QCoreApplication::translate("MainWindow", "System", nullptr));
|
||||
toolBar->setWindowTitle(QCoreApplication::translate("MainWindow", "toolBar", nullptr));
|
||||
} // retranslateUi
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user