OSD: Improve main window stat spacing

This commit is contained in:
JordanTheToaster 2024-09-15 16:03:29 +01:00 committed by lightningterror
parent d33168d31f
commit 904874d959
3 changed files with 19 additions and 5 deletions

View File

@ -228,17 +228,21 @@ void MainWindow::setupAdditionalUi()
m_status_resolution_widget = new QLabel(m_ui.statusBar); m_status_resolution_widget = new QLabel(m_ui.statusBar);
m_status_resolution_widget->setFixedHeight(16); 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_resolution_widget->hide();
m_status_fps_widget = new QLabel(m_ui.statusBar); 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_fps_widget->hide();
m_status_vps_widget = new QLabel(m_ui.statusBar); 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_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 = new QMenu(m_ui.toolBar);
m_settings_toolbar_menu->addAction(m_ui.actionSettings); m_settings_toolbar_menu->addAction(m_ui.actionSettings);
m_settings_toolbar_menu->addAction(m_ui.actionViewGameProperties); 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_resolution_widget, s_vm_valid, 0);
Update(m_status_fps_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_vps_widget, s_vm_valid, 0);
Update(m_status_speed_widget, s_vm_valid, 0);
} }
void MainWindow::updateWindowTitle() void MainWindow::updateWindowTitle()
@ -1983,6 +1988,7 @@ void MainWindow::onVMStopped()
m_status_resolution_widget->setText(empty_string); m_status_resolution_widget->setText(empty_string);
m_status_fps_widget->setText(empty_string); m_status_fps_widget->setText(empty_string);
m_status_vps_widget->setText(empty_string); m_status_vps_widget->setText(empty_string);
m_status_speed_widget->setText(empty_string);
updateEmulationActions(false, false, false); updateEmulationActions(false, false, false);
updateGameDependentActions(); updateGameDependentActions();

View File

@ -98,6 +98,7 @@ public:
__fi QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; } __fi QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; }
__fi QLabel* getStatusFPSWidget() const { return m_status_fps_widget; } __fi QLabel* getStatusFPSWidget() const { return m_status_fps_widget; }
__fi QLabel* getStatusVPSWidget() const { return m_status_vps_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. /// Rescans a single file. NOTE: Happens on UI thread.
void rescanFile(const std::string& path); void rescanFile(const std::string& path);
@ -295,6 +296,7 @@ private:
QLabel* m_status_renderer_widget = nullptr; QLabel* m_status_renderer_widget = nullptr;
QLabel* m_status_fps_widget = nullptr; QLabel* m_status_fps_widget = nullptr;
QLabel* m_status_vps_widget = nullptr; QLabel* m_status_vps_widget = nullptr;
QLabel* m_status_speed_widget = nullptr;
QLabel* m_status_resolution_widget = nullptr; QLabel* m_status_resolution_widget = nullptr;
QMenu* m_settings_toolbar_menu = nullptr; QMenu* m_settings_toolbar_menu = nullptr;

View File

@ -1059,9 +1059,15 @@ void EmuThread::updatePerformanceMetrics(bool force)
if (speed != m_last_speed || vfps != m_last_video_fps || force) if (speed != m_last_speed || vfps != m_last_video_fps || force)
{ {
QMetaObject::invokeMethod(g_main_window->getStatusVPSWidget(), "setText", Qt::QueuedConnection, 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))); Q_ARG(const QString&, tr("VPS: %1 ").arg(vfps, 0, 'f', 0)));
m_last_speed = speed;
m_last_video_fps = vfps; 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;
}
} }
} }
} }