mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	citra_qt: add Restart hotkey & menu action code
This commit is contained in:
		
							parent
							
								
									ffae5be1ea
								
							
						
					
					
						commit
						6380d52d1c
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -309,6 +309,7 @@ void GMainWindow::InitializeHotkeys() { | ||||||
|     RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |     RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | ||||||
|     RegisterHotkey("Main Window", "Start Emulation"); |     RegisterHotkey("Main Window", "Start Emulation"); | ||||||
|     RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4)); |     RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4)); | ||||||
|  |     RegisterHotkey("Main Window", "Restart", QKeySequence(Qt::Key_F5)); | ||||||
|     RegisterHotkey("Main Window", "Swap Screens", QKeySequence(tr("F9"))); |     RegisterHotkey("Main Window", "Swap Screens", QKeySequence(tr("F9"))); | ||||||
|     RegisterHotkey("Main Window", "Toggle Screen Layout", QKeySequence(tr("F10"))); |     RegisterHotkey("Main Window", "Toggle Screen Layout", QKeySequence(tr("F10"))); | ||||||
|     RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); |     RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); | ||||||
|  | @ -335,6 +336,11 @@ void GMainWindow::InitializeHotkeys() { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|  |     connect(GetHotkey("Main Window", "Restart", this), &QShortcut::activated, this, [&] { | ||||||
|  |         if (!Core::System::GetInstance().IsPoweredOn()) | ||||||
|  |             return; | ||||||
|  |         BootGame(QString(UISettings::values.recent_files.first())); | ||||||
|  |     }); | ||||||
|     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); | ||||||
|     connect(GetHotkey("Main Window", "Toggle Screen Layout", render_window), &QShortcut::activated, |     connect(GetHotkey("Main Window", "Toggle Screen Layout", render_window), &QShortcut::activated, | ||||||
|  | @ -450,6 +456,8 @@ 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, | ||||||
|  |             [&] { 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); | ||||||
|  | @ -740,6 +748,7 @@ void GMainWindow::ShutdownGame() { | ||||||
|     ui.action_Start->setText(tr("Start")); |     ui.action_Start->setText(tr("Start")); | ||||||
|     ui.action_Pause->setEnabled(false); |     ui.action_Pause->setEnabled(false); | ||||||
|     ui.action_Stop->setEnabled(false); |     ui.action_Stop->setEnabled(false); | ||||||
|  |     ui.action_Restart->setEnabled(false); | ||||||
|     ui.action_Report_Compatibility->setEnabled(false); |     ui.action_Report_Compatibility->setEnabled(false); | ||||||
|     render_window->hide(); |     render_window->hide(); | ||||||
|     if (game_list->isEmpty()) |     if (game_list->isEmpty()) | ||||||
|  | @ -1016,6 +1025,7 @@ void GMainWindow::OnStartGame() { | ||||||
| 
 | 
 | ||||||
|     ui.action_Pause->setEnabled(true); |     ui.action_Pause->setEnabled(true); | ||||||
|     ui.action_Stop->setEnabled(true); |     ui.action_Stop->setEnabled(true); | ||||||
|  |     ui.action_Restart->setEnabled(true); | ||||||
|     ui.action_Report_Compatibility->setEnabled(true); |     ui.action_Report_Compatibility->setEnabled(true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue