Add Dark theme, Icon theming
configure_general.ui: Add UI Option for Themes config.cpp: Save Theme Settings
|
@ -1,5 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="icons">
|
|
||||||
<file>yuzu.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
Before Width: | Height: | Size: 7.5 KiB |
|
@ -0,0 +1,11 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="icons/default">
|
||||||
|
<file alias="index.theme">icons/index.theme</file>
|
||||||
|
|
||||||
|
<file alias="16x16/checked.png">icons/16x16/checked.png</file>
|
||||||
|
|
||||||
|
<file alias="16x16/failed.png">icons/16x16/failed.png</file>
|
||||||
|
|
||||||
|
<file alias="256x256/yuzu.png">icons/256x256/yuzu.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 9.0 KiB |
|
@ -0,0 +1,10 @@
|
||||||
|
[Icon Theme]
|
||||||
|
Name=default
|
||||||
|
Comment=default theme
|
||||||
|
Directories=16x16,256x256
|
||||||
|
|
||||||
|
[16x16]
|
||||||
|
Size=16
|
||||||
|
|
||||||
|
[256x256]
|
||||||
|
Size=256
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Icon Theme]
|
||||||
|
Name=qdarkstyle
|
||||||
|
Comment=dark theme
|
||||||
|
Inherits=default
|
||||||
|
Directories=16x16,256x256
|
||||||
|
|
||||||
|
[16x16]
|
||||||
|
Size=16
|
||||||
|
|
||||||
|
[256x256]
|
||||||
|
Size=256
|
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 172 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 187 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 491 B |
After Width: | Height: | Size: 252 B |
After Width: | Height: | Size: 493 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 240 B |
After Width: | Height: | Size: 598 B |
After Width: | Height: | Size: 598 B |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 940 B |
After Width: | Height: | Size: 972 B |
After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 728 B |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 646 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 224 B |
After Width: | Height: | Size: 182 B |
After Width: | Height: | Size: 239 B |
After Width: | Height: | Size: 195 B |
After Width: | Height: | Size: 578 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 159 B |
|
@ -0,0 +1,49 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="icons/qdarkstyle">
|
||||||
|
<file alias="index.theme">icons/index.theme</file>
|
||||||
|
</qresource>
|
||||||
|
<qresource prefix="qss_icons">
|
||||||
|
<file>rc/up_arrow_disabled.png</file>
|
||||||
|
<file>rc/Hmovetoolbar.png</file>
|
||||||
|
<file>rc/stylesheet-branch-end.png</file>
|
||||||
|
<file>rc/branch_closed-on.png</file>
|
||||||
|
<file>rc/stylesheet-vline.png</file>
|
||||||
|
<file>rc/branch_closed.png</file>
|
||||||
|
<file>rc/branch_open-on.png</file>
|
||||||
|
<file>rc/transparent.png</file>
|
||||||
|
<file>rc/right_arrow_disabled.png</file>
|
||||||
|
<file>rc/sizegrip.png</file>
|
||||||
|
<file>rc/close.png</file>
|
||||||
|
<file>rc/close-hover.png</file>
|
||||||
|
<file>rc/close-pressed.png</file>
|
||||||
|
<file>rc/down_arrow.png</file>
|
||||||
|
<file>rc/Vmovetoolbar.png</file>
|
||||||
|
<file>rc/left_arrow.png</file>
|
||||||
|
<file>rc/stylesheet-branch-more.png</file>
|
||||||
|
<file>rc/up_arrow.png</file>
|
||||||
|
<file>rc/right_arrow.png</file>
|
||||||
|
<file>rc/left_arrow_disabled.png</file>
|
||||||
|
<file>rc/Hsepartoolbar.png</file>
|
||||||
|
<file>rc/branch_open.png</file>
|
||||||
|
<file>rc/Vsepartoolbar.png</file>
|
||||||
|
<file>rc/down_arrow_disabled.png</file>
|
||||||
|
<file>rc/undock.png</file>
|
||||||
|
<file>rc/checkbox_checked_disabled.png</file>
|
||||||
|
<file>rc/checkbox_checked_focus.png</file>
|
||||||
|
<file>rc/checkbox_checked.png</file>
|
||||||
|
<file>rc/checkbox_indeterminate.png</file>
|
||||||
|
<file>rc/checkbox_indeterminate_focus.png</file>
|
||||||
|
<file>rc/checkbox_unchecked_disabled.png</file>
|
||||||
|
<file>rc/checkbox_unchecked_focus.png</file>
|
||||||
|
<file>rc/checkbox_unchecked.png</file>
|
||||||
|
<file>rc/radio_checked_disabled.png</file>
|
||||||
|
<file>rc/radio_checked_focus.png</file>
|
||||||
|
<file>rc/radio_checked.png</file>
|
||||||
|
<file>rc/radio_unchecked_disabled.png</file>
|
||||||
|
<file>rc/radio_unchecked_focus.png</file>
|
||||||
|
<file>rc/radio_unchecked.png</file>
|
||||||
|
</qresource>
|
||||||
|
<qresource prefix="qdarkstyle">
|
||||||
|
<file>style.qss</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -2,12 +2,14 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "ui_aboutdialog.h"
|
#include "ui_aboutdialog.h"
|
||||||
#include "yuzu/about_dialog.h"
|
#include "yuzu/about_dialog.h"
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
|
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->labelLogo->setPixmap(QIcon::fromTheme("yuzu").pixmap(200));
|
||||||
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
|
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
|
||||||
Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,8 @@ void Config::ReadValues() {
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("UI");
|
qt_config->beginGroup("UI");
|
||||||
|
UISettings::values.theme = qt_config->value("theme", UISettings::themes[0].second).toString();
|
||||||
|
|
||||||
qt_config->beginGroup("UILayout");
|
qt_config->beginGroup("UILayout");
|
||||||
UISettings::values.geometry = qt_config->value("geometry").toByteArray();
|
UISettings::values.geometry = qt_config->value("geometry").toByteArray();
|
||||||
UISettings::values.state = qt_config->value("state").toByteArray();
|
UISettings::values.state = qt_config->value("state").toByteArray();
|
||||||
|
|
|
@ -13,6 +13,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
for (auto theme : UISettings::themes) {
|
||||||
|
ui->theme_combobox->addItem(theme.first, theme.second);
|
||||||
|
}
|
||||||
|
|
||||||
this->setConfiguration();
|
this->setConfiguration();
|
||||||
|
|
||||||
ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||||
|
@ -24,6 +28,7 @@ ConfigureGeneral::~ConfigureGeneral() {}
|
||||||
void ConfigureGeneral::setConfiguration() {
|
void ConfigureGeneral::setConfiguration() {
|
||||||
ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
|
ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
|
||||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
||||||
|
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
||||||
ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit);
|
ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit);
|
||||||
ui->use_docked_mode->setChecked(Settings::values.use_docked_mode);
|
ui->use_docked_mode->setChecked(Settings::values.use_docked_mode);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +36,9 @@ void ConfigureGeneral::setConfiguration() {
|
||||||
void ConfigureGeneral::applyConfiguration() {
|
void ConfigureGeneral::applyConfiguration() {
|
||||||
UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
|
UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
|
||||||
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
||||||
|
UISettings::values.theme =
|
||||||
|
ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
|
||||||
|
|
||||||
Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked();
|
Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked();
|
||||||
Settings::values.use_docked_mode = ui->use_docked_mode->isChecked();
|
Settings::values.use_docked_mode = ui->use_docked_mode->isChecked();
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
|
|
|
@ -83,6 +83,33 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="theme_group_box">
|
||||||
|
<property name="title">
|
||||||
|
<string>Theme</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="theme_qhbox_layout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="theme_qvbox_layout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="theme_qhbox_layout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="theme_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Theme:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="theme_combobox"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="HotKeysGroupBox">
|
<widget class="QGroupBox" name="HotKeysGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
|
@ -95,6 +95,9 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||||
|
|
||||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||||
|
|
||||||
|
default_theme_paths = QIcon::themeSearchPaths();
|
||||||
|
UpdateUITheme();
|
||||||
|
|
||||||
// Show one-time "callout" messages to the user
|
// Show one-time "callout" messages to the user
|
||||||
ShowCallouts();
|
ShowCallouts();
|
||||||
|
|
||||||
|
@ -653,6 +656,7 @@ void GMainWindow::OnConfigure() {
|
||||||
auto result = configureDialog.exec();
|
auto result = configureDialog.exec();
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
configureDialog.applyConfiguration();
|
configureDialog.applyConfiguration();
|
||||||
|
UpdateUITheme();
|
||||||
config->Save();
|
config->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,6 +837,31 @@ void GMainWindow::filterBarSetChecked(bool state) {
|
||||||
emit(OnToggleFilterBar());
|
emit(OnToggleFilterBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::UpdateUITheme() {
|
||||||
|
QStringList theme_paths(default_theme_paths);
|
||||||
|
if (UISettings::values.theme != UISettings::themes[0].second &&
|
||||||
|
!UISettings::values.theme.isEmpty()) {
|
||||||
|
QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
||||||
|
QFile f(theme_uri);
|
||||||
|
if (!f.exists()) {
|
||||||
|
LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
|
||||||
|
} else {
|
||||||
|
f.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
QTextStream ts(&f);
|
||||||
|
qApp->setStyleSheet(ts.readAll());
|
||||||
|
GMainWindow::setStyleSheet(ts.readAll());
|
||||||
|
}
|
||||||
|
theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme});
|
||||||
|
QIcon::setThemeName(":/icons/" + UISettings::values.theme);
|
||||||
|
} else {
|
||||||
|
qApp->setStyleSheet("");
|
||||||
|
GMainWindow::setStyleSheet("");
|
||||||
|
theme_paths.append(QStringList{":/icons/default"});
|
||||||
|
QIcon::setThemeName(":/icons/default");
|
||||||
|
}
|
||||||
|
QIcon::setThemeSearchPaths(theme_paths);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef main
|
#ifdef main
|
||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -166,6 +166,9 @@ private:
|
||||||
|
|
||||||
QAction* actions_recent_files[max_recent_files_item];
|
QAction* actions_recent_files[max_recent_files_item];
|
||||||
|
|
||||||
|
// stores default icon theme search paths for the platform
|
||||||
|
QStringList default_theme_paths;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
|
|
|
@ -15,6 +15,10 @@ namespace UISettings {
|
||||||
using ContextualShortcut = std::pair<QString, int>;
|
using ContextualShortcut = std::pair<QString, int>;
|
||||||
using Shortcut = std::pair<QString, ContextualShortcut>;
|
using Shortcut = std::pair<QString, ContextualShortcut>;
|
||||||
|
|
||||||
|
static const std::array<std::pair<QString, QString>, 2> themes = {
|
||||||
|
{std::make_pair(QString("Default"), QString("default")),
|
||||||
|
std::make_pair(QString("Dark"), QString("qdarkstyle"))}};
|
||||||
|
|
||||||
struct Values {
|
struct Values {
|
||||||
QByteArray geometry;
|
QByteArray geometry;
|
||||||
QByteArray state;
|
QByteArray state;
|
||||||
|
|