Add channel names on companion failsafe sliders (fix #3021), remove redundant stuff

This commit is contained in:
Andre Bernet
2015-11-01 14:06:49 +04:00
parent 1641db873d
commit 58216ec8b0
7 changed files with 14 additions and 8 deletions
+1
View File
@@ -13,6 +13,7 @@ Notice: version 2.1.4 was sipped by the OpenTX team to avoid confusion with the
<li>Fixed wrong import of Logical switches from OpenTX 2.0.x version (<a href=https://github.com/opentx/opentx/issues/2942>#2942</a>)</li>
<li>Fixed a problem with updates path on Windows (<a href=https://github.com/opentx/opentx/issues/2876>#2876</a>)</li>
<li>Edge representation unified (changed from "no release" to "instant") (<a href=https://github.com/opentx/opentx/issues/2837>#2837</a>)</li>
<li>Added channel names on failsafe sliders (<a href=https://github.com/opentx/opentx/issues/3021>#3021</a>)</li>
<li>Corrected failsafe mapping when using Custom failsafe mode, D16 protocol and channel range different from from 1-8.
Users with such setups are advised to re-check their failsafe settings (<a href=https://github.com/opentx/opentx/issues/2975>#2975</a>)</li>
<li>Various texts and translations corrections</li>
-1
View File
@@ -1300,7 +1300,6 @@ enum Capability {
HasExpoNames,
HasNoExpo,
HasMixerNames,
HasChNames,
HasCvNames,
HasPxxCountry,
HasPPMStart,
@@ -578,8 +578,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
return (IS_TARANIS(board) ? 10 : 6);
case GvarsName:
return (IS_9X(board) ? 0 : 6);
case HasChNames:
return (IS_TARANIS(board) ? 1 : 0);
case GvarsInCS:
case HasFAIMode:
return 1;
+9 -1
View File
@@ -193,12 +193,12 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
spinbox->setDecimals(1);
label->setProperty("index", i);
spinbox->setProperty("index", i);
failsafeSpins << spinbox;
ui->failsafesLayout->addWidget(label, 3*(i/8), i%8, Qt::AlignHCenter);
ui->failsafesLayout->addWidget(combo, 1+3*(i/8), i%8, Qt::AlignHCenter);
ui->failsafesLayout->addWidget(spinbox, 2+3*(i/8), i%8, Qt::AlignHCenter);
failsafeGroups[i].combo = combo;
failsafeGroups[i].spinbox = spinbox;
failsafeGroups[i].label = label;
updateFailsafe(i);
connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(onFailsafeComboIndexChanged(int)));
connect(spinbox, SIGNAL(valueChanged(double)), this, SLOT(onFailsafeSpinChanged(double)));
@@ -302,6 +302,14 @@ void ModulePanel::update()
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setCurrentIndex(module.failsafeMode);
ui->failsafesFrame->setEnabled(module.failsafeMode == FAILSAFE_CUSTOM);
if (firmware->getCapability(ChannelsName) > 0) {
for(int i=0; i<maxChannels;i++) {
QString name = QString(model->limitData[i+module.channelsStart].name).trimmed();
if (!name.isEmpty()) {
failsafeGroups[i].label->setText(name);
}
}
}
}
else {
mask = 0;
+1 -1
View File
@@ -45,6 +45,7 @@ class ModulePanel : public ModelPanel
struct ChannelFailsafeWidgetsGroup {
QComboBox * combo;
QDoubleSpinBox * spinbox;
QLabel * label;
};
Q_OBJECT
@@ -75,7 +76,6 @@ class ModulePanel : public ModelPanel
ModuleData & module;
int moduleIdx;
Ui::Module *ui;
QVector<QDoubleSpinBox *> failsafeSpins;
ChannelFailsafeWidgetsGroup failsafeGroups[maxChannels];
};
+2 -2
View File
@@ -57,7 +57,7 @@ QString ModelPrinter::printChannelName(int idx)
QString ModelPrinter::printOutputName(int idx)
{
QString name = QString(model.limitData[idx].name).trimmed();
if (firmware->getCapability(HasChNames) && !name.isEmpty()) {
if (firmware->getCapability(ChannelsName) > 0 && !name.isEmpty()) {
return name;
}
else {
@@ -313,7 +313,7 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
QString ModelPrinter::printMixerName(int curDest)
{
QString str = printChannelName(curDest-1) + " ";
if (firmware->getCapability(HasChNames)) {
if (firmware->getCapability(ChannelsName) > 0) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
+1 -1
View File
@@ -270,7 +270,7 @@ QString MultiModelPrinter::printLimits()
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'>" \
"<tr>" \
" <td><b>" + tr("Channel") + "</b></td>" \
" <td><b>" + (firmware->getCapability(HasChNames) ? tr("Name") : "") + "</b></td>" \
" <td><b>" + (firmware->getCapability(ChannelsName) > 0 ? tr("Name") : "") + "</b></td>" \
" <td><b>" + tr("Offset") + "</b></td>" \
" <td><b>" + tr("Min") + "</b></td>" \
" <td><b>" + tr("Max") + "</b></td>" \