diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 57b97d5b136161cac1874a7ec842bdc7bca777d4..f0bb967a0cdd2779cd9233d227a66a16d7008d23 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -796,6 +796,7 @@ void MainWindow::connectCommonActions() // Connect internal actions connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(UASCreated(UASInterface*))); + connect(UASManager::instance(), SIGNAL(UASDeleted(int)), this, SLOT(UASDeleted(int))); // Unmanned System controls connect(_ui.actionLiftoff, SIGNAL(triggered()), UASManager::instance(), SLOT(launchActiveUAS())); @@ -909,6 +910,14 @@ void MainWindow::UASCreated(UASInterface* uas) } } +void MainWindow::UASDeleted(int uasId) +{ + if (_mapUasId2HilDockWidget.contains(uasId)) { + _mapUasId2HilDockWidget[uasId]->deleteLater(); + _mapUasId2HilDockWidget.remove(uasId); + } +} + /// Stores the state of the toolbar, status bar and widgets associated with the current view void MainWindow::_storeCurrentViewState(void) { diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 4ba330997b9fb836823129135b38e8de725179ff..a337268e0706b0c5f84bf0828f928d53ee58927c 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -146,6 +146,9 @@ public slots: /** @brief Add a new UAS */ void UASCreated(UASInterface* uas); + /** @brief Remove an old UAS */ + void UASDeleted(int uasID); + void handleMisconfiguration(UASInterface* uas); /** @brief Load configuration views */ void loadSetupView();