mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 01:35:45 +08:00
@@ -22,7 +22,7 @@ namespace BlackCore
|
|||||||
m_simulator(nullptr), m_updateTimer(nullptr)
|
m_simulator(nullptr), m_updateTimer(nullptr)
|
||||||
{
|
{
|
||||||
m_updateTimer = new QTimer(this);
|
m_updateTimer = new QTimer(this);
|
||||||
loadPlugins();
|
findSimulatorPlugins();
|
||||||
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
||||||
connectTo();
|
connectTo();
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ namespace BlackCore
|
|||||||
emit connectionChanged(value);
|
emit connectionChanged(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulator::loadPlugins()
|
void CContextSimulator::findSimulatorPlugins()
|
||||||
{
|
{
|
||||||
m_pluginsDir = QDir(qApp->applicationDirPath().append("/plugins/simulator"));
|
m_pluginsDir = QDir(qApp->applicationDirPath().append("/plugins/simulator"));
|
||||||
if (!m_pluginsDir.exists())
|
if (!m_pluginsDir.exists())
|
||||||
@@ -107,9 +107,9 @@ namespace BlackCore
|
|||||||
ISimulatorFactory *factory = qobject_cast<ISimulatorFactory *>(plugin);
|
ISimulatorFactory *factory = qobject_cast<ISimulatorFactory *>(plugin);
|
||||||
if (factory)
|
if (factory)
|
||||||
{
|
{
|
||||||
m_simulator = factory->create(this);
|
CSimulatorInfo simulatorInfo = factory->getSimulatorInfo();
|
||||||
connect(m_simulator, SIGNAL(connectionChanged(bool)), this, SLOT(setConnectionStatus(bool)));
|
qDebug() << "Found simulator plugin: " << simulatorInfo.toQString();
|
||||||
qDebug() << "Simulator plugin:" << m_simulator->getSimulatorInfo().toQString();
|
m_simulatorFactories.insert(factory);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,16 +68,14 @@ namespace BlackCore
|
|||||||
void setConnectionStatus(bool value);
|
void setConnectionStatus(bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*!
|
//! \brief find and catalog all simulator plugins
|
||||||
* \brief Load any kind of plugins
|
void findSimulatorPlugins();
|
||||||
* \todo Currently it goes through the plugins folder and creates an instance for any plugin it may find
|
|
||||||
* In case an FSX and an X-Plane are in that folder, m_simulator will always point to X-Plane in the end.
|
|
||||||
*/
|
|
||||||
void loadPlugins();
|
|
||||||
BlackMisc::Aviation::CAircraft m_ownAircraft;
|
BlackMisc::Aviation::CAircraft m_ownAircraft;
|
||||||
BlackCore::ISimulator *m_simulator;
|
BlackCore::ISimulator *m_simulator;
|
||||||
QTimer *m_updateTimer;
|
QTimer *m_updateTimer;
|
||||||
QDir m_pluginsDir;
|
QDir m_pluginsDir;
|
||||||
|
QSet<ISimulatorFactory*> m_simulatorFactories;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BlackCore
|
} // namespace BlackCore
|
||||||
|
|||||||
Reference in New Issue
Block a user