mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
UI interpolation setup form using radio buttons instead of combobox
This commit is contained in:
@@ -29,7 +29,8 @@ namespace BlackGui
|
||||
connect(cb, &QCheckBox::stateChanged, this, &CInterpolationSetupForm::onCheckboxChanged);
|
||||
}
|
||||
|
||||
connect(ui->co_InterpolatorMode, &QComboBox::currentTextChanged, this, &CInterpolationSetupForm::onInterpolatorModeChanged);
|
||||
// one conect is enough, otherwise 2 change signals
|
||||
connect(ui->rb_Linear, &QRadioButton::toggled, this, &CInterpolationSetupForm::onInterpolatorModeChanged);
|
||||
}
|
||||
|
||||
CInterpolationSetupForm::~CInterpolationSetupForm()
|
||||
@@ -43,10 +44,7 @@ namespace BlackGui
|
||||
ui->cb_ForceVtolInterpolation->setChecked(setup.isForcingVtolInterpolation());
|
||||
ui->cb_SendGndFlagToSim->setChecked(setup.isSendingGndFlagToSimulator());
|
||||
ui->cb_FixSceneryOffset->setChecked(setup.isFixingSceneryOffset());
|
||||
|
||||
const QString im = setup.getInterpolatorModeAsString();
|
||||
if (im.contains("linear", Qt::CaseInsensitive)) { ui->co_InterpolatorMode->setCurrentIndex(1); }
|
||||
else { ui->co_InterpolatorMode->setCurrentIndex(0); }
|
||||
this->setInterpolatorMode(setup.getInterpolatorMode());
|
||||
}
|
||||
|
||||
CInterpolationAndRenderingSetupPerCallsign CInterpolationSetupForm::getValue() const
|
||||
@@ -58,7 +56,7 @@ namespace BlackGui
|
||||
setup.setSendingGndFlagToSimulator(ui->cb_SendGndFlagToSim->isChecked());
|
||||
setup.setSimulatorDebuggingMessages(ui->cb_DebugDriver->isChecked());
|
||||
setup.setFixingSceneryOffset(ui->cb_FixSceneryOffset->isChecked());
|
||||
setup.setInterpolatorMode(ui->co_InterpolatorMode->currentText());
|
||||
setup.setInterpolatorMode(this->getInterpolatorMode());
|
||||
return setup;
|
||||
}
|
||||
|
||||
@@ -70,7 +68,8 @@ namespace BlackGui
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_ForceVtolInterpolation, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_SendGndFlagToSim, readonly);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FixSceneryOffset, readonly);
|
||||
ui->co_InterpolatorMode->setEnabled(!readonly);
|
||||
ui->rb_Linear->setEnabled(!readonly);
|
||||
ui->rb_Spline->setEnabled(!readonly);
|
||||
}
|
||||
|
||||
CStatusMessageList CInterpolationSetupForm::validate(bool nested) const
|
||||
@@ -85,9 +84,27 @@ namespace BlackGui
|
||||
emit this->valueChanged();
|
||||
}
|
||||
|
||||
void CInterpolationSetupForm::onInterpolatorModeChanged(const QString &mode)
|
||||
CInterpolationAndRenderingSetupBase::InterpolatorMode CInterpolationSetupForm::getInterpolatorMode() const
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
if (ui->rb_Linear->isChecked()) { return CInterpolationAndRenderingSetupBase::Linear; }
|
||||
return CInterpolationAndRenderingSetupBase::Spline;
|
||||
}
|
||||
|
||||
void CInterpolationSetupForm::setInterpolatorMode(CInterpolationAndRenderingSetupBase::InterpolatorMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case CInterpolationAndRenderingSetupBase::Linear : ui->rb_Linear->setChecked(true); break;
|
||||
case CInterpolationAndRenderingSetupBase::Spline:
|
||||
default:
|
||||
ui->rb_Spline->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CInterpolationSetupForm::onInterpolatorModeChanged(bool checked)
|
||||
{
|
||||
Q_UNUSED(checked);
|
||||
emit this->valueChanged();
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -60,7 +60,13 @@ namespace BlackGui
|
||||
void onCheckboxChanged(int state);
|
||||
|
||||
//! Interpolator mode
|
||||
void onInterpolatorModeChanged(const QString &mode);
|
||||
void onInterpolatorModeChanged(bool checked);
|
||||
|
||||
//! Mode from UI
|
||||
BlackMisc::Simulation::CInterpolationAndRenderingSetupBase::InterpolatorMode getInterpolatorMode() const;
|
||||
|
||||
//! Set mode
|
||||
void setInterpolatorMode(BlackMisc::Simulation::CInterpolationAndRenderingSetupBase::InterpolatorMode mode);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>231</width>
|
||||
<height>96</height>
|
||||
<width>223</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -40,24 +40,10 @@
|
||||
</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>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cb_SendGndFlagToSim">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_EnableParts">
|
||||
<property name="text">
|
||||
<string>send gnd.to simulator</string>
|
||||
<string>enable parts</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@@ -81,18 +67,75 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_EnableParts">
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cb_SendGndFlagToSim">
|
||||
<property name="text">
|
||||
<string>enable parts</string>
|
||||
<string>send gnd.to simulator</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="wi_InterpolatorType" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_InterpolatorType">
|
||||
<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="QRadioButton" name="rb_Spline">
|
||||
<property name="text">
|
||||
<string>spline</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_Linear">
|
||||
<property name="text">
|
||||
<string>linear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_InterpolatorType">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>rb_Spline</tabstop>
|
||||
<tabstop>cb_EnableParts</tabstop>
|
||||
<tabstop>cb_SendGndFlagToSim</tabstop>
|
||||
<tabstop>cb_FixSceneryOffset</tabstop>
|
||||
<tabstop>cb_ForceVtolInterpolation</tabstop>
|
||||
<tabstop>cb_DebugDriver</tabstop>
|
||||
<tabstop>cb_LogInterpolation</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user