Issue #855 fixed
This commit is contained in:
@@ -491,6 +491,8 @@ int OpenTxInterface::getCapability(const Capability capability)
|
||||
case FlightModesName:
|
||||
case GvarsName:
|
||||
return (IS_TARANIS(board) ? 10 : 6);
|
||||
case HasChNames:
|
||||
return (IS_TARANIS(board) ? 1 : 0);
|
||||
case GvarsInCS:
|
||||
case HasFAIMode:
|
||||
return 1;
|
||||
|
||||
@@ -43,6 +43,29 @@ MixesPanel::~MixesPanel()
|
||||
{
|
||||
}
|
||||
|
||||
QString MixesPanel::getChannelLabel(int curDest)
|
||||
{
|
||||
QString str;
|
||||
unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
|
||||
if (curDest > outputs) {
|
||||
str = QObject::tr("X%1 ").arg(curDest-outputs);
|
||||
}
|
||||
else {
|
||||
str = QObject::tr("CH%1").arg(curDest);
|
||||
str.append(" ");
|
||||
str = str.left(4);
|
||||
if (GetEepromInterface()->getCapability(HasChNames)) {
|
||||
QString name = model.limitData[curDest-1].name;
|
||||
if (!name.isEmpty()) {
|
||||
name = QString("(") + name + QString(")");
|
||||
}
|
||||
name.append(" ");
|
||||
str += name.left(8);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void MixesPanel::update()
|
||||
{
|
||||
// curDest -> destination channel4
|
||||
@@ -52,26 +75,13 @@ void MixesPanel::update()
|
||||
unsigned int curDest = 0;
|
||||
int i;
|
||||
unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
|
||||
int showNames = false; // TODO in a menu ui->showNames_Ckb->isChecked();
|
||||
for (i=0; i<GetEepromInterface()->getCapability(Mixes); i++) {
|
||||
MixData *md = &model.mixData[i];
|
||||
if ((md->destCh==0) || (md->destCh>outputs+(unsigned int)GetEepromInterface()->getCapability(ExtraChannels))) continue;
|
||||
QString str = "";
|
||||
while (curDest<(md->destCh-1)) {
|
||||
while (curDest < md->destCh-1) {
|
||||
curDest++;
|
||||
if (curDest > outputs) {
|
||||
str = tr("X%1 ").arg(curDest-outputs);
|
||||
}
|
||||
else {
|
||||
str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
|
||||
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
|
||||
QString name=model.limitData[curDest-1].name;
|
||||
if (!name.isEmpty()) {
|
||||
name.append(" ");
|
||||
str=name.left(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
str = getChannelLabel(curDest);
|
||||
qba.clear();
|
||||
qba.append((quint8)-curDest);
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
@@ -79,23 +89,12 @@ void MixesPanel::update()
|
||||
MixerlistWidget->addItem(itm);
|
||||
}
|
||||
|
||||
if (md->destCh > outputs) {
|
||||
str = tr("X%1 ").arg(md->destCh-outputs);
|
||||
}
|
||||
else {
|
||||
str = tr("CH%1%2").arg(md->destCh/10).arg(md->destCh%10);
|
||||
str.append(" ");
|
||||
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
|
||||
QString name=model.limitData[md->destCh-1].name;
|
||||
if (!name.isEmpty()) {
|
||||
name.append(" ");
|
||||
str=name.left(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
str = getChannelLabel(md->destCh);
|
||||
|
||||
if (curDest != md->destCh) {
|
||||
curDest = md->destCh;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
str.fill(' ');
|
||||
}
|
||||
|
||||
@@ -154,21 +153,7 @@ void MixesPanel::update()
|
||||
|
||||
while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) {
|
||||
curDest++;
|
||||
QString str;
|
||||
|
||||
if (curDest > outputs) {
|
||||
str = tr("X%1 ").arg(curDest-outputs);
|
||||
}
|
||||
else {
|
||||
str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
|
||||
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
|
||||
QString name=model.limitData[curDest-1].name;
|
||||
if (!name.isEmpty()) {
|
||||
name.append(" ");
|
||||
str=name.left(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
QString str = getChannelLabel(curDest);
|
||||
qba.clear();
|
||||
qba.append((quint8)-curDest);
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
|
||||
@@ -50,7 +50,7 @@ class MixesPanel : public ModelPanel
|
||||
void mixersDeleteList(QList<int> list);
|
||||
QList<int> createMixListFromSelected();
|
||||
void setSelectedByMixList(QList<int> list);
|
||||
|
||||
QString getChannelLabel(int curDest);
|
||||
};
|
||||
|
||||
#endif // MIXES_H
|
||||
|
||||
Reference in New Issue
Block a user