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

GCS/emptygadget: EmptyGadget is a placeholder uavgadget. GCS is no longer well behaved with zero gadget plugins so it is recommended to always have emptygadget loaded.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@338 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
ephy 2010-03-19 17:29:28 +00:00 committed by ephy
parent 8137b68fbd
commit 7884356cf6
10 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<plugin name="EmptyGadget" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2010 OpenPilot Project</copyright>
<license></license>
<description>An empty gadget!</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
</dependencyList>
</plugin>

View File

@ -0,0 +1,21 @@
/*
* emptygadget.cpp
*
* Created on: Mar 11, 2010
* Author: peter
*/
#include "emptygadget.h"
#include "emptygadgetwidget.h"
#include <QtGui/QToolBar>
EmptyGadget::EmptyGadget(EmptyGadgetWidget *widget) :
IUAVGadget(widget),
m_widget(widget),
m_toolbar(new QToolBar())
{
}
EmptyGadget::~EmptyGadget()
{
}

View File

@ -0,0 +1,40 @@
/*
* emptygadget.h
*
* Created on: Mar 11, 2010
* Author: peter
*/
#ifndef EMPTYGADGET_H_
#define EMPTYGADGET_H_
#include <coreplugin/iuavgadget.h>
class IUAVGadget;
//class QList<int>;
class QWidget;
class QString;
class EmptyGadgetWidget;
using namespace Core;
class EmptyGadget : public Core::IUAVGadget
{
Q_OBJECT
public:
EmptyGadget(EmptyGadgetWidget *widget = 0);
~EmptyGadget();
QList<int> context() const { return m_context; }
QWidget *widget() { return m_widget; }
QString contextHelpId() const { return QString(); }
QWidget *toolBar() { return m_toolbar; }
private:
QWidget *m_widget;
QWidget *m_toolbar;
QList<int> m_context;
};
#endif // EMPTYGADGET_H_

View File

@ -0,0 +1,16 @@
TEMPLATE = lib
TARGET = EmptyGadget
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
HEADERS += emptyplugin.h
HEADERS += emptygadget.h
HEADERS += emptygadgetwidget.h
HEADERS += emptygadgetfactory.h
SOURCES += emptyplugin.cpp
SOURCES += emptygadget.cpp
SOURCES += emptygadgetfactory.cpp
SOURCES += emptygadgetwidget.cpp
OTHER_FILES += EmptyGadget.pluginspec

View File

@ -0,0 +1,28 @@
/*
* emptygadgetfactory.cpp
*
* Created on: Mar 11, 2010
* Author: peter
*/
#include "emptygadgetfactory.h"
#include "emptygadgetwidget.h"
#include "emptygadget.h"
#include <coreplugin/iuavgadget.h>
EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) : IUAVGadgetFactory(parent)
{
}
EmptyGadgetFactory::~EmptyGadgetFactory()
{
}
Core::IUAVGadget* EmptyGadgetFactory::createUAVGadget(QWidget *parent) {
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
return new EmptyGadget(gadgetWidget);
}
QString EmptyGadgetFactory::name() {
return QString("EmptyGadget");
}

View File

@ -0,0 +1,28 @@
/*
* emptygadgetfactory.h
*
* Created on: Mar 6, 2010
* Author: peter
*/
#ifndef EMPTYGADGETFACTORY_H_
#define EMPTYGADGETFACTORY_H_
#include <coreplugin/iuavgadgetfactory.h>
using namespace Core;
class IUAVGadget;
class IUAVGadgetFactory;
class EmptyGadgetFactory : public Core::IUAVGadgetFactory
{
Q_OBJECT
public:
EmptyGadgetFactory(QObject *parent = 0);
~EmptyGadgetFactory();
Core::IUAVGadget *createUAVGadget(QWidget *parent);
QString name();
};
#endif // EMPTYGADGETFACTORY_H_

View File

@ -0,0 +1,28 @@
/*
* emptygadgetwidget.cpp
*
* Created on: Mar 6, 2010
* Author: peter
*/
#include "emptygadgetwidget.h"
#include <QDebug>
#include <QStringList>
#include <QtGui/QWidget>
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
EmptyGadgetWidget::EmptyGadgetWidget(QWidget *parent) : QLabel(parent)
{
setMinimumSize(64,64);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setText(QString("Empty gadget"));
}
EmptyGadgetWidget::~EmptyGadgetWidget()
{
// Do nothing
}

View File

@ -0,0 +1,27 @@
/*
* emptygadgetwidget.h
*
* Created on: Mar 6, 2010
* Author: peter
*/
#ifndef EMPTYGADGETWIDGET_H_
#define EMPTYGADGETWIDGET_H_
#include <QtGui/QWidget>
#include <QtGui/QLabel>
class QWidget;
class QLabel;
class EmptyGadgetWidget : public QLabel
{
Q_OBJECT
public:
EmptyGadgetWidget(QWidget *parent = 0);
~EmptyGadgetWidget();
private:
};
#endif /* EMPTYGADGETWIDGET_H_ */

View File

@ -0,0 +1,46 @@
/*
* emptyplugin.cpp
*
* Created on: Mar 6, 2010
* Author: peter
*/
#include "emptyplugin.h"
#include "emptygadgetfactory.h"
#include <QDebug>
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
EmptyPlugin::EmptyPlugin()
{
// Do nothing
}
EmptyPlugin::~EmptyPlugin()
{
// Do nothing
}
bool EmptyPlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
mf = new EmptyGadgetFactory(this);
addAutoReleasedObject(mf);
qDebug() << "EmptyPlugin::initialize()";
return true;
}
void EmptyPlugin::extensionsInitialized()
{
// Do nothing
}
void EmptyPlugin::shutdown()
{
// Do nothing
}
Q_EXPORT_PLUGIN(EmptyPlugin)

View File

@ -0,0 +1,27 @@
/*
* emptyplugin.h
*
* Created on: Mar 6, 2010
* Author: peter
*/
#ifndef EMPTYPLUGIN_H_
#define EMPTYPLUGIN_H_
#include <extensionsystem/iplugin.h>
class EmptyGadgetFactory;
class EmptyPlugin : public ExtensionSystem::IPlugin
{
public:
EmptyPlugin();
~EmptyPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private:
EmptyGadgetFactory *mf;
};
#endif /* EMPTYPLUGIN_H_ */