From 1b28b2668274dc266a7f523760a264c1af1044de Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 18 Feb 2017 12:09:14 -0800 Subject: Qt: Add (empty) status bar --- src/citra_qt/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 513da8001..43530b275 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -94,6 +94,17 @@ void GMainWindow::InitializeWidgets() { game_list = new GameList(); ui.horizontalLayout->addWidget(game_list); + + // Create status bar + emu_speed_label = new QLabel(); + game_fps_label = new QLabel(); + emu_frametime_label = new QLabel(); + + for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) { + label->setVisible(false); + statusBar()->addPermanentWidget(label); + } + statusBar()->setVisible(true); } void GMainWindow::InitializeDebugWidgets() { @@ -229,6 +240,9 @@ void GMainWindow::RestoreUIState() { ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); + + ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar); + statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); } void GMainWindow::ConnectWidgetEvents() { @@ -261,6 +275,7 @@ void GMainWindow::ConnectMenuEvents() { &GMainWindow::ToggleWindowMode); connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this, &GMainWindow::OnDisplayTitleBars); + connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); } void GMainWindow::OnDisplayTitleBars(bool show) { @@ -624,6 +639,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { #endif UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); + UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked(); UISettings::values.first_start = false; game_list->SaveInterfaceLayout(); -- cgit v1.2.3 From c75ae6c585f651a1b7c162c2e1ecccd22a1c587d Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 19 Feb 2017 14:34:47 -0800 Subject: Add performance statistics to status bar --- src/citra_qt/main.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/citra_qt/main.cpp') 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; -- cgit v1.2.3 From 3b4e4003336c94527339a2a9ad7d52875974258f Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 19 Feb 2017 18:35:04 -0800 Subject: Remove built-in (non-Microprofile) profiler --- src/citra_qt/main.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 41356a6ca..138763080 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -113,11 +113,6 @@ void GMainWindow::InitializeDebugWidgets() { QMenu* debug_menu = ui.menu_View_Debugging; - profilerWidget = new ProfilerWidget(this); - addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); - profilerWidget->hide(); - debug_menu->addAction(profilerWidget->toggleViewAction()); - #if MICROPROFILE_ENABLED microProfileDialog = new MicroProfileDialog(this); microProfileDialog->hide(); -- cgit v1.2.3 From 008c709dbf66e748c8b7227ba34187939535e479 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 19 Feb 2017 18:56:26 -0800 Subject: Qt: Don't show fractional figures in the status bar They're not very important and this makes the display changes less often, making it less distracting. --- src/citra_qt/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 138763080..955faf748 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -627,8 +627,8 @@ void GMainWindow::UpdateStatusBar() { 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_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0)); + game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 0)); emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2)); emu_speed_label->setVisible(true); -- cgit v1.2.3 From f273959205fbafd80a256117bc53b3c79517cbdb Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 19 Feb 2017 19:09:46 -0800 Subject: Qt: Add tooltips to status bar displays --- src/citra_qt/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 955faf748..cbfb267ab 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -97,8 +97,15 @@ void GMainWindow::InitializeWidgets() { // Create status bar emu_speed_label = new QLabel(); + emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% " + "indicate emulation is running faster or slower than a 3DS.")); game_fps_label = new QLabel(); + game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. " + "This will vary from game to game and scene to scene.")); emu_frametime_label = new QLabel(); + emu_frametime_label->setToolTip( + tr("Time taken to emulate a 3DS frame, not counting framelimiting or v-sync. For " + "full-speed emulation this should be at most 16.67 ms.")); for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) { label->setVisible(false); -- cgit v1.2.3 From 915d69ac4c79a867cf1693b25567331e63650c27 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 20 Feb 2017 16:36:44 -0800 Subject: Qt: Increase status bar update interval to 2 seconds --- src/citra_qt/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index cbfb267ab..003cfc839 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -405,7 +405,7 @@ void GMainWindow::BootGame(const QString& filename) { if (ui.action_Single_Window_Mode->isChecked()) { game_list->hide(); } - status_bar_update_timer.start(1000); + status_bar_update_timer.start(2000); render_window->show(); render_window->setFocus(); -- cgit v1.2.3 From 1469b3212b7bbc320844e3ea747c995bf3437552 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 20 Feb 2017 16:53:40 -0800 Subject: Qt: Tweak status bar styling --- src/citra_qt/main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 003cfc839..e1661ca9a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -109,6 +109,8 @@ void GMainWindow::InitializeWidgets() { for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) { label->setVisible(false); + label->setFrameStyle(QFrame::NoFrame); + label->setContentsMargins(4, 0, 4, 0); statusBar()->addPermanentWidget(label); } statusBar()->setVisible(true); -- cgit v1.2.3