From c5b0e79e9974a974f86c318d6870eaad708483a0 Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 25 Mar 2014 19:18:28 +0100 Subject: [PATCH] Issue #860 fixed --- companion/src/helpers.cpp | 2 +- companion/src/modeledit/channels.cpp | 23 +++++++++++++++++++++++ companion/src/modeledit/channels.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 381aded98..62a383dbd 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -246,7 +246,7 @@ void CurveGroup::update() if (lastType != curve.type) { lastType = curve.type; curveValueCB->clear(); - for (int i=-numcurves; iaddItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString()); } } diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index 070a0fcdc..3a6904b48 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -18,6 +18,8 @@ Channels::Channels(QWidget * parent, ModelData & model): addLabel(gridLayout, tr("Min"), col++); addLabel(gridLayout, tr("Max"), col++); addLabel(gridLayout, tr("Invert"), col++); + if (IS_TARANIS(GetEepromInterface()->getBoard())) + addLabel(gridLayout, tr("Curve"), col++); if (GetEepromInterface()->getCapability(PPMCenter)) addLabel(gridLayout, tr("Center"), col++); if (GetEepromInterface()->getCapability(SYMLimits)) @@ -88,6 +90,19 @@ Channels::Channels(QWidget * parent, ModelData & model): connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited())); gridLayout->addWidget(invCB, i+1, col++, 1, 1); + // Curve + if (IS_TARANIS(GetEepromInterface()->getBoard())) { + QComboBox * curveCB = new QComboBox(this); + curveCB->setProperty("index", i); + int numcurves = GetEepromInterface()->getCapability(NumCurves); + for (int j=-numcurves; j<=numcurves; j++) { + curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j); + } + curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves); + connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited())); + gridLayout->addWidget(curveCB, i+1, col++, 1, 1); + } + // PPM center if (GetEepromInterface()->getCapability(PPMCenter)) { QSpinBox * center = new QSpinBox(this); @@ -168,6 +183,14 @@ void Channels::invEdited() emit modified(); } +void Channels::curveEdited() +{ + QComboBox *cb = qobject_cast(sender()); + int index = cb->property("index").toInt(); + model.limitData[index].curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, cb->itemData(cb->currentIndex()).toInt()); + emit modified(); +} + void Channels::ppmcenterEdited() { QSpinBox *sb = qobject_cast(sender()); diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h index ee372ecd7..1d44db8bd 100644 --- a/companion/src/modeledit/channels.h +++ b/companion/src/modeledit/channels.h @@ -18,6 +18,7 @@ class Channels : public ModelPanel void minEdited(); void maxEdited(); void invEdited(); + void curveEdited(); void ppmcenterEdited(); };