1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-107 New gadget for modifying a list of waypoints

This commit is contained in:
James Cotton 2012-05-09 11:12:29 -05:00
parent 420829e549
commit 15067b010f
13 changed files with 523 additions and 0 deletions

View File

@ -134,6 +134,11 @@ plugin_qmlview.depends = plugin_coreplugin
plugin_qmlview.depends += plugin_uavobjects
SUBDIRS += plugin_qmlview
# Waypoint Editor gadget
plugin_waypointeditor.subdir = waypointeditor
plugin_waypointeditor.depends = plugin_coreplugin
plugin_waypointeditor.depends += plugin_uavobjects
SUBDIRS += plugin_waypointeditor
#IP connection plugin
plugin_ipconnection.subdir = ipconnection

View File

@ -0,0 +1,11 @@
<plugin name="WaypointEditor" version="0.0.1" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2012 OpenPilot Project</copyright>
<license>The GNU Public License (GPL) Version 3</license>
<description>Allows editing a list of waypoints</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
</dependencyList>
</plugin>

View File

@ -0,0 +1,22 @@
TEMPLATE = lib
TARGET = WaypointEditor
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjects/uavobjects.pri)
HEADERS += waypointeditorgadget.h
HEADERS += waypointeditorgadgetwidget.h
HEADERS += waypointeditorgadgetfactory.h
HEADERS += waypointeditorplugin.h
SOURCES += waypointeditorgadget.cpp
SOURCES += waypointeditorgadgetwidget.cpp
SOURCES += waypointeditorgadgetfactory.cpp
SOURCES += waypointeditorplugin.cpp
OTHER_FILES += waypointeditor.pluginspec
FORMS += waypointeditor.ui
RESOURCES += waypointeditor.qrc

View File

@ -0,0 +1,3 @@
<RCC>
<qresource prefix="/waypointeditor"/>
</RCC>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WaypointEditor</class>
<widget class="QWidget" name="WaypointEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>653</width>
<height>296</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTableView" name="tableView">
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>New Waypoint</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,48 @@
/**
******************************************************************************
* @file waypointeditorgadget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 "waypointeditorgadget.h"
#include "waypointeditorgadgetwidget.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
#include <QDebug>
WaypointEditorGadget::WaypointEditorGadget(QString classId, WaypointEditorGadgetWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{
}
WaypointEditorGadget::~WaypointEditorGadget()
{
delete m_widget;
}
void WaypointEditorGadget::loadConfiguration(IUAVGadgetConfiguration* config)
{
Q_UNUSED(config);
}

View File

@ -0,0 +1,59 @@
/**
******************************************************************************
* @file waypointeditorgadget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 WaypointEditorGADGET_H_
#define WaypointEditorGADGET_H_
#include <coreplugin/iuavgadget.h>
namespace Core {
class IUAVGadget;
}
//class QWidget;
//class QString;
class WaypointEditorGadgetWidget;
using namespace Core;
class WaypointEditorGadget : public Core::IUAVGadget
{
Q_OBJECT
public:
WaypointEditorGadget(QString classId, WaypointEditorGadgetWidget *widget, QWidget *parent = 0);
~WaypointEditorGadget();
QList<int> context() const { return m_context; }
QWidget *widget() { return m_widget; }
QString contextHelpId() const { return QString(); }
void loadConfiguration(IUAVGadgetConfiguration* config);
private:
QWidget *m_widget;
QList<int> m_context;
};
#endif // WaypointEditorGADGET_H_

View File

@ -0,0 +1,47 @@
/**
******************************************************************************
* @file waypointeditorgadgetfactor.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 "waypointeditorgadgetfactory.h"
#include "waypointeditorgadgetwidget.h"
#include "waypointeditorgadget.h"
#include <coreplugin/iuavgadget.h>
#include <QDebug>
WaypointEditorGadgetFactory::WaypointEditorGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("WaypointEditorGadget"),
tr("Waypoint Editor"),
parent)
{
}
WaypointEditorGadgetFactory::~WaypointEditorGadgetFactory()
{
}
IUAVGadget* WaypointEditorGadgetFactory::createGadget(QWidget *parent) {
WaypointEditorGadgetWidget* gadgetWidget = new WaypointEditorGadgetWidget(parent);
return new WaypointEditorGadget(QString("WaypointEditorGadget"), gadgetWidget, parent);
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
* @file waypointeditorgadgetfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 WaypointEditorGADGETFACTORY_H_
#define WaypointEditorGADGETFACTORY_H_
#include <coreplugin/iuavgadgetfactory.h>
namespace Core {
class IUAVGadget;
class IUAVGadgetFactory;
}
using namespace Core;
class WaypointEditorGadgetFactory : public IUAVGadgetFactory
{
Q_OBJECT
public:
WaypointEditorGadgetFactory(QObject *parent = 0);
~WaypointEditorGadgetFactory();
IUAVGadget *createGadget(QWidget *parent);
};
#endif // WaypointEditorGADGETFACTORY_H_

View File

@ -0,0 +1,69 @@
/**
******************************************************************************
* @file waypointeditorgadgetwidget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 "waypointeditorgadgetwidget.h"
#include "ui_waypointeditor.h"
#include <QDebug>
#include <QString>
#include <QStringList>
#include <QtGui/QWidget>
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
#include "uavobject.h"
#include "uavobjectmanager.h"
#include "manualcontrolcommand.h"
#include "extensionsystem/pluginmanager.h"
#include "extensionsystem/pluginmanager.h"
WaypointEditorGadgetWidget::WaypointEditorGadgetWidget(QWidget *parent) : QLabel(parent)
{
m_waypointeditor = new Ui_WaypointEditor();
m_waypointeditor->setupUi(this);
}
WaypointEditorGadgetWidget::~WaypointEditorGadgetWidget()
{
// Do nothing
}
void WaypointEditorGadgetWidget::waypointChanged(UAVObject *)
{
}
void WaypointEditorGadgetWidget::waypointActiveChanged(UAVObject *)
{
}
void WaypointEditorGadgetWidget::addInstance()
{
}
/**
* @}
* @}
*/

View File

@ -0,0 +1,55 @@
/**
******************************************************************************
* @file waypointeditorgadgetwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 WaypointEditorGADGETWIDGET_H_
#define WaypointEditorGADGETWIDGET_H_
#include <QtGui/QLabel>
#include <waypoint.h>
#include <waypointactive.h>
class Ui_WaypointEditor;
class WaypointEditorGadgetWidget : public QLabel
{
Q_OBJECT
public:
WaypointEditorGadgetWidget(QWidget *parent = 0);
~WaypointEditorGadgetWidget();
signals:
protected slots:
void waypointChanged(UAVObject *);
void waypointActiveChanged(UAVObject *);
void addInstance();
private:
Ui_WaypointEditor * m_waypointeditor;
};
#endif /* WaypointEditorGADGETWIDGET_H_ */

View File

@ -0,0 +1,68 @@
/**
******************************************************************************
* @file waypointeditorplugin.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 "waypointeditorplugin.h"
#include "waypointeditorgadgetfactory.h"
#include <QDebug>
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
WaypointEditorPlugin::WaypointEditorPlugin()
{
// Do nothing
}
WaypointEditorPlugin::~WaypointEditorPlugin()
{
// Do nothing
}
bool WaypointEditorPlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
mf = new WaypointEditorGadgetFactory(this);
addAutoReleasedObject(mf);
return true;
}
void WaypointEditorPlugin::extensionsInitialized()
{
// Do nothing
}
void WaypointEditorPlugin::shutdown()
{
// Do nothing
}
Q_EXPORT_PLUGIN(WaypointEditorPlugin)
/**
* @}
* @}
*/

View File

@ -0,0 +1,46 @@
/**
******************************************************************************
* @file waypointeditorplugin.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup Waypoint Editor GCS Plugins
* @{
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
* @{
* @brief A gadget to edit a list of waypoints
*****************************************************************************/
/*
* 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 WaypointEditorPLUGIN_H_
#define WaypointEditorPLUGIN_H_
#include <extensionsystem/iplugin.h>
class WaypointEditorGadgetFactory;
class WaypointEditorPlugin : public ExtensionSystem::IPlugin
{
public:
WaypointEditorPlugin();
~WaypointEditorPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private:
WaypointEditorGadgetFactory *mf;
};
#endif /* WaypointEditorPLUGIN_H_ */