mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
Qt: Fix game properties being inaccessible in batch mode
This commit is contained in:
parent
6a99ff9c08
commit
0af334bba5
|
@ -464,15 +464,6 @@ void MainWindow::onRunningGameChanged(const QString& filename, const QString& ga
|
||||||
if (m_display_widget)
|
if (m_display_widget)
|
||||||
m_display_widget->setWindowTitle(windowTitle());
|
m_display_widget->setWindowTitle(windowTitle());
|
||||||
|
|
||||||
bool has_game_list_entry = false;
|
|
||||||
if (!filename.isEmpty())
|
|
||||||
{
|
|
||||||
const GameListEntry* entry = m_host_interface->getGameList()->GetEntryForPath(filename.toStdString().c_str());
|
|
||||||
has_game_list_entry = (entry != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ui.actionViewGameProperties->setEnabled(has_game_list_entry);
|
|
||||||
|
|
||||||
m_running_game_code = game_code.toStdString();
|
m_running_game_code = game_code.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,9 +654,16 @@ void MainWindow::onViewGamePropertiesActionTriggered()
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ensureGameListLoaded();
|
||||||
|
|
||||||
const GameListEntry* entry = m_host_interface->getGameList()->GetEntryForPath(path.c_str());
|
const GameListEntry* entry = m_host_interface->getGameList()->GetEntryForPath(path.c_str());
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("DuckStation"),
|
||||||
|
tr("Could not find a game list entry for the currently running file. Please make sure this "
|
||||||
|
"file is in a location scanned by the game list."));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GamePropertiesDialog::showForEntry(m_host_interface, entry, this);
|
GamePropertiesDialog::showForEntry(m_host_interface, entry, this);
|
||||||
}
|
}
|
||||||
|
@ -961,6 +959,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool cheevo
|
||||||
m_ui.menuWindowSize->setDisabled(starting || !running);
|
m_ui.menuWindowSize->setDisabled(starting || !running);
|
||||||
|
|
||||||
m_ui.actionFullscreen->setDisabled(starting || !running);
|
m_ui.actionFullscreen->setDisabled(starting || !running);
|
||||||
|
m_ui.actionViewGameProperties->setDisabled(starting || !running);
|
||||||
|
|
||||||
m_ui.actionLoadState->setDisabled(cheevos_challenge_mode);
|
m_ui.actionLoadState->setDisabled(cheevos_challenge_mode);
|
||||||
m_ui.menuLoadState->setDisabled(cheevos_challenge_mode);
|
m_ui.menuLoadState->setDisabled(cheevos_challenge_mode);
|
||||||
|
@ -1538,6 +1537,21 @@ void MainWindow::updateDebugMenuCropMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ensureGameListLoaded()
|
||||||
|
{
|
||||||
|
if (m_host_interface->getGameList()->IsGameListLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const bool was_running = System::IsRunning();
|
||||||
|
if (m_emulation_running)
|
||||||
|
m_host_interface->pauseSystem(true, true);
|
||||||
|
|
||||||
|
m_host_interface->refreshGameList();
|
||||||
|
|
||||||
|
if (!was_running)
|
||||||
|
m_host_interface->pauseSystem(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent* event)
|
void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
{
|
{
|
||||||
m_host_interface->synchronousPowerOffSystem();
|
m_host_interface->synchronousPowerOffSystem();
|
||||||
|
|
|
@ -146,6 +146,7 @@ private:
|
||||||
void updateDebugMenuCPUExecutionMode();
|
void updateDebugMenuCPUExecutionMode();
|
||||||
void updateDebugMenuGPURenderer();
|
void updateDebugMenuGPURenderer();
|
||||||
void updateDebugMenuCropMode();
|
void updateDebugMenuCropMode();
|
||||||
|
void ensureGameListLoaded();
|
||||||
|
|
||||||
Ui::MainWindow m_ui;
|
Ui::MainWindow m_ui;
|
||||||
|
|
||||||
|
|
|
@ -616,6 +616,8 @@ void GameList::SetSearchDirectoriesFromSettings(SettingsInterface& si)
|
||||||
|
|
||||||
void GameList::Refresh(bool invalidate_cache, bool invalidate_database, ProgressCallback* progress /* = nullptr */)
|
void GameList::Refresh(bool invalidate_cache, bool invalidate_database, ProgressCallback* progress /* = nullptr */)
|
||||||
{
|
{
|
||||||
|
m_game_list_loaded = true;
|
||||||
|
|
||||||
if (!progress)
|
if (!progress)
|
||||||
progress = ProgressCallback::NullProgressCallback;
|
progress = ProgressCallback::NullProgressCallback;
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ public:
|
||||||
const u32 GetEntryCount() const { return static_cast<u32>(m_entries.size()); }
|
const u32 GetEntryCount() const { return static_cast<u32>(m_entries.size()); }
|
||||||
const std::vector<DirectoryEntry>& GetSearchDirectories() const { return m_search_directories; }
|
const std::vector<DirectoryEntry>& GetSearchDirectories() const { return m_search_directories; }
|
||||||
const u32 GetSearchDirectoryCount() const { return static_cast<u32>(m_search_directories.size()); }
|
const u32 GetSearchDirectoryCount() const { return static_cast<u32>(m_search_directories.size()); }
|
||||||
|
const bool IsGameListLoaded() const { return m_game_list_loaded; }
|
||||||
|
|
||||||
const GameListEntry* GetEntryForPath(const char* path) const;
|
const GameListEntry* GetEntryForPath(const char* path) const;
|
||||||
const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const;
|
const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const;
|
||||||
|
@ -187,4 +188,5 @@ private:
|
||||||
bool m_database_load_tried = false;
|
bool m_database_load_tried = false;
|
||||||
bool m_compatibility_list_load_tried = false;
|
bool m_compatibility_list_load_tried = false;
|
||||||
bool m_game_settings_load_tried = false;
|
bool m_game_settings_load_tried = false;
|
||||||
|
bool m_game_list_loaded = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue