Use data model for throttle src
This commit is contained in:
@@ -1113,6 +1113,9 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||||||
ui->toplcdTimer->hide();
|
ui->toplcdTimer->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->throttleSource->setModel(panelFilteredModels->getItemModel(FIM_THRSOURCE));
|
||||||
|
ui->throttleSource->setField(model.thrTraceSrc, this);
|
||||||
|
|
||||||
if (!firmware->getCapability(HasDisplayText)) {
|
if (!firmware->getCapability(HasDisplayText)) {
|
||||||
ui->displayText->hide();
|
ui->displayText->hide();
|
||||||
ui->editText->hide();
|
ui->editText->hide();
|
||||||
@@ -1279,14 +1282,6 @@ void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
|
|||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupPanel::on_throttleSource_currentIndexChanged(int index)
|
|
||||||
{
|
|
||||||
if (!lock) {
|
|
||||||
model->thrTraceSrc = ui->throttleSource->currentData().toUInt();
|
|
||||||
emit modified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetupPanel::on_throttleTrimSwitch_currentIndexChanged(int index)
|
void SetupPanel::on_throttleTrimSwitch_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
@@ -1345,28 +1340,6 @@ void SetupPanel::on_image_currentIndexChanged(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupPanel::populateThrottleSourceCB()
|
|
||||||
{
|
|
||||||
Board::Type board = firmware->getBoard();
|
|
||||||
lock = true;
|
|
||||||
ui->throttleSource->clear();
|
|
||||||
ui->throttleSource->addItem(tr("THR"), 0);
|
|
||||||
|
|
||||||
int idx = 1;
|
|
||||||
for (int i = 0; i < getBoardCapability(board, Board::Pots) + getBoardCapability(board, Board::Sliders); i++, idx++) {
|
|
||||||
if (RawSource(SOURCE_TYPE_STICK, 4 + i).isAvailable(model, &generalSettings, board)) {
|
|
||||||
ui->throttleSource->addItem(firmware->getAnalogInputName(4 + i), idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < firmware->getCapability(Outputs); i++, idx++) {
|
|
||||||
ui->throttleSource->addItem(RawSource(SOURCE_TYPE_CH, i).toString(model, &generalSettings), idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
int thrTraceSrcIdx = ui->throttleSource->findData(model->thrTraceSrc);
|
|
||||||
ui->throttleSource->setCurrentIndex(thrTraceSrcIdx);
|
|
||||||
lock = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetupPanel::populateThrottleTrimSwitchCB()
|
void SetupPanel::populateThrottleTrimSwitchCB()
|
||||||
{
|
{
|
||||||
Board::Type board = firmware->getBoard();
|
Board::Type board = firmware->getBoard();
|
||||||
@@ -1394,7 +1367,7 @@ void SetupPanel::update()
|
|||||||
{
|
{
|
||||||
ui->name->setText(model->name);
|
ui->name->setText(model->name);
|
||||||
ui->throttleReverse->setChecked(model->throttleReversed);
|
ui->throttleReverse->setChecked(model->throttleReversed);
|
||||||
populateThrottleSourceCB();
|
ui->throttleSource->updateValue();
|
||||||
populateThrottleTrimSwitchCB();
|
populateThrottleTrimSwitchCB();
|
||||||
ui->throttleWarning->setChecked(!model->disableThrottleWarning);
|
ui->throttleWarning->setChecked(!model->disableThrottleWarning);
|
||||||
ui->trimIncrement->setCurrentIndex(model->trimInc+2);
|
ui->trimIncrement->setCurrentIndex(model->trimInc+2);
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ class SetupPanel : public ModelPanel
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_name_editingFinished();
|
void on_name_editingFinished();
|
||||||
void on_throttleSource_currentIndexChanged(int index);
|
|
||||||
void on_throttleTrimSwitch_currentIndexChanged(int index);
|
void on_throttleTrimSwitch_currentIndexChanged(int index);
|
||||||
void on_throttleTrim_toggled(bool checked);
|
void on_throttleTrim_toggled(bool checked);
|
||||||
void on_extendedLimits_toggled(bool checked);
|
void on_extendedLimits_toggled(bool checked);
|
||||||
@@ -185,7 +184,6 @@ class SetupPanel : public ModelPanel
|
|||||||
void updateStartupSwitches();
|
void updateStartupSwitches();
|
||||||
void updatePotWarnings();
|
void updatePotWarnings();
|
||||||
void updateBeepCenter();
|
void updateBeepCenter();
|
||||||
void populateThrottleSourceCB();
|
|
||||||
void populateThrottleTrimSwitchCB();
|
void populateThrottleTrimSwitchCB();
|
||||||
int timersCount;
|
int timersCount;
|
||||||
int selectedTimerIndex;
|
int selectedTimerIndex;
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QComboBox" name="throttleSource">
|
<widget class="AutoComboBox" name="throttleSource">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|||||||
Reference in New Issue
Block a user