diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 98 | ||||
| -rw-r--r-- | src/yuzu/main.h | 4 |
2 files changed, 95 insertions, 7 deletions
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; |