diff --git a/companion/src/modelslist.cpp b/companion/src/modelslist.cpp index 8e5f82369..d606e7e74 100644 --- a/companion/src/modelslist.cpp +++ b/companion/src/modelslist.cpp @@ -722,20 +722,22 @@ void TreeModel::refresh() } int protocol; QString rxs; - for (unsigned j=0; j 0) { + if (protocol != PULSES_OFF && moduleData.modelId > 0) { if (!rxs.isEmpty()) { rxs.append(", "); } - unsigned mdlidx = model.moduleData[j].modelId; + unsigned mdlidx = moduleData.modelId; rxs.append(QString("%1").arg(uint(mdlidx), 2, 10, QChar('0'))); - if (!isModelIdUnique(mdlidx)) { + if (!isModelIdUnique(mdlidx, moduleIdx, protocol)) { current->setHighlightRX(true); } } + moduleIdx++; } current->setData(currentColumn++, rxs); } @@ -746,17 +748,16 @@ void TreeModel::refresh() } } -bool TreeModel::isModelIdUnique(unsigned modelIdx) +bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol) { int cnt = 0; - for (unsigned i=0; imodels.size(); i++) { - ModelData & model = radioData->models[i]; + for (auto const& model: radioData->models) { if (!model.isEmpty()) { - for (unsigned j=0; j 1) { - return false; - } + unsigned moduleIdx = 0; + const ModuleData& moduleData = model.moduleData[module]; + if (moduleData.protocol == protocol && moduleData.modelId == modelIdx) { + if (++cnt > 1) { + return false; } } } diff --git a/companion/src/modelslist.h b/companion/src/modelslist.h index d7e60684c..135e8b28d 100644 --- a/companion/src/modelslist.h +++ b/companion/src/modelslist.h @@ -149,7 +149,7 @@ class TreeModel : public QAbstractItemModel private: TreeItem * getItem(const QModelIndex & index) const; - bool isModelIdUnique(unsigned modelId); + bool isModelIdUnique(unsigned modelId, unsigned module, unsigned protocol); TreeItem * rootItem; RadioData * radioData;