mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Connected Dials plugin to UAVObjects. Does not actually update yet but we're getting there.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@641 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d02a3325d9
commit
195f5b8a75
@ -6,5 +6,6 @@
|
|||||||
<url>http://www.openpilot.org</url>
|
<url>http://www.openpilot.org</url>
|
||||||
<dependencyList>
|
<dependencyList>
|
||||||
<dependency name="Core" version="1.0.0"/>
|
<dependency name="Core" version="1.0.0"/>
|
||||||
|
<dependency name="UAVObjects" version="0.0.1"/>
|
||||||
</dependencyList>
|
</dependencyList>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -3,7 +3,7 @@ TARGET = AirspeedGadget
|
|||||||
QT += svg
|
QT += svg
|
||||||
include(../../openpilotgcsplugin.pri)
|
include(../../openpilotgcsplugin.pri)
|
||||||
include(../../plugins/coreplugin/coreplugin.pri)
|
include(../../plugins/coreplugin/coreplugin.pri)
|
||||||
include(../../libs/qwt/qwt.pri)
|
include(airspeed_dependencies.pri)
|
||||||
HEADERS += airspeedplugin.h
|
HEADERS += airspeedplugin.h
|
||||||
HEADERS += airspeedgadget.h
|
HEADERS += airspeedgadget.h
|
||||||
HEADERS += airspeedgadgetwidget.h
|
HEADERS += airspeedgadgetwidget.h
|
||||||
|
1
ground/src/plugins/airspeed/airspeed_dependencies.pri
Normal file
1
ground/src/plugins/airspeed/airspeed_dependencies.pri
Normal file
@ -0,0 +1 @@
|
|||||||
|
include(../../plugins/uavobjects/uavobjects.pri)
|
@ -26,9 +26,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "airspeedgadgetwidget.h"
|
#include "airspeedgadgetwidget.h"
|
||||||
|
#include "extensionsystem/pluginmanager.h"
|
||||||
|
#include "uavobjects/uavobjectmanager.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QtGui/QFileDialog>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||||
@ -64,8 +64,43 @@ AirspeedGadgetWidget::~AirspeedGadgetWidget()
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Connects the widget to the relevant UAVObjects
|
||||||
|
*/
|
||||||
void AirspeedGadgetWidget::connectNeedles(QString object1, QString field1, QString object2, QString field2 ) {
|
void AirspeedGadgetWidget::connectNeedles(QString object1, QString field1, QString object2, QString field2 ) {
|
||||||
|
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
|
|
||||||
|
// Check validity of arguments first, reject empty args and unknown fields.
|
||||||
|
if (!(object1.isEmpty() || field1.isEmpty())) {
|
||||||
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(object1) );
|
||||||
|
if (obj != NULL ) {
|
||||||
|
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedles(UAVObject*)));
|
||||||
|
} else {
|
||||||
|
std::cout << "Error: Object is unknown (" << object1.toStdString() << ")." << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// And do the same for the second needle.
|
||||||
|
if (!(object2.isEmpty() || field2.isEmpty())) {
|
||||||
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(object2) );
|
||||||
|
if (obj != NULL ) {
|
||||||
|
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedles(UAVObject*)));
|
||||||
|
} else {
|
||||||
|
std::cout << "Error: Object is unknown (" << object2.toStdString() << ")." << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Called by the systemalarms UAVObject
|
||||||
|
*/
|
||||||
|
void AirspeedGadgetWidget::updateNeedles(UAVObject *systemObject) {
|
||||||
|
|
||||||
|
// UAVObjectField* field = obj->getField(QString("Field1"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@
|
|||||||
#define AIRSPEEDGADGETWIDGET_H_
|
#define AIRSPEEDGADGETWIDGET_H_
|
||||||
|
|
||||||
#include "airspeedgadgetconfiguration.h"
|
#include "airspeedgadgetconfiguration.h"
|
||||||
|
#include "uavobjects/uavobject.h"
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QtSvg/QSvgRenderer>
|
#include <QtSvg/QSvgRenderer>
|
||||||
#include <QtSvg/QGraphicsSvgItem>
|
#include <QtSvg/QGraphicsSvgItem>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
// Used for test purposes
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
class AirspeedGadgetWidget : public QGraphicsView
|
class AirspeedGadgetWidget : public QGraphicsView
|
||||||
@ -67,6 +67,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
// Test function
|
// Test function
|
||||||
void testRotate();
|
void testRotate();
|
||||||
|
void updateNeedles(UAVObject *systemAlarm); // Called by the systemalarms UAVObject
|
||||||
void rotateNeedles();
|
void rotateNeedles();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user