diff --git a/src/QGCCore.cc b/src/QGCCore.cc index d2379d63b5613ac1e24528cb86d5199cbd09a66b..ee0e4ef818189dd6c6ef9eae65d1b0dcbffa31e4 100644 --- a/src/QGCCore.cc +++ b/src/QGCCore.cc @@ -168,38 +168,9 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv) // Remove splash screen splashScreen->finish(mainWindow); - if (upgraded) mainWindow->showInfoMessage(tr("Default Settings Loaded"), tr("APM Planner has been upgraded from version %1 to version %2. Some of your user preferences have been reset to defaults for safety reasons. Please adjust them where needed.").arg(lastApplicationVersion).arg(QGC_APPLICATION_VERSION)); + if (upgraded) mainWindow->showInfoMessage(tr("Default Settings Loaded"), + tr("APM Planner has been upgraded from version %1 to version %2. Some of your user preferences have been reset to defaults for safety reasons. Please adjust them where needed.").arg(lastApplicationVersion).arg(QGC_APPLICATION_VERSION)); - // Check if link could be connected - if (!udpLink->connect()) - { - QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Critical); - msgBox.setText("Could not connect UDP port. Is an instance of " + qAppName() + "already running?"); - msgBox.setInformativeText("You will not be able to receive data via UDP. Please check that you're running the right executable and then re-start " + qAppName() + ". Do you want to close the application?"); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - int ret = msgBox.exec(); - - // Close the message box shortly after the click to prevent accidental clicks - QTimer::singleShot(15000, &msgBox, SLOT(reject())); - - // Exit application - if (ret == QMessageBox::Yes) - { - //mainWindow->close(); - QTimer::singleShot(200, mainWindow, SLOT(close())); - } - } - -// forever -// { -// QGC::SLEEP::msleep(5000); -// } - -// mainWindow->close(); -// mainWindow->deleteLater(); -// QGC::SLEEP::msleep(200); } /** diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 0d3029181be66ee68516d277ca6fcacd9e7886db..eab45af760c1dddc1a0096b1c2cc8f3e9fe12121 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -189,26 +189,6 @@ MainWindow::MainWindow(QWidget *parent): advancedActions << ui.actionEngineersView; toolBar->setPerspectiveChangeAdvancedActions(advancedActions); -#else - // Add the APM 'toolbar' - - APMToolBar *apmToolBar = new APMToolBar(this); - apmToolBar->setFlightViewAction(ui.actionFlightView); - apmToolBar->setFlightPlanViewAction(ui.actionMissionView); - apmToolBar->setHardwareViewAction(ui.actionHardwareConfig); - apmToolBar->setSoftwareViewAction(ui.actionSoftwareConfig); - apmToolBar->setSimulationViewAction(ui.actionSimulation_View); - apmToolBar->setTerminalViewAction(ui.actionSimulation_View); - - QDockWidget *widget = new QDockWidget(tr("APM Tool Bar"),this); - widget->setWidget(apmToolBar); - widget->setMinimumHeight(72); - widget->setMaximumHeight(72); - widget->setMinimumWidth(1024); - widget->setFeatures(QDockWidget::NoDockWidgetFeatures); - widget->setTitleBarWidget(new QWidget(this)); // Disables the title bar -// /*widget*/->setStyleSheet("QDockWidget { border: 0px solid #FFFFFF; border-radius: 0px; border-bottom: 0px;}"); - this->addDockWidget(Qt::TopDockWidgetArea, widget); #endif customStatusBar = new QGCStatusBar(this); @@ -235,6 +215,28 @@ MainWindow::MainWindow(QWidget *parent): connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*))); +#ifndef QGC_TOOLBAR_ENABLED + // Add the APM 'toolbar' + + APMToolBar *apmToolBar = new APMToolBar(this); + apmToolBar->setFlightViewAction(ui.actionFlightView); + apmToolBar->setFlightPlanViewAction(ui.actionMissionView); + apmToolBar->setHardwareViewAction(ui.actionHardwareConfig); + apmToolBar->setSoftwareViewAction(ui.actionSoftwareConfig); + apmToolBar->setSimulationViewAction(ui.actionSimulation_View); + apmToolBar->setTerminalViewAction(ui.actionSimulation_View); + + QDockWidget *widget = new QDockWidget(tr("APM Tool Bar"),this); + widget->setWidget(apmToolBar); + widget->setMinimumHeight(72); + widget->setMaximumHeight(72); + widget->setMinimumWidth(1024); + widget->setFeatures(QDockWidget::NoDockWidgetFeatures); + widget->setTitleBarWidget(new QWidget(this)); // Disables the title bar +// /*widget*/->setStyleSheet("QDockWidget { border: 0px solid #FFFFFF; border-radius: 0px; border-bottom: 0px;}"); + this->addDockWidget(Qt::TopDockWidgetArea, widget); +#endif + // Connect user interface devices emit initStatusChanged("Initializing joystick interface."); joystickWidget = 0; @@ -918,6 +920,8 @@ void MainWindow::showTool(bool show) }*/ void MainWindow::addCentralWidget(QWidget* widget, const QString& title) { + Q_UNUSED(title); + // Check if this widget already has been added if (centerStack->indexOf(widget) == -1) { @@ -1729,6 +1733,7 @@ void MainWindow::commsWidgetDestroyed(QObject *obj) void MainWindow::setActiveUAS(UASInterface* uas) { + Q_UNUSED(uas); // Enable and rename menu // ui.menuUnmanned_System->setTitle(uas->getUASName()); // if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true); @@ -1950,6 +1955,7 @@ void MainWindow::UASCreated(UASInterface* uas) void MainWindow::UASDeleted(UASInterface* uas) { + Q_UNUSED(uas); if (UASManager::instance()->getUASList().count() == 0) { // Last system deleted diff --git a/src/ui/QGCStatusBar.cc b/src/ui/QGCStatusBar.cc index 04f77de2f43ff130ae328fb5a880a86a2eddd04c..2870e20f97662a38b57125f84d001d8be7cdcba0 100644 --- a/src/ui/QGCStatusBar.cc +++ b/src/ui/QGCStatusBar.cc @@ -49,16 +49,11 @@ QGCStatusBar::QGCStatusBar(QWidget *parent) : void QGCStatusBar::paintEvent(QPaintEvent * event) { + Q_UNUSED(event); QPainter p(this); QStyleOption opt; opt.initFrom(this); style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this); - //QStatusBar::paintEvent(event); -// if (currentMessage().length() == 0) { -// QStatusBar::paintEvent(event); -// } else { - -// } } void QGCStatusBar::setLogPlayer(QGCMAVLinkLogPlayer* player) @@ -66,12 +61,6 @@ void QGCStatusBar::setLogPlayer(QGCMAVLinkLogPlayer* player) this->player = player; addPermanentWidget(player); connect(toggleLoggingButton, SIGNAL(clicked(bool)), this, SLOT(logging(bool))); - //connect(MainWindow::instance()->getMAVLink(), SIGNAL(loggingChanged(bool)), toggleLoggingButton, SLOT(setChecked(bool))); - - // XXX Mutex issue if called like this -// toggleLoggingButton->blockSignals(true); -// toggleLoggingButton->setChecked(MainWindow::instance()->getMAVLink()->loggingEnabled()); -// toggleLoggingButton->blockSignals(false); } void QGCStatusBar::logging(bool checked) diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 1a7414bd877092dd43fce607aa7637c2f496b8a5..30d89f5d817a3eb80438a3e0ac3115081affd802 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -423,6 +423,8 @@ void QGCToolBar::updateBatteryRemaining(UASInterface* uas, double voltage, doubl { Q_UNUSED(uas); Q_UNUSED(seconds); + Q_UNUSED(current); + if (batteryPercent != percent || batteryVoltage != voltage) changed = true; batteryPercent = percent; batteryVoltage = voltage; diff --git a/src/ui/apmtoolbar.cpp b/src/ui/apmtoolbar.cpp index f3253160bf768bf330080786d038a7e3a55ac753..56fd991a0a7a2f4ac7047773425aa0ffe0e2d830 100644 --- a/src/ui/apmtoolbar.cpp +++ b/src/ui/apmtoolbar.cpp @@ -20,9 +20,7 @@ APMToolBar::APMToolBar(QWidget *parent): updateLinkDisplay(LinkManager::instance()->getLinks().last()); } - QObject *object = rootObject(); - if (object) - object->setProperty("connected", false); + setConnection(false); } void APMToolBar::setFlightViewAction(QAction *action) @@ -116,12 +114,18 @@ void APMToolBar::connectMAV() qDebug() << "result = " << result; // Change the image to represent the state - QObject *object = rootObject(); - object->setProperty("connected", result); + setConnection(result); emit MAVConnected(result); } +void APMToolBar::setConnection(bool connection) +{ + // Change the image to represent the state + QObject *object = rootObject(); + object->setProperty("connected", connection); +} + APMToolBar::~APMToolBar() { qDebug() << "Destory APM Toolbar"; @@ -161,5 +165,10 @@ void APMToolBar::updateLinkDisplay(LinkInterface* newLink) QString linkName = newLink->getName(); object->setProperty("linkNameLabel", linkName); + + connect(newLink, SIGNAL(connected(bool)), + this, SLOT(setConnection(bool))); + + setConnection(newLink->isConnected()); } } diff --git a/src/ui/apmtoolbar.h b/src/ui/apmtoolbar.h index e6e14446cbaf3418ae864a06545427aa3719bafa..d4e48212e54460e07638a07d00b0286637d82359 100644 --- a/src/ui/apmtoolbar.h +++ b/src/ui/apmtoolbar.h @@ -41,6 +41,7 @@ public slots: void connectMAV(); void showConnectionDialog(); + void setConnection(bool connection); void updateLinkDisplay(LinkInterface *newLink); };