mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Ref T348, if plugin is unloaded, also fire "simulator disconnected". Also change to Qt::QueuedConnection.
Related: Ref T317 Ref T247 Ref T335
This commit is contained in:
@@ -470,6 +470,7 @@ namespace BlackCore
|
||||
|
||||
ISimulatorListener *listener = m_plugins->createListener(simulatorInfo.getIdentifier());
|
||||
if (!listener) { return false; }
|
||||
if (listener->isRunning()) { return true; } // already running
|
||||
|
||||
if (listener->thread() != &m_listenersThread)
|
||||
{
|
||||
@@ -510,7 +511,13 @@ namespace BlackCore
|
||||
{
|
||||
if (!m_simulatorPlugin.first.isUnspecified())
|
||||
{
|
||||
ISimulator *sim = m_simulatorPlugin.second;
|
||||
ISimulator *simulator = m_simulatorPlugin.second;
|
||||
if (simulator->isConnected()) {
|
||||
// we are about to unload an connected simulator
|
||||
this->updateMarkAllAsNotRendered(); // without plugin nothing can be rendered
|
||||
emit this->simulatorStatusChanged(ISimulator::Disconnected);
|
||||
}
|
||||
|
||||
m_simulatorPlugin.second = nullptr;
|
||||
m_simulatorPlugin.first = CSimulatorPluginInfo();
|
||||
|
||||
@@ -518,12 +525,12 @@ namespace BlackCore
|
||||
Q_ASSERT(this->getIContextNetwork()->isLocalObject());
|
||||
|
||||
// unload and disconnect
|
||||
if (sim)
|
||||
if (simulator)
|
||||
{
|
||||
// disconnect signals and delete
|
||||
sim->disconnect(this);
|
||||
sim->unload();
|
||||
sim->deleteLater();
|
||||
simulator->disconnect(this);
|
||||
simulator->unload();
|
||||
simulator->deleteLater();
|
||||
emit this->simulatorPluginChanged(CSimulatorPluginInfo());
|
||||
}
|
||||
}
|
||||
@@ -600,6 +607,7 @@ namespace BlackCore
|
||||
if (!status.testFlag(ISimulator::Connected))
|
||||
{
|
||||
// we got disconnected, plugin no longer needed
|
||||
this->updateMarkAllAsNotRendered(); // without plugin nothing can be rendered
|
||||
this->unloadSimulatorPlugin();
|
||||
this->restoreSimulatorPlugins();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackGui
|
||||
CSimulatorInfo simulator = CSimulatorInfo(CSimulatorInfo::P3D); // default
|
||||
if (sGui->getIContextSimulator())
|
||||
{
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CAircraftModelStringCompleter::onSimulatorConnected);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CAircraftModelStringCompleter::onSimulatorConnected, Qt::QueuedConnection);
|
||||
CSimulatorInfo pluginSimulator = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulator();
|
||||
if (pluginSimulator.isSingleSimulator())
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
||||
if (sGui->getIContextSimulator())
|
||||
{
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::onSimulatorStatusChanged);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CInfoBarStatusComponent::onMapperReady);
|
||||
connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarStatusComponent::onInternetAccessibleChanged);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BlackGui
|
||||
this->addOrUpdateLiveDataByName("info", "no data yet", CIcons::StandardIconWarning16);
|
||||
|
||||
// connects
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CSimulatorComponent::onSimulatorStatusChanged);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CSimulatorComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
|
||||
connect(&m_updateTimer, &QTimer::timeout, this, &CSimulatorComponent::update);
|
||||
connect(ui->pb_RefreshInternals, &QPushButton::pressed, this, &CSimulatorComponent::refreshInternals);
|
||||
if (sGui->supportsContexts() && sGui->getIContextSimulator())
|
||||
|
||||
@@ -27,8 +27,7 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
configureLoginModes();
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged,
|
||||
this, &CLoginModeButtons::configureLoginModes);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CLoginModeButtons::configureLoginModes, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
CLoginModeButtons::~CLoginModeButtons()
|
||||
|
||||
Reference in New Issue
Block a user