Corrections on Curves in MixerDialog and ExpoDialog (introduction of

CurveGroup to share code)
This commit is contained in:
Bertrand Songis
2014-01-15 11:50:00 +01:00
parent 0f0db5e1d3
commit 888895b60b
11 changed files with 249 additions and 94 deletions
+19 -6
View File
@@ -51,9 +51,11 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
}
populateSwitchCB(ui->switchesCB,ed->swtch);
populateCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, 0);
ui->modeCB->setCurrentIndex(ed->mode-1);
// TODO keep this group, same in MixerDialog
CurveGroup * curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
ui->sideCB->setCurrentIndex(ed->mode-1);
ui->label_expo->hide();
@@ -77,6 +79,19 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
}
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->sideLabel->hide();
ui->sideCB->hide();
}
else {
ui->sourceLabel->hide();
ui->sourceCB->hide();
ui->scaleLabel->hide();
ui->scaleSB->hide();
ui->trimLabel->hide();
ui->trimCB->hide();
}
int expolength=GetEepromInterface()->getCapability(HasExpoNames);
if (!expolength) {
ui->label_name->hide();
@@ -101,7 +116,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->modeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->sideCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->expoGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
for (int i=0; i<9; i++) {
@@ -164,15 +179,13 @@ void ExpoDialog::valuesChanged()
{
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
retrieveCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, 0);
if (ui->weightGV->isChecked()) {
ed->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
} else {
ed->weight = ui->weightSB->value();
}
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->modeCB->currentIndex() + 1;
ed->mode = ui->sideCB->currentIndex() + 1;
int i=0;
for (i=0; i<ui->expoName->text().toAscii().length(); i++) {
ed->name[i]=ui->expoName->text().toAscii().at(i);
+81 -16
View File
@@ -44,14 +44,14 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Weight</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
<item>
<widget class="QCheckBox" name="weightGV">
@@ -85,14 +85,14 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_expo">
<property name="text">
<string>Expo</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,1,0">
<item>
<widget class="QCheckBox" name="expoGV">
@@ -126,14 +126,14 @@
</item>
</layout>
</item>
<item row="3" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_phases">
<property name="text">
<string>Flight modes</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="6" column="1">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="lb_FP0">
@@ -290,14 +290,14 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Switch</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="switchesCB">
<property name="whatsThis">
<string>Switch used by the expo.
@@ -305,14 +305,14 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_curves">
<property name="text">
<string>Curve</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0">
<item>
<widget class="QComboBox" name="curveTypeCB">
@@ -343,15 +343,15 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<item row="9" column="0">
<widget class="QLabel" name="sideLabel">
<property name="text">
<string>Stick Side</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="modeCB">
<item row="9" column="1">
<widget class="QComboBox" name="sideCB">
<item>
<property name="text">
<string>NEG</string>
@@ -369,7 +369,7 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</item>
</widget>
</item>
<item row="8" column="0" colspan="2">
<item row="11" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
@@ -388,7 +388,7 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="10" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -401,6 +401,71 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="sourceCB">
<property name="whatsThis">
<string>The source for the mixer</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="trimCB">
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="sourceLabel">
<property name="text">
<string>Source</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="trimLabel">
<property name="text">
<string>Include Trim</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="scaleLabel">
<property name="text">
<string>Scale</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="scaleSB">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Delay ans Slow&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600; text-decoration: underline;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;These values control the speed and delay of the output of the mix. &lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If Delay is not zero the actuation of the mix will be delayed by the specified amount of seconds.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If Slow is not zero then the speed of the mix will be set by the value specified -&amp;gt; the value states the number of seconds it takes to transit from -100 to 100.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="decimals">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
+10 -11
View File
@@ -76,19 +76,18 @@ void InputsPanel::update()
str = " ";
}
switch (md->mode) {
case (1): str += " <-"; break;
case (2): str += " ->"; break;
default: str += " "; break;
};
str += tr("Weight(%1)").arg(getGVarString(md->weight));
QString curveStr = md->curve.toString();
if (!curveStr.isEmpty()) {
str += " " + curveStr;
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
switch (md->mode) {
case (1): str += " <-"; break;
case (2): str += " ->"; break;
default: str += " "; break;
};
}
str += " " + tr("Weight(%1)").arg(getGVarString(md->weight));
if (md->curve.value) str += " " + md->curve.toString();
if (GetEepromInterface()->getCapability(FlightPhases)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) {
+1 -10
View File
@@ -70,7 +70,7 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
ui->offsetCB->hide();
}
populateCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, 0);
CurveGroup * curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve);
ui->MixDR_CB->setChecked(md->noExpo==0);
if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) {
@@ -143,12 +143,6 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->offsetCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveTypeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveGVarCB,SIGNAL(stateChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveValueCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveValueSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->offsetSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged())); // TODO why the same slot?
@@ -249,9 +243,6 @@ void MixerDialog::valuesChanged()
}
md->carryTrim = -(ui->trimCB->currentIndex()-1);
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
retrieveCurveReference(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, 0);
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
md->mixWarn = ui->warningCB->currentIndex();
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();