mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #844, avoid pending load indicator
* Renamed to settingsChanged * update bookings even if not connected
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f281092f16
commit
99254938b1
@@ -109,8 +109,8 @@ namespace BlackGui
|
|||||||
this->ps_airportsRead();
|
this->ps_airportsRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
// settings have
|
// init settings
|
||||||
this->ps_settingsChanged();
|
this->settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAtcStationComponent::~CAtcStationComponent()
|
CAtcStationComponent::~CAtcStationComponent()
|
||||||
@@ -142,10 +142,12 @@ namespace BlackGui
|
|||||||
Q_ASSERT(ui->tvp_AtcStationsOnline);
|
Q_ASSERT(ui->tvp_AtcStationsOnline);
|
||||||
|
|
||||||
// check if component is visible, if we have already data then skip udpate
|
// check if component is visible, if we have already data then skip udpate
|
||||||
bool hasData = this->countBookedStations() > 0 || this->countOnlineStations() > 0;
|
const bool hasData = this->countBookedStations() > 0 || this->countOnlineStations() > 0;
|
||||||
if (hasData && !this->isVisibleWidget())
|
if (hasData && !this->isVisibleWidget())
|
||||||
{
|
{
|
||||||
// Update skipped, as not visible
|
// Update skipped, as not visible
|
||||||
|
ui->tvp_AtcStationsBooked->hideLoadIndicator();
|
||||||
|
ui->tvp_AtcStationsOnline->hideLoadIndicator();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,10 +163,10 @@ namespace BlackGui
|
|||||||
// update
|
// update
|
||||||
if (this->m_timestampOnlineStationsChanged > this->m_timestampLastReadOnlineStations)
|
if (this->m_timestampOnlineStationsChanged > this->m_timestampLastReadOnlineStations)
|
||||||
{
|
{
|
||||||
// sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidVoiceRoom()
|
|
||||||
const CAtcStationsSettings settings = m_settingsAtc.getThreadLocal();
|
const CAtcStationsSettings settings = m_settingsAtc.getThreadLocal();
|
||||||
CAtcStationList onlineStations =
|
CAtcStationList onlineStations =
|
||||||
sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidFrequency();
|
sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidFrequency(); // alternatively: stationsWithValidVoiceRoom()
|
||||||
|
|
||||||
if (settings.showOnlyInRange())
|
if (settings.showOnlyInRange())
|
||||||
{
|
{
|
||||||
onlineStations.removeIfOutsideRange();
|
onlineStations.removeIfOutsideRange();
|
||||||
@@ -179,6 +181,7 @@ namespace BlackGui
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->tvp_AtcStationsOnline->clear();
|
ui->tvp_AtcStationsOnline->clear();
|
||||||
|
ui->tvp_AtcStationsOnline->hideLoadIndicator();
|
||||||
this->updateTreeView();
|
this->updateTreeView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +199,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAtcStationComponent::getMetar(const QString &airportIcaoCode)
|
void CAtcStationComponent::getMetar(const QString &airportIcaoCode)
|
||||||
{
|
{
|
||||||
QString icao(airportIcaoCode.isEmpty() ? ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper());
|
const QString icao(airportIcaoCode.isEmpty() ? ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper());
|
||||||
ui->le_AtcStationsOnlineMetar->setText(icao);
|
ui->le_AtcStationsOnlineMetar->setText(icao);
|
||||||
if (icao.length() != 4) { return; }
|
if (icao.length() != 4) { return; }
|
||||||
CMetar metar(sGui->getIContextNetwork()->getMetarForAirport(icao));
|
CMetar metar(sGui->getIContextNetwork()->getMetarForAirport(icao));
|
||||||
@@ -224,7 +227,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
// trigger new read, which takes some time. A signal will be received when this is done
|
// trigger new read, which takes some time. A signal will be received when this is done
|
||||||
CLogMessage(this).info("Requested new bookings");
|
CLogMessage(this).info("Requested new bookings");
|
||||||
sGui->getIContextNetwork()->readAtcBookingsFromSource();
|
sGui->getIContextNetwork()->requestAtcBookingsUpdate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -246,7 +249,11 @@ namespace BlackGui
|
|||||||
// a single value is updated (e.g. online status)
|
// a single value is updated (e.g. online status)
|
||||||
// just update timestamp, data will be pulled by timer
|
// just update timestamp, data will be pulled by timer
|
||||||
// the timestamp will tell if there are any newer data
|
// the timestamp will tell if there are any newer data
|
||||||
|
// unlike online stations, this can happen if we are not connected to a FSD server
|
||||||
|
|
||||||
this->m_timestampBookedStationsChanged = QDateTime::currentDateTimeUtc();
|
this->m_timestampBookedStationsChanged = QDateTime::currentDateTimeUtc();
|
||||||
|
if (this->m_updateTimer.isActive()) { return; } // update by timer
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAtcStationComponent::ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
void CAtcStationComponent::ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
||||||
@@ -310,7 +317,7 @@ namespace BlackGui
|
|||||||
sGui->getIContextOwnAircraft()->updateActiveComFrequency(frequency, unit, identifier());
|
sGui->getIContextOwnAircraft()->updateActiveComFrequency(frequency, unit, identifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAtcStationComponent::ps_settingsChanged()
|
void CAtcStationComponent::settingsChanged()
|
||||||
{
|
{
|
||||||
const CViewUpdateSettings settings = this->m_settingsView.get();
|
const CViewUpdateSettings settings = this->m_settingsView.get();
|
||||||
const int ms = settings.getAtcUpdateTime().toMs();
|
const int ms = settings.getAtcUpdateTime().toMs();
|
||||||
|
|||||||
@@ -118,9 +118,6 @@ namespace BlackGui
|
|||||||
//! Set COM frequency
|
//! Set COM frequency
|
||||||
void ps_setComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit);
|
void ps_setComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit);
|
||||||
|
|
||||||
//! Settings have been changed
|
|
||||||
void ps_settingsChanged();
|
|
||||||
|
|
||||||
//! Airports read from web readers
|
//! Airports read from web readers
|
||||||
void ps_airportsRead();
|
void ps_airportsRead();
|
||||||
|
|
||||||
@@ -131,14 +128,17 @@ namespace BlackGui
|
|||||||
//! Init the completers
|
//! Init the completers
|
||||||
void initCompleters();
|
void initCompleters();
|
||||||
|
|
||||||
|
//! Settings have been changed
|
||||||
|
void settingsChanged();
|
||||||
|
|
||||||
QScopedPointer<Ui::CAtcStationComponent> ui;
|
QScopedPointer<Ui::CAtcStationComponent> ui;
|
||||||
QTimer m_updateTimer { this };
|
QTimer m_updateTimer { this };
|
||||||
QDateTime m_timestampLastReadOnlineStations; //!< stations read
|
QDateTime m_timestampLastReadOnlineStations; //!< stations read
|
||||||
QDateTime m_timestampOnlineStationsChanged; //!< stations marked as changed
|
QDateTime m_timestampOnlineStationsChanged; //!< stations marked as changed
|
||||||
QDateTime m_timestampLastReadBookedStations; //!< stations read
|
QDateTime m_timestampLastReadBookedStations; //!< stations read
|
||||||
QDateTime m_timestampBookedStationsChanged; //!< stations marked as changed
|
QDateTime m_timestampBookedStationsChanged; //!< stations marked as changed
|
||||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settingsView { this, &CAtcStationComponent::ps_settingsChanged };
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settingsView { this, &CAtcStationComponent::settingsChanged };
|
||||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TAtcStationsSettings> m_settingsAtc { this, &CAtcStationComponent::ps_settingsChanged };
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TAtcStationsSettings> m_settingsAtc { this, &CAtcStationComponent::settingsChanged };
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user