1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

GCS/empty,map,scope: Updates to gadgets from interface changes.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@385 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
ephy 2010-03-25 18:34:58 +00:00 committed by ephy
parent 6587eb0524
commit b0e9e527f0
11 changed files with 48 additions and 35 deletions

View File

@ -41,7 +41,7 @@ EmptyGadgetFactory::~EmptyGadgetFactory()
} }
Core::IUAVGadget* EmptyGadgetFactory::createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) { Core::IUAVGadget* EmptyGadgetFactory::createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent); EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
return new EmptyGadget(QString("EmptyGadget"), configurations, gadgetWidget); return new EmptyGadget(QString("EmptyGadget"), configurations, gadgetWidget);
} }

View File

@ -41,7 +41,7 @@ public:
EmptyGadgetFactory(QObject *parent = 0); EmptyGadgetFactory(QObject *parent = 0);
~EmptyGadgetFactory(); ~EmptyGadgetFactory();
Core::IUAVGadget *createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent); Core::IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
}; };
#endif // EMPTYGADGETFACTORY_H_ #endif // EMPTYGADGETFACTORY_H_

View File

@ -4,15 +4,15 @@ include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/coreplugin/coreplugin.pri)
include(../../libs/qmapcontrol/qmapcontrol.pri) include(../../libs/qmapcontrol/qmapcontrol.pri)
HEADERS += mapplugin.h \ HEADERS += mapplugin.h \
mapgadgetconfiguration.h mapgadgetconfiguration.h \
HEADERS += mapgadget.h mapgadget.h \
HEADERS += mapgadgetwidget.h mapgadgetwidget.h \
HEADERS += mapgadgetfactory.h mapgadgetfactory.h \
HEADERS += mapgadgetoptionspage.h mapgadgetoptionspage.h
SOURCES += mapplugin.cpp \ SOURCES += mapplugin.cpp \
mapgadgetconfiguration.cpp mapgadgetconfiguration.cpp \
SOURCES += mapgadget.cpp mapgadget.cpp \
SOURCES += mapgadgetfactory.cpp mapgadgetfactory.cpp \
SOURCES += mapgadgetwidget.cpp mapgadgetwidget.cpp \
SOURCES += mapgadgetoptionspage.cpp mapgadgetoptionspage.cpp
OTHER_FILES += MapGadget.pluginspec OTHER_FILES += MapGadget.pluginspec

View File

@ -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 MapGadgetConfiguration::saveState() const
{ {
QByteArray bytes; QByteArray bytes;

View File

@ -39,7 +39,7 @@ public:
explicit MapGadgetConfiguration(bool locked, QString classId, QString name, const QByteArray &state = 0, QObject *parent = 0); explicit MapGadgetConfiguration(bool locked, QString classId, QString name, const QByteArray &state = 0, QObject *parent = 0);
int zoom() { return m_defaultZoom; } int zoom() { return m_defaultZoom; }
QByteArray saveState() const; QByteArray saveState() const;
IUAVGadgetConfiguration *clone() { return 0; } IUAVGadgetConfiguration *clone(QString name);
signals: signals:
public slots: public slots:

View File

@ -9,6 +9,7 @@
#include "mapgadget.h" #include "mapgadget.h"
#include "mapgadgetconfiguration.h" #include "mapgadgetconfiguration.h"
#include "mapgadgetoptionspage.h" #include "mapgadgetoptionspage.h"
#include <coreplugin/uavgadgetoptionspagedecorator.h>
#include <coreplugin/iuavgadget.h> #include <coreplugin/iuavgadget.h>
MapGadgetFactory::MapGadgetFactory(QObject *parent) : MapGadgetFactory::MapGadgetFactory(QObject *parent) :
@ -20,23 +21,23 @@ MapGadgetFactory::MapGadgetFactory(QObject *parent) :
MapGadgetFactory::~MapGadgetFactory() MapGadgetFactory::~MapGadgetFactory()
{ {
} }
Core::IUAVGadget* MapGadgetFactory::createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) { Core::IUAVGadget* MapGadgetFactory::createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent); MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent);
return new MapGadget(QString("MapGadget"), configurations, gadgetWidget); return new MapGadget(QString("MapGadget"), configurations, gadgetWidget);
} }
IUAVGadgetConfiguration *MapGadgetFactory::createUAVGadgetConfiguration(bool locked, IUAVGadgetConfiguration *MapGadgetFactory::createConfiguration(bool locked,
const QString configName, const QString configName,
const QByteArray &state) const QByteArray &state)
{ {
return new MapGadgetConfiguration(locked, QString("MapGadget"), configName, 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);
} }

View File

@ -24,11 +24,11 @@ public:
MapGadgetFactory(QObject *parent = 0); MapGadgetFactory(QObject *parent = 0);
~MapGadgetFactory(); ~MapGadgetFactory();
Core::IUAVGadget *createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent); Core::IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
IUAVGadgetConfiguration *createUAVGadgetConfiguration(bool locked, IUAVGadgetConfiguration *createConfiguration(bool locked,
const QString configName, const QString configName,
const QByteArray &state); const QByteArray &state);
UAVGadgetOptionsPage *createUAVGadgetOptionsPage(IUAVGadgetConfiguration *config); IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
}; };
#endif // MAPGADGETFACTORY_H_ #endif // MAPGADGETFACTORY_H_

View File

@ -30,14 +30,14 @@
#include <QtGui/QLabel> #include <QtGui/QLabel>
MapGadgetOptionsPage::MapGadgetOptionsPage(IUAVGadgetConfiguration *config, QObject *parent) : MapGadgetOptionsPage::MapGadgetOptionsPage(IUAVGadgetConfiguration *config, QObject *parent) :
UAVGadgetOptionsPage(config, parent) IOptionsPage(parent),
m_config(qobject_cast<MapGadgetConfiguration*>(config))
{ {
m_config = qobject_cast<MapGadgetConfiguration*>(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())); // QLabel *label = new QLabel(QString(m_config->zoom()));
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
return label; return label;

View File

@ -28,18 +28,26 @@
#ifndef MAPGADGETOPTIONSPAGE_H #ifndef MAPGADGETOPTIONSPAGE_H
#define MAPGADGETOPTIONSPAGE_H #define MAPGADGETOPTIONSPAGE_H
#include "coreplugin/uavgadgetoptionspage.h" #include "coreplugin/dialogs/ioptionspage.h"
namespace Core {
class IUAVGadgetConfiguration;
}
class MapGadgetConfiguration; class MapGadgetConfiguration;
using namespace Core; using namespace Core;
class MapGadgetOptionsPage : public UAVGadgetOptionsPage class MapGadgetOptionsPage : public IOptionsPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MapGadgetOptionsPage(IUAVGadgetConfiguration *config, QObject *parent = 0); 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 apply();
void finish(); void finish();
@ -49,7 +57,6 @@ public slots:
private: private:
MapGadgetConfiguration *m_config; MapGadgetConfiguration *m_config;
}; };
#endif // MAPGADGETOPTIONSPAGE_H #endif // MAPGADGETOPTIONSPAGE_H

View File

@ -21,7 +21,7 @@ ScopeGadgetFactory::~ScopeGadgetFactory()
} }
Core::IUAVGadget* ScopeGadgetFactory::createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) { Core::IUAVGadget* ScopeGadgetFactory::createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent); ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent);
return new ScopeGadget(QString("ScopeGadget"), configurations, gadgetWidget); return new ScopeGadget(QString("ScopeGadget"), configurations, gadgetWidget);
} }

View File

@ -21,7 +21,7 @@ public:
ScopeGadgetFactory(QObject *parent = 0); ScopeGadgetFactory(QObject *parent = 0);
~ScopeGadgetFactory(); ~ScopeGadgetFactory();
Core::IUAVGadget *createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent); Core::IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
}; };
#endif // SCOPEGADGETFACTORY_H_ #endif // SCOPEGADGETFACTORY_H_