mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
refs #239, removed aircraft / ATC station parts from main window, now in component.
mainwindow_atc entirely removed
This commit is contained in:
@@ -30,7 +30,6 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false),
|
||||
|
||||
// timers
|
||||
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr),
|
||||
m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
|
||||
m_timerStatusBar(nullptr), m_timerAudioTests(nullptr), m_timerSimulator(nullptr),
|
||||
// context menus
|
||||
@@ -327,19 +326,7 @@ void MainWindow::connectionStatusChanged(uint /** from **/, uint to, const QStri
|
||||
void MainWindow::timerBasedUpdates()
|
||||
{
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == this->m_timerUpdateAtcStationsOnline)
|
||||
{
|
||||
int t = this->ui->hs_SettingsGuiAtcRefreshTime->value() * 1000;
|
||||
this->m_timerUpdateAtcStationsOnline->start(t);
|
||||
this->reloadAtcStationsOnline();
|
||||
}
|
||||
else if (sender == this->m_timerUpdateAircraftsInRange)
|
||||
{
|
||||
int t = this->ui->hs_SettingsGuiAircraftRefreshTime->value() * 1000;
|
||||
this->m_timerUpdateAircraftsInRange->start(t);
|
||||
this->reloadAircraftsInRange();
|
||||
}
|
||||
else if (sender == this->m_timerContextWatchdog)
|
||||
if (sender == this->m_timerContextWatchdog)
|
||||
{
|
||||
this->setContextAvailability();
|
||||
this->updateGuiStatusInformation();
|
||||
@@ -350,10 +337,7 @@ void MainWindow::timerBasedUpdates()
|
||||
}
|
||||
|
||||
// own aircraft
|
||||
if (sender == this->m_timerUpdateAircraftsInRange || sender == this->m_timerUpdateAtcStationsOnline)
|
||||
{
|
||||
this->reloadOwnAircraft(); // regular updates
|
||||
}
|
||||
this->reloadOwnAircraft(); // regular updates
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -367,23 +351,6 @@ void MainWindow::setContextAvailability()
|
||||
this->m_contextAudioAvailable = this->m_coreAvailable || this->getIContextAudio()->usingLocalObjects();
|
||||
}
|
||||
|
||||
/*
|
||||
* Middle panel changed
|
||||
*/
|
||||
void MainWindow::middlePanelChanged(int /* index */)
|
||||
{
|
||||
if (this->isContextNetworkAvailableCheck())
|
||||
{
|
||||
// remark, ATC stations is handled by tab changed
|
||||
|
||||
if (this->ui->sw_MainMiddle->currentWidget() == this->ui->pg_AircraftsInRange)
|
||||
{
|
||||
if (this->ui->tvp_AircraftsInRange->rowCount() < 1)
|
||||
this->reloadAircraftsInRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Update GUI
|
||||
*/
|
||||
|
||||
@@ -103,8 +103,6 @@ private:
|
||||
bool m_contextNetworkAvailable;
|
||||
bool m_contextAudioAvailable;
|
||||
BlackMisc::Aviation::CAircraft m_ownAircraft; /*!< own aircraft's state */
|
||||
QTimer *m_timerUpdateAtcStationsOnline; /*!< timer for update of stations */
|
||||
QTimer *m_timerUpdateAircraftsInRange; /*!< timer for update of aircrafts */
|
||||
QTimer *m_timerCollectedCockpitUpdates; /*!< collect cockpit updates over a short period before sending */
|
||||
QTimer *m_timerContextWatchdog; /*!< core available? */
|
||||
QTimer *m_timerStatusBar; /*!< cleaning up status bar */
|
||||
@@ -229,11 +227,8 @@ private:
|
||||
//! Start all update timers
|
||||
void startUpdateTimers();
|
||||
|
||||
/*!
|
||||
* \brief Stop all update timers
|
||||
* \param disconnect also disconnect signal/slots
|
||||
*/
|
||||
void stopUpdateTimers(bool disconnect = false);
|
||||
//! Stop all update timers
|
||||
void stopUpdateTimers();
|
||||
|
||||
/*!
|
||||
* \brief Stop all timers
|
||||
@@ -262,15 +257,6 @@ private slots:
|
||||
// Data received related slots
|
||||
//
|
||||
|
||||
//! Reload booked stations
|
||||
void reloadAtcStationsBooked();
|
||||
|
||||
//! Reload online stations
|
||||
void reloadAtcStationsOnline();
|
||||
|
||||
//! Reload aircrafts in range
|
||||
void reloadAircraftsInRange();
|
||||
|
||||
//! Reload own aircraft
|
||||
bool reloadOwnAircraft();
|
||||
|
||||
@@ -337,12 +323,6 @@ private slots:
|
||||
*/
|
||||
void networkServerSelected(QModelIndex index);
|
||||
|
||||
/*!
|
||||
* \brief Online ATC station selected
|
||||
* \param index
|
||||
*/
|
||||
void onlineAtcStationSelected(QModelIndex index);
|
||||
|
||||
//! Alter traffic server
|
||||
void alterTrafficServer();
|
||||
|
||||
@@ -352,21 +332,9 @@ private slots:
|
||||
//! Update timer
|
||||
void timerBasedUpdates();
|
||||
|
||||
//! ATC station, tab changed, reload data
|
||||
void atcStationTabChanged(int tabIndex);
|
||||
|
||||
//! Middle panel has changed, reload data
|
||||
void middlePanelChanged(int index);
|
||||
|
||||
//! Command entered
|
||||
void commandEntered();
|
||||
|
||||
//! Get METAR for given ICAO airport code
|
||||
void getMetar(const QString &airportIcaoCode = "");
|
||||
|
||||
//! Request new ATIS
|
||||
void requestAtis();
|
||||
|
||||
//! Close text message tab
|
||||
void closeTextMessageTab();
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ QStatusBar QLabel {
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>7</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pg_StatusPage">
|
||||
<property name="sizePolicy">
|
||||
@@ -571,7 +571,7 @@ QStatusBar QLabel {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>86</width>
|
||||
<width>90</width>
|
||||
<height>59</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -694,7 +694,7 @@ QStatusBar QLabel {
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tw_AtcStations">
|
||||
<widget class="BlackGui::CAtcStationComponent" name="twp_AtcStations">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -719,283 +719,13 @@ QStatusBar QLabel {
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tb_AtcStationsOnline">
|
||||
<attribute name="title">
|
||||
<string>In range</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<property name="spacing">
|
||||
<number>2</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>
|
||||
<widget class="BlackGui::CAtcStationView" name="tvp_AtcStationsOnline">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_AtcStationsOnlineInfo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>110</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Info (ATIS, METAR, ...)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AtcStationsOnlineAtisGroup">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="te_AtcStationsOnlineInfo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_AtcStationsOnlineBottom">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pb_AtcStationsLoadMetar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load METAR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_AtcStationsAtisReload">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reload ATIS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="le_AtcStationsOnlineMetar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string extracomment="Airport ICAO code"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>EDDF</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_AtcStationsBooked">
|
||||
<attribute name="title">
|
||||
<string>Bookings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_AtcStationsBooked">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::CAtcStationView" name="tvp_AtcStationsBooked">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_ReloadAtcStationsBooked">
|
||||
<property name="text">
|
||||
<string>Reload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_AircraftsInRange">
|
||||
<widget class="QWidget" name="pg_Aircrafts">
|
||||
<layout class="QVBoxLayout" name="vl_AircraftsInRange">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
@@ -1013,11 +743,7 @@ QStatusBar QLabel {
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::CAircraftView" name="tvp_AircraftsInRange">
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="BlackGui::CAircraftComponent" name="twp_Aircrafts"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -3178,16 +2904,6 @@ QStatusBar QLabel {
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/statusmessageview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CAtcStationView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/atcstationview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CAircraftView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/aircraftview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CKeyboardKeyView</class>
|
||||
<extends>QTableView</extends>
|
||||
@@ -3216,6 +2932,18 @@ QStatusBar QLabel {
|
||||
<header>blackgui/usercomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CAircraftComponent</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>blackgui/aircraftcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CAtcStationComponent</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>blackgui/atcstationcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cb_StatusWithDBus</tabstop>
|
||||
@@ -3223,15 +2951,7 @@ QStatusBar QLabel {
|
||||
<tabstop>le_StatusAudioContext</tabstop>
|
||||
<tabstop>tvp_StatusMessages</tabstop>
|
||||
<tabstop>le_CommandLineInput</tabstop>
|
||||
<tabstop>tw_AtcStations</tabstop>
|
||||
<tabstop>tvp_AtcStationsOnline</tabstop>
|
||||
<tabstop>te_AtcStationsOnlineInfo</tabstop>
|
||||
<tabstop>le_AtcStationsOnlineMetar</tabstop>
|
||||
<tabstop>pb_AtcStationsLoadMetar</tabstop>
|
||||
<tabstop>pb_AtcStationsAtisReload</tabstop>
|
||||
<tabstop>tvp_AtcStationsBooked</tabstop>
|
||||
<tabstop>pb_ReloadAtcStationsBooked</tabstop>
|
||||
<tabstop>tvp_AircraftsInRange</tabstop>
|
||||
<tabstop>twp_AtcStations</tabstop>
|
||||
<tabstop>pb_CockpitToggleCom1</tabstop>
|
||||
<tabstop>ds_CockpitCom1Active</tabstop>
|
||||
<tabstop>ds_CockpitCom1Standby</tabstop>
|
||||
|
||||
@@ -14,15 +14,6 @@ using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Audio;
|
||||
|
||||
/*
|
||||
* Read aircrafts
|
||||
*/
|
||||
void MainWindow::reloadAircraftsInRange()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->ui->tvp_AircraftsInRange->update(this->getIContextNetwork()->getAircraftsInRange());
|
||||
}
|
||||
|
||||
/*
|
||||
* Read own aircraft
|
||||
*/
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "blackgui/atcstationlistmodel.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackcore/context_network.h"
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Settings;
|
||||
|
||||
|
||||
/*
|
||||
* Read booked stations
|
||||
*/
|
||||
void MainWindow::reloadAtcStationsBooked()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->ui->tvp_AtcStationsBooked->update(this->getIContextNetwork()->getAtcStationsBooked());
|
||||
}
|
||||
|
||||
/*
|
||||
* Read online stations
|
||||
*/
|
||||
void MainWindow::reloadAtcStationsOnline()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->ui->tvp_AtcStationsOnline->update(this->getIContextNetwork()->getAtcStationsOnline());
|
||||
if (!this->getIContextNetwork()->isConnected())
|
||||
{
|
||||
// clear metar/ATIS
|
||||
this->ui->te_AtcStationsOnlineInfo->clear();
|
||||
}
|
||||
|
||||
// after reloading, update cockpit based on better information
|
||||
this->updateCockpitFromContext();
|
||||
}
|
||||
|
||||
/*
|
||||
* Station selected
|
||||
*/
|
||||
void MainWindow::onlineAtcStationSelected(QModelIndex index)
|
||||
{
|
||||
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset
|
||||
const CAtcStation stationClicked = this->ui->tvp_AtcStationsBooked->derivedModel()->at(index);
|
||||
QString infoMessage;
|
||||
|
||||
if (stationClicked.hasAtis())
|
||||
{
|
||||
infoMessage.append(stationClicked.getAtis().getMessage());
|
||||
}
|
||||
if (stationClicked.hasMetar())
|
||||
{
|
||||
if (!infoMessage.isEmpty()) infoMessage.append("\n\n");
|
||||
infoMessage.append(stationClicked.getMetar().getMessage());
|
||||
}
|
||||
this->ui->te_AtcStationsOnlineInfo->setText(infoMessage);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get METAR
|
||||
*/
|
||||
void MainWindow::getMetar(const QString &airportIcaoCode)
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
if (!this->getIContextNetwork()->isConnected()) return;
|
||||
QString icao = airportIcaoCode.isEmpty() ? this->ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper();
|
||||
this->ui->le_AtcStationsOnlineMetar->setText(icao);
|
||||
if (icao.length() != 4) return;
|
||||
CInformationMessage metar = this->getIContextNetwork()->getMetar(icao);
|
||||
if (metar.getType() != CInformationMessage::METAR) return;
|
||||
if (metar.isEmpty()) return;
|
||||
this->ui->te_AtcStationsOnlineInfo->setText(metar.getMessage());
|
||||
}
|
||||
|
||||
/*
|
||||
* Get METAR
|
||||
*/
|
||||
void MainWindow::requestAtis()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
if (!this->getIContextNetwork()->isConnected()) return;
|
||||
this->getIContextNetwork()->requestAtisUpdates();
|
||||
}
|
||||
|
||||
/*
|
||||
* ATC station tab changed are changed
|
||||
*/
|
||||
void MainWindow::atcStationTabChanged(int /** tabIndex **/)
|
||||
{
|
||||
if (this->isContextNetworkAvailableCheck())
|
||||
{
|
||||
if (this->ui->tw_AtcStations->currentWidget() == this->ui->tb_AtcStationsBooked)
|
||||
{
|
||||
if (this->ui->tvp_AtcStationsBooked->rowCount() < 1)
|
||||
this->reloadAtcStationsBooked();
|
||||
}
|
||||
else if (this->ui->tw_AtcStations->currentWidget() == this->ui->tb_AtcStationsOnline)
|
||||
{
|
||||
this->reloadAtcStationsOnline();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,6 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
||||
}
|
||||
|
||||
// init encapsulated table views / models
|
||||
this->ui->tvp_AtcStationsBooked->setStationMode(CAtcStationListModel::StationsBooked);
|
||||
this->ui->tvp_CockpitVoiceRoom1->setUserMode(CUserListModel::UserShort);
|
||||
this->ui->tvp_CockpitVoiceRoom2->setUserMode(CUserListModel::UserShort);
|
||||
|
||||
@@ -70,8 +69,6 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
||||
this->ui->cb_CockpitSelcal2->addItems(BlackMisc::Aviation::CSelcal::codePairs());
|
||||
|
||||
// timers
|
||||
if (this->m_timerUpdateAircraftsInRange == nullptr) this->m_timerUpdateAircraftsInRange = new QTimer(this);
|
||||
if (this->m_timerUpdateAtcStationsOnline == nullptr) this->m_timerUpdateAtcStationsOnline = new QTimer(this);
|
||||
if (this->m_timerContextWatchdog == nullptr) this->m_timerContextWatchdog = new QTimer(this);
|
||||
if (this->m_timerCollectedCockpitUpdates == nullptr) this->m_timerCollectedCockpitUpdates = new QTimer(this);
|
||||
if (this->m_timerAudioTests == nullptr) this->m_timerAudioTests = new QTimer(this);
|
||||
@@ -117,8 +114,6 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
||||
connect = this->connect(this->getIContextNetwork(), SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)), this, SLOT(appendTextMessagesToGui(BlackMisc::Network::CTextMessageList)));
|
||||
Q_ASSERT(connect);
|
||||
this->connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorConnectionChanged);
|
||||
this->connect(this->m_timerUpdateAircraftsInRange, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
this->connect(this->m_timerUpdateAtcStationsOnline, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
this->connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
this->connect(this->m_timerCollectedCockpitUpdates, &QTimer::timeout, this, &MainWindow::sendCockpitUpdates);
|
||||
this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &MainWindow::audioTestUpdate);
|
||||
@@ -127,6 +122,7 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
||||
|
||||
// sliders
|
||||
this->connect(this->ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this->ui->twp_Users, &BlackGui::CUserComponent::setUpdateIntervalSeconds);
|
||||
this->connect(this->ui->hs_SettingsGuiAircraftRefreshTime, &QSlider::valueChanged, this->ui->twp_Aircrafts, &BlackGui::CAircraftComponent::setUpdateIntervalSeconds);
|
||||
|
||||
Q_ASSERT(connect);
|
||||
Q_UNUSED(connect); // suppress GCC warning in release build
|
||||
@@ -179,7 +175,6 @@ void MainWindow::initGuiSignals()
|
||||
// This is why we still have some "old" SIGNAL/SLOT connections here
|
||||
|
||||
// MAIN buttons
|
||||
this->connect(this->ui->sw_MainMiddle, &QStackedWidget::currentChanged, this, &MainWindow::middlePanelChanged);
|
||||
connected = this->connect(this->ui->pb_MainAircrafts, SIGNAL(released()), this, SLOT(setMainPage()));
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->pb_MainAtc, SIGNAL(released()), this, SLOT(setMainPage()));
|
||||
@@ -256,16 +251,6 @@ void MainWindow::initGuiSignals()
|
||||
this->connect(this->ui->pb_SettingsAudioMicrophoneTest, &QPushButton::clicked, this, &MainWindow::startAudioTest);
|
||||
this->connect(this->ui->pb_SettingsAudioSquelchTest, &QPushButton::clicked, this, &MainWindow::startAudioTest);
|
||||
|
||||
// ATC
|
||||
connected = this->connect(this->ui->le_AtcStationsOnlineMetar, SIGNAL(returnPressed()), this, SLOT(getMetar()));
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->pb_AtcStationsLoadMetar, SIGNAL(clicked()), this, SLOT(getMetar()));
|
||||
Q_ASSERT(connected);
|
||||
this->connect(this->ui->tw_AtcStations, &QTabWidget::currentChanged, this, &MainWindow::atcStationTabChanged);
|
||||
this->connect(this->ui->pb_ReloadAtcStationsBooked, &QPushButton::clicked, this, &MainWindow::reloadAtcStationsBooked);
|
||||
this->connect(this->ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &MainWindow::onlineAtcStationSelected);
|
||||
this->connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &MainWindow::requestAtis);
|
||||
|
||||
// Settings server
|
||||
this->connect(this->ui->pb_SettingsTnCurrentServer, &QPushButton::released, this, &MainWindow::alterTrafficServer);
|
||||
this->connect(this->ui->pb_SettingsTnRemoveServer, &QPushButton::released, this, &MainWindow::alterTrafficServer);
|
||||
@@ -299,16 +284,17 @@ void MainWindow::initialDataReads()
|
||||
}
|
||||
|
||||
this->reloadSettings(); // init read
|
||||
this->reloadAtcStationsBooked(); // init read, to do this no traffic network required
|
||||
this->reloadOwnAircraft(); // init read, independent of traffic network
|
||||
|
||||
if (this->getIContextNetwork()->isConnected())
|
||||
{
|
||||
// connection is already established
|
||||
this->reloadAircraftsInRange();
|
||||
this->reloadAtcStationsOnline();
|
||||
this->ui->twp_Aircrafts->update();
|
||||
this->ui->twp_AtcStations->update();
|
||||
|
||||
this->updateGuiStatusInformation();
|
||||
this->ui->twp_Users->update();
|
||||
this->ui->twp_Aircrafts->update();
|
||||
}
|
||||
|
||||
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeGui, CStatusMessage::SeverityInfo, "initial data read"));
|
||||
@@ -319,22 +305,19 @@ void MainWindow::initialDataReads()
|
||||
*/
|
||||
void MainWindow::startUpdateTimers()
|
||||
{
|
||||
this->m_timerUpdateAircraftsInRange->start(this->ui->hs_SettingsGuiAircraftRefreshTime->value() * 1000);
|
||||
this->m_timerUpdateAtcStationsOnline->start(this->ui->hs_SettingsGuiAtcRefreshTime->value() * 1000);
|
||||
this->ui->twp_Aircrafts->setUpdateIntervalSeconds(this->ui->hs_SettingsGuiAtcRefreshTime->value());
|
||||
this->ui->twp_AtcStations->setUpdateIntervalSeconds(this->ui->hs_SettingsGuiAircraftRefreshTime->value());
|
||||
this->ui->twp_Users->setUpdateIntervalSeconds(this->ui->hs_SettingsGuiUserRefreshTime->value());
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop udate timers
|
||||
*/
|
||||
void MainWindow::stopUpdateTimers(bool disconnect)
|
||||
void MainWindow::stopUpdateTimers()
|
||||
{
|
||||
this->m_timerUpdateAircraftsInRange->stop();
|
||||
this->m_timerUpdateAtcStationsOnline->stop();
|
||||
this->ui->twp_Users->setUpdateInterval(-1);
|
||||
if (!disconnect) return;
|
||||
this->disconnect(this->m_timerUpdateAircraftsInRange);
|
||||
this->disconnect(this->m_timerUpdateAtcStationsOnline);
|
||||
this->ui->twp_AtcStations->stopTimer();
|
||||
this->ui->twp_Aircrafts->stopTimer();
|
||||
this->ui->twp_Users->stopTimer();
|
||||
}
|
||||
|
||||
void MainWindow::stopAllTimers(bool disconnect)
|
||||
@@ -344,7 +327,7 @@ void MainWindow::stopAllTimers(bool disconnect)
|
||||
this->m_timerCollectedCockpitUpdates->stop();
|
||||
this->m_timerAudioTests->stop();
|
||||
this->m_timerSimulator->stop();
|
||||
this->stopUpdateTimers(disconnect);
|
||||
this->stopUpdateTimers();
|
||||
if (!disconnect) return;
|
||||
this->disconnect(this->m_timerStatusBar);
|
||||
this->disconnect(this->m_timerContextWatchdog);
|
||||
|
||||
Reference in New Issue
Block a user