Fixes suggested by Bertrand. ExtraChannels not yet removed

This commit is contained in:
Damjan Adamic
2014-04-15 19:12:29 +02:00
parent 52954b1be4
commit 6354b83a0d
2 changed files with 20 additions and 26 deletions
+19 -25
View File
@@ -5,7 +5,8 @@
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings): MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings), ModelPanel(parent, model, generalSettings),
mixInserted(false), HighlightedSource(0) mixInserted(false),
highlightedSource(0)
{ {
QGridLayout * mixesLayout = new QGridLayout(this); QGridLayout * mixesLayout = new QGridLayout(this);
@@ -46,20 +47,15 @@ QString MixesPanel::getChannelLabel(int curDest)
{ {
QString str; QString str;
int outputs = GetEepromInterface()->getCapability(Outputs); int outputs = GetEepromInterface()->getCapability(Outputs);
if (curDest > outputs) { str = QObject::tr("CH%1").arg(curDest);
str = QObject::tr("X%1 ").arg(curDest-outputs, 2, 10, QChar('0')); (str.length() < 4) ? str.append(" ") : str.append(" ");
} if (GetEepromInterface()->getCapability(HasChNames)) {
else { QString name = model.limitData[curDest-1].name;
str = QObject::tr("CH%1").arg(curDest, 2, 10, QChar('0')); if (!name.isEmpty()) {
str.append(" "); name = QString("(") + name + QString(")");
if (GetEepromInterface()->getCapability(HasChNames)) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
name.append(" ");
str += name.left(8);
} }
name.append(" ");
str += name.left(8);
} }
return str; return str;
} }
@@ -75,7 +71,7 @@ void MixesPanel::update()
unsigned int outputs = GetEepromInterface()->getCapability(Outputs); unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
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];
//std::cout << "md->destCh: " << md->destCh << std::endl; //qDebug() << "md->destCh: " << md->destCh;
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) {
@@ -86,7 +82,6 @@ void MixesPanel::update()
curDest++; curDest++;
} }
} }
while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) { while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) {
curDest++; curDest++;
AddMixerLine(-curDest); AddMixerLine(-curDest);
@@ -98,8 +93,6 @@ void MixesPanel::update()
bool MixesPanel::AddMixerLine(int dest) bool MixesPanel::AddMixerLine(int dest)
{ {
bool new_ch; bool new_ch;
//std::cout << "dest: " << dest << std::endl;
//QWidget *w = getMixerWidget(dest, &new_ch);
QString str = getMixerText(dest, &new_ch); QString str = getMixerText(dest, &new_ch);
QListWidgetItem *itm = new QListWidgetItem(); QListWidgetItem *itm = new QListWidgetItem();
itm->setData(Qt::UserRole, QByteArray(1, (quint8)dest)); itm->setData(Qt::UserRole, QByteArray(1, (quint8)dest));
@@ -113,11 +106,12 @@ bool MixesPanel::AddMixerLine(int dest)
#endif #endif
MixerlistWidget->addItem(itm); MixerlistWidget->addItem(itm);
MixerlistWidget->setItemWidget(itm, getMixerWidget(str)); MixerlistWidget->setItemWidget(itm, getMixerWidget(str));
std::cout << "MixesPanel::AddMixerLine(): " << str.toUtf8().constData() << std::endl; qDebug() << "MixesPanel::AddMixerLine(): " << str;
return new_ch; return new_ch;
} }
QWidget * MixesPanel::getMixerWidget(const QString & mixer_text) { QWidget * MixesPanel::getMixerWidget(const QString & mixer_text)
{
QLabel * l = new QLabel(); QLabel * l = new QLabel();
l->setFont(QFont("Courier New",12)); l->setFont(QFont("Courier New",12));
l->setTextFormat(Qt::RichText); l->setTextFormat(Qt::RichText);
@@ -135,7 +129,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if (dest < 0) { if (dest < 0) {
str = getChannelLabel(-dest); str = getChannelLabel(-dest);
//highlight channell if needed //highlight channell if needed
if (-dest == (int)HighlightedSource) { if (-dest == (int)highlightedSource) {
str = "<b>" + str + "</b>"; str = "<b>" + str + "</b>";
} }
} }
@@ -147,7 +141,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if ((dest == 0) || (model.mixData[dest-1].destCh != md->destCh)) { if ((dest == 0) || (model.mixData[dest-1].destCh != md->destCh)) {
*new_ch = 1; *new_ch = 1;
//highlight channell if needed //highlight channell if needed
if (md->destCh == HighlightedSource) { if (md->destCh == highlightedSource) {
str = "<b>" + str + "</b>"; str = "<b>" + str + "</b>";
} }
} }
@@ -162,7 +156,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
}; };
//highlight source if needed //highlight source if needed
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)HighlightedSource) ) { if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
str += " <b>" + Qt::escape(md->srcRaw.toString()) + "</b>"; str += " <b>" + Qt::escape(md->srcRaw.toString()) + "</b>";
} }
else { else {
@@ -426,8 +420,8 @@ void MixesPanel::mixerHighlight()
else { else {
dest = model.mixData[idx].destCh; dest = model.mixData[idx].destCh;
} }
HighlightedSource = ( (int)HighlightedSource == dest) ? 0 : dest; highlightedSource = ( (int)highlightedSource == dest) ? 0 : dest;
//std::cout << "MixesPanel::mixerHighlight(1): " << HighlightedSource << std::endl; qDebug() << "MixesPanel::mixerHighlight(): " << highlightedSource ;
for(int i=0; i<MixerlistWidget->count(); i++) { for(int i=0; i<MixerlistWidget->count(); i++) {
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0); int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
bool dummy; bool dummy;
+1 -1
View File
@@ -42,7 +42,7 @@ class MixesPanel : public ModelPanel
private: private:
MixersList *MixerlistWidget; MixersList *MixerlistWidget;
bool mixInserted; bool mixInserted;
unsigned int HighlightedSource; unsigned int highlightedSource;
int getMixerIndex(unsigned int dch); int getMixerIndex(unsigned int dch);
bool gm_insertMix(int idx); bool gm_insertMix(int idx);