mirror of https://github.com/PCSX2/pcsx2.git
Qt: Calculate icon theme from palette instead of name
This commit is contained in:
parent
6b66cd7f29
commit
dbfb93a50f
|
@ -88,10 +88,10 @@ MainWindow::~MainWindow()
|
||||||
|
|
||||||
void MainWindow::initialize()
|
void MainWindow::initialize()
|
||||||
{
|
{
|
||||||
setIconThemeFromSettings();
|
setStyleFromSettings();
|
||||||
|
setIconThemeFromStyle();
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
setupAdditionalUi();
|
setupAdditionalUi();
|
||||||
setStyleFromSettings();
|
|
||||||
connectSignals();
|
connectSignals();
|
||||||
connectVMThreadSignals(g_emu_thread);
|
connectVMThreadSignals(g_emu_thread);
|
||||||
|
|
||||||
|
@ -549,17 +549,11 @@ void MainWindow::setStyleFromSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setIconThemeFromSettings()
|
void MainWindow::setIconThemeFromStyle()
|
||||||
{
|
{
|
||||||
const std::string theme(Host::GetBaseStringSettingValue("UI", "Theme", DEFAULT_THEME_NAME));
|
QPalette palette = qApp->palette();
|
||||||
QString icon_theme;
|
bool dark = palette.windowText().color().value() > palette.window().color().value();
|
||||||
|
QIcon::setThemeName(dark ? QStringLiteral("white") : QStringLiteral("black"));
|
||||||
if (theme == "darkfusion" || theme == "darkfusionblue" || theme == "dualtoneOrangeBlue" || theme == "ScarletDevilRed")
|
|
||||||
icon_theme = QStringLiteral("white");
|
|
||||||
else
|
|
||||||
icon_theme = QStringLiteral("black");
|
|
||||||
|
|
||||||
QIcon::setThemeName(icon_theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onScreenshotActionTriggered()
|
void MainWindow::onScreenshotActionTriggered()
|
||||||
|
@ -1219,7 +1213,7 @@ void MainWindow::onToolsOpenDataDirectoryTriggered()
|
||||||
void MainWindow::onThemeChanged()
|
void MainWindow::onThemeChanged()
|
||||||
{
|
{
|
||||||
setStyleFromSettings();
|
setStyleFromSettings();
|
||||||
setIconThemeFromSettings();
|
setIconThemeFromStyle();
|
||||||
recreate();
|
recreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ private:
|
||||||
void setupAdditionalUi();
|
void setupAdditionalUi();
|
||||||
void connectSignals();
|
void connectSignals();
|
||||||
void setStyleFromSettings();
|
void setStyleFromSettings();
|
||||||
void setIconThemeFromSettings();
|
void setIconThemeFromStyle();
|
||||||
|
|
||||||
void saveStateToConfig();
|
void saveStateToConfig();
|
||||||
void restoreStateFromConfig();
|
void restoreStateFromConfig();
|
||||||
|
|
Loading…
Reference in New Issue