mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-26 15:54:15 +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:
parent
8137b68fbd
commit
7884356cf6
10
ground/src/plugins/emptygadget/EmptyGadget.pluginspec
Normal file
10
ground/src/plugins/emptygadget/EmptyGadget.pluginspec
Normal 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>
|
21
ground/src/plugins/emptygadget/emptygadget.cpp
Normal file
21
ground/src/plugins/emptygadget/emptygadget.cpp
Normal 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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
40
ground/src/plugins/emptygadget/emptygadget.h
Normal file
40
ground/src/plugins/emptygadget/emptygadget.h
Normal 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_
|
16
ground/src/plugins/emptygadget/emptygadget.pro
Normal file
16
ground/src/plugins/emptygadget/emptygadget.pro
Normal 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
|
28
ground/src/plugins/emptygadget/emptygadgetfactory.cpp
Normal file
28
ground/src/plugins/emptygadget/emptygadgetfactory.cpp
Normal 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");
|
||||||
|
}
|
28
ground/src/plugins/emptygadget/emptygadgetfactory.h
Normal file
28
ground/src/plugins/emptygadget/emptygadgetfactory.h
Normal 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_
|
28
ground/src/plugins/emptygadget/emptygadgetwidget.cpp
Normal file
28
ground/src/plugins/emptygadget/emptygadgetwidget.cpp
Normal 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
|
||||||
|
}
|
||||||
|
|
27
ground/src/plugins/emptygadget/emptygadgetwidget.h
Normal file
27
ground/src/plugins/emptygadget/emptygadgetwidget.h
Normal 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_ */
|
46
ground/src/plugins/emptygadget/emptyplugin.cpp
Normal file
46
ground/src/plugins/emptygadget/emptyplugin.cpp
Normal 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)
|
||||||
|
|
27
ground/src/plugins/emptygadget/emptyplugin.h
Normal file
27
ground/src/plugins/emptygadget/emptyplugin.h
Normal 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_ */
|
Loading…
x
Reference in New Issue
Block a user