mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-18 05:51:49 +01:00
citra_qt: add Clear Recent Files menu action
I had to edit a bit of the Restart action so that it does not go wrong because recent files are cleared.
This commit is contained in:
parent
0233f3286c
commit
6a1f9afbba
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user