Commit d5f5922c authored by pixhawk's avatar pixhawk

Working on better param interface, improving/fixing simulation link

parent 1b2b89a5
# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Author:
# Lorenz Meier <mavteam@student.ethz.ch>
# (c) 2009-2010 PIXHAWK Team
# This file is part of the mav groundstation project
# QGroundControl 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.
# QGroundControl 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 QGroundControl. If not, see <http://www.gnu.org/licenses/>.
# -------------------------------------------------
# Include QMapControl map library
# prefer version from external directory /
# from http://github.com/pixhawk/qmapcontrol/
# over bundled version in lib directory
# Version from GIT repository is preferred
# include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{
# Include bundled version if necessary
CONFIG += designer plugin
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
FORMS = src/ui/designer/QGCParamSlider.ui
HEADERS = src/ui/designer/QGCParamSlider.h \
src/ui/designer/QGCParamSliderPlugin.h
SOURCES = src/ui/designer/QGCParamSlider.cc \
src/ui/designer/QGCParamSliderPlugin.cc
# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES $$HEADERS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/worldtimeclockplugin
INSTALLS += target
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
......@@ -375,9 +375,9 @@ void MAVLinkSimulationLink::mainloop()
// Move X Position
x = 8.0*sin((double)circleCounter/50.0);
y = 3.0*cos((double)circleCounter/40.0);
z = 1.8 + 1.2*sin((double)circleCounter/60.0);
x = 12.0*sin(((double)circleCounter)/100.0);
y = 5.0*cos(((double)circleCounter)/100.0);
z = 1.8 + 1.2*sin(((double)circleCounter)/60.0);
circleCounter++;
......@@ -413,7 +413,7 @@ void MAVLinkSimulationLink::mainloop()
// streampointer += bufferlength;
// GLOBAL POSITION
mavlink_msg_global_position_pack(systemId, componentId, &ret, 0, 47.378028137103+(x*0.001), 8.54899892510421+(y*0.001), z+25.0, 0, 0, 0);
mavlink_msg_global_position_pack(systemId, componentId, &ret, 0, 47.378028137103+(x*0.002), 8.54899892510421+(y*0.002), z+35.0, 0, 0, 0);
bufferlength = mavlink_msg_to_send_buffer(buffer, &ret);
//add data into datastream
memcpy(stream+streampointer,buffer, bufferlength);
......
#include "QGCParamSlider.h"
#include "ui_QGCParamSlider.h"
QGCParamSlider::QGCParamSlider(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCParamSlider)
{
ui->setupUi(this);
}
QGCParamSlider::~QGCParamSlider()
{
delete ui;
}
void QGCParamSlider::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
#ifndef QGCPARAMSLIDER_H
#define QGCPARAMSLIDER_H
#include <QWidget>
#include <QtDesigner/QDesignerExportWidget>
namespace Ui {
class QGCParamSlider;
}
class QDESIGNER_WIDGET_EXPORT QGCParamSlider : public QWidget
{
Q_OBJECT
public:
explicit QGCParamSlider(QWidget *parent = 0);
~QGCParamSlider();
protected:
void changeEvent(QEvent *e);
private:
Ui::QGCParamSlider *ui;
};
#endif // QGCPARAMSLIDER_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCParamSlider</class>
<widget class="QWidget" name="QGCParamSlider">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>22</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="valueLabel">
<property name="text">
<string>0.00</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="valueSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "QGCParamSliderPlugin.h"
#include "QGCParamSlider.h"
#include <QtPlugin>
QGCParamSliderPlugin::QGCParamSliderPlugin(QObject *parent) :
QObject(parent)
{
initialized = false;
}
void QGCParamSliderPlugin::initialize(QDesignerFormEditorInterface * /* core */)
{
if (initialized)
return;
initialized = true;
}
bool QGCParamSliderPlugin::isInitialized() const
{
return initialized;
}
QWidget *QGCParamSliderPlugin::createWidget(QWidget *parent)
{
return new QGCParamSlider(parent);
}
QString QGCParamSliderPlugin::name() const
{
return "QGCParamSlider";
}
QString QGCParamSliderPlugin::group() const
{
return "QGroundControl";
}
QIcon QGCParamSliderPlugin::icon() const
{
return QIcon();
}
QString QGCParamSliderPlugin::toolTip() const
{
return "";
}
QString QGCParamSliderPlugin::whatsThis() const
{
return "";
}
bool QGCParamSliderPlugin::isContainer() const
{
return false;
}
QString QGCParamSliderPlugin::domXml() const
{
return "<ui language=\"c++\">\n"
" <widget class=\"QGCParamSlider\" name=\"paramSlider\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>150</width>\n"
" <height>16</height>\n"
" </rect>\n"
" </property>\n"
" </widget>\n"
"</ui>";
}
QString QGCParamSliderPlugin::includeFile() const
{
return "QGCParamSlider.h";
}
Q_EXPORT_PLUGIN2(qgcparamsliderplugin, QGCParamSliderPlugin)
#ifndef QGCPARAMSLIDERPLUGIN_H
#define QGCPARAMSLIDERPLUGIN_H
#include <QtDesigner/QDesignerCustomWidgetInterface>
class QGCParamSliderPlugin : public QObject,
public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
explicit QGCParamSliderPlugin(QObject *parent = 0);
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);
private:
bool initialized;
};
#endif // QGCPARAMSLIDERPLUGIN_H
......@@ -47,7 +47,7 @@ void MAV2DIcon::drawIcon(QPen* pen)
if (pen)
{
mypixmap = new QPixmap(radius+1, radius+1);
mypixmap->fill(Qt::transparent);
//mypixmap->fill(Qt::transparent);
QPainter painter(mypixmap);
// DRAW MICRO AIR VEHICLE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment