mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01:00
More accessible screen layout settings. (#3340)
* Remove borders from status bar items On Ubuntu the status bar didn't look as good as on Windows due to some border being drawn around each status bar cell. * Revert "Remove borders from status bar items" This reverts commit 15fd32bf2b33d72f5c1b589b35c8dd6232ad263c. * Remove borders from status bar items On Ubuntu the status bar didn't look as good as on Windows due to some border being drawn around each status bar cell. * More accessible screen layout settings. Depending on the game I'm playing I find myself needing to switch screen layouts very often and it's currently a hassle to have to open the settings dialog in order to do that so I've added shortcuts for the screen layout options and swap screen option on the main menu plus I added a keyboard shortcut to quickly toggle between the available layouts during game play (F10). I've also updated the swap screen shortcut (F9 now, used to be Ctrl + Tab) so it's next to the layout toggle shortcut by default (F9 and F10). * Clean up.
This commit is contained in:
parent
d3a0375f47
commit
8e4b806419
@ -192,7 +192,15 @@ void GMainWindow::InitializeWidgets() {
|
|||||||
statusBar()->addPermanentWidget(label, 0);
|
statusBar()->addPermanentWidget(label, 0);
|
||||||
}
|
}
|
||||||
statusBar()->setVisible(true);
|
statusBar()->setVisible(true);
|
||||||
|
|
||||||
|
// Removes an ugly inner border from the status bar widgets under Linux
|
||||||
setStyleSheet("QStatusBar::item{border: none;}");
|
setStyleSheet("QStatusBar::item{border: none;}");
|
||||||
|
|
||||||
|
QActionGroup* actionGroup_ScreenLayouts = new QActionGroup(this);
|
||||||
|
actionGroup_ScreenLayouts->addAction(ui.action_Screen_Layout_Default);
|
||||||
|
actionGroup_ScreenLayouts->addAction(ui.action_Screen_Layout_Single_Screen);
|
||||||
|
actionGroup_ScreenLayouts->addAction(ui.action_Screen_Layout_Large_Screen);
|
||||||
|
actionGroup_ScreenLayouts->addAction(ui.action_Screen_Layout_Side_by_Side);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::InitializeDebugWidgets() {
|
void GMainWindow::InitializeDebugWidgets() {
|
||||||
@ -269,8 +277,9 @@ void GMainWindow::InitializeRecentFileMenuActions() {
|
|||||||
|
|
||||||
void GMainWindow::InitializeHotkeys() {
|
void GMainWindow::InitializeHotkeys() {
|
||||||
RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
|
RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
|
||||||
RegisterHotkey("Main Window", "Swap Screens", QKeySequence::NextChild);
|
|
||||||
RegisterHotkey("Main Window", "Start Emulation");
|
RegisterHotkey("Main Window", "Start Emulation");
|
||||||
|
RegisterHotkey("Main Window", "Swap Screens", QKeySequence(tr("F9")));
|
||||||
|
RegisterHotkey("Main Window", "Toggle Screen Layout", QKeySequence(tr("F10")));
|
||||||
RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen);
|
RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen);
|
||||||
RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape),
|
RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape),
|
||||||
Qt::ApplicationShortcut);
|
Qt::ApplicationShortcut);
|
||||||
@ -284,8 +293,10 @@ void GMainWindow::InitializeHotkeys() {
|
|||||||
&GMainWindow::OnMenuLoadFile);
|
&GMainWindow::OnMenuLoadFile);
|
||||||
connect(GetHotkey("Main Window", "Start Emulation", this), &QShortcut::activated, this,
|
connect(GetHotkey("Main Window", "Start Emulation", this), &QShortcut::activated, this,
|
||||||
&GMainWindow::OnStartGame);
|
&GMainWindow::OnStartGame);
|
||||||
connect(GetHotkey("Main Window", "Swap Screens", render_window), &QShortcut::activated, this,
|
connect(GetHotkey("Main Window", "Swap Screens", render_window), &QShortcut::activated,
|
||||||
&GMainWindow::OnSwapScreens);
|
ui.action_Screen_Layout_Swap_Screens, &QAction::trigger);
|
||||||
|
connect(GetHotkey("Main Window", "Toggle Screen Layout", render_window), &QShortcut::activated,
|
||||||
|
this, &GMainWindow::ToggleScreenLayout);
|
||||||
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
|
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
|
||||||
ui.action_Fullscreen, &QAction::trigger);
|
ui.action_Fullscreen, &QAction::trigger);
|
||||||
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
|
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
|
||||||
@ -347,6 +358,7 @@ void GMainWindow::RestoreUIState() {
|
|||||||
ToggleWindowMode();
|
ToggleWindowMode();
|
||||||
|
|
||||||
ui.action_Fullscreen->setChecked(UISettings::values.fullscreen);
|
ui.action_Fullscreen->setChecked(UISettings::values.fullscreen);
|
||||||
|
SyncMenuUISettings();
|
||||||
|
|
||||||
ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
|
ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
|
||||||
OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
|
OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
|
||||||
@ -397,7 +409,20 @@ void GMainWindow::ConnectMenuEvents() {
|
|||||||
connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
|
connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
|
||||||
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
||||||
ui.action_Fullscreen->setShortcut(GetHotkey("Main Window", "Fullscreen", this)->key());
|
ui.action_Fullscreen->setShortcut(GetHotkey("Main Window", "Fullscreen", this)->key());
|
||||||
|
ui.action_Screen_Layout_Swap_Screens->setShortcut(
|
||||||
|
GetHotkey("Main Window", "Swap Screens", this)->key());
|
||||||
|
ui.action_Screen_Layout_Swap_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
|
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
|
||||||
|
connect(ui.action_Screen_Layout_Default, &QAction::triggered, this,
|
||||||
|
&GMainWindow::ChangeScreenLayout);
|
||||||
|
connect(ui.action_Screen_Layout_Single_Screen, &QAction::triggered, this,
|
||||||
|
&GMainWindow::ChangeScreenLayout);
|
||||||
|
connect(ui.action_Screen_Layout_Large_Screen, &QAction::triggered, this,
|
||||||
|
&GMainWindow::ChangeScreenLayout);
|
||||||
|
connect(ui.action_Screen_Layout_Side_by_Side, &QAction::triggered, this,
|
||||||
|
&GMainWindow::ChangeScreenLayout);
|
||||||
|
connect(ui.action_Screen_Layout_Swap_Screens, &QAction::triggered, this,
|
||||||
|
&GMainWindow::OnSwapScreens);
|
||||||
|
|
||||||
// Help
|
// Help
|
||||||
connect(ui.action_FAQ, &QAction::triggered,
|
connect(ui.action_FAQ, &QAction::triggered,
|
||||||
@ -937,6 +962,50 @@ void GMainWindow::ToggleWindowMode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ChangeScreenLayout() {
|
||||||
|
Settings::LayoutOption new_layout = Settings::LayoutOption::Default;
|
||||||
|
|
||||||
|
if (ui.action_Screen_Layout_Default->isChecked()) {
|
||||||
|
new_layout = Settings::LayoutOption::Default;
|
||||||
|
} else if (ui.action_Screen_Layout_Single_Screen->isChecked()) {
|
||||||
|
new_layout = Settings::LayoutOption::SingleScreen;
|
||||||
|
} else if (ui.action_Screen_Layout_Large_Screen->isChecked()) {
|
||||||
|
new_layout = Settings::LayoutOption::LargeScreen;
|
||||||
|
} else if (ui.action_Screen_Layout_Side_by_Side->isChecked()) {
|
||||||
|
new_layout = Settings::LayoutOption::SideScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings::values.layout_option = new_layout;
|
||||||
|
Settings::Apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ToggleScreenLayout() {
|
||||||
|
Settings::LayoutOption new_layout = Settings::LayoutOption::Default;
|
||||||
|
|
||||||
|
switch (Settings::values.layout_option) {
|
||||||
|
case Settings::LayoutOption::Default:
|
||||||
|
new_layout = Settings::LayoutOption::SingleScreen;
|
||||||
|
break;
|
||||||
|
case Settings::LayoutOption::SingleScreen:
|
||||||
|
new_layout = Settings::LayoutOption::LargeScreen;
|
||||||
|
break;
|
||||||
|
case Settings::LayoutOption::LargeScreen:
|
||||||
|
new_layout = Settings::LayoutOption::SideScreen;
|
||||||
|
break;
|
||||||
|
case Settings::LayoutOption::SideScreen:
|
||||||
|
new_layout = Settings::LayoutOption::Default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings::values.layout_option = new_layout;
|
||||||
|
Settings::Apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMainWindow::OnSwapScreens() {
|
||||||
|
Settings::values.swap_screen = ui.action_Screen_Layout_Swap_Screens->isChecked();
|
||||||
|
Settings::Apply();
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
ConfigureDialog configureDialog(this);
|
ConfigureDialog configureDialog(this);
|
||||||
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
|
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
|
||||||
@ -945,6 +1014,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
configureDialog.applyConfiguration();
|
configureDialog.applyConfiguration();
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
|
SyncMenuUISettings();
|
||||||
config->Save();
|
config->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -958,11 +1028,6 @@ void GMainWindow::OnToggleFilterBar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnSwapScreens() {
|
|
||||||
Settings::values.swap_screen = !Settings::values.swap_screen;
|
|
||||||
Settings::Apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMainWindow::OnCreateGraphicsSurfaceViewer() {
|
void GMainWindow::OnCreateGraphicsSurfaceViewer() {
|
||||||
auto graphicsSurfaceViewerWidget = new GraphicsSurfaceWidget(Pica::g_debug_context, this);
|
auto graphicsSurfaceViewerWidget = new GraphicsSurfaceWidget(Pica::g_debug_context, this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceViewerWidget);
|
addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceViewerWidget);
|
||||||
@ -1201,6 +1266,18 @@ void GMainWindow::SetupUIStrings() {
|
|||||||
tr("Citra %1| %2-%3").arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
tr("Citra %1| %2-%3").arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::SyncMenuUISettings() {
|
||||||
|
ui.action_Screen_Layout_Default->setChecked(Settings::values.layout_option ==
|
||||||
|
Settings::LayoutOption::Default);
|
||||||
|
ui.action_Screen_Layout_Single_Screen->setChecked(Settings::values.layout_option ==
|
||||||
|
Settings::LayoutOption::SingleScreen);
|
||||||
|
ui.action_Screen_Layout_Large_Screen->setChecked(Settings::values.layout_option ==
|
||||||
|
Settings::LayoutOption::LargeScreen);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef main
|
#ifdef main
|
||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,6 +79,7 @@ private:
|
|||||||
void InitializeHotkeys();
|
void InitializeHotkeys();
|
||||||
|
|
||||||
void SetDefaultUIGeometry();
|
void SetDefaultUIGeometry();
|
||||||
|
void SyncMenuUISettings();
|
||||||
void RestoreUIState();
|
void RestoreUIState();
|
||||||
|
|
||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
@ -139,11 +140,13 @@ private slots:
|
|||||||
/// Called whenever a user selects the "File->Select Game List Root" menu item
|
/// Called whenever a user selects the "File->Select Game List Root" menu item
|
||||||
void OnMenuSelectGameListRoot();
|
void OnMenuSelectGameListRoot();
|
||||||
void OnMenuRecentFile();
|
void OnMenuRecentFile();
|
||||||
void OnSwapScreens();
|
|
||||||
void OnConfigure();
|
void OnConfigure();
|
||||||
void OnToggleFilterBar();
|
void OnToggleFilterBar();
|
||||||
void OnDisplayTitleBars(bool);
|
void OnDisplayTitleBars(bool);
|
||||||
void ToggleFullscreen();
|
void ToggleFullscreen();
|
||||||
|
void ChangeScreenLayout();
|
||||||
|
void ToggleScreenLayout();
|
||||||
|
void OnSwapScreens();
|
||||||
void ShowFullscreen();
|
void ShowFullscreen();
|
||||||
void HideFullscreen();
|
void HideFullscreen();
|
||||||
void ToggleWindowMode();
|
void ToggleWindowMode();
|
||||||
|
@ -86,11 +86,25 @@
|
|||||||
<addaction name="action_Create_Pica_Surface_Viewer"/>
|
<addaction name="action_Create_Pica_Surface_Viewer"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_Screen_Layout">
|
||||||
|
<property name="title">
|
||||||
|
<string>Screen Layout</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_Screen_Layout_Default"/>
|
||||||
|
<addaction name="action_Screen_Layout_Single_Screen"/>
|
||||||
|
<addaction name="action_Screen_Layout_Large_Screen"/>
|
||||||
|
<addaction name="action_Screen_Layout_Side_by_Side"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="action_Screen_Layout_Swap_Screens"/>
|
||||||
|
</widget>
|
||||||
<addaction name="action_Fullscreen"/>
|
<addaction name="action_Fullscreen"/>
|
||||||
<addaction name="action_Single_Window_Mode"/>
|
<addaction name="action_Single_Window_Mode"/>
|
||||||
|
<addaction name="menu_Screen_Layout"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="action_Display_Dock_Widget_Headers"/>
|
<addaction name="action_Display_Dock_Widget_Headers"/>
|
||||||
<addaction name="action_Show_Filter_Bar"/>
|
<addaction name="action_Show_Filter_Bar"/>
|
||||||
<addaction name="action_Show_Status_Bar"/>
|
<addaction name="action_Show_Status_Bar"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="menu_View_Debugging"/>
|
<addaction name="menu_View_Debugging"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Help">
|
<widget class="QMenu" name="menu_Help">
|
||||||
@ -230,6 +244,46 @@
|
|||||||
<string>Opens the maintenance tool to modify your Citra installation</string>
|
<string>Opens the maintenance tool to modify your Citra installation</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_Screen_Layout_Default">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Default</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Layout_Single_Screen">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Single Screen</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Layout_Large_Screen">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Large Screen</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Layout_Side_by_Side">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Side by Side</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Layout_Swap_Screens">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Swap Screens</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="action_Check_For_Updates">
|
<action name="action_Check_For_Updates">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Check for Updates</string>
|
<string>Check for Updates</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user