Fixed bugs for ATC bookings, those can be read even if network is not connected

This commit is contained in:
Klaus Basan
2014-06-05 13:26:08 +02:00
parent 6404fafb34
commit 48d66c204f
3 changed files with 24 additions and 14 deletions

View File

@@ -461,7 +461,7 @@ QStatusBar QLabel {
<enum>QFrame::NoFrame</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>7</number>
</property>
<widget class="QWidget" name="pg_StatusPage">
<property name="sizePolicy">
@@ -571,8 +571,8 @@ QStatusBar QLabel {
<rect>
<x>0</x>
<y>0</y>
<width>90</width>
<height>59</height>
<width>326</width>
<height>267</height>
</rect>
</property>
<attribute name="label">
@@ -859,7 +859,7 @@ QStatusBar QLabel {
<item>
<widget class="QTabWidget" name="tw_Settings">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tb_SettingsTrafficNetwork">
<attribute name="title">
@@ -1355,6 +1355,13 @@ QStatusBar QLabel {
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="cb_SettingsAudioNotificationVoiceRoom">
<property name="text">
<string>notification for join/leave voice room</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -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"));
}

View File

@@ -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()