summaryrefslogtreecommitdiff
path: root/src/citra_qt/main.cpp
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-02-26 17:51:15 -0800
committerGravatar GitHub2017-02-26 17:51:15 -0800
commitb250ce21b9a62cb573540fdb14f30c28fa66e6ad (patch)
treeef55a0cd4a531a097de2152f563d712551972c4b /src/citra_qt/main.cpp
parentMerge pull request #2595 from jroweboy/patch (diff)
parentPerfStats: Re-order and document members better (diff)
downloadyuzu-b250ce21b9a62cb573540fdb14f30c28fa66e6ad.tar.gz
yuzu-b250ce21b9a62cb573540fdb14f30c28fa66e6ad.tar.xz
yuzu-b250ce21b9a62cb573540fdb14f30c28fa66e6ad.zip
Merge pull request #2587 from yuriks/status-bar
Replace built-in Profiler with indicators in status bar
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r--src/citra_qt/main.cpp57
1 files changed, 52 insertions, 5 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 7a80af890..fd51659b9 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -95,6 +95,26 @@ void GMainWindow::InitializeWidgets() {
95 95
96 game_list = new GameList(); 96 game_list = new GameList();
97 ui.horizontalLayout->addWidget(game_list); 97 ui.horizontalLayout->addWidget(game_list);
98
99 // Create status bar
100 emu_speed_label = new QLabel();
101 emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% "
102 "indicate emulation is running faster or slower than a 3DS."));
103 game_fps_label = new QLabel();
104 game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "
105 "This will vary from game to game and scene to scene."));
106 emu_frametime_label = new QLabel();
107 emu_frametime_label->setToolTip(
108 tr("Time taken to emulate a 3DS frame, not counting framelimiting or v-sync. For "
109 "full-speed emulation this should be at most 16.67 ms."));
110
111 for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) {
112 label->setVisible(false);
113 label->setFrameStyle(QFrame::NoFrame);
114 label->setContentsMargins(4, 0, 4, 0);
115 statusBar()->addPermanentWidget(label);
116 }
117 statusBar()->setVisible(true);
98} 118}
99 119
100void GMainWindow::InitializeDebugWidgets() { 120void GMainWindow::InitializeDebugWidgets() {
@@ -103,11 +123,6 @@ void GMainWindow::InitializeDebugWidgets() {
103 123
104 QMenu* debug_menu = ui.menu_View_Debugging; 124 QMenu* debug_menu = ui.menu_View_Debugging;
105 125
106 profilerWidget = new ProfilerWidget(this);
107 addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
108 profilerWidget->hide();
109 debug_menu->addAction(profilerWidget->toggleViewAction());
110
111#if MICROPROFILE_ENABLED 126#if MICROPROFILE_ENABLED
112 microProfileDialog = new MicroProfileDialog(this); 127 microProfileDialog = new MicroProfileDialog(this);
113 microProfileDialog->hide(); 128 microProfileDialog->hide();
@@ -230,6 +245,9 @@ void GMainWindow::RestoreUIState() {
230 245
231 ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); 246 ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
232 OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); 247 OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
248
249 ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar);
250 statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
233} 251}
234 252
235void GMainWindow::ConnectWidgetEvents() { 253void GMainWindow::ConnectWidgetEvents() {
@@ -240,6 +258,8 @@ void GMainWindow::ConnectWidgetEvents() {
240 connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, 258 connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window,
241 SLOT(OnEmulationStarting(EmuThread*))); 259 SLOT(OnEmulationStarting(EmuThread*)));
242 connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); 260 connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
261
262 connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar);
243} 263}
244 264
245void GMainWindow::ConnectMenuEvents() { 265void GMainWindow::ConnectMenuEvents() {
@@ -262,6 +282,7 @@ void GMainWindow::ConnectMenuEvents() {
262 &GMainWindow::ToggleWindowMode); 282 &GMainWindow::ToggleWindowMode);
263 connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this, 283 connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this,
264 &GMainWindow::OnDisplayTitleBars); 284 &GMainWindow::OnDisplayTitleBars);
285 connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
265} 286}
266 287
267void GMainWindow::OnDisplayTitleBars(bool show) { 288void GMainWindow::OnDisplayTitleBars(bool show) {
@@ -387,6 +408,8 @@ void GMainWindow::BootGame(const QString& filename) {
387 if (ui.action_Single_Window_Mode->isChecked()) { 408 if (ui.action_Single_Window_Mode->isChecked()) {
388 game_list->hide(); 409 game_list->hide();
389 } 410 }
411 status_bar_update_timer.start(2000);
412
390 render_window->show(); 413 render_window->show();
391 render_window->setFocus(); 414 render_window->setFocus();
392 415
@@ -421,6 +444,12 @@ void GMainWindow::ShutdownGame() {
421 render_window->hide(); 444 render_window->hide();
422 game_list->show(); 445 game_list->show();
423 446
447 // Disable status bar updates
448 status_bar_update_timer.stop();
449 emu_speed_label->setVisible(false);
450 game_fps_label->setVisible(false);
451 emu_frametime_label->setVisible(false);
452
424 emulation_running = false; 453 emulation_running = false;
425} 454}
426 455
@@ -600,6 +629,23 @@ void GMainWindow::OnCreateGraphicsSurfaceViewer() {
600 graphicsSurfaceViewerWidget->show(); 629 graphicsSurfaceViewerWidget->show();
601} 630}
602 631
632void GMainWindow::UpdateStatusBar() {
633 if (emu_thread == nullptr) {
634 status_bar_update_timer.stop();
635 return;
636 }
637
638 auto results = Core::System::GetInstance().GetAndResetPerfStats();
639
640 emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0));
641 game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 0));
642 emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2));
643
644 emu_speed_label->setVisible(true);
645 game_fps_label->setVisible(true);
646 emu_frametime_label->setVisible(true);
647}
648
603bool GMainWindow::ConfirmClose() { 649bool GMainWindow::ConfirmClose() {
604 if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) 650 if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
605 return true; 651 return true;
@@ -625,6 +671,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
625#endif 671#endif
626 UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); 672 UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
627 UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); 673 UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked();
674 UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked();
628 UISettings::values.first_start = false; 675 UISettings::values.first_start = false;
629 676
630 game_list->SaveInterfaceLayout(); 677 game_list->SaveInterfaceLayout();