mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Ref T372, interpolation log.display show min/max/mean times and allow to stop by entering empty callsign
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include "blackcore/context/contextnetworkimpl.h"
|
#include "blackcore/context/contextnetworkimpl.h"
|
||||||
#include "blackcore/context/contextsimulator.h"
|
#include "blackcore/context/contextsimulator.h"
|
||||||
#include "blackcore/airspacemonitor.h"
|
#include "blackcore/airspacemonitor.h"
|
||||||
|
#include "blackmisc/timestampobjectlist.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
@@ -55,7 +56,7 @@ namespace BlackGui
|
|||||||
ui->tvp_InboundAircraftSituations->setWithMenuRequestElevation(true);
|
ui->tvp_InboundAircraftSituations->setWithMenuRequestElevation(true);
|
||||||
|
|
||||||
connect(&m_updateTimer, &QTimer::timeout, this, &CInterpolationLogDisplay::updateLog);
|
connect(&m_updateTimer, &QTimer::timeout, this, &CInterpolationLogDisplay::updateLog);
|
||||||
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validCallsignEntered, this, &CInterpolationLogDisplay::onCallsignEntered);
|
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::editingFinished, this, &CInterpolationLogDisplay::onCallsignEntered);
|
||||||
connect(ui->hs_UpdateTime, &QSlider::valueChanged, this, &CInterpolationLogDisplay::onSliderChanged);
|
connect(ui->hs_UpdateTime, &QSlider::valueChanged, this, &CInterpolationLogDisplay::onSliderChanged);
|
||||||
connect(ui->pb_StartStop, &QPushButton::released, this, &CInterpolationLogDisplay::toggleStartStop);
|
connect(ui->pb_StartStop, &QPushButton::released, this, &CInterpolationLogDisplay::toggleStartStop);
|
||||||
connect(ui->pb_ResetLastSent, &QPushButton::released, this, &CInterpolationLogDisplay::resetLastSentValues);
|
connect(ui->pb_ResetLastSent, &QPushButton::released, this, &CInterpolationLogDisplay::resetLastSentValues);
|
||||||
@@ -195,29 +196,32 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInterpolationLogDisplay::onCallsignEntered()
|
void CInterpolationLogDisplay::onCallsignEntered()
|
||||||
{
|
{
|
||||||
const CCallsign cs = ui->comp_CallsignCompleter->getCallsign();
|
|
||||||
if (!m_simulator)
|
if (!m_simulator)
|
||||||
{
|
{
|
||||||
this->stop();
|
this->stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CCallsign cs = ui->comp_CallsignCompleter->getCallsign();
|
||||||
if (m_callsign == cs) { return; }
|
if (m_callsign == cs) { return; }
|
||||||
|
|
||||||
|
// empty callsign, just stop
|
||||||
|
if (cs.isEmpty())
|
||||||
|
{
|
||||||
|
this->stop();
|
||||||
|
m_callsign.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// clear last callsign
|
// clear last callsign
|
||||||
if (!m_callsign.isEmpty())
|
if (!m_callsign.isEmpty())
|
||||||
{
|
{
|
||||||
m_simulator->setLogInterpolation(false, m_callsign); // stop logging "old" callsign
|
m_simulator->setLogInterpolation(false, m_callsign); // stop logging "old" callsign
|
||||||
m_callsign = CCallsign(); // clear callsign
|
m_callsign.clear(); // clear callsign
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set new callsign or stop
|
// set new callsign or stop
|
||||||
if (cs.isEmpty())
|
|
||||||
{
|
|
||||||
this->stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_callsign = cs;
|
m_callsign = cs;
|
||||||
m_simulator->setLogInterpolation(true, cs);
|
m_simulator->setLogInterpolation(true, cs);
|
||||||
if (!this->start())
|
if (!this->start())
|
||||||
@@ -299,12 +303,17 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInterpolationLogDisplay::onSituationAdded(const CAircraftSituation &situation)
|
void CInterpolationLogDisplay::onSituationAdded(const CAircraftSituation &situation)
|
||||||
{
|
{
|
||||||
|
static const QString info("times: %1 offset %2");
|
||||||
|
|
||||||
const CCallsign cs = situation.getCallsign();
|
const CCallsign cs = situation.getCallsign();
|
||||||
if (!this->logCallsign(cs)) { return; }
|
if (!this->logCallsign(cs)) { return; }
|
||||||
const CAircraftSituationList situations = m_airspaceMonitor->remoteAircraftSituations(cs);
|
const CAircraftSituationList situations = m_airspaceMonitor->remoteAircraftSituations(cs);
|
||||||
|
const MillisecondsMinMaxMean tsDiffMsMinMaxMean = situations.getTimestampDifferenceMinMaxMean();
|
||||||
|
const MillisecondsMinMaxMean offsetMsMinMaxMean = situations.getOffsetMinMaxMean();
|
||||||
const CAircraftSituationChangeList changes = m_airspaceMonitor->remoteAircraftSituationChanges(cs);
|
const CAircraftSituationChangeList changes = m_airspaceMonitor->remoteAircraftSituationChanges(cs);
|
||||||
ui->tvp_InboundAircraftSituations->updateContainerAsync(situations);
|
ui->tvp_InboundAircraftSituations->updateContainerAsync(situations);
|
||||||
ui->tvp_Changes->updateContainerMaybeAsync(changes);
|
ui->tvp_Changes->updateContainerMaybeAsync(changes);
|
||||||
|
ui->le_InboundSituationsInfo->setText(info.arg(tsDiffMsMinMaxMean.asString(), offsetMsMinMaxMean.asString()));
|
||||||
ui->led_Situation->blink();
|
ui->led_Situation->blink();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,8 +401,8 @@ namespace BlackGui
|
|||||||
if (!sApp || sApp->isShuttingDown()) { break; } // stop and return
|
if (!sApp || sApp->isShuttingDown()) { break; } // stop and return
|
||||||
if (m_callsign.isEmpty())
|
if (m_callsign.isEmpty())
|
||||||
{
|
{
|
||||||
static const CStatusMessage ms = CStatusMessage(this).validationError("No callsign");
|
// static const CStatusMessage ms = CStatusMessage(this).validationError("No callsign for logging");
|
||||||
m = ms;
|
// m = ms;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -531,6 +531,13 @@
|
|||||||
<string>Inbound situations from network</string>
|
<string>Inbound situations from network</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vl_InboundSituations">
|
<layout class="QVBoxLayout" name="vl_InboundSituations">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_InboundSituationsInfo">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Views::CAircraftSituationView" name="tvp_InboundAircraftSituations">
|
<widget class="BlackGui::Views::CAircraftSituationView" name="tvp_InboundAircraftSituations">
|
||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
|
|||||||
Reference in New Issue
Block a user