diff --git a/ground/src/plugins/emptygadget/emptygadgetfactory.cpp b/ground/src/plugins/emptygadget/emptygadgetfactory.cpp index b05067856..9f96f2a30 100644 --- a/ground/src/plugins/emptygadget/emptygadgetfactory.cpp +++ b/ground/src/plugins/emptygadget/emptygadgetfactory.cpp @@ -41,7 +41,7 @@ EmptyGadgetFactory::~EmptyGadgetFactory() } -Core::IUAVGadget* EmptyGadgetFactory::createUAVGadget(QList *configurations, QWidget *parent) { +Core::IUAVGadget* EmptyGadgetFactory::createGadget(QList *configurations, QWidget *parent) { EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent); return new EmptyGadget(QString("EmptyGadget"), configurations, gadgetWidget); } diff --git a/ground/src/plugins/emptygadget/emptygadgetfactory.h b/ground/src/plugins/emptygadget/emptygadgetfactory.h index 0f0c01e7b..d652e3cc7 100644 --- a/ground/src/plugins/emptygadget/emptygadgetfactory.h +++ b/ground/src/plugins/emptygadget/emptygadgetfactory.h @@ -41,7 +41,7 @@ public: EmptyGadgetFactory(QObject *parent = 0); ~EmptyGadgetFactory(); - Core::IUAVGadget *createUAVGadget(QList *configurations, QWidget *parent); + Core::IUAVGadget *createGadget(QList *configurations, QWidget *parent); }; #endif // EMPTYGADGETFACTORY_H_ diff --git a/ground/src/plugins/map/map.pro b/ground/src/plugins/map/map.pro index fa3410e9f..dc7ae1044 100644 --- a/ground/src/plugins/map/map.pro +++ b/ground/src/plugins/map/map.pro @@ -4,15 +4,15 @@ include(../../openpilotgcsplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) include(../../libs/qmapcontrol/qmapcontrol.pri) HEADERS += mapplugin.h \ - mapgadgetconfiguration.h -HEADERS += mapgadget.h -HEADERS += mapgadgetwidget.h -HEADERS += mapgadgetfactory.h -HEADERS += mapgadgetoptionspage.h + mapgadgetconfiguration.h \ + mapgadget.h \ + mapgadgetwidget.h \ + mapgadgetfactory.h \ + mapgadgetoptionspage.h SOURCES += mapplugin.cpp \ - mapgadgetconfiguration.cpp -SOURCES += mapgadget.cpp -SOURCES += mapgadgetfactory.cpp -SOURCES += mapgadgetwidget.cpp -SOURCES += mapgadgetoptionspage.cpp + mapgadgetconfiguration.cpp \ + mapgadget.cpp \ + mapgadgetfactory.cpp \ + mapgadgetwidget.cpp \ + mapgadgetoptionspage.cpp OTHER_FILES += MapGadget.pluginspec diff --git a/ground/src/plugins/map/mapgadgetconfiguration.cpp b/ground/src/plugins/map/mapgadgetconfiguration.cpp index 2f250e71a..0ca2790c4 100644 --- a/ground/src/plugins/map/mapgadgetconfiguration.cpp +++ b/ground/src/plugins/map/mapgadgetconfiguration.cpp @@ -40,6 +40,11 @@ MapGadgetConfiguration::MapGadgetConfiguration(bool locked, QString classId, QSt } } +IUAVGadgetConfiguration *MapGadgetConfiguration::clone(QString name) +{ + return new MapGadgetConfiguration(this->locked(), this->classId(), name); +} + QByteArray MapGadgetConfiguration::saveState() const { QByteArray bytes; diff --git a/ground/src/plugins/map/mapgadgetconfiguration.h b/ground/src/plugins/map/mapgadgetconfiguration.h index 5976b6b70..c956b92ad 100644 --- a/ground/src/plugins/map/mapgadgetconfiguration.h +++ b/ground/src/plugins/map/mapgadgetconfiguration.h @@ -39,7 +39,7 @@ public: explicit MapGadgetConfiguration(bool locked, QString classId, QString name, const QByteArray &state = 0, QObject *parent = 0); int zoom() { return m_defaultZoom; } QByteArray saveState() const; - IUAVGadgetConfiguration *clone() { return 0; } + IUAVGadgetConfiguration *clone(QString name); signals: public slots: diff --git a/ground/src/plugins/map/mapgadgetfactory.cpp b/ground/src/plugins/map/mapgadgetfactory.cpp index 3b2b14256..89a3af277 100644 --- a/ground/src/plugins/map/mapgadgetfactory.cpp +++ b/ground/src/plugins/map/mapgadgetfactory.cpp @@ -9,6 +9,7 @@ #include "mapgadget.h" #include "mapgadgetconfiguration.h" #include "mapgadgetoptionspage.h" +#include #include MapGadgetFactory::MapGadgetFactory(QObject *parent) : @@ -20,23 +21,23 @@ MapGadgetFactory::MapGadgetFactory(QObject *parent) : MapGadgetFactory::~MapGadgetFactory() { - } -Core::IUAVGadget* MapGadgetFactory::createUAVGadget(QList *configurations, QWidget *parent) { +Core::IUAVGadget* MapGadgetFactory::createGadget(QList *configurations, QWidget *parent) { MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent); return new MapGadget(QString("MapGadget"), configurations, gadgetWidget); } -IUAVGadgetConfiguration *MapGadgetFactory::createUAVGadgetConfiguration(bool locked, - const QString configName, - const QByteArray &state) +IUAVGadgetConfiguration *MapGadgetFactory::createConfiguration(bool locked, + const QString configName, + const QByteArray &state) { return new MapGadgetConfiguration(locked, QString("MapGadget"), configName, state); } -UAVGadgetOptionsPage *MapGadgetFactory::createUAVGadgetOptionsPage(IUAVGadgetConfiguration *config) +IOptionsPage *MapGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) { - return new MapGadgetOptionsPage(config); + MapGadgetOptionsPage *page = new MapGadgetOptionsPage(config); + return new UAVGadgetOptionsPageDecorator(page, config); } diff --git a/ground/src/plugins/map/mapgadgetfactory.h b/ground/src/plugins/map/mapgadgetfactory.h index d114bd1f9..bb3235eff 100644 --- a/ground/src/plugins/map/mapgadgetfactory.h +++ b/ground/src/plugins/map/mapgadgetfactory.h @@ -24,11 +24,11 @@ public: MapGadgetFactory(QObject *parent = 0); ~MapGadgetFactory(); - Core::IUAVGadget *createUAVGadget(QList *configurations, QWidget *parent); - IUAVGadgetConfiguration *createUAVGadgetConfiguration(bool locked, - const QString configName, - const QByteArray &state); - UAVGadgetOptionsPage *createUAVGadgetOptionsPage(IUAVGadgetConfiguration *config); + Core::IUAVGadget *createGadget(QList *configurations, QWidget *parent); + IUAVGadgetConfiguration *createConfiguration(bool locked, + const QString configName, + const QByteArray &state); + IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); }; #endif // MAPGADGETFACTORY_H_ diff --git a/ground/src/plugins/map/mapgadgetoptionspage.cpp b/ground/src/plugins/map/mapgadgetoptionspage.cpp index 501d62aa0..55a1fe2d7 100644 --- a/ground/src/plugins/map/mapgadgetoptionspage.cpp +++ b/ground/src/plugins/map/mapgadgetoptionspage.cpp @@ -30,14 +30,14 @@ #include MapGadgetOptionsPage::MapGadgetOptionsPage(IUAVGadgetConfiguration *config, QObject *parent) : - UAVGadgetOptionsPage(config, parent) + IOptionsPage(parent), + m_config(qobject_cast(config)) { - m_config = qobject_cast(config); } -QWidget *MapGadgetOptionsPage::widget() +QWidget *MapGadgetOptionsPage::createPage(QWidget *parent) { - QWidget *label = new QLabel("Settings will be here."); + QWidget *label = new QLabel("Settings will be here.", parent); // QLabel *label = new QLabel(QString(m_config->zoom())); label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); return label; diff --git a/ground/src/plugins/map/mapgadgetoptionspage.h b/ground/src/plugins/map/mapgadgetoptionspage.h index a45967bc2..bb102812c 100644 --- a/ground/src/plugins/map/mapgadgetoptionspage.h +++ b/ground/src/plugins/map/mapgadgetoptionspage.h @@ -28,18 +28,26 @@ #ifndef MAPGADGETOPTIONSPAGE_H #define MAPGADGETOPTIONSPAGE_H -#include "coreplugin/uavgadgetoptionspage.h" +#include "coreplugin/dialogs/ioptionspage.h" +namespace Core { +class IUAVGadgetConfiguration; +} class MapGadgetConfiguration; using namespace Core; -class MapGadgetOptionsPage : public UAVGadgetOptionsPage +class MapGadgetOptionsPage : public IOptionsPage { Q_OBJECT public: explicit MapGadgetOptionsPage(IUAVGadgetConfiguration *config, QObject *parent = 0); - QWidget *widget(); + QString id() const { return ""; } + QString trName() const { return ""; } + QString category() const { return ""; } + QString trCategory() const { return ""; } + + QWidget *createPage(QWidget *parent); void apply(); void finish(); @@ -49,7 +57,6 @@ public slots: private: MapGadgetConfiguration *m_config; - }; #endif // MAPGADGETOPTIONSPAGE_H diff --git a/ground/src/plugins/scope/scopegadgetfactory.cpp b/ground/src/plugins/scope/scopegadgetfactory.cpp index 6e1317281..b4d3d7814 100644 --- a/ground/src/plugins/scope/scopegadgetfactory.cpp +++ b/ground/src/plugins/scope/scopegadgetfactory.cpp @@ -21,7 +21,7 @@ ScopeGadgetFactory::~ScopeGadgetFactory() } -Core::IUAVGadget* ScopeGadgetFactory::createUAVGadget(QList *configurations, QWidget *parent) { +Core::IUAVGadget* ScopeGadgetFactory::createGadget(QList *configurations, QWidget *parent) { ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent); return new ScopeGadget(QString("ScopeGadget"), configurations, gadgetWidget); } diff --git a/ground/src/plugins/scope/scopegadgetfactory.h b/ground/src/plugins/scope/scopegadgetfactory.h index 0a209892f..53bbba91e 100644 --- a/ground/src/plugins/scope/scopegadgetfactory.h +++ b/ground/src/plugins/scope/scopegadgetfactory.h @@ -21,7 +21,7 @@ public: ScopeGadgetFactory(QObject *parent = 0); ~ScopeGadgetFactory(); - Core::IUAVGadget *createUAVGadget(QList *configurations, QWidget *parent); + Core::IUAVGadget *createGadget(QList *configurations, QWidget *parent); }; #endif // SCOPEGADGETFACTORY_H_