mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-800 Remove WayointEditor as it was supeseed by PathActionEditor
This commit is contained in:
parent
a89a2cfb47
commit
da76d775f9
@ -150,12 +150,6 @@ plugin_pathactioneditor.depends = plugin_coreplugin
|
||||
plugin_pathactioneditor.depends += plugin_uavobjects
|
||||
SUBDIRS += plugin_pathactioneditor
|
||||
|
||||
# Waypoint Editor gadget
|
||||
plugin_waypointeditor.subdir = waypointeditor
|
||||
plugin_waypointeditor.depends = plugin_coreplugin
|
||||
plugin_waypointeditor.depends += plugin_uavobjects
|
||||
SUBDIRS += plugin_waypointeditor
|
||||
|
||||
# Primary Flight Display (PFD) gadget, QML version
|
||||
plugin_pfdqml.subdir = pfdqml
|
||||
plugin_pfdqml.depends = plugin_coreplugin
|
||||
|
@ -1,11 +0,0 @@
|
||||
<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>
|
||||
|
@ -1,26 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = WaypointEditor
|
||||
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/uavobjects/uavobjects.pri)
|
||||
|
||||
HEADERS += waypointeditorgadget.h \
|
||||
waypointtable.h
|
||||
HEADERS += waypointeditorgadgetwidget.h
|
||||
HEADERS += waypointeditorgadgetfactory.h
|
||||
HEADERS += waypointeditorplugin.h
|
||||
|
||||
SOURCES += waypointeditorgadget.cpp \
|
||||
waypointtable.cpp
|
||||
SOURCES += waypointeditorgadgetwidget.cpp
|
||||
SOURCES += waypointeditorgadgetfactory.cpp
|
||||
SOURCES += waypointeditorplugin.cpp
|
||||
|
||||
OTHER_FILES += waypointeditor.pluginspec
|
||||
|
||||
FORMS += waypointeditor.ui
|
||||
|
||||
RESOURCES += waypointeditor.qrc
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/waypointeditor"/>
|
||||
</RCC>
|
@ -1,55 +0,0 @@
|
||||
<?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="waypoints">
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonNewWaypoint">
|
||||
<property name="text">
|
||||
<string>New Waypoint</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSaveFile">
|
||||
<property name="text">
|
||||
<string>Save to File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonLoadFile">
|
||||
<property name="text">
|
||||
<string>Load from File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,48 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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);
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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_
|
@ -1,47 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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_
|
@ -1,90 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 "extensionsystem/pluginmanager.h"
|
||||
|
||||
WaypointEditorGadgetWidget::WaypointEditorGadgetWidget(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
m_waypointeditor = new Ui_WaypointEditor();
|
||||
m_waypointeditor->setupUi(this);
|
||||
|
||||
waypointTable = new WaypointTable(this);
|
||||
m_waypointeditor->waypoints->setModel(waypointTable);
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Q_ASSERT(pm != NULL);
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
Q_ASSERT(objManager != NULL);
|
||||
waypointObj = Waypoint::GetInstance(objManager);
|
||||
Q_ASSERT(waypointObj != NULL);
|
||||
|
||||
// Connect the signals
|
||||
connect(m_waypointeditor->buttonNewWaypoint, SIGNAL(clicked()),
|
||||
this, SLOT(addInstance()));
|
||||
}
|
||||
|
||||
WaypointEditorGadgetWidget::~WaypointEditorGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void WaypointEditorGadgetWidget::waypointChanged(UAVObject *)
|
||||
{
|
||||
}
|
||||
|
||||
void WaypointEditorGadgetWidget::waypointActiveChanged(UAVObject *)
|
||||
{
|
||||
}
|
||||
|
||||
void WaypointEditorGadgetWidget::addInstance()
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Q_ASSERT(pm != NULL);
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
Q_ASSERT(objManager != NULL);
|
||||
|
||||
qDebug() << "Instances before: " << objManager->getNumInstances(waypointObj->getObjID());
|
||||
Waypoint *obj = new Waypoint();
|
||||
quint32 newInstId = objManager->getNumInstances(waypointObj->getObjID());
|
||||
obj->initialize(newInstId,obj->getMetaObject());
|
||||
objManager->registerObject(obj);
|
||||
qDebug() << "Instances after: " << objManager->getNumInstances(waypointObj->getObjID());
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -1,57 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 <waypointtable.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;
|
||||
WaypointTable *waypointTable;
|
||||
Waypoint *waypointObj;
|
||||
};
|
||||
|
||||
#endif /* WaypointEditorGADGETWIDGET_H_ */
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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)
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -1,46 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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_ */
|
@ -1,191 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file waypointtable.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup Waypoint Editor GCS Plugins
|
||||
* @{
|
||||
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
|
||||
* @{
|
||||
* @brief Table model for listing waypoint
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 <QDebug>
|
||||
#include <QBrush>
|
||||
#include "waypointtable.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
|
||||
WaypointTable::WaypointTable(QObject *parent) :
|
||||
QAbstractTableModel(parent)
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Q_ASSERT(pm != NULL);
|
||||
objManager = pm->getObject<UAVObjectManager>();
|
||||
Q_ASSERT(objManager != NULL);
|
||||
waypointObj = Waypoint::GetInstance(objManager);
|
||||
Q_ASSERT(waypointObj != NULL);
|
||||
waypointActiveObj = WaypointActive::GetInstance(objManager);
|
||||
Q_ASSERT(waypointActiveObj != NULL);
|
||||
|
||||
elements = 0;
|
||||
|
||||
// Unfortunately there is no per object new instance signal yet
|
||||
connect(objManager, SIGNAL(newInstance(UAVObject*)),
|
||||
this, SLOT(doNewInstance(UAVObject*)));
|
||||
connect(waypointActiveObj, SIGNAL(objectUpdated(UAVObject*)),
|
||||
this, SLOT(waypointsUpdated(UAVObject*)));
|
||||
|
||||
int numWaypoints = objManager->getNumInstances(Waypoint::OBJID);
|
||||
for (int i = 0; i < numWaypoints; i++) {
|
||||
Waypoint *waypoint = Waypoint::GetInstance(objManager, i);
|
||||
Q_ASSERT(waypoint);
|
||||
if(waypoint)
|
||||
connect(waypoint, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(waypointsUpdated(UAVObject*)));
|
||||
}
|
||||
|
||||
headers.clear();
|
||||
headers.append(QString("North"));
|
||||
headers.append(QString("East"));
|
||||
headers.append(QString("Down"));
|
||||
}
|
||||
|
||||
int WaypointTable::rowCount(const QModelIndex & /*parent*/) const
|
||||
{
|
||||
return elements;
|
||||
}
|
||||
|
||||
int WaypointTable::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return headers.length();
|
||||
}
|
||||
|
||||
QVariant WaypointTable::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole) {
|
||||
Waypoint *obj = Waypoint::GetInstance(objManager, index.row());
|
||||
Q_ASSERT(obj);
|
||||
Waypoint::DataFields waypoint = obj->getData();
|
||||
|
||||
switch(index.column()) {
|
||||
case 0:
|
||||
return waypoint.Position[Waypoint::POSITION_NORTH];
|
||||
case 1:
|
||||
return waypoint.Position[Waypoint::POSITION_EAST];
|
||||
case 2:
|
||||
return waypoint.Position[Waypoint::POSITION_DOWN];
|
||||
default:
|
||||
Q_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
} else if (role == Qt::BackgroundRole) {
|
||||
WaypointActive::DataFields waypointActive = waypointActiveObj->getData();
|
||||
|
||||
if(index.row() == waypointActive.Index) {
|
||||
return QBrush(Qt::lightGray);
|
||||
} else
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
else {
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QVariant WaypointTable::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
||||
if(section < headers.length())
|
||||
return headers[section];
|
||||
return QVariant::Invalid;
|
||||
} else
|
||||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called for any new UAVO instance and when that is a Waypoint register
|
||||
* to update the table
|
||||
*/
|
||||
void WaypointTable::doNewInstance(UAVObject*obj)
|
||||
{
|
||||
Q_ASSERT(obj);
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
if (obj->getObjID() == Waypoint::OBJID)
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)),this,SLOT(waypointsUpdated(UAVObject*)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever the waypoints are updated to inform
|
||||
* the view
|
||||
*/
|
||||
void WaypointTable::waypointsUpdated(UAVObject *)
|
||||
{
|
||||
int elementsNow = objManager->getNumInstances(waypointObj->getObjID());
|
||||
|
||||
// Currently only support adding instances which is all the UAVO manager
|
||||
// supports
|
||||
if (elementsNow > elements) {
|
||||
beginInsertRows(QModelIndex(), elements, elementsNow-1);
|
||||
elements = elementsNow;
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
QModelIndex i1 = index(0,0);
|
||||
QModelIndex i2 = index(elements-1, columnCount(QModelIndex()));
|
||||
emit dataChanged(i1, i2);
|
||||
}
|
||||
|
||||
Qt::ItemFlags WaypointTable::flags(const QModelIndex &index) const
|
||||
{
|
||||
return QAbstractTableModel::flags(index) | Qt::ItemIsEditable;
|
||||
}
|
||||
|
||||
bool WaypointTable::setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole )
|
||||
{
|
||||
Q_UNUSED(role);
|
||||
|
||||
double val = value.toDouble();
|
||||
qDebug() << "New value " << val << " for column " << index.column();
|
||||
|
||||
Waypoint *obj = Waypoint::GetInstance(objManager, index.row());
|
||||
Q_ASSERT(obj);
|
||||
Waypoint::DataFields waypoint = obj->getData();
|
||||
|
||||
switch(index.column()) {
|
||||
case 0:
|
||||
waypoint.Position[Waypoint::POSITION_NORTH] = val;
|
||||
break;
|
||||
case 1:
|
||||
waypoint.Position[Waypoint::POSITION_EAST] = val;
|
||||
break;
|
||||
case 2:
|
||||
waypoint.Position[Waypoint::POSITION_DOWN] = val;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
obj->setData(waypoint);
|
||||
obj->updated();
|
||||
qDebug() << "Set data for instance " << obj->getInstID();
|
||||
|
||||
return true;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file waypointtable.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup Waypoint Editor GCS Plugins
|
||||
* @{
|
||||
* @addtogroup WaypointEditorGadgetPlugin Waypoint Editor Gadget Plugin
|
||||
* @{
|
||||
* @brief Table model for listing waypoint
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 WAYPOINTTABLE_H
|
||||
#define WAYPOINTTABLE_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <waypoint.h>
|
||||
#include <waypointactive.h>
|
||||
|
||||
class WaypointTable : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WaypointTable(QObject *parent = 0);
|
||||
|
||||
// Get dimensionality of the data
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
|
||||
// Access data
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
|
||||
// Functions to make the data editable
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData ( const QModelIndex & index, const QVariant & value, int role);
|
||||
signals:
|
||||
|
||||
protected slots:
|
||||
void waypointsUpdated(UAVObject *);
|
||||
void doNewInstance(UAVObject*);
|
||||
public slots:
|
||||
|
||||
private:
|
||||
UAVObjectManager *objManager;
|
||||
Waypoint *waypointObj;
|
||||
WaypointActive *waypointActiveObj;
|
||||
QList <QString> headers;
|
||||
int elements;
|
||||
};
|
||||
|
||||
#endif // WAYPOINTTABLE_H
|
Loading…
x
Reference in New Issue
Block a user