refs #335, adjusted main window for new managed status bar

This commit is contained in:
Klaus Basan
2014-11-05 20:20:26 +01:00
committed by Roland Winklmeier
parent dfd007c9a1
commit 23dfc4c496
5 changed files with 41 additions and 40 deletions

View File

@@ -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);
}
/*

View File

@@ -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::MainWindow> 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();

View File

@@ -13,7 +13,6 @@
#include "blackmisc/project.h"
#include "blackmisc/hotkeyfunction.h"
#include "blackmisc/logmessage.h"
#include <QSortFilterProxyModel>
#include <QSizeGrip>
#include <QHBoxLayout>
#include <QPushButton>
@@ -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);
}