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);
return new EmptyGadget(QString("EmptyGadget"), configurations, gadgetWidget);
}

View File

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

View File

@ -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

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 bytes;

View File

@ -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:

View File

@ -9,6 +9,7 @@
#include "mapgadget.h"
#include "mapgadgetconfiguration.h"
#include "mapgadgetoptionspage.h"
#include <coreplugin/uavgadgetoptionspagedecorator.h>
#include <coreplugin/iuavgadget.h>
MapGadgetFactory::MapGadgetFactory(QObject *parent) :
@ -20,23 +21,23 @@ MapGadgetFactory::MapGadgetFactory(QObject *parent) :
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);
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);
}

View File

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

View File

@ -30,14 +30,14 @@
#include <QtGui/QLabel>
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()));
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
return label;

View File

@ -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

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);
return new ScopeGadget(QString("ScopeGadget"), configurations, gadgetWidget);
}

View File

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