Ref T773, allow to clear/write log. from interpolation UI via buttons

This commit is contained in:
Klaus Basan
2020-02-14 00:41:31 +01:00
committed by Mat Sutcliffe
parent 33b3cd5461
commit 70e08fdf8b
4 changed files with 80 additions and 18 deletions

View File

@@ -76,13 +76,17 @@ namespace BlackGui
connect(ui->pb_StartStop, &QPushButton::released, this, &CInterpolationLogDisplay::toggleStartStop);
connect(ui->pb_ResetLastSent, &QPushButton::released, this, &CInterpolationLogDisplay::resetLastSentValues);
connect(ui->pb_ResetStats, &QPushButton::released, this, &CInterpolationLogDisplay::resetStatistics);
connect(ui->pb_ShowLogInSimulator, &QPushButton::released, this, &CInterpolationLogDisplay::showLogInSimulator);
connect(ui->pb_ShowLogInSimulator, &QPushButton::released, this, &CInterpolationLogDisplay::logPosCommand);
connect(ui->pb_FollowInSimulator, &QPushButton::released, this, &CInterpolationLogDisplay::followInSimulator);
connect(ui->pb_RequestElevation1, &QPushButton::released, this, &CInterpolationLogDisplay::requestElevationClicked);
connect(ui->pb_RequestElevation2, &QPushButton::released, this, &CInterpolationLogDisplay::requestElevationClicked);
connect(ui->pb_GetLastInterpolation, &QPushButton::released, this, &CInterpolationLogDisplay::getLogAmdDisplayLastInterpolation);
connect(ui->pb_InjectElevation, &QPushButton::released, this, &CInterpolationLogDisplay::onInjectElevation);
connect(ui->pb_ElvClear, &QPushButton::released, this, &CInterpolationLogDisplay::clearElevationResults);
connect(ui->pb_ClearLog, &QPushButton::released, this, &CInterpolationLogDisplay::clearLogCommand);
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->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);
@@ -180,6 +184,7 @@ namespace BlackGui
void CInterpolationLogDisplay::getLogAmdDisplayLastInterpolation()
{
if (!m_simulator) { return; }
const SituationLog sLog = m_simulator->interpolationLogger().getLastSituationLog();
this->displayLastInterpolation(sLog);
}
@@ -283,15 +288,6 @@ namespace BlackGui
}
}
void CInterpolationLogDisplay::showLogInSimulator()
{
if (m_callsign.isEmpty()) { return; }
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
const QString cmd = QStringLiteral(".drv pos ") % m_callsign.asString();
sGui->getIContextSimulator()->parseCommandLine(cmd, this->identifier());
}
void CInterpolationLogDisplay::followInSimulator()
{
if (m_callsign.isEmpty()) { return; }
@@ -479,13 +475,38 @@ namespace BlackGui
}
}
void CInterpolationLogDisplay::logPosCommand()
{
if (m_callsign.isEmpty()) { return; }
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
const QString cmd = QStringLiteral(".drv logint clear") % m_callsign.asString();
sGui->getIContextSimulator()->parseCommandLine(cmd, this->identifier());
}
void CInterpolationLogDisplay::clearLogCommand()
{
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
const QString cmd = QStringLiteral(".drv logint clear");
sGui->getIContextSimulator()->parseCommandLine(cmd, this->identifier());
}
void CInterpolationLogDisplay::writeLogCommand()
{
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
const QString cmd = QStringLiteral(".drv logint write");
sGui->getIContextSimulator()->parseCommandLine(cmd, this->identifier());
}
bool CInterpolationLogDisplay::checkLogPrerequisites()
{
CStatusMessage m;
do
{
if (!this->isVisible()) { return false; } // silently return
if (!sApp || sApp->isShuttingDown()) { break; } // stop and return
if (!sGui || sGui->isShuttingDown()) { break; } // stop and return
if (m_callsign.isEmpty())
{
// static const CStatusMessage ms = CStatusMessage(this).validationError(u"No callsign for logging");

View File

@@ -96,9 +96,6 @@ namespace BlackGui
//! Toggle start/stop
void toggleStartStop();
//! Display log in simulator
void showLogInSimulator();
//! Follow aircraft in simulator
void followInSimulator();
@@ -150,6 +147,14 @@ namespace BlackGui
//! Clear elevation results
void clearElevationResults();
//! Clear log. command
void clearLogCommand();
//! Write log. command
void writeLogCommand();
//! Display log in simulator
void logPosCommand();
//! Check if can do logging, otherwise stop and display message
bool checkLogPrerequisites();

View File

@@ -177,7 +177,7 @@
</item>
<item>
<widget class="QFrame" name="fr_LogStatus">
<layout class="QHBoxLayout" name="hl_LogCallsign" stretch="2,0,0,0,0,0">
<layout class="QHBoxLayout" name="hl_LogCallsign" stretch="2,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>3</number>
</property>
@@ -197,6 +197,20 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_WriteLogToFile">
<property name="text">
<string>write log.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_ClearLog">
<property name="text">
<string>clear log.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_ResetStats">
<property name="text">
@@ -664,6 +678,20 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_WriteLogToFile2">
<property name="text">
<string>write log.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_ClearLog2">
<property name="text">
<string>clear log.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_GetLastInterpolation">
<property name="text">
@@ -1018,6 +1046,8 @@
<tabstop>hs_UpdateTime</tabstop>
<tabstop>pb_StartStop</tabstop>
<tabstop>comp_CallsignCompleter</tabstop>
<tabstop>pb_WriteLogToFile</tabstop>
<tabstop>pb_ClearLog</tabstop>
<tabstop>pb_ResetStats</tabstop>
<tabstop>pb_ResetLastSent</tabstop>
<tabstop>pb_ShowLogInSimulator</tabstop>
@@ -1037,6 +1067,7 @@
<tabstop>le_ElevationReqRec</tabstop>
<tabstop>le_Elevation</tabstop>
<tabstop>le_SimulatorSpecific</tabstop>
<tabstop>le_InboundSituationsInfo</tabstop>
<tabstop>tvp_InboundAircraftSituations</tabstop>
<tabstop>tvp_InboundAircraftParts</tabstop>
<tabstop>tvp_Changes</tabstop>
@@ -1050,7 +1081,12 @@
<tabstop>tvp_InterpolatedAircraftSituations</tabstop>
<tabstop>tvp_LoopbackAircraftSituations</tabstop>
<tabstop>te_TextLog</tabstop>
<tabstop>pb_ElvClear</tabstop>
<tabstop>le_ElvHistoryCount</tabstop>
<tabstop>cb_ElvAllowPseudo</tabstop>
<tabstop>le_ElevationTestValue</tabstop>
<tabstop>pte_ElevationAtPosition</tabstop>
<tabstop>lv_ElevevationHistory</tabstop>
</tabstops>
<resources/>
<connections/>