diff options
| author | 2020-01-28 23:59:30 +0100 | |
|---|---|---|
| committer | 2020-01-28 23:59:30 +0100 | |
| commit | 4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952 (patch) | |
| tree | 1fe70c7485464f8e31af3a04a624af035c671fb7 | |
| parent | Merge pull request #3359 from ReinUsesLisp/assert-point-size (diff) | |
| download | yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.gz yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.xz yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.zip | |
GUI: Togglable graphics settings buttons in status bar
| -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 | 98 | ||||
| -rw-r--r-- | src/yuzu/main.h | 4 |
7 files changed, 172 insertions, 22 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 b5dd3e0d6..135adde06 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -454,11 +454,10 @@ 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); |
| 461 | statusBar()->addPermanentWidget(message_label, 1); | 460 | statusBar()->addPermanentWidget(message_label, 01); |
| 462 | 461 | ||
| 463 | emu_speed_label = new QLabel(); | 462 | emu_speed_label = new QLabel(); |
| 464 | emu_speed_label->setToolTip( | 463 | emu_speed_label->setToolTip( |
| @@ -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 | ||
| @@ -1000,6 +1065,8 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 1000 | game_list_placeholder->hide(); | 1065 | game_list_placeholder->hide(); |
| 1001 | } | 1066 | } |
| 1002 | status_bar_update_timer.start(2000); | 1067 | status_bar_update_timer.start(2000); |
| 1068 | async_status_button->setDisabled(true); | ||
| 1069 | renderer_status_button->setDisabled(true); | ||
| 1003 | 1070 | ||
| 1004 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 1071 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 1005 | 1072 | ||
| @@ -1065,10 +1132,13 @@ void GMainWindow::ShutdownGame() { | |||
| 1065 | 1132 | ||
| 1066 | // Disable status bar updates | 1133 | // Disable status bar updates |
| 1067 | status_bar_update_timer.stop(); | 1134 | status_bar_update_timer.stop(); |
| 1068 | message_label->setVisible(false); | ||
| 1069 | emu_speed_label->setVisible(false); | 1135 | emu_speed_label->setVisible(false); |
| 1070 | game_fps_label->setVisible(false); | 1136 | game_fps_label->setVisible(false); |
| 1071 | emu_frametime_label->setVisible(false); | 1137 | emu_frametime_label->setVisible(false); |
| 1138 | async_status_button->setEnabled(true); | ||
| 1139 | #ifdef HAS_VULKAN | ||
| 1140 | renderer_status_button->setEnabled(true); | ||
| 1141 | #endif | ||
| 1072 | 1142 | ||
| 1073 | emulation_running = false; | 1143 | emulation_running = false; |
| 1074 | 1144 | ||
| @@ -1836,6 +1906,13 @@ void GMainWindow::OnConfigure() { | |||
| 1836 | } | 1906 | } |
| 1837 | 1907 | ||
| 1838 | config->Save(); | 1908 | config->Save(); |
| 1909 | |||
| 1910 | dock_status_button->setChecked(Settings::values.use_docked_mode); | ||
| 1911 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); | ||
| 1912 | #ifdef HAS_VULKAN | ||
| 1913 | renderer_status_button->setChecked( | ||
| 1914 | Settings::values.renderer_backend == Settings::RendererBackend::Vulkan ? true : false); | ||
| 1915 | #endif | ||
| 1839 | } | 1916 | } |
| 1840 | 1917 | ||
| 1841 | void GMainWindow::OnLoadAmiibo() { | 1918 | void GMainWindow::OnLoadAmiibo() { |
| @@ -2028,7 +2105,6 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det | |||
| 2028 | if (emu_thread) { | 2105 | if (emu_thread) { |
| 2029 | emu_thread->SetRunning(true); | 2106 | emu_thread->SetRunning(true); |
| 2030 | message_label->setText(status_message); | 2107 | message_label->setText(status_message); |
| 2031 | message_label->setVisible(true); | ||
| 2032 | } | 2108 | } |
| 2033 | } | 2109 | } |
| 2034 | } | 2110 | } |
| @@ -2290,8 +2366,16 @@ void GMainWindow::UpdateUITheme() { | |||
| 2290 | QStringList theme_paths(default_theme_paths); | 2366 | QStringList theme_paths(default_theme_paths); |
| 2291 | 2367 | ||
| 2292 | if (is_default_theme || current_theme.isEmpty()) { | 2368 | if (is_default_theme || current_theme.isEmpty()) { |
| 2293 | qApp->setStyleSheet({}); | 2369 | const QString theme_uri(QStringLiteral(":default/style.qss")); |
| 2294 | setStyleSheet({}); | 2370 | QFile f(theme_uri); |
| 2371 | if (f.open(QFile::ReadOnly | QFile::Text)) { | ||
| 2372 | QTextStream ts(&f); | ||
| 2373 | qApp->setStyleSheet(ts.readAll()); | ||
| 2374 | setStyleSheet(ts.readAll()); | ||
| 2375 | } else { | ||
| 2376 | qApp->setStyleSheet({}); | ||
| 2377 | setStyleSheet({}); | ||
| 2378 | } | ||
| 2295 | theme_paths.append(default_icons); | 2379 | theme_paths.append(default_icons); |
| 2296 | QIcon::setThemeName(default_icons); | 2380 | QIcon::setThemeName(default_icons); |
| 2297 | } else { | 2381 | } else { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index a56f9a981..537c7d5ed 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; |
| @@ -229,6 +230,9 @@ private: | |||
| 229 | QLabel* emu_speed_label = nullptr; | 230 | QLabel* emu_speed_label = nullptr; |
| 230 | QLabel* game_fps_label = nullptr; | 231 | QLabel* game_fps_label = nullptr; |
| 231 | QLabel* emu_frametime_label = nullptr; | 232 | QLabel* emu_frametime_label = nullptr; |
| 233 | QPushButton* async_status_button = nullptr; | ||
| 234 | QPushButton* renderer_status_button = nullptr; | ||
| 235 | QPushButton* dock_status_button = nullptr; | ||
| 232 | QTimer status_bar_update_timer; | 236 | QTimer status_bar_update_timer; |
| 233 | 237 | ||
| 234 | std::unique_ptr<Config> config; | 238 | std::unique_ptr<Config> config; |