summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2020-02-03 16:57:18 -0500
committerGravatar GitHub2020-02-03 16:57:18 -0500
commit57332878223cd4d92ed0990b215286b623a81aed (patch)
tree21bd2575fb6f0c1cb17ad63bbf11f83a8f818fad /src
parentMerge pull request #3337 from ReinUsesLisp/vulkan-staged (diff)
parentclang (diff)
downloadyuzu-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 'src')
-rw-r--r--src/yuzu/main.cpp96
-rw-r--r--src/yuzu/main.h4
2 files changed, 94 insertions, 6 deletions
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
1785void GMainWindow::OnLoadAmiibo() { 1862void 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;
27class MicroProfileDialog; 27class MicroProfileDialog;
28class ProfilerWidget; 28class ProfilerWidget;
29class QLabel; 29class QLabel;
30class QPushButton;
30class WaitTreeWidget; 31class WaitTreeWidget;
31enum class GameListOpenTarget; 32enum class GameListOpenTarget;
32class GameListPlaceholder; 33class 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;