Qt: Add option to reset played time

This commit is contained in:
Connor McLaughlin
2023-01-11 20:21:27 +10:00
parent 50a616421f
commit 7c6071dfe1
6 changed files with 52 additions and 8 deletions

View File

@ -1408,6 +1408,9 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
connect(menu.addAction(tr("Exclude From List")), &QAction::triggered,
[this, entry]() { getSettingsDialog()->getGameListSettingsWidget()->addExcludedPath(entry->path); });
connect(menu.addAction(tr("Reset Play Time")), &QAction::triggered,
[this, entry]() { clearGameListEntryPlayTime(entry); });
connect(menu.addAction(tr("Add Search Directory...")), &QAction::triggered,
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });
@ -1451,6 +1454,20 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry)
m_game_list_widget->refreshGridCovers();
}
void MainWindow::clearGameListEntryPlayTime(const GameList::Entry* entry)
{
if (QMessageBox::question(
this, tr("Confirm Reset"),
tr("Are you sure you want to reset the play time for '%1'?\n\nThis action cannot be undone.")
.arg(QString::fromStdString(entry->title))) != QMessageBox::Yes)
{
return;
}
GameList::ClearPlayedTimeForSerial(entry->serial);
m_game_list_widget->refresh(false);
}
void MainWindow::setupAdditionalUi()
{
const bool status_bar_visible = Host::GetBaseBoolSettingValue("UI", "ShowStatusBar", true);