diff --git a/samples/blackgui/mainwindow.cpp b/samples/blackgui/mainwindow.cpp
index 43cdaa693..a7299b085 100644
--- a/samples/blackgui/mainwindow.cpp
+++ b/samples/blackgui/mainwindow.cpp
@@ -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
*/
diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h
index bbb1078c9..045402af1 100644
--- a/samples/blackgui/mainwindow.h
+++ b/samples/blackgui/mainwindow.h
@@ -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();
diff --git a/samples/blackgui/mainwindow.ui b/samples/blackgui/mainwindow.ui
index ca3f04459..d0c07b8c6 100644
--- a/samples/blackgui/mainwindow.ui
+++ b/samples/blackgui/mainwindow.ui
@@ -461,7 +461,7 @@ QStatusBar QLabel {
QFrame::NoFrame
- 7
+ 1
@@ -571,7 +571,7 @@ QStatusBar QLabel {
0
0
- 86
+ 90
59
@@ -694,7 +694,7 @@ QStatusBar QLabel {
0
-
-
+
0
@@ -719,283 +719,13 @@ QStatusBar QLabel {
- 0
+ -1
-
-
- In range
-
-
-
- 2
-
-
- 2
-
-
- 2
-
-
- 2
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
-
-
-
- QAbstractItemView::SingleSelection
-
-
- QAbstractItemView::SelectRows
-
-
- true
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 110
-
-
-
- Info (ATIS, METAR, ...)
-
-
-
- 0
-
-
- 0
-
-
- 12
-
-
- 0
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 100
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 25
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Raised
-
-
-
- QLayout::SetDefaultConstraint
-
-
- 5
-
-
- 0
-
-
- 2
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- Load METAR
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Reload ATIS
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 60
- 16777215
-
-
-
-
-
-
- EDDF
-
-
- 5
-
-
- true
-
-
-
-
-
-
-
-
-
-
- Bookings
-
-
-
- 3
-
-
- 0
-
-
- 3
-
-
- 0
-
-
- 3
-
- -
-
-
- QFrame::StyledPanel
-
-
- QFrame::Sunken
-
-
- 1
-
-
- true
-
-
- QAbstractItemView::SingleSelection
-
-
- QAbstractItemView::SelectRows
-
-
- true
-
-
- true
-
-
- false
-
-
-
- -
-
-
- Reload
-
-
-
-
-
-
+
0
@@ -1013,11 +743,7 @@ QStatusBar QLabel {
0
-
-
-
- false
-
-
+
@@ -3178,16 +2904,6 @@ QStatusBar QLabel {
QTableView
blackgui/statusmessageview.h
-
- BlackGui::CAtcStationView
- QTableView
- blackgui/atcstationview.h
-
-
- BlackGui::CAircraftView
- QTableView
-
-
BlackGui::CKeyboardKeyView
QTableView
@@ -3216,6 +2932,18 @@ QStatusBar QLabel {
1
+
+ BlackGui::CAircraftComponent
+ QTabWidget
+ blackgui/aircraftcomponent.h
+ 1
+
+
+ BlackGui::CAtcStationComponent
+ QTabWidget
+ blackgui/atcstationcomponent.h
+ 1
+
cb_StatusWithDBus
@@ -3223,15 +2951,7 @@ QStatusBar QLabel {
le_StatusAudioContext
tvp_StatusMessages
le_CommandLineInput
- tw_AtcStations
- tvp_AtcStationsOnline
- te_AtcStationsOnlineInfo
- le_AtcStationsOnlineMetar
- pb_AtcStationsLoadMetar
- pb_AtcStationsAtisReload
- tvp_AtcStationsBooked
- pb_ReloadAtcStationsBooked
- tvp_AircraftsInRange
+ twp_AtcStations
pb_CockpitToggleCom1
ds_CockpitCom1Active
ds_CockpitCom1Standby
diff --git a/samples/blackgui/mainwindow_aircraft.cpp b/samples/blackgui/mainwindow_aircraft.cpp
index d69aab877..10d4ba8fb 100644
--- a/samples/blackgui/mainwindow_aircraft.cpp
+++ b/samples/blackgui/mainwindow_aircraft.cpp
@@ -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
*/
diff --git a/samples/blackgui/mainwindow_atc.cpp b/samples/blackgui/mainwindow_atc.cpp
deleted file mode 100644
index 65f825e9c..000000000
--- a/samples/blackgui/mainwindow_atc.cpp
+++ /dev/null
@@ -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();
- }
- }
-}
diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp
index 2852f37b2..bda4d9cfc 100644
--- a/samples/blackgui/mainwindow_init.cpp
+++ b/samples/blackgui/mainwindow_init.cpp
@@ -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);