From 904874d959bd7227cf6bbdf8811807fc817732cb Mon Sep 17 00:00:00 2001 From: JordanTheToaster Date: Sun, 15 Sep 2024 16:03:29 +0100 Subject: [PATCH] OSD: Improve main window stat spacing --- pcsx2-qt/MainWindow.cpp | 12 +++++++++--- pcsx2-qt/MainWindow.h | 2 ++ pcsx2-qt/QtHost.cpp | 10 ++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index 51c907ba4b..b2af4fcac8 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -228,17 +228,21 @@ void MainWindow::setupAdditionalUi() m_status_resolution_widget = new QLabel(m_ui.statusBar); m_status_resolution_widget->setFixedHeight(16); - m_status_resolution_widget->setFixedSize(70, 16); + m_status_resolution_widget->setFixedSize(75, 16); m_status_resolution_widget->hide(); m_status_fps_widget = new QLabel(m_ui.statusBar); - m_status_fps_widget->setFixedSize(85, 16); + m_status_fps_widget->setFixedSize(60, 16); m_status_fps_widget->hide(); m_status_vps_widget = new QLabel(m_ui.statusBar); - m_status_vps_widget->setFixedSize(125, 16); + m_status_vps_widget->setFixedSize(60, 16); m_status_vps_widget->hide(); + m_status_speed_widget = new QLabel(m_ui.statusBar); + m_status_speed_widget->setFixedSize(90, 16); + m_status_speed_widget->hide(); + m_settings_toolbar_menu = new QMenu(m_ui.toolBar); m_settings_toolbar_menu->addAction(m_ui.actionSettings); m_settings_toolbar_menu->addAction(m_ui.actionViewGameProperties); @@ -953,6 +957,7 @@ void MainWindow::updateStatusBarWidgetVisibility() Update(m_status_resolution_widget, s_vm_valid, 0); Update(m_status_fps_widget, s_vm_valid, 0); Update(m_status_vps_widget, s_vm_valid, 0); + Update(m_status_speed_widget, s_vm_valid, 0); } void MainWindow::updateWindowTitle() @@ -1983,6 +1988,7 @@ void MainWindow::onVMStopped() m_status_resolution_widget->setText(empty_string); m_status_fps_widget->setText(empty_string); m_status_vps_widget->setText(empty_string); + m_status_speed_widget->setText(empty_string); updateEmulationActions(false, false, false); updateGameDependentActions(); diff --git a/pcsx2-qt/MainWindow.h b/pcsx2-qt/MainWindow.h index fd94e66fda..be3d2ef286 100644 --- a/pcsx2-qt/MainWindow.h +++ b/pcsx2-qt/MainWindow.h @@ -98,6 +98,7 @@ public: __fi QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; } __fi QLabel* getStatusFPSWidget() const { return m_status_fps_widget; } __fi QLabel* getStatusVPSWidget() const { return m_status_vps_widget; } + __fi QLabel* getStatusSpeedWidget() const { return m_status_speed_widget; } /// Rescans a single file. NOTE: Happens on UI thread. void rescanFile(const std::string& path); @@ -295,6 +296,7 @@ private: QLabel* m_status_renderer_widget = nullptr; QLabel* m_status_fps_widget = nullptr; QLabel* m_status_vps_widget = nullptr; + QLabel* m_status_speed_widget = nullptr; QLabel* m_status_resolution_widget = nullptr; QMenu* m_settings_toolbar_menu = nullptr; diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index 6f2473e672..608cdd75e6 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -1059,9 +1059,15 @@ void EmuThread::updatePerformanceMetrics(bool force) if (speed != m_last_speed || vfps != m_last_video_fps || force) { QMetaObject::invokeMethod(g_main_window->getStatusVPSWidget(), "setText", Qt::QueuedConnection, - Q_ARG(const QString&, tr("VPS: %1 (%2%) ").arg(vfps, 0, 'f', 0).arg(speed, 0, 'f', 0))); - m_last_speed = speed; + Q_ARG(const QString&, tr("VPS: %1 ").arg(vfps, 0, 'f', 0))); m_last_video_fps = vfps; + + if (speed != m_last_speed || force) + { + QMetaObject::invokeMethod(g_main_window->getStatusSpeedWidget(), "setText", Qt::QueuedConnection, + Q_ARG(const QString&, tr("Speed: %1% ").arg(speed, 0, 'f', 0))); + m_last_speed = speed; + } } } }