From 573858552c7abf97bba5be4ce032af5857ba73b6 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 3 May 2014 11:00:56 +0200 Subject: [PATCH] Fixes #1052 --- companion/src/eeprominterface.cpp | 11 +++++++++++ companion/src/eeprominterface.h | 2 ++ companion/src/helpers.cpp | 8 +++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 868e107ce..5c3f6ff40 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -1003,6 +1003,17 @@ ExpoData * ModelData::insertInput(const int idx) return &expoData[idx]; } +bool ModelData::isInputValid(const unsigned int idx) const +{ + for (int i=0; imode == 0) break; + if (expo->chn == idx) + return true; + } + return false; +} + void ModelData::removeInput(const int idx) { memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData)); diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index ddf770469..d7d655624 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -939,6 +939,8 @@ class ModelData { ExpoData * insertInput(const int idx); void removeInput(const int idx); + bool isInputValid(const unsigned int idx) const; + bool used; char name[12+1]; uint8_t modelVoice; diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 836dee391..8522773d4 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -548,9 +548,11 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData & if (flags & POPULATE_VIRTUAL_INPUTS) { int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs); for (int i=0; iaddItem(item.toString(), item.toValue()); - if (item == source) b->setCurrentIndex(b->count()-1); + if (model.isInputValid(i)) { + item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model); + b->addItem(item.toString(), item.toValue()); + if (item == source) b->setCurrentIndex(b->count()-1); + } } }