diff --git a/src/ui/CommConfigurationWindow.cc b/src/ui/CommConfigurationWindow.cc index b207dab3879f22cf2965968d5da8d19a2d28b16c..0941d175ddf1af744c0278b397342d86d75e22b8 100644 --- a/src/ui/CommConfigurationWindow.cc +++ b/src/ui/CommConfigurationWindow.cc @@ -81,7 +81,7 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn // Connect the current UAS action = new QAction(QIcon(":/images/devices/network-wireless.svg"), "", this); LinkManager::instance()->add(link); - action->setData(LinkManager::instance()->getLinks().indexOf(link)); + action->setData(link->getId()); action->setEnabled(true); action->setVisible(true); setLinkName(link->getName()); @@ -264,7 +264,9 @@ void CommConfigurationWindow::setLinkType(int linktype) QList actions = MainWindow::instance()->listLinkMenuActions(); foreach (QAction* act, actions) { - if (act->data().toInt() == LinkManager::instance()->getLinks().indexOf(tmpLink)) + const int& linkIndex(LinkManager::instance()->getLinks().indexOf(tmpLink)); + const int& linkID(LinkManager::instance()->getLinks()[linkIndex]->getId()); + if (act->data().toInt() == linkID) { act->trigger(); break; diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 67fb579bcbc8a6cfb4b34d77db5c7ae85f8b4299..a609fbe8f33a7b63e658feefdecbc172107d32ea 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -1492,8 +1492,11 @@ void MainWindow::addLink() // Go fishing for this link's configuration window QList actions = ui.menuNetwork->actions(); + const int& linkIndex(LinkManager::instance()->getLinks().indexOf(link)); + const int& linkID(LinkManager::instance()->getLinks()[linkIndex]->getId()); + foreach (QAction* act, actions) { - if (act->data().toInt() == LinkManager::instance()->getLinks().indexOf(link)) { + if (act->data().toInt() == linkID) { // LinkManager::instance()->getLinks().indexOf(link) act->trigger(); break; } @@ -1512,17 +1515,20 @@ void MainWindow::addLink(LinkInterface *link) // Go fishing for this link's configuration window QList actions = ui.menuNetwork->actions(); - bool found = false; + bool found(false); + + const int& linkIndex(LinkManager::instance()->getLinks().indexOf(link)); + const int& linkID(LinkManager::instance()->getLinks()[linkIndex]->getId()); foreach (QAction* act, actions) { - if (act->data().toInt() == LinkManager::instance()->getLinks().indexOf(link)) { + if (act->data().toInt() == linkID) { // LinkManager::instance()->getLinks().indexOf(link) found = true; } } - UDPLink* udp = dynamic_cast(link); + //UDPLink* udp = dynamic_cast(link); - if (!found || udp) { + if (!found) { // || udp CommConfigurationWindow* commWidget = new CommConfigurationWindow(link, mavlink, this); QAction* action = commWidget->getAction(); ui.menuNetwork->addAction(action); diff --git a/src/ui/QGCParamWidget.h b/src/ui/QGCParamWidget.h index 68bd77da35a146b130f882d4ec6ca9c2a666d462..c558fd6deffaaadabb23a6eb0d60cc3df1d5592f 100644 --- a/src/ui/QGCParamWidget.h +++ b/src/ui/QGCParamWidget.h @@ -52,7 +52,7 @@ public: UASInterface* getUAS(); signals: /** @brief A parameter was changed in the widget, NOT onboard */ - void parameterChanged(int component, QString parametername, float value); + //void parameterChanged(int component, QString parametername, float value); // defined in QGCUASParamManager already /** @brief Request a single parameter */ void requestParameter(int component, int parameter); public slots: