diff --git a/src/lime_qt/main.cpp b/src/lime_qt/main.cpp index f60a43e09..0a7f274a8 100644 --- a/src/lime_qt/main.cpp +++ b/src/lime_qt/main.cpp @@ -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() { @@ -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); @@ -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()) { @@ -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(); } @@ -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() { diff --git a/src/lime_qt/main.h b/src/lime_qt/main.h index ccdf0ce9a..260cd1cd0 100644 --- a/src/lime_qt/main.h +++ b/src/lime_qt/main.h @@ -260,6 +260,7 @@ private slots: void ToggleFullscreen(); void ToggleSecondaryFullscreen(); void ChangeScreenLayout(); + void ChangeSmallScreenPosition(); void UpdateSecondaryWindowVisibility(); void ToggleScreenLayout(); void OnSwapScreens(); diff --git a/src/lime_qt/main.ui b/src/lime_qt/main.ui index cfa6b2e69..a3dd3d4ab 100644 --- a/src/lime_qt/main.ui +++ b/src/lime_qt/main.ui @@ -142,6 +142,19 @@ + + + Small Screen Position + + + + + + + + + + @@ -538,6 +551,70 @@ Custom Layout + + + true + + + Top Right + + + + + true + + + Middle Right + + + + + true + + + Bottom Right + + + + + true + + + Top Left + + + + + true + + + Middle Left + + + + + true + + + Bottom Left + + + + + true + + + Above + + + + + true + + + Below + + true