mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #291, timers for aircraft component independent of network connection
Remarks: sim can be connected, while network is not
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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/>
|
||||
|
||||
Reference in New Issue
Block a user