Skip to content

Commit

Permalink
OSD: Improve main window stat spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanTheToaster authored and lightningterror committed Sep 16, 2024
1 parent d33168d commit 904874d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
12 changes: 9 additions & 3 deletions pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions pcsx2-qt/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class MainWindow final : public QMainWindow
__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);
Expand Down Expand Up @@ -295,6 +296,7 @@ private Q_SLOTS:
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;
Expand Down
10 changes: 8 additions & 2 deletions pcsx2-qt/QtHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down

0 comments on commit 904874d

Please sign in to comment.