15 namespace swift::misc::simulation::xplane
22 else { m_dbusMode =
"p2p"; }
41 if (!path.isEmpty()) {
writeTo(path); }
47 if (!path.isEmpty()) {
writeTo(path); }
53 if (!path.isEmpty()) {
writeTo(path); }
61 QString configFilePath = filePath +
"/xswiftbus.conf";
62 QFile configFile(configFilePath);
64 if (configFile.open(QIODevice::WriteOnly))
67 QTextStream ts(&configFile);
68 ts <<
"# DBus Mode - Options: p2p, session" << Qt::endl;
69 ts <<
"dbusMode = " << m_dbusMode << Qt::endl;
71 ts <<
"# DBus server address - relevant for P2P mode only" << Qt::endl;
72 ts <<
"dbusAddress = " << m_dbusAddress << Qt::endl;
74 ts <<
"# DBus server port - relevant for P2P mode only" << Qt::endl;
75 ts <<
"dbusPort = " << m_dbusPort << Qt::endl;
77 ts <<
"# Render phase debugging - to help diagnose crashes" << Qt::endl;
78 ts <<
"debug = " <<
boolToOnOff(m_debug) << Qt::endl;
80 ts <<
"# TCAS traffic - to disable in case of crashes" << Qt::endl;
85 ts <<
"# Updated by CXSwiftBusConfigWriter " << QDateTime::currentDateTimeUtc().toString(
"yyyyMMddHHmmss")
static bool dBusAddressToHostAndPort(const QString &dbusAddress, QString &o_host, int &o_port)
Extract host and port from a DBus address.
static bool isSessionOrSystemAddress(const QString &address)
True if address is session or system bus address.
static QString xswiftbusPluginDir(const QString &xplaneRootDir=CXPlaneUtil::xplaneRootDir())
xswiftbus plugin directory
static QString xplane11Dir()
XPlane 11 directory.
static QString xplane10Dir()
XPlane 10 directory.
static QString xplane9Dir()
XPlane 9 directory.
void updateInAllXPlaneVersions()
Update xswiftbus.conf in all known X-Plane versions (XP9 - XP11 are supported)
void writeTo(const QString &filePath)
Write new xswiftbus.conf to filePath. Existing files are removed.
void updateInXPlane10()
Update xswiftbus.conf in X-Plane 10.
void setTcasEnabled(bool on)
Set TCAS on/off.
void updateInXPlane9()
Update xswiftbus.conf in X-Plane 9.
void setDebugMode(bool on)
Set debug on/off.
void setDBusAddress(const QString &dBusAddress)
Set new DBus address.
CXSwiftBusConfigWriter(QObject *parent=nullptr)
Default constructor.
void updateInXPlane11()
Update xswiftbus.conf in X-Plane 11.
SWIFT_MISC_EXPORT const QString & boolToOnOff(bool v)
Bool to on/off.