mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
@@ -22,7 +22,7 @@ namespace BlackCore
|
||||
m_simulator(nullptr), m_updateTimer(nullptr)
|
||||
{
|
||||
m_updateTimer = new QTimer(this);
|
||||
loadPlugins();
|
||||
findSimulatorPlugins();
|
||||
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
||||
connectTo();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace BlackCore
|
||||
emit connectionChanged(value);
|
||||
}
|
||||
|
||||
void CContextSimulator::loadPlugins()
|
||||
void CContextSimulator::findSimulatorPlugins()
|
||||
{
|
||||
m_pluginsDir = QDir(qApp->applicationDirPath().append("/plugins/simulator"));
|
||||
if (!m_pluginsDir.exists())
|
||||
@@ -107,9 +107,9 @@ namespace BlackCore
|
||||
ISimulatorFactory *factory = qobject_cast<ISimulatorFactory *>(plugin);
|
||||
if (factory)
|
||||
{
|
||||
m_simulator = factory->create(this);
|
||||
connect(m_simulator, SIGNAL(connectionChanged(bool)), this, SLOT(setConnectionStatus(bool)));
|
||||
qDebug() << "Simulator plugin:" << m_simulator->getSimulatorInfo().toQString();
|
||||
CSimulatorInfo simulatorInfo = factory->getSimulatorInfo();
|
||||
qDebug() << "Found simulator plugin: " << simulatorInfo.toQString();
|
||||
m_simulatorFactories.insert(factory);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,16 +68,14 @@ namespace BlackCore
|
||||
void setConnectionStatus(bool value);
|
||||
|
||||
private:
|
||||
/*!
|
||||
* \brief Load any kind of plugins
|
||||
* \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();
|
||||
//! \brief find and catalog all simulator plugins
|
||||
void findSimulatorPlugins();
|
||||
|
||||
BlackMisc::Aviation::CAircraft m_ownAircraft;
|
||||
BlackCore::ISimulator *m_simulator;
|
||||
QTimer *m_updateTimer;
|
||||
QDir m_pluginsDir;
|
||||
QSet<ISimulatorFactory*> m_simulatorFactories;
|
||||
};
|
||||
|
||||
} // namespace BlackCore
|
||||
|
||||
Reference in New Issue
Block a user