From 48d66c204fa6a2651c221fbcb116797e281b94c0 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 5 Jun 2014 13:26:08 +0200 Subject: [PATCH] Fixed bugs for ATC bookings, those can be read even if network is not connected --- samples/blackgui/mainwindow.ui | 15 +++++++++++---- samples/blackgui/mainwindow_init.cpp | 8 +++++++- src/blackgui/atcstationcomponent.cpp | 15 ++++++--------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/samples/blackgui/mainwindow.ui b/samples/blackgui/mainwindow.ui index 8062bb277..a9c823006 100644 --- a/samples/blackgui/mainwindow.ui +++ b/samples/blackgui/mainwindow.ui @@ -461,7 +461,7 @@ QStatusBar QLabel { QFrame::NoFrame - 4 + 7 @@ -571,8 +571,8 @@ QStatusBar QLabel { 0 0 - 90 - 59 + 326 + 267 @@ -859,7 +859,7 @@ QStatusBar QLabel { - 0 + 2 @@ -1355,6 +1355,13 @@ QStatusBar QLabel { + + + + notification for join/leave voice room + + + diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp index 471cdbf54..31a0df1c9 100644 --- a/samples/blackgui/mainwindow_init.cpp +++ b/samples/blackgui/mainwindow_init.cpp @@ -261,16 +261,22 @@ void MainWindow::initialDataReads() this->reloadSettings(); // init read this->reloadOwnAircraft(); // init read, independent of traffic network + // also reads bookings if not connected if (this->getIContextNetwork()->isConnected()) { // connection is already established - this->ui->comp_Aircrafts->update(); this->ui->comp_AtcStations->update(); + this->ui->comp_Aircrafts->update(); this->updateGuiStatusInformation(); this->ui->comp_Users->update(); this->ui->comp_Aircrafts->update(); } + else + { + // Initial booking read + QTimer::singleShot(30 * 1000, this->ui->comp_AtcStations, SLOT(update())); + } this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeGui, CStatusMessage::SeverityInfo, "initial data read")); } diff --git a/src/blackgui/atcstationcomponent.cpp b/src/blackgui/atcstationcomponent.cpp index 20c39fa29..86e5306d9 100644 --- a/src/blackgui/atcstationcomponent.cpp +++ b/src/blackgui/atcstationcomponent.cpp @@ -21,9 +21,9 @@ namespace BlackGui connected = this->connect(this->ui->pb_AtcStationsLoadMetar, SIGNAL(clicked()), this, SLOT(getMetar())); Q_ASSERT(connected); this->connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::atcStationsTabChanged); - this->connect(this->ui->pb_ReloadAtcStationsBooked, &QPushButton::clicked, this, &CAtcStationComponent::reloadAtcStationsBooked); this->connect(this->ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &CAtcStationComponent::onlineAtcStationSelected); this->connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::requestAtis); + this->connect(this->ui->pb_ReloadAtcStationsBooked, &QPushButton::clicked, this, &CAtcStationComponent::reloadAtcStationsBooked); } CAtcStationComponent::~CAtcStationComponent() @@ -46,11 +46,11 @@ namespace BlackGui Q_ASSERT(this->ui->tvp_AtcStationsOnline); Q_ASSERT(this->getIContextNetwork()); + // initial read for bookings + if (this->ui->tvp_AtcStationsBooked->isEmpty()) this->reloadAtcStationsBooked(); + if (this->getIContextNetwork()->isConnected()) { - // initial read for bookings - if (this->ui->tvp_AtcStationsBooked->isEmpty()) this->reloadAtcStationsBooked(); - // update if (this->m_timestampOnlineStationsChanged.isNull() || this->m_timestampLastReadOnlineStations.isNull() || (this->m_timestampOnlineStationsChanged > this->m_timestampLastReadOnlineStations)) @@ -71,11 +71,8 @@ namespace BlackGui Q_ASSERT(this->ui->tvp_AtcStationsBooked); Q_ASSERT(this->getIContextNetwork()); - if (this->getIContextNetwork()->isConnected()) - { - this->ui->tvp_AtcStationsBooked->update(this->getIContextNetwork()->getAtcStationsBooked()); - this->m_timestampLastReadBookedStations = QDateTime::currentDateTimeUtc(); - } + this->ui->tvp_AtcStationsBooked->update(this->getIContextNetwork()->getAtcStationsBooked()); + this->m_timestampLastReadBookedStations = QDateTime::currentDateTimeUtc(); } void CAtcStationComponent::changedAtcStationsOnline()