Qt: Add Set Cover Image/Edit Memory Cards for merged disc sets

This commit is contained in:
Stenzek 2024-05-21 13:54:19 +10:00
parent 08125262bb
commit f9b58c4077
No known key found for this signature in database
1 changed files with 64 additions and 46 deletions

View File

@ -767,10 +767,15 @@ void MainWindow::destroySubWindows()
void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidget* parent_window, QMenu* menu)
{
QAction* resume_action = menu->addAction(tr("Resume"));
QAction* resume_action = nullptr;
QMenu* load_state_menu = nullptr;
if (!entry->IsDiscSet())
{
resume_action = menu->addAction(tr("Resume"));
resume_action->setEnabled(false);
QMenu* load_state_menu = menu->addMenu(tr("Load State"));
load_state_menu = menu->addMenu(tr("Load State"));
load_state_menu->setEnabled(false);
if (!entry->serial.empty())
@ -805,6 +810,7 @@ void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidg
[this, entry, path = std::move(ssi.path)]() { startFile(entry->path, std::move(path), std::nullopt); });
}
}
}
QAction* open_memory_cards_action = menu->addAction(tr("Edit Memory Cards..."));
connect(open_memory_cards_action, &QAction::triggered, [entry]() {
@ -815,6 +821,8 @@ void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidg
g_main_window->openMemoryCardEditor(paths[0], paths[1]);
});
if (!entry->IsDiscSet())
{
const bool has_any_states = resume_action->isEnabled() || load_state_menu->isEnabled();
QAction* delete_save_states_action = menu->addAction(tr("Delete Save States..."));
delete_save_states_action->setEnabled(has_any_states);
@ -833,6 +841,7 @@ void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidg
System::DeleteSaveStates(entry->serial.c_str(), true);
});
}
}
}
static QString FormatTimestampForSaveStateMenu(u64 timestamp)
@ -1511,12 +1520,21 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
SettingsWindow::openGamePropertiesDialog(first_disc->path, first_disc->serial, first_disc->region);
});
connect(menu.addAction(tr("Set Cover Image...")), &QAction::triggered,
[this, entry]() { setGameListEntryCoverImage(entry); });
menu.addSeparator();
populateGameListContextMenu(entry, this, &menu);
menu.addSeparator();
connect(menu.addAction(tr("Select Disc")), &QAction::triggered, this, &MainWindow::onGameListEntryActivated);
}
}
menu.addSeparator();
connect(menu.addAction(tr("Add Search Directory...")), &QAction::triggered,
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });