summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMichael Maltese <mchtly@gmail.com>2017-06-05 00:15:15 -0700
committerMichael Maltese <mchtly@gmail.com>2017-06-05 17:04:29 -0700
commit6b084e21dc5aa25f8e5cea5bc54e477dd0b4a561 (patch)
tree191afd5ef631e4f50dc1c2adb3fa751343f01ee1 /Source/Core
parentd6db5151655f42298c1c9a8587489954e718a22f (diff)
SettingsWindow: update icons when theme changes
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt2/Config/SettingsWindow.cpp14
-rw-r--r--Source/Core/DolphinQt2/Config/SettingsWindow.h4
2 files changed, 12 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt2/Config/SettingsWindow.cpp b/Source/Core/DolphinQt2/Config/SettingsWindow.cpp
index 8cfc1d0d5c..eb906c9ed7 100644
--- a/Source/Core/DolphinQt2/Config/SettingsWindow.cpp
+++ b/Source/Core/DolphinQt2/Config/SettingsWindow.cpp
@@ -11,6 +11,7 @@
#include <QVBoxLayout>
#include "DolphinQt2/Config/SettingsWindow.h"
+#include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h"
#include "DolphinQt2/Settings/GeneralPane.h"
#include "DolphinQt2/Settings/InterfacePane.h"
@@ -75,15 +76,18 @@ void SettingsWindow::MakeUnfinishedWarning()
m_warning_group->setLayout(m_warning_group_layout);
}
-void SettingsWindow::AddCategoryToList(const QString& title, const QString& icon)
+void SettingsWindow::AddCategoryToList(const QString& title, const std::string& icon_name)
{
QString dir = Settings::Instance().GetThemeDir();
QListWidgetItem* button = new QListWidgetItem();
- button->setIcon(QIcon(dir.append(icon)));
button->setText(title);
button->setTextAlignment(Qt::AlignVCenter);
button->setSizeHint(QSize(28, 28));
button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+ auto set_icon = [=] { button->setIcon(Resources::GetScaledThemeIcon(icon_name)); };
+ QObject::connect(&Settings::Instance(), &Settings::ThemeChanged, set_icon);
+ set_icon();
m_categories->addItem(button);
}
@@ -95,9 +99,9 @@ void SettingsWindow::MakeCategoryList()
m_categories->setMovement(QListView::Static);
m_categories->setSpacing(0);
- AddCategoryToList(tr("General"), QStringLiteral("config.png"));
- AddCategoryToList(tr("Interface"), QStringLiteral("browse.png"));
- AddCategoryToList(tr("Paths"), QStringLiteral("browse.png"));
+ AddCategoryToList(tr("General"), "config");
+ AddCategoryToList(tr("Interface"), "browse");
+ AddCategoryToList(tr("Paths"), "browse");
connect(m_categories, &QListWidget::currentItemChanged, this, &SettingsWindow::changePage);
}
diff --git a/Source/Core/DolphinQt2/Config/SettingsWindow.h b/Source/Core/DolphinQt2/Config/SettingsWindow.h
index 00c1c227c1..d83400791b 100644
--- a/Source/Core/DolphinQt2/Config/SettingsWindow.h
+++ b/Source/Core/DolphinQt2/Config/SettingsWindow.h
@@ -4,6 +4,8 @@
#pragma once
+#include <string>
+
#include <QDialog>
class QGroupBox;
@@ -23,7 +25,7 @@ public slots:
private:
void MakeCategoryList();
void MakeUnfinishedWarning();
- void AddCategoryToList(const QString& title, const QString& icon);
+ void AddCategoryToList(const QString& title, const std::string& icon_name);
void SetupSettingsWidget();
QStackedWidget* m_settings_outer;
QListWidget* m_categories;