refs #304, reflect changes in components for GUI, GUI utility class to set main window position correctly

This commit is contained in:
Klaus Basan
2014-07-27 15:10:52 +02:00
parent e55bdd0857
commit 18fe626db7
8 changed files with 349 additions and 796 deletions

View File

@@ -9,8 +9,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "blackmisc/iconsstandard.h"
#include "blackmisc/iconsnetwork.h"
#include "blackmisc/icon.h"
#include "blackgui/stylesheetutility.h"
#include "blackgui/models/atcstationlistmodel.h"
#include "blackcore/dbus_server.h"
@@ -47,7 +46,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
m_timerContextWatchdog(nullptr),
m_timerStatusBar(nullptr), m_timerSimulator(nullptr),
// context menus
m_contextMenuAudio(nullptr), m_contextMenuStatusMessageList(nullptr),
m_contextMenuStatusMessageList(nullptr),
// cockpit
m_inputFocusedWidget(nullptr),
// status bar
@@ -160,10 +159,10 @@ void MainWindow::ps_setMainPage(bool start)
}
QObject *sender = QObject::sender();
if (sender == this->ui->pb_MainConnect || sender == this->ui->pb_MainStatus)
this->ui->sw_MainMiddle->setCurrentIndex(MainPageStatus);
else if (sender == this->ui->pb_MainCockpit)
if (sender == this->ui->pb_MainCockpit)
{
this->ui->sw_MainMiddle->setCurrentIndex(MainPageCockpit);
}
else
{
this->ui->sw_MainMiddle->setCurrentIndex(MainPageFoo);
@@ -200,6 +199,10 @@ void MainWindow::ps_setMainPage(bool start)
{
this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaWeather);
}
else if (sender == this->ui->pb_MainLog)
{
this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaLog);
}
else if (sender == this->ui->pb_MainMappings)
{
this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaMappings);
@@ -230,8 +233,6 @@ void MainWindow::ps_toggleNetworkConnection()
{
CStatusMessageList msgs;
if (!this->isContextNetworkAvailableCheck()) return;
this->ui->lbl_StatusNetworkConnectedIcon->setPixmap(CIconsNetworkAndAviation::statusTransition());
if (!this->getIContextNetwork()->isConnected())
{
// validation of data here is not required, network context does this
@@ -299,11 +300,11 @@ void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessag
if (!this->m_init) return;
this->ui->sb_MainStatusBar->show();
this->m_timerStatusBar->start(3000);
this->m_statusBarIcon->setPixmap(statusMessage.toIcon());
this->m_statusBarIcon->setPixmap(statusMessage.toPixmap());
this->m_statusBarLabel->setText(statusMessage.getMessage());
// list
this->ui->tvp_StatusMessages->insert(statusMessage);
this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage);
// display overlay for errors, but not for validation
if (statusMessage.getSeverity() == CStatusMessage::SeverityError && statusMessage.getType() != CStatusMessage::TypeValidation)
@@ -326,7 +327,7 @@ void MainWindow::displayRedirectedOutput(const CStatusMessage &statusMessage, qi
{
if (!this->getIContextApplication()) return;
if (this->getIContextApplication()->getUniqueId() == contextId) return; //self triggered
this->ui->te_StatusPageConsole->appendHtml(statusMessage.toHtml());
this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToConsole(statusMessage);
}
void MainWindow::ps_onChangedSetttings(uint typeValue)
@@ -410,41 +411,23 @@ void MainWindow::updateGuiStatusInformation()
{
bool dbus = !this->getIContextNetwork()->usingLocalObjects();
network = dbus ? now : "local";
this->ui->cb_StatusWithDBus->setChecked(dbus);
}
// handle voice, mute
QString voice("unavailable");
if (this->m_contextAudioAvailable)
{
voice = this->getIContextAudio()->usingLocalObjects() ? "local" : now;
this->ui->pb_SoundMute->setEnabled(true);
}
else
{
// voice not available
this->ui->pb_SoundMute->setEnabled(false);
this->ui->comp_InfoBarStatus->setDBusStatus(dbus);
}
// update status fields
this->ui->le_StatusNetworkContext->setText(network);
this->ui->le_StatusAudioContext->setText(voice);
QString s = QString("network: %1").arg(network);
this->ui->comp_InfoBarStatus->setDBusTooltip(s);
// Connected button
if (this->m_contextNetworkAvailable && this->getIContextNetwork()->isConnected())
{
if (this->ui->lbl_StatusNetworkConnectedIcon->toolTip().startsWith("dis", Qt::CaseInsensitive))
this->ui->lbl_StatusNetworkConnectedIcon->setToolTip(now);
this->ui->pb_MainConnect->setText("Disconnect");
this->ui->pb_MainConnect->setStyleSheet("background-color: green");
this->ui->lbl_StatusNetworkConnectedIcon->setPixmap(CIconsNetworkAndAviation::statusConnected());
}
else
{
this->ui->lbl_StatusNetworkConnectedIcon->setToolTip("disconnected");
this->ui->pb_MainConnect->setText("Connect");
this->ui->pb_MainConnect->setStyleSheet("background-color: ");
this->ui->lbl_StatusNetworkConnectedIcon->setPixmap(CIconsNetworkAndAviation::statusDisconnected());
}
}
@@ -471,25 +454,39 @@ void MainWindow::ps_changeWindowOpacity(int opacity)
void MainWindow::updateSimulatorData()
{
if (this->getIContextSimulator()->isConnected())
ui->le_SimulatorStatus->setText("Connected");
else
ui->le_SimulatorStatus->setText("Not connected");
CSimulatorComponent *simComp = this->ui->comp_MainInfoArea->getSimulatorComponent();
Q_ASSERT(simComp);
if (!this->getIContextSimulator()->isConnected())
{
simComp->clear();
simComp->addOrUpdateByName("info", "sim not connected", CIcons::StandardIconWarning16);
return;
}
// clear old warnings / information
if (simComp->rowCount() < 5)
{
simComp->clear();
}
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
ui->le_SimulatorLatitude->setText(ownAircraft.getSituation().latitude().toFormattedQString());
ui->le_SimulatorLongitude->setText(ownAircraft.getSituation().longitude().toFormattedQString());
ui->le_SimulatorAltitude->setText(ownAircraft.getSituation().getAltitude().toFormattedQString());
ui->le_SimulatorPitch->setText(ownAircraft.getSituation().getPitch().toFormattedQString());
ui->le_SimulatorBank->setText(ownAircraft.getSituation().getBank().toFormattedQString());
ui->le_SimulatorHeading->setText(ownAircraft.getSituation().getHeading().toFormattedQString());
ui->le_SimulatorGroundSpeed->setText(ownAircraft.getSituation().getGroundSpeed().toFormattedQString());
CAircraftSituation s = ownAircraft.getSituation();
CComSystem c1 = ownAircraft.getCom1System();
CComSystem c2 = ownAircraft.getCom2System();
ui->le_SimulatorCom1Active->setText(ownAircraft.getCom1System().getFrequencyActive().toFormattedQString());
ui->le_SimulatorCom1Standby->setText(ownAircraft.getCom1System().getFrequencyStandby().toFormattedQString());
ui->le_SimulatorCom2Active->setText(ownAircraft.getCom2System().getFrequencyActive().toFormattedQString());
ui->le_SimulatorCom2Standby->setText(ownAircraft.getCom2System().getFrequencyStandby().toFormattedQString());
ui->le_SimulatorTransponder->setText(ownAircraft.getTransponderCodeFormatted());
simComp->addOrUpdateByName("latitude", s.latitude().toFormattedQString(), s.latitude().toIcon());
simComp->addOrUpdateByName("longitude", s.longitude().toFormattedQString(), s.longitude().toIcon());
simComp->addOrUpdateByName("altitude", s.getAltitude().toFormattedQString(), s.getAltitude().toIcon());
simComp->addOrUpdateByName("pitch", s.getPitch().toFormattedQString(), CIcons::AviationAttitudeIndicator);
simComp->addOrUpdateByName("bank", s.getBank().toFormattedQString(), CIcons::AviationAttitudeIndicator);
simComp->addOrUpdateByName("heading", s.getHeading().toFormattedQString(), s.getHeading().toIcon());
simComp->addOrUpdateByName("ground speed", s.getGroundSpeed().toFormattedQString(), s.getGroundSpeed().toIcon());
simComp->addOrUpdateByName("COM1 active", c1.getFrequencyActive().toFormattedQString(), c1.getFrequencyActive().toIcon());
simComp->addOrUpdateByName("COM2 active", c2.getFrequencyActive().toFormattedQString(), c2.getFrequencyActive().toIcon());
simComp->addOrUpdateByName("COM1 standby", c1.getFrequencyStandby().toFormattedQString(), c1.getFrequencyStandby().toIcon());
simComp->addOrUpdateByName("COM2 standby", c2.getFrequencyStandby().toFormattedQString(), c2.getFrequencyStandby().toIcon());
simComp->addOrUpdateByName("Transponder", ownAircraft.getTransponderCodeFormatted(), ownAircraft.getTransponder().toIcon());
}
void MainWindow::ps_onSimulatorConnectionChanged(bool isAvailable)

View File

@@ -74,9 +74,8 @@ protected:
//! \remarks keep the values in sync with the real tab indexes
enum MainPageIndex
{
MainPageStatus = 0,
MainPageCockpit = 4,
MainPageFoo = 9
MainPageCockpit = 0,
MainPageFoo = 1
};
private:
@@ -99,7 +98,6 @@ private:
QPoint m_dragPosition; /*!< position, if moving is handled with frameless window */
// context menus
QMenu *m_contextMenuAudio; /*!< audio context menu */
QMenu *m_contextMenuStatusMessageList; /*!< context menu for status message list */
// cockpit
@@ -119,9 +117,6 @@ private:
//! Init GUI signals
void initGuiSignals();
//! Init the context menus
void initContextMenus();
//! Context network availability check, otherwise status message
bool isContextNetworkAvailableCheck();
@@ -242,9 +237,6 @@ private slots:
*/
void ps_changeWindowOpacity(int opacity = -1);
//! Context menu for audio
void ps_displayAudioIconContextMenu(const QPoint &position);
//! Toogle Windows stay on top
void ps_toogleWindowStayOnTop();

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>350</width>
<height>550</height>
<height>574</height>
</rect>
</property>
<property name="sizePolicy">
@@ -35,6 +35,9 @@
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
@@ -124,82 +127,6 @@
<property name="spacing">
<number>2</number>
</property>
<item row="1" column="2">
<widget class="QPushButton" name="pb_MainCockpit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Cockpit</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pb_MainMappings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Mappings</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pb_MainWeather">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Weather</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pb_MainStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="5">
<widget class="QLineEdit" name="le_CommandLineInput">
<property name="sizePolicy">
@@ -213,28 +140,6 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pb_MainSettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="pb_SoundMute">
<property name="maximumSize">
@@ -333,8 +238,8 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pb_MainTextMessages">
<item row="2" column="0">
<widget class="QPushButton" name="pb_MainAircrafts">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -348,58 +253,11 @@
</size>
</property>
<property name="text">
<string>Text/Chat</string>
<string>Aircrafts</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pb_MainFlightplan">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Flightplan</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pb_MainUsers">
<property name="text">
<string>Users</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pb_CockpitIdent">
<property name="text">
<string>Ident</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pb_MainSimulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pb_Foo">
<property name="text">
<string>Foo</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="0">
<widget class="QPushButton" name="pb_MainAtc">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -418,8 +276,15 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pb_MainAircrafts">
<item row="4" column="0">
<widget class="QPushButton" name="pb_MainUsers">
<property name="text">
<string>Users</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pb_MainCockpit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -433,7 +298,145 @@
</size>
</property>
<property name="text">
<string>Aircrafts</string>
<string>Cockpit</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pb_CockpitIdent">
<property name="text">
<string>Ident</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="pb_Foo">
<property name="text">
<string>Foo</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pb_MainTextMessages">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Text/Chat</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pb_MainSimulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pb_MainWeather">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Weather</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pb_MainFlightplan">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Flightplan</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pb_MainMappings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Mappings</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pb_MainSettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pb_MainLog">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Log</string>
</property>
</widget>
</item>
@@ -462,277 +465,8 @@
<enum>QFrame::NoFrame</enum>
</property>
<property name="currentIndex">
<number>7</number>
<number>1</number>
</property>
<widget class="QWidget" name="pg_StatusPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="vl_Status">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QGridLayout" name="gl_PageStatus">
<item row="0" column="3">
<widget class="QCheckBox" name="cb_StatusWithDBus">
<property name="text">
<string>DBus</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_StatusNetworkContext">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_StatusNetworkConnected">
<property name="text">
<string>Network connected</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_NetworkContextAvailable">
<property name="text">
<string>Network context</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbl_StatusNetworkContext">
<property name="text">
<string>Voice context</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="le_StatusAudioContext">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbl_StatusNetworkConnectedIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>:/blackgui/icons/loginred.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbl_StatusVoiceStatus">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>:/blackgui/icons/audiovolumelow.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QToolBox" name="tb_StatusPage">
<property name="currentIndex">
<number>0</number>
</property>
<property name="tabSpacing">
<number>3</number>
</property>
<widget class="QWidget" name="pg_StatusPageMessages">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>79</width>
<height>71</height>
</rect>
</property>
<attribute name="label">
<string>Messages</string>
</attribute>
<layout class="QVBoxLayout" name="vl_StatusPageMessages">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Views::CStatusMessageView" name="tvp_StatusMessages">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_StatusPageConsole">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>83</width>
<height>71</height>
</rect>
</property>
<attribute name="label">
<string>Console</string>
</attribute>
<layout class="QVBoxLayout" name="vl_StatusPageConsole">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPlainTextEdit" name="te_StatusPageConsole">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_AtcStations">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="vl_AtcStations">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="pg_Aircrafts">
<layout class="QVBoxLayout" name="vl_AircraftsInRange">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="pg_Users">
<layout class="QVBoxLayout" name="vl_Users">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="pg_Cockpit">
<layout class="QVBoxLayout" name="vl_CockpitPage">
<property name="spacing">
@@ -755,247 +489,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_TextMessages">
<layout class="QVBoxLayout" name="vl_TextMessages_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="pg_Flightplan">
<layout class="QVBoxLayout" name="vl_Flightplan">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="pg_Settings">
<layout class="QVBoxLayout" name="vl_Settings">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="pg_Simulator">
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QLabel" name="lbl_OwnAircraftSituationLongitude">
<property name="text">
<string>Longitude</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_SimulatorStatus">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lbl_OwnAircraftSituationBank">
<property name="text">
<string>Bank</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_OwnAircraftSituationLatitude">
<property name="text">
<string>Latitude</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lbl_SimulatorGroundSpeed">
<property name="text">
<string>Ground Speed</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lbl_SimulatorHeading">
<property name="text">
<string>Heading</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lbl_SimulatorOnGround">
<property name="text">
<string>On ground</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbl_OwnAircraftSituationAltitude">
<property name="text">
<string>Altitude</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lbl_OwnAircraftSituationPitch">
<property name="text">
<string>Pitch</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_SimulatorStatus">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_SimulatorLatitude">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_SimulatorLongitude">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="le_SimulatorAltitude">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="le_SimulatorPitch">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="le_SimulatorCom1Active">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="lbl_SimulatorCom1Standby">
<property name="text">
<string>COM1 Standby</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="lbl_SimulatorCom1Active">
<property name="text">
<string>COM1 Active</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="lbl_SimulatorCom2Active">
<property name="text">
<string>COM2 Active</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="lbl_SimulatorCom2Standby">
<property name="text">
<string>COM2 Standby</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="le_SimulatorCom1Standby"/>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="le_SimulatorCom2Active"/>
</item>
<item row="13" column="1">
<widget class="QLineEdit" name="le_SimulatorCom2Standby"/>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="le_SimulatorBank">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="le_SimulatorHeading">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="le_SimulatorGroundSpeed">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="le_SimulatorOnGround">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLineEdit" name="le_SimulatorTransponder"/>
</item>
<item row="14" column="0">
<widget class="QLabel" name="lbl_SimulatorTransponder">
<property name="text">
<string>Transponder</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_Foo">
<layout class="QVBoxLayout" name="vl_Foo">
<property name="spacing">
@@ -1114,6 +607,18 @@
<bool>false</bool>
</property>
</widget>
<widget class="BlackGui::CDockWidgetInfoBar" name="dw_InfoBarStatus">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="allowedAreas">
<set>Qt::BottomDockWidgetArea|Qt::TopDockWidgetArea</set>
</property>
<attribute name="dockWidgetArea">
<number>4</number>
</attribute>
<widget class="BlackGui::Components::CInfoBarStatus" name="comp_InfoBarStatus"/>
</widget>
<action name="menu_TestLocationsEDDF">
<property name="text">
<string>Position EDDF (Frankfurt, GER)</string>
@@ -1167,11 +672,6 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>BlackGui::Views::CStatusMessageView</class>
<extends>QTableView</extends>
<header>blackgui/views/statusmessageview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::Components::CCockpitV1Component</class>
<extends>QWidget</extends>
@@ -1184,28 +684,26 @@
<header>blackgui/components/maininfoareacomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CInfoBarStatus</class>
<extends>QWidget</extends>
<header>blackgui/components/infobarstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::CDockWidgetInfoBar</class>
<extends>QDockWidget</extends>
<header>blackgui/dockwidgetinfobar.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cb_StatusWithDBus</tabstop>
<tabstop>le_StatusNetworkContext</tabstop>
<tabstop>le_StatusAudioContext</tabstop>
<tabstop>tvp_StatusMessages</tabstop>
<tabstop>le_CommandLineInput</tabstop>
<tabstop>pb_MainConnect</tabstop>
<tabstop>pb_MainStatus</tabstop>
<tabstop>pb_MainWeather</tabstop>
<tabstop>pb_MainFlightplan</tabstop>
<tabstop>pb_MainUsers</tabstop>
<tabstop>pb_CockpitIdent</tabstop>
<tabstop>pb_MainCockpit</tabstop>
<tabstop>pb_MainTextMessages</tabstop>
<tabstop>pb_MainMappings</tabstop>
<tabstop>pb_MainSettings</tabstop>
<tabstop>pb_MainKeypadOpacity100</tabstop>
<tabstop>pb_MainKeypadOpacity050</tabstop>
<tabstop>pb_SoundMute</tabstop>
<tabstop>pb_SoundMaxVolume</tabstop>
<tabstop>te_StatusPageConsole</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -17,7 +17,7 @@
#include "blackgui/components/textmessagecomponent.h"
#include "blackgui/models/atcstationlistmodel.h"
#include "blackgui/models/keyboardkeylistmodel.h"
#include "blackmisc/iconsstandard.h"
#include "blackmisc/icons.h"
#include "blackmisc/avselcal.h"
#include "blackmisc/project.h"
#include <QSortFilterProxyModel>
@@ -129,9 +129,6 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
// start screen
this->ps_setMainPage(true);
// init context menus
this->initContextMenus();
// starting
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ComponentGui, IContextApplication::ActionStarts);
@@ -139,8 +136,8 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
ps_onSimulatorConnectionChanged(this->getIContextSimulator()->isConnected());
// info
this->ui->te_StatusPageConsole->appendPlainText(CProject::systemNameAndVersion());
this->ui->te_StatusPageConsole->appendPlainText(CProject::compiledInfo());
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::systemNameAndVersion());
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::compiledInfo());
// hotkeys
this->ps_registerHotkeys();
@@ -180,8 +177,6 @@ void MainWindow::initGuiSignals()
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainSimulator, SIGNAL(released()), this, SLOT(ps_setMainPage()));
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainStatus, SIGNAL(released()), this, SLOT(ps_setMainPage()));
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainUsers, SIGNAL(released()), this, SLOT(ps_setMainPage()));
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainTextMessages, SIGNAL(released()), this, SLOT(ps_setMainPage()));
@@ -190,6 +185,8 @@ void MainWindow::initGuiSignals()
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainMappings, SIGNAL(released()), this, SLOT(ps_setMainPage()));
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainLog, SIGNAL(released()), this, SLOT(ps_setMainPage()));
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainKeypadOpacity050, SIGNAL(clicked()), this, SLOT(ps_changeWindowOpacity()));
Q_ASSERT(connected);
connected = this->connect(this->ui->pb_MainKeypadOpacity100, SIGNAL(clicked()), this, SLOT(ps_changeWindowOpacity()));

View File

@@ -80,50 +80,3 @@ void MainWindow::ps_onMenuClicked()
}
if (!msgs.isEmpty()) this->ps_displayStatusMessagesInGui(msgs);
}
/*
* Reload settings
*/
void MainWindow::initContextMenus()
{
this->ui->lbl_StatusVoiceStatus->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->ui->lbl_StatusVoiceStatus, &QLabel::customContextMenuRequested, this, &MainWindow::ps_displayAudioIconContextMenu);
}
/*
* Audio context menu
*/
void MainWindow::ps_displayAudioIconContextMenu(const QPoint &position)
{
// position for most widgets
QWidget *sender = qobject_cast<QWidget *>(QWidget::sender());
Q_ASSERT(sender);
QPoint globalPosition = sender->mapToGlobal(position);
if (!this->m_contextMenuAudio)
{
this->m_contextMenuAudio = new QMenu(this);
this->m_contextMenuAudio->addAction("Toogle mute");
#if defined(Q_OS_WIN)
// QSysInfo::WindowsVersion only available on Win platforms
if (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
{
this->m_contextMenuAudio->addAction("Mixer");
}
#endif
}
QAction *selectedItem = this->m_contextMenuAudio->exec(globalPosition);
if (selectedItem)
{
// http://forum.technical-assistance.co.uk/sndvol32exe-command-line-parameters-vt1348.html
const QList<QAction *> actions = this->m_contextMenuAudio->actions();
if (selectedItem == actions.at(0)) this->ui->pb_SoundMute->click();
else if (actions.size() > 1 && selectedItem == actions.at(1))
{
QStringList parameterlist;
QProcess::startDetached("SndVol.exe", parameterlist);
}
}
}

View File

@@ -0,0 +1,64 @@
/* Copyright (C) 2014
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of Swift Project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "guiutility.h"
#include <QWidget>
#include <QApplication>
namespace BlackGui
{
QMainWindow *CGuiUtility::mainWindow()
{
QWidgetList tlw = topLevelApplicationWidgetsWithName();
foreach(QWidget * w, tlw)
{
QMainWindow *mw = qobject_cast<QMainWindow *>(w);
if (!mw) { continue; }
QString n = mw->objectName().toLower();
if (n.contains("main") && n.contains("window")) return mw;
}
return nullptr;
}
QWidgetList CGuiUtility::topLevelApplicationWidgetsWithName()
{
QWidgetList tlw = QApplication::topLevelWidgets();
QWidgetList rl;
foreach(QWidget * w, tlw)
{
if (w->objectName().isEmpty()) continue;
rl.append(w);
}
return rl;
}
QPoint CGuiUtility::mainWindowPosition()
{
QMainWindow *mw = mainWindow();
return (mw) ? mw->pos() : QPoint();
}
QPoint CGuiUtility::introWindowPosition()
{
QWidgetList tlw = topLevelApplicationWidgetsWithName();
foreach(QWidget * w, tlw)
{
QString n = w->objectName().toLower();
if (n.contains("intro")) return w->pos();
}
return QPoint(0, 0);
}
QPoint CGuiUtility::assumedMainWindowPosition()
{
QPoint p = mainWindowPosition();
return (p.isNull()) ? introWindowPosition() : p;
}
}

48
src/blackgui/guiutility.h Normal file
View File

@@ -0,0 +1,48 @@
/* Copyright (C) 2014
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of Swift Project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_GUIUTILITY_H
#define BLACKGUI_GUIUTILITY_H
#include <QWidgetList>
#include <QMainWindow>
namespace BlackGui
{
//! GUI utilities
class CGuiUtility
{
public:
//! Main application window
static QMainWindow *mainWindow();
//! Top level widgets with names
static QWidgetList topLevelApplicationWidgetsWithName();
//! Position of main window
static QPoint mainWindowPosition();
//! Position of intro window
static QPoint introWindowPosition();
//! During initialization, when main window position might not be set set
static QPoint assumedMainWindowPosition();
private:
//! Constructor, use static methods only
CGuiUtility() {}
};
}
#endif // guard

View File

@@ -1,5 +1,9 @@
/** http://qt-project.org/doc/qt-5.3/stylesheet-examples.html **/
#MainWindow {
background-color: darkslategray;
}
QWidget {
background-color: black;
}