Skip to content

Commit

Permalink
small screen position submenu on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidRGriswold committed Aug 20, 2024
1 parent 00ceabf commit 2214248
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 1 deletion.
77 changes: 76 additions & 1 deletion src/lime_qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ void GMainWindow::InitializeWidgets() {
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Separate_Windows);
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Hybrid_Screen);
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Custom_Layout);

QActionGroup* actionGroup_SmallPositions = new QActionGroup(this);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_TopRight);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_MiddleRight);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_BottomRight);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_TopLeft);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_MiddleLeft);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_BottomLeft);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_Above);
actionGroup_SmallPositions->addAction(ui->action_Small_Screen_Below);
}

void GMainWindow::InitializeDebugWidgets() {
Expand Down Expand Up @@ -923,6 +933,15 @@ void GMainWindow::ConnectMenuEvents() {
connect_menu(ui->action_Screen_Layout_Side_by_Side, &GMainWindow::ChangeScreenLayout);
connect_menu(ui->action_Screen_Layout_Separate_Windows, &GMainWindow::ChangeScreenLayout);
connect_menu(ui->action_Screen_Layout_Custom_Layout, &GMainWindow::ChangeScreenLayout);
connect_menu(ui->action_Small_Screen_TopRight, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_MiddleRight, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_BottomRight, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_TopLeft, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_MiddleLeft, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_BottomLeft, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_Above, &GMainWindow::ChangeSmallScreenPosition);
connect_menu(ui->action_Small_Screen_Below, &GMainWindow::ChangeSmallScreenPosition);

connect_menu(ui->action_Screen_Layout_Swap_Screens, &GMainWindow::OnSwapScreens);
connect_menu(ui->action_Screen_Layout_Upright_Screens, &GMainWindow::OnRotateScreens);

Expand Down Expand Up @@ -2441,13 +2460,13 @@ void GMainWindow::UpdateSecondaryWindowVisibility() {

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;
ui->menu_Small_Screen_Position->setEnabled(true);
} else if (ui->action_Screen_Layout_Hybrid_Screen->isChecked()) {
new_layout = Settings::LayoutOption::HybridScreen;
} else if (ui->action_Screen_Layout_Side_by_Side->isChecked()) {
Expand All @@ -2459,6 +2478,34 @@ void GMainWindow::ChangeScreenLayout() {
}

Settings::values.layout_option = new_layout;
SyncMenuUISettings();
system.ApplySettings();
UpdateSecondaryWindowVisibility();
}

void GMainWindow::ChangeSmallScreenPosition() {
Settings::SmallScreenPosition new_position = Settings::SmallScreenPosition::BottomRight;

if (ui->action_Small_Screen_TopRight->isChecked()) {
new_position = Settings::SmallScreenPosition::TopRight;
} else if (ui->action_Small_Screen_MiddleRight->isChecked()) {
new_position = Settings::SmallScreenPosition::MiddleRight;
} else if (ui->action_Small_Screen_BottomRight->isChecked()) {
new_position = Settings::SmallScreenPosition::BottomRight;
} else if (ui->action_Small_Screen_TopLeft->isChecked()) {
new_position = Settings::SmallScreenPosition::TopLeft;
} else if (ui->action_Small_Screen_MiddleLeft->isChecked()) {
new_position = Settings::SmallScreenPosition::MiddleLeft;
} else if (ui->action_Small_Screen_BottomLeft->isChecked()) {
new_position = Settings::SmallScreenPosition::BottomLeft;
} else if (ui->action_Small_Screen_Above->isChecked()) {
new_position = Settings::SmallScreenPosition::Above;
} else if (ui->action_Small_Screen_Below->isChecked()) {
new_position = Settings::SmallScreenPosition::Below;
}

Settings::values.small_screen_position = new_position;
SyncMenuUISettings();
system.ApplySettings();
UpdateSecondaryWindowVisibility();
}
Expand Down Expand Up @@ -3525,6 +3572,34 @@ void GMainWindow::SyncMenuUISettings() {
ui->action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen.GetValue());
ui->action_Screen_Layout_Upright_Screens->setChecked(
Settings::values.upright_screen.GetValue());

if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::LargeScreen) {
ui->menu_Small_Screen_Position->setEnabled(true);
} else {
ui->menu_Small_Screen_Position->setEnabled(false);
}

ui->action_Small_Screen_TopRight->setChecked(
Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::TopRight);
ui->action_Small_Screen_MiddleRight->setChecked(
Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::MiddleRight);
ui->action_Small_Screen_BottomRight->setChecked(
Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::BottomRight);
ui->action_Small_Screen_TopLeft->setChecked(Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::TopLeft);
ui->action_Small_Screen_MiddleLeft->setChecked(
Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::MiddleLeft);
ui->action_Small_Screen_BottomLeft->setChecked(
Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::BottomLeft);
ui->action_Small_Screen_Above->setChecked(Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::Above);
ui->action_Small_Screen_Below->setChecked(Settings::values.small_screen_position.GetValue() ==
Settings::SmallScreenPosition::Below);
}

void GMainWindow::RetranslateStatusBar() {
Expand Down
1 change: 1 addition & 0 deletions src/lime_qt/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ private slots:
void ToggleFullscreen();
void ToggleSecondaryFullscreen();
void ChangeScreenLayout();
void ChangeSmallScreenPosition();
void UpdateSecondaryWindowVisibility();
void ToggleScreenLayout();
void OnSwapScreens();
Expand Down
77 changes: 77 additions & 0 deletions src/lime_qt/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@
<addaction name="separator"/>
<addaction name="action_Screen_Layout_Upright_Screens"/>
<addaction name="action_Screen_Layout_Swap_Screens"/>
<widget class="QMenu" name="menu_Small_Screen_Position">
<property name="title">
<string>Small Screen Position</string>
</property>
<addaction name="action_Small_Screen_TopRight"/>
<addaction name="action_Small_Screen_MiddleRight"/>
<addaction name="action_Small_Screen_BottomRight"/>
<addaction name="action_Small_Screen_TopLeft"/>
<addaction name="action_Small_Screen_MiddleLeft"/>
<addaction name="action_Small_Screen_BottomLeft"/>
<addaction name="action_Small_Screen_Above"/>
<addaction name="action_Small_Screen_Below"/>
</widget>
</widget>
<addaction name="action_Fullscreen"/>
<addaction name="action_Single_Window_Mode"/>
Expand Down Expand Up @@ -538,6 +551,70 @@
<string>Custom Layout</string>
</property>
</action>
<action name="action_Small_Screen_TopRight">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Top Right</string>
</property>
</action>
<action name="action_Small_Screen_MiddleRight">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Middle Right</string>
</property>
</action>
<action name="action_Small_Screen_BottomRight">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Bottom Right</string>
</property>
</action>
<action name="action_Small_Screen_TopLeft">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Top Left</string>
</property>
</action>
<action name="action_Small_Screen_MiddleLeft">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Middle Left</string>
</property>
</action>
<action name="action_Small_Screen_BottomLeft">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Bottom Left</string>
</property>
</action>
<action name="action_Small_Screen_Above">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Above</string>
</property>
</action>
<action name="action_Small_Screen_Below">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Below</string>
</property>
</action>
<action name="action_Screen_Layout_Swap_Screens">
<property name="checkable">
<bool>true</bool>
Expand Down

0 comments on commit 2214248

Please sign in to comment.