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 (!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]() {
|
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));
|
||||||
|
|
|
@ -907,32 +907,35 @@ 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);
|
||||||
|
|
||||||
const std::vector<SaveStateInfo> available_states(GetAvailableSaveStates(entry->code.c_str()));
|
if (!entry->code.empty())
|
||||||
const QString timestamp_format = QLocale::system().dateTimeFormat(QLocale::ShortFormat);
|
|
||||||
for (const SaveStateInfo& ssi : available_states)
|
|
||||||
{
|
{
|
||||||
if (ssi.global)
|
const std::vector<SaveStateInfo> available_states(GetAvailableSaveStates(entry->code.c_str()));
|
||||||
continue;
|
const QString timestamp_format = QLocale::system().dateTimeFormat(QLocale::ShortFormat);
|
||||||
|
for (const SaveStateInfo& ssi : available_states)
|
||||||
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));
|
if (ssi.global)
|
||||||
resume_action->setEnabled(true);
|
continue;
|
||||||
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); });
|
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..."));
|
QAction* open_memory_cards_action = menu->addAction(tr("Edit Memory Cards..."));
|
||||||
|
|
Loading…
Reference in a new issue