diff --git a/src/comm/QGCFlightGearLink.cc b/src/comm/QGCFlightGearLink.cc index a9dcd9a97a95f9c85e304e908f4315dc7602ad88..1c015a7094d2ade2a294c89e45f60e191f9a6c47 100644 --- a/src/comm/QGCFlightGearLink.cc +++ b/src/comm/QGCFlightGearLink.cc @@ -52,7 +52,7 @@ QGCFlightGearLink::QGCFlightGearLink(UASInterface* mav, QString remoteHost, QHos QGCFlightGearLink::~QGCFlightGearLink() { - disconnect(); + disconnectSimulation(); } /** @@ -339,11 +339,13 @@ QObject::connect( process, SIGNAL(error(QProcess::ProcessError)), QStringList processCall; QString processFgfs; QString fgRoot; +QString fgScenery; QString aircraft("Rascal110-JSBSim"); #ifdef Q_OS_MACX processFgfs = "/Applications/FlightGear.app/Contents/Resources/fgfs"; fgRoot = "--fg-root=/Applications/FlightGear.app/Contents/Resources/data"; +fgScenery = "--fg-scenery=\"/Applications/FlightGear.app/Contents/Resources/data/Scenery\""; #endif #ifdef Q_OS_WIN32 @@ -357,6 +359,7 @@ fgRoot = "--fg-root=/usr/share/flightgear/data"; #endif processCall << fgRoot; +//processCall << fgScenery; processCall << "--generic=socket,out,50,127.0.0.1,49005,udp,ardupilot"; processCall << "--generic=socket,in,50,127.0.0.1,49000,udp,ardupilot"; processCall << "--in-air"; diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index fedbf62ec0d2a47220d79805e39a351e0fc3ebd5..b1aa2218bd7684f4723ef84b472d1c311a74a5ff 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -968,7 +968,8 @@ void MainWindow::createCustomWidget() QDockWidget* dock = new QDockWidget("Unnamed Tool", this); QGCToolWidget* tool = new QGCToolWidget("Unnamed Tool", dock); - if (QGCToolWidget::instances()->size() < 2) { + if (QGCToolWidget::instances()->size() < 2) + { // This is the first widget ui.menuTools->addSeparator(); } @@ -990,28 +991,34 @@ void MainWindow::loadCustomWidget() { QString widgetFileExtension(".qgw"); QString fileName = QFileDialog::getOpenFileName(this, tr("Specify Widget File Name"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("QGroundControl Widget (*%1);;").arg(widgetFileExtension)); - QGCToolWidget* tool = new QGCToolWidget("", this); - tool->loadSettings(fileName); - if (QGCToolWidget::instances()->size() < 2) { - // This is the first widget - ui.menuTools->addSeparator(); - } + if (fileName.length() > 0) + { - // Add widget to UI - QDockWidget* dock = new QDockWidget(tool->getTitle(), this); - connect(tool, SIGNAL(destroyed()), dock, SLOT(deleteLater())); - dock->setWidget(tool); - tool->setParent(dock); + QGCToolWidget* tool = new QGCToolWidget("", this); + tool->loadSettings(fileName); - QAction* showAction = new QAction("Show Unnamed Tool", this); - showAction->setCheckable(true); - connect(dock, SIGNAL(visibilityChanged(bool)), showAction, SLOT(setChecked(bool))); - connect(showAction, SIGNAL(triggered(bool)), dock, SLOT(setVisible(bool))); - tool->setMainMenuAction(showAction); - ui.menuTools->addAction(showAction); - this->addDockWidget(Qt::BottomDockWidgetArea, dock); - dock->setVisible(true); + if (QGCToolWidget::instances()->size() < 2) + { + // This is the first widget + ui.menuTools->addSeparator(); + } + + // Add widget to UI + QDockWidget* dock = new QDockWidget(tool->getTitle(), this); + connect(tool, SIGNAL(destroyed()), dock, SLOT(deleteLater())); + dock->setWidget(tool); + tool->setParent(dock); + + QAction* showAction = new QAction(tool->getTitle(), this); + showAction->setCheckable(true); + connect(dock, SIGNAL(visibilityChanged(bool)), showAction, SLOT(setChecked(bool))); + connect(showAction, SIGNAL(triggered(bool)), dock, SLOT(setVisible(bool))); + tool->setMainMenuAction(showAction); + ui.menuTools->addAction(showAction); + this->addDockWidget(Qt::BottomDockWidgetArea, dock); + dock->setVisible(true); + } } void MainWindow::connectPxWidgets()