diff --git a/src/swiftgui_standard/swiftguistd.cpp b/src/swiftgui_standard/swiftguistd.cpp index 7bfcbad0f..914951de0 100644 --- a/src/swiftgui_standard/swiftguistd.cpp +++ b/src/swiftgui_standard/swiftguistd.cpp @@ -46,7 +46,7 @@ SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowM { // GUI ui->setupUi(this); - this->ui->wi_CentralWidgetOutside->setProperty("mainframeless", this->isFrameless()); + this->ui->wi_CentralWidgetOutside->setProperty("frameless", this->isFrameless()); this->m_compInfoWindow = new CInfoWindowComponent(this); // setupUi has to be first! } @@ -106,7 +106,6 @@ void SwiftGuiStd::closeEvent(QCloseEvent *event) { Q_UNUSED(event); this->performGracefulShutdown(); - // if (this->sender() != this) QMainWindow::closeEvent(event); QApplication::exit(); } @@ -132,6 +131,19 @@ bool SwiftGuiStd::isMainPageSelected(SwiftGuiStd::MainPageIndex mainPage) const return this->ui->sw_MainMiddle->currentIndex() == static_cast(mainPage); } +void SwiftGuiStd::hideMainPage(bool hide) +{ + //! \todo further implement hide main page + if (hide) + { + + } + else + { + + } +} + void SwiftGuiStd::ps_loginRequested() { if (this->ui->sw_MainMiddle->currentIndex() == static_cast(MainPageLogin)) @@ -275,7 +287,7 @@ void SwiftGuiStd::updateGuiStatusInformation() /* * Opacity 0-100 */ -void SwiftGuiStd::ps_changeWindowOpacity(int opacity) +void SwiftGuiStd::ps_onChangedWindowOpacity(int opacity) { qreal o = opacity / 100.0; o = o < 0.3 ? 0.3 : o; @@ -315,12 +327,12 @@ void SwiftGuiStd::ps_registerHotkeyFunctions() m_inputManager->registerHotkeyFunc(CHotkeyFunction::Opacity50(), this, [ this ](bool isPressed) { - if (isPressed) this->ps_changeWindowOpacity(50); + if (isPressed) this->ps_onChangedWindowOpacity(50); }); m_inputManager->registerHotkeyFunc(CHotkeyFunction::Opacity100(), this, [ this ](bool isPressed) { - if (isPressed) this->ps_changeWindowOpacity(100); + if (isPressed) this->ps_onChangedWindowOpacity(100); }); m_inputManager->registerHotkeyFunc(CHotkeyFunction::ToogleWindowsStayOnTop(), this, [ this ](bool isPressed) @@ -343,12 +355,24 @@ void SwiftGuiStd::ps_onStyleSheetsChanged() this->setStyleSheet(s); } + +/* + * Main widget (login, main info area...) + */ void SwiftGuiStd::ps_onCurrentMainWidgetChanged(int currentIndex) { emit currentMainInfoAreaChanged(this->ui->sw_MainMiddle->currentWidget()); Q_UNUSED(currentIndex); } +/* + * Main info area floating? + */ +void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating) +{ + this->hideMainPage(floating); +} + /* * Notification */ diff --git a/src/swiftgui_standard/swiftguistd.h b/src/swiftgui_standard/swiftguistd.h index 17bfbc732..a7bbbdfe2 100644 --- a/src/swiftgui_standard/swiftguistd.h +++ b/src/swiftgui_standard/swiftguistd.h @@ -62,7 +62,7 @@ public: }; //! Constructor - explicit SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent = nullptr); + SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent = nullptr); //! Destructor ~SwiftGuiStd(); @@ -83,13 +83,13 @@ signals: protected: //! \copy QMainWindow::mouseMoveEvent - void mouseMoveEvent(QMouseEvent *event) override { if (!handleMouseMoveEvent(event)) { QMainWindow::mouseMoveEvent(event); } ; } + virtual void mouseMoveEvent(QMouseEvent *event) override { if (!handleMouseMoveEvent(event)) { QMainWindow::mouseMoveEvent(event); } ; } //! \copy QMainWindow::mousePressEvent - void mousePressEvent(QMouseEvent *event) override { if (!handleMousePressEvent(event)) { QMainWindow::mousePressEvent(event); } } + virtual void mousePressEvent(QMouseEvent *event) override { if (!handleMousePressEvent(event)) { QMainWindow::mousePressEvent(event); } } //! \copydoc QMainWindow::closeEvent - void closeEvent(QCloseEvent *event) override; + virtual void closeEvent(QCloseEvent *event) override; private: QScopedPointer ui; @@ -105,6 +105,8 @@ private: bool m_contextAudioAvailable = false; QTimer *m_timerContextWatchdog = nullptr; //!< core available? BlackMisc::Aviation::CAircraft m_ownAircraft; //!< own aircraft's state + QSize m_windowMinSizeWithMainPageShown; + QSize m_windowMinSizeWithMainPageHidden; // cockpit QString m_transponderResetValue; //!< Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas @@ -152,6 +154,9 @@ private: */ bool isMainPageSelected(MainPageIndex mainPage) const; + //! Show or hide the main Page + void hideMainPage(bool hide); + //! Start all update timers void startUpdateTimersWhenConnected(); @@ -226,7 +231,7 @@ private slots: * \brief changeOpacity * \param opacity 0-100 */ - void ps_changeWindowOpacity(int opacity = -1); + void ps_onChangedWindowOpacity(int opacity = -1); //! Toogle Windows stay on top void ps_toogleWindowStayOnTop(); @@ -240,6 +245,8 @@ private slots: //! Main info area current widget changed void ps_onCurrentMainWidgetChanged(int currentIndex); + //! Whole main info area floating + void ps_onChangedMainInfoAreaFloating(bool floating); }; #pragma pop_macro("interface") diff --git a/src/swiftgui_standard/swiftguistd.ui b/src/swiftgui_standard/swiftguistd.ui index 5fc125ca1..bb124aa5a 100644 --- a/src/swiftgui_standard/swiftguistd.ui +++ b/src/swiftgui_standard/swiftguistd.ui @@ -90,7 +90,7 @@ - + 0 @@ -103,7 +103,7 @@ 0 - + @@ -173,10 +173,10 @@ - + - + 0 0 diff --git a/src/swiftgui_standard/swiftguistd_init.cpp b/src/swiftgui_standard/swiftguistd_init.cpp index 478bf6e6e..9bb1e8054 100644 --- a/src/swiftgui_standard/swiftguistd_init.cpp +++ b/src/swiftgui_standard/swiftguistd_init.cpp @@ -52,10 +52,15 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig) // http://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5 if (this->isFrameless()) { + // wrap menu in layout, add button to menu bar and insert on top QHBoxLayout *menuBarLayout = this->addFramelessCloseButton(this->ui->mb_MainMenuBar); this->ui->vl_CentralWidgetOutside->insertLayout(0, menuBarLayout, 0); - // move the status bar intothe frame (otherwise it is dangling outside) + // now insert the dock widget info bar into the widget + this->ui->vl_CentralWidgetOutside->insertWidget(1, this->ui->dw_InfoBarStatus); + + // move the status bar into the frame + // (otherwise it is dangling outside the frame as it belongs to the window) this->ui->sb_MainStatusBar->setParent(this->ui->wi_CentralWidgetOutside); this->ui->vl_CentralWidgetOutside->addWidget(this->ui->sb_MainStatusBar, 0); @@ -134,7 +139,7 @@ void SwiftGuiStd::initGuiSignals() // main keypad connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this, &SwiftGuiStd::ps_setMainPageInfoArea); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &SwiftGuiStd::ps_loginRequested); - connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &SwiftGuiStd::ps_changeWindowOpacity); + connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &SwiftGuiStd::ps_onChangedWindowOpacity); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::identPressed, this->ui->comp_MainInfoArea->getCockpitComponent(), &CCockpitComponent::setSelectedTransponderModeStateIdent); connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedInfoAreaStatus, ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::onMainInfoAreaChanged); @@ -157,7 +162,7 @@ void SwiftGuiStd::initGuiSignals() connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display); // settings (GUI component), styles - connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &SwiftGuiStd::ps_changeWindowOpacity); + connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &SwiftGuiStd::ps_onChangedWindowOpacity); connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &SwiftGuiStd::ps_onStyleSheetsChanged); // sliders @@ -176,6 +181,8 @@ void SwiftGuiStd::initGuiSignals() this->ui->comp_MainInfoArea->getSettingsComponent()->setSettingsTab(CSettingsComponent::SettingTabNetwork); }); + // main info area + connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedWholeInfoAreaFloating, this, &SwiftGuiStd::ps_onChangedMainInfoAreaFloating); } /*