From e50520c0aa6032482cbc938fafc97f174c5a53ac Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 26 Apr 2020 00:39:30 +0200 Subject: [PATCH] Added a component for aircraft parts * internals page and log.display both use that component * complete parts code now encapsulated --- src/blackgui/components/aircraftcomponent.h | 2 +- .../components/aircraftpartscomponent.cpp | 183 ++++++++++ .../components/aircraftpartscomponent.h | 67 ++++ .../components/aircraftpartscomponent.ui | 289 ++++++++++++++++ src/blackgui/components/callsigncompleter.h | 4 +- .../components/internalscomponent.cpp | 135 -------- src/blackgui/components/internalscomponent.h | 12 - src/blackgui/components/internalscomponent.ui | 249 +------------- .../components/interpolationlogdisplay.cpp | 7 +- .../components/interpolationlogdisplay.ui | 320 ++++++++++-------- .../simulation/remoteaircraftprovider.cpp | 2 +- 11 files changed, 726 insertions(+), 544 deletions(-) create mode 100644 src/blackgui/components/aircraftpartscomponent.cpp create mode 100644 src/blackgui/components/aircraftpartscomponent.h create mode 100644 src/blackgui/components/aircraftpartscomponent.ui diff --git a/src/blackgui/components/aircraftcomponent.h b/src/blackgui/components/aircraftcomponent.h index 6b384a869..1bd6d78e0 100644 --- a/src/blackgui/components/aircraftcomponent.h +++ b/src/blackgui/components/aircraftcomponent.h @@ -25,7 +25,7 @@ namespace Ui { class CAircraftComponent; } namespace BlackMisc { - namespace Aviation { class CCallsign; } + namespace Aviation { class CCallsign; } namespace Simulation { class CSimulatedAircraft; } } namespace BlackGui diff --git a/src/blackgui/components/aircraftpartscomponent.cpp b/src/blackgui/components/aircraftpartscomponent.cpp new file mode 100644 index 000000000..6170bb388 --- /dev/null +++ b/src/blackgui/components/aircraftpartscomponent.cpp @@ -0,0 +1,183 @@ +/* Copyright (C) 2020 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, + * or distributed except according to the terms contained in the LICENSE file. + */ + +#include "aircraftpartscomponent.h" +#include "ui_aircraftpartscomponent.h" + +#include "blackgui/guiapplication.h" +#include "blackcore/context/contextnetwork.h" +#include "blackcore/context/contextsimulator.h" +#include "blackcore/context/contextownaircraft.h" +#include "blackmisc/aviation/aircraftenginelist.h" +#include "blackmisc/aviation/aircraftlights.h" + +using namespace BlackMisc; +using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; +using namespace BlackMisc::Math; +using namespace BlackMisc::PhysicalQuantities; +using namespace BlackMisc::Simulation; +using namespace BlackCore; +using namespace BlackCore::Context; + +namespace BlackGui +{ + namespace Components + { + CAircraftPartsComponent::CAircraftPartsComponent(QWidget *parent) : + QFrame(parent), + ui(new Ui::CAircraftPartsComponent) + { + ui->setupUi(this); + + ui->editor_AircraftParts->showSetButton(false); + connect(ui->pb_SendAircraftPartsGui, &QPushButton::released, this, &CAircraftPartsComponent::sendAircraftParts); + connect(ui->pb_SendAircraftPartsJson, &QPushButton::released, this, &CAircraftPartsComponent::sendAircraftParts); + connect(ui->pb_CurrentParts, &QPushButton::released, this, &CAircraftPartsComponent::setCurrentParts); + connect(ui->pb_OwnParts, &QPushButton::released, this, &CAircraftPartsComponent::displayOwnParts); + connect(ui->pb_RequestFromNetwork, &QPushButton::released, this, &CAircraftPartsComponent::requestPartsFromNetwork); + connect(ui->pb_DisplayLog, &QPushButton::released, this, &CAircraftPartsComponent::displayLogInSimulator); + connect(ui->comp_RemoteAircraftCompleter, &CCallsignCompleter::validCallsignEnteredDigest, this, &CAircraftPartsComponent::onCallsignChanged); + + ui->comp_RemoteAircraftCompleter->addOwnCallsign(true); + } + + CAircraftPartsComponent::~CAircraftPartsComponent() + { + // void + } + + void CAircraftPartsComponent::setCallsign(const CCallsign &callsign) + { + ui->comp_RemoteAircraftCompleter->setCallsign(callsign); + this->onCallsignChanged(); + } + + void CAircraftPartsComponent::sendAircraftParts() + { + if (!sGui || sGui->isShuttingDown()) { return; } + + Q_ASSERT(sGui->getIContextNetwork()); + if (!sGui->getIContextNetwork()->isConnected()) + { + CLogMessage(this).validationError(u"Cannot send aircraft parts, network not connected"); + return; + } + const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign(true)); + if (callsign.isEmpty()) + { + CLogMessage(this).validationError(u"No valid callsign selected"); + return; + } + + CClient client = sGui->getIContextNetwork()->getClientsForCallsigns(callsign).frontOrDefault(); + if (client.getCallsign().isEmpty() || client.getCallsign() != callsign) + { + CLogMessage(this).validationError(u"No valid client for '%1'") << callsign.asString(); + return; + } + + if (!client.hasAircraftPartsCapability()) + { + static const QString question("'%1' does not support parts, enable parts for it?"); + const QMessageBox::StandardButton reply = QMessageBox::question(this, "No parts supported", question.arg(callsign.asString()), QMessageBox::Yes | QMessageBox::No); + if (reply != QMessageBox::Yes) { return; } + client.addCapability(CClient::FsdWithAircraftConfig); + const bool enabled = sGui->getIContextNetwork()->setOtherClient(client); + Q_UNUSED(enabled) + } + + const bool json = (QObject::sender() == ui->pb_SendAircraftPartsJson); + const CAircraftParts parts = json ? ui->editor_AircraftParts->getAircraftPartsFromJson() : ui->editor_AircraftParts->getAircraftPartsFromGui(); + ui->editor_AircraftParts->setAircraftParts(parts); // display in UI as GUI and JSON + + ui->tb_History->setToolTip(""); + const bool incremental = ui->cb_AircraftPartsIncremental->isChecked(); + sGui->getIContextNetwork()->testAddAircraftParts(callsign, parts, incremental); + CLogMessage(this).info(u"Added parts for %1") << callsign.toQString(); + } + + void CAircraftPartsComponent::setCurrentParts() + { + if (!sGui->getIContextNetwork()->isConnected()) { return; } + const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign()); + if (callsign.isEmpty()) { return; } + + const CAircraftPartsList partsList = sGui->getIContextNetwork()->getRemoteAircraftParts(callsign); + if (partsList.isEmpty()) + { + CStatusMessage(this).info(u"No parts for '%1'") << callsign.asString(); + return; + } + const CAircraftParts parts = partsList.latestObject(); + const CStatusMessageList history = sGui->getIContextNetwork()->getAircraftPartsHistory(callsign); + ui->editor_AircraftParts->setAircraftParts(parts); + ui->tb_History->setToolTip(history.toHtml()); + } + + void CAircraftPartsComponent::requestPartsFromNetwork() + { + if (!sGui || sGui->isShuttingDown()) { return; } + if (!sGui->getIContextNetwork()) { return; } + + const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign(true)); + if (callsign.isEmpty()) + { + CLogMessage(this).validationError(u"No valid callsign selected"); + return; + } + ui->pb_RequestFromNetwork->setEnabled(false); + sGui->getIContextNetwork()->testRequestAircraftConfig(callsign); + CLogMessage(this).info(u"Request aircraft config for '%1'") << callsign.asString(); + + // simple approach to update UI when parts are received + const QPointer myself(this); + QTimer::singleShot(3000, this, [ = ] + { + if (!myself) { return; } + ui->pb_CurrentParts->click(); + ui->pb_RequestFromNetwork->setEnabled(true); + }); + } + + void CAircraftPartsComponent::onCallsignChanged() + { + this->setCurrentParts(); + emit this->callsignChanged(ui->comp_RemoteAircraftCompleter->getCallsign()); + } + + void CAircraftPartsComponent::displayOwnParts() + { + if (!sGui || sGui->isShuttingDown()) { return; } + if (!sGui->getIContextOwnAircraft()) { return; } + + const CSimulatedAircraft myAircraft = sGui->getIContextOwnAircraft()->getOwnAircraft(); + const CCallsign cs = myAircraft.getCallsign(); + const CAircraftParts parts = myAircraft.getParts(); + ui->comp_RemoteAircraftCompleter->setCallsign(cs); + ui->editor_AircraftParts->setAircraftParts(parts); + } + + void CAircraftPartsComponent::displayLogInSimulator() + { + if (!sGui || sGui->isShuttingDown()) { return; } + if (!sGui->getIContextSimulator()) { return; } + const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign(true)); + if (callsign.isEmpty()) + { + CLogMessage(this).validationError(u"No valid callsign selected"); + return; + } + + const CIdentifier i(this->objectName()); + const QString dotCmd(".drv pos " + callsign.asString()); + sGui->getIContextSimulator()->parseCommandLine(dotCmd, i); + } + + } // ns +} // ns diff --git a/src/blackgui/components/aircraftpartscomponent.h b/src/blackgui/components/aircraftpartscomponent.h new file mode 100644 index 000000000..0fd1ae0fd --- /dev/null +++ b/src/blackgui/components/aircraftpartscomponent.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2020 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, + * or distributed except according to the terms contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_COMPONENTS_AIRCRAFTPARTSCOMPONENT_H +#define BLACKGUI_COMPONENTS_AIRCRAFTPARTSCOMPONENT_H + +#include "blackmisc/aviation/callsign.h" + +#include +#include + +namespace Ui { class CAircraftPartsComponent; } +namespace BlackGui +{ + namespace Components + { + //! Allows to display and manipulate parts + class CAircraftPartsComponent : public QFrame + { + Q_OBJECT + + public: + //! Ctor + explicit CAircraftPartsComponent(QWidget *parent = nullptr); + + //! Dtor + virtual ~CAircraftPartsComponent() override; + + //! Set selected callsign + void setCallsign(const BlackMisc::Aviation::CCallsign &callsign); + + signals: + //! Currently used callsign + void callsignChanged(const BlackMisc::Aviation::CCallsign &callsign); + + private: + //! Send aircraft parts + void sendAircraftParts(); + + //! Current parts in UI + void setCurrentParts(); + + //! Request parts (aka aircraft config) from network + void requestPartsFromNetwork(); + + //! Display own aircraft parts + void displayOwnParts(); + + //! Own aircraft parts in simulator + void displayLogInSimulator(); + + //! Completer has been changed + void onCallsignChanged(); + + QScopedPointer ui; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/aircraftpartscomponent.ui b/src/blackgui/components/aircraftpartscomponent.ui new file mode 100644 index 000000000..35e3f1613 --- /dev/null +++ b/src/blackgui/components/aircraftpartscomponent.ui @@ -0,0 +1,289 @@ + + + CAircraftPartsComponent + + + + 0 + 0 + 640 + 480 + + + + Frame + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + 4 + + + 4 + + + 2 + + + 0 + + + 2 + + + 0 + + + + + Aircraft: + + + + + + + + 0 + 25 + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + own parts + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + display log. + + + + + + + Request from network + + + request (network) + + + + + + + + + + + :/diagona/icons/diagona/icons/table-sheet.png:/diagona/icons/diagona/icons/table-sheet.png + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + + 0 + 0 + + + + Parts + + + + 4 + + + 4 + + + 4 + + + 4 + + + 2 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + + + + 0 + 0 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + incremental + + + Incr. + + + + + + + set current parts values + + + current + + + + + + + Send JSON + + + + + + + Send GUI + + + + + + + + + + + BlackGui::Components::CCallsignCompleter + QFrame +
blackgui/components/callsigncompleter.h
+ 1 +
+ + BlackGui::Editors::CAircraftPartsForm + QFrame +
blackgui/editors/aircraftpartsform.h
+ 1 +
+
+ + + + +
diff --git a/src/blackgui/components/callsigncompleter.h b/src/blackgui/components/callsigncompleter.h index 502a4b1c2..bb954e653 100644 --- a/src/blackgui/components/callsigncompleter.h +++ b/src/blackgui/components/callsigncompleter.h @@ -83,8 +83,8 @@ namespace BlackGui QScopedPointer ui; BlackMisc::CDigestSignal m_dsAircraftsInRangeChanged { this, &CCallsignCompleter::onChangedAircraftInRange, 5000, 5 }; - BlackMisc::CDigestSignal m_dsEditingFinished { this, &CCallsignCompleter::editingFinishedDigest, 500, 3 }; - BlackMisc::CDigestSignal m_dsValidCallsignEntered { this, &CCallsignCompleter::validCallsignEnteredDigest, 500, 3 }; + BlackMisc::CDigestSignal m_dsEditingFinished { this, &CCallsignCompleter::editingFinishedDigest, 500, 3 }; + BlackMisc::CDigestSignal m_dsValidCallsignEntered { this, &CCallsignCompleter::validCallsignEnteredDigest, 500, 3 }; QString m_lastValue; bool m_addOwnCallsign = false; diff --git a/src/blackgui/components/internalscomponent.cpp b/src/blackgui/components/internalscomponent.cpp index 03079d52c..e8fca14b7 100644 --- a/src/blackgui/components/internalscomponent.cpp +++ b/src/blackgui/components/internalscomponent.cpp @@ -17,8 +17,6 @@ #include "blackcore/context/contextsimulator.h" #include "blackmisc/simulation/interpolationlogger.h" #include "blackmisc/simulation/interpolationrenderingsetup.h" -#include "blackmisc/aviation/aircraftenginelist.h" -#include "blackmisc/aviation/aircraftlights.h" #include "blackmisc/aviation/callsign.h" #include "blackmisc/network/client.h" #include "blackmisc/network/textmessage.h" @@ -48,8 +46,6 @@ using namespace BlackMisc::Network; using namespace BlackMisc::Math; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Simulation; -using namespace BlackCore; -using namespace BlackCore::Context; namespace BlackGui { @@ -61,17 +57,11 @@ namespace BlackGui { ui->setupUi(this); ui->tw_Internals->setCurrentIndex(0); - ui->editor_AircraftParts->showSetButton(false); ui->le_TxtMsgFrom->setValidator(new CUpperCaseValidator(ui->le_TxtMsgFrom)); ui->le_TxtMsgTo->setValidator(new CUpperCaseValidator(ui->le_TxtMsgFrom)); ui->le_AtisCallsign->setValidator(new CUpperCaseValidator(ui->le_AtisCallsign)); - connect(ui->pb_SendAircraftPartsGui, &QPushButton::released, this, &CInternalsComponent::sendAircraftParts); - connect(ui->pb_SendAircraftPartsJson, &QPushButton::released, this, &CInternalsComponent::sendAircraftParts); - connect(ui->pb_CurrentParts, &QPushButton::released, this, &CInternalsComponent::setCurrentParts); - connect(ui->pb_OwnParts, &QPushButton::released, this, &CInternalsComponent::displayOwnParts); - connect(ui->cb_DebugContextAudio, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); connect(ui->cb_DebugContextApplication, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); connect(ui->cb_DebugContextNetwork, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); @@ -86,16 +76,12 @@ namespace BlackGui connect(ui->pb_LatestInterpolationLog, &QPushButton::released, this, &CInternalsComponent::showLogFiles); connect(ui->pb_LatestPartsLog, &QPushButton::released, this, &CInternalsComponent::showLogFiles); - connect(ui->pb_RequestFromNetwork, &QPushButton::released, this, &CInternalsComponent::requestPartsFromNetwork); - connect(ui->pb_DisplayLog, &QPushButton::released, this, &CInternalsComponent::displayLogInSimulator); connect(ui->pb_SendAtis, &QPushButton::released, this, &CInternalsComponent::sendAtis); connect(ui->pb_NetworkUpdateAndReset, &QPushButton::released, this, &CInternalsComponent::networkStatistics); connect(ui->pb_NetworkUpdate, &QPushButton::released, this, &CInternalsComponent::networkStatistics); connect(ui->cb_NetworkStatistics, &QCheckBox::stateChanged, this, &CInternalsComponent::onNetworkStatisticsToggled); - connect(ui->comp_RemoteAircraftCompleter, &CCallsignCompleter::validCallsignEnteredDigest, this, &CInternalsComponent::onCallsignChanged); - if (sGui && sGui->isSupportingCrashpad()) { ui->cb_CrashDumpUpload->setChecked(CCrashHandler::instance()->isCrashDumpUploadEnabled()); @@ -109,7 +95,6 @@ namespace BlackGui ui->cb_CrashDumpUpload->setEnabled(false); } - ui->comp_RemoteAircraftCompleter->addOwnCallsign(true); this->contextFlagsToGui(); } @@ -122,68 +107,6 @@ namespace BlackGui QWidget::showEvent(event); } - void CInternalsComponent::sendAircraftParts() - { - if (!sGui || sGui->isShuttingDown()) { return; } - - Q_ASSERT(sGui->getIContextNetwork()); - if (!sGui->getIContextNetwork()->isConnected()) - { - CLogMessage(this).validationError(u"Cannot send aircraft parts, network not connected"); - return; - } - const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign(true)); - if (callsign.isEmpty()) - { - CLogMessage(this).validationError(u"No valid callsign selected"); - return; - } - - CClient client = sGui->getIContextNetwork()->getClientsForCallsigns(callsign).frontOrDefault(); - if (client.getCallsign().isEmpty() || client.getCallsign() != callsign) - { - CLogMessage(this).validationError(u"No valid client for '%1'") << callsign.asString(); - return; - } - - if (!client.hasAircraftPartsCapability()) - { - static const QString question("'%1' does not support parts, enable parts for it?"); - const QMessageBox::StandardButton reply = QMessageBox::question(this, "No parts supported", question.arg(callsign.asString()), QMessageBox::Yes | QMessageBox::No); - if (reply != QMessageBox::Yes) { return; } - client.addCapability(CClient::FsdWithAircraftConfig); - const bool enabled = sGui->getIContextNetwork()->setOtherClient(client); - Q_UNUSED(enabled) - } - - const bool json = (QObject::sender() == ui->pb_SendAircraftPartsJson); - const CAircraftParts parts = json ? ui->editor_AircraftParts->getAircraftPartsFromJson() : ui->editor_AircraftParts->getAircraftPartsFromGui(); - ui->editor_AircraftParts->setAircraftParts(parts); // display in UI as GUI and JSON - - ui->tb_History->setToolTip(""); - const bool incremental = ui->cb_AircraftPartsIncremental->isChecked(); - sGui->getIContextNetwork()->testAddAircraftParts(callsign, parts, incremental); - CLogMessage(this).info(u"Added parts for %1") << callsign.toQString(); - } - - void CInternalsComponent::setCurrentParts() - { - if (!sGui->getIContextNetwork()->isConnected()) { return; } - const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign()); - if (callsign.isEmpty()) { return; } - - const CAircraftPartsList partsList = sGui->getIContextNetwork()->getRemoteAircraftParts(callsign); - if (partsList.isEmpty()) - { - CStatusMessage(this).info(u"No parts for '%1'") << callsign.asString(); - return; - } - const CAircraftParts parts = partsList.latestObject(); - const CStatusMessageList history = sGui->getIContextNetwork()->getAircraftPartsHistory(callsign); - ui->editor_AircraftParts->setAircraftParts(parts); - ui->tb_History->setToolTip(history.toHtml()); - } - void CInternalsComponent::enableDebug(int state) { Q_ASSERT(sGui->getIContextApplication()); @@ -287,64 +210,6 @@ namespace BlackGui QDesktopServices::openUrl(QUrl::fromLocalFile(file)); } - void CInternalsComponent::requestPartsFromNetwork() - { - if (!sGui || sGui->isShuttingDown()) { return; } - if (!sGui->getIContextNetwork()) { return; } - - const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign(true)); - if (callsign.isEmpty()) - { - CLogMessage(this).validationError(u"No valid callsign selected"); - return; - } - ui->pb_RequestFromNetwork->setEnabled(false); - sGui->getIContextNetwork()->testRequestAircraftConfig(callsign); - CLogMessage(this).info(u"Request aircraft config for '%1'") << callsign.asString(); - - // simple approach to update UI when parts are received - const QPointer myself(this); - QTimer::singleShot(3000, this, [ = ] - { - if (!myself) { return; } - ui->pb_CurrentParts->click(); - ui->pb_RequestFromNetwork->setEnabled(true); - }); - } - - void CInternalsComponent::onCallsignChanged() - { - this->setCurrentParts(); - } - - void CInternalsComponent::displayOwnParts() - { - if (!sGui || sGui->isShuttingDown()) { return; } - if (!sGui->getIContextOwnAircraft()) { return; } - - const CSimulatedAircraft myAircraft = sGui->getIContextOwnAircraft()->getOwnAircraft(); - const CCallsign cs = myAircraft.getCallsign(); - const CAircraftParts parts = myAircraft.getParts(); - ui->comp_RemoteAircraftCompleter->setCallsign(cs); - ui->editor_AircraftParts->setAircraftParts(parts); - } - - void CInternalsComponent::displayLogInSimulator() - { - if (!sGui || sGui->isShuttingDown()) { return; } - if (!sGui->getIContextSimulator()) { return; } - const CCallsign callsign(ui->comp_RemoteAircraftCompleter->getCallsign(true)); - if (callsign.isEmpty()) - { - CLogMessage(this).validationError(u"No valid callsign selected"); - return; - } - - const CIdentifier i(this->objectName()); - const QString dotCmd(".drv pos " + callsign.asString()); - sGui->getIContextSimulator()->parseCommandLine(dotCmd, i); - } - void CInternalsComponent::contextFlagsToGui() { ui->cb_DebugContextApplication->setChecked(sGui->getIContextApplication()->isDebugEnabled()); diff --git a/src/blackgui/components/internalscomponent.h b/src/blackgui/components/internalscomponent.h index 9ce7b587d..539633f06 100644 --- a/src/blackgui/components/internalscomponent.h +++ b/src/blackgui/components/internalscomponent.h @@ -42,12 +42,6 @@ namespace BlackGui virtual void showEvent(QShowEvent *event) override; private: - //! Send aircraft parts - void sendAircraftParts(); - - //! Current parts in UI - void setCurrentParts(); - //! Enable / disable debugging void enableDebug(int state); @@ -63,12 +57,6 @@ namespace BlackGui //! Show log files void showLogFiles(); - //! Request parts (aka aircraft config) from network - void requestPartsFromNetwork(); - - //! Completer has been changed - void onCallsignChanged(); - //! Display own parts void displayOwnParts(); diff --git a/src/blackgui/components/internalscomponent.ui b/src/blackgui/components/internalscomponent.ui index 8dea68b46..66e4b314d 100644 --- a/src/blackgui/components/internalscomponent.ui +++ b/src/blackgui/components/internalscomponent.ui @@ -448,243 +448,13 @@ 0 - - - - 4 - - - 4 - - - 2 - - - 0 - - - 2 - - - 0 - - - - - Aircraft: - - - - - - - - 0 - 25 - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - own parts - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - display log. - - - - - - - Request from network - - - request (network) - - - - - - - - - - - :/diagona/icons/diagona/icons/table-sheet.png:/diagona/icons/diagona/icons/table-sheet.png - - - - - - - - - - - + QFrame::StyledPanel QFrame::Raised - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Vertical - - - - - 0 - 0 - - - - Parts - - - - 4 - - - 4 - - - 4 - - - 4 - - - 2 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - - - - - - 0 - 0 - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - incremental - - - Incr. - - - - - - - set current parts values - - - current - - - - - - - Send JSON - - - - - - - Send GUI - - - - @@ -723,12 +493,6 @@ - - BlackGui::Editors::CAircraftPartsForm - QFrame -
blackgui/editors/aircraftpartsform.h
- 1 -
BlackGui::Components::CRawFsdMessagesComponent QFrame @@ -736,9 +500,9 @@ 1 - BlackGui::Components::CCallsignCompleter + BlackGui::Components::CAircraftPartsComponent QFrame -
blackgui/components/callsigncompleter.h
+
blackgui/components/aircraftpartscomponent.h
1
@@ -772,13 +536,6 @@ cb_NetworkStatistics pb_NetworkUpdate pb_NetworkUpdateAndReset - pb_DisplayLog - pb_RequestFromNetwork - tb_History - pb_CurrentParts - cb_AircraftPartsIncremental - pb_SendAircraftPartsJson - pb_SendAircraftPartsGui diff --git a/src/blackgui/components/interpolationlogdisplay.cpp b/src/blackgui/components/interpolationlogdisplay.cpp index a662c56db..23c73c2d3 100644 --- a/src/blackgui/components/interpolationlogdisplay.cpp +++ b/src/blackgui/components/interpolationlogdisplay.cpp @@ -88,10 +88,10 @@ namespace BlackGui connect(ui->pb_ClearLog2, &QPushButton::released, this, &CInterpolationLogDisplay::clearLogCommand); connect(ui->pb_WriteLogToFile, &QPushButton::released, this, &CInterpolationLogDisplay::writeLogCommand); connect(ui->pb_WriteLogToFile2, &QPushButton::released, this, &CInterpolationLogDisplay::writeLogCommand); + connect(ui->le_InjectElevation, &QLineEdit::returnPressed, this, &CInterpolationLogDisplay::onInjectElevation); + connect(ui->le_ElvHistoryCount, &QLineEdit::editingFinished, this, &CInterpolationLogDisplay::onElevationHistoryCountFinished); + connect(ui->cb_ElvAllowPseudo, &QCheckBox::toggled, this, &CInterpolationLogDisplay::onPseudoElevationToggled); connect(ui->tvp_InboundAircraftSituations, &CAircraftSituationView::requestElevation, this, &CInterpolationLogDisplay::requestElevation); - connect(ui->le_InjectElevation, &QLineEdit::returnPressed, this, &CInterpolationLogDisplay::onInjectElevation); - connect(ui->le_ElvHistoryCount, &QLineEdit::editingFinished, this, &CInterpolationLogDisplay::onElevationHistoryCountFinished); - connect(ui->cb_ElvAllowPseudo, &QCheckBox::toggled, this, &CInterpolationLogDisplay::onPseudoElevationToggled); connect(ui->editor_ElevationCoordinate, &CCoordinateForm::changedCoordinate, this, &CInterpolationLogDisplay::requestElevationAtPosition); connect(sGui, &CGuiApplication::aboutToShutdown, this, &CInterpolationLogDisplay::onAboutToShutdown, Qt::QueuedConnection); } @@ -248,6 +248,7 @@ namespace BlackGui // set new callsign or stop m_callsign = cs; m_simulator->setLogInterpolation(true, cs); + ui->comp_Parts->setCallsign(cs); if (!this->start()) { this->initPartsView(); diff --git a/src/blackgui/components/interpolationlogdisplay.ui b/src/blackgui/components/interpolationlogdisplay.ui index d694549e4..8b6e04540 100644 --- a/src/blackgui/components/interpolationlogdisplay.ui +++ b/src/blackgui/components/interpolationlogdisplay.ui @@ -280,17 +280,53 @@ 3 - - - - Simulator: + + + + true + + + void - - + + - Not used: + Req/rec: + + + + + + + elevation requested + + + true + + + req./rec. + + + + + + + true + + + count + + + + + + + true + + + time min, max, .. @@ -304,20 +340,20 @@ - - - - Upd.#: - - - - - + + true - void + offset from changes + + + + + + + @@ -331,13 +367,48 @@ - - + + + + Gnd.flag: + + + + + + + Elevation: + + + + + true - limited? + req.time ms + + + + + + + Limited + + + + + + + Simulator: + + + + + + + Parts: @@ -361,101 +432,6 @@ - - - - - - - - - - - Parts: - - - - - - - true - - - offset-CG - - - - - - - true - - - req.time ms - - - - - - - true - - - offset from changes - - - - - - - Req/rec: - - - - - - - Scenery offset-CG - - - Off-CG: - - - - - - - Req. time: - - - - - - - true - - - count - - - - - - - Limited - - - - - - - true - - - time min, max, .. - - - @@ -466,26 +442,6 @@ - - - - Gnd.flag: - - - - - - - elevation requested - - - true - - - req./rec. - - - @@ -496,13 +452,6 @@ - - - - Elevation: - - - @@ -513,7 +462,58 @@ - + + + + Scenery offset-CG + + + Off-CG: + + + + + + + Upd.#: + + + + + + + Req. time: + + + + + + + Not used: + + + + + + + true + + + offset-CG + + + + + + + true + + + limited? + + + + true @@ -523,8 +523,14 @@ - + + + + 75 + 0 + + re-calc @@ -584,6 +590,9 @@ Inbound parts from network + + false + @@ -633,6 +642,23 @@ + + + Parts + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + Interpolation @@ -1047,6 +1073,12 @@
blackgui/editors/coordinateform.h
1 + + BlackGui::Components::CAircraftPartsComponent + QFrame +
blackgui/components/aircraftpartscomponent.h
+ 1 +
le_UpdateTime diff --git a/src/blackmisc/simulation/remoteaircraftprovider.cpp b/src/blackmisc/simulation/remoteaircraftprovider.cpp index fc8f27447..1a600b860 100644 --- a/src/blackmisc/simulation/remoteaircraftprovider.cpp +++ b/src/blackmisc/simulation/remoteaircraftprovider.cpp @@ -406,7 +406,7 @@ namespace BlackMisc void CRemoteAircraftProvider::storeAircraftParts(const CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs) { const CSimulatedAircraft remoteAircraft(this->getAircraftInRangeForCallsign(callsign)); - const bool isFull = jsonObject.value(CAircraftParts::attributeNameIsFullJson()).toBool(); + const bool isFull = jsonObject.value(CAircraftParts::attributeNameIsFullJson()).toBool(); const bool validCs = remoteAircraft.hasValidCallsign(); if (!validCs) {