mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-05 21:52:10 +01:00
Corrected GUI widget spacers, added OpenGL rendering.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2617 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
f6805de71e
commit
7c73f9c2c8
@ -1,6 +1,7 @@
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
TARGET = GCSControl
|
TARGET = GCSControl
|
||||||
QT += svg
|
QT += svg
|
||||||
|
QT += opengl
|
||||||
|
|
||||||
include(../../openpilotgcsplugin.pri)
|
include(../../openpilotgcsplugin.pri)
|
||||||
include(../../plugins/coreplugin/coreplugin.pri)
|
include(../../plugins/coreplugin/coreplugin.pri)
|
||||||
|
@ -1,125 +1,134 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>GCSControl</class>
|
<class>GCSControl</class>
|
||||||
<widget class="QWidget" name="GCSControl">
|
<widget class="QWidget" name="GCSControl">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>653</width>
|
<width>653</width>
|
||||||
<height>295</height>
|
<height>295</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<property name="spacing">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<number>2</number>
|
||||||
<item>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<property name="margin">
|
||||||
<item>
|
<number>5</number>
|
||||||
<widget class="QCheckBox" name="checkBoxGcsControl">
|
</property>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>GCS Control</string>
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QCheckBox" name="checkBoxGcsControl">
|
||||||
<widget class="QCheckBox" name="checkBoxArmed">
|
<property name="text">
|
||||||
<property name="text">
|
<string>GCS Control</string>
|
||||||
<string>Armed</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QCheckBox" name="checkBoxArmed">
|
||||||
<widget class="QLabel" name="label">
|
<property name="text">
|
||||||
<property name="text">
|
<string>Armed</string>
|
||||||
<string>Flight Mode:</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QLabel" name="label">
|
||||||
<widget class="QComboBox" name="comboBoxFlightMode"/>
|
<property name="text">
|
||||||
</item>
|
<string>Flight Mode:</string>
|
||||||
</layout>
|
</property>
|
||||||
</item>
|
<property name="alignment">
|
||||||
</layout>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<spacer name="horizontalSpacer">
|
</item>
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<widget class="QComboBox" name="comboBoxFlightMode"/>
|
||||||
</property>
|
</item>
|
||||||
<property name="sizeHint" stdset="0">
|
</layout>
|
||||||
<size>
|
</item>
|
||||||
<width>40</width>
|
</layout>
|
||||||
<height>20</height>
|
</item>
|
||||||
</size>
|
<item>
|
||||||
</property>
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0">
|
||||||
</spacer>
|
<property name="horizontalSpacing">
|
||||||
</item>
|
<number>10</number>
|
||||||
<item>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
|
<property name="leftMargin">
|
||||||
<property name="horizontalSpacing">
|
<number>0</number>
|
||||||
<number>10</number>
|
</property>
|
||||||
</property>
|
<item row="0" column="0">
|
||||||
<property name="leftMargin">
|
<widget class="JoystickControl" name="widgetLeftStick" native="true">
|
||||||
<number>0</number>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<item row="0" column="0">
|
<horstretch>0</horstretch>
|
||||||
<widget class="JoystickControl" name="widgetLeftStick" native="true">
|
<verstretch>0</verstretch>
|
||||||
<property name="sizePolicy">
|
</sizepolicy>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
</property>
|
||||||
<horstretch>0</horstretch>
|
<property name="minimumSize">
|
||||||
<verstretch>0</verstretch>
|
<size>
|
||||||
</sizepolicy>
|
<width>100</width>
|
||||||
</property>
|
<height>100</height>
|
||||||
<property name="minimumSize">
|
</size>
|
||||||
<size>
|
</property>
|
||||||
<width>200</width>
|
<property name="mouseTracking">
|
||||||
<height>200</height>
|
<bool>false</bool>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="mouseTracking">
|
</item>
|
||||||
<bool>false</bool>
|
<item row="0" column="2">
|
||||||
</property>
|
<widget class="JoystickControl" name="widgetRightStick" native="true">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
</item>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<item row="0" column="1">
|
<horstretch>0</horstretch>
|
||||||
<widget class="JoystickControl" name="widgetRightStick" native="true">
|
<verstretch>0</verstretch>
|
||||||
<property name="sizePolicy">
|
</sizepolicy>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
</property>
|
||||||
<horstretch>0</horstretch>
|
<property name="minimumSize">
|
||||||
<verstretch>0</verstretch>
|
<size>
|
||||||
</sizepolicy>
|
<width>100</width>
|
||||||
</property>
|
<height>100</height>
|
||||||
<property name="minimumSize">
|
</size>
|
||||||
<size>
|
</property>
|
||||||
<width>200</width>
|
</widget>
|
||||||
<height>200</height>
|
</item>
|
||||||
</size>
|
<item row="0" column="1">
|
||||||
</property>
|
<spacer name="verticalSpacer">
|
||||||
</widget>
|
<property name="orientation">
|
||||||
</item>
|
<enum>Qt::Vertical</enum>
|
||||||
</layout>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
</layout>
|
<size>
|
||||||
</widget>
|
<width>2</width>
|
||||||
<customwidgets>
|
<height>40</height>
|
||||||
<customwidget>
|
</size>
|
||||||
<class>JoystickControl</class>
|
</property>
|
||||||
<extends>QWidget</extends>
|
</spacer>
|
||||||
<header>joystickcontrol.h</header>
|
</item>
|
||||||
<container>1</container>
|
</layout>
|
||||||
</customwidget>
|
</item>
|
||||||
</customwidgets>
|
</layout>
|
||||||
<resources/>
|
</widget>
|
||||||
<connections/>
|
<customwidgets>
|
||||||
</ui>
|
<customwidget>
|
||||||
|
<class>JoystickControl</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>joystickcontrol.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
@ -1,174 +1,177 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file GCSControlgadgetwidget.cpp
|
* @file GCSControlgadgetwidget.cpp
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin
|
* @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin
|
||||||
* @{
|
* @{
|
||||||
* @brief A gadget to control the UAV, either from the keyboard or a joystick
|
* @brief A gadget to control the UAV, either from the keyboard or a joystick
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
* for more details.
|
* for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* 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.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
#include "gcscontrolgadgetwidget.h"
|
#include "gcscontrolgadgetwidget.h"
|
||||||
#include "ui_gcscontrol.h"
|
#include "ui_gcscontrol.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QTextEdit>
|
#include <QtGui/QTextEdit>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
#include "uavobject.h"
|
#include "uavobject.h"
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
#include "manualcontrolcommand.h"
|
#include "manualcontrolcommand.h"
|
||||||
#include "extensionsystem/pluginmanager.h"
|
#include "extensionsystem/pluginmanager.h"
|
||||||
|
|
||||||
GCSControlGadgetWidget::GCSControlGadgetWidget(QWidget *parent) : QLabel(parent)
|
GCSControlGadgetWidget::GCSControlGadgetWidget(QWidget *parent) : QLabel(parent)
|
||||||
{
|
{
|
||||||
m_gcscontrol = new Ui_GCSControl();
|
m_gcscontrol = new Ui_GCSControl();
|
||||||
m_gcscontrol->setupUi(this);
|
m_gcscontrol->setupUi(this);
|
||||||
|
|
||||||
|
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
||||||
UAVObject::Metadata mdata = obj->getMetadata();
|
UAVObject::Metadata mdata = obj->getMetadata();
|
||||||
m_gcscontrol->checkBoxGcsControl->setChecked(mdata.flightAccess == UAVObject::ACCESS_READONLY);
|
m_gcscontrol->checkBoxGcsControl->setChecked(mdata.flightAccess == UAVObject::ACCESS_READONLY);
|
||||||
|
|
||||||
// Set up the drop down box for the flightmode
|
// Set up the drop down box for the flightmode
|
||||||
m_gcscontrol->comboBoxFlightMode->addItems(obj->getField("FlightMode")->getOptions());
|
m_gcscontrol->comboBoxFlightMode->addItems(obj->getField("FlightMode")->getOptions());
|
||||||
|
|
||||||
// Set up slots and signals for joysticks
|
// Set up slots and signals for joysticks
|
||||||
connect(m_gcscontrol->widgetLeftStick,SIGNAL(positionClicked(double,double)),this,SLOT(leftStickClicked(double,double)));
|
connect(m_gcscontrol->widgetLeftStick,SIGNAL(positionClicked(double,double)),this,SLOT(leftStickClicked(double,double)));
|
||||||
connect(m_gcscontrol->widgetRightStick,SIGNAL(positionClicked(double,double)),this,SLOT(rightStickClicked(double,double)));
|
connect(m_gcscontrol->widgetRightStick,SIGNAL(positionClicked(double,double)),this,SLOT(rightStickClicked(double,double)));
|
||||||
|
|
||||||
// Connect misc controls
|
// Connect misc controls
|
||||||
connect(m_gcscontrol->checkBoxGcsControl, SIGNAL(stateChanged(int)), this, SLOT(toggleControl(int)));
|
connect(m_gcscontrol->checkBoxGcsControl, SIGNAL(stateChanged(int)), this, SLOT(toggleControl(int)));
|
||||||
connect(m_gcscontrol->checkBoxArmed, SIGNAL(stateChanged(int)), this, SLOT(toggleArmed(int)));
|
connect(m_gcscontrol->checkBoxArmed, SIGNAL(stateChanged(int)), this, SLOT(toggleArmed(int)));
|
||||||
connect(m_gcscontrol->comboBoxFlightMode, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFlightMode(int)));
|
connect(m_gcscontrol->comboBoxFlightMode, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFlightMode(int)));
|
||||||
|
|
||||||
// Connect object updated event from UAVObject to also update check boxes and dropdown
|
// Connect object updated event from UAVObject to also update check boxes and dropdown
|
||||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(mccChanged(UAVObject*)));
|
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(mccChanged(UAVObject*)));
|
||||||
|
|
||||||
|
|
||||||
leftX = 0;
|
leftX = 0;
|
||||||
leftY = 0;
|
leftY = 0;
|
||||||
rightX = 0;
|
rightX = 0;
|
||||||
rightY = 0;
|
rightY = 0;
|
||||||
}
|
|
||||||
|
m_gcscontrol->widgetLeftStick->enableOpenGL(true);
|
||||||
GCSControlGadgetWidget::~GCSControlGadgetWidget()
|
m_gcscontrol->widgetRightStick->enableOpenGL(true);
|
||||||
{
|
}
|
||||||
// Do nothing
|
|
||||||
}
|
GCSControlGadgetWidget::~GCSControlGadgetWidget()
|
||||||
|
{
|
||||||
void GCSControlGadgetWidget::updateSticks(double nleftX, double nleftY, double nrightX, double nrightY) {
|
// Do nothing
|
||||||
leftX = nleftX;
|
}
|
||||||
leftY = nleftY;
|
|
||||||
rightX = nrightX;
|
void GCSControlGadgetWidget::updateSticks(double nleftX, double nleftY, double nrightX, double nrightY) {
|
||||||
rightY = nrightY;
|
leftX = nleftX;
|
||||||
m_gcscontrol->widgetLeftStick->changePosition(leftX,leftY);
|
leftY = nleftY;
|
||||||
m_gcscontrol->widgetRightStick->changePosition(rightX,rightY);
|
rightX = nrightX;
|
||||||
}
|
rightY = nrightY;
|
||||||
|
m_gcscontrol->widgetLeftStick->changePosition(leftX,leftY);
|
||||||
void GCSControlGadgetWidget::leftStickClicked(double X, double Y) {
|
m_gcscontrol->widgetRightStick->changePosition(rightX,rightY);
|
||||||
leftX = X;
|
}
|
||||||
leftY = Y;
|
|
||||||
emit sticksChanged(leftX,leftY,rightX,rightY);
|
void GCSControlGadgetWidget::leftStickClicked(double X, double Y) {
|
||||||
}
|
leftX = X;
|
||||||
|
leftY = Y;
|
||||||
void GCSControlGadgetWidget::rightStickClicked(double X, double Y) {
|
emit sticksChanged(leftX,leftY,rightX,rightY);
|
||||||
rightX = X;
|
}
|
||||||
rightY = Y;
|
|
||||||
emit sticksChanged(leftX,leftY,rightX,rightY);
|
void GCSControlGadgetWidget::rightStickClicked(double X, double Y) {
|
||||||
}
|
rightX = X;
|
||||||
|
rightY = Y;
|
||||||
/*!
|
emit sticksChanged(leftX,leftY,rightX,rightY);
|
||||||
\brief Called when the gcs control is toggled and enabled or disables flight write access to manual control command
|
}
|
||||||
*/
|
|
||||||
void GCSControlGadgetWidget::toggleControl(int state)
|
/*!
|
||||||
{
|
\brief Called when the gcs control is toggled and enabled or disables flight write access to manual control command
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
*/
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
void GCSControlGadgetWidget::toggleControl(int state)
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
{
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObject::Metadata mdata = obj->getMetadata();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
if (state)
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
||||||
{
|
|
||||||
mccInitialData = mdata;
|
UAVObject::Metadata mdata = obj->getMetadata();
|
||||||
mdata.flightAccess = UAVObject::ACCESS_READONLY;
|
if (state)
|
||||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
{
|
||||||
mdata.gcsTelemetryAcked = false;
|
mccInitialData = mdata;
|
||||||
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
mdata.flightAccess = UAVObject::ACCESS_READONLY;
|
||||||
mdata.gcsTelemetryUpdatePeriod = 100;
|
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
||||||
|
mdata.gcsTelemetryAcked = false;
|
||||||
}
|
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
||||||
else
|
mdata.gcsTelemetryUpdatePeriod = 100;
|
||||||
{
|
|
||||||
mdata = mccInitialData;
|
}
|
||||||
}
|
else
|
||||||
obj->setMetadata(mdata);
|
{
|
||||||
}
|
mdata = mccInitialData;
|
||||||
|
}
|
||||||
void GCSControlGadgetWidget::toggleArmed(int state)
|
obj->setMetadata(mdata);
|
||||||
{
|
}
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
void GCSControlGadgetWidget::toggleArmed(int state)
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
{
|
||||||
if(state)
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
obj->getField("Armed")->setValue("True");
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
else
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
||||||
obj->getField("Armed")->setValue("False");
|
if(state)
|
||||||
obj->updated();
|
obj->getField("Armed")->setValue("True");
|
||||||
}
|
else
|
||||||
|
obj->getField("Armed")->setValue("False");
|
||||||
void GCSControlGadgetWidget::mccChanged(UAVObject * obj)
|
obj->updated();
|
||||||
{
|
}
|
||||||
m_gcscontrol->checkBoxArmed->setChecked(obj->getField("Armed")->getValue() == "True");
|
|
||||||
m_gcscontrol->comboBoxFlightMode->setCurrentIndex(m_gcscontrol->comboBoxFlightMode->findText(obj->getField("FlightMode")->getValue().toString()));
|
void GCSControlGadgetWidget::mccChanged(UAVObject * obj)
|
||||||
}
|
{
|
||||||
|
m_gcscontrol->checkBoxArmed->setChecked(obj->getField("Armed")->getValue() == "True");
|
||||||
/*!
|
m_gcscontrol->comboBoxFlightMode->setCurrentIndex(m_gcscontrol->comboBoxFlightMode->findText(obj->getField("FlightMode")->getValue().toString()));
|
||||||
\brief Called when the flight mode drop down is changed and sets the ManualControlCommand->FlightMode accordingly
|
}
|
||||||
*/
|
|
||||||
void GCSControlGadgetWidget::selectFlightMode(int state)
|
/*!
|
||||||
{
|
\brief Called when the flight mode drop down is changed and sets the ManualControlCommand->FlightMode accordingly
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
*/
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
void GCSControlGadgetWidget::selectFlightMode(int state)
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
{
|
||||||
UAVObjectField * field = obj->getField("FlightMode");
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
field->setValue(field->getOptions()[state]);
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
obj->updated();
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );
|
||||||
}
|
UAVObjectField * field = obj->getField("FlightMode");
|
||||||
|
field->setValue(field->getOptions()[state]);
|
||||||
void GCSControlGadgetWidget::setGCSControl(bool newState)
|
obj->updated();
|
||||||
{
|
}
|
||||||
m_gcscontrol->checkBoxGcsControl->setChecked(newState);
|
|
||||||
};
|
void GCSControlGadgetWidget::setGCSControl(bool newState)
|
||||||
bool GCSControlGadgetWidget::getGCSControl(void)
|
{
|
||||||
{
|
m_gcscontrol->checkBoxGcsControl->setChecked(newState);
|
||||||
return m_gcscontrol->checkBoxGcsControl->isChecked();
|
};
|
||||||
};
|
bool GCSControlGadgetWidget::getGCSControl(void)
|
||||||
|
{
|
||||||
|
return m_gcscontrol->checkBoxGcsControl->isChecked();
|
||||||
/**
|
};
|
||||||
* @}
|
|
||||||
* @}
|
|
||||||
*/
|
/**
|
||||||
|
* @}
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QtOpenGL/QGLWidget>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,6 +74,17 @@ JoystickControl::~JoystickControl()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Enables/Disables OpenGL
|
||||||
|
*/
|
||||||
|
void JoystickControl::enableOpenGL(bool flag)
|
||||||
|
{
|
||||||
|
if (flag)
|
||||||
|
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||||
|
else
|
||||||
|
setViewport(new QWidget);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update the displayed position based on an MCC update
|
* @brief Update the displayed position based on an MCC update
|
||||||
*/
|
*/
|
||||||
|
@ -46,6 +46,7 @@ class JoystickControl : public QGraphicsView
|
|||||||
public:
|
public:
|
||||||
explicit JoystickControl(QWidget *parent = 0);
|
explicit JoystickControl(QWidget *parent = 0);
|
||||||
~JoystickControl();
|
~JoystickControl();
|
||||||
|
void enableOpenGL(bool flag);
|
||||||
void paint();
|
void paint();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user