mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
Qt: Allow memory card editing from playlist context menu
This commit is contained in:
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 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)
|
||||
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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
if (ssi.global)
|
||||
continue;
|
||||
|
||||
connect(action, &QAction::triggered, [this, path]() { loadState(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));
|
||||
}
|
||||
|
||||
connect(action, &QAction::triggered, [this, path]() { loadState(path); });
|
||||
}
|
||||
}
|
||||
|
||||
QAction* open_memory_cards_action = menu->addAction(tr("Edit Memory Cards..."));
|
||||
|
|
Loading…
Reference in a new issue