mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Add ISimulatorListener interface
This commit is contained in:
committed by
Roland Winklmeier
parent
95829affe4
commit
adc623f0e7
@@ -113,7 +113,6 @@ namespace BlackSimPlugin
|
||||
virtual bool isRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
private slots:
|
||||
void ps_serviceRegistered(const QString &serviceName);
|
||||
void ps_serviceUnregistered();
|
||||
void ps_setAirportsInRange(const QStringList &icaoCodes, const QStringList &names, const BlackMisc::CSequence<double> &lats, const BlackMisc::CSequence<double> &lons, const BlackMisc::CSequence<double> &alts);
|
||||
void ps_emitOwnAircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao);
|
||||
@@ -172,6 +171,31 @@ namespace BlackSimPlugin
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//! Listener waits for xbus service to show up
|
||||
class CSimulatorXPlaneListener : public BlackCore::ISimulatorListener
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CSimulatorXPlaneListener(QObject* parent);
|
||||
|
||||
//! \copydoc BlackCore::ISimulatorListener::start
|
||||
virtual void start() override;
|
||||
|
||||
//! \copydoc BlackCore::ISimulatorListener::stop
|
||||
virtual void stop() override;
|
||||
|
||||
private slots:
|
||||
void ps_serviceRegistered(const QString &serviceName);
|
||||
|
||||
private:
|
||||
QDBusConnection m_conn { "default" };
|
||||
QDBusServiceWatcher* m_watcher { nullptr };
|
||||
const BlackSim::CSimulatorInfo m_simulatorInfo = BlackSim::CSimulatorInfo::XP();
|
||||
|
||||
};
|
||||
|
||||
//! Factory for creating CSimulatorXPlane instance
|
||||
class CSimulatorXPlaneFactory : public QObject, public BlackCore::ISimulatorFactory
|
||||
@@ -189,6 +213,9 @@ namespace BlackSimPlugin
|
||||
|
||||
//! \copydoc BlackCore::ISimulatorFactory::getSimulatorInfo
|
||||
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const override { return BlackSim::CSimulatorInfo::XP(); }
|
||||
|
||||
//! \copydoc BlackCore::ISimulatorFactory::getListener
|
||||
virtual BlackCore::ISimulatorListener *createListener(QObject *parent = nullptr) override { return new CSimulatorXPlaneListener(parent); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user