diff --git a/QGCExternalLibs.pri b/QGCExternalLibs.pri index 71eb4734f495096f57648dab03a4812b45838ebb..9c9e1d82ade21a6cc64e630ac1496a10f59731a2 100644 --- a/QGCExternalLibs.pri +++ b/QGCExternalLibs.pri @@ -1,21 +1,3 @@ -# -# [REQUIRED] Tell the Linux build to look in a few additional places for libs -# -LinuxBuild { - INCLUDEPATH += \ - /usr/include \ - /usr/local/include - - LIBS += \ - -L/usr/lib - - linux-g++-64 { - LIBS += \ - -L/usr/local/lib64 \ - -L/usr/lib64 - } -} - # # [REQUIRED] Add support for to Windows. # @@ -261,36 +243,6 @@ else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_GOOGLE_EAR message("Skipping support for Google Earth view (unsupported platform)") } -# -# [OPTIONAL] Protcol Buffers for PixHawk -# -LinuxBuild : contains(MAVLINK_DIALECT, pixhawk) { - exists(/usr/local/include/google/protobuf) | exists(/usr/include/google/protobuf) { - message("Including support for Protocol Buffers") - - DEFINES += QGC_PROTOBUF_ENABLED - - LIBS += \ - -lprotobuf \ - -lprotobuf-lite \ - -lprotoc - - HEADERS += \ - libs/mavlink/include/mavlink/v1.0/pixhawk/pixhawk.pb.h \ - src/ui/map3D/ObstacleGroupNode.h \ - src/ui/map3D/GLOverlayGeode.h - - SOURCES += \ - libs/mavlink/share/mavlink/src/v1.0/pixhawk/pixhawk.pb.cc \ - src/ui/map3D/ObstacleGroupNode.cc \ - src/ui/map3D/GLOverlayGeode.cc - } else { - warning("Skipping support for Protocol Buffers (missing libraries, see README)") - } -} else { - message("Skipping support for Protocol Buffers (unsupported platform)") -} - # # [REQUIRED] EIGEN matrix library # NOMINMAX constant required to make internal min/max work. @@ -341,13 +293,15 @@ contains(DEFINES, DISABLE_XBEE) { } else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_XBEE) { message("Skipping support for native XBee API (manual override from user_config.pri)") } else:LinuxBuild { - exists(/usr/include/xbee.h) { + linux-g++-64 { + message("Skipping support for XBee API (64-bit Linux builds not supported)") + } else:exists(/usr/include/xbee.h) { message("Including support for XBee API") HEADERS += $$XBEE_DEPENDENT_HEADERS SOURCES += $$XBEE_DEPENDENT_SOURCES DEFINES += $$XBEE_DEFINES - LIBS += -lxbee + LIBS += -L/usr/lib -lxbee } else { warning("Skipping support for XBee API (missing libraries, see README)") } diff --git a/QGCSetup.pri b/QGCSetup.pri index 46bdebb66fa2ca5fcae0ade454af1d7fde9a3ad2..eea95719948d6902c3e51a8644785682e93c0c57 100644 --- a/QGCSetup.pri +++ b/QGCSetup.pri @@ -159,11 +159,8 @@ WindowsBuild { DESTDIR_WIN = $$replace(DESTDIR, "/", "\\") D_DIR = $$[QT_INSTALL_LIBEXECS] DLL_DIR = $$replace(D_DIR, "/", "\\") - P_DIR = $$[QT_INSTALL_PLUGINS] - PLUGIN_DIR = $$replace(P_DIR, "/", "\\") # Copy dependencies - DebugBuild: DLL_QT_DEBUGCHAR = "d" ReleaseBuild: DLL_QT_DEBUGCHAR = "" COPY_FILE_LIST = \ diff --git a/files/styles/style-dark.css b/files/styles/style-dark.css index 5f6c8da60dce8d26a8a6d9125500e30abd9f751e..9716a8594e5ad03668c554b8c9e5d56b09b5127a 100644 --- a/files/styles/style-dark.css +++ b/files/styles/style-dark.css @@ -334,6 +334,14 @@ QMenu::separator { margin: 8px 5px 4px 5px; } +/* + * Fix for bug in Qt5 where QMenuBar items are styled natively on Windows, ignoring inherited settings. + * so we explicitly set their background color here (should match catch-all style background color). + */ +QMenuBar::item { + background-color: #222; +} + QMenuBar::item:selected { background-color: #CCC; color: #000; diff --git a/files/styles/style-light.css b/files/styles/style-light.css index 25c38addf4d8854ad865f695abcf67fb55f95174..74ab01cb9dccc5e76aacfe9d3be2898ec162c00f 100644 --- a/files/styles/style-light.css +++ b/files/styles/style-light.css @@ -278,6 +278,14 @@ QMenu::separator { margin: 8px 5px 4px 5px; } +/* + * Fix for bug in Qt5 where QMenuBar items are styled natively on Windows, ignoring inherited settings. + * so we explicitly set their background color here (should match catch-all style background color). + */ +QMenuBar::item { + background-color: #F6F6F6; +} + QMenuBar::item:selected { background-color: #555; color: #FFF; diff --git a/libs/mavlink/include/mavlink/v1.0 b/libs/mavlink/include/mavlink/v1.0 index 04b1ad5b284d5e916858ca9f928e93d97bbf6ad9..77d9553174779947b45aa08d29129dcb659f5b5e 160000 --- a/libs/mavlink/include/mavlink/v1.0 +++ b/libs/mavlink/include/mavlink/v1.0 @@ -1 +1 @@ -Subproject commit 04b1ad5b284d5e916858ca9f928e93d97bbf6ad9 +Subproject commit 77d9553174779947b45aa08d29129dcb659f5b5e diff --git a/libs/qtconcurrent/QtConcurrentTools b/libs/qtconcurrent/QtConcurrentTools deleted file mode 100644 index b8c36c1dd86b92c84fb780c60e5b6f58b0c32f0d..0000000000000000000000000000000000000000 --- a/libs/qtconcurrent/QtConcurrentTools +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qtconcurrent/multitask.h" -#include "qtconcurrent/runextensions.h" diff --git a/libs/qtconcurrent/multitask.h b/libs/qtconcurrent/multitask.h deleted file mode 100644 index 18a748c0e1d637b3409593544602c37ed54061f4..0000000000000000000000000000000000000000 --- a/libs/qtconcurrent/multitask.h +++ /dev/null @@ -1,196 +0,0 @@ -/** - ****************************************************************************** - * - * @file multitask.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup - * @{ - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MULTITASK_H -#define MULTITASK_H - -#include "qtconcurrent_global.h" -#include "runextensions.h" - -#include -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace QtConcurrent { - -class QTCONCURRENT_EXPORT MultiTaskBase : public QObject, public QRunnable -{ - Q_OBJECT -protected slots: - virtual void cancelSelf() = 0; - virtual void setFinished() = 0; - virtual void setProgressRange(int min, int max) = 0; - virtual void setProgressValue(int value) = 0; - virtual void setProgressText(QString value) = 0; -}; - -template -class MultiTask : public MultiTaskBase -{ -public: - MultiTask(void (Class::*fn)(QFutureInterface &), const QList &objects) - : fn(fn), - objects(objects) - { - maxProgress = 100*objects.size(); - } - - QFuture future() - { - futureInterface.reportStarted(); - return futureInterface.future(); - } - - void run() - { - QThreadPool::globalInstance()->releaseThread(); - futureInterface.setProgressRange(0, maxProgress); - foreach (Class *object, objects) { - QFutureWatcher *watcher = new QFutureWatcher(); - watchers.insert(object, watcher); - finished.insert(watcher, false); - connect(watcher, SIGNAL(finished()), this, SLOT(setFinished())); - connect(watcher, SIGNAL(progressRangeChanged(int,int)), this, SLOT(setProgressRange(int,int))); - connect(watcher, SIGNAL(progressValueChanged(int)), this, SLOT(setProgressValue(int))); - connect(watcher, SIGNAL(progressTextChanged(QString)), this, SLOT(setProgressText(QString))); - watcher->setFuture(QtConcurrent::run(fn, object)); - } - selfWatcher = new QFutureWatcher(); - connect(selfWatcher, SIGNAL(canceled()), this, SLOT(cancelSelf())); - selfWatcher->setFuture(futureInterface.future()); - loop = new QEventLoop; - loop->exec(); - futureInterface.reportFinished(); - QThreadPool::globalInstance()->reserveThread(); - qDeleteAll(watchers.values()); - delete selfWatcher; - delete loop; - } -protected: - void cancelSelf() - { - foreach (QFutureWatcher *watcher, watchers) - watcher->future().cancel(); - } - - void setFinished() - { - updateProgress(); - QFutureWatcher *watcher = static_cast *>(sender()); - if (finished.contains(watcher)) - finished[watcher] = true; - bool allFinished = true; - const QList finishedValues = finished.values(); - foreach (bool isFinished, finishedValues) { - if (!isFinished) { - allFinished = false; - break; - } - } - if (allFinished) - loop->quit(); - } - - void setProgressRange(int min, int max) - { - Q_UNUSED(min) - Q_UNUSED(max) - updateProgress(); - } - - void setProgressValue(int value) - { - Q_UNUSED(value) - updateProgress(); - } - - void setProgressText(QString value) - { - Q_UNUSED(value) - updateProgressText(); - } -private: - void updateProgress() - { - int progressSum = 0; - const QList *> watchersValues = watchers.values(); - foreach (QFutureWatcher *watcher, watchersValues) { - if (watcher->progressMinimum() == watcher->progressMaximum()) { - if (watcher->future().isFinished() && !watcher->future().isCanceled()) - progressSum += 100; - } else { - progressSum += 100*(watcher->progressValue()-watcher->progressMinimum())/(watcher->progressMaximum()-watcher->progressMinimum()); - } - } - futureInterface.setProgressValue(progressSum); - } - - void updateProgressText() - { - QString text; - const QList *> watchersValues = watchers.values(); - foreach (QFutureWatcher *watcher, watchersValues) { - if (!watcher->progressText().isEmpty()) - text += watcher->progressText() + "\n"; - } - text = text.trimmed(); - futureInterface.setProgressValueAndText(futureInterface.progressValue(), text); - } - - QFutureInterface futureInterface; - void (Class::*fn)(QFutureInterface &); - QList objects; - - QFutureWatcher *selfWatcher; - QMap *> watchers; - QMap *, bool> finished; - QEventLoop *loop; - int maxProgress; -}; - -template -QFuture run(void (Class::*fn)(QFutureInterface &), const QList &objects, int priority = 0) -{ - MultiTask *task = new MultiTask(fn, objects); - QFuture future = task->future(); - QThreadPool::globalInstance()->start(task, priority); - return future; -} - -} // namespace QtConcurrent - -QT_END_NAMESPACE - -#endif // MULTITASK_H diff --git a/libs/qtconcurrent/qtconcurrent.pri b/libs/qtconcurrent/qtconcurrent.pri deleted file mode 100644 index 57929a4cf11042a08347064a1fb7cd4468efe858..0000000000000000000000000000000000000000 --- a/libs/qtconcurrent/qtconcurrent.pri +++ /dev/null @@ -1 +0,0 @@ -LIBS *= -l$$qtLibraryTarget(QtConcurrent) diff --git a/libs/qtconcurrent/qtconcurrent.pro b/libs/qtconcurrent/qtconcurrent.pro deleted file mode 100644 index ef29d9188ff217c5fe0551fdee0c0c5c07cf6cd7..0000000000000000000000000000000000000000 --- a/libs/qtconcurrent/qtconcurrent.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = lib -TARGET = QtConcurrent -DEFINES += BUILD_QTCONCURRENT - -include(../../openpilotgcslibrary.pri) - -HEADERS += \ - qtconcurrent_global.h \ - multitask.h \ - runextensions.h diff --git a/libs/qtconcurrent/qtconcurrent_global.h b/libs/qtconcurrent/qtconcurrent_global.h deleted file mode 100644 index ba8c071f379ef0c37648826869d1c5b698fdb2e7..0000000000000000000000000000000000000000 --- a/libs/qtconcurrent/qtconcurrent_global.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - ****************************************************************************** - * - * @file qtconcurrent_global.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup - * @{ - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef QTCONCURRENT_GLOBAL_H -#define QTCONCURRENT_GLOBAL_H - -#include - -#if defined(BUILD_QTCONCURRENT) -# define QTCONCURRENT_EXPORT Q_DECL_EXPORT -#else -# define QTCONCURRENT_EXPORT Q_DECL_IMPORT -#endif - -#endif // QTCONCURRENT_GLOBAL_H diff --git a/libs/qtconcurrent/runextensions.h b/libs/qtconcurrent/runextensions.h deleted file mode 100644 index 96f5c7dab1a6babfe0d5e3f70037ef2ec9c7ddec..0000000000000000000000000000000000000000 --- a/libs/qtconcurrent/runextensions.h +++ /dev/null @@ -1,393 +0,0 @@ -/** - ****************************************************************************** - * - * @file runextensions.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup - * @{ - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef QTCONCURRENT_RUNEX_H -#define QTCONCURRENT_RUNEX_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtConcurrent { - -template -class StoredInterfaceFunctionCall0 : public QRunnable -{ -public: - StoredInterfaceFunctionCall0(void (fn)(QFutureInterface &)) - : fn(fn) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - fn(futureInterface); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - -}; -template -class StoredInterfaceMemberFunctionCall0 : public QRunnable -{ -public: - StoredInterfaceMemberFunctionCall0(void (Class::*fn)(QFutureInterface &), Class *object) - : fn(fn), object(object) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - (object->*fn)(futureInterface); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Class *object; - -}; - -template -class StoredInterfaceFunctionCall1 : public QRunnable -{ -public: - StoredInterfaceFunctionCall1(void (fn)(QFutureInterface &, Arg1), Arg1 arg1) - : fn(fn), arg1(arg1) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - fn(futureInterface, arg1); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Arg1 arg1; -}; -template -class StoredInterfaceMemberFunctionCall1 : public QRunnable -{ -public: - StoredInterfaceMemberFunctionCall1(void (Class::*fn)(QFutureInterface &, Arg1), Class *object, Arg1 arg1) - : fn(fn), object(object), arg1(arg1) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - (object->*fn)(futureInterface, arg1); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Class *object; - Arg1 arg1; -}; - -template -class StoredInterfaceFunctionCall2 : public QRunnable -{ -public: - StoredInterfaceFunctionCall2(void (fn)(QFutureInterface &, Arg1, Arg2), Arg1 arg1, Arg2 arg2) - : fn(fn), arg1(arg1), arg2(arg2) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - fn(futureInterface, arg1, arg2); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Arg1 arg1; Arg2 arg2; -}; -template -class StoredInterfaceMemberFunctionCall2 : public QRunnable -{ -public: - StoredInterfaceMemberFunctionCall2(void (Class::*fn)(QFutureInterface &, Arg1, Arg2), Class *object, Arg1 arg1, Arg2 arg2) - : fn(fn), object(object), arg1(arg1), arg2(arg2) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - (object->*fn)(futureInterface, arg1, arg2); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Class *object; - Arg1 arg1; Arg2 arg2; -}; - -template -class StoredInterfaceFunctionCall3 : public QRunnable -{ -public: - StoredInterfaceFunctionCall3(void (fn)(QFutureInterface &, Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3) - : fn(fn), arg1(arg1), arg2(arg2), arg3(arg3) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - fn(futureInterface, arg1, arg2, arg3); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Arg1 arg1; Arg2 arg2; Arg3 arg3; -}; -template -class StoredInterfaceMemberFunctionCall3 : public QRunnable -{ -public: - StoredInterfaceMemberFunctionCall3(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3) - : fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - (object->*fn)(futureInterface, arg1, arg2, arg3); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Class *object; - Arg1 arg1; Arg2 arg2; Arg3 arg3; -}; - -template -class StoredInterfaceFunctionCall4 : public QRunnable -{ -public: - StoredInterfaceFunctionCall4(void (fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) - : fn(fn), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - fn(futureInterface, arg1, arg2, arg3, arg4); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; -}; -template -class StoredInterfaceMemberFunctionCall4 : public QRunnable -{ -public: - StoredInterfaceMemberFunctionCall4(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) - : fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - (object->*fn)(futureInterface, arg1, arg2, arg3, arg4); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Class *object; - Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; -}; - -template -class StoredInterfaceFunctionCall5 : public QRunnable -{ -public: - StoredInterfaceFunctionCall5(void (fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) - : fn(fn), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - fn(futureInterface, arg1, arg2, arg3, arg4, arg5); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; -}; -template -class StoredInterfaceMemberFunctionCall5 : public QRunnable -{ -public: - StoredInterfaceMemberFunctionCall5(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) - : fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { } - - QFuture start() - { - futureInterface.reportStarted(); - QFuture future = futureInterface.future(); - QThreadPool::globalInstance()->start(this); - return future; - } - - void run() - { - (object->*fn)(futureInterface, arg1, arg2, arg3, arg4, arg5); - futureInterface.reportFinished(); - } -private: - QFutureInterface futureInterface; - FunctionPointer fn; - Class *object; - Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; -}; - -template -QFuture run(void (*functionPointer)(QFutureInterface &)) -{ - return (new StoredInterfaceFunctionCall0 &)>(functionPointer))->start(); -} -template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1), Arg1 arg1) -{ - return (new StoredInterfaceFunctionCall1 &, Arg1), Arg1>(functionPointer, arg1))->start(); -} -template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2), Arg1 arg1, Arg2 arg2) -{ - return (new StoredInterfaceFunctionCall2 &, Arg1, Arg2), Arg1, Arg2>(functionPointer, arg1, arg2))->start(); -} -template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3) -{ - return (new StoredInterfaceFunctionCall3 &, Arg1, Arg2, Arg3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start(); -} -template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) -{ - return (new StoredInterfaceFunctionCall4 &, Arg1, Arg2, Arg3, Arg4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start(); -} -template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) -{ - return (new StoredInterfaceFunctionCall5 &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); -} - -template -QFuture run(void (Class::*fn)(QFutureInterface &), Class *object) -{ - return (new StoredInterfaceMemberFunctionCall0 &), Class>(fn, object))->start(); -} - -} // namespace QtConcurrent - -QT_END_NAMESPACE - -#endif // QTCONCURRENT_RUNEX_H diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 72b71f5f8db7bfaadd14c2a0a803c7dfd99e9a9d..faa8f4df24bdc7f60ae6d2562be4b0c911bc89b8 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -756,8 +756,7 @@ HEADERS += \ src/qgcunittest/FlightModeConfigTest.h \ src/qgcunittest/FlightGearTest.h \ src/qgcunittest/TCPLinkTest.h \ - src/qgcunittest/TCPLoopBackServer.h \ - src/qgcunittest/QGCUASFileManagerTest.h + src/qgcunittest/TCPLoopBackServer.h SOURCES += \ src/qgcunittest/UASUnitTest.cc \ @@ -769,5 +768,4 @@ SOURCES += \ src/qgcunittest/FlightModeConfigTest.cc \ src/qgcunittest/FlightGearTest.cc \ src/qgcunittest/TCPLinkTest.cc \ - src/qgcunittest/TCPLoopBackServer.cc \ - src/qgcunittest/QGCUASFileManagerTest.cc + src/qgcunittest/TCPLoopBackServer.cc diff --git a/qml/ApmToolBar.qml b/qml/ApmToolBar.qml index 23a78150796efd1196e6598ca79b92f0d09242ee..6ede1e51d419c6e1a9a554889a20a91837a2e826 100644 --- a/qml/ApmToolBar.qml +++ b/qml/ApmToolBar.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.1 import "./components" diff --git a/qml/components/Button.qml b/qml/components/Button.qml index 798a161076bb015a7845c7ac3254e2c4e7a8e9d8..27b1f9e337c7842362bcb64bf44d7ecb61306fd0 100644 --- a/qml/components/Button.qml +++ b/qml/components/Button.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.1 Rectangle { signal clicked diff --git a/qml/components/DigitalDisplay.qml b/qml/components/DigitalDisplay.qml index dc70d0149c9b9e79a4a5dc508815a94dc23c9450..5af486b5a4179118d35dd49703f6f41419a1d44e 100644 --- a/qml/components/DigitalDisplay.qml +++ b/qml/components/DigitalDisplay.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.1 Rectangle { diff --git a/qml/components/StatusDisplay.qml b/qml/components/StatusDisplay.qml index 9d4f6ade628325a3025b0e133e63913c9e5314e3..30bb8a848d9ac9cb31f99c36becefffcca8182bf 100644 --- a/qml/components/StatusDisplay.qml +++ b/qml/components/StatusDisplay.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.1 Rectangle { id: statusDisplay diff --git a/qml/components/TextButton.qml b/qml/components/TextButton.qml index c7b2b32226103c85779769e3af60df0cda11ab68..24b261cd95e5163c28c4477c5b0bcefb28325739 100644 --- a/qml/components/TextButton.qml +++ b/qml/components/TextButton.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.1 Rectangle { signal clicked diff --git a/qupgrade b/qupgrade index 09109881e7a2dc1a0c381264d531e9b7930a7c80..4a1cf20507252eafecb2e06618e73afceeb76608 160000 --- a/qupgrade +++ b/qupgrade @@ -1 +1 @@ -Subproject commit 09109881e7a2dc1a0c381264d531e9b7930a7c80 +Subproject commit 4a1cf20507252eafecb2e06618e73afceeb76608 diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 72b1d041c1395139035b745bbc69fd19b8822cca..81186fd0b8298363b57092cb23e285a24126effe 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -32,10 +32,6 @@ #include "QGCMAVLinkUASFactory.h" #include "QGC.h" -#ifdef QGC_PROTOBUF_ENABLED -#include -#endif - Q_DECLARE_METATYPE(mavlink_message_t) /** @@ -317,87 +313,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) rstatus.txbuf, rstatus.noise, rstatus.remnoise); } -#if defined(QGC_PROTOBUF_ENABLED) - - if (message.msgid == MAVLINK_MSG_ID_EXTENDED_MESSAGE) - { - mavlink_extended_message_t extended_message; - - extended_message.base_msg = message; - - // read extended header - uint8_t* payload = reinterpret_cast(message.payload64); - - memcpy(&extended_message.extended_payload_len, payload + 3, 4); - - // Check if message is valid - if - (b.size() != MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_EXTENDED_HEADER_LEN+ extended_message.extended_payload_len) - { - //invalid message - qDebug() << "GOT INVALID EXTENDED MESSAGE, ABORTING"; - return; - } - - const uint8_t* extended_payload = reinterpret_cast(b.constData()) + MAVLINK_NUM_NON_PAYLOAD_BYTES + MAVLINK_EXTENDED_HEADER_LEN; - - // copy extended payload data - memcpy(extended_message.extended_payload, extended_payload, extended_message.extended_payload_len); - -#if defined(QGC_USE_PIXHAWK_MESSAGES) - - if (protobufManager.cacheFragment(extended_message)) - { - std::tr1::shared_ptr protobuf_msg; - - if (protobufManager.getMessage(protobuf_msg)) - { - const google::protobuf::Descriptor* descriptor = protobuf_msg->GetDescriptor(); - if (!descriptor) - { - continue; - } - - const google::protobuf::FieldDescriptor* headerField = descriptor->FindFieldByName("header"); - if (!headerField) - { - continue; - } - - const google::protobuf::Descriptor* headerDescriptor = headerField->message_type(); - if (!headerDescriptor) - { - continue; - } - - const google::protobuf::FieldDescriptor* sourceSysIdField = headerDescriptor->FindFieldByName("source_sysid"); - if (!sourceSysIdField) - { - continue; - } - - const google::protobuf::Reflection* reflection = protobuf_msg->GetReflection(); - const google::protobuf::Message& headerMsg = reflection->GetMessage(*protobuf_msg, headerField); - const google::protobuf::Reflection* headerReflection = headerMsg.GetReflection(); - - int source_sysid = headerReflection->GetInt32(headerMsg, sourceSysIdField); - - UASInterface* uas = UASManager::instance()->getUASForId(source_sysid); - - if (uas != NULL) - { - emit extendedMessageReceived(link, protobuf_msg); - } - } - } -#endif - - position += extended_message.extended_payload_len; - - continue; - } -#endif - // Log data if (m_loggingEnabled && m_logfile) { diff --git a/src/comm/MAVLinkProtocol.h b/src/comm/MAVLinkProtocol.h index 16dea03bdcde56983f962d0480137e60572b3b00..05f113231b08f16eef77afb8bfe7e736a0c06bcc 100644 --- a/src/comm/MAVLinkProtocol.h +++ b/src/comm/MAVLinkProtocol.h @@ -42,15 +42,6 @@ This file is part of the QGROUNDCONTROL project #include "QGCMAVLink.h" #include "QGC.h" -#if defined(QGC_PROTOBUF_ENABLED) -#include -#include -#if defined(QGC_USE_PIXHAWK_MESSAGES) -#include -#endif -#endif - - /** * @brief MAVLink micro air vehicle protocol reference implementation. * @@ -239,17 +230,9 @@ protected: int systemId; bool _should_exit; -#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) - mavlink::ProtobufManager protobufManager; -#endif - signals: /** @brief Message received and directly copied via signal */ void messageReceived(LinkInterface* link, mavlink_message_t message); -#if defined(QGC_PROTOBUF_ENABLED) - /** @brief Message received via signal */ - void extendedMessageReceived(LinkInterface *link, std::tr1::shared_ptr message); -#endif /** @brief Emitted if heartbeat emission mode is changed */ void heartbeatChanged(bool heartbeats); /** @brief Emitted if logging is started / stopped */ diff --git a/src/main.cc b/src/main.cc index ab7d0c985111142f915097bd2ac6377bdac29050..b945d8530446708700bd92ef1555cbbe3e41c5f2 100644 --- a/src/main.cc +++ b/src/main.cc @@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { const char symbols[] = { 'I', 'E', '!', 'X' }; - QString output = QString("[%1] in %2:%3 - \"%2\"").arg(symbols[type]).arg(context.file).arg(context.line).arg(msg); + QString output = QString("[%1] at %2:%3 - \"%4\"").arg(symbols[type]).arg(context.file).arg(context.line).arg(msg); std::cerr << output.toStdString() << std::endl; if( type == QtFatalMsg ) abort(); } diff --git a/src/qgcunittest/MockUAS.h b/src/qgcunittest/MockUAS.h index 5b3a529982517314a5dc18c861d2eb544cab6a4b..6a757c0e31bc1cc19fe818925ca70e75d9f57212 100644 --- a/src/qgcunittest/MockUAS.h +++ b/src/qgcunittest/MockUAS.h @@ -97,18 +97,6 @@ public: virtual double getPitch() const { Q_ASSERT(false); return std::numeric_limits::quiet_NaN(); }; virtual double getYaw() const { Q_ASSERT(false); return std::numeric_limits::quiet_NaN(); }; virtual bool getSelected() const { Q_ASSERT(false); return false; }; -#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) - virtual px::GLOverlay getOverlay() { Q_ASSERT(false); }; - virtual px::GLOverlay getOverlay(qreal& receivedTimestamp) { Q_ASSERT(false); }; - virtual px::ObstacleList getObstacleList() { Q_ASSERT(false); }; - virtual px::ObstacleList getObstacleList(qreal& receivedTimestamp) { Q_ASSERT(false); }; - virtual px::Path getPath() { Q_ASSERT(false); }; - virtual px::Path getPath(qreal& receivedTimestamp) { Q_ASSERT(false); }; - virtual px::PointCloudXYZRGB getPointCloud() { Q_ASSERT(false); }; - virtual px::PointCloudXYZRGB getPointCloud(qreal& receivedTimestamp) { Q_ASSERT(false); }; - virtual px::RGBDImage getRGBDImage() { Q_ASSERT(false); }; - virtual px::RGBDImage getRGBDImage(qreal& receivedTimestamp) { Q_ASSERT(false); }; -#endif virtual bool isArmed() const { Q_ASSERT(false); return false; }; virtual int getAirframe() const { Q_ASSERT(false); return 0; }; virtual UASWaypointManager* getWaypointManager(void) { Q_ASSERT(false); return NULL; }; diff --git a/src/uas/PxQuadMAV.cc b/src/uas/PxQuadMAV.cc index 337a83ee0003a23f3d13639c927e55696d865c97..d7fbb8cef1033c5bfff9324abc012d58c2e1b3e3 100644 --- a/src/uas/PxQuadMAV.cc +++ b/src/uas/PxQuadMAV.cc @@ -206,14 +206,6 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) #endif } -#if defined(QGC_PROTOBUF_ENABLED) -void PxQuadMAV::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr message) -{ - UAS::receiveExtendedMessage(link, message); -} - -#endif - void PxQuadMAV::sendProcessCommand(int watchdogId, int processId, unsigned int command) { #ifdef MAVLINK_ENABLED_PIXHAWK diff --git a/src/uas/PxQuadMAV.h b/src/uas/PxQuadMAV.h index 28c3ba3a61bcd0af2419f8fea46c659bdac1d9ac..1e87f8deadd53abc5e192aac0160c297cb6b1756 100644 --- a/src/uas/PxQuadMAV.h +++ b/src/uas/PxQuadMAV.h @@ -35,10 +35,6 @@ public: public slots: /** @brief Receive a MAVLink message from this MAV */ void receiveMessage(LinkInterface* link, mavlink_message_t message); -#if defined(QGC_PROTOBUF_ENABLED) - /** @brief Receive a Protobuf message from this MAV */ - void receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr message); -#endif /** @brief Send a command to an onboard process */ void sendProcessCommand(int watchdogId, int processId, unsigned int command); signals: diff --git a/src/uas/QGCMAVLinkUASFactory.cc b/src/uas/QGCMAVLinkUASFactory.cc index f1a1b90a82b1a13ccdb63fa616a2b340aaea127f..ea5d02db14cdf71b46af1b62e7528bb5c071b513 100644 --- a/src/uas/QGCMAVLinkUASFactory.cc +++ b/src/uas/QGCMAVLinkUASFactory.cc @@ -36,9 +36,6 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte // Connect this robot to the UAS object connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), mav, SLOT(receiveMessage(LinkInterface*, mavlink_message_t))); connect(mavlink, SIGNAL(messageReceived(LinkInterface*,mavlink_message_t)), mav->getFileManager(), SLOT(receiveMessage(LinkInterface*, mavlink_message_t))); -#ifdef QGC_PROTOBUF_ENABLED - connect(mavlink, SIGNAL(extendedMessageReceived(LinkInterface*, std::tr1::shared_ptr)), mav, SLOT(receiveExtendedMessage(LinkInterface*, std::tr1::shared_ptr))); -#endif uas = mav; } break; @@ -53,9 +50,6 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte // else the slot of the parent object is called (and thus the special // packets never reach their goal) connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), mav, SLOT(receiveMessage(LinkInterface*, mavlink_message_t))); -#ifdef QGC_PROTOBUF_ENABLED - connect(mavlink, SIGNAL(extendedMessageReceived(LinkInterface*, std::tr1::shared_ptr)), mav, SLOT(receiveExtendedMessage(LinkInterface*, std::tr1::shared_ptr))); -#endif uas = mav; } break; diff --git a/src/uas/QGCUASFileManager.cc b/src/uas/QGCUASFileManager.cc index 3359dd74fee9abd5fdf4ed5d8c2b9bcd93c64f7c..866d512c198306c5d75e892debd20706c1b9487c 100644 --- a/src/uas/QGCUASFileManager.cc +++ b/src/uas/QGCUASFileManager.cc @@ -1,24 +1,24 @@ /*===================================================================== - + QGroundControl Open Source Ground Control Station - + (c) 2009 - 2014 QGROUNDCONTROL PROJECT - + This file is part of the QGROUNDCONTROL project - + QGROUNDCONTROL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + QGROUNDCONTROL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QGROUNDCONTROL. If not, see . - + ======================================================================*/ #include "QGCUASFileManager.h" @@ -86,14 +86,14 @@ quint32 QGCUASFileManager::crc32(Request* request, unsigned state) { uint8_t* data = (uint8_t*)request; size_t cbData = sizeof(RequestHeader) + request->hdr.size; - + // Always calculate CRC with 0 initial CRC value quint32 crcSave = request->hdr.crc32; request->hdr.crc32 = 0; - + for (size_t i=0; i < cbData; i++) state = crctab[(state ^ data[i]) & 0xff] ^ (state >> 8); - + request->hdr.crc32 = crcSave; return state; @@ -104,17 +104,17 @@ void QGCUASFileManager::_openAckResponse(Request* openAck) { _currentOperation = kCORead; _activeSession = openAck->hdr.session; - + _readOffset = 0; // Start reading at beginning of file _readFileAccumulator.clear(); // Start with an empty file - + Request request; request.hdr.magic = 'f'; request.hdr.session = _activeSession; request.hdr.opcode = kCmdRead; request.hdr.offset = _readOffset; request.hdr.size = sizeof(request.data); - + _sendRequest(&request); } @@ -124,13 +124,13 @@ void QGCUASFileManager::_closeReadSession(bool success) { if (success) { QString downloadFilePath = _readFileDownloadDir.absoluteFilePath(_readFileDownloadFilename); - + QFile file(downloadFilePath); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { _emitErrorMessage(tr("Unable to open local file for writing (%1)").arg(downloadFilePath)); return; } - + qint64 bytesWritten = file.write((const char *)_readFileAccumulator, _readFileAccumulator.length()); if (bytesWritten != _readFileAccumulator.length()) { file.close(); @@ -138,10 +138,10 @@ void QGCUASFileManager::_closeReadSession(bool success) return; } file.close(); - + _emitStatusMessage(tr("Download complete '%1'").arg(downloadFilePath)); } - + // Close the open session _sendTerminateCommand(); } @@ -155,7 +155,7 @@ void QGCUASFileManager::_readAckResponse(Request* readAck) _emitErrorMessage(tr("Read: Incorrect session returned")); return; } - + if (readAck->hdr.offset != _readOffset) { _currentOperation = kCOIdle; _readFileAccumulator.clear(); @@ -164,20 +164,20 @@ void QGCUASFileManager::_readAckResponse(Request* readAck) } _readFileAccumulator.append((const char*)readAck->data, readAck->hdr.size); - + if (readAck->hdr.size == sizeof(readAck->data)) { // Possibly still more data to read, send next read request - + _currentOperation = kCORead; - + _readOffset += readAck->hdr.size; - + Request request; request.hdr.magic = 'f'; request.hdr.session = _activeSession; request.hdr.opcode = kCmdRead; request.hdr.offset = _readOffset; - + _sendRequest(&request); } else { // We only receieved a partial buffer back. These means we are at EOF @@ -194,15 +194,15 @@ void QGCUASFileManager::_listAckResponse(Request* listAck) _emitErrorMessage(tr("List: Offset returned (%1) differs from offset requested (%2)").arg(listAck->hdr.offset).arg(_listOffset)); return; } - + uint8_t offset = 0; uint8_t cListEntries = 0; uint8_t cBytes = listAck->hdr.size; - + // parse filenames out of the buffer while (offset < cBytes) { const char * ptr = ((const char *)listAck->data) + offset; - + // get the length of the name uint8_t cBytesLeft = cBytes - offset; size_t nlen = strnlen(ptr, cBytesLeft); @@ -221,10 +221,10 @@ void QGCUASFileManager::_listAckResponse(Request* listAck) // put it in the view _emitStatusMessage(ptr); } - + // account for the name + NUL offset += nlen + 1; - + cListEntries++; } @@ -244,12 +244,17 @@ void QGCUASFileManager::_listAckResponse(Request* listAck) void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t message) { Q_UNUSED(link); - + if (message.msgid != MAVLINK_MSG_ID_ENCAPSULATED_DATA) { // wtf, not for us return; } - + + // XXX: hack to prevent files from videostream to interfere + if (message.compid != MAV_COMP_ID_IMU) { + return; + } + _clearAckTimeout(); mavlink_encapsulated_data_t data; @@ -257,28 +262,28 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me Request* request = (Request*)&data.data[0]; // FIXME: Check CRC - + if (request->hdr.opcode == kRspAck) { - + switch (_currentOperation) { case kCOIdle: // we should not be seeing anything here.. shut the other guy up _sendCmdReset(); break; - + case kCOAck: // We are expecting an ack back _currentOperation = kCOIdle; break; - + case kCOList: _listAckResponse(request); break; - + case kCOOpen: _openAckResponse(request); break; - + case kCORead: _readAckResponse(request); break; @@ -289,12 +294,12 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me } } else if (request->hdr.opcode == kRspNak) { Q_ASSERT(request->hdr.size == 1); // Should only have one byte of error code - + OperationState previousOperation = _currentOperation; uint8_t errorCode = request->data[0]; - + _currentOperation = kCOIdle; - + if (previousOperation == kCOList && errorCode == kErrEOF) { // This is not an error, just the end of the read loop emit listComplete(); @@ -351,9 +356,9 @@ void QGCUASFileManager::_sendListCommand(void) request.hdr.session = 0; request.hdr.opcode = kCmdList; request.hdr.offset = _listOffset; - + _fillRequestWithString(&request, _listPath); - + _sendRequest(&request); } @@ -365,9 +370,9 @@ void QGCUASFileManager::downloadPath(const QString& from, const QDir& downloadDi if (from.isEmpty()) { return; } - + _readFileDownloadDir.setPath(downloadDir.absolutePath()); - + // We need to strip off the file name from the fully qualified path. We can't use the usual QDir // routines because this path does not exist locally. int i; @@ -378,9 +383,9 @@ void QGCUASFileManager::downloadPath(const QString& from, const QDir& downloadDi } i++; // move past slash _readFileDownloadFilename = from.right(from.size() - i); - + emit resetStatusMessages(); - + _currentOperation = kCOOpen; Request request; @@ -436,18 +441,18 @@ bool QGCUASFileManager::_sendOpcodeOnlyCmd(uint8_t opcode, OperationState newOpS // Can't have multiple commands in play at the same time return false; } - + Request request; request.hdr.magic = 'f'; request.hdr.session = 0; request.hdr.opcode = opcode; request.hdr.offset = 0; request.hdr.size = 0; - + _currentOperation = newOpState; - + _sendRequest(&request); - + return true; } @@ -455,7 +460,7 @@ bool QGCUASFileManager::_sendOpcodeOnlyCmd(uint8_t opcode, OperationState newOpS void QGCUASFileManager::_setupAckTimeout(void) { Q_ASSERT(!_ackTimer.isActive()); - + _ackTimer.setSingleShot(true); _ackTimer.start(_ackTimerTimeoutMsecs); } @@ -464,7 +469,7 @@ void QGCUASFileManager::_setupAckTimeout(void) void QGCUASFileManager::_clearAckTimeout(void) { Q_ASSERT(_ackTimer.isActive()); - + _ackTimer.stop(); } @@ -513,7 +518,7 @@ void QGCUASFileManager::_emitStatusMessage(const QString& msg) void QGCUASFileManager::_sendRequest(Request* request) { mavlink_message_t message; - + _setupAckTimeout(); request->hdr.crc32 = crc32(request); diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 393d4bb6b0de48d6cbaca9864ba41c9e159ab5b0..66d5725f7b35aee858f7907c5cc48815f8c738c4 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -30,10 +30,6 @@ #include #include -#ifdef QGC_PROTOBUF_ENABLED -#include -#endif - /** * Gets the settings from the previous UAS (name, airframe, autopilot, battery specs) * by calling readSettings. This means the new UAS will have the same settings @@ -128,14 +124,6 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(), nedPosGlobalOffset(0,0,0), nedAttGlobalOffset(0,0,0), - #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) - receivedOverlayTimestamp(0.0), - receivedObstacleListTimestamp(0.0), - receivedPathTimestamp(0.0), - receivedPointCloudTimestamp(0.0), - receivedRGBDImageTimestamp(0.0), - #endif - airSpeed(std::numeric_limits::quiet_NaN()), groundSpeed(std::numeric_limits::quiet_NaN()), waypointManager(this), @@ -1545,105 +1533,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) } } - -#if defined(QGC_PROTOBUF_ENABLED) -/** -* Receive an extended message. -* @param link -* @param message -*/ -void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr message) -{ - if (!link) - { - return; - } - if (!links->contains(link)) - { - addLink(link); - } - - const google::protobuf::Descriptor* descriptor = message->GetDescriptor(); - if (!descriptor) - { - return; - } - - const google::protobuf::FieldDescriptor* headerField = descriptor->FindFieldByName("header"); - if (!headerField) - { - return; - } - - const google::protobuf::Descriptor* headerDescriptor = headerField->message_type(); - if (!headerDescriptor) - { - return; - } - - const google::protobuf::FieldDescriptor* sourceSysIdField = headerDescriptor->FindFieldByName("source_sysid"); - if (!sourceSysIdField) - { - return; - } - - const google::protobuf::Reflection* reflection = message->GetReflection(); - const google::protobuf::Message& headerMsg = reflection->GetMessage(*message, headerField); - const google::protobuf::Reflection* headerReflection = headerMsg.GetReflection(); - - int source_sysid = headerReflection->GetInt32(headerMsg, sourceSysIdField); - - if (source_sysid != uasId) - { - return; - } - -#ifdef QGC_USE_PIXHAWK_MESSAGES - if (message->GetTypeName() == overlay.GetTypeName()) - { - receivedOverlayTimestamp = QGC::groundTimeSeconds(); - overlayMutex.lock(); - overlay.CopyFrom(*message); - overlayMutex.unlock(); - emit overlayChanged(this); - } - else if (message->GetTypeName() == obstacleList.GetTypeName()) - { - receivedObstacleListTimestamp = QGC::groundTimeSeconds(); - obstacleListMutex.lock(); - obstacleList.CopyFrom(*message); - obstacleListMutex.unlock(); - emit obstacleListChanged(this); - } - else if (message->GetTypeName() == path.GetTypeName()) - { - receivedPathTimestamp = QGC::groundTimeSeconds(); - pathMutex.lock(); - path.CopyFrom(*message); - pathMutex.unlock(); - emit pathChanged(this); - } - else if (message->GetTypeName() == pointCloud.GetTypeName()) - { - receivedPointCloudTimestamp = QGC::groundTimeSeconds(); - pointCloudMutex.lock(); - pointCloud.CopyFrom(*message); - pointCloudMutex.unlock(); - emit pointCloudChanged(this); - } - else if (message->GetTypeName() == rgbdImage.GetTypeName()) - { - receivedRGBDImageTimestamp = QGC::groundTimeSeconds(); - rgbdImageMutex.lock(); - rgbdImage.CopyFrom(*message); - rgbdImageMutex.unlock(); - emit rgbdImageChanged(this); - } -#endif -} - -#endif - /** * Set the home position of the UAS. * @param lat The latitude fo the home position diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index cf697ea9b46826bc93cc9c2b7e114018a1a8e293..973dfbf69601867a8060862dd2bae923f0ace003 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -45,13 +45,6 @@ This file is part of the QGROUNDCONTROL project #include "QGCUASParamManagerInterface.h" #include "RadioCalibration/RadioCalibrationData.h" -#ifdef QGC_PROTOBUF_ENABLED -#include -#ifdef QGC_USE_PIXHAWK_MESSAGES -#include -#endif -#endif - class QGCUASFileManager; enum BatteryType @@ -136,19 +129,6 @@ public: virtual bool getSelected() const = 0; -#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) - virtual px::GLOverlay getOverlay() = 0; - virtual px::GLOverlay getOverlay(qreal& receivedTimestamp) = 0; - virtual px::ObstacleList getObstacleList() = 0; - virtual px::ObstacleList getObstacleList(qreal& receivedTimestamp) = 0; - virtual px::Path getPath() = 0; - virtual px::Path getPath(qreal& receivedTimestamp) = 0; - virtual px::PointCloudXYZRGB getPointCloud() = 0; - virtual px::PointCloudXYZRGB getPointCloud(qreal& receivedTimestamp) = 0; - virtual px::RGBDImage getRGBDImage() = 0; - virtual px::RGBDImage getRGBDImage(qreal& receivedTimestamp) = 0; -#endif - virtual bool isArmed() const = 0; /** @brief Set the airframe of this MAV */ @@ -603,19 +583,6 @@ signals: /** @brief Radio Calibration Data has been received from the MAV*/ void radioCalibrationReceived(const QPointer&); -#if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) - /** @brief Overlay data has been changed */ - void overlayChanged(UASInterface* uas); - /** @brief Obstacle list data has been changed */ - void obstacleListChanged(UASInterface* uas); - /** @brief Path data has been changed */ - void pathChanged(UASInterface* uas); - /** @brief Point cloud data has been changed */ - void pointCloudChanged(UASInterface* uas); - /** @brief RGBD image data has been changed */ - void rgbdImageChanged(UASInterface* uas); -#endif - /** * @brief Localization quality changed * @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization diff --git a/src/ui/DebugConsole.cc b/src/ui/DebugConsole.cc index 7b0026fd9c581584f7c94381d8d68c167fb97f49..9237142da68d86e4a0c48924a9073953f2095278 100644 --- a/src/ui/DebugConsole.cc +++ b/src/ui/DebugConsole.cc @@ -47,7 +47,7 @@ DebugConsole::DebugConsole(QWidget *parent) : currLink(NULL), holdOn(false), convertToAscii(true), - filterMAVLINK(false), + filterMAVLINK(true), autoHold(true), bytesToIgnore(0), lastByte(-1), diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index c60851c4fa27368bed1823b62680ad4900324ace..d42bfcc9adc843353abb31a485db8cf55f711241 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -190,13 +190,11 @@ void MainWindow::init() menuActionHelper->setMenu(ui.menuTools); // Qt 4 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar. + // TODO: Check that this is still necessary on Qt5 on Ubuntu #ifdef Q_OS_LINUX menuBar()->setNativeMenuBar(false); #endif - // We only need this menu if we have more than one system - // ui.menuConnected_Systems->setEnabled(false); - // Set dock options setDockOptions(AnimatedDocks | AllowTabbedDocks | AllowNestedDocks); @@ -437,7 +435,6 @@ MainWindow::~MainWindow() } } // Delete all UAS objects - delete debugConsole; delete menuActionHelper; for (int i=0;icreateToolAction(tr("Status Details"), "UAS_STATUS_DETAILS_DOCKWIDGET"); - { - if (!debugConsole) - { - debugConsole = new DebugConsole(); - debugConsole->setWindowTitle("Communications Console"); - debugConsole->hide(); - QAction* tempAction = ui.menuTools->addAction(tr("Communication Console")); - tempAction->setCheckable(true); - connect(tempAction,SIGNAL(triggered(bool)),debugConsole,SLOT(setShown(bool))); - } - } - createDockWidget(simView,new HSIDisplay(this),tr("Horizontal Situation"),"HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET",VIEW_SIMULATION,Qt::BottomDockWidgetArea); + createDockWidget(pilotView, new DebugConsole(this), tr("Communications Console"), "COMMUNICATION_CONSOLE_DOCKWIDGET", VIEW_FLIGHT, Qt::LeftDockWidgetArea); + //createDockWidget(simView,new HSIDisplay(this),tr("Horizontal Situation"),"HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET",VIEW_SIMULATION,Qt::BottomDockWidgetArea); menuActionHelper->createToolAction(tr("Flight Display"), "HEAD_DOWN_DISPLAY_1_DOCKWIDGET"); menuActionHelper->createToolAction(tr("Actuator Status"), "HEAD_DOWN_DISPLAY_2_DOCKWIDGET"); @@ -685,7 +672,7 @@ void MainWindow::buildCommonWidgets() createDockWidget(engineeringView,new HUD(320,240,this),tr("Video Downlink"),"HEAD_UP_DISPLAY_DOCKWIDGET",VIEW_FLIGHT,Qt::RightDockWidgetArea); createDockWidget(simView,new PrimaryFlightDisplay(this),tr("Primary Flight Display"),"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET",VIEW_SIMULATION,Qt::RightDockWidgetArea); - createDockWidget(pilotView,new PrimaryFlightDisplay(this),tr("Primary Flight Display"),"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea); + createDockWidget(plannerView,new PrimaryFlightDisplay(this),tr("Primary Flight Display"),"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea); QGCTabbedInfoView *infoview = new QGCTabbedInfoView(this); infoview->addSource(mavlinkDecoder); diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index c1694c391133238da39f7b5c314a4e5b1a1a9502..7c3db9353511e421f574b29e7361f5cdeb008254 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -463,8 +463,6 @@ protected: QPointer toolBar; QPointer customStatusBar; - QPointer debugConsole; - QPointer mavlinkInspectorWidget; QPointer mavlinkDecoder; QPointer mavlinkSenderWidget; diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index baba7621703a60ee580c29319ca73ab01022d439..b4c3c1bd0e3c2f48ab3508590355371fd12a741f 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -377,6 +377,9 @@ Settings + + Application settings + @@ -439,10 +442,10 @@ :/files/images/categories/preferences-system.svg:/files/images/categories/preferences-system.svg - Config + Vehicle Setup - Configuration options of the vehicle. + Hardware setup of the vehicle diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index 98ce31537d5521ee61a6c0a074d8aea33a5d2c74..06121d1d5a43d09bfd60e9bbe27bbc5dbce86739 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -104,8 +104,13 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateView())); updateTimer.start(); - ui->advancedGroupBox->hide(); - connect(ui->advancedCheckBox,SIGNAL(toggled(bool)),ui->advancedGroupBox,SLOT(setShown(bool))); + // Make sure the advanced features match what the checkbox indicates on startup and listen for + // future changes. + if (!ui->advancedCheckBox->isChecked()) + { + ui->advancedGroupBox->hide(); + } + connect(ui->advancedCheckBox, SIGNAL(toggled(bool)), ui->advancedGroupBox,SLOT(setVisible(bool))); } void QGCVehicleConfig::rcMenuButtonClicked() { diff --git a/src/ui/SerialConfigurationWindow.cc b/src/ui/SerialConfigurationWindow.cc index 052043e5d7416494426ad4f77bd792246a7935ab..ad928597d4648b823c429a311784420576e544e0 100644 --- a/src/ui/SerialConfigurationWindow.cc +++ b/src/ui/SerialConfigurationWindow.cc @@ -132,7 +132,8 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge connect(ui.parEven, SIGNAL(toggled(bool)), this, SLOT(setParityEven(bool))); connect(ui.dataBitsSpinBox, SIGNAL(valueChanged(int)), this->link, SLOT(setDataBits(int))); connect(ui.stopBitsSpinBox, SIGNAL(valueChanged(int)), this->link, SLOT(setStopBits(int))); - connect(ui.advCheckBox,SIGNAL(clicked(bool)),ui.advGroupBox,SLOT(setShown(bool))); + connect(ui.advCheckBox, SIGNAL(clicked(bool)), ui.advGroupBox, SLOT(setVisible(bool))); + ui.advCheckBox->setCheckable(true); ui.advCheckBox->setChecked(false); ui.advGroupBox->setVisible(false); diff --git a/src/ui/configuration/ApmFirmwareConfig.cc b/src/ui/configuration/ApmFirmwareConfig.cc index a79e4dfcb986fe75b052609e813cf6381cd32ed0..47e1ac72e9d84d1e0402d7d9deac5a4e8f640364 100644 --- a/src/ui/configuration/ApmFirmwareConfig.cc +++ b/src/ui/configuration/ApmFirmwareConfig.cc @@ -38,7 +38,7 @@ ApmFirmwareConfig::ApmFirmwareConfig(QWidget *parent) : QWidget(parent) ui.progressBar->setValue(0); ui.textBrowser->setVisible(false); - connect(ui.showOutputCheckBox,SIGNAL(clicked(bool)),ui.textBrowser,SLOT(setShown(bool))); + connect(ui.showOutputCheckBox,SIGNAL(clicked(bool)),ui.textBrowser,SLOT(setVisible(bool))); /*addBetaLabel(ui.roverPushButton); addBetaLabel(ui.planePushButton); diff --git a/src/ui/configuration/ApmHardwareConfig.cc b/src/ui/configuration/ApmHardwareConfig.cc index f576e6fa07ae9013016295f0e4ee8260036b4458..38aef8b6a7f8c0800e2f3145d604db94cb5b0ff3 100644 --- a/src/ui/configuration/ApmHardwareConfig.cc +++ b/src/ui/configuration/ApmHardwareConfig.cc @@ -49,13 +49,13 @@ ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent) ui.osdButton->setVisible(false); ui.cameraGimbalButton->setVisible(false); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.radio3DRButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.batteryMonitorButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.sonarButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.opticalFlowButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.osdButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.cameraGimbalButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.antennaTrackerButton,SLOT(setShown(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.radio3DRButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.batteryMonitorButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.sonarButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.opticalFlowButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.osdButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.cameraGimbalButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.antennaTrackerButton,SLOT(setVisible(bool))); connect(ui.frameTypeButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget())); @@ -157,27 +157,27 @@ void ApmHardwareConfig::activeUASSet(UASInterface *uas) } if (uas->getSystemType() == MAV_TYPE_FIXED_WING) { - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.arduPlaneLevelButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool))); - connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.airspeedButton,SLOT(setShown(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.arduPlaneLevelButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool))); + connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.airspeedButton,SLOT(setVisible(bool))); } else if (uas->getSystemType() == MAV_TYPE_QUADROTOR) { - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.frameTypeButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.accelCalibrateButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.frameTypeButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.accelCalibrateButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool))); } else if (uas->getSystemType() == MAV_TYPE_GROUND_ROVER) { - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool))); } else { - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool))); - connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool))); + connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool))); } ui.firmwareButton->setVisible(true); ui.manditoryHardware->setVisible(true); diff --git a/src/ui/linechart/IncrementalPlot.cc b/src/ui/linechart/IncrementalPlot.cc index a06077dab34213a58ab6b6d811d601d87cb37abc..705a1a984720ac68314fc34094666eccc7e67c48 100644 --- a/src/ui/linechart/IncrementalPlot.cc +++ b/src/ui/linechart/IncrementalPlot.cc @@ -100,8 +100,6 @@ IncrementalPlot::IncrementalPlot(QWidget *parent): resetScaling(); legend = NULL; - - connect(this, SIGNAL(legendChecked(QwtPlotItem*,bool)), this, SLOT(handleLegendClick(QwtPlotItem*,bool))); } IncrementalPlot::~IncrementalPlot()