mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
[feature][XPlane] Set own aircraft model string when own aircraft changes.
Summary: Refactored parts of CAircraftModelLoaderXPlane::parseFlyableAirplanes into static method extractAcfProperties that can be called by xswiftbus. Used extractAcfProperties in xswiftbus to provide the model string to the driver. Implemented CSimulatorXPlane::ps_emitOwnAircraftModelChanged. Implements T74. Reviewers: rwinklmeier Reviewed By: rwinklmeier Subscribers: jenkins Tags: #swift_pilot_client Differential Revision: https://dev.swift-project.org/D23
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "service.h"
|
||||
#include "blackmisc/simulation/xplane/aircraftmodelloaderxplane.h"
|
||||
#include <XPLM/XPLMPlanes.h>
|
||||
#include <XPLM/XPLMUtilities.h>
|
||||
#include <QDebug>
|
||||
@@ -31,7 +32,9 @@ namespace XSwiftBus
|
||||
char filename[256];
|
||||
char path[512];
|
||||
XPLMGetNthAircraftModel(XPLM_USER_AIRCRAFT, filename, path);
|
||||
emit aircraftModelChanged(path, filename, getAircraftLivery(), getAircraftIcaoCode());
|
||||
const auto model = BlackMisc::Simulation::XPlane::CAircraftModelLoaderXPlane::extractAcfProperties(path, QFileInfo(path));
|
||||
emit aircraftModelChanged(path, filename, getAircraftLivery(), getAircraftIcaoCode(),
|
||||
model.getModelString(), model.getName(), model.getDistributor().getDescription(), getAircraftDescription());
|
||||
}
|
||||
|
||||
void CService::addTextMessage(const QString &text, double red, double green, double blue)
|
||||
|
||||
@@ -70,7 +70,8 @@ namespace XSwiftBus
|
||||
|
||||
signals:
|
||||
//! Emitted when the model or livery changes.
|
||||
void aircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao);
|
||||
void aircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao,
|
||||
const QString &modelString, const QString &name, const QString &distributor, const QString &description);
|
||||
|
||||
//! Airports in range updated.
|
||||
void airportsInRangeUpdated(const QStringList &icaoCodes, const QStringList &names, const QDoubleList &lats, const QDoubleList &lons, const QDoubleList &alts);
|
||||
@@ -94,6 +95,9 @@ namespace XSwiftBus
|
||||
//! Get the ICAO code of the current aircraft model
|
||||
QString getAircraftIcaoCode() const { return m_icao.get().c_str(); }
|
||||
|
||||
//! Get the description of the current aircraft model
|
||||
QString getAircraftDescription() const { return m_descrip.get().c_str(); }
|
||||
|
||||
//! Get major version number
|
||||
int getXPlaneVersionMajor() const;
|
||||
|
||||
@@ -233,6 +237,7 @@ namespace XSwiftBus
|
||||
|
||||
StringDataRef<xplane::data::sim::aircraft::view::acf_livery_path> m_liveryPath;
|
||||
StringDataRef<xplane::data::sim::aircraft::view::acf_ICAO> m_icao;
|
||||
StringDataRef<xplane::data::sim::aircraft::view::acf_descrip> m_descrip;
|
||||
DataRef<xplane::data::sim::time::paused> m_paused;
|
||||
DataRef<xplane::data::sim::time::use_system_time> m_useSystemTime;
|
||||
DataRef<xplane::data::sim::flightmodel::position::latitude> m_latitude;
|
||||
|
||||
Reference in New Issue
Block a user