From 2c4f50c4f566907dd9e38be17fc8713a4d94bc80 Mon Sep 17 00:00:00 2001 From: PT_Dreamer Date: Sat, 6 Oct 2012 01:40:25 +0100 Subject: [PATCH] GCS-Export uploader functions --- .../src/plugins/uploader/devicewidget.h | 4 +- .../plugins/uploader/runningdevicewidget.h | 3 +- .../src/plugins/uploader/uploader.pri | 3 ++ .../src/plugins/uploader/uploader.pro | 14 +++---- .../uploader/uploader_dependencies.pri | 6 +++ .../src/plugins/uploader/uploader_global.h | 40 +++++++++++++++++++ .../src/plugins/uploader/uploadergadget.h | 3 +- .../uploader/uploadergadgetconfiguration.h | 3 +- .../uploader/uploadergadgetfactory.cpp | 4 +- .../plugins/uploader/uploadergadgetfactory.h | 8 +++- .../uploader/uploadergadgetoptionspage.h | 3 +- .../plugins/uploader/uploadergadgetwidget.h | 4 +- .../src/plugins/uploader/uploaderplugin.h | 3 +- 13 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/uploader/uploader.pri create mode 100644 ground/openpilotgcs/src/plugins/uploader/uploader_dependencies.pri create mode 100644 ground/openpilotgcs/src/plugins/uploader/uploader_global.h diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.h b/ground/openpilotgcs/src/plugins/uploader/devicewidget.h index d2eab8e28..eaf8c6a0f 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.h @@ -42,8 +42,10 @@ #include "devicedescriptorstruct.h" #include #include +#include "uploader_global.h" + using namespace OP_DFU; -class deviceWidget : public QWidget +class UPLOADER_EXPORT deviceWidget : public QWidget { Q_OBJECT public: diff --git a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h index 58e9583c1..18b354cce 100644 --- a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h @@ -39,8 +39,9 @@ #include "uavobjectmanager.h" #include "uavobject.h" #include "uavobjectutilmanager.h" +#include "uploader_global.h" -class runningDeviceWidget : public QWidget +class UPLOADER_EXPORT runningDeviceWidget : public QWidget { Q_OBJECT public: diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.pri b/ground/openpilotgcs/src/plugins/uploader/uploader.pri new file mode 100644 index 000000000..8425d3649 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.pri @@ -0,0 +1,3 @@ +include(uploader_dependencies.pri) + +LIBS *= -l$$qtLibraryName(Uploader) diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.pro b/ground/openpilotgcs/src/plugins/uploader/uploader.pro index 05742868d..490a9dd93 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.pro +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.pro @@ -1,12 +1,8 @@ TEMPLATE = lib TARGET = Uploader +DEFINES += UPLOADER_LIBRARY QT += svg -include(../../openpilotgcsplugin.pri) -include(../../plugins/coreplugin/coreplugin.pri) -include(../../plugins/uavobjects/uavobjects.pri) -include(../../plugins/uavtalk/uavtalk.pri) -include(../../plugins/rawhid/rawhid.pri) -include(../../plugins/uavobjectutil/uavobjectutil.pri) +include(uploader_dependencies.pri) INCLUDEPATH += ../../libs/qextserialport/src HEADERS += uploadergadget.h \ @@ -22,7 +18,9 @@ HEADERS += uploadergadget.h \ SSP/qssp.h \ SSP/qsspt.h \ SSP/common.h \ - runningdevicewidget.h + runningdevicewidget.h \ + uploader_global.h \ + enums.h SOURCES += uploadergadget.cpp \ uploadergadgetconfiguration.cpp \ uploadergadgetfactory.cpp \ @@ -36,7 +34,7 @@ SOURCES += uploadergadget.cpp \ SSP/qssp.cpp \ SSP/qsspt.cpp \ runningdevicewidget.cpp -OTHER_FILES += Uploader.pluginspec +OTHER_FILES += Uploader.pluginspec \ FORMS += \ uploader.ui \ diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader_dependencies.pri b/ground/openpilotgcs/src/plugins/uploader/uploader_dependencies.pri new file mode 100644 index 000000000..b85fc46a1 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uploader/uploader_dependencies.pri @@ -0,0 +1,6 @@ +include(../../openpilotgcsplugin.pri) +include(../../plugins/coreplugin/coreplugin.pri) +include(../../plugins/uavobjects/uavobjects.pri) +include(../../plugins/uavtalk/uavtalk.pri) +include(../../plugins/rawhid/rawhid.pri) +include(../../plugins/uavobjectutil/uavobjectutil.pri) diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader_global.h b/ground/openpilotgcs/src/plugins/uploader/uploader_global.h new file mode 100644 index 000000000..ee74a7bac --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uploader/uploader_global.h @@ -0,0 +1,40 @@ +/** + ****************************************************************************** + * + * @file uploader_global.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @see The GNU Public License (GPL) Version 3 + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup + * @{ + * @brief + *****************************************************************************/ +/* + * 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 UPLOADER_GLOBAL_H +#define UPLOADER_GLOBAL_H + +#include + +#if defined(UPLOADER_LIBRARY) +# define UPLOADER_EXPORT Q_DECL_EXPORT +#else +# define UPLOADER_EXPORT Q_DECL_IMPORT +#endif + +#endif diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadget.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadget.h index f698c81ea..369756a0b 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadget.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadget.h @@ -30,6 +30,7 @@ #include #include "uploadergadgetwidget.h" +#include "uploader_global.h" class IUAVGadget; class QWidget; @@ -38,7 +39,7 @@ class UploaderGadgetWidget; using namespace Core; -class UploaderGadget : public Core::IUAVGadget +class UPLOADER_EXPORT UploaderGadget : public Core::IUAVGadget { Q_OBJECT public: diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetconfiguration.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetconfiguration.h index 274a73fab..99a8e1ea7 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetconfiguration.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetconfiguration.h @@ -30,10 +30,11 @@ #include #include +#include "uploader_global.h" using namespace Core; -class UploaderGadgetConfiguration : public IUAVGadgetConfiguration +class UPLOADER_EXPORT UploaderGadgetConfiguration : public IUAVGadgetConfiguration { Q_OBJECT public: diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.cpp index 692985e5c..a42b16102 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.cpp @@ -26,11 +26,11 @@ */ #include "uploadergadgetfactory.h" -#include "uploadergadgetwidget.h" #include "uploadergadget.h" #include "uploadergadgetconfiguration.h" #include "uploadergadgetoptionspage.h" #include +#include "uploadergadgetwidget.h" UploaderGadgetFactory::UploaderGadgetFactory(QObject *parent) : IUAVGadgetFactory(QString("Uploader"), tr("Uploader"), parent) @@ -44,6 +44,8 @@ UploaderGadgetFactory::~UploaderGadgetFactory() Core::IUAVGadget* UploaderGadgetFactory::createGadget(QWidget *parent) { UploaderGadgetWidget* gadgetWidget = new UploaderGadgetWidget(parent); + connect(this,SIGNAL(autoUpdate()),gadgetWidget,SLOT(autoUpdate())); + connect(gadgetWidget,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant))); return new UploaderGadget(QString("Uploader"), gadgetWidget, parent); } diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.h index c836287b1..9a9edd821 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetfactory.h @@ -29,7 +29,8 @@ #define UPLOADERGADGETFACTORY_H #include - +#include "uploader_global.h" +#include "enums.h" namespace Core { class IUAVGadget; class IUAVGadgetFactory; @@ -37,7 +38,7 @@ class IUAVGadgetFactory; using namespace Core; -class UploaderGadgetFactory : public Core::IUAVGadgetFactory +class UPLOADER_EXPORT UploaderGadgetFactory : public Core::IUAVGadgetFactory { Q_OBJECT public: @@ -46,6 +47,9 @@ public: Core::IUAVGadget *createGadget(QWidget *parent); IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings); +signals: + void autoUpdateSignal(uploader::AutoUpdateStep,QVariant); + void autoUpdate(); }; #endif // UPLOADERGADGETFACTORY_H diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetoptionspage.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetoptionspage.h index e9df9bd07..16b05962e 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetoptionspage.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetoptionspage.h @@ -32,6 +32,7 @@ #include "QString" #include #include +#include "uploader_global.h" namespace Core { class IUAVGadgetConfiguration; @@ -43,7 +44,7 @@ class QSpinBox; using namespace Core; -class UploaderGadgetOptionsPage : public IOptionsPage +class UPLOADER_EXPORT UploaderGadgetOptionsPage : public IOptionsPage { Q_OBJECT public: diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h index f30496934..5b3fc8d3a 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h @@ -56,12 +56,12 @@ #include #include #include +#include "uploader_global.h" #include "enums.h" using namespace OP_DFU; using namespace uploader; - -class UploaderGadgetWidget : public QWidget +class UPLOADER_EXPORT UploaderGadgetWidget : public QWidget { Q_OBJECT diff --git a/ground/openpilotgcs/src/plugins/uploader/uploaderplugin.h b/ground/openpilotgcs/src/plugins/uploader/uploaderplugin.h index 33a5c0e9a..253ea9049 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploaderplugin.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploaderplugin.h @@ -29,10 +29,11 @@ #define UPLOADERPLUGIN_H #include +#include "uploader_global.h" class UploaderGadgetFactory; -class UploaderPlugin : public ExtensionSystem::IPlugin +class UPLOADER_EXPORT UploaderPlugin : public ExtensionSystem::IPlugin { public: UploaderPlugin();