mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #347, improvement in main GUI
* info bar attached to window layout * prepared for floating info area (whole area) -> hideMainPage * renamed some functions (slots)
This commit is contained in:
committed by
Roland Winklmeier
parent
bd2bf0d3ba
commit
e6d0f2ecb4
@@ -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<int>(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<int>(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
|
||||
*/
|
||||
|
||||
@@ -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::SwiftGuiStd> 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")
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_CentralFrameInside">
|
||||
<layout class="QVBoxLayout" name="vl_CentralFrameInside">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -103,7 +103,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="sw_MainMiddle">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
@@ -173,10 +173,10 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CMainKeypadAreaComponent" name="comp_MainKeypadArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user