match module as well, not just protocol (#6794)
This commit is contained in:
committed by
Bertrand Songis
parent
7941c8b2b5
commit
5afe15be83
@@ -722,6 +722,7 @@ void TreeModel::refresh()
|
|||||||
}
|
}
|
||||||
int protocol;
|
int protocol;
|
||||||
QString rxs;
|
QString rxs;
|
||||||
|
unsigned moduleIdx = 0;
|
||||||
for (auto const& moduleData: model.moduleData) {
|
for (auto const& moduleData: model.moduleData) {
|
||||||
protocol = moduleData.protocol;
|
protocol = moduleData.protocol;
|
||||||
// These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues
|
// These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues
|
||||||
@@ -732,10 +733,11 @@ void TreeModel::refresh()
|
|||||||
}
|
}
|
||||||
unsigned mdlidx = moduleData.modelId;
|
unsigned mdlidx = moduleData.modelId;
|
||||||
rxs.append(QString("%1").arg(uint(mdlidx), 2, 10, QChar('0')));
|
rxs.append(QString("%1").arg(uint(mdlidx), 2, 10, QChar('0')));
|
||||||
if (!isModelIdUnique(mdlidx, protocol)) {
|
if (!isModelIdUnique(mdlidx, moduleIdx, protocol)) {
|
||||||
current->setHighlightRX(true);
|
current->setHighlightRX(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
moduleIdx++;
|
||||||
}
|
}
|
||||||
current->setData(currentColumn++, rxs);
|
current->setData(currentColumn++, rxs);
|
||||||
}
|
}
|
||||||
@@ -746,16 +748,16 @@ void TreeModel::refresh()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned protocol)
|
bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol)
|
||||||
{
|
{
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (auto const& model: radioData->models) {
|
for (auto const& model: radioData->models) {
|
||||||
if (!model.isEmpty()) {
|
if (!model.isEmpty()) {
|
||||||
for (auto const& moduleData: model.moduleData) {
|
unsigned moduleIdx = 0;
|
||||||
if (moduleData.protocol == protocol && moduleData.modelId == modelIdx) {
|
const ModuleData& moduleData = model.moduleData[module];
|
||||||
if (++cnt > 1) {
|
if (moduleData.protocol == protocol && moduleData.modelId == modelIdx) {
|
||||||
return false;
|
if (++cnt > 1) {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class TreeModel : public QAbstractItemModel
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TreeItem * getItem(const QModelIndex & index) const;
|
TreeItem * getItem(const QModelIndex & index) const;
|
||||||
bool isModelIdUnique(unsigned modelId, unsigned protocol);
|
bool isModelIdUnique(unsigned modelId, unsigned module, unsigned protocol);
|
||||||
|
|
||||||
TreeItem * rootItem;
|
TreeItem * rootItem;
|
||||||
RadioData * radioData;
|
RadioData * radioData;
|
||||||
|
|||||||
Reference in New Issue
Block a user