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@380 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
ephy 2010-03-24 19:50:09 +00:00 committed by ephy
parent 0516034897
commit 9c042a35f4
17 changed files with 260 additions and 91 deletions

View File

@ -1,19 +1,36 @@
/* /**
* emptygadget.cpp ******************************************************************************
* *
* Created on: Mar 11, 2010 * @file emptygadget.cpp
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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
*/ */
#include "emptygadget.h" #include "emptygadget.h"
#include "emptygadgetwidget.h" #include "emptygadgetwidget.h"
#include <QtGui/QToolBar>
EmptyGadget::EmptyGadget(EmptyGadgetWidget *widget) : EmptyGadget::EmptyGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, EmptyGadgetWidget *widget) :
IUAVGadget(widget), IUAVGadget(classId, configurations, widget),
m_widget(widget), m_widget(widget)
m_toolbar(new QToolBar())
{ {
m_gadgetKind = QString("EmptyGadget");
} }
EmptyGadget::~EmptyGadget() EmptyGadget::~EmptyGadget()

View File

@ -1,8 +1,28 @@
/* /**
* emptygadget.h ******************************************************************************
* *
* Created on: Mar 11, 2010 * @file emptygadget.h
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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 EMPTYGADGET_H_ #ifndef EMPTYGADGET_H_
@ -11,7 +31,6 @@
#include <coreplugin/iuavgadget.h> #include <coreplugin/iuavgadget.h>
class IUAVGadget; class IUAVGadget;
//class QList<int>;
class QWidget; class QWidget;
class QString; class QString;
class EmptyGadgetWidget; class EmptyGadgetWidget;
@ -22,17 +41,15 @@ class EmptyGadget : public Core::IUAVGadget
{ {
Q_OBJECT Q_OBJECT
public: public:
EmptyGadget(EmptyGadgetWidget *widget = 0); EmptyGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, EmptyGadgetWidget *widget = 0);
~EmptyGadget(); ~EmptyGadget();
QList<int> context() const { return m_context; } QList<int> context() const { return m_context; }
QWidget *widget() { return m_widget; } QWidget *widget() { return m_widget; }
QString contextHelpId() const { return QString(); } QString contextHelpId() const { return QString(); }
QWidget *toolBar() { return m_toolbar; }
private: private:
QWidget *m_widget; QWidget *m_widget;
QWidget *m_toolbar;
QList<int> m_context; QList<int> m_context;
}; };

View File

@ -1,18 +1,39 @@
/* /**
* emptygadgetfactory.cpp ******************************************************************************
* *
* Created on: Mar 11, 2010 * @file emptygadgetfactory.cpp
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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
*/ */
#include "emptygadgetfactory.h" #include "emptygadgetfactory.h"
#include "emptygadgetwidget.h" #include "emptygadgetwidget.h"
#include "emptygadget.h" #include "emptygadget.h"
#include <coreplugin/iuavgadget.h> #include <coreplugin/iuavgadget.h>
EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) : IUAVGadgetFactory(parent) EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("EmptyGadget"),
tr("Choose Gadget..."),
parent)
{ {
m_name = tr("Choose gadget...");
m_gadgetKind = QString("EmptyGadget");
} }
EmptyGadgetFactory::~EmptyGadgetFactory() EmptyGadgetFactory::~EmptyGadgetFactory()
@ -20,7 +41,7 @@ EmptyGadgetFactory::~EmptyGadgetFactory()
} }
Core::IUAVGadget* EmptyGadgetFactory::createUAVGadget(QWidget *parent) { Core::IUAVGadget* EmptyGadgetFactory::createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent); EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
return new EmptyGadget(gadgetWidget); return new EmptyGadget(QString("EmptyGadget"), configurations, gadgetWidget);
} }

View File

@ -1,8 +1,28 @@
/* /**
* emptygadgetfactory.h ******************************************************************************
* *
* Created on: Mar 6, 2010 * @file emptygadgetfactory.h
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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 EMPTYGADGETFACTORY_H_ #ifndef EMPTYGADGETFACTORY_H_
@ -21,7 +41,7 @@ public:
EmptyGadgetFactory(QObject *parent = 0); EmptyGadgetFactory(QObject *parent = 0);
~EmptyGadgetFactory(); ~EmptyGadgetFactory();
Core::IUAVGadget *createUAVGadget(QWidget *parent); Core::IUAVGadget *createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
}; };
#endif // EMPTYGADGETFACTORY_H_ #endif // EMPTYGADGETFACTORY_H_

View File

@ -1,8 +1,28 @@
/* /**
* emptygadgetwidget.cpp ******************************************************************************
* *
* Created on: Mar 6, 2010 * @file emptygadgetwidget.cpp
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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
*/ */
#include "emptygadgetwidget.h" #include "emptygadgetwidget.h"

View File

@ -1,8 +1,28 @@
/* /**
* emptygadgetwidget.h ******************************************************************************
* *
* Created on: Mar 6, 2010 * @file emptygadgetwidget.h
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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 EMPTYGADGETWIDGET_H_ #ifndef EMPTYGADGETWIDGET_H_

View File

@ -1,8 +1,28 @@
/* /**
* emptyplugin.cpp ******************************************************************************
* *
* Created on: Mar 6, 2010 * @file emptyplugin.cpp
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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
*/ */
#include "emptyplugin.h" #include "emptyplugin.h"
#include "emptygadgetfactory.h" #include "emptygadgetfactory.h"

View File

@ -1,8 +1,28 @@
/* /**
* emptyplugin.h ******************************************************************************
* *
* Created on: Mar 6, 2010 * @file emptyplugin.h
* Author: peter * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup emptygadget
* @{
*
*****************************************************************************/
/*
* 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 EMPTYPLUGIN_H_ #ifndef EMPTYPLUGIN_H_

View File

@ -1,18 +1,18 @@
TEMPLATE = lib TEMPLATE = lib
TARGET = MapGadget TARGET = MapGadget
include(../../openpilotgcsplugin.pri) 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
HEADERS += mapgadget.h HEADERS += mapgadget.h
HEADERS += mapgadgetwidget.h HEADERS += mapgadgetwidget.h
HEADERS += mapgadgetfactory.h HEADERS += mapgadgetfactory.h
SOURCES += mapplugin.cpp HEADERS += mapgadgetoptionspage.h
SOURCES += mapplugin.cpp \
mapgadgetconfiguration.cpp
SOURCES += mapgadget.cpp SOURCES += mapgadget.cpp
SOURCES += mapgadgetfactory.cpp SOURCES += mapgadgetfactory.cpp
SOURCES += mapgadgetwidget.cpp SOURCES += mapgadgetwidget.cpp
SOURCES += mapgadgetoptionspage.cpp
OTHER_FILES += MapGadget.pluginspec OTHER_FILES += MapGadget.pluginspec

View File

@ -6,14 +6,11 @@
*/ */
#include "mapgadget.h" #include "mapgadget.h"
#include "mapgadgetwidget.h" #include "mapgadgetwidget.h"
#include <QtGui/QToolBar>
MapGadget::MapGadget(MapGadgetWidget *widget) : MapGadget::MapGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, MapGadgetWidget *widget) :
IUAVGadget(widget), IUAVGadget(classId, configurations, widget),
m_widget(widget), m_widget(widget)
m_toolbar(new QToolBar())
{ {
m_gadgetKind = QString("MapGadget");
} }
MapGadget::~MapGadget() MapGadget::~MapGadget()

View File

@ -22,17 +22,15 @@ class MapGadget : public Core::IUAVGadget
{ {
Q_OBJECT Q_OBJECT
public: public:
MapGadget(MapGadgetWidget *widget = 0); MapGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, MapGadgetWidget *widget = 0);
~MapGadget(); ~MapGadget();
QList<int> context() const { return m_context; } QList<int> context() const { return m_context; }
QWidget *widget() { return m_widget; } QWidget *widget() { return m_widget; }
QString contextHelpId() const { return QString(); } QString contextHelpId() const { return QString(); }
QWidget *toolBar() { return m_toolbar; }
private: private:
QWidget *m_widget; QWidget *m_widget;
QWidget *m_toolbar;
QList<int> m_context; QList<int> m_context;
}; };

View File

@ -7,12 +7,15 @@
#include "mapgadgetfactory.h" #include "mapgadgetfactory.h"
#include "mapgadgetwidget.h" #include "mapgadgetwidget.h"
#include "mapgadget.h" #include "mapgadget.h"
#include "mapgadgetconfiguration.h"
#include "mapgadgetoptionspage.h"
#include <coreplugin/iuavgadget.h> #include <coreplugin/iuavgadget.h>
MapGadgetFactory::MapGadgetFactory(QObject *parent) : IUAVGadgetFactory(parent) MapGadgetFactory::MapGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("MapGadget"),
tr("Map Gadget"),
parent)
{ {
m_name = tr("Map Gadget");
m_gadgetKind = QString("MapGadget");
} }
MapGadgetFactory::~MapGadgetFactory() MapGadgetFactory::~MapGadgetFactory()
@ -20,7 +23,20 @@ MapGadgetFactory::~MapGadgetFactory()
} }
Core::IUAVGadget* MapGadgetFactory::createUAVGadget(QWidget *parent) { Core::IUAVGadget* MapGadgetFactory::createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent); MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent);
return new MapGadget(gadgetWidget); return new MapGadget(QString("MapGadget"), configurations, gadgetWidget);
} }
IUAVGadgetConfiguration *MapGadgetFactory::createUAVGadgetConfiguration(bool locked,
const QString configName,
const QByteArray &state)
{
return new MapGadgetConfiguration(locked, QString("MapGadget"), configName, state);
}
UAVGadgetOptionsPage *MapGadgetFactory::createUAVGadgetOptionsPage(IUAVGadgetConfiguration *config)
{
return new MapGadgetOptionsPage(config);
}

View File

@ -10,9 +10,12 @@
#include <coreplugin/iuavgadgetfactory.h> #include <coreplugin/iuavgadgetfactory.h>
using namespace Core; namespace Core {
class IUAVGadget; class IUAVGadget;
class IUAVGadgetFactory; class IUAVGadgetFactory;
}
using namespace Core;
class MapGadgetFactory : public Core::IUAVGadgetFactory class MapGadgetFactory : public Core::IUAVGadgetFactory
{ {
@ -21,7 +24,11 @@ public:
MapGadgetFactory(QObject *parent = 0); MapGadgetFactory(QObject *parent = 0);
~MapGadgetFactory(); ~MapGadgetFactory();
Core::IUAVGadget *createUAVGadget(QWidget *parent); Core::IUAVGadget *createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
IUAVGadgetConfiguration *createUAVGadgetConfiguration(bool locked,
const QString configName,
const QByteArray &state);
UAVGadgetOptionsPage *createUAVGadgetOptionsPage(IUAVGadgetConfiguration *config);
}; };
#endif // MAPGADGETFACTORY_H_ #endif // MAPGADGETFACTORY_H_

View File

@ -6,14 +6,11 @@
*/ */
#include "scopegadget.h" #include "scopegadget.h"
#include "scopegadgetwidget.h" #include "scopegadgetwidget.h"
#include <QtGui/QToolBar>
ScopeGadget::ScopeGadget(ScopeGadgetWidget *widget) : ScopeGadget::ScopeGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, ScopeGadgetWidget *widget) :
IUAVGadget(widget), IUAVGadget(classId, configurations, widget),
m_widget(widget), m_widget(widget)
m_toolbar(new QToolBar())
{ {
m_gadgetKind = QString("ScopeGadget");
} }
ScopeGadget::~ScopeGadget() ScopeGadget::~ScopeGadget()

View File

@ -22,17 +22,15 @@ class ScopeGadget : public Core::IUAVGadget
{ {
Q_OBJECT Q_OBJECT
public: public:
ScopeGadget(ScopeGadgetWidget *widget = 0); ScopeGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, ScopeGadgetWidget *widget = 0);
~ScopeGadget(); ~ScopeGadget();
QList<int> context() const { return m_context; } QList<int> context() const { return m_context; }
QWidget *widget() { return m_widget; } QWidget *widget() { return m_widget; }
QString contextHelpId() const { return QString(); } QString contextHelpId() const { return QString(); }
QWidget *toolBar() { return m_toolbar; }
private: private:
QWidget *m_widget; QWidget *m_widget;
QWidget *m_toolbar;
QList<int> m_context; QList<int> m_context;
}; };

View File

@ -9,10 +9,11 @@
#include "scopegadget.h" #include "scopegadget.h"
#include <coreplugin/iuavgadget.h> #include <coreplugin/iuavgadget.h>
ScopeGadgetFactory::ScopeGadgetFactory(QObject *parent) : IUAVGadgetFactory(parent) ScopeGadgetFactory::ScopeGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("ScopeGadget"),
tr("Scope Gadget"),
parent)
{ {
m_name = tr("Scope Gadget");
m_gadgetKind = QString("ScopeGadget");
} }
ScopeGadgetFactory::~ScopeGadgetFactory() ScopeGadgetFactory::~ScopeGadgetFactory()
@ -20,7 +21,7 @@ ScopeGadgetFactory::~ScopeGadgetFactory()
} }
Core::IUAVGadget* ScopeGadgetFactory::createUAVGadget(QWidget *parent) { Core::IUAVGadget* ScopeGadgetFactory::createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent); ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent);
return new ScopeGadget(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(QWidget *parent); Core::IUAVGadget *createUAVGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
}; };
#endif // SCOPEGADGETFACTORY_H_ #endif // SCOPEGADGETFACTORY_H_