Qt: Allow memory card editing from playlist context menu

This commit is contained in:
Connor McLaughlin 2020-12-02 00:56:31 +10:00
parent 0ea2ced46d
commit cd8f17dbd0
2 changed files with 28 additions and 28 deletions

View file

@ -537,12 +537,9 @@ void MainWindow::onGameListContextMenuRequested(const QPoint& point, const GameL
menu.addSeparator(); menu.addSeparator();
if (!m_emulation_running) if (!m_emulation_running)
{
if (!entry->code.empty())
{ {
m_host_interface->populateGameListContextMenu(entry, this, &menu); m_host_interface->populateGameListContextMenu(entry, this, &menu);
menu.addSeparator(); menu.addSeparator();
}
connect(menu.addAction(tr("Default Boot")), &QAction::triggered, [this, entry]() { connect(menu.addAction(tr("Default Boot")), &QAction::triggered, [this, entry]() {
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(entry->path)); m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(entry->path));

View file

@ -907,6 +907,8 @@ void QtHostInterface::populateGameListContextMenu(const GameListEntry* entry, QW
QMenu* load_state_menu = menu->addMenu(tr("Load State")); QMenu* load_state_menu = menu->addMenu(tr("Load State"));
load_state_menu->setEnabled(false); load_state_menu->setEnabled(false);
if (!entry->code.empty())
{
const std::vector<SaveStateInfo> available_states(GetAvailableSaveStates(entry->code.c_str())); const std::vector<SaveStateInfo> available_states(GetAvailableSaveStates(entry->code.c_str()));
const QString timestamp_format = QLocale::system().dateTimeFormat(QLocale::ShortFormat); const QString timestamp_format = QLocale::system().dateTimeFormat(QLocale::ShortFormat);
for (const SaveStateInfo& ssi : available_states) for (const SaveStateInfo& ssi : available_states)
@ -934,6 +936,7 @@ void QtHostInterface::populateGameListContextMenu(const GameListEntry* entry, QW
connect(action, &QAction::triggered, [this, path]() { loadState(path); }); connect(action, &QAction::triggered, [this, path]() { loadState(path); });
} }
}
QAction* open_memory_cards_action = menu->addAction(tr("Edit Memory Cards...")); QAction* open_memory_cards_action = menu->addAction(tr("Edit Memory Cards..."));
connect(open_memory_cards_action, &QAction::triggered, [this, entry]() { connect(open_memory_cards_action, &QAction::triggered, [this, entry]() {