mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #325, reduced loading in ATC stations component
This commit is contained in:
@@ -55,6 +55,16 @@ namespace BlackGui
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int CAtcStationComponent::countBookedStations() const
|
||||
{
|
||||
return ui->tvp_AtcStationsBooked->rowCount();
|
||||
}
|
||||
|
||||
int CAtcStationComponent::countOnlineStations() const
|
||||
{
|
||||
return ui->tvp_AtcStationsOnline->rowCount();
|
||||
}
|
||||
|
||||
void CAtcStationComponent::runtimeHasBeenSet()
|
||||
{
|
||||
Q_ASSERT(this->getRuntime());
|
||||
@@ -74,6 +84,14 @@ namespace BlackGui
|
||||
Q_ASSERT(this->ui->tvp_AtcStationsOnline);
|
||||
Q_ASSERT(this->getIContextNetwork());
|
||||
|
||||
// check if component is visible, if we have already data then skip udpate
|
||||
bool hasData = this->countBookedStations() > 0 || this->countOnlineStations() > 0;
|
||||
if (hasData && !this->isVisibleWidget())
|
||||
{
|
||||
qDebug() << this->objectName() << "Skipping update, not visible";
|
||||
return;
|
||||
}
|
||||
|
||||
// bookings
|
||||
if (this->m_timestampBookedStationsChanged > this->m_timestampLastReadBookedStations)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,12 @@ namespace BlackGui
|
||||
//! Timer for updating
|
||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||
|
||||
//! Number of booked stations
|
||||
int countBookedStations() const;
|
||||
|
||||
//! Number of online stations
|
||||
int countOnlineStations() const;
|
||||
|
||||
public slots:
|
||||
//! Update stations
|
||||
void update();
|
||||
|
||||
Reference in New Issue
Block a user