mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Log. can also be triggered from internals UI
This commit is contained in:
committed by
Roland Winklmeier
parent
740de9786f
commit
fd2f63f246
@@ -44,6 +44,7 @@ using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Context;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -78,6 +79,7 @@ namespace BlackGui
|
||||
connect(ui->pb_LatestInterpolationLog, &QPushButton::pressed, this, &CInternalsComponent::showLogFiles);
|
||||
connect(ui->pb_LatestPartsLog, &QPushButton::pressed, this, &CInternalsComponent::showLogFiles);
|
||||
connect(ui->pb_RequestFromNetwork, &QPushButton::pressed, this, &CInternalsComponent::requestPartsFromNetwork);
|
||||
connect(ui->pb_DisplayLog, &QPushButton::pressed, this, &CInternalsComponent::displayLogInSimulator);
|
||||
|
||||
connect(ui->comp_RemoteAircraftSelector, &CRemoteAircraftSelector::changedCallsign, this, &CInternalsComponent::selectorChanged);
|
||||
this->contextFlagsToGui();
|
||||
@@ -249,8 +251,10 @@ namespace BlackGui
|
||||
CLogMessage(this).info("Request aircraft config for '%1'") << callsign.asString();
|
||||
|
||||
// simple approach to update UI when parts are received
|
||||
QTimer::singleShot(3000, this, [this]
|
||||
const QPointer<CInternalsComponent> myself(this);
|
||||
QTimer::singleShot(3000, this, [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
ui->pb_CurrentParts->click();
|
||||
ui->pb_RequestFromNetwork->setEnabled(true);
|
||||
});
|
||||
@@ -261,6 +265,22 @@ namespace BlackGui
|
||||
this->setCurrentParts();
|
||||
}
|
||||
|
||||
void CInternalsComponent::displayLogInSimulator()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
if (!sGui->getIContextSimulator()) { return; }
|
||||
const CCallsign callsign(ui->comp_RemoteAircraftSelector->getSelectedCallsign());
|
||||
if (callsign.isEmpty())
|
||||
{
|
||||
CLogMessage(this).validationError("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());
|
||||
|
||||
@@ -68,6 +68,9 @@ namespace BlackGui
|
||||
//! Selector has been changed
|
||||
void selectorChanged();
|
||||
|
||||
//! Log in simulator
|
||||
void displayLogInSimulator();
|
||||
|
||||
//! Set the context flags
|
||||
void contextFlagsToGui();
|
||||
|
||||
|
||||
@@ -347,15 +347,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_PartsNetwork">
|
||||
<property name="text">
|
||||
<string>Network:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="wi_PartsNetwork" native="true">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QWidget" name="wi_Parts" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_PartsNetwork">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
@@ -369,7 +362,27 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<item>
|
||||
<spacer name="hs_Parts">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_DisplayLog">
|
||||
<property name="text">
|
||||
<string>display log.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_RequestFromNetwork">
|
||||
<property name="toolTip">
|
||||
<string>Request from network</string>
|
||||
|
||||
Reference in New Issue
Block a user