mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Mapping component, set simulator selector when simulator is connected
This commit is contained in:
@@ -132,6 +132,7 @@ namespace BlackGui
|
|||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::airspaceSnapshotHandled, this, &CMappingComponent::tokenBucketUpdate, Qt::QueuedConnection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::airspaceSnapshotHandled, this, &CMappingComponent::tokenBucketUpdate, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::addingRemoteModelFailed, this, &CMappingComponent::onAddingRemoteAircraftFailed, Qt::QueuedConnection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::addingRemoteModelFailed, this, &CMappingComponent::onAddingRemoteAircraftFailed, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CMappingComponent::onSimulatorPluginChanged, Qt::QueuedConnection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CMappingComponent::onSimulatorPluginChanged, Qt::QueuedConnection);
|
||||||
|
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CMappingComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::onRemoteAircraftModelChanged, Qt::QueuedConnection);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::onRemoteAircraftModelChanged, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftEnabled, this, &CMappingComponent::tokenBucketUpdateAircraft, Qt::QueuedConnection);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftEnabled, this, &CMappingComponent::tokenBucketUpdateAircraft, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedFastPositionUpdates, this, &CMappingComponent::tokenBucketUpdateAircraft, Qt::QueuedConnection);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::changedFastPositionUpdates, this, &CMappingComponent::tokenBucketUpdateAircraft, Qt::QueuedConnection);
|
||||||
@@ -149,7 +150,7 @@ namespace BlackGui
|
|||||||
QPointer<CMappingComponent> myself(this);
|
QPointer<CMappingComponent> myself(this);
|
||||||
QTimer::singleShot(10000, this, [ = ]
|
QTimer::singleShot(10000, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!myself) { return; }
|
if (!myself || !sGui || sGui->isShuttingDown()) { return; }
|
||||||
const CSimulatorInfo simulator(myself->getConnectedOrSelectedSimulator());
|
const CSimulatorInfo simulator(myself->getConnectedOrSelectedSimulator());
|
||||||
myself->onModelSetSimulatorChanged(simulator);
|
myself->onModelSetSimulatorChanged(simulator);
|
||||||
myself->onModelSetChanged(simulator);
|
myself->onModelSetChanged(simulator);
|
||||||
@@ -185,7 +186,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CMappingComponent::onModelSetChanged(const CSimulatorInfo &dummy)
|
void CMappingComponent::onModelSetChanged(const CSimulatorInfo &dummy)
|
||||||
{
|
{
|
||||||
// change model set, which can be any model set
|
// changed model set, which can be any model set
|
||||||
Q_UNUSED(dummy); // we do not use the passed simulator
|
Q_UNUSED(dummy); // we do not use the passed simulator
|
||||||
|
|
||||||
const CSimulatorInfo simulator(ui->comp_SimulatorSelector->getValue()); // UI value
|
const CSimulatorInfo simulator(ui->comp_SimulatorSelector->getValue()); // UI value
|
||||||
@@ -295,6 +296,17 @@ namespace BlackGui
|
|||||||
ui->comp_SimulatorSelector->setToConnectedSimulator(50);
|
ui->comp_SimulatorSelector->setToConnectedSimulator(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::onSimulatorStatusChanged(int status)
|
||||||
|
{
|
||||||
|
const ISimulator::SimulatorStatus simStatus = static_cast<ISimulator::SimulatorStatus>(status);
|
||||||
|
|
||||||
|
// make sure the selector represents connected simulator
|
||||||
|
if (simStatus.testFlag(ISimulator::Connected) && sGui && sGui->getIContextSimulator())
|
||||||
|
{
|
||||||
|
ui->comp_SimulatorSelector->setToConnectedSimulator(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CMappingComponent::doMatchingsAgain()
|
void CMappingComponent::doMatchingsAgain()
|
||||||
{
|
{
|
||||||
if (!sGui || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; }
|
if (!sGui || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; }
|
||||||
|
|||||||
@@ -167,13 +167,16 @@ namespace BlackGui
|
|||||||
//! Plugin info has been changed
|
//! Plugin info has been changed
|
||||||
void onSimulatorPluginChanged(const BlackMisc::Simulation::CSimulatorPluginInfo &pluginInfo);
|
void onSimulatorPluginChanged(const BlackMisc::Simulation::CSimulatorPluginInfo &pluginInfo);
|
||||||
|
|
||||||
|
//! Simulator connected
|
||||||
|
void onSimulatorStatusChanged(int status);
|
||||||
|
|
||||||
//! Do re-matching
|
//! Do re-matching
|
||||||
void doMatchingsAgain();
|
void doMatchingsAgain();
|
||||||
|
|
||||||
static constexpr int OverlayMessageMs = 5000;
|
static constexpr int OverlayMessageMs = 5000;
|
||||||
QScopedPointer<Ui::CMappingComponent> ui;
|
QScopedPointer<Ui::CMappingComponent> ui;
|
||||||
bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update
|
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
|
bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update
|
||||||
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
||||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settings { this, &CMappingComponent::settingsChanged }; //!< settings changed
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settings { this, &CMappingComponent::settingsChanged }; //!< settings changed
|
||||||
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
||||||
|
|||||||
Reference in New Issue
Block a user