Browse Source

Merge pull request #293 from N00byKing/drkthm

Add Dark Theme (And Theming in General + Icon Theming)
pull/15/merge
bunnei 8 years ago
committed by GitHub
parent
commit
b3298465cf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dist/icons/icons.qrc
  2. BIN
      dist/icons/yuzu.png
  3. 11
      dist/qt_themes/default/default.qrc
  4. BIN
      dist/qt_themes/default/icons/16x16/checked.png
  5. BIN
      dist/qt_themes/default/icons/16x16/failed.png
  6. BIN
      dist/qt_themes/default/icons/256x256/yuzu.png
  7. 10
      dist/qt_themes/default/icons/index.theme
  8. 11
      dist/qt_themes/qdarkstyle/icons/index.theme
  9. BIN
      dist/qt_themes/qdarkstyle/rc/Hmovetoolbar.png
  10. BIN
      dist/qt_themes/qdarkstyle/rc/Hsepartoolbar.png
  11. BIN
      dist/qt_themes/qdarkstyle/rc/Vmovetoolbar.png
  12. BIN
      dist/qt_themes/qdarkstyle/rc/Vsepartoolbar.png
  13. BIN
      dist/qt_themes/qdarkstyle/rc/branch_closed-on.png
  14. BIN
      dist/qt_themes/qdarkstyle/rc/branch_closed.png
  15. BIN
      dist/qt_themes/qdarkstyle/rc/branch_open-on.png
  16. BIN
      dist/qt_themes/qdarkstyle/rc/branch_open.png
  17. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_checked.png
  18. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_checked_disabled.png
  19. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_checked_focus.png
  20. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_indeterminate.png
  21. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_indeterminate_disabled.png
  22. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_indeterminate_focus.png
  23. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_unchecked.png
  24. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_unchecked_disabled.png
  25. BIN
      dist/qt_themes/qdarkstyle/rc/checkbox_unchecked_focus.png
  26. BIN
      dist/qt_themes/qdarkstyle/rc/close-hover.png
  27. BIN
      dist/qt_themes/qdarkstyle/rc/close-pressed.png
  28. BIN
      dist/qt_themes/qdarkstyle/rc/close.png
  29. BIN
      dist/qt_themes/qdarkstyle/rc/down_arrow.png
  30. BIN
      dist/qt_themes/qdarkstyle/rc/down_arrow_disabled.png
  31. BIN
      dist/qt_themes/qdarkstyle/rc/left_arrow.png
  32. BIN
      dist/qt_themes/qdarkstyle/rc/left_arrow_disabled.png
  33. BIN
      dist/qt_themes/qdarkstyle/rc/radio_checked.png
  34. BIN
      dist/qt_themes/qdarkstyle/rc/radio_checked_disabled.png
  35. BIN
      dist/qt_themes/qdarkstyle/rc/radio_checked_focus.png
  36. BIN
      dist/qt_themes/qdarkstyle/rc/radio_unchecked.png
  37. BIN
      dist/qt_themes/qdarkstyle/rc/radio_unchecked_disabled.png
  38. BIN
      dist/qt_themes/qdarkstyle/rc/radio_unchecked_focus.png
  39. BIN
      dist/qt_themes/qdarkstyle/rc/right_arrow.png
  40. BIN
      dist/qt_themes/qdarkstyle/rc/right_arrow_disabled.png
  41. BIN
      dist/qt_themes/qdarkstyle/rc/sizegrip.png
  42. BIN
      dist/qt_themes/qdarkstyle/rc/stylesheet-branch-end.png
  43. BIN
      dist/qt_themes/qdarkstyle/rc/stylesheet-branch-more.png
  44. BIN
      dist/qt_themes/qdarkstyle/rc/stylesheet-vline.png
  45. BIN
      dist/qt_themes/qdarkstyle/rc/transparent.png
  46. BIN
      dist/qt_themes/qdarkstyle/rc/undock.png
  47. BIN
      dist/qt_themes/qdarkstyle/rc/up_arrow.png
  48. BIN
      dist/qt_themes/qdarkstyle/rc/up_arrow_disabled.png
  49. 49
      dist/qt_themes/qdarkstyle/style.qrc
  50. 1268
      dist/qt_themes/qdarkstyle/style.qss
  51. 2
      src/yuzu/about_dialog.cpp
  52. 2
      src/yuzu/configuration/config.cpp
  53. 8
      src/yuzu/configuration/configure_general.cpp
  54. 27
      src/yuzu/configuration/configure_general.ui
  55. 30
      src/yuzu/main.cpp
  56. 6
      src/yuzu/main.h
  57. 4
      src/yuzu/ui_settings.h

5
dist/icons/icons.qrc

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="icons">
<file>yuzu.png</file>
</qresource>
</RCC>

BIN
dist/icons/yuzu.png

Before

Width: 219  |  Height: 243  |  Size: 7.5 KiB

11
dist/qt_themes/default/default.qrc

@ -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>

BIN
dist/qt_themes/default/icons/16x16/checked.png

After

Width: 16  |  Height: 16  |  Size: 451 B

BIN
dist/qt_themes/default/icons/16x16/failed.png

After

Width: 16  |  Height: 16  |  Size: 428 B

BIN
dist/qt_themes/default/icons/256x256/yuzu.png

After

Width: 256  |  Height: 284  |  Size: 9.0 KiB

10
dist/qt_themes/default/icons/index.theme

@ -0,0 +1,10 @@
[Icon Theme]
Name=default
Comment=default theme
Directories=16x16,256x256
[16x16]
Size=16
[256x256]
Size=256

11
dist/qt_themes/qdarkstyle/icons/index.theme

@ -0,0 +1,11 @@
[Icon Theme]
Name=qdarkstyle
Comment=dark theme
Inherits=default
Directories=16x16,256x256
[16x16]
Size=16
[256x256]
Size=256

BIN
dist/qt_themes/qdarkstyle/rc/Hmovetoolbar.png

After

Width: 16  |  Height: 64  |  Size: 220 B

BIN
dist/qt_themes/qdarkstyle/rc/Hsepartoolbar.png

After

Width: 7  |  Height: 63  |  Size: 172 B

BIN
dist/qt_themes/qdarkstyle/rc/Vmovetoolbar.png

After

Width: 54  |  Height: 10  |  Size: 228 B

BIN
dist/qt_themes/qdarkstyle/rc/Vsepartoolbar.png

After

Width: 63  |  Height: 7  |  Size: 187 B

BIN
dist/qt_themes/qdarkstyle/rc/branch_closed-on.png

After

Width: 6  |  Height: 9  |  Size: 147 B

BIN
dist/qt_themes/qdarkstyle/rc/branch_closed.png

After

Width: 6  |  Height: 9  |  Size: 160 B

BIN
dist/qt_themes/qdarkstyle/rc/branch_open-on.png

After

Width: 9  |  Height: 6  |  Size: 150 B

BIN
dist/qt_themes/qdarkstyle/rc/branch_open.png

After

Width: 9  |  Height: 6  |  Size: 166 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_checked.png

After

Width: 32  |  Height: 32  |  Size: 492 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_checked_disabled.png

After

Width: 32  |  Height: 32  |  Size: 491 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_checked_focus.png

After

Width: 32  |  Height: 32  |  Size: 252 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_indeterminate.png

After

Width: 32  |  Height: 32  |  Size: 493 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_indeterminate_disabled.png

After

Width: 32  |  Height: 32  |  Size: 492 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_indeterminate_focus.png

After

Width: 32  |  Height: 32  |  Size: 249 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_unchecked.png

After

Width: 32  |  Height: 32  |  Size: 464 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_unchecked_disabled.png

After

Width: 32  |  Height: 32  |  Size: 464 B

BIN
dist/qt_themes/qdarkstyle/rc/checkbox_unchecked_focus.png

After

Width: 32  |  Height: 32  |  Size: 240 B

BIN
dist/qt_themes/qdarkstyle/rc/close-hover.png

After

Width: 64  |  Height: 64  |  Size: 598 B

BIN
dist/qt_themes/qdarkstyle/rc/close-pressed.png

After

Width: 64  |  Height: 64  |  Size: 598 B

BIN
dist/qt_themes/qdarkstyle/rc/close.png

After

Width: 64  |  Height: 64  |  Size: 586 B

BIN
dist/qt_themes/qdarkstyle/rc/down_arrow.png

After

Width: 9  |  Height: 6  |  Size: 165 B

BIN
dist/qt_themes/qdarkstyle/rc/down_arrow_disabled.png

After

Width: 9  |  Height: 6  |  Size: 166 B

BIN
dist/qt_themes/qdarkstyle/rc/left_arrow.png

After

Width: 6  |  Height: 9  |  Size: 166 B

BIN
dist/qt_themes/qdarkstyle/rc/left_arrow_disabled.png

After

Width: 6  |  Height: 9  |  Size: 166 B

BIN
dist/qt_themes/qdarkstyle/rc/radio_checked.png

After

Width: 32  |  Height: 32  |  Size: 940 B

BIN
dist/qt_themes/qdarkstyle/rc/radio_checked_disabled.png

After

Width: 32  |  Height: 32  |  Size: 972 B

BIN
dist/qt_themes/qdarkstyle/rc/radio_checked_focus.png

After

Width: 32  |  Height: 32  |  Size: 846 B

BIN
dist/qt_themes/qdarkstyle/rc/radio_unchecked.png

After

Width: 32  |  Height: 32  |  Size: 728 B

BIN
dist/qt_themes/qdarkstyle/rc/radio_unchecked_disabled.png

After

Width: 32  |  Height: 32  |  Size: 760 B

BIN
dist/qt_themes/qdarkstyle/rc/radio_unchecked_focus.png

After

Width: 32  |  Height: 32  |  Size: 646 B

BIN
dist/qt_themes/qdarkstyle/rc/right_arrow.png

After

Width: 6  |  Height: 9  |  Size: 160 B

BIN
dist/qt_themes/qdarkstyle/rc/right_arrow_disabled.png

After

Width: 6  |  Height: 9  |  Size: 160 B

BIN
dist/qt_themes/qdarkstyle/rc/sizegrip.png

After

Width: 16  |  Height: 16  |  Size: 129 B

BIN
dist/qt_themes/qdarkstyle/rc/stylesheet-branch-end.png

After

Width: 81  |  Height: 58  |  Size: 224 B

BIN
dist/qt_themes/qdarkstyle/rc/stylesheet-branch-more.png

After

Width: 24  |  Height: 17  |  Size: 182 B

BIN
dist/qt_themes/qdarkstyle/rc/stylesheet-vline.png

After

Width: 81  |  Height: 58  |  Size: 239 B

BIN
dist/qt_themes/qdarkstyle/rc/transparent.png

After

Width: 64  |  Height: 64  |  Size: 195 B

BIN
dist/qt_themes/qdarkstyle/rc/undock.png

After

Width: 64  |  Height: 64  |  Size: 578 B

BIN
dist/qt_themes/qdarkstyle/rc/up_arrow.png

After

Width: 9  |  Height: 6  |  Size: 158 B

BIN
dist/qt_themes/qdarkstyle/rc/up_arrow_disabled.png

After

Width: 9  |  Height: 6  |  Size: 159 B

49
dist/qt_themes/qdarkstyle/style.qrc

@ -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>

1268
dist/qt_themes/qdarkstyle/style.qss
File diff suppressed because it is too large
View File

2
src/yuzu/about_dialog.cpp

@ -2,12 +2,14 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <QIcon>
#include "common/scm_rev.h"
#include "ui_aboutdialog.h"
#include "yuzu/about_dialog.h"
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
ui->setupUi(this);
ui->labelLogo->setPixmap(QIcon::fromTheme("yuzu").pixmap(200));
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
}

2
src/yuzu/configuration/config.cpp

@ -107,6 +107,8 @@ void Config::ReadValues() {
qt_config->endGroup();
qt_config->beginGroup("UI");
UISettings::values.theme = qt_config->value("theme", UISettings::themes[0].second).toString();
qt_config->beginGroup("UILayout");
UISettings::values.geometry = qt_config->value("geometry").toByteArray();
UISettings::values.state = qt_config->value("state").toByteArray();

8
src/yuzu/configuration/configure_general.cpp

@ -13,6 +13,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ui->setupUi(this);
for (auto theme : UISettings::themes) {
ui->theme_combobox->addItem(theme.first, theme.second);
}
this->setConfiguration();
ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
@ -24,6 +28,7 @@ ConfigureGeneral::~ConfigureGeneral() {}
void ConfigureGeneral::setConfiguration() {
ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
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_docked_mode->setChecked(Settings::values.use_docked_mode);
}
@ -31,6 +36,9 @@ void ConfigureGeneral::setConfiguration() {
void ConfigureGeneral::applyConfiguration() {
UISettings::values.gamedir_deepscan = ui->toggle_deepscan->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_docked_mode = ui->use_docked_mode->isChecked();
Settings::Apply();

27
src/yuzu/configuration/configure_general.ui

@ -83,6 +83,33 @@
</layout>
</widget>
</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>
<widget class="QGroupBox" name="HotKeysGroupBox">
<property name="title">

30
src/yuzu/main.cpp

@ -78,6 +78,9 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
ui.setupUi(this);
statusBar()->hide();
default_theme_paths = QIcon::themeSearchPaths();
UpdateUITheme();
InitializeWidgets();
InitializeDebugWidgets();
InitializeRecentFileMenuActions();
@ -653,6 +656,7 @@ void GMainWindow::OnConfigure() {
auto result = configureDialog.exec();
if (result == QDialog::Accepted) {
configureDialog.applyConfiguration();
UpdateUITheme();
config->Save();
}
}
@ -833,6 +837,32 @@ void GMainWindow::filterBarSetChecked(bool state) {
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);
emit UpdateThemedIcons();
}
#ifdef main
#undef main
#endif

6
src/yuzu/main.h

@ -64,6 +64,9 @@ signals:
*/
void EmulationStopping();
// Signal that tells widgets to update icons to use the current theme
void UpdateThemedIcons();
private:
void InitializeWidgets();
void InitializeDebugWidgets();
@ -166,6 +169,9 @@ private:
QAction* actions_recent_files[max_recent_files_item];
// stores default icon theme search paths for the platform
QStringList default_theme_paths;
protected:
void dropEvent(QDropEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;

4
src/yuzu/ui_settings.h

@ -15,6 +15,10 @@ namespace UISettings {
using ContextualShortcut = std::pair<QString, int>;
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 {
QByteArray geometry;
QByteArray state;

Loading…
Cancel
Save