mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Merge pull request #5043 from vitor-k/screen-rotate
Implement Upright/Book-style layout
This commit is contained in:
		
						commit
						a0f9c795c8
					
				
					 15 changed files with 408 additions and 115 deletions
				
			
		|  | @ -57,7 +57,7 @@ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config: | |||
| // This must be in alphabetical order according to action name as it must have the same order as
 | ||||
| // UISetting::values.shortcuts, which is alphabetically ordered.
 | ||||
| // clang-format off
 | ||||
| const std::array<UISettings::Shortcut, 20> default_hotkeys{ | ||||
| const std::array<UISettings::Shortcut, 21> default_hotkeys{ | ||||
|     {{QStringLiteral("Advance Frame"),            QStringLiteral("Main Window"), {QStringLiteral("\\"), Qt::ApplicationShortcut}}, | ||||
|      {QStringLiteral("Capture Screenshot"),       QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}}, | ||||
|      {QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}}, | ||||
|  | @ -70,6 +70,7 @@ const std::array<UISettings::Shortcut, 20> default_hotkeys{ | |||
|      {QStringLiteral("Load File"),                QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WindowShortcut}}, | ||||
|      {QStringLiteral("Remove Amiibo"),            QStringLiteral("Main Window"), {QStringLiteral("F3"), Qt::ApplicationShortcut}}, | ||||
|      {QStringLiteral("Restart Emulation"),        QStringLiteral("Main Window"), {QStringLiteral("F6"), Qt::WindowShortcut}}, | ||||
|      {QStringLiteral("Rotate Screens Upright"),   QStringLiteral("Main Window"), {QStringLiteral("F8"), Qt::WindowShortcut}}, | ||||
|      {QStringLiteral("Stop Emulation"),           QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}}, | ||||
|      {QStringLiteral("Swap Screens"),             QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}}, | ||||
|      {QStringLiteral("Toggle Filter Bar"),        QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}}, | ||||
|  | @ -296,6 +297,7 @@ void Config::ReadLayoutValues() { | |||
|     Settings::values.layout_option = | ||||
|         static_cast<Settings::LayoutOption>(ReadSetting(QStringLiteral("layout_option")).toInt()); | ||||
|     Settings::values.swap_screen = ReadSetting(QStringLiteral("swap_screen"), false).toBool(); | ||||
|     Settings::values.upright_screen = ReadSetting(QStringLiteral("upright_screen"), false).toBool(); | ||||
|     Settings::values.custom_layout = ReadSetting(QStringLiteral("custom_layout"), false).toBool(); | ||||
|     Settings::values.custom_top_left = ReadSetting(QStringLiteral("custom_top_left"), 0).toInt(); | ||||
|     Settings::values.custom_top_top = ReadSetting(QStringLiteral("custom_top_top"), 0).toInt(); | ||||
|  | @ -765,6 +767,7 @@ void Config::SaveLayoutValues() { | |||
|     WriteSetting(QStringLiteral("filter_mode"), Settings::values.filter_mode, true); | ||||
|     WriteSetting(QStringLiteral("layout_option"), static_cast<int>(Settings::values.layout_option)); | ||||
|     WriteSetting(QStringLiteral("swap_screen"), Settings::values.swap_screen, false); | ||||
|     WriteSetting(QStringLiteral("upright_screen"), Settings::values.upright_screen, false); | ||||
|     WriteSetting(QStringLiteral("custom_layout"), Settings::values.custom_layout, false); | ||||
|     WriteSetting(QStringLiteral("custom_top_left"), Settings::values.custom_top_left, 0); | ||||
|     WriteSetting(QStringLiteral("custom_top_top"), Settings::values.custom_top_top, 0); | ||||
|  |  | |||
|  | @ -53,6 +53,7 @@ void ConfigureEnhancements::SetConfiguration() { | |||
|     ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option)); | ||||
|     ui->swap_screen->setChecked(Settings::values.swap_screen); | ||||
|     ui->toggle_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache); | ||||
|     ui->upright_screen->setChecked(Settings::values.upright_screen); | ||||
|     ui->toggle_dump_textures->setChecked(Settings::values.dump_textures); | ||||
|     ui->toggle_custom_textures->setChecked(Settings::values.custom_textures); | ||||
|     ui->toggle_preload_textures->setChecked(Settings::values.preload_textures); | ||||
|  | @ -101,6 +102,7 @@ void ConfigureEnhancements::ApplyConfiguration() { | |||
|         static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex()); | ||||
|     Settings::values.swap_screen = ui->swap_screen->isChecked(); | ||||
|     Settings::values.use_disk_shader_cache = ui->toggle_disk_shader_cache->isChecked(); | ||||
|     Settings::values.upright_screen = ui->upright_screen->isChecked(); | ||||
|     Settings::values.dump_textures = ui->toggle_dump_textures->isChecked(); | ||||
|     Settings::values.custom_textures = ui->toggle_custom_textures->isChecked(); | ||||
|     Settings::values.preload_textures = ui->toggle_preload_textures->isChecked(); | ||||
|  |  | |||
|  | @ -239,6 +239,13 @@ | |||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="QCheckBox" name="upright_screen"> | ||||
|         <property name="text"> | ||||
|          <string>Rotate Screens Upright</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <layout class="QHBoxLayout" name="horizontalLayout_6"> | ||||
|         <item> | ||||
|  |  | |||
|  | @ -410,6 +410,8 @@ void GMainWindow::InitializeHotkeys() { | |||
|             }); | ||||
|     connect(hotkey_registry.GetHotkey("Main Window", "Swap Screens", render_window), | ||||
|             &QShortcut::activated, ui.action_Screen_Layout_Swap_Screens, &QAction::trigger); | ||||
|     connect(hotkey_registry.GetHotkey("Main Window", "Rotate Screens Upright", render_window), | ||||
|             &QShortcut::activated, ui.action_Screen_Layout_Upright_Screens, &QAction::trigger); | ||||
|     connect(hotkey_registry.GetHotkey("Main Window", "Toggle Screen Layout", render_window), | ||||
|             &QShortcut::activated, this, &GMainWindow::ToggleScreenLayout); | ||||
|     connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), | ||||
|  | @ -607,6 +609,9 @@ void GMainWindow::ConnectMenuEvents() { | |||
|     ui.action_Screen_Layout_Swap_Screens->setShortcut( | ||||
|         hotkey_registry.GetHotkey("Main Window", "Swap Screens", this)->key()); | ||||
|     ui.action_Screen_Layout_Swap_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut); | ||||
|     ui.action_Screen_Layout_Upright_Screens->setShortcut( | ||||
|         hotkey_registry.GetHotkey("Main Window", "Rotate Screens Upright", this)->key()); | ||||
|     ui.action_Screen_Layout_Upright_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut); | ||||
|     connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); | ||||
|     connect(ui.action_Screen_Layout_Default, &QAction::triggered, this, | ||||
|             &GMainWindow::ChangeScreenLayout); | ||||
|  | @ -618,6 +623,8 @@ void GMainWindow::ConnectMenuEvents() { | |||
|             &GMainWindow::ChangeScreenLayout); | ||||
|     connect(ui.action_Screen_Layout_Swap_Screens, &QAction::triggered, this, | ||||
|             &GMainWindow::OnSwapScreens); | ||||
|     connect(ui.action_Screen_Layout_Upright_Screens, &QAction::triggered, this, | ||||
|             &GMainWindow::OnRotateScreens); | ||||
| 
 | ||||
|     // Movie
 | ||||
|     connect(ui.action_Record_Movie, &QAction::triggered, this, &GMainWindow::OnRecordMovie); | ||||
|  | @ -1435,6 +1442,11 @@ void GMainWindow::OnSwapScreens() { | |||
|     Settings::Apply(); | ||||
| } | ||||
| 
 | ||||
| void GMainWindow::OnRotateScreens() { | ||||
|     Settings::values.upright_screen = ui.action_Screen_Layout_Upright_Screens->isChecked(); | ||||
|     Settings::Apply(); | ||||
| } | ||||
| 
 | ||||
| void GMainWindow::OnCheats() { | ||||
|     CheatDialog cheat_dialog(this); | ||||
|     cheat_dialog.exec(); | ||||
|  | @ -2032,6 +2044,7 @@ void GMainWindow::SyncMenuUISettings() { | |||
|     ui.action_Screen_Layout_Side_by_Side->setChecked(Settings::values.layout_option == | ||||
|                                                      Settings::LayoutOption::SideScreen); | ||||
|     ui.action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen); | ||||
|     ui.action_Screen_Layout_Upright_Screens->setChecked(Settings::values.upright_screen); | ||||
| } | ||||
| 
 | ||||
| void GMainWindow::RetranslateStatusBar() { | ||||
|  |  | |||
|  | @ -187,6 +187,7 @@ private slots: | |||
|     void ChangeScreenLayout(); | ||||
|     void ToggleScreenLayout(); | ||||
|     void OnSwapScreens(); | ||||
|     void OnRotateScreens(); | ||||
|     void OnCheats(); | ||||
|     void ShowFullscreen(); | ||||
|     void HideFullscreen(); | ||||
|  |  | |||
|  | @ -109,6 +109,7 @@ | |||
|      <addaction name="action_Screen_Layout_Large_Screen"/> | ||||
|      <addaction name="action_Screen_Layout_Side_by_Side"/> | ||||
|      <addaction name="separator"/> | ||||
|      <addaction name="action_Screen_Layout_Upright_Screens"/> | ||||
|      <addaction name="action_Screen_Layout_Swap_Screens"/> | ||||
|     </widget> | ||||
|     <addaction name="action_Fullscreen"/> | ||||
|  | @ -425,6 +426,14 @@ | |||
|     <string>Swap Screens</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="action_Screen_Layout_Upright_Screens"> | ||||
|    <property name="checkable"> | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Rotate Upright</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="action_Check_For_Updates"> | ||||
|    <property name="text"> | ||||
|     <string>Check for Updates</string> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue