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