diff options
| author | 2020-02-03 16:57:18 -0500 | |
|---|---|---|
| committer | 2020-02-03 16:57:18 -0500 | |
| commit | 57332878223cd4d92ed0990b215286b623a81aed (patch) | |
| tree | 21bd2575fb6f0c1cb17ad63bbf11f83a8f818fad | |
| parent | Merge pull request #3337 from ReinUsesLisp/vulkan-staged (diff) | |
| parent | clang (diff) | |
| download | yuzu-57332878223cd4d92ed0990b215286b623a81aed.tar.gz yuzu-57332878223cd4d92ed0990b215286b623a81aed.tar.xz yuzu-57332878223cd4d92ed0990b215286b623a81aed.zip | |
Merge pull request #3360 from CJBok/statusbar-buttons
GUI: Togglable graphics settings buttons in status bar
Diffstat (limited to '')
| -rw-r--r-- | dist/qt_themes/colorful/style.qrc | 2 | ||||
| -rw-r--r-- | dist/qt_themes/colorful/style.qss | 4 | ||||
| -rw-r--r-- | dist/qt_themes/default/default.qrc | 13 | ||||
| -rw-r--r-- | dist/qt_themes/default/style.qss | 35 | ||||
| -rw-r--r-- | dist/qt_themes/qdarkstyle/style.qss | 38 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 96 | ||||
| -rw-r--r-- | src/yuzu/main.h | 4 |
7 files changed, 171 insertions, 21 deletions
diff --git a/dist/qt_themes/colorful/style.qrc b/dist/qt_themes/colorful/style.qrc index af2f3fd56..36735519a 100644 --- a/dist/qt_themes/colorful/style.qrc +++ b/dist/qt_themes/colorful/style.qrc | |||
| @@ -10,6 +10,6 @@ | |||
| 10 | <file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file> | 10 | <file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file> |
| 11 | </qresource> | 11 | </qresource> |
| 12 | <qresource prefix="colorful"> | 12 | <qresource prefix="colorful"> |
| 13 | <file>style.qss</file> | 13 | <file alias="style.qss">../default/style.qss</file> |
| 14 | </qresource> | 14 | </qresource> |
| 15 | </RCC> | 15 | </RCC> |
diff --git a/dist/qt_themes/colorful/style.qss b/dist/qt_themes/colorful/style.qss deleted file mode 100644 index 413fc81da..000000000 --- a/dist/qt_themes/colorful/style.qss +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | /* | ||
| 2 | This file is intentionally left blank. | ||
| 3 | We do not want to apply any stylesheet for colorful, only icons. | ||
| 4 | */ | ||
diff --git a/dist/qt_themes/default/default.qrc b/dist/qt_themes/default/default.qrc index d1a0ee1be..c51fdb26c 100644 --- a/dist/qt_themes/default/default.qrc +++ b/dist/qt_themes/default/default.qrc | |||
| @@ -1,25 +1,18 @@ | |||
| 1 | <RCC> | 1 | <RCC> |
| 2 | <qresource prefix="icons/default"> | 2 | <qresource prefix="icons/default"> |
| 3 | <file alias="index.theme">icons/index.theme</file> | 3 | <file alias="index.theme">icons/index.theme</file> |
| 4 | |||
| 5 | <file alias="16x16/checked.png">icons/16x16/checked.png</file> | 4 | <file alias="16x16/checked.png">icons/16x16/checked.png</file> |
| 6 | |||
| 7 | <file alias="16x16/failed.png">icons/16x16/failed.png</file> | 5 | <file alias="16x16/failed.png">icons/16x16/failed.png</file> |
| 8 | |||
| 9 | <file alias="16x16/lock.png">icons/16x16/lock.png</file> | 6 | <file alias="16x16/lock.png">icons/16x16/lock.png</file> |
| 10 | |||
| 11 | <file alias="48x48/bad_folder.png">icons/48x48/bad_folder.png</file> | 7 | <file alias="48x48/bad_folder.png">icons/48x48/bad_folder.png</file> |
| 12 | |||
| 13 | <file alias="48x48/chip.png">icons/48x48/chip.png</file> | 8 | <file alias="48x48/chip.png">icons/48x48/chip.png</file> |
| 14 | |||
| 15 | <file alias="48x48/folder.png">icons/48x48/folder.png</file> | 9 | <file alias="48x48/folder.png">icons/48x48/folder.png</file> |
| 16 | |||
| 17 | <file alias="48x48/plus.png">icons/48x48/plus.png</file> | 10 | <file alias="48x48/plus.png">icons/48x48/plus.png</file> |
| 18 | |||
| 19 | <file alias="48x48/sd_card.png">icons/48x48/sd_card.png</file> | 11 | <file alias="48x48/sd_card.png">icons/48x48/sd_card.png</file> |
| 20 | |||
| 21 | <file alias="256x256/yuzu.png">icons/256x256/yuzu.png</file> | 12 | <file alias="256x256/yuzu.png">icons/256x256/yuzu.png</file> |
| 22 | |||
| 23 | <file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file> | 13 | <file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file> |
| 24 | </qresource> | 14 | </qresource> |
| 15 | <qresource prefix="default"> | ||
| 16 | <file>style.qss</file> | ||
| 17 | </qresource> | ||
| 25 | </RCC> | 18 | </RCC> |
diff --git a/dist/qt_themes/default/style.qss b/dist/qt_themes/default/style.qss new file mode 100644 index 000000000..6b5953e38 --- /dev/null +++ b/dist/qt_themes/default/style.qss | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | QPushButton#TogglableStatusBarButton { | ||
| 2 | color: #959595; | ||
| 3 | border: 1px solid transparent; | ||
| 4 | background-color: transparent; | ||
| 5 | padding: 0px 3px 0px 3px; | ||
| 6 | text-align: center; | ||
| 7 | } | ||
| 8 | |||
| 9 | QPushButton#TogglableStatusBarButton:checked { | ||
| 10 | color: #000000; | ||
| 11 | } | ||
| 12 | |||
| 13 | QPushButton#TogglableStatusBarButton:hover { | ||
| 14 | border: 1px solid #76797C; | ||
| 15 | } | ||
| 16 | |||
| 17 | QPushButton#RendererStatusBarButton { | ||
| 18 | color: #656565; | ||
| 19 | border: 1px solid transparent; | ||
| 20 | background-color: transparent; | ||
| 21 | padding: 0px 3px 0px 3px; | ||
| 22 | text-align: center; | ||
| 23 | } | ||
| 24 | |||
| 25 | QPushButton#RendererStatusBarButton:hover { | ||
| 26 | border: 1px solid #76797C; | ||
| 27 | } | ||
| 28 | |||
| 29 | QPushButton#RendererStatusBarButton:checked { | ||
| 30 | color: #e85c00; | ||
| 31 | } | ||
| 32 | |||
| 33 | QPushButton#RendererStatusBarButton:!checked{ | ||
| 34 | color: #0066ff; | ||
| 35 | } | ||
diff --git a/dist/qt_themes/qdarkstyle/style.qss b/dist/qt_themes/qdarkstyle/style.qss index 9814b06dd..7d088a719 100644 --- a/dist/qt_themes/qdarkstyle/style.qss +++ b/dist/qt_themes/qdarkstyle/style.qss | |||
| @@ -1236,3 +1236,41 @@ QToolButton:disabled, | |||
| 1236 | QPlainTextEdit:disabled { | 1236 | QPlainTextEdit:disabled { |
| 1237 | background-color: #2b2e31; | 1237 | background-color: #2b2e31; |
| 1238 | } | 1238 | } |
| 1239 | |||
| 1240 | QPushButton#TogglableStatusBarButton { | ||
| 1241 | min-width: 0px; | ||
| 1242 | color: #656565; | ||
| 1243 | border: 1px solid transparent; | ||
| 1244 | background-color: transparent; | ||
| 1245 | padding: 0px 3px 0px 3px; | ||
| 1246 | text-align: center; | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | QPushButton#TogglableStatusBarButton:checked { | ||
| 1250 | color: #ffffff; | ||
| 1251 | } | ||
| 1252 | |||
| 1253 | QPushButton#TogglableStatusBarButton:hover { | ||
| 1254 | border: 1px solid #76797C; | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | QPushButton#RendererStatusBarButton { | ||
| 1258 | min-width: 0px; | ||
| 1259 | color: #656565; | ||
| 1260 | border: 1px solid transparent; | ||
| 1261 | background-color: transparent; | ||
| 1262 | padding: 0px 3px 0px 3px; | ||
| 1263 | text-align: center; | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | QPushButton#RendererStatusBarButton:hover { | ||
| 1267 | border: 1px solid #76797C; | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | QPushButton#RendererStatusBarButton:checked { | ||
| 1271 | color: #e85c00; | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | QPushButton#RendererStatusBarButton:!checked{ | ||
| 1275 | color: #00ccdd; | ||
| 1276 | } \ No newline at end of file | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 4000bf44a..54ca2dc1d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -454,7 +454,6 @@ void GMainWindow::InitializeWidgets() { | |||
| 454 | // Create status bar | 454 | // Create status bar |
| 455 | message_label = new QLabel(); | 455 | message_label = new QLabel(); |
| 456 | // Configured separately for left alignment | 456 | // Configured separately for left alignment |
| 457 | message_label->setVisible(false); | ||
| 458 | message_label->setFrameStyle(QFrame::NoFrame); | 457 | message_label->setFrameStyle(QFrame::NoFrame); |
| 459 | message_label->setContentsMargins(4, 0, 4, 0); | 458 | message_label->setContentsMargins(4, 0, 4, 0); |
| 460 | message_label->setAlignment(Qt::AlignLeft); | 459 | message_label->setAlignment(Qt::AlignLeft); |
| @@ -476,8 +475,73 @@ void GMainWindow::InitializeWidgets() { | |||
| 476 | label->setVisible(false); | 475 | label->setVisible(false); |
| 477 | label->setFrameStyle(QFrame::NoFrame); | 476 | label->setFrameStyle(QFrame::NoFrame); |
| 478 | label->setContentsMargins(4, 0, 4, 0); | 477 | label->setContentsMargins(4, 0, 4, 0); |
| 479 | statusBar()->addPermanentWidget(label, 0); | 478 | statusBar()->addPermanentWidget(label); |
| 480 | } | 479 | } |
| 480 | |||
| 481 | // Setup Dock button | ||
| 482 | dock_status_button = new QPushButton(); | ||
| 483 | dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); | ||
| 484 | dock_status_button->setFocusPolicy(Qt::NoFocus); | ||
| 485 | connect(dock_status_button, &QPushButton::clicked, [&] { | ||
| 486 | Settings::values.use_docked_mode = !Settings::values.use_docked_mode; | ||
| 487 | dock_status_button->setChecked(Settings::values.use_docked_mode); | ||
| 488 | OnDockedModeChanged(!Settings::values.use_docked_mode, Settings::values.use_docked_mode); | ||
| 489 | }); | ||
| 490 | dock_status_button->setText(tr("DOCK")); | ||
| 491 | dock_status_button->setCheckable(true); | ||
| 492 | dock_status_button->setChecked(Settings::values.use_docked_mode); | ||
| 493 | statusBar()->insertPermanentWidget(0, dock_status_button); | ||
| 494 | |||
| 495 | // Setup ASync button | ||
| 496 | async_status_button = new QPushButton(); | ||
| 497 | async_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); | ||
| 498 | async_status_button->setFocusPolicy(Qt::NoFocus); | ||
| 499 | connect(async_status_button, &QPushButton::clicked, [&] { | ||
| 500 | if (emulation_running) { | ||
| 501 | return; | ||
| 502 | } | ||
| 503 | Settings::values.use_asynchronous_gpu_emulation = | ||
| 504 | !Settings::values.use_asynchronous_gpu_emulation; | ||
| 505 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); | ||
| 506 | Settings::Apply(); | ||
| 507 | }); | ||
| 508 | async_status_button->setText(tr("ASYNC")); | ||
| 509 | async_status_button->setCheckable(true); | ||
| 510 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); | ||
| 511 | statusBar()->insertPermanentWidget(0, async_status_button); | ||
| 512 | |||
| 513 | // Setup Renderer API button | ||
| 514 | renderer_status_button = new QPushButton(); | ||
| 515 | renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton")); | ||
| 516 | renderer_status_button->setCheckable(true); | ||
| 517 | renderer_status_button->setFocusPolicy(Qt::NoFocus); | ||
| 518 | connect(renderer_status_button, &QPushButton::toggled, [=](bool checked) { | ||
| 519 | renderer_status_button->setText(checked ? tr("VULKAN") : tr("OPENGL")); | ||
| 520 | }); | ||
| 521 | renderer_status_button->toggle(); | ||
| 522 | |||
| 523 | #ifndef HAS_VULKAN | ||
| 524 | renderer_status_button->setChecked(false); | ||
| 525 | renderer_status_button->setCheckable(false); | ||
| 526 | renderer_status_button->setDisabled(true); | ||
| 527 | #else | ||
| 528 | renderer_status_button->setChecked(Settings::values.renderer_backend == | ||
| 529 | Settings::RendererBackend::Vulkan); | ||
| 530 | connect(renderer_status_button, &QPushButton::clicked, [=] { | ||
| 531 | if (emulation_running) { | ||
| 532 | return; | ||
| 533 | } | ||
| 534 | if (renderer_status_button->isChecked()) { | ||
| 535 | Settings::values.renderer_backend = Settings::RendererBackend::Vulkan; | ||
| 536 | } else { | ||
| 537 | Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; | ||
| 538 | } | ||
| 539 | |||
| 540 | Settings::Apply(); | ||
| 541 | }); | ||
| 542 | #endif // HAS_VULKAN | ||
| 543 | statusBar()->insertPermanentWidget(0, renderer_status_button); | ||
| 544 | |||
| 481 | statusBar()->setVisible(true); | 545 | statusBar()->setVisible(true); |
| 482 | setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}")); | 546 | setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}")); |
| 483 | } | 547 | } |
| @@ -640,6 +704,7 @@ void GMainWindow::InitializeHotkeys() { | |||
| 640 | Settings::values.use_docked_mode = !Settings::values.use_docked_mode; | 704 | Settings::values.use_docked_mode = !Settings::values.use_docked_mode; |
| 641 | OnDockedModeChanged(!Settings::values.use_docked_mode, | 705 | OnDockedModeChanged(!Settings::values.use_docked_mode, |
| 642 | Settings::values.use_docked_mode); | 706 | Settings::values.use_docked_mode); |
| 707 | dock_status_button->setChecked(Settings::values.use_docked_mode); | ||
| 643 | }); | 708 | }); |
| 644 | } | 709 | } |
| 645 | 710 | ||
| @@ -944,6 +1009,8 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 944 | game_list_placeholder->hide(); | 1009 | game_list_placeholder->hide(); |
| 945 | } | 1010 | } |
| 946 | status_bar_update_timer.start(2000); | 1011 | status_bar_update_timer.start(2000); |
| 1012 | async_status_button->setDisabled(true); | ||
| 1013 | renderer_status_button->setDisabled(true); | ||
| 947 | 1014 | ||
| 948 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 1015 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 949 | 1016 | ||
| @@ -1009,10 +1076,13 @@ void GMainWindow::ShutdownGame() { | |||
| 1009 | 1076 | ||
| 1010 | // Disable status bar updates | 1077 | // Disable status bar updates |
| 1011 | status_bar_update_timer.stop(); | 1078 | status_bar_update_timer.stop(); |
| 1012 | message_label->setVisible(false); | ||
| 1013 | emu_speed_label->setVisible(false); | 1079 | emu_speed_label->setVisible(false); |
| 1014 | game_fps_label->setVisible(false); | 1080 | game_fps_label->setVisible(false); |
| 1015 | emu_frametime_label->setVisible(false); | 1081 | emu_frametime_label->setVisible(false); |
| 1082 | async_status_button->setEnabled(true); | ||
| 1083 | #ifdef HAS_VULKAN | ||
| 1084 | renderer_status_button->setEnabled(true); | ||
| 1085 | #endif | ||
| 1016 | 1086 | ||
| 1017 | emulation_running = false; | 1087 | emulation_running = false; |
| 1018 | 1088 | ||
| @@ -1780,6 +1850,13 @@ void GMainWindow::OnConfigure() { | |||
| 1780 | } | 1850 | } |
| 1781 | 1851 | ||
| 1782 | config->Save(); | 1852 | config->Save(); |
| 1853 | |||
| 1854 | dock_status_button->setChecked(Settings::values.use_docked_mode); | ||
| 1855 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); | ||
| 1856 | #ifdef HAS_VULKAN | ||
| 1857 | renderer_status_button->setChecked(Settings::values.renderer_backend == | ||
| 1858 | Settings::RendererBackend::Vulkan); | ||
| 1859 | #endif | ||
| 1783 | } | 1860 | } |
| 1784 | 1861 | ||
| 1785 | void GMainWindow::OnLoadAmiibo() { | 1862 | void GMainWindow::OnLoadAmiibo() { |
| @@ -1972,7 +2049,6 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det | |||
| 1972 | if (emu_thread) { | 2049 | if (emu_thread) { |
| 1973 | emu_thread->SetRunning(true); | 2050 | emu_thread->SetRunning(true); |
| 1974 | message_label->setText(status_message); | 2051 | message_label->setText(status_message); |
| 1975 | message_label->setVisible(true); | ||
| 1976 | } | 2052 | } |
| 1977 | } | 2053 | } |
| 1978 | } | 2054 | } |
| @@ -2234,8 +2310,16 @@ void GMainWindow::UpdateUITheme() { | |||
| 2234 | QStringList theme_paths(default_theme_paths); | 2310 | QStringList theme_paths(default_theme_paths); |
| 2235 | 2311 | ||
| 2236 | if (is_default_theme || current_theme.isEmpty()) { | 2312 | if (is_default_theme || current_theme.isEmpty()) { |
| 2237 | qApp->setStyleSheet({}); | 2313 | const QString theme_uri(QStringLiteral(":default/style.qss")); |
| 2238 | setStyleSheet({}); | 2314 | QFile f(theme_uri); |
| 2315 | if (f.open(QFile::ReadOnly | QFile::Text)) { | ||
| 2316 | QTextStream ts(&f); | ||
| 2317 | qApp->setStyleSheet(ts.readAll()); | ||
| 2318 | setStyleSheet(ts.readAll()); | ||
| 2319 | } else { | ||
| 2320 | qApp->setStyleSheet({}); | ||
| 2321 | setStyleSheet({}); | ||
| 2322 | } | ||
| 2239 | theme_paths.append(default_icons); | 2323 | theme_paths.append(default_icons); |
| 2240 | QIcon::setThemeName(default_icons); | 2324 | QIcon::setThemeName(default_icons); |
| 2241 | } else { | 2325 | } else { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 65d4f50bb..8eba2172c 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -27,6 +27,7 @@ class LoadingScreen; | |||
| 27 | class MicroProfileDialog; | 27 | class MicroProfileDialog; |
| 28 | class ProfilerWidget; | 28 | class ProfilerWidget; |
| 29 | class QLabel; | 29 | class QLabel; |
| 30 | class QPushButton; | ||
| 30 | class WaitTreeWidget; | 31 | class WaitTreeWidget; |
| 31 | enum class GameListOpenTarget; | 32 | enum class GameListOpenTarget; |
| 32 | class GameListPlaceholder; | 33 | class GameListPlaceholder; |
| @@ -228,6 +229,9 @@ private: | |||
| 228 | QLabel* emu_speed_label = nullptr; | 229 | QLabel* emu_speed_label = nullptr; |
| 229 | QLabel* game_fps_label = nullptr; | 230 | QLabel* game_fps_label = nullptr; |
| 230 | QLabel* emu_frametime_label = nullptr; | 231 | QLabel* emu_frametime_label = nullptr; |
| 232 | QPushButton* async_status_button = nullptr; | ||
| 233 | QPushButton* renderer_status_button = nullptr; | ||
| 234 | QPushButton* dock_status_button = nullptr; | ||
| 231 | QTimer status_bar_update_timer; | 235 | QTimer status_bar_update_timer; |
| 232 | 236 | ||
| 233 | std::unique_ptr<Config> config; | 237 | std::unique_ptr<Config> config; |