refs #291, timers for aircraft component independent of network connection

Remarks: sim can be connected, while network is not
This commit is contained in:
Klaus Basan
2014-07-06 17:17:40 +02:00
parent db195bcd9b
commit 330919329d
4 changed files with 44 additions and 24 deletions

View File

@@ -311,10 +311,6 @@ void MainWindow::connectionStatusChanged(uint /** from **/, uint to, const QStri
{
this->updateGuiStatusInformation();
INetwork::ConnectionStatus newStatus = static_cast<INetwork::ConnectionStatus>(to);
if (newStatus == INetwork::Connected)
this->startUpdateTimers();
else if (newStatus == INetwork::Disconnecting || newStatus == INetwork::Disconnected || newStatus == INetwork::DisconnectedError)
this->stopUpdateTimers();
// sounds
switch (newStatus)

View File

@@ -145,6 +145,9 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
// hotkeys
this->registerHotkeys();
// update timers
this->startUpdateTimers();
// do this as last statement, so it can be used as flag
// whether init has been completed
this->m_init = true;
@@ -234,24 +237,6 @@ void MainWindow::initialDataReads()
this->ui->comp_Settings->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_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

@@ -20,10 +20,15 @@ namespace BlackGui
{
Q_ASSERT(this->ui->tvp_AircraftsInRange);
Q_ASSERT(this->getIContextNetwork());
Q_ASSERT(this->getIContextSimulator());
if (this->getIContextNetwork()->isConnected())
{
this->ui->tvp_AircraftsInRange->update(this->getIContextNetwork()->getAircraftsInRange());
}
if (this->getIContextSimulator()->isConnected())
{
this->ui->tvp_AirportsInRange->update(this->getIContextSimulator()->getAirportsInRange());
}
}
}

View File

@@ -11,14 +11,14 @@
</rect>
</property>
<property name="windowTitle">
<string>TabWidget</string>
<string>Airports in range</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tb_AircraftsInRange">
<attribute name="title">
<string>In range</string>
<string>Aircrafts in range</string>
</attribute>
<layout class="QVBoxLayout" name="vl_AircraftsInRange">
<property name="spacing">
@@ -45,6 +45,35 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_AirportsInRange">
<attribute name="title">
<string>Airports in range</string>
</attribute>
<layout class="QVBoxLayout" name="vl_AirportsInRange">
<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::CAirportView" name="tvp_AirportsInRange">
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
@@ -52,6 +81,11 @@
<extends>QTableView</extends>
<header>blackgui/aircraftview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CAirportView</class>
<extends>QTableView</extends>
<header>blackgui/airportview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>