From 3784ee4ffd086d4f1431638c03ed009f1a0928ee Mon Sep 17 00:00:00 2001 From: edouard Date: Tue, 22 Jun 2010 09:22:51 +0000 Subject: [PATCH] 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 --- .../gpsdisplay/GpsDisplayGadget.pluginspec | 11 + ground/src/plugins/gpsdisplay/gpsdisplay.pro | 22 ++ .../gpsdisplay/gpsdisplay_dependencies.pri | 3 + .../plugins/gpsdisplay/gpsdisplaygadget.cpp | 52 +++++ .../src/plugins/gpsdisplay/gpsdisplaygadget.h | 56 +++++ .../gpsdisplaygadgetconfiguration.cpp | 66 ++++++ .../gpsdisplaygadgetconfiguration.h | 59 +++++ .../gpsdisplay/gpsdisplaygadgetfactory.cpp | 60 +++++ .../gpsdisplay/gpsdisplaygadgetfactory.h | 52 +++++ .../gpsdisplaygadgetoptionspage.cpp | 198 ++++++++++++++++ .../gpsdisplay/gpsdisplaygadgetoptionspage.h | 76 +++++++ .../gpsdisplay/gpsdisplaygadgetoptionspage.ui | 213 ++++++++++++++++++ .../plugins/gpsdisplay/gpsdisplayplugin.cpp | 65 ++++++ .../src/plugins/gpsdisplay/gpsdisplayplugin.h | 47 ++++ .../plugins/gpsdisplay/gpsdisplaywidget.cpp | 60 +++++ .../src/plugins/gpsdisplay/gpsdisplaywidget.h | 61 +++++ .../plugins/gpsdisplay/gpsdisplaywidget.ui | 169 ++++++++++++++ 17 files changed, 1270 insertions(+) create mode 100644 ground/src/plugins/gpsdisplay/GpsDisplayGadget.pluginspec create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplay.pro create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplay_dependencies.pri create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadget.h create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.cpp create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.h create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.cpp create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.ui create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplayplugin.h create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaywidget.h create mode 100644 ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui diff --git a/ground/src/plugins/gpsdisplay/GpsDisplayGadget.pluginspec b/ground/src/plugins/gpsdisplay/GpsDisplayGadget.pluginspec new file mode 100644 index 000000000..aa25960b4 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/GpsDisplayGadget.pluginspec @@ -0,0 +1,11 @@ + + The OpenPilot Project + (C) 2010 Edouard Lafargue + The GNU Public License (GPL) Version 3 + Plugin displaying the status of the onboard GPS + http://www.openpilot.org + + + + + diff --git a/ground/src/plugins/gpsdisplay/gpsdisplay.pro b/ground/src/plugins/gpsdisplay/gpsdisplay.pro new file mode 100644 index 000000000..b6008f4bf --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplay.pro @@ -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 diff --git a/ground/src/plugins/gpsdisplay/gpsdisplay_dependencies.pri b/ground/src/plugins/gpsdisplay/gpsdisplay_dependencies.pri new file mode 100644 index 000000000..ad54b0073 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplay_dependencies.pri @@ -0,0 +1,3 @@ +include(../../plugins/uavobjects/uavobjects.pri) +#include(../../plugins/coreplugin/coreplugin.pri) +#include(../../libs/utils/utils.pri) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp new file mode 100644 index 000000000..bc6be147a --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp @@ -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(config); + //m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint +} diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.h b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.h new file mode 100644 index 000000000..111874466 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.h @@ -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 +#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_ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.cpp new file mode 100644 index 000000000..700e9a9cb --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.cpp @@ -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 + +/** + * 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; +} diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h new file mode 100644 index 000000000..3268d7a79 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h @@ -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 + +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 diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp new file mode 100644 index 000000000..6d8c70fba --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp @@ -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 + +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(config)); +} + diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.h b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.h new file mode 100644 index 000000000..99d178c54 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.h @@ -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 + +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_ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.cpp new file mode 100644 index 000000000..6eb180755 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.cpp @@ -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 +#include +#include + +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.portNamesetupUi(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; +} diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h new file mode 100644 index 000000000..c2ace9afc --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h @@ -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 +#include "coreplugin/dialogs/ioptionspage.h" +#include "QString" +#include +#include + +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 diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.ui b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.ui new file mode 100644 index 000000000..d7701cad5 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.ui @@ -0,0 +1,213 @@ + + + GpsDisplayGadgetOptionsPage + + + + 0 + 0 + 486 + 300 + + + + + 0 + 0 + + + + Form + + + + 0 + + + + + + + 10 + 10 + 46 + 13 + + + + Mode: + + + + + + 50 + 10 + 69 + 22 + + + + + + + 160 + 40 + 118 + 3 + + + + Qt::Horizontal + + + + + + 40 + 60 + 46 + 13 + + + + Port: + + + + + + 160 + 60 + 61 + 16 + + + + Port Speed: + + + + + + 70 + 60 + 69 + 22 + + + + + + + 230 + 60 + 69 + 22 + + + + + + + 320 + 60 + 71 + 16 + + + + Flow Control: + + + + + + 390 + 60 + 69 + 22 + + + + + + + 10 + 100 + 51 + 16 + + + + Bit format: + + + + + + 70 + 100 + 69 + 22 + + + + + + + 150 + 100 + 69 + 22 + + + + + + + 230 + 100 + 69 + 22 + + + + + + + 70 + 140 + 69 + 22 + + + + + + + 20 + 140 + 46 + 13 + + + + Timeout: + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp new file mode 100644 index 000000000..23469d7a3 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp @@ -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 +#include +#include +#include + + +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) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplayplugin.h b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.h new file mode 100644 index 000000000..7b7d7ad44 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.h @@ -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 + +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_ */ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp new file mode 100644 index 000000000..70a74fdfd --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp @@ -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 +#include +#include + +/* + * 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() { +} + + + diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h new file mode 100644 index 000000000..cf3acd5f3 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h @@ -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 +#include +#include + +#include +#include + +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_ */ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui new file mode 100644 index 000000000..70b8ac0d8 --- /dev/null +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui @@ -0,0 +1,169 @@ + + + GpsDisplayWidget + + + + 0 + 0 + 488 + 279 + + + + Form + + + + + 10 + 10 + 281 + 91 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + + 10 + 10 + 46 + 13 + + + + Position: + + + + + + 10 + 30 + 46 + 13 + + + + Fix: + + + + + + 10 + 50 + 46 + 13 + + + + Bearing: + + + + + + 150 + 50 + 46 + 13 + + + + Speed: + + + + + + 90 + 30 + 46 + 13 + + + + HDOP: + + + + + + 10 + 70 + 46 + 13 + + + + Time: + + + + + + + 10 + 110 + 75 + 23 + + + + Connect + + + + + + 300 + 10 + 171 + 171 + + + + + + + 100 + 110 + 191 + 71 + + + + + + + 10 + 190 + 461 + 81 + + + + + + + 10 + 140 + 75 + 23 + + + + Disconnect + + + + + +