mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
refs #335, adjusted main window for new managed status bar
This commit is contained in:
committed by
Roland Winklmeier
parent
dfd007c9a1
commit
23dfc4c496
@@ -96,6 +96,15 @@ QAbstractScrollArea #pg_StatusPageConsole { background-color: black; }
|
|||||||
min-height:20px;
|
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 **/
|
/** cockpit needs to come after sw_MainMiddle **/
|
||||||
#comp_CockpitComComponent QPushButton {
|
#comp_CockpitComComponent QPushButton {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
@@ -395,14 +404,13 @@ QSlider::handle:horizontal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSizeGrip {
|
QSizeGrip {
|
||||||
image: url(:/diagona/icons/diagona/icons/arrow-resize-135.png);
|
image: url(:/diagona/icons/diagona/icons/arrow-in-out.png);
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStatusBar {
|
QStatusBar {
|
||||||
background-image: url(:/textures/icons/textures/texture-outer.jpg);
|
background: transparent;
|
||||||
background-color: darkslategray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStatusBar::item {
|
QStatusBar::item {
|
||||||
|
|||||||
@@ -7,15 +7,27 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>56</width>
|
<width>56</width>
|
||||||
<height>12</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>show / hide</string>
|
<string>show / hide</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -223,16 +223,12 @@ bool MainWindow::isContextAudioAvailableCheck()
|
|||||||
*/
|
*/
|
||||||
void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage)
|
void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage)
|
||||||
{
|
{
|
||||||
|
if (!this->m_init) return;
|
||||||
if (statusMessage.isRedundant()) return;
|
if (statusMessage.isRedundant()) return;
|
||||||
|
|
||||||
if (statusMessage.wasHandledBy(this)) return;
|
if (statusMessage.wasHandledBy(this)) return;
|
||||||
statusMessage.markAsHandledBy(this);
|
statusMessage.markAsHandledBy(this);
|
||||||
|
this->m_statusBar.displayStatusMessage(statusMessage);
|
||||||
if (!this->m_init) return;
|
this->ui->comp_MainInfoArea->displayStatusMessage(statusMessage);
|
||||||
this->ui->sb_MainStatusBar->show();
|
|
||||||
this->m_timerStatusBar->start(3000);
|
|
||||||
this->m_statusBarIcon->setPixmap(statusMessage.toPixmap());
|
|
||||||
this->m_statusBarLabel->setText(statusMessage.getMessage());
|
|
||||||
|
|
||||||
// list
|
// list
|
||||||
this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage);
|
this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage);
|
||||||
@@ -327,7 +323,6 @@ void MainWindow::updateGuiStatusInformation()
|
|||||||
// update status fields
|
// update status fields
|
||||||
QString s = QString("network: %1").arg(network);
|
QString s = QString("network: %1").arg(network);
|
||||||
this->ui->comp_InfoBarStatus->setDBusTooltip(s);
|
this->ui->comp_InfoBarStatus->setDBusTooltip(s);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "blackgui/models/userlistmodel.h"
|
#include "blackgui/models/userlistmodel.h"
|
||||||
#include "blackgui/models/statusmessagelistmodel.h"
|
#include "blackgui/models/statusmessagelistmodel.h"
|
||||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||||
|
#include "blackgui/managedstatusbar.h"
|
||||||
#include "blackmisc/nwtextmessage.h"
|
#include "blackmisc/nwtextmessage.h"
|
||||||
#include "blackmisc/loghandler.h"
|
#include "blackmisc/loghandler.h"
|
||||||
#include "blacksound/soundgenerator.h"
|
#include "blacksound/soundgenerator.h"
|
||||||
@@ -81,20 +82,19 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::MainWindow> ui;
|
QScopedPointer<Ui::MainWindow> ui;
|
||||||
BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup
|
|
||||||
bool m_init = false;
|
bool m_init = false;
|
||||||
GuiModes::WindowMode m_windowMode = GuiModes::WindowNormal;
|
BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup
|
||||||
BlackInput::IKeyboard *m_keyboard = nullptr; //!< hotkeys
|
BlackGui::CManagedStatusBar m_statusBar;
|
||||||
|
GuiModes::WindowMode m_windowMode = GuiModes::WindowNormal;
|
||||||
BlackMisc::CLogSubscriber m_logSubscriber { this, &MainWindow::ps_displayStatusMessageInGui };
|
BlackInput::IKeyboard *m_keyboard = nullptr; //!< hotkeys
|
||||||
|
BlackMisc::CLogSubscriber m_logSubscriber { this, &MainWindow::ps_displayStatusMessageInGui };
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
bool m_coreAvailable = false;
|
bool m_coreAvailable = false;
|
||||||
bool m_contextNetworkAvailable = false;
|
bool m_contextNetworkAvailable = false;
|
||||||
bool m_contextAudioAvailable = false;
|
bool m_contextAudioAvailable = false;
|
||||||
BlackMisc::Aviation::CAircraft m_ownAircraft; //!< own aircraft's state
|
|
||||||
QTimer *m_timerContextWatchdog = nullptr; //!< core available?
|
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
|
// frameless window
|
||||||
QPoint m_dragPosition; /*!< position, if moving is handled with 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
|
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
|
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
|
//! GUI status update
|
||||||
void updateGuiStatusInformation();
|
void updateGuiStatusInformation();
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "blackmisc/project.h"
|
#include "blackmisc/project.h"
|
||||||
#include "blackmisc/hotkeyfunction.h"
|
#include "blackmisc/hotkeyfunction.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include <QSortFilterProxyModel>
|
|
||||||
#include <QSizeGrip>
|
#include <QSizeGrip>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@@ -72,18 +71,8 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
|||||||
this->initGuiSignals();
|
this->initGuiSignals();
|
||||||
|
|
||||||
// status bar
|
// status bar
|
||||||
if (!this->m_statusBarLabel)
|
this->ui->dw_InfoBarStatus->allowStatusBar(false);
|
||||||
{
|
this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// signal / slots contexts / timers
|
// signal / slots contexts / timers
|
||||||
connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::ps_onConnectionTerminated);
|
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
|
// Remark: With new style, only methods of same signature can be connected
|
||||||
// This is why we still have some "old" SIGNAL/SLOT connections here
|
// 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, 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::connectPressed, this, &MainWindow::ps_toggleNetworkConnection);
|
||||||
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &MainWindow::ps_changeWindowOpacity);
|
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::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_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);
|
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::commandEntered, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::parseCommandLine);
|
||||||
|
|
||||||
// menu
|
// menu
|
||||||
@@ -210,10 +202,8 @@ void MainWindow::stopUpdateTimersWhenDisconnected()
|
|||||||
*/
|
*/
|
||||||
void MainWindow::stopAllTimers(bool disconnect)
|
void MainWindow::stopAllTimers(bool disconnect)
|
||||||
{
|
{
|
||||||
this->m_timerStatusBar->stop();
|
|
||||||
this->m_timerContextWatchdog->stop();
|
this->m_timerContextWatchdog->stop();
|
||||||
this->stopUpdateTimersWhenDisconnected();
|
this->stopUpdateTimersWhenDisconnected();
|
||||||
if (!disconnect) return;
|
if (!disconnect) return;
|
||||||
this->disconnect(this->m_timerStatusBar);
|
|
||||||
this->disconnect(this->m_timerContextWatchdog);
|
this->disconnect(this->m_timerContextWatchdog);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user