diff options
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 43530b275..41356a6ca 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -253,6 +253,8 @@ void GMainWindow::ConnectWidgetEvents() { | |||
| 253 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, | 253 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, |
| 254 | SLOT(OnEmulationStarting(EmuThread*))); | 254 | SLOT(OnEmulationStarting(EmuThread*))); |
| 255 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); | 255 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); |
| 256 | |||
| 257 | connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar); | ||
| 256 | } | 258 | } |
| 257 | 259 | ||
| 258 | void GMainWindow::ConnectMenuEvents() { | 260 | void GMainWindow::ConnectMenuEvents() { |
| @@ -401,6 +403,8 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 401 | if (ui.action_Single_Window_Mode->isChecked()) { | 403 | if (ui.action_Single_Window_Mode->isChecked()) { |
| 402 | game_list->hide(); | 404 | game_list->hide(); |
| 403 | } | 405 | } |
| 406 | status_bar_update_timer.start(1000); | ||
| 407 | |||
| 404 | render_window->show(); | 408 | render_window->show(); |
| 405 | render_window->setFocus(); | 409 | render_window->setFocus(); |
| 406 | 410 | ||
| @@ -435,6 +439,12 @@ void GMainWindow::ShutdownGame() { | |||
| 435 | render_window->hide(); | 439 | render_window->hide(); |
| 436 | game_list->show(); | 440 | game_list->show(); |
| 437 | 441 | ||
| 442 | // Disable status bar updates | ||
| 443 | status_bar_update_timer.stop(); | ||
| 444 | emu_speed_label->setVisible(false); | ||
| 445 | game_fps_label->setVisible(false); | ||
| 446 | emu_frametime_label->setVisible(false); | ||
| 447 | |||
| 438 | emulation_running = false; | 448 | emulation_running = false; |
| 439 | } | 449 | } |
| 440 | 450 | ||
| @@ -614,6 +624,23 @@ void GMainWindow::OnCreateGraphicsSurfaceViewer() { | |||
| 614 | graphicsSurfaceViewerWidget->show(); | 624 | graphicsSurfaceViewerWidget->show(); |
| 615 | } | 625 | } |
| 616 | 626 | ||
| 627 | void GMainWindow::UpdateStatusBar() { | ||
| 628 | if (emu_thread == nullptr) { | ||
| 629 | status_bar_update_timer.stop(); | ||
| 630 | return; | ||
| 631 | } | ||
| 632 | |||
| 633 | auto results = Core::System::GetInstance().GetAndResetPerfStats(); | ||
| 634 | |||
| 635 | emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 2)); | ||
| 636 | game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 1)); | ||
| 637 | emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2)); | ||
| 638 | |||
| 639 | emu_speed_label->setVisible(true); | ||
| 640 | game_fps_label->setVisible(true); | ||
| 641 | emu_frametime_label->setVisible(true); | ||
| 642 | } | ||
| 643 | |||
| 617 | bool GMainWindow::ConfirmClose() { | 644 | bool GMainWindow::ConfirmClose() { |
| 618 | if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) | 645 | if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) |
| 619 | return true; | 646 | return true; |