From 913c64179c75b6ae731db3c294deb8d4e78f5ca9 Mon Sep 17 00:00:00 2001 From: Michael Carpenter Date: Thu, 23 May 2013 08:47:00 -0400 Subject: [PATCH] Fix for layout glitch when using HIL Configuration, and added checks to see if there is an active UAS before attempting to connect HSIDisplay signals --- src/ui/HSIDisplay.cc | 5 ++++- src/ui/MainWindow.cc | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index 624353d16..bcfe7adb5 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 3b9e7103d..3fcf424c0 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) { -- 2.22.0