mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
refs #325, reduced loading in ATC stations component
This commit is contained in:
@@ -55,6 +55,16 @@ namespace BlackGui
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CAtcStationComponent::countBookedStations() const
|
||||||
|
{
|
||||||
|
return ui->tvp_AtcStationsBooked->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAtcStationComponent::countOnlineStations() const
|
||||||
|
{
|
||||||
|
return ui->tvp_AtcStationsOnline->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
void CAtcStationComponent::runtimeHasBeenSet()
|
void CAtcStationComponent::runtimeHasBeenSet()
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->getRuntime());
|
Q_ASSERT(this->getRuntime());
|
||||||
@@ -74,6 +84,14 @@ namespace BlackGui
|
|||||||
Q_ASSERT(this->ui->tvp_AtcStationsOnline);
|
Q_ASSERT(this->ui->tvp_AtcStationsOnline);
|
||||||
Q_ASSERT(this->getIContextNetwork());
|
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
|
// bookings
|
||||||
if (this->m_timestampBookedStationsChanged > this->m_timestampLastReadBookedStations)
|
if (this->m_timestampBookedStationsChanged > this->m_timestampLastReadBookedStations)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ namespace BlackGui
|
|||||||
//! Timer for updating
|
//! Timer for updating
|
||||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||||
|
|
||||||
|
//! Number of booked stations
|
||||||
|
int countBookedStations() const;
|
||||||
|
|
||||||
|
//! Number of online stations
|
||||||
|
int countOnlineStations() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Update stations
|
//! Update stations
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
Reference in New Issue
Block a user