diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-02-19 23:34:47 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-02-27 02:22:03 +0100 |
commit | c75ae6c585f651a1b7c162c2e1ecccd22a1c587d (patch) | |
tree | 30d51f39c6b57244e1ede29820c3f5d98ca38451 /src/citra_qt | |
parent | SynchronizedWrapper: Add Lock convenience method (diff) | |
download | yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.tar yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.tar.gz yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.tar.bz2 yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.tar.lz yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.tar.xz yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.tar.zst yuzu-c75ae6c585f651a1b7c162c2e1ecccd22a1c587d.zip |
Diffstat (limited to 'src/citra_qt')
-rw-r--r-- | src/citra_qt/main.cpp | 27 | ||||
-rw-r--r-- | src/citra_qt/main.h | 3 |
2 files changed, 30 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() { connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); + + connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar); } void GMainWindow::ConnectMenuEvents() { @@ -401,6 +403,8 @@ void GMainWindow::BootGame(const QString& filename) { if (ui.action_Single_Window_Mode->isChecked()) { game_list->hide(); } + status_bar_update_timer.start(1000); + render_window->show(); render_window->setFocus(); @@ -435,6 +439,12 @@ void GMainWindow::ShutdownGame() { render_window->hide(); game_list->show(); + // Disable status bar updates + status_bar_update_timer.stop(); + emu_speed_label->setVisible(false); + game_fps_label->setVisible(false); + emu_frametime_label->setVisible(false); + emulation_running = false; } @@ -614,6 +624,23 @@ void GMainWindow::OnCreateGraphicsSurfaceViewer() { graphicsSurfaceViewerWidget->show(); } +void GMainWindow::UpdateStatusBar() { + if (emu_thread == nullptr) { + status_bar_update_timer.stop(); + return; + } + + auto results = Core::System::GetInstance().GetAndResetPerfStats(); + + emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 2)); + game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 1)); + emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2)); + + emu_speed_label->setVisible(true); + game_fps_label->setVisible(true); + emu_frametime_label->setVisible(true); +} + bool GMainWindow::ConfirmClose() { if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) return true; diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 3cbf4ea99..ec841eaa5 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -127,6 +127,8 @@ private slots: void OnCreateGraphicsSurfaceViewer(); private: + void UpdateStatusBar(); + Ui::MainWindow ui; GRenderWindow* render_window; @@ -136,6 +138,7 @@ private: QLabel* emu_speed_label = nullptr; QLabel* game_fps_label = nullptr; QLabel* emu_frametime_label = nullptr; + QTimer status_bar_update_timer; std::unique_ptr<Config> config; |