diff --git a/src/blackgui/components/interpolationlogdisplay.cpp b/src/blackgui/components/interpolationlogdisplay.cpp index 598b0739e..bfe4ef068 100644 --- a/src/blackgui/components/interpolationlogdisplay.cpp +++ b/src/blackgui/components/interpolationlogdisplay.cpp @@ -29,7 +29,7 @@ namespace BlackGui namespace Components { CInterpolationLogDisplay::CInterpolationLogDisplay(QWidget *parent) : - QFrame(parent), + COverlayMessagesFrame(parent), ui(new Ui::CInterpolationLogDisplay) { Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui"); @@ -53,6 +53,7 @@ namespace BlackGui connect(ui->hs_UpdateTime, &QSlider::valueChanged, this, &CInterpolationLogDisplay::onSliderChanged); connect(ui->pb_StartStop, &QPushButton::released, this, &CInterpolationLogDisplay::toggleStartStop); connect(ui->pb_ResetStats, &QPushButton::released, this, &CInterpolationLogDisplay::resetStatistics); + connect(ui->pb_GetLastInterpolation, &QPushButton::released, this, &CInterpolationLogDisplay::displayLastInterpolation); connect(sGui, &CGuiApplication::aboutToShutdown, this, &CInterpolationLogDisplay::onAboutToShutdown); } @@ -94,6 +95,7 @@ namespace BlackGui void CInterpolationLogDisplay::updateLog() { if (!sGui || sGui->isShuttingDown()) { return; } + if (!this->isVisible()) { return; } const bool hasLogger = m_airspaceMonitor && m_simulatorCommon && m_simulatorCommon->isConnected() && !m_simulatorCommon->isShuttingDown(); if (!hasLogger || m_callsign.isEmpty()) { @@ -121,12 +123,40 @@ namespace BlackGui const CClient client = m_airspaceMonitor->getClientOrDefaultForCallsign(m_callsign); ui->le_GndFlag->setText(boolToYesNo(client.hasGndFlagCapability())); + + this->displayLastInterpolation(); } } + void CInterpolationLogDisplay::displayLastInterpolation() + { + if (!sApp || sApp->isShuttingDown() || !m_airspaceMonitor || !m_simulatorCommon) { return; } + if (m_callsign.isEmpty()) + { + static const CStatusMessage m = CStatusMessage(this).validationError("No callsign"); + this->showOverlayMessage(m); + return; + } + if (!m_simulatorCommon->getLogCallsigns().contains(m_callsign)) + { + static const CStatusMessage m = CStatusMessage(this).validationError("No logger attached, start logging"); + this->showOverlayMessage(m); + return; + } + + const SituationLog sLog = m_simulatorCommon->interpolationLogger().getLastSituationLog(); + // ui->te_LastInterpolatedSituation->setText(sLog.toQString(false, true, true, false, "
")); + ui->te_LastInterpolatedSituation->setText(sLog.situationCurrent.toQString(true)); + ui->te_SituationChange->setText(sLog.change.toQString(true)); + ui->le_SceneryOffset->setText(sLog.change.getGuessedSceneryDeviation().valueRoundedWithUnit(CLengthUnit::ft(), 1)); + + const PartsLog pLog = m_simulatorCommon->interpolationLogger().getLastPartsLog(); + ui->te_LastInterpolatedParts->setText(pLog.parts.toQString(true)); + } + void CInterpolationLogDisplay::onSliderChanged(int timeSecs) { - static const QString time("%1 secs"); + static const QString time("%1secs"); m_updateTimer.setInterval(timeSecs * 1000); ui->le_UpdateTime->setText(time.arg(timeSecs)); } diff --git a/src/blackgui/components/interpolationlogdisplay.h b/src/blackgui/components/interpolationlogdisplay.h index e2b401cd7..101a8e0f0 100644 --- a/src/blackgui/components/interpolationlogdisplay.h +++ b/src/blackgui/components/interpolationlogdisplay.h @@ -12,6 +12,7 @@ #ifndef BLACKGUI_COMPONENTS_INTERPOLATIONLOGDISPLAY_H #define BLACKGUI_COMPONENTS_INTERPOLATIONLOGDISPLAY_H +#include "blackgui/overlaymessagesframe.h" #include "blackgui/blackguiexport.h" #include "blackcore/simulatorcommon.h" #include "blackmisc/aviation/callsign.h" @@ -29,7 +30,7 @@ namespace BlackGui /** * Display live data of interpolation */ - class BLACKGUI_EXPORT CInterpolationLogDisplay : public QFrame + class BLACKGUI_EXPORT CInterpolationLogDisplay : public COverlayMessagesFrame { Q_OBJECT @@ -38,6 +39,7 @@ namespace BlackGui enum Tab { TabFlow, + TabInterpolation, TabTextLog }; @@ -60,6 +62,9 @@ namespace BlackGui //! Update log. void updateLog(); + //! Get last interpolation + void displayLastInterpolation(); + //! Slider interval void onSliderChanged(int timeSecs); diff --git a/src/blackgui/components/interpolationlogdisplay.ui b/src/blackgui/components/interpolationlogdisplay.ui index 09e931607..328f82bd7 100644 --- a/src/blackgui/components/interpolationlogdisplay.ui +++ b/src/blackgui/components/interpolationlogdisplay.ui @@ -205,7 +205,7 @@ Misc. - + 3 @@ -218,179 +218,166 @@ 3 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Parts: - - - - - - - true - - - parts? - - - - - - - Gnd.flag: - - - - - - - true - - - gnd.flag? - - - - - - - update aircraft req.time - - - Update req. - - - - - - - true - - - - - - - Avg.update time: - - - - - - - true - - - - - - - req.: - - - - - - - elevation requested - - - true - - - req. - - - - - - - Rec.: - - - - - - - elevation received - - - true - - - rec. - - - - + + + + true + + + time + - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - CG: - - - - - - - true - - - CG - - - - - - - Elevation: - - - - - - - true - - - elevation - - - - + + + + update aircraft req.time + + + Update req. + + + + + + + elevation requested + + + true + + + req. + + + + + + + Parts: + + + + + + + true + + + parts? + + + + + + + CG: + + + + + + + true + + + gnd.flag? + + + + + + + Gnd.flag: + + + + + + + Req.: + + + + + + + elevation received + + + true + + + rec. + + + + + + + true + + + time + + + + + + + Avg.upd.time: + + + + + + + true + + + CG + + + + + + + Rec.: + + + + + + + true + + + elevation + + + + + + + Elevation: + + + + + + + true + + + offset + + + + + + + Offset: + @@ -420,6 +407,104 @@ + + + Interpolation + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + last interpolation + + + + + + + Situation + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + + + + + Changes + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + + + + + Parts + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + + + Text log. @@ -463,18 +548,27 @@ - comp_CallsignCompleter - le_UpdateTime - hs_UpdateTime + tw_LogTabs + le_CG le_Parts le_GndFlag + le_UpdateAircraftReqTimeMs + le_AvgUpdateTimeMs le_ElevationReq + le_ElevationRec + le_SceneryOffset le_Elevation tvp_AircraftSituations tvp_AircraftParts - tw_LogTabs + te_LastInterpolatedSituation + te_SituationChange + te_LastInterpolatedParts te_TextLog - le_ElevationRec + hs_UpdateTime + comp_CallsignCompleter + pb_GetLastInterpolation + le_UpdateTime + pb_ResetStats pb_StartStop