Qt: Allow memory card editing from playlist context menu

pull/1126/head
Connor McLaughlin 4 years ago
parent 0ea2ced46d
commit cd8f17dbd0

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

@ -907,32 +907,35 @@ void QtHostInterface::populateGameListContextMenu(const GameListEntry* entry, QW
QMenu* load_state_menu = menu->addMenu(tr("Load State"));
load_state_menu->setEnabled(false);
const std::vector<SaveStateInfo> available_states(GetAvailableSaveStates(entry->code.c_str()));
const QString timestamp_format = QLocale::system().dateTimeFormat(QLocale::ShortFormat);
for (const SaveStateInfo& ssi : available_states)
if (!entry->code.empty())
{
if (ssi.global)
continue;
const std::vector<SaveStateInfo> available_states(GetAvailableSaveStates(entry->code.c_str()));
const QString timestamp_format = QLocale::system().dateTimeFormat(QLocale::ShortFormat);
for (const SaveStateInfo& ssi : available_states)
{
if (ssi.global)
continue;
const s32 slot = ssi.slot;
const QDateTime timestamp(QDateTime::fromSecsSinceEpoch(static_cast<qint64>(ssi.timestamp)));
const QString timestamp_str(timestamp.toString(timestamp_format));
const QString path(QString::fromStdString(ssi.path));
const s32 slot = ssi.slot;
const QDateTime timestamp(QDateTime::fromSecsSinceEpoch(static_cast<qint64>(ssi.timestamp)));
const QString timestamp_str(timestamp.toString(timestamp_format));
const QString path(QString::fromStdString(ssi.path));
QAction* action;
if (slot < 0)
{
resume_action->setText(tr("Resume (%1)").arg(timestamp_str));
resume_action->setEnabled(true);
action = resume_action;
}
else
{
load_state_menu->setEnabled(true);
action = load_state_menu->addAction(tr("Game Save %1 (%2)").arg(slot).arg(timestamp_str));
}
QAction* action;
if (slot < 0)
{
resume_action->setText(tr("Resume (%1)").arg(timestamp_str));
resume_action->setEnabled(true);
action = resume_action;
}
else
{
load_state_menu->setEnabled(true);
action = load_state_menu->addAction(tr("Game Save %1 (%2)").arg(slot).arg(timestamp_str));
}
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..."));

Loading…
Cancel
Save