mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 15:15:39 +08:00
refs #814, some adjustments because of MS comment
(performance of airline view)
This commit is contained in:
@@ -49,26 +49,26 @@ namespace BlackGui
|
|||||||
ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::NetworkMode);
|
ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::NetworkMode);
|
||||||
ui->tvp_AircraftInRange->configureMenu(true, false, false);
|
ui->tvp_AircraftInRange->configureMenu(true, false, false);
|
||||||
|
|
||||||
|
this->ps_settingsChanged();
|
||||||
|
|
||||||
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::modelDataChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::modelDataChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||||
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget, this, &CAircraftComponent::requestTextMessageWidget);
|
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget, this, &CAircraftComponent::requestTextMessageWidget);
|
||||||
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestHighlightInSimulator, this, &CAircraftComponent::ps_onMenuHighlightInSimulator);
|
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestHighlightInSimulator, this, &CAircraftComponent::ps_onMenuHighlightInSimulator);
|
||||||
connect(ui->tvp_AirportsInRange, &CSimulatedAircraftView::modelDataChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
connect(ui->tvp_AirportsInRange, &CSimulatedAircraftView::modelDataChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CAircraftComponent::ps_connectionStatusChanged);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CAircraftComponent::ps_connectionStatusChanged);
|
||||||
connect(&m_updateTimer, &QTimer::timeout, this, &CAircraftComponent::update);
|
connect(&m_updateTimer, &QTimer::timeout, this, &CAircraftComponent::update);
|
||||||
|
|
||||||
this->ps_settingsChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftComponent::~CAircraftComponent()
|
CAircraftComponent::~CAircraftComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
int CAircraftComponent::countAircraft() const
|
int CAircraftComponent::countAircraftInView() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(ui->tvp_AircraftInRange);
|
Q_ASSERT(ui->tvp_AircraftInRange);
|
||||||
return ui->tvp_AircraftInRange->rowCount();
|
return ui->tvp_AircraftInRange->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAircraftComponent::countAirportsInRange() const
|
int CAircraftComponent::countAirportsInRangeInView() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(ui->tvp_AirportsInRange);
|
Q_ASSERT(ui->tvp_AirportsInRange);
|
||||||
return ui->tvp_AirportsInRange->rowCount();
|
return ui->tvp_AirportsInRange->rowCount();
|
||||||
@@ -89,18 +89,19 @@ namespace BlackGui
|
|||||||
Q_ASSERT(sGui->getIContextNetwork());
|
Q_ASSERT(sGui->getIContextNetwork());
|
||||||
Q_ASSERT(sGui->getIContextSimulator());
|
Q_ASSERT(sGui->getIContextSimulator());
|
||||||
|
|
||||||
|
// count < 1 checks if view already has been updated
|
||||||
if (sGui->getIContextNetwork()->isConnected())
|
if (sGui->getIContextNetwork()->isConnected())
|
||||||
{
|
{
|
||||||
bool visible = (this->isVisibleWidget() && this->currentWidget() == ui->tb_AircraftInRange);
|
const bool visible = (this->isVisibleWidget() && this->currentWidget() == ui->tb_AircraftInRange);
|
||||||
if (this->countAircraft() < 1 || visible)
|
if (this->countAircraftInView() < 1 || visible)
|
||||||
{
|
{
|
||||||
ui->tvp_AircraftInRange->updateContainer(sGui->getIContextNetwork()->getAircraftInRange());
|
ui->tvp_AircraftInRange->updateContainer(sGui->getIContextNetwork()->getAircraftInRange());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sGui->getIContextSimulator()->getSimulatorStatus() > 0)
|
if (sGui->getIContextSimulator()->getSimulatorStatus() > 0)
|
||||||
{
|
{
|
||||||
bool visible = (this->isVisibleWidget() && this->currentWidget() == ui->tb_AirportsInRange);
|
const bool visible = (this->isVisibleWidget() && this->currentWidget() == ui->tb_AirportsInRange);
|
||||||
if (this->countAirportsInRange() < 1 || visible)
|
if (this->countAirportsInRangeInView() < 1 || visible)
|
||||||
{
|
{
|
||||||
ui->tvp_AirportsInRange->updateContainer(sGui->getIContextSimulator()->getAirportsInRange());
|
ui->tvp_AirportsInRange->updateContainer(sGui->getIContextSimulator()->getAirportsInRange());
|
||||||
}
|
}
|
||||||
@@ -127,8 +128,8 @@ namespace BlackGui
|
|||||||
int ap = this->indexOf(ui->tb_AirportsInRange);
|
int ap = this->indexOf(ui->tb_AirportsInRange);
|
||||||
QString acs = this->tabBar()->tabText(ac);
|
QString acs = this->tabBar()->tabText(ac);
|
||||||
QString aps = this->tabBar()->tabText(ap);
|
QString aps = this->tabBar()->tabText(ap);
|
||||||
acs = CGuiUtility::replaceTabCountValue(acs, this->countAircraft());
|
acs = CGuiUtility::replaceTabCountValue(acs, this->countAircraftInView());
|
||||||
aps = CGuiUtility::replaceTabCountValue(aps, this->countAirportsInRange());
|
aps = CGuiUtility::replaceTabCountValue(aps, this->countAirportsInRangeInView());
|
||||||
this->tabBar()->setTabText(ac, acs);
|
this->tabBar()->setTabText(ac, acs);
|
||||||
this->tabBar()->setTabText(ap, aps);
|
this->tabBar()->setTabText(ap, aps);
|
||||||
}
|
}
|
||||||
@@ -160,6 +161,5 @@ namespace BlackGui
|
|||||||
const CViewUpdateSettings settings = this->m_settings.get();
|
const CViewUpdateSettings settings = this->m_settings.get();
|
||||||
this->m_updateTimer.setInterval(settings.getAircraftUpdateTime().toMs());
|
this->m_updateTimer.setInterval(settings.getAircraftUpdateTime().toMs());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ namespace BlackGui
|
|||||||
explicit CAircraftComponent(QWidget *parent = nullptr);
|
explicit CAircraftComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CAircraftComponent();
|
virtual ~CAircraftComponent();
|
||||||
|
|
||||||
//! Aircraft in range
|
//! Aircraft in range
|
||||||
int countAircraft() const;
|
int countAircraftInView() const;
|
||||||
|
|
||||||
//! Airports in range
|
//! Airports in range
|
||||||
int countAirportsInRange() const;
|
int countAirportsInRangeInView() const;
|
||||||
|
|
||||||
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
|
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
|
||||||
virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget) override;
|
virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget) override;
|
||||||
@@ -64,7 +64,7 @@ namespace BlackGui
|
|||||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Update aircraft
|
//! Update aircraft/airport view
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
Reference in New Issue
Block a user