mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
Ref T261, interpolator mode is now part of setup
* added attribute in setup * adjusted UI * adjusted interpolator / simulator functions
This commit is contained in:
committed by
Roland Winklmeier
parent
eb815ab987
commit
3d2a74a652
@@ -14,6 +14,7 @@
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
#include "blackmisc/simulation/interpolationsetuplist.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include <QPointer>
|
||||
|
||||
using namespace BlackGui::Views;
|
||||
using namespace BlackMisc;
|
||||
@@ -41,7 +42,13 @@ namespace BlackGui
|
||||
connect(ui->rb_Global, &QRadioButton::released, this, &CInterpolationSetupComponent::onModeChanged);
|
||||
|
||||
ui->rb_Global->setChecked(true);
|
||||
QTimer::singleShot(250, this, &CInterpolationSetupComponent::onModeChanged);
|
||||
|
||||
QPointer<CInterpolationSetupComponent> myself(this);
|
||||
QTimer::singleShot(250, this, [ = ]
|
||||
{
|
||||
if (myself.isNull()) { return; }
|
||||
this->onModeChanged();
|
||||
});
|
||||
}
|
||||
|
||||
CInterpolationSetupComponent::~CInterpolationSetupComponent()
|
||||
@@ -118,7 +125,13 @@ namespace BlackGui
|
||||
if (removed < 1) { return; } // nothing done
|
||||
const bool set = this->setSetupsToContext(setups);
|
||||
if (!set) { return; }
|
||||
QTimer::singleShot(100, this, &CInterpolationSetupComponent::displaySetupsPerCallsign);
|
||||
|
||||
QPointer<CInterpolationSetupComponent> myself(this);
|
||||
QTimer::singleShot(100, this, [ = ]
|
||||
{
|
||||
if (myself.isNull()) { return; }
|
||||
this->displaySetupsPerCallsign();
|
||||
});
|
||||
}
|
||||
|
||||
void CInterpolationSetupComponent::setUiValuesFromGlobal()
|
||||
@@ -137,7 +150,7 @@ namespace BlackGui
|
||||
|
||||
bool CInterpolationSetupComponent::checkPrerequisites()
|
||||
{
|
||||
if (!sGui || !sGui->getIContextSimulator())
|
||||
if (!sGui || !sGui->getIContextSimulator() || sGui->isShuttingDown())
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(this).validationError("No context");
|
||||
this->showOverlayMessage(m);
|
||||
@@ -154,7 +167,7 @@ namespace BlackGui
|
||||
|
||||
bool CInterpolationSetupComponent::setSetupsToContext(const CInterpolationSetupList &setups)
|
||||
{
|
||||
if (!sGui || !sGui->getIContextSimulator()) { return false; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return false; }
|
||||
if (setups == m_lastSetSetups) { return false; }
|
||||
sGui->getIContextSimulator()->setInterpolationAndRenderingSetupsPerCallsign(setups);
|
||||
m_lastSetSetups = setups;
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace BlackGui
|
||||
{
|
||||
connect(cb, &QCheckBox::stateChanged, this, &CInterpolationSetupForm::onCheckboxChanged);
|
||||
}
|
||||
|
||||
connect(ui->co_InterpolatorMode, &QComboBox::currentTextChanged, this, &CInterpolationSetupForm::onInterpolatorModeChanged);
|
||||
}
|
||||
|
||||
CInterpolationSetupForm::~CInterpolationSetupForm()
|
||||
@@ -41,6 +43,10 @@ namespace BlackGui
|
||||
ui->cb_ForceFullInterpolation->setChecked(setup.isForcingFullInterpolation());
|
||||
ui->cb_EnableGndFlag->setChecked(setup.isGndFlagEnabled());
|
||||
ui->cb_SendGndFlagToSim->setChecked(setup.sendGndFlagToSimulator());
|
||||
|
||||
const QString im = setup.getInterpolatorModeAsString();
|
||||
if (im.contains("linear", Qt::CaseInsensitive)) { ui->co_InterpolatorMode->setCurrentIndex(1); }
|
||||
else { ui->co_InterpolatorMode->setCurrentIndex(0); }
|
||||
}
|
||||
|
||||
CInterpolationAndRenderingSetupPerCallsign CInterpolationSetupForm::getValue() const
|
||||
@@ -52,6 +58,7 @@ namespace BlackGui
|
||||
setup.setLogInterpolation(ui->cb_LogInterpolation->isChecked());
|
||||
setup.setSendGndFlagToSimulator(ui->cb_SendGndFlagToSim->isChecked());
|
||||
setup.setSimulatorDebuggingMessages(ui->cb_DebugDriver->isChecked());
|
||||
setup.setInterpolatorMode(ui->co_InterpolatorMode->currentText());
|
||||
return setup;
|
||||
}
|
||||
|
||||
@@ -63,6 +70,7 @@ namespace BlackGui
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ForceFullInterpolation, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_EnableGndFlag, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_SendGndFlagToSim, readonly);
|
||||
ui->co_InterpolatorMode->setEnabled(!readonly);
|
||||
}
|
||||
|
||||
CStatusMessageList CInterpolationSetupForm::validate(bool nested) const
|
||||
@@ -76,5 +84,11 @@ namespace BlackGui
|
||||
Q_UNUSED(state);
|
||||
emit this->valueChanged();
|
||||
}
|
||||
|
||||
void CInterpolationSetupForm::onInterpolatorModeChanged(const QString &mode)
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
emit this->valueChanged();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -58,6 +58,9 @@ namespace BlackGui
|
||||
|
||||
//! Checkbox has been changed
|
||||
void onCheckboxChanged(int state);
|
||||
|
||||
//! Interpolator mode
|
||||
void onInterpolatorModeChanged(const QString &mode);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -7,21 +7,35 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>236</width>
|
||||
<height>75</height>
|
||||
<height>102</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cb_ForceFullInterpolation">
|
||||
<property name="text">
|
||||
<string>force full interpolation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="cb_DebugDriver">
|
||||
<property name="text">
|
||||
<string>driver dbg. msgs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cb_EnableGndFlag">
|
||||
<property name="text">
|
||||
<string>use gnd.flag</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_EnableParts">
|
||||
<property name="text">
|
||||
<string>enable parts</string>
|
||||
@@ -31,34 +45,34 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_ForceFullInterpolation">
|
||||
<property name="text">
|
||||
<string>force full interpolation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cb_DebugDriver">
|
||||
<property name="text">
|
||||
<string>driver dbg. msgs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cb_LogInterpolation">
|
||||
<property name="text">
|
||||
<string>log.interpolation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cb_SendGndFlagToSim">
|
||||
<property name="text">
|
||||
<string>send gnd.to simulator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="co_InterpolatorMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Spline interpolator</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Linear interpolator</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user