Ref T270, interpolation log improvements

* last interpolation tab
* display scenery offset
* UI formatting
* using COverlayMessagesFrame
This commit is contained in:
Klaus Basan
2018-05-31 19:34:04 +02:00
parent 04110447c8
commit eeaa5d8bf6
3 changed files with 309 additions and 180 deletions

View File

@@ -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, "<br>"));
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));
}

View File

@@ -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);

View File

@@ -205,7 +205,7 @@
<property name="title">
<string>Misc.</string>
</property>
<layout class="QVBoxLayout" name="vl_Misc" stretch="0,0">
<layout class="QGridLayout" name="gl_Misc">
<property name="leftMargin">
<number>3</number>
</property>
@@ -218,179 +218,166 @@
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QFrame" name="fr_Misc1">
<layout class="QHBoxLayout" name="hl_Misc1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lbl_Parts">
<property name="text">
<string>Parts:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_Parts">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>parts?</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_GndFlag">
<property name="text">
<string>Gnd.flag:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_GndFlag">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>gnd.flag?</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_UpdateAircraftReqTime">
<property name="toolTip">
<string>update aircraft req.time</string>
</property>
<property name="text">
<string>Update req.</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_UpdateAircraftReqTimeMs">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_AverageUpdateTime">
<property name="text">
<string>Avg.update time:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_AvgUpdateTimeMs">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_ElevationRequested">
<property name="text">
<string>req.:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_ElevationReq">
<property name="toolTip">
<string>elevation requested</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>req.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_ElevationReceived">
<property name="text">
<string>Rec.:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_ElevationRec">
<property name="toolTip">
<string>elevation received</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>rec.</string>
</property>
</widget>
</item>
</layout>
<item row="0" column="7">
<widget class="QLineEdit" name="le_UpdateAircraftReqTimeMs">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>time</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="fr_Misc2">
<layout class="QHBoxLayout" name="hl_Misc2" stretch="0,1,0,4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lbl_CG">
<property name="text">
<string>CG:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_CG">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>CG</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Elevation">
<property name="text">
<string>Elevation:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_Elevation">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>elevation</string>
</property>
</widget>
</item>
</layout>
<item row="0" column="6">
<widget class="QLabel" name="lbl_UpdateAircraftReqTime">
<property name="toolTip">
<string>update aircraft req.time</string>
</property>
<property name="text">
<string>Update req.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_ElevationReq">
<property name="toolTip">
<string>elevation requested</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>req.</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbl_Parts">
<property name="text">
<string>Parts:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="le_Parts">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>parts?</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_CG">
<property name="text">
<string>CG:</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLineEdit" name="le_GndFlag">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>gnd.flag?</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="lbl_GndFlag">
<property name="text">
<string>Gnd.flag:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_ElevationRequested">
<property name="text">
<string>Req.:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="le_ElevationRec">
<property name="toolTip">
<string>elevation received</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>rec.</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLineEdit" name="le_AvgUpdateTimeMs">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>time</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QLabel" name="lbl_AverageUpdateTime">
<property name="text">
<string>Avg.upd.time:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_CG">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>CG</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbl_ElevationReceived">
<property name="text">
<string>Rec.:</string>
</property>
</widget>
</item>
<item row="1" column="7" colspan="3">
<widget class="QLineEdit" name="le_Elevation">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>elevation</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="lbl_Elevation">
<property name="text">
<string>Elevation:</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QLineEdit" name="le_SceneryOffset">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>offset</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label">
<property name="text">
<string>Offset:</string>
</property>
</widget>
</item>
</layout>
@@ -420,6 +407,104 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_Interpolation">
<attribute name="title">
<string>Interpolation</string>
</attribute>
<layout class="QVBoxLayout" name="vl_Interpolation" stretch="0,2,1,1">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item alignment="Qt::AlignRight">
<widget class="QPushButton" name="pb_GetLastInterpolation">
<property name="text">
<string> last interpolation </string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_LastSituation">
<property name="title">
<string>Situation</string>
</property>
<layout class="QVBoxLayout" name="vl_LastSituation">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QTextEdit" name="te_LastInterpolatedSituation"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_Changes">
<property name="title">
<string>Changes</string>
</property>
<layout class="QVBoxLayout" name="vl_Changes">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QTextEdit" name="te_SituationChange"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_Parts">
<property name="title">
<string>Parts</string>
</property>
<layout class="QVBoxLayout" name="vl_Parts">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QTextEdit" name="te_LastInterpolatedParts"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_TextLog">
<attribute name="title">
<string>Text log.</string>
@@ -463,18 +548,27 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>comp_CallsignCompleter</tabstop>
<tabstop>le_UpdateTime</tabstop>
<tabstop>hs_UpdateTime</tabstop>
<tabstop>tw_LogTabs</tabstop>
<tabstop>le_CG</tabstop>
<tabstop>le_Parts</tabstop>
<tabstop>le_GndFlag</tabstop>
<tabstop>le_UpdateAircraftReqTimeMs</tabstop>
<tabstop>le_AvgUpdateTimeMs</tabstop>
<tabstop>le_ElevationReq</tabstop>
<tabstop>le_ElevationRec</tabstop>
<tabstop>le_SceneryOffset</tabstop>
<tabstop>le_Elevation</tabstop>
<tabstop>tvp_AircraftSituations</tabstop>
<tabstop>tvp_AircraftParts</tabstop>
<tabstop>tw_LogTabs</tabstop>
<tabstop>te_LastInterpolatedSituation</tabstop>
<tabstop>te_SituationChange</tabstop>
<tabstop>te_LastInterpolatedParts</tabstop>
<tabstop>te_TextLog</tabstop>
<tabstop>le_ElevationRec</tabstop>
<tabstop>hs_UpdateTime</tabstop>
<tabstop>comp_CallsignCompleter</tabstop>
<tabstop>pb_GetLastInterpolation</tabstop>
<tabstop>le_UpdateTime</tabstop>
<tabstop>pb_ResetStats</tabstop>
<tabstop>pb_StartStop</tabstop>
</tabstops>
<resources/>