mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
refs #898, rendered view update
* removed redundant function * use token bucket for forced updated * and timer updates to update speed, pos. etc., but not forced
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ac07d7f7b6
commit
fef6cba645
@@ -100,9 +100,9 @@ namespace BlackGui
|
|||||||
ui->completer_ModelStrings->selectSource(CAircraftModelStringCompleter::ModelSet);
|
ui->completer_ModelStrings->selectSource(CAircraftModelStringCompleter::ModelSet);
|
||||||
|
|
||||||
// Updates
|
// Updates
|
||||||
|
connect(&m_updateTimer, &QTimer::timeout, this, &CMappingComponent::ps_timerUpdate);
|
||||||
ui->tvp_AircraftModels->setDisplayAutomatically(false);
|
ui->tvp_AircraftModels->setDisplayAutomatically(false);
|
||||||
this->ps_settingsChanged();
|
this->ps_settingsChanged();
|
||||||
connect(&m_updateTimer, &QTimer::timeout, this, &CMappingComponent::ps_timerUpdate);
|
|
||||||
|
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CMappingComponent::ps_onModelSetChanged);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CMappingComponent::ps_onModelSetChanged);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_tokenBucketUpdateAircraft);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_tokenBucketUpdateAircraft);
|
||||||
@@ -358,7 +358,7 @@ namespace BlackGui
|
|||||||
Q_UNUSED(from);
|
Q_UNUSED(from);
|
||||||
if (INetwork::isDisconnectedStatus(to))
|
if (INetwork::isDisconnectedStatus(to))
|
||||||
{
|
{
|
||||||
this->tokenBucketUpdate(true);
|
this->ps_tokenBucketUpdate();
|
||||||
ui->tvp_RenderedAircraft->clear();
|
ui->tvp_RenderedAircraft->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CMappingComponent::ps_addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
void CMappingComponent::ps_addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
||||||
{
|
{
|
||||||
this->tokenBucketUpdate(true);
|
this->ps_tokenBucketUpdate();
|
||||||
Q_UNUSED(aircraft);
|
Q_UNUSED(aircraft);
|
||||||
Q_UNUSED(message);
|
Q_UNUSED(message);
|
||||||
}
|
}
|
||||||
@@ -413,6 +413,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_missedRenderedAircraftUpdate = false;
|
m_missedRenderedAircraftUpdate = false;
|
||||||
|
m_updateTimer.start(); // restart
|
||||||
if (sGui->getIContextSimulator()->getSimulatorStatus() > 0)
|
if (sGui->getIContextSimulator()->getSimulatorStatus() > 0)
|
||||||
{
|
{
|
||||||
const CSimulatedAircraftList aircraft(sGui->getIContextNetwork()->getAircraftInRange());
|
const CSimulatedAircraftList aircraft(sGui->getIContextNetwork()->getAircraftInRange());
|
||||||
@@ -424,31 +425,22 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::ps_timerUpdate()
|
||||||
|
{
|
||||||
|
// timer update to update position, speed ...
|
||||||
|
this->updateRenderedAircraftView(false); // unforced
|
||||||
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_tokenBucketUpdateAircraft(const CSimulatedAircraft &aircraft)
|
void CMappingComponent::ps_tokenBucketUpdateAircraft(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
Q_UNUSED(aircraft);
|
Q_UNUSED(aircraft);
|
||||||
this->tokenBucketUpdate(true);
|
this->ps_tokenBucketUpdate();
|
||||||
}
|
|
||||||
|
|
||||||
void CMappingComponent::ps_timerUpdate()
|
|
||||||
{
|
|
||||||
this->tokenBucketUpdate(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_tokenBucketUpdate()
|
void CMappingComponent::ps_tokenBucketUpdate()
|
||||||
{
|
{
|
||||||
this->tokenBucketUpdate(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMappingComponent::tokenBucketUpdate(bool markForUpdate)
|
|
||||||
{
|
|
||||||
if (markForUpdate) { this->m_missedRenderedAircraftUpdate = true; }
|
|
||||||
if (!this->m_missedRenderedAircraftUpdate) { return; }
|
|
||||||
if (!this->m_bucket.tryConsume()) { return; }
|
if (!this->m_bucket.tryConsume()) { return; }
|
||||||
|
this->updateRenderedAircraftView(true); // forced update
|
||||||
// update, normally when view is invisible,
|
|
||||||
// but we want an update from time to have some data when user switches to view
|
|
||||||
this->updateRenderedAircraftView(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_settingsChanged()
|
void CMappingComponent::ps_settingsChanged()
|
||||||
|
|||||||
@@ -136,9 +136,6 @@ namespace BlackGui
|
|||||||
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Token bucket based update
|
|
||||||
void tokenBucketUpdate(bool markForUpdate);
|
|
||||||
|
|
||||||
//! Identifier for data send from this component
|
//! Identifier for data send from this component
|
||||||
BlackMisc::CIdentifier mappingIdentifier();
|
BlackMisc::CIdentifier mappingIdentifier();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user