Qt: add option to reset time played

This commit is contained in:
Megamouse 2023-04-18 21:17:57 +02:00
parent 450ab7c289
commit e133c8c2c3

View File

@ -1302,6 +1302,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
QAction* download_compat = menu.addAction(tr("&Download Compatibility Database"));
menu.addSeparator();
QAction* edit_notes = menu.addAction(tr("&Edit Tooltip Notes"));
QAction* reset_time_played = menu.addAction(tr("&Reset Time Played"));
QMenu* icon_menu = menu.addMenu(tr("&Custom Images"));
const std::array<QAction*, 3> custom_icon_actions =
@ -1625,6 +1626,16 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
Refresh();
}
});
connect(reset_time_played, &QAction::triggered, this, [this, name, serial]
{
if (QMessageBox::question(this, tr("Confirm Reset"), tr("Reset time played?\n\n%0 [%1]").arg(name).arg(serial)) == QMessageBox::Yes)
{
m_persistent_settings->SetPlaytime(serial, 0);
m_persistent_settings->SetLastPlayed(serial, 0);
m_persistent_settings->sync();
Refresh();
}
});
connect(copy_info, &QAction::triggered, this, [name, serial]
{
QApplication::clipboard()->setText(name % QStringLiteral(" [") % serial % QStringLiteral("]"));