From 23dfc4c496e3f515a8bc0eb9e8ac959ff3e6cf80 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 5 Nov 2014 20:20:26 +0100 Subject: [PATCH] refs #335, adjusted main window for new managed status bar --- src/blackgui/qss/mainwindow.qss | 14 +++++++++++--- src/blackgui/showhidebar.ui | 16 ++++++++++++++-- src/swiftgui_standard/mainwindow.cpp | 11 +++-------- src/swiftgui_standard/mainwindow.h | 18 +++++++----------- src/swiftgui_standard/mainwindow_init.cpp | 22 ++++++---------------- 5 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/blackgui/qss/mainwindow.qss b/src/blackgui/qss/mainwindow.qss index f097d391c..6c6c238d5 100644 --- a/src/blackgui/qss/mainwindow.qss +++ b/src/blackgui/qss/mainwindow.qss @@ -96,6 +96,15 @@ QAbstractScrollArea #pg_StatusPageConsole { background-color: black; } min-height:20px; } +#wi_MainKeypadArea QPushButton::checked { + /** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/ + /** need to fix pressed button first **/ + border-style: solid; + border-color: yellow; + font: bold; + color: yellow; +} + /** cockpit needs to come after sw_MainMiddle **/ #comp_CockpitComComponent QPushButton { background-color: transparent; @@ -395,14 +404,13 @@ QSlider::handle:horizontal { } QSizeGrip { - image: url(:/diagona/icons/diagona/icons/arrow-resize-135.png); + image: url(:/diagona/icons/diagona/icons/arrow-in-out.png); width: 16px; height: 16px; } QStatusBar { - background-image: url(:/textures/icons/textures/texture-outer.jpg); - background-color: darkslategray; + background: transparent; } QStatusBar::item { diff --git a/src/blackgui/showhidebar.ui b/src/blackgui/showhidebar.ui index c7fa76490..95283d7e0 100644 --- a/src/blackgui/showhidebar.ui +++ b/src/blackgui/showhidebar.ui @@ -7,15 +7,27 @@ 0 0 56 - 12 + 25 - + 0 0 + + + 0 + 25 + + + + + 16777215 + 25 + + show / hide diff --git a/src/swiftgui_standard/mainwindow.cpp b/src/swiftgui_standard/mainwindow.cpp index 05608b468..eca1329ff 100644 --- a/src/swiftgui_standard/mainwindow.cpp +++ b/src/swiftgui_standard/mainwindow.cpp @@ -223,16 +223,12 @@ bool MainWindow::isContextAudioAvailableCheck() */ void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage) { + if (!this->m_init) return; if (statusMessage.isRedundant()) return; - if (statusMessage.wasHandledBy(this)) return; statusMessage.markAsHandledBy(this); - - if (!this->m_init) return; - this->ui->sb_MainStatusBar->show(); - this->m_timerStatusBar->start(3000); - this->m_statusBarIcon->setPixmap(statusMessage.toPixmap()); - this->m_statusBarLabel->setText(statusMessage.getMessage()); + this->m_statusBar.displayStatusMessage(statusMessage); + this->ui->comp_MainInfoArea->displayStatusMessage(statusMessage); // list this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage); @@ -327,7 +323,6 @@ void MainWindow::updateGuiStatusInformation() // update status fields QString s = QString("network: %1").arg(network); this->ui->comp_InfoBarStatus->setDBusTooltip(s); - } /* diff --git a/src/swiftgui_standard/mainwindow.h b/src/swiftgui_standard/mainwindow.h index 763b1ca90..9362fb845 100644 --- a/src/swiftgui_standard/mainwindow.h +++ b/src/swiftgui_standard/mainwindow.h @@ -26,6 +26,7 @@ #include "blackgui/models/userlistmodel.h" #include "blackgui/models/statusmessagelistmodel.h" #include "blackgui/models/keyboardkeylistmodel.h" +#include "blackgui/managedstatusbar.h" #include "blackmisc/nwtextmessage.h" #include "blackmisc/loghandler.h" #include "blacksound/soundgenerator.h" @@ -81,20 +82,19 @@ protected: private: QScopedPointer ui; - BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup bool m_init = false; - GuiModes::WindowMode m_windowMode = GuiModes::WindowNormal; - BlackInput::IKeyboard *m_keyboard = nullptr; //!< hotkeys - - BlackMisc::CLogSubscriber m_logSubscriber { this, &MainWindow::ps_displayStatusMessageInGui }; + BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup + BlackGui::CManagedStatusBar m_statusBar; + GuiModes::WindowMode m_windowMode = GuiModes::WindowNormal; + BlackInput::IKeyboard *m_keyboard = nullptr; //!< hotkeys + BlackMisc::CLogSubscriber m_logSubscriber { this, &MainWindow::ps_displayStatusMessageInGui }; // contexts bool m_coreAvailable = false; bool m_contextNetworkAvailable = false; bool m_contextAudioAvailable = false; - BlackMisc::Aviation::CAircraft m_ownAircraft; //!< own aircraft's state QTimer *m_timerContextWatchdog = nullptr; //!< core available? - QTimer *m_timerStatusBar = nullptr; //!< cleaning up status bar + BlackMisc::Aviation::CAircraft m_ownAircraft; //!< own aircraft's state // frameless window QPoint m_dragPosition; /*!< position, if moving is handled with frameless window */ @@ -106,10 +106,6 @@ private: QString m_transponderResetValue; //!< Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas QWidget *m_inputFocusedWidget = nullptr; //!< currently used widget for input, mainly used with cockpit - // status bar - QLabel *m_statusBarIcon = nullptr; //!< status bar icon - QLabel *m_statusBarLabel = nullptr; //!< status bar label - //! GUI status update void updateGuiStatusInformation(); diff --git a/src/swiftgui_standard/mainwindow_init.cpp b/src/swiftgui_standard/mainwindow_init.cpp index 52d0750b9..d50516187 100644 --- a/src/swiftgui_standard/mainwindow_init.cpp +++ b/src/swiftgui_standard/mainwindow_init.cpp @@ -13,7 +13,6 @@ #include "blackmisc/project.h" #include "blackmisc/hotkeyfunction.h" #include "blackmisc/logmessage.h" -#include #include #include #include @@ -72,18 +71,8 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig) this->initGuiSignals(); // status bar - if (!this->m_statusBarLabel) - { - // also subject of style sheet - this->m_statusBarIcon = new QLabel(this); - this->m_statusBarLabel = new QLabel(this); - this->m_timerStatusBar = new QTimer(this); - this->m_statusBarLabel->setMinimumHeight(16); - connect(this->m_timerStatusBar, &QTimer::timeout, this->m_statusBarIcon, &QLabel::clear); - connect(this->m_timerStatusBar, &QTimer::timeout, this->m_statusBarLabel, &QLabel::clear); - this->ui->sb_MainStatusBar->addWidget(this->m_statusBarIcon, 0); - this->ui->sb_MainStatusBar->addWidget(this->m_statusBarLabel, 1); - } + this->ui->dw_InfoBarStatus->allowStatusBar(false); + this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar); // signal / slots contexts / timers connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::ps_onConnectionTerminated); @@ -139,12 +128,15 @@ void MainWindow::initGuiSignals() // Remark: With new style, only methods of same signature can be connected // This is why we still have some "old" SIGNAL/SLOT connections here - // Main keypad + // main keypad connect(this->ui->comp_MainKeypadArea, SIGNAL(selectedMainInfoAreaDockWidget(CMainInfoAreaComponent::InfoArea)), this, SLOT(ps_setMainPage())); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &MainWindow::ps_toggleNetworkConnection); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &MainWindow::ps_changeWindowOpacity); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::identPressed, this->ui->comp_MainInfoArea->getCockpitComponent(), &CCockpitComponent::setSelectedTransponderModeStateIdent); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::selectArea); + connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedInfoAreaStatus, ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::onMainInfoAreaChanged); + + // command line connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::commandEntered, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::parseCommandLine); // menu @@ -210,10 +202,8 @@ void MainWindow::stopUpdateTimersWhenDisconnected() */ void MainWindow::stopAllTimers(bool disconnect) { - this->m_timerStatusBar->stop(); this->m_timerContextWatchdog->stop(); this->stopUpdateTimersWhenDisconnected(); if (!disconnect) return; - this->disconnect(this->m_timerStatusBar); this->disconnect(this->m_timerContextWatchdog); }