diff --git a/src/blackgui/components/coresettingsdialog.ui b/src/blackgui/components/coresettingsdialog.ui index c1412abfc..1d6e70a9f 100644 --- a/src/blackgui/components/coresettingsdialog.ui +++ b/src/blackgui/components/coresettingsdialog.ui @@ -7,13 +7,13 @@ 0 0 350 - 400 + 450 350 - 400 + 450 diff --git a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h index b5ba625f8..2756aa3c4 100644 --- a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h +++ b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h @@ -121,6 +121,18 @@ namespace BlackMisc return true; } + //! Debug messages? + bool isLogRenderPhases() const { return m_logRenderPhases; } + + //! Debug messages? + void setLogRenderPhases(bool log) { m_logRenderPhases = log; } + + //! TCAS functionality? + bool isTcasEnabled() const { return m_tcasEnabled; } + + //! TCAS functionality? + void setTcasEnabled(bool tcas) { m_tcasEnabled = tcas; } + //! Load and parse config file bool parseXSwiftBusString(const std::string &json); @@ -145,6 +157,8 @@ namespace BlackMisc //! The JSON members @{ static constexpr char JsonDBusServerAddress[] = "dbusserveradress"; static constexpr char JsonDrawingLabels[] = "drawinglabels"; + static constexpr char JsonLogRenderPhases[] = "renderPhases"; + static constexpr char JsonTcas[] = "tcas"; static constexpr char JsonMaxPlanes[] = "maxplanes"; static constexpr char JsonMaxDrawDistance[] = "maxDrawDistance"; static constexpr char JsonNightTextureMode[] = "nighttexture"; @@ -157,13 +171,15 @@ namespace BlackMisc //! Object has been updated virtual void objectUpdated() = 0; - std::string m_dBusServerAddress { "tcp:host=127.0.0.1,port=45001" }; //!< DBus server + std::string m_dBusServerAddress { "tcp:host=127.0.0.1,port=45001" }; //!< DBus server (also in class CXSwiftBusConfigWriter) std::string m_nightTextureMode { "auto" }; //!< night texture mode std::string m_msgBox { "20;20;20;-1;5;5000" }; //!< left, top, right, bottom, lines, duration - int m_maxPlanes = 100; //!< max. planes in XPlane + int m_maxPlanes = 100; //!< max. planes in XPlane int m_followAircraftDistanceM = 200; //!< follow aircraft in distance bool m_drawingLabels = true; //!< labels in XPlane bool m_bundleTaxiLandingLights = true; //!< bundle taxi and landing lights + bool m_logRenderPhases = false; //!< render phases debug messages + bool m_tcasEnabled = true; //!< TCAS functionality double m_maxDrawDistanceNM = 50.0; //!< distance in XPlane int64_t m_msSinceEpochQtFree = 0; //!< timestamp }; diff --git a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.hpp b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.hpp index a4cdfa796..a16a2eb53 100644 --- a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.hpp +++ b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.hpp @@ -29,6 +29,8 @@ constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonNi constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonMessageBox[]; constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights[]; constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonTimestamp[]; +constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonTcas[]; +constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonLogRenderPhases[]; //! @endcond namespace BlackMisc @@ -67,6 +69,14 @@ namespace BlackMisc { m_bundleTaxiLandingLights = settingsDoc[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].GetBool(); c++; } + if (settingsDoc.HasMember(CXSwiftBusSettingsQtFree::JsonTcas) && settingsDoc[CXSwiftBusSettingsQtFree::JsonTcas].IsBool()) + { + m_tcasEnabled = settingsDoc[CXSwiftBusSettingsQtFree::JsonTcas].GetBool(); c++; + } + if (settingsDoc.HasMember(CXSwiftBusSettingsQtFree::JsonLogRenderPhases) && settingsDoc[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].IsBool()) + { + m_logRenderPhases = settingsDoc[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].GetBool(); c++; + } if (settingsDoc.HasMember(CXSwiftBusSettingsQtFree::JsonMaxPlanes) && settingsDoc[CXSwiftBusSettingsQtFree::JsonMaxPlanes].IsInt()) { m_maxPlanes = settingsDoc[CXSwiftBusSettingsQtFree::JsonMaxPlanes].GetInt(); c++; @@ -84,7 +94,7 @@ namespace BlackMisc m_msSinceEpochQtFree = settingsDoc[CXSwiftBusSettingsQtFree::JsonTimestamp].GetInt64(); c++; } this->objectUpdated(); // post processing - return c == 9; + return c == 11; } std::string CXSwiftBusSettingsQtFree::toXSwiftBusJsonString() const @@ -97,15 +107,17 @@ namespace BlackMisc Document::AllocatorType &a = document.GetAllocator(); // Value k1(JsonDBusServerAddress, a); // Value v1(m_dBusServerAddress, a); - document.AddMember(JsonDBusServerAddress, StringRef(m_dBusServerAddress.c_str()), a); - document.AddMember(JsonNightTextureMode, StringRef(m_nightTextureMode.c_str()), a); - document.AddMember(JsonMessageBox, StringRef(m_msgBox.c_str()), a); + document.AddMember(JsonDBusServerAddress, StringRef(m_dBusServerAddress.c_str()), a); + document.AddMember(JsonNightTextureMode, StringRef(m_nightTextureMode.c_str()), a); + document.AddMember(JsonMessageBox, StringRef(m_msgBox.c_str()), a); document.AddMember(JsonMaxPlanes, m_maxPlanes, a); - document.AddMember(JsonMaxDrawDistance, m_maxDrawDistanceNM, a); + document.AddMember(JsonMaxDrawDistance, m_maxDrawDistanceNM, a); document.AddMember(JsonTimestamp, m_msSinceEpochQtFree, a); document.AddMember(JsonDrawingLabels, m_drawingLabels, a); document.AddMember(JsonBundleTaxiLandingLights, m_bundleTaxiLandingLights, a); document.AddMember(JsonFollowAircraftDistanceM, m_followAircraftDistanceM, a); + document.AddMember(JsonLogRenderPhases, m_logRenderPhases, a); + document.AddMember(JsonTcas, m_tcasEnabled, a); // document[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].SetString(StringRef(m_dBusServerAddress.c_str(), m_dBusServerAddress.size())); // document[CXSwiftBusSettingsQtFree::JsonDrawingLabels].SetBool(m_drawingLabels); @@ -122,27 +134,31 @@ namespace BlackMisc std::string CXSwiftBusSettingsQtFree::convertToString() const { return "DBusServer: " + m_dBusServerAddress + - ", drawLabels: " + QtFreeUtils::boolToYesNo(m_drawingLabels) + - ", bundle lights: " + QtFreeUtils::boolToYesNo(m_bundleTaxiLandingLights) + - ", night t.: " + m_nightTextureMode + - ", max planes: " + std::to_string(m_maxPlanes) + + ", drawLabels: " + QtFreeUtils::boolToYesNo(m_drawingLabels) + + ", bundle lights: " + QtFreeUtils::boolToYesNo(m_bundleTaxiLandingLights) + + ", phases: " + QtFreeUtils::boolToYesNo(m_logRenderPhases) + + ", TCAS: " + QtFreeUtils::boolToYesNo(m_tcasEnabled) + + ", night t.: " + m_nightTextureMode + + ", max planes: " + std::to_string(m_maxPlanes) + ", max distance NM: " + std::to_string(m_maxDrawDistanceNM) + ", follow dist m: " + std::to_string(m_followAircraftDistanceM) + - ", msg.box: " + m_msgBox + - ", ts: " + std::to_string(m_msSinceEpochQtFree); + ", msg.box: " + m_msgBox + + ", ts: " + std::to_string(m_msSinceEpochQtFree); } int CXSwiftBusSettingsQtFree::update(const CXSwiftBusSettingsQtFree &newValues) { int changed = 0; if (m_dBusServerAddress != newValues.m_dBusServerAddress) { m_dBusServerAddress = newValues.m_dBusServerAddress; changed++; } - if (m_msgBox != newValues.m_msgBox) { m_msgBox = newValues.m_msgBox; changed++; } + if (m_msgBox != newValues.m_msgBox) { m_msgBox = newValues.m_msgBox; changed++; } if (m_drawingLabels != newValues.m_drawingLabels) { m_drawingLabels = newValues.m_drawingLabels; changed++; } - if (m_bundleTaxiLandingLights != newValues.m_bundleTaxiLandingLights) { m_bundleTaxiLandingLights = newValues.m_bundleTaxiLandingLights; 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_maxPlanes != newValues.m_maxPlanes) { m_maxPlanes = newValues.m_maxPlanes; changed++; } if (m_msSinceEpochQtFree != newValues.m_msSinceEpochQtFree) { m_msSinceEpochQtFree = newValues.m_msSinceEpochQtFree; changed++; } - if (m_followAircraftDistanceM != newValues.m_followAircraftDistanceM) { m_followAircraftDistanceM = newValues.m_followAircraftDistanceM; 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 diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.h b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.h index 1cefe4372..2a55945bd 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.h +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.h @@ -38,7 +38,7 @@ namespace BlackSimPlugin CSimulatorXPlaneConfig(QObject *parent = nullptr); //! Dtor - virtual ~CSimulatorXPlaneConfig() {} + virtual ~CSimulatorXPlaneConfig() override {} //! \copydoc BlackGui::IPluginConfig::createConfigWindow() BlackGui::CPluginConfigWindow *createConfigWindow(QWidget *parent) override; diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp index 4c5db0f43..9795a6466 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp @@ -55,6 +55,8 @@ namespace BlackSimPlugin m_xSwiftBusServerSettings.set(changed); CXSwiftBusConfigWriter xswiftbusConfigWriter; xswiftbusConfigWriter.setDBusAddress(changed.getDBusServerAddressQt()); + xswiftbusConfigWriter.setDebugMode(s.isLogRenderPhases()); + xswiftbusConfigWriter.setTcasEnabled(s.isTcasEnabled()); xswiftbusConfigWriter.updateInAllXPlaneVersions(); } this->close(); @@ -70,6 +72,8 @@ namespace BlackSimPlugin s.setDrawingLabels(ui->cb_DrawLabels->isChecked()); s.setNightTextureModeQt(ui->cb_NightTextureMode->currentText()); s.setBundlingTaxiAndLandingLights(ui->cb_BundleTaxiLandingLights->isChecked()); + s.setTcasEnabled(ui->cb_TcasEnabled->isChecked()); + s.setLogRenderPhases(ui->cb_LogRenderPhases->isChecked()); // left, top, right, bottom, height s.setMessageBoxValues( @@ -88,9 +92,11 @@ namespace BlackSimPlugin ui->comp_SettingsXSwiftBus->set(settings.getDBusServerAddressQt()); ui->sb_MaxAircraft->setValue(settings.getMaxPlanes()); ui->sb_FollowAircraftDistanceM->setValue(settings.getFollowAircraftDistanceM()); - ui->cb_DrawLabels->setChecked(settings.isDrawingLabels()); ui->ds_MaxDrawDistanceNM->setValue(settings.getMaxDrawDistanceNM()); + ui->cb_DrawLabels->setChecked(settings.isDrawingLabels()); ui->cb_BundleTaxiLandingLights->setChecked(settings.isBundlingTaxiAndLandingLights()); + ui->cb_TcasEnabled->setChecked(settings.isTcasEnabled()); + ui->cb_LogRenderPhases->setChecked(settings.isLogRenderPhases()); const QString s = settings.getNightTextureModeQt().left(1); if (!s.isEmpty()) diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui index 55d6864b5..cb6929ac2 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui @@ -6,14 +6,14 @@ 0 0 - 300 - 450 + 378 + 585 - 300 - 425 + 275 + 475 @@ -158,14 +158,14 @@ - + Message box - + @@ -193,33 +193,17 @@ - - - - ms - - - 1000 - - - 25000 - - - 250 - - - - + Box margins px. - + @@ -293,14 +277,14 @@ - + Night texture - + @@ -319,6 +303,57 @@ + + + + log.render phases + + + + + + + Logging + + + + + + + show traffic on TCAS + + + + + + + TCAS + + + + + + + ms + + + 1000 + + + 25000 + + + 250 + + + + + + + Box disappears after + + + @@ -351,8 +386,9 @@ sb_FollowAircraftDistanceM cb_DrawLabels cb_BundleTaxiLandingLights + cb_TcasEnabled + cb_LogRenderPhases sb_MessageBoxLines - sb_MessageBoxDuration le_MsgBoxMarginsTop le_MsgBoxMarginsBottom le_MsgBoxMarginsLeft