1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

OP-52 : Skeleton GPS Display Gadget. Don't get your hopes too high, it doesn't do anything, and won't for the time being, but since the code exists, I thought I would still commit it nevertheless.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@857 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-06-22 09:22:51 +00:00 committed by edouard
parent 090deaafc8
commit 3784ee4ffd
17 changed files with 1270 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<plugin name="GpsDisplayGadget" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2010 Edouard Lafargue</copyright>
<license>The GNU Public License (GPL) Version 3</license>
<description>Plugin displaying the status of the onboard GPS</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
<dependency name="UAVObjects" version="0.0.1"/>
</dependencyList>
</plugin>

View File

@ -0,0 +1,22 @@
TEMPLATE = lib
TARGET = GpsDisplayGadget
QT += svg
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(gpsdisplay_dependencies.pri)
include(../../libs/qwt/qwt.pri)
HEADERS += gpsdisplayplugin.h
HEADERS += gpsdisplaygadget.h
HEADERS += gpsdisplaywidget.h
HEADERS += gpsdisplaygadgetfactory.h
HEADERS += gpsdisplaygadgetconfiguration.h
HEADERS += gpsdisplaygadgetoptionspage.h
SOURCES += gpsdisplayplugin.cpp
SOURCES += gpsdisplaygadget.cpp
SOURCES += gpsdisplaygadgetfactory.cpp
SOURCES += gpsdisplaywidget.cpp
SOURCES += gpsdisplaygadgetconfiguration.cpp
SOURCES += gpsdisplaygadgetoptionspage.cpp
OTHER_FILES += GpsDisplayGadget.pluginspec
FORMS += gpsdisplaygadgetoptionspage.ui \
gpsdisplaywidget.ui

View File

@ -0,0 +1,3 @@
include(../../plugins/uavobjects/uavobjects.pri)
#include(../../plugins/coreplugin/coreplugin.pri)
#include(../../libs/utils/utils.pri)

View File

@ -0,0 +1,52 @@
/**
******************************************************************************
*
* @file systemhealthgadget.cpp
* @author Edouard Lafargue Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup systemhealth
* @{
*
*****************************************************************************/
/*
* 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 "gpsdisplaygadget.h"
#include "gpsdisplaywidget.h"
#include "gpsdisplaygadgetconfiguration.h"
GpsDisplayGadget::GpsDisplayGadget(QString classId, GpsDisplayWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{
}
GpsDisplayGadget::~GpsDisplayGadget()
{
}
/*
This is called when a configuration is loaded, and updates the plugin's settings.
Careful: the plugin is already drawn before the loadConfiguration method is called the
first time, so you have to be careful not to assume all the plugin values are initialized
the first time you use them
*/
void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
{
GpsDisplayGadgetConfiguration *m = qobject_cast<GpsDisplayGadgetConfiguration*>(config);
//m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint
}

View File

@ -0,0 +1,56 @@
/**
******************************************************************************
*
* @file gpsdisplaygadget.h
* @author Edouard Lafargue Copyright (C) 2010.
* @brief Gps gadget to display GPS Status
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 GPSDISPLAYGADGET_H_
#define GPSDISPLAYGADGET_H_
#include <coreplugin/iuavgadget.h>
#include "gpsdisplaywidget.h"
class IUAVGadget;
class QWidget;
class QString;
class GpsDisplayWidget;
using namespace Core;
class GpsDisplayGadget : public Core::IUAVGadget
{
Q_OBJECT
public:
GpsDisplayGadget(QString classId, GpsDisplayWidget *widget, QWidget *parent = 0);
~GpsDisplayGadget();
QWidget *widget() { return m_widget; }
void loadConfiguration(IUAVGadgetConfiguration* config);
private:
GpsDisplayWidget *m_widget;
};
#endif // GPSDISPLAYGADGET_H_

View File

@ -0,0 +1,66 @@
/**
******************************************************************************
*
* @file gpsdisplaygadgetconfiguration.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief GPS Display Plugin Gadget configuration
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 "gpsdisplaygadgetconfiguration.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
systemFile("Unknown")
{
//if a saved configuration exists load it
if (state.count() > 0) {
QDataStream stream(state);
stream >> systemFile;
}
}
/**
* Clones a configuration.
*
*/
IUAVGadgetConfiguration *GpsDisplayGadgetConfiguration::clone()
{
GpsDisplayGadgetConfiguration *m = new GpsDisplayGadgetConfiguration(this->classId());
m->systemFile=systemFile;
return m;
}
/**
* Saves a configuration.
*
*/
QByteArray GpsDisplayGadgetConfiguration::saveState() const
{
QByteArray bytes;
QDataStream stream(&bytes, QIODevice::WriteOnly);
stream << systemFile;
return bytes;
}

View File

@ -0,0 +1,59 @@
/**
******************************************************************************
*
* @file gpsdisplaygadgetconfiguration.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief GPS Display Plugin Gadget configuration
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 GPSDISPLAYGADGETCONFIGURATION_H
#define GPSDISPLAYGADGETCONFIGURATION_H
#include <coreplugin/iuavgadgetconfiguration.h>
using namespace Core;
/* This is a generic system health gadget displaying
system alarms for one or more components.
*/
class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
//set gps display configuration functions
void setSystemFile(QString filename){systemFile=filename;}
//get dial configuration functions
QString getSystemFile() {return systemFile;}
QByteArray saveState() const;
IUAVGadgetConfiguration *clone();
private:
// systemFile contains the source SVG:
QString systemFile;
};
#endif // GPSDISPLAYGADGETCONFIGURATION_H

View File

@ -0,0 +1,60 @@
/**
******************************************************************************
*
* @file gpsdisplaygadgetfactory.cpp
* @author Edouard Lafargue Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 "gpsdisplaygadgetfactory.h"
#include "gpsdisplaywidget.h"
#include "gpsdisplaygadget.h"
#include "gpsdisplaygadgetconfiguration.h"
#include "gpsdisplaygadgetoptionspage.h"
#include <coreplugin/iuavgadget.h>
GpsDisplayGadgetFactory::GpsDisplayGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("GpsDisplayGadget"),
tr("GPS Display Gadget"),
parent)
{
}
GpsDisplayGadgetFactory::~GpsDisplayGadgetFactory()
{
}
Core::IUAVGadget* GpsDisplayGadgetFactory::createGadget(QWidget *parent)
{
GpsDisplayWidget* gadgetWidget = new GpsDisplayWidget(parent);
return new GpsDisplayGadget(QString("GpsDisplayGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *GpsDisplayGadgetFactory::createConfiguration(const QByteArray &state)
{
return new GpsDisplayGadgetConfiguration(QString("GpsDisplayGadget"), state);
}
IOptionsPage *GpsDisplayGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
{
return new GpsDisplayGadgetOptionsPage(qobject_cast<GpsDisplayGadgetConfiguration*>(config));
}

View File

@ -0,0 +1,52 @@
/**
******************************************************************************
*
* @file gpsdisplaygadgetfactory.h
* @author Edouard Lafargue Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 GPSDISPLAYGADGETFACTORY_H_
#define GPSDISPLAYGADGETFACTORY_H_
#include <coreplugin/iuavgadgetfactory.h>
namespace Core {
class IUAVGadget;
class IUAVGadgetFactory;
}
using namespace Core;
class GpsDisplayGadgetFactory : public IUAVGadgetFactory
{
Q_OBJECT
public:
GpsDisplayGadgetFactory(QObject *parent = 0);
~GpsDisplayGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};
#endif // GPSDISPLAYGADGETFACTORY_H_

View File

@ -0,0 +1,198 @@
/**
******************************************************************************
*
* @file gpsdisplaygadgetoptionspage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief GPS Display Plugin Gadget options page
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 "gpsdisplaygadgetoptionspage.h"
#include "gpsdisplaygadgetconfiguration.h"
#include "ui_gpsdisplaygadgetoptionspage.h"
#include <QFileDialog>
#include <QtAlgorithms>
#include <QStringList>
GpsDisplayGadgetOptionsPage::GpsDisplayGadgetOptionsPage(GpsDisplayGadgetConfiguration *config, QObject *parent) :
IOptionsPage(parent),
m_config(config)
{
// Taken from the uploader gadget, since we also can use a serial port for this
// Gadget
//the begining of some ugly code
//diferent OS's have diferent serial port capabilities
#ifdef Q_OS_WIN
//load windows port capabilities
BaudRateTypeString
<<"BAUD110"
<<"BAUD300"
<<"BAUD600"
<<"BAUD1200"
<<"BAUD2400"
<<"BAUD4800"
<<"BAUD9600"
<<"BAUD14400"
<<"BAUD19200"
<<"BAUD38400"
<<"BAUD56000"
<<"BAUD57600"
<<"BAUD115200"
<<"BAUD128000"
<<"BAUD256000";
DataBitsTypeString
<<"DATA_5"
<<"DATA_6"
<<"DATA_7"
<<"DATA_8";
ParityTypeString
<<"PAR_NONE"
<<"PAR_ODD"
<<"PAR_EVEN"
<<"PAR_MARK" //WINDOWS ONLY
<<"PAR_SPACE";
StopBitsTypeString
<<"STOP_1"
<<"STOP_1_5" //WINDOWS ONLY
<<"STOP_2";
#else
//load POSIX port capabilities
BaudRateTypeString
<<"BAUD50" //POSIX ONLY
<<"BAUD75" //POSIX ONLY
<<"BAUD110"
<<"BAUD134" //POSIX ONLY
<<"BAUD150" //POSIX ONLY
<<"BAUD200" //POSIX ONLY
<<"BAUD300"
<<"BAUD600"
<<"BAUD1200"
<<"BAUD1800" //POSIX ONLY
<<"BAUD2400"
<<"BAUD4800"
<<"BAUD9600"
<<"BAUD19200"
<<"BAUD38400"
<<"BAUD57600"
<<"BAUD76800" //POSIX ONLY
<<"BAUD115200";
DataBitsTypeString
<<"DATA_5"
<<"DATA_6"
<<"DATA_7"
<<"DATA_8";
ParityTypeString
<<"PAR_NONE"
<<"PAR_ODD"
<<"PAR_EVEN"
<<"PAR_SPACE";
StopBitsTypeString
<<"STOP_1"
<<"STOP_2";
#endif
//load all OS's capabilities
BaudRateTypeStringALL
<<"BAUD50" //POSIX ONLY
<<"BAUD75" //POSIX ONLY
<<"BAUD110"
<<"BAUD134" //POSIX ONLY
<<"BAUD150" //POSIX ONLY
<<"BAUD200" //POSIX ONLY
<<"BAUD300"
<<"BAUD600"
<<"BAUD1200"
<<"BAUD1800" //POSIX ONLY
<<"BAUD2400"
<<"BAUD4800"
<<"BAUD9600"
<<"BAUD14400"
<<"BAUD19200"
<<"BAUD38400"
<<"BAUD56000"
<<"BAUD57600"
<<"BAUD76800" //POSIX ONLY
<<"BAUD115200"
<<"BAUD128000"
<<"BAUD256000";
DataBitsTypeStringALL
<<"DATA_5"
<<"DATA_6"
<<"DATA_7"
<<"DATA_8";
ParityTypeStringALL
<<"PAR_NONE"
<<"PAR_ODD"
<<"PAR_EVEN"
<<"PAR_MARK" //WINDOWS ONLY
<<"PAR_SPACE";
StopBitsTypeStringALL
<<"STOP_1"
<<"STOP_1_5" //WINDOWS ONLY
<<"STOP_2";
FlowTypeString
<<"FLOW_OFF"
<<"FLOW_HARDWARE"
<<"FLOW_XONXOFF";
}
bool sortPorts(QextPortInfo const& s1,QextPortInfo const& s2)
{
return s1.portName<s2.portName;
}
//creates options page widget (uses the UI file)
QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
{
options_page = new Ui::GpsDisplayGadgetOptionsPage();
//main widget
QWidget *optionsPageWidget = new QWidget;
//main layout
options_page->setupUi(optionsPageWidget);
// Restore the contents from the settings:
options_page->svgFilePathChooser->setExpectedKind(Utils::PathChooser::File);
options_page->svgFilePathChooser->setPromptDialogFilter(tr("SVG image (*.svg)"));
options_page->svgFilePathChooser->setPromptDialogTitle(tr("Choose SVG image"));
options_page->svgFilePathChooser->setPath(m_config->getSystemFile());
return optionsPageWidget;
}
/**
* Called when the user presses apply or OK.
*
* Saves the current values
*
*/
void GpsDisplayGadgetOptionsPage::apply()
{
m_config->setSystemFile(options_page->svgFilePathChooser->path());
}
void GpsDisplayGadgetOptionsPage::finish()
{
delete options_page;
}

View File

@ -0,0 +1,76 @@
/**
******************************************************************************
*
* @file gpsdisplaygadgetoptionspage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief GPS Display Gadget options page
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 GPSDISPLAYGADGETOPTIONSPAGE_H
#define GPSDISPLAYGADGETOPTIONSPAGE_H
#include <qextserialport/src/qextserialenumerator.h>
#include "coreplugin/dialogs/ioptionspage.h"
#include "QString"
#include <QStringList>
#include <QDebug>
namespace Core {
class IUAVGadgetConfiguration;
}
class GpsDisplayGadgetConfiguration;
namespace Ui {
class GpsDisplayGadgetOptionsPage;
}
using namespace Core;
class GpsDisplayGadgetOptionsPage : public IOptionsPage
{
Q_OBJECT
public:
explicit GpsDisplayGadgetOptionsPage(GpsDisplayGadgetConfiguration *config, QObject *parent = 0);
QWidget *createPage(QWidget *parent);
void apply();
void finish();
private:
Ui::GpsDisplayGadgetOptionsPage *options_page;
GpsDisplayGadgetConfiguration *m_config;
QStringList BaudRateTypeString;
QStringList BaudRateTypeStringALL;
QStringList DataBitsTypeStringALL;
QStringList ParityTypeStringALL;
QStringList StopBitsTypeStringALL;
QStringList DataBitsTypeString;
QStringList ParityTypeString;
QStringList StopBitsTypeString;
QStringList FlowTypeString;
private slots:
};
#endif // GPSDISPLAYGADGETOPTIONSPAGE_H

View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GpsDisplayGadgetOptionsPage</class>
<widget class="QWidget" name="GpsDisplayGadgetOptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>486</width>
<height>300</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="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="Utils::PathChooser" name="svgFilePathChooser" native="true">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>50</x>
<y>10</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>160</x>
<y>40</y>
<width>118</width>
<height>3</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>40</x>
<y>60</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Port:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>160</x>
<y>60</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Port Speed:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_2">
<property name="geometry">
<rect>
<x>70</x>
<y>60</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox_3">
<property name="geometry">
<rect>
<x>230</x>
<y>60</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>320</x>
<y>60</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Flow Control:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_4">
<property name="geometry">
<rect>
<x>390</x>
<y>60</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Bit format:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_5">
<property name="geometry">
<rect>
<x>70</x>
<y>100</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox_6">
<property name="geometry">
<rect>
<x>150</x>
<y>100</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox_7">
<property name="geometry">
<rect>
<x>230</x>
<y>100</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox_8">
<property name="geometry">
<rect>
<x>70</x>
<y>140</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>140</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Timeout:</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header>utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,65 @@
/**
******************************************************************************
*
* @file systemhealthplugin.h
* @author Edouard Lafargue Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup systemhealth
* @{
*
*****************************************************************************/
/*
* 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 "gpsdisplayplugin.h"
#include "gpsdisplaygadgetfactory.h"
#include <QDebug>
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
GpsDisplayPlugin::GpsDisplayPlugin()
{
// Do nothing
}
GpsDisplayPlugin::~GpsDisplayPlugin()
{
// Do nothing
}
bool GpsDisplayPlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
mf = new GpsDisplayGadgetFactory(this);
addAutoReleasedObject(mf);
return true;
}
void GpsDisplayPlugin::extensionsInitialized()
{
// Do nothing
}
void GpsDisplayPlugin::shutdown()
{
// Do nothing
}
Q_EXPORT_PLUGIN(GpsDisplayPlugin)

View File

@ -0,0 +1,47 @@
/**
******************************************************************************
*
* @file gpsdisplayplugin.h
* @author Edouard Lafargue Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 GPSDISPLAYPLUGIN_H_
#define GPSDISPLAYPLUGIN_H_
#include <extensionsystem/iplugin.h>
class GpsDisplayGadgetFactory;
class GpsDisplayPlugin : public ExtensionSystem::IPlugin
{
public:
GpsDisplayPlugin();
~GpsDisplayPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private:
GpsDisplayGadgetFactory *mf;
};
#endif /* GPSDISPLAYPLUGIN_H_ */

View File

@ -0,0 +1,60 @@
/**
******************************************************************************
*
* @file gpsdisplaywidget.cpp
* @author Edouard Lafargue Copyright (C) 2010.
* @brief GPS Display widget, does the actual drawing
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 "gpsdisplaywidget.h"
#include "ui_gpsdisplaywidget.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjects/uavobjectmanager.h"
#include <iostream>
#include <QtGui/QFileDialog>
#include <QDebug>
/*
* Initialize the widget
*/
GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
{
setMinimumSize(128,128);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
widget = new Ui_GpsDisplayWidget();
widget->setupUi(this);
}
GpsDisplayWidget::~GpsDisplayWidget()
{
delete widget;
}
void GpsDisplayWidget::connectButtonClicked() {
}

View File

@ -0,0 +1,61 @@
/**
******************************************************************************
*
* @file gpsdisplaywidget.h
* @author Edouard Lafargue Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup gpsdisplay
* @{
*
*****************************************************************************/
/*
* 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 GPSDISPLAYWIDGET_H_
#define GPSDISPLAYWIDGET_H_
#include "gpsdisplaygadgetconfiguration.h"
#include "uavobjects/uavobject.h"
#include <QGraphicsView>
#include <QtSvg/QSvgRenderer>
#include <QtSvg/QGraphicsSvgItem>
#include <QFile>
#include <QTimer>
class Ui_GpsDisplayWidget;
class GpsDisplayWidget : public QWidget
{
Q_OBJECT
public:
GpsDisplayWidget(QWidget *parent = 0);
~GpsDisplayWidget();
// void setMode(QString mode); // Either UAVTalk or serial port
private slots:
void connectButtonClicked();
private:
Ui_GpsDisplayWidget* widget;
bool connected;
};
#endif /* GPSDISPLAYWIDGET_H_ */

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GpsDisplayWidget</class>
<widget class="QWidget" name="GpsDisplayWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>488</width>
<height>279</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>281</width>
<height>91</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Position:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Fix:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Bearing:</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Speed:</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>HDOP:</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Time:</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
<widget class="QGraphicsView" name="graphicsView">
<property name="geometry">
<rect>
<x>300</x>
<y>10</y>
<width>171</width>
<height>171</height>
</rect>
</property>
</widget>
<widget class="QGraphicsView" name="graphicsView_2">
<property name="geometry">
<rect>
<x>100</x>
<y>110</y>
<width>191</width>
<height>71</height>
</rect>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>461</width>
<height>81</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Disconnect</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>