diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index 624353d1607dafe8fd976a625a7df32451496b71..bcfe7adb5b1a57ce79499955362959503ebd4c12 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -178,7 +178,10 @@ HSIDisplay::HSIDisplay(QWidget *parent) : connect(&statusClearTimer, SIGNAL(timeout()), this, SLOT(clearStatusMessage())); statusClearTimer.start(3000); - setActiveUAS(UASManager::instance()->getActiveUAS()); + if (UASManager::instance()->getActiveUAS()) + { + setActiveUAS(UASManager::instance()->getActiveUAS()); + } setFocusPolicy(Qt::StrongFocus); } diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 3b9e7103d6779e5a7cf4c0b8a858673527e4daa5..3fcf424c0c728db933340bd981c0e41542988a64 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -345,8 +345,9 @@ QString MainWindow::getWindowStateKey() return QString::number(currentView)+"_windowstate_" + UASManager::instance()->getActiveUAS()->getAutopilotTypeName(); } else - - return QString::number(currentView)+"_windowstate"; + { + return QString::number(currentView)+"_windowstate"; + } } QString MainWindow::getWindowGeometryKey() @@ -727,7 +728,12 @@ void MainWindow::loadDockWidget(QString name) { return; } - if (name == "UNMANNED_SYSTEM_CONTROL_DOCKWIDGET") + if (name.startsWith("HIL_CONFIG")) + { + //It's a HIL widget. + showHILConfigurationWidget(UASManager::instance()->getActiveUAS()); + } + else if (name == "UNMANNED_SYSTEM_CONTROL_DOCKWIDGET") { createDockWidget(centerStack->currentWidget(),new UASControlWidget(this),tr("Control"),"UNMANNED_SYSTEM_CONTROL_DOCKWIDGET",currentView,Qt::LeftDockWidgetArea); } @@ -906,8 +912,8 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas) void MainWindow::closeEvent(QCloseEvent *event) { if (isVisible()) storeViewState(); - storeSettings(); aboutToCloseFlag = true; + storeSettings(); mavlink->storeSettings(); UASManager::instance()->storeSettings(); QMainWindow::closeEvent(event); @@ -1748,7 +1754,8 @@ void MainWindow::UASCreated(UASInterface* uas) connect(uas, SIGNAL(systemSpecsChanged(int)), this, SLOT(UASSpecsChanged(int))); // HIL - showHILConfigurationWidget(uas); + //We only want to show it when it's explicitly requested. This is now handled by loadViewState() + //showHILConfigurationWidget(uas); if (!linechartWidget) {