Merge pull request #4056 from zhaowenlan1779/clear-recent-files

citra_qt: add Clear Recent Files menu action
This commit is contained in:
James Rowe 2018-08-07 21:28:33 -06:00 committed by GitHub
commit 93386efccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View file

@ -312,6 +312,14 @@ void GMainWindow::InitializeRecentFileMenuActions() {
ui.menu_recent_files->addAction(actions_recent_files[i]); ui.menu_recent_files->addAction(actions_recent_files[i]);
} }
ui.menu_recent_files->addSeparator();
QAction* action_clear_recent_files = new QAction(this);
action_clear_recent_files->setText(tr("Clear Recent Files"));
connect(action_clear_recent_files, &QAction::triggered, this, [this] {
UISettings::values.recent_files.clear();
UpdateRecentFiles();
});
ui.menu_recent_files->addAction(action_clear_recent_files);
UpdateRecentFiles(); UpdateRecentFiles();
} }
@ -347,10 +355,10 @@ void GMainWindow::InitializeHotkeys() {
} }
} }
}); });
connect(GetHotkey("Main Window", "Restart", this), &QShortcut::activated, this, [&] { connect(GetHotkey("Main Window", "Restart", this), &QShortcut::activated, this, [this] {
if (!Core::System::GetInstance().IsPoweredOn()) if (!Core::System::GetInstance().IsPoweredOn())
return; return;
BootGame(QString(UISettings::values.recent_files.first())); BootGame(QString(game_path));
}); });
connect(GetHotkey("Main Window", "Swap Screens", render_window), &QShortcut::activated, connect(GetHotkey("Main Window", "Swap Screens", render_window), &QShortcut::activated,
ui.action_Screen_Layout_Swap_Screens, &QAction::trigger); ui.action_Screen_Layout_Swap_Screens, &QAction::trigger);
@ -468,8 +476,7 @@ void GMainWindow::ConnectMenuEvents() {
connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
connect(ui.action_Restart, &QAction::triggered, this, connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); });
[&] { BootGame(QString(UISettings::values.recent_files.first())); });
connect(ui.action_Report_Compatibility, &QAction::triggered, this, connect(ui.action_Report_Compatibility, &QAction::triggered, this,
&GMainWindow::OnMenuReportCompatibility); &GMainWindow::OnMenuReportCompatibility);
connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
@ -687,6 +694,8 @@ bool GMainWindow::LoadROM(const QString& filename) {
game_title = QString::fromStdString(title); game_title = QString::fromStdString(title);
SetupUIStrings(); SetupUIStrings();
game_path = filename;
Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt"); Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt");
return true; return true;
} }
@ -784,6 +793,8 @@ void GMainWindow::ShutdownGame() {
game_title.clear(); game_title.clear();
SetupUIStrings(); SetupUIStrings();
game_path.clear();
} }
void GMainWindow::StoreRecentFile(const QString& filename) { void GMainWindow::StoreRecentFile(const QString& filename) {

View file

@ -205,6 +205,8 @@ private:
std::unique_ptr<EmuThread> emu_thread; std::unique_ptr<EmuThread> emu_thread;
// The title of the game currently running // The title of the game currently running
QString game_title; QString game_title;
// The path to the game currently running
QString game_path;
// Debugger panes // Debugger panes
ProfilerWidget* profilerWidget; ProfilerWidget* profilerWidget;