mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 22:29:13 +08:00
refactor: Format inc files
This commit is contained in:
@@ -8,7 +8,8 @@ import subprocess
|
|||||||
|
|
||||||
|
|
||||||
def should_file_formatted(file) -> bool:
|
def should_file_formatted(file) -> bool:
|
||||||
return file.endswith(".cpp") or file.endswith(".h")
|
excluded_filenames = ["datarefs.inc"]
|
||||||
|
return file not in excluded_filenames and (file.endswith(".cpp") or file.endswith(".h") or file.endswith(".inc"))
|
||||||
|
|
||||||
|
|
||||||
def get_formattable_files(folder_name):
|
def get_formattable_files(folder_name):
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ namespace swift::config
|
|||||||
{
|
{
|
||||||
constexpr bool CBuildConfig::isCompiledWithMsFlightSimulatorSupport()
|
constexpr bool CBuildConfig::isCompiledWithMsFlightSimulatorSupport()
|
||||||
{
|
{
|
||||||
return CBuildConfig::isCompiledWithFs9Support() || CBuildConfig::isCompiledWithFsxSupport() || CBuildConfig::isCompiledWithP3DSupport() || isCompiledWithMSFSSupport() || isCompiledWithMSFS2024Support();
|
return CBuildConfig::isCompiledWithFs9Support() || CBuildConfig::isCompiledWithFsxSupport() ||
|
||||||
|
CBuildConfig::isCompiledWithP3DSupport() || isCompiledWithMSFSSupport() ||
|
||||||
|
isCompiledWithMSFS2024Support();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool CBuildConfig::isRunningOnWindowsNtPlatform()
|
constexpr bool CBuildConfig::isRunningOnWindowsNtPlatform()
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
|
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||||
|
|
||||||
#include "xswiftbussettingsqtfree.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
|
|
||||||
|
#include "xswiftbussettingsqtfree.h"
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic push
|
# pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace swift::misc::simulation::settings;
|
using namespace swift::misc::simulation::settings;
|
||||||
@@ -46,57 +46,85 @@ namespace swift::misc
|
|||||||
if (parsed.is_discarded()) { return false; }
|
if (parsed.is_discarded()) { return false; }
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDBusServerAddress) && parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].is_string())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDBusServerAddress) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].is_string())
|
||||||
{
|
{
|
||||||
m_dBusServerAddress = parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].get<std::string>(); c++;
|
m_dBusServerAddress = parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].get<std::string>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMessageBox) && parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].is_string())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMessageBox) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].is_string())
|
||||||
{
|
{
|
||||||
m_msgBox = parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].get<std::string>(); c++;
|
m_msgBox = parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].get<std::string>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonNightTextureMode) && parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].is_string())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonNightTextureMode) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].is_string())
|
||||||
{
|
{
|
||||||
m_nightTextureMode = parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].get<std::string>(); c++;
|
m_nightTextureMode = parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].get<std::string>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDrawingLabels) && parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].is_boolean())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDrawingLabels) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].is_boolean())
|
||||||
{
|
{
|
||||||
m_drawingLabels = parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].get<bool>(); c++;
|
m_drawingLabels = parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].get<bool>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLabelColor) && parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].is_number_integer())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLabelColor) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].is_number_integer())
|
||||||
{
|
{
|
||||||
m_labelColor = parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].get<int>(); c++;
|
m_labelColor = parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].get<int>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights) && parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].is_boolean())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].is_boolean())
|
||||||
{
|
{
|
||||||
m_bundleTaxiLandingLights = parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].get<bool>(); c++;
|
m_bundleTaxiLandingLights =
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].get<bool>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTcas) && parsed[CXSwiftBusSettingsQtFree::JsonTcas].is_boolean())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTcas) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonTcas].is_boolean())
|
||||||
{
|
{
|
||||||
m_tcasEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTcas].get<bool>(); c++;
|
m_tcasEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTcas].get<bool>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTerrainProbe) && parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].is_boolean())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTerrainProbe) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].is_boolean())
|
||||||
{
|
{
|
||||||
m_terrainProbeEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].get<bool>(); c++;
|
m_terrainProbeEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].get<bool>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLogRenderPhases) && parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].is_boolean())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLogRenderPhases) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].is_boolean())
|
||||||
{
|
{
|
||||||
m_logRenderPhases = parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].get<bool>(); c++;
|
m_logRenderPhases = parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].get<bool>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxPlanes) && parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].is_number_integer())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxPlanes) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].is_number_integer())
|
||||||
{
|
{
|
||||||
m_maxPlanes = parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].get<int>(); c++;
|
m_maxPlanes = parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].get<int>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxDrawDistance) && parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].is_number_float())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxDrawDistance) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].is_number_float())
|
||||||
{
|
{
|
||||||
m_maxDrawDistanceNM = parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].get<double>(); c++;
|
m_maxDrawDistanceNM = parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].get<double>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM) && parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].is_number_integer())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].is_number_integer())
|
||||||
{
|
{
|
||||||
m_followAircraftDistanceM = parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].get<int>(); c++;
|
m_followAircraftDistanceM =
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].get<int>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTimestamp) && parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].is_number_integer())
|
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTimestamp) &&
|
||||||
|
parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].is_number_integer())
|
||||||
{
|
{
|
||||||
m_msSinceEpochQtFree = parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].get<int64_t>(); c++;
|
m_msSinceEpochQtFree = parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].get<int64_t>();
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
this->objectUpdated(); // post processing
|
this->objectUpdated(); // post processing
|
||||||
return c == 13;
|
return c == 13;
|
||||||
@@ -106,7 +134,6 @@ namespace swift::misc
|
|||||||
{
|
{
|
||||||
nlohmann::json json;
|
nlohmann::json json;
|
||||||
|
|
||||||
|
|
||||||
json[JsonDBusServerAddress] = m_dBusServerAddress;
|
json[JsonDBusServerAddress] = m_dBusServerAddress;
|
||||||
json[JsonNightTextureMode] = m_nightTextureMode;
|
json[JsonNightTextureMode] = m_nightTextureMode;
|
||||||
json[JsonMessageBox] = m_msgBox;
|
json[JsonMessageBox] = m_msgBox;
|
||||||
@@ -127,47 +154,96 @@ namespace swift::misc
|
|||||||
std::string CXSwiftBusSettingsQtFree::convertToString() const
|
std::string CXSwiftBusSettingsQtFree::convertToString() const
|
||||||
{
|
{
|
||||||
return "DBusServer: " + m_dBusServerAddress +
|
return "DBusServer: " + m_dBusServerAddress +
|
||||||
", drawLabels: " + qtfreeutils::boolToYesNo(m_drawingLabels) +
|
", drawLabels: " + qtfreeutils::boolToYesNo(m_drawingLabels) +
|
||||||
", labelColor: " + std::to_string((m_labelColor >> 16) & 0xff) +
|
", labelColor: " + std::to_string((m_labelColor >> 16) & 0xff) + ";" +
|
||||||
";" + std::to_string((m_labelColor >> 8) & 0xff) +
|
std::to_string((m_labelColor >> 8) & 0xff) + ";" + std::to_string(m_labelColor & 0xff) +
|
||||||
";" + std::to_string(m_labelColor & 0xff) +
|
", bundle lights: " + qtfreeutils::boolToYesNo(m_bundleTaxiLandingLights) +
|
||||||
", bundle lights: " + qtfreeutils::boolToYesNo(m_bundleTaxiLandingLights) +
|
", phases: " + qtfreeutils::boolToYesNo(m_logRenderPhases) +
|
||||||
", phases: " + qtfreeutils::boolToYesNo(m_logRenderPhases) +
|
", TCAS: " + qtfreeutils::boolToYesNo(m_tcasEnabled) +
|
||||||
", TCAS: " + qtfreeutils::boolToYesNo(m_tcasEnabled) +
|
", terr.probe: " + qtfreeutils::boolToYesNo(m_terrainProbeEnabled) +
|
||||||
", terr.probe: " + qtfreeutils::boolToYesNo(m_terrainProbeEnabled) +
|
", night t.: " + m_nightTextureMode + ", max planes: " + std::to_string(m_maxPlanes) +
|
||||||
", night t.: " + m_nightTextureMode +
|
|
||||||
", max planes: " + std::to_string(m_maxPlanes) +
|
|
||||||
", max distance NM: " + std::to_string(m_maxDrawDistanceNM) +
|
", max distance NM: " + std::to_string(m_maxDrawDistanceNM) +
|
||||||
", follow dist m: " + std::to_string(m_followAircraftDistanceM) +
|
", follow dist m: " + std::to_string(m_followAircraftDistanceM) + ", msg.box: " + m_msgBox +
|
||||||
", msg.box: " + m_msgBox +
|
", ts: " + std::to_string(m_msSinceEpochQtFree);
|
||||||
", ts: " + std::to_string(m_msSinceEpochQtFree);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CXSwiftBusSettingsQtFree::update(const CXSwiftBusSettingsQtFree &newValues)
|
int CXSwiftBusSettingsQtFree::update(const CXSwiftBusSettingsQtFree &newValues)
|
||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
if (m_dBusServerAddress != newValues.m_dBusServerAddress) { m_dBusServerAddress = newValues.m_dBusServerAddress; changed++; }
|
if (m_dBusServerAddress != newValues.m_dBusServerAddress)
|
||||||
if (m_msgBox != newValues.m_msgBox) { m_msgBox = newValues.m_msgBox; changed++; }
|
{
|
||||||
if (m_drawingLabels != newValues.m_drawingLabels) { m_drawingLabels = newValues.m_drawingLabels; changed++; }
|
m_dBusServerAddress = newValues.m_dBusServerAddress;
|
||||||
if (m_labelColor != newValues.m_labelColor) { m_labelColor = newValues.m_labelColor; changed++; }
|
changed++;
|
||||||
if (m_nightTextureMode != newValues.m_nightTextureMode) { m_nightTextureMode = newValues.m_nightTextureMode; changed++; }
|
}
|
||||||
if (m_logRenderPhases != newValues.m_logRenderPhases) { m_logRenderPhases = newValues.m_logRenderPhases; changed++; }
|
if (m_msgBox != newValues.m_msgBox)
|
||||||
if (m_tcasEnabled != newValues.m_tcasEnabled) { m_tcasEnabled = newValues.m_tcasEnabled; changed++; }
|
{
|
||||||
if (m_terrainProbeEnabled != newValues.m_terrainProbeEnabled) { m_terrainProbeEnabled = newValues.m_terrainProbeEnabled; changed++; }
|
m_msgBox = newValues.m_msgBox;
|
||||||
if (m_maxPlanes != newValues.m_maxPlanes) { m_maxPlanes = newValues.m_maxPlanes; changed++; }
|
changed++;
|
||||||
if (m_msSinceEpochQtFree != newValues.m_msSinceEpochQtFree) { m_msSinceEpochQtFree = newValues.m_msSinceEpochQtFree; changed++; }
|
}
|
||||||
if (m_bundleTaxiLandingLights != newValues.m_bundleTaxiLandingLights) { m_bundleTaxiLandingLights = newValues.m_bundleTaxiLandingLights; changed++; }
|
if (m_drawingLabels != newValues.m_drawingLabels)
|
||||||
if (m_followAircraftDistanceM != newValues.m_followAircraftDistanceM) { m_followAircraftDistanceM = newValues.m_followAircraftDistanceM; changed++; }
|
{
|
||||||
if (!qtfreeutils::isFuzzyEqual(m_maxDrawDistanceNM, newValues.m_maxDrawDistanceNM)) { m_maxDrawDistanceNM = newValues.m_maxDrawDistanceNM; changed++; }
|
m_drawingLabels = newValues.m_drawingLabels;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_labelColor != newValues.m_labelColor)
|
||||||
|
{
|
||||||
|
m_labelColor = newValues.m_labelColor;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_nightTextureMode != newValues.m_nightTextureMode)
|
||||||
|
{
|
||||||
|
m_nightTextureMode = newValues.m_nightTextureMode;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_logRenderPhases != newValues.m_logRenderPhases)
|
||||||
|
{
|
||||||
|
m_logRenderPhases = newValues.m_logRenderPhases;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_tcasEnabled != newValues.m_tcasEnabled)
|
||||||
|
{
|
||||||
|
m_tcasEnabled = newValues.m_tcasEnabled;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_terrainProbeEnabled != newValues.m_terrainProbeEnabled)
|
||||||
|
{
|
||||||
|
m_terrainProbeEnabled = newValues.m_terrainProbeEnabled;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_maxPlanes != newValues.m_maxPlanes)
|
||||||
|
{
|
||||||
|
m_maxPlanes = newValues.m_maxPlanes;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_msSinceEpochQtFree != newValues.m_msSinceEpochQtFree)
|
||||||
|
{
|
||||||
|
m_msSinceEpochQtFree = newValues.m_msSinceEpochQtFree;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_bundleTaxiLandingLights != newValues.m_bundleTaxiLandingLights)
|
||||||
|
{
|
||||||
|
m_bundleTaxiLandingLights = newValues.m_bundleTaxiLandingLights;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (m_followAircraftDistanceM != newValues.m_followAircraftDistanceM)
|
||||||
|
{
|
||||||
|
m_followAircraftDistanceM = newValues.m_followAircraftDistanceM;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
if (!qtfreeutils::isFuzzyEqual(m_maxDrawDistanceNM, newValues.m_maxDrawDistanceNM))
|
||||||
|
{
|
||||||
|
m_maxDrawDistanceNM = newValues.m_maxDrawDistanceNM;
|
||||||
|
changed++;
|
||||||
|
}
|
||||||
|
|
||||||
if (changed > 0) { this->objectUpdated(); } // post processing
|
if (changed > 0) { this->objectUpdated(); } // post processing
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // namespace settings
|
||||||
} // ns
|
} // namespace simulation
|
||||||
} // ns
|
} // namespace swift::misc
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user