Qt: Fix load state menu not refreshing after save
This commit is contained in:
parent
1e0e802fa4
commit
208928b6dc
|
@ -119,6 +119,15 @@ void MainWindow::onEmulationPaused(bool paused)
|
|||
m_ui.actionPause->setChecked(paused);
|
||||
}
|
||||
|
||||
void MainWindow::onStateSaved(const QString& game_code, bool global, qint32 slot)
|
||||
{
|
||||
// don't bother updating for the resume state since we're powering off anyway
|
||||
if (slot < 0)
|
||||
return;
|
||||
|
||||
m_host_interface->populateSaveStateMenus(game_code.toStdString().c_str(), m_ui.menuLoadState, m_ui.menuSaveState);
|
||||
}
|
||||
|
||||
void MainWindow::onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||
float worst_frame_time)
|
||||
{
|
||||
|
@ -331,6 +340,7 @@ void MainWindow::connectSignals()
|
|||
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);
|
||||
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
|
||||
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);
|
||||
connect(m_host_interface, &QtHostInterface::stateSaved, this, &MainWindow::onStateSaved);
|
||||
connect(m_host_interface, &QtHostInterface::systemPerformanceCountersUpdated, this,
|
||||
&MainWindow::onSystemPerformanceCountersUpdated);
|
||||
connect(m_host_interface, &QtHostInterface::runningGameChanged, this, &MainWindow::onRunningGameChanged);
|
||||
|
|
|
@ -30,6 +30,7 @@ private Q_SLOTS:
|
|||
void onEmulationStarted();
|
||||
void onEmulationStopped();
|
||||
void onEmulationPaused(bool paused);
|
||||
void onStateSaved(const QString& game_code, bool global, qint32 slot);
|
||||
void onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||
float worst_frame_time);
|
||||
void onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
||||
|
|
|
@ -651,7 +651,7 @@ void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_
|
|||
for (s32 i = 1; i <= PER_GAME_SAVE_STATE_SLOTS; i++)
|
||||
{
|
||||
QAction* action = save_menu->addAction(tr("Game Save %1").arg(i));
|
||||
connect(action, &QAction::triggered, [this, i]() { saveState(i, false); });
|
||||
connect(action, &QAction::triggered, [this, i]() { saveState(false, i); });
|
||||
}
|
||||
|
||||
save_menu->addSeparator();
|
||||
|
@ -660,7 +660,7 @@ void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_
|
|||
for (s32 i = 1; i <= GLOBAL_SAVE_STATE_SLOTS; i++)
|
||||
{
|
||||
QAction* action = save_menu->addAction(tr("Global Save %1").arg(i));
|
||||
connect(action, &QAction::triggered, [this, i]() { saveState(i, true); });
|
||||
connect(action, &QAction::triggered, [this, i]() { saveState(true, i); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,7 +696,10 @@ void QtHostInterface::saveState(bool global, qint32 slot, bool block_until_done
|
|||
}
|
||||
|
||||
if (m_system)
|
||||
{
|
||||
SaveState(global, slot);
|
||||
emit stateSaved(QString::fromStdString(m_system->GetRunningCode()), global, slot);
|
||||
}
|
||||
}
|
||||
|
||||
void QtHostInterface::enableBackgroundControllerPolling()
|
||||
|
|
|
@ -67,6 +67,7 @@ Q_SIGNALS:
|
|||
void emulationStarted();
|
||||
void emulationStopped();
|
||||
void emulationPaused(bool paused);
|
||||
void stateSaved(const QString& game_code, bool global, qint32 slot);
|
||||
void gameListRefreshed();
|
||||
void createDisplayWindowRequested(QThread* worker_thread, bool use_debug_device);
|
||||
void destroyDisplayWindowRequested();
|
||||
|
|
Loading…
Reference in New Issue