4 #include "xswiftbussettingsqtfree.h"
9 #include "nlohmann/json.hpp"
12 #pragma GCC diagnostic push
13 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
16 using namespace swift::misc::simulation::settings;
17 using namespace swift::misc::simulation::xplane;
42 if (json.empty()) {
return false; }
44 const nlohmann::basic_json parsed = nlohmann::json::parse(json,
nullptr,
false);
46 if (parsed.is_discarded()) {
return false; }
101 this->objectUpdated();
110 json[JsonDBusServerAddress] = m_dBusServerAddress;
111 json[JsonNightTextureMode] = m_nightTextureMode;
112 json[JsonMessageBox] = m_msgBox;
113 json[JsonMaxPlanes] = m_maxPlanes;
114 json[JsonMaxDrawDistance] = m_maxDrawDistanceNM;
115 json[JsonTimestamp] = m_msSinceEpochQtFree;
116 json[JsonDrawingLabels] = m_drawingLabels;
117 json[JsonLabelColor] = m_labelColor;
118 json[JsonBundleTaxiLandingLights] = m_bundleTaxiLandingLights;
119 json[JsonFollowAircraftDistanceM] = m_followAircraftDistanceM;
120 json[JsonLogRenderPhases] = m_logRenderPhases;
121 json[JsonTcas] = m_tcasEnabled;
122 json[JsonTerrainProbe] = m_terrainProbeEnabled;
129 return "DBusServer: " + m_dBusServerAddress +
130 ", drawLabels: " + qtfreeutils::boolToYesNo(m_drawingLabels) +
131 ", labelColor: " + std::to_string((m_labelColor >> 16) & 0xff) +
132 ";" + std::to_string((m_labelColor >> 8) & 0xff) +
133 ";" + std::to_string(m_labelColor & 0xff) +
134 ", bundle lights: " + qtfreeutils::boolToYesNo(m_bundleTaxiLandingLights) +
135 ", phases: " + qtfreeutils::boolToYesNo(m_logRenderPhases) +
136 ", TCAS: " + qtfreeutils::boolToYesNo(m_tcasEnabled) +
137 ", terr.probe: " + qtfreeutils::boolToYesNo(m_terrainProbeEnabled) +
138 ", night t.: " + m_nightTextureMode +
139 ", max planes: " + std::to_string(m_maxPlanes) +
140 ", max distance NM: " + std::to_string(m_maxDrawDistanceNM) +
141 ", follow dist m: " + std::to_string(m_followAircraftDistanceM) +
142 ", msg.box: " + m_msgBox +
143 ", ts: " + std::to_string(m_msSinceEpochQtFree);
150 if (m_msgBox != newValues.
m_msgBox) { m_msgBox = newValues.
m_msgBox; changed++; }
163 if (changed > 0) { this->objectUpdated(); }
172 #pragma GCC diagnostic pop
xswiftbus/swift side settings class, JSON capable, shared among all services
static constexpr char JsonBundleTaxiLandingLights[]
The JSON members.
static constexpr char JsonTerrainProbe[]
The JSON members.
int update(const CXSwiftBusSettingsQtFree &newValues)
Update only changed values.
int m_followAircraftDistanceM
follow aircraft in distance
static constexpr char JsonTcas[]
The JSON members.
static constexpr char JsonTimestamp[]
The JSON members.
static constexpr char JsonMaxPlanes[]
The JSON members.
int64_t m_msSinceEpochQtFree
timestamp
static constexpr char JsonLogRenderPhases[]
The JSON members.
static constexpr char JsonLabelColor[]
The JSON members.
static constexpr char JsonMessageBox[]
The JSON members.
int m_labelColor
labels in XPlane
static constexpr char JsonFollowAircraftDistanceM[]
The JSON members.
std::string m_dBusServerAddress
DBus server (also in class CXSwiftBusConfigWriter)
static constexpr char JsonDBusServerAddress[]
The JSON members.
std::string m_nightTextureMode
night texture mode
std::string m_msgBox
left, top, right, bottom, lines, duration, colors
bool m_bundleTaxiLandingLights
bundle taxi and landing lights
bool m_logRenderPhases
render phases debug messages
bool m_tcasEnabled
TCAS functionality.
std::string convertToString() const
Convert to string.
static constexpr char JsonNightTextureMode[]
The JSON members.
static constexpr char JsonDrawingLabels[]
The JSON members.
bool m_terrainProbeEnabled
terrain probe to establish ground elevation
double m_maxDrawDistanceNM
distance in XPlane
std::string toXSwiftBusJsonString() const
As JSON string.
static constexpr char JsonMaxDrawDistance[]
The JSON members.
bool parseXSwiftBusString(const std::string &json)
Load and parse config file.
bool m_drawingLabels
labels in XPlane
Free functions in swift::misc.