mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +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());
|
ISimulatorListener *listener = m_plugins->createListener(simulatorInfo.getIdentifier());
|
||||||
if (!listener) { return false; }
|
if (!listener) { return false; }
|
||||||
|
if (listener->isRunning()) { return true; } // already running
|
||||||
|
|
||||||
if (listener->thread() != &m_listenersThread)
|
if (listener->thread() != &m_listenersThread)
|
||||||
{
|
{
|
||||||
@@ -510,7 +511,13 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (!m_simulatorPlugin.first.isUnspecified())
|
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.second = nullptr;
|
||||||
m_simulatorPlugin.first = CSimulatorPluginInfo();
|
m_simulatorPlugin.first = CSimulatorPluginInfo();
|
||||||
|
|
||||||
@@ -518,12 +525,12 @@ namespace BlackCore
|
|||||||
Q_ASSERT(this->getIContextNetwork()->isLocalObject());
|
Q_ASSERT(this->getIContextNetwork()->isLocalObject());
|
||||||
|
|
||||||
// unload and disconnect
|
// unload and disconnect
|
||||||
if (sim)
|
if (simulator)
|
||||||
{
|
{
|
||||||
// disconnect signals and delete
|
// disconnect signals and delete
|
||||||
sim->disconnect(this);
|
simulator->disconnect(this);
|
||||||
sim->unload();
|
simulator->unload();
|
||||||
sim->deleteLater();
|
simulator->deleteLater();
|
||||||
emit this->simulatorPluginChanged(CSimulatorPluginInfo());
|
emit this->simulatorPluginChanged(CSimulatorPluginInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -600,6 +607,7 @@ namespace BlackCore
|
|||||||
if (!status.testFlag(ISimulator::Connected))
|
if (!status.testFlag(ISimulator::Connected))
|
||||||
{
|
{
|
||||||
// we got disconnected, plugin no longer needed
|
// we got disconnected, plugin no longer needed
|
||||||
|
this->updateMarkAllAsNotRendered(); // without plugin nothing can be rendered
|
||||||
this->unloadSimulatorPlugin();
|
this->unloadSimulatorPlugin();
|
||||||
this->restoreSimulatorPlugins();
|
this->restoreSimulatorPlugins();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace BlackGui
|
|||||||
CSimulatorInfo simulator = CSimulatorInfo(CSimulatorInfo::P3D); // default
|
CSimulatorInfo simulator = CSimulatorInfo(CSimulatorInfo::P3D); // default
|
||||||
if (sGui->getIContextSimulator())
|
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();
|
CSimulatorInfo pluginSimulator = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulator();
|
||||||
if (pluginSimulator.isSingleSimulator())
|
if (pluginSimulator.isSingleSimulator())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
||||||
if (sGui->getIContextSimulator())
|
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->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CInfoBarStatusComponent::onMapperReady);
|
||||||
connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarStatusComponent::onInternetAccessibleChanged);
|
connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarStatusComponent::onInternetAccessibleChanged);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace BlackGui
|
|||||||
this->addOrUpdateLiveDataByName("info", "no data yet", CIcons::StandardIconWarning16);
|
this->addOrUpdateLiveDataByName("info", "no data yet", CIcons::StandardIconWarning16);
|
||||||
|
|
||||||
// connects
|
// 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(&m_updateTimer, &QTimer::timeout, this, &CSimulatorComponent::update);
|
||||||
connect(ui->pb_RefreshInternals, &QPushButton::pressed, this, &CSimulatorComponent::refreshInternals);
|
connect(ui->pb_RefreshInternals, &QPushButton::pressed, this, &CSimulatorComponent::refreshInternals);
|
||||||
if (sGui->supportsContexts() && sGui->getIContextSimulator())
|
if (sGui->supportsContexts() && sGui->getIContextSimulator())
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
configureLoginModes();
|
configureLoginModes();
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged,
|
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CLoginModeButtons::configureLoginModes, Qt::QueuedConnection);
|
||||||
this, &CLoginModeButtons::configureLoginModes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLoginModeButtons::~CLoginModeButtons()
|
CLoginModeButtons::~CLoginModeButtons()
|
||||||
|
|||||||
Reference in New Issue
Block a user