From 61c7be7765b8248953f667bd238ddfbb7544d8d9 Mon Sep 17 00:00:00 2001 From: dankers Date: Wed, 23 Jun 2010 01:59:12 +0000 Subject: [PATCH] Some Doxygen fixes, remove auto generated headers from config plugin, remove emptyplugin from the build. Just janitor work. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@862 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../src/plugins/airspeed/airspeedgadget.cpp | 136 +-- ground/src/plugins/airspeed/airspeedgadget.h | 112 +-- .../airspeed/airspeedgadgetconfiguration.cpp | 2 +- .../airspeed/airspeedgadgetconfiguration.h | 2 +- .../airspeed/airspeedgadgetfactory.cpp | 120 +-- .../plugins/airspeed/airspeedgadgetfactory.h | 104 +- .../airspeed/airspeedgadgetoptionspage.cpp | 2 +- .../airspeed/airspeedgadgetoptionspage.h | 2 +- .../plugins/airspeed/airspeedgadgetwidget.cpp | 916 +++++++++--------- .../plugins/airspeed/airspeedgadgetwidget.h | 276 +++--- .../src/plugins/airspeed/airspeedplugin.cpp | 132 +-- ground/src/plugins/airspeed/airspeedplugin.h | 94 +- ground/src/plugins/config/configfactory.h | 2 +- ground/src/plugins/config/configgadget.cpp | 2 +- ground/src/plugins/config/configgadget.h | 2 +- .../config/configgadgetconfiguration.cpp | 2 +- .../config/configgadgetconfiguration.h | 2 +- .../plugins/config/configgadgetfactory.cpp | 2 +- .../src/plugins/config/configgadgetfactory.h | 2 +- .../config/configgadgetoptionspage.cpp | 2 +- .../plugins/config/configgadgetoptionspage.h | 2 +- .../src/plugins/config/configgadgetwidget.cpp | 2 +- .../src/plugins/config/configgadgetwidget.h | 2 +- ground/src/plugins/config/configplugin.cpp | 2 +- ground/src/plugins/config/configplugin.h | 2 +- ground/src/plugins/config/ui_configgadget.h | 96 -- .../plugins/config/ui_configgadgetwidget.h | 96 -- .../plugins/consolegadget/consolegadget.cpp | 102 +- .../src/plugins/consolegadget/consolegadget.h | 118 +-- .../consolegadget/consolegadgetfactory.cpp | 94 +- .../consolegadget/consolegadgetfactory.h | 100 +- .../consolegadget/consolegadgetwidget.cpp | 88 +- .../consolegadget/consolegadgetwidget.h | 88 +- .../plugins/consolegadget/consoleplugin.cpp | 130 +-- .../src/plugins/consolegadget/consoleplugin.h | 94 +- .../consolegadget/texteditloggerengine.cpp | 270 +++--- .../consolegadget/texteditloggerengine.h | 114 +-- .../src/plugins/emptygadget/emptygadget.cpp | 78 +- ground/src/plugins/emptygadget/emptygadget.h | 118 +-- .../emptygadget/emptygadgetfactory.cpp | 94 +- .../plugins/emptygadget/emptygadgetfactory.h | 100 +- .../plugins/emptygadget/emptygadgetwidget.cpp | 100 +- .../plugins/emptygadget/emptygadgetwidget.h | 88 +- .../src/plugins/emptygadget/emptyplugin.cpp | 130 +-- ground/src/plugins/emptygadget/emptyplugin.h | 94 +- .../plugins/gpsdisplay/gpsdisplaygadget.cpp | 104 +- .../src/plugins/gpsdisplay/gpsdisplaygadget.h | 112 +-- .../gpsdisplaygadgetconfiguration.cpp | 2 +- .../gpsdisplaygadgetconfiguration.h | 2 +- .../gpsdisplay/gpsdisplaygadgetfactory.cpp | 120 +-- .../gpsdisplay/gpsdisplaygadgetfactory.h | 104 +- .../gpsdisplaygadgetoptionspage.cpp | 2 +- .../gpsdisplay/gpsdisplaygadgetoptionspage.h | 2 +- .../plugins/gpsdisplay/gpsdisplayplugin.cpp | 130 +-- .../src/plugins/gpsdisplay/gpsdisplayplugin.h | 94 +- .../plugins/gpsdisplay/gpsdisplaywidget.cpp | 120 +-- .../src/plugins/gpsdisplay/gpsdisplaywidget.h | 122 +-- ground/src/plugins/hitl/flightgearbridge.cpp | 2 +- ground/src/plugins/hitl/flightgearbridge.h | 2 +- ground/src/plugins/hitl/hitl.cpp | 98 +- ground/src/plugins/hitl/hitl.h | 112 +-- ground/src/plugins/hitl/hitlconfiguration.cpp | 134 +-- ground/src/plugins/hitl/hitlconfiguration.h | 136 +-- ground/src/plugins/hitl/hitlfactory.cpp | 116 +-- ground/src/plugins/hitl/hitlfactory.h | 104 +- ground/src/plugins/hitl/hitloptionspage.cpp | 146 +-- ground/src/plugins/hitl/hitloptionspage.h | 130 +-- ground/src/plugins/hitl/hitlplugin.cpp | 126 +-- ground/src/plugins/hitl/hitlplugin.h | 94 +- ground/src/plugins/hitl/hitlwidget.cpp | 418 ++++---- ground/src/plugins/hitl/hitlwidget.h | 140 +-- .../plugins/lineardial/lineardialgadget.cpp | 116 +-- .../src/plugins/lineardial/lineardialgadget.h | 112 +-- .../lineardialgadgetconfiguration.cpp | 2 +- .../lineardialgadgetconfiguration.h | 2 +- .../lineardial/lineardialgadgetfactory.cpp | 120 +-- .../lineardial/lineardialgadgetfactory.h | 104 +- .../lineardialgadgetoptionspage.cpp | 4 +- .../lineardial/lineardialgadgetoptionspage.h | 4 +- .../lineardial/lineardialgadgetwidget.cpp | 640 ++++++------ .../lineardial/lineardialgadgetwidget.h | 250 ++--- .../plugins/lineardial/lineardialplugin.cpp | 132 +-- .../src/plugins/lineardial/lineardialplugin.h | 94 +- .../src/plugins/modelview/modelviewgadget.cpp | 100 +- .../src/plugins/modelview/modelviewgadget.h | 112 +-- .../modelviewgadgetconfiguration.cpp | 128 +-- .../modelview/modelviewgadgetconfiguration.h | 116 +-- .../modelview/modelviewgadgetfactory.cpp | 118 +-- .../modelview/modelviewgadgetfactory.h | 104 +- .../modelview/modelviewgadgetoptionspage.cpp | 142 +-- .../modelview/modelviewgadgetoptionspage.h | 148 +-- .../modelview/modelviewgadgetwidget.cpp | 400 ++++---- .../plugins/modelview/modelviewgadgetwidget.h | 192 ++-- .../src/plugins/modelview/modelviewplugin.cpp | 130 +-- .../src/plugins/modelview/modelviewplugin.h | 94 +- ground/src/plugins/plugins.pro | 14 +- 96 files changed, 4988 insertions(+), 5178 deletions(-) delete mode 100644 ground/src/plugins/config/ui_configgadget.h delete mode 100644 ground/src/plugins/config/ui_configgadgetwidget.h diff --git a/ground/src/plugins/airspeed/airspeedgadget.cpp b/ground/src/plugins/airspeed/airspeedgadget.cpp index d9e6b9476..c033059fb 100644 --- a/ground/src/plugins/airspeed/airspeedgadget.cpp +++ b/ground/src/plugins/airspeed/airspeedgadget.cpp @@ -1,68 +1,68 @@ -/** - ****************************************************************************** - * - * @file airspeedgadget.cpp - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 "airspeedgadget.h" -#include "airspeedgadgetwidget.h" -#include "airspeedgadgetconfiguration.h" - -AirspeedGadget::AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget) -{ -} - -AirspeedGadget::~AirspeedGadget() -{ -} - -/* - 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 AirspeedGadget::loadConfiguration(IUAVGadgetConfiguration* config) -{ - AirspeedGadgetConfiguration *m = qobject_cast(config); - m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(), - m->dialNeedle2(),m->dialNeedle3(),m->getN1Move(), m->getN2Move(), - m->getN3Move()); - - m_widget->setN1Min(m->getN1Min()); - m_widget->setN1Max(m->getN1Max()); - m_widget->setN1Factor(m->getN1Factor()); - m_widget->setN2Min(m->getN2Min()); - m_widget->setN2Max(m->getN2Max()); - m_widget->setN2Factor(m->getN2Factor()); - m_widget->setN3Min(m->getN3Min()); - m_widget->setN3Max(m->getN3Max()); - m_widget->setN3Factor(m->getN3Factor()); - m_widget->connectNeedles(m->getN1DataObject(),m->getN1ObjField(), - m->getN2DataObject(),m->getN2ObjField(), - m->getN3DataObject(),m->getN3ObjField() - ); -} +/** + ****************************************************************************** + * + * @file airspeedgadget.cpp + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "airspeedgadget.h" +#include "airspeedgadgetwidget.h" +#include "airspeedgadgetconfiguration.h" + +AirspeedGadget::AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget) +{ +} + +AirspeedGadget::~AirspeedGadget() +{ +} + +/* + 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 AirspeedGadget::loadConfiguration(IUAVGadgetConfiguration* config) +{ + AirspeedGadgetConfiguration *m = qobject_cast(config); + m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(), + m->dialNeedle2(),m->dialNeedle3(),m->getN1Move(), m->getN2Move(), + m->getN3Move()); + + m_widget->setN1Min(m->getN1Min()); + m_widget->setN1Max(m->getN1Max()); + m_widget->setN1Factor(m->getN1Factor()); + m_widget->setN2Min(m->getN2Min()); + m_widget->setN2Max(m->getN2Max()); + m_widget->setN2Factor(m->getN2Factor()); + m_widget->setN3Min(m->getN3Min()); + m_widget->setN3Max(m->getN3Max()); + m_widget->setN3Factor(m->getN3Factor()); + m_widget->connectNeedles(m->getN1DataObject(),m->getN1ObjField(), + m->getN2DataObject(),m->getN2ObjField(), + m->getN3DataObject(),m->getN3ObjField() + ); +} diff --git a/ground/src/plugins/airspeed/airspeedgadget.h b/ground/src/plugins/airspeed/airspeedgadget.h index 4784eab75..ba777176a 100644 --- a/ground/src/plugins/airspeed/airspeedgadget.h +++ b/ground/src/plugins/airspeed/airspeedgadget.h @@ -1,56 +1,56 @@ -/** - ****************************************************************************** - * - * @file airspeedgadget.h - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 AIRSPEEDGADGET_H_ -#define AIRSPEEDGADGET_H_ - -#include -#include "airspeedgadgetwidget.h" - -class IUAVGadget; -class QWidget; -class QString; -class AirspeedGadgetWidget; - -using namespace Core; - -class AirspeedGadget : public Core::IUAVGadget -{ - Q_OBJECT -public: - AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent = 0); - ~AirspeedGadget(); - - QWidget *widget() { return m_widget; } - void loadConfiguration(IUAVGadgetConfiguration* config); - -private: - AirspeedGadgetWidget *m_widget; -}; - - -#endif // AIRSPEEDGADGET_H_ +/** + ****************************************************************************** + * + * @file airspeedgadget.h + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 AIRSPEEDGADGET_H_ +#define AIRSPEEDGADGET_H_ + +#include +#include "airspeedgadgetwidget.h" + +class IUAVGadget; +class QWidget; +class QString; +class AirspeedGadgetWidget; + +using namespace Core; + +class AirspeedGadget : public Core::IUAVGadget +{ + Q_OBJECT +public: + AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent = 0); + ~AirspeedGadget(); + + QWidget *widget() { return m_widget; } + void loadConfiguration(IUAVGadgetConfiguration* config); + +private: + AirspeedGadgetWidget *m_widget; +}; + + +#endif // AIRSPEEDGADGET_H_ diff --git a/ground/src/plugins/airspeed/airspeedgadgetconfiguration.cpp b/ground/src/plugins/airspeed/airspeedgadgetconfiguration.cpp index 32870767a..df2866600 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetconfiguration.cpp +++ b/ground/src/plugins/airspeed/airspeedgadgetconfiguration.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Airspeed Plugin Gadget configuration * @see The GNU Public License (GPL) Version 3 - * @defgroup Airspeed + * @defgroup dialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/airspeed/airspeedgadgetconfiguration.h b/ground/src/plugins/airspeed/airspeedgadgetconfiguration.h index 080b82953..14ed95cde 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetconfiguration.h +++ b/ground/src/plugins/airspeed/airspeedgadgetconfiguration.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Airspeed Plugin Gadget configuration * @see The GNU Public License (GPL) Version 3 - * @defgroup Airspeed + * @defgroup dialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/airspeed/airspeedgadgetfactory.cpp b/ground/src/plugins/airspeed/airspeedgadgetfactory.cpp index 0e42014d6..fabca4da4 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetfactory.cpp +++ b/ground/src/plugins/airspeed/airspeedgadgetfactory.cpp @@ -1,60 +1,60 @@ -/** - ****************************************************************************** - * - * @file airspeedgadgetfactory.cpp - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 "airspeedgadgetfactory.h" -#include "airspeedgadgetwidget.h" -#include "airspeedgadget.h" -#include "airspeedgadgetconfiguration.h" -#include "airspeedgadgetoptionspage.h" -#include - -AirspeedGadgetFactory::AirspeedGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("AirspeedGadget"), - tr("Analog Dial Gadget"), - parent) -{ -} - -AirspeedGadgetFactory::~AirspeedGadgetFactory() -{ -} - -Core::IUAVGadget* AirspeedGadgetFactory::createGadget(QWidget *parent) -{ - AirspeedGadgetWidget* gadgetWidget = new AirspeedGadgetWidget(parent); - return new AirspeedGadget(QString("AirspeedGadget"), gadgetWidget, parent); -} - -IUAVGadgetConfiguration *AirspeedGadgetFactory::createConfiguration(const QByteArray &state) -{ - return new AirspeedGadgetConfiguration(QString("AirspeedGadget"), state); -} - -IOptionsPage *AirspeedGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) -{ - return new AirspeedGadgetOptionsPage(qobject_cast(config)); -} - +/** + ****************************************************************************** + * + * @file airspeedgadgetfactory.cpp + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "airspeedgadgetfactory.h" +#include "airspeedgadgetwidget.h" +#include "airspeedgadget.h" +#include "airspeedgadgetconfiguration.h" +#include "airspeedgadgetoptionspage.h" +#include + +AirspeedGadgetFactory::AirspeedGadgetFactory(QObject *parent) : + IUAVGadgetFactory(QString("AirspeedGadget"), + tr("Analog Dial Gadget"), + parent) +{ +} + +AirspeedGadgetFactory::~AirspeedGadgetFactory() +{ +} + +Core::IUAVGadget* AirspeedGadgetFactory::createGadget(QWidget *parent) +{ + AirspeedGadgetWidget* gadgetWidget = new AirspeedGadgetWidget(parent); + return new AirspeedGadget(QString("AirspeedGadget"), gadgetWidget, parent); +} + +IUAVGadgetConfiguration *AirspeedGadgetFactory::createConfiguration(const QByteArray &state) +{ + return new AirspeedGadgetConfiguration(QString("AirspeedGadget"), state); +} + +IOptionsPage *AirspeedGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) +{ + return new AirspeedGadgetOptionsPage(qobject_cast(config)); +} + diff --git a/ground/src/plugins/airspeed/airspeedgadgetfactory.h b/ground/src/plugins/airspeed/airspeedgadgetfactory.h index aae9ab2be..cb95059ea 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetfactory.h +++ b/ground/src/plugins/airspeed/airspeedgadgetfactory.h @@ -1,52 +1,52 @@ -/** - ****************************************************************************** - * - * @file airspeedgadgetfactory.h - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 AIRSPEEDGADGETFACTORY_H_ -#define AIRSPEEDGADGETFACTORY_H_ - -#include - -namespace Core { -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class AirspeedGadgetFactory : public IUAVGadgetFactory -{ - Q_OBJECT -public: - AirspeedGadgetFactory(QObject *parent = 0); - ~AirspeedGadgetFactory(); - - Core::IUAVGadget *createGadget(QWidget *parent); - IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); - IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); -}; - -#endif // AIRSPEEDGADGETFACTORY_H_ +/** + ****************************************************************************** + * + * @file airspeedgadgetfactory.h + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 AIRSPEEDGADGETFACTORY_H_ +#define AIRSPEEDGADGETFACTORY_H_ + +#include + +namespace Core { +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class AirspeedGadgetFactory : public IUAVGadgetFactory +{ + Q_OBJECT +public: + AirspeedGadgetFactory(QObject *parent = 0); + ~AirspeedGadgetFactory(); + + Core::IUAVGadget *createGadget(QWidget *parent); + IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); + IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); +}; + +#endif // AIRSPEEDGADGETFACTORY_H_ diff --git a/ground/src/plugins/airspeed/airspeedgadgetoptionspage.cpp b/ground/src/plugins/airspeed/airspeedgadgetoptionspage.cpp index 0cf46b887..2df41a1d8 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetoptionspage.cpp +++ b/ground/src/plugins/airspeed/airspeedgadgetoptionspage.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Airspeed Plugin Gadget options page * @see The GNU Public License (GPL) Version 3 - * @defgroup Airspeed + * @defgroup dialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/airspeed/airspeedgadgetoptionspage.h b/ground/src/plugins/airspeed/airspeedgadgetoptionspage.h index 4872e5eeb..10152b8f6 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetoptionspage.h +++ b/ground/src/plugins/airspeed/airspeedgadgetoptionspage.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Airspeed Plugin Gadget options page * @see The GNU Public License (GPL) Version 3 - * @defgroup Airspeed + * @defgroup dialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/airspeed/airspeedgadgetwidget.cpp b/ground/src/plugins/airspeed/airspeedgadgetwidget.cpp index d5ec669d6..5b06f8fb9 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetwidget.cpp +++ b/ground/src/plugins/airspeed/airspeedgadgetwidget.cpp @@ -1,458 +1,458 @@ -/** - ****************************************************************************** - * - * @file airspeedgadgetwidget.cpp - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 "airspeedgadgetwidget.h" -#include -#include - -AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent) -{ - // TODO: create a proper "needle" object instead of hardcoding all this - // which is ugly (but easy). - - setMinimumSize(64,64); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - setScene(new QGraphicsScene(this)); - setRenderHints(QPainter::Antialiasing); - - m_renderer = new QSvgRenderer(); - - obj1 = NULL; - obj2 = NULL; - obj3 = NULL; - - // This timer mechanism makes needles rotate smoothly - connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles())); - dialTimer.start(20); - -} - -AirspeedGadgetWidget::~AirspeedGadgetWidget() -{ - // Do nothing -} - -/*! - \brief Connects the widget to the relevant UAVObjects - */ -void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1, - QString object2, QString nfield2, - QString object3, QString nfield3) { - if (obj1 != NULL) - disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle1(UAVObject*))); - if (obj2 != NULL) - disconnect(obj2,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle2(UAVObject*))); - if (obj3 != NULL) - disconnect(obj3,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle3(UAVObject*))); - - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - - // Check validity of arguments first, reject empty args and unknown fields. - if (!(object1.isEmpty() || nfield1.isEmpty())) { - obj1 = dynamic_cast( objManager->getObject(object1) ); - if (obj1 != NULL ) { - std::cout << "Connected Object 1 (" << object1.toStdString() << ")." << std::endl; - connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle1(UAVObject*))); - field1 = nfield1; - } else { - std::cout << "Error: Object is unknown (" << object1.toStdString() << ")." << std::endl; - } - } - - // And do the same for the second needle. - if (!(object2.isEmpty() || nfield2.isEmpty())) { - obj2 = dynamic_cast( objManager->getObject(object2) ); - if (obj2 != NULL ) { - std::cout << "Connected Object 2 (" << object2.toStdString() << ")." << std::endl; - connect(obj2, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle2(UAVObject*))); - field2 = nfield2; - } else { - std::cout << "Error: Object is unknown (" << object2.toStdString() << ")." << std::endl; - } - } - - // And do the same for the third needle. - if (!(object3.isEmpty() || nfield3.isEmpty())) { - obj3 = dynamic_cast( objManager->getObject(object3) ); - if (obj3 != NULL ) { - std::cout << "Connected Object 3 (" << object3.toStdString() << ")." << std::endl; - connect(obj3, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle3(UAVObject*))); - field3 = nfield3; - } else { - std::cout << "Error: Object is unknown (" << object3.toStdString() << ")." << std::endl; - } - } -} - -/*! - \brief Called by the UAVObject which got updated - */ -void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) { - // Double check that the field exists: - UAVObjectField* field = object1->getField(field1); - if (field) { - setNeedle1(field->getDouble()); - } else { - std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; - } -} - -/*! - \brief Called by the UAVObject which got updated - */ -void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) { - UAVObjectField* field = object2->getField(field2); - if (field) { - setNeedle2(field->getDouble()); - } else { - std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; - } -} - -/*! - \brief Called by the UAVObject which got updated - */ -void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) { - UAVObjectField* field = object3->getField(field3); - if (field) { - setNeedle3(field->getDouble()); - } else { - std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; - } -} - -/* - Initializes the dial file, and does all the one-time calculations for - display later. - */ -void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, - QString n3, QString n1Move, QString n2Move, QString n3Move) -{ - if (QFile::exists(dfn)) - { - m_renderer->load(dfn); - if(m_renderer->isValid()) - { - fgenabled = false; - n2enabled = false; - n3enabled = false; - QGraphicsScene *l_scene = scene(); - l_scene->clear(); // Deletes all items contained in the scene as well. - m_background = new QGraphicsSvgItem(); - // All other items will be clipped to the shape of the background - m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape| - QGraphicsItem::ItemClipsToShape); - m_foreground = new QGraphicsSvgItem(); - m_needle1 = new QGraphicsSvgItem(); - m_needle2 = new QGraphicsSvgItem(); - m_needle3 = new QGraphicsSvgItem(); - m_needle1->setParentItem(m_background); - m_needle2->setParentItem(m_background); - m_needle3->setParentItem(m_background); - m_foreground->setParentItem(m_background); - - // We assume the dial contains at least the background - // and needle1 - m_background->setSharedRenderer(m_renderer); - m_background->setElementId(bg); - l_scene->addItem(m_background); - - m_needle1->setSharedRenderer(m_renderer); - m_needle1->setElementId(n1); - l_scene->addItem(m_needle1); - - // The dial gadget allows Needle1 and Needle2 to be - // the same element, for combined movement. Needle3 - // is always independent. - if (n1 == n2) { - m_needle2 = m_needle1; - n2enabled = true; - } else { - if (m_renderer->elementExists(n2)) { - m_needle2->setSharedRenderer(m_renderer); - m_needle2->setElementId(n2); - l_scene->addItem(m_needle2); - n2enabled = true; - } - } - - if (m_renderer->elementExists(n3)) { - m_needle3->setSharedRenderer(m_renderer); - m_needle3->setElementId(n3); - l_scene->addItem(m_needle3); - n3enabled = true; - } - - if (m_renderer->elementExists(fg)) { - m_foreground->setSharedRenderer(m_renderer); - m_foreground->setElementId(fg); - l_scene->addItem(m_foreground); - fgenabled = true; - } - - rotateN1 = false; - horizN1 = false; - vertN1 = false; - rotateN2 = false; - horizN2 = false; - vertN2 = false; - rotateN3 = false; - horizN3 = false; - vertN3 = false; - - - // Now setup the rotation/translation settings: - // this is UGLY UGLY UGLY, sorry... - if (n1Move.contains("Rotate")) { - rotateN1 = true; - } else if (n1Move.contains("Horizontal")) { - horizN1 = true; - } else if (n1Move.contains("Vertical")) { - vertN1 = true; - } - - if (n2Move.contains("Rotate")) { - rotateN2 = true; - } else if (n2Move.contains("Horizontal")) { - horizN2 = true; - } else if (n2Move.contains("Vertical")) { - vertN2 = true; - } - - if (n3Move.contains("Rotate")) { - rotateN3 = true; - } else if (n3Move.contains("Horizontal")) { - horizN3 = true; - } else if (n3Move.contains("Vertical")) { - vertN3 = true; - } - - l_scene->setSceneRect(m_background->boundingRect()); - - // Now Initialize the center for all transforms of the dial needles to the - // center of the background: - // - Move the center of the needle to the center of the background. - QRectF rectB = m_background->boundingRect(); - QRectF rectN = m_needle1->boundingRect(); - m_needle1->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2); - // - Put the transform origin point of the needle at its center. - m_needle1->setTransformOriginPoint(rectN.width()/2,rectN.height()/2); - if ((n1 != n2) && n2enabled) { - // Only do it for needle1 if it is not the same as n2 - rectN = m_needle2->boundingRect(); - m_needle2->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2); - m_needle2->setTransformOriginPoint(rectN.width()/2,rectN.height()/2); - } - if (n3enabled) { - rectN = m_needle3->boundingRect(); - m_needle3->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2); - m_needle3->setTransformOriginPoint(rectN.width()/2,rectN.height()/2); - } - - // Last: we just loaded the dial file which is by default valid for a "zero" value - // of the needles, so we have to reset the needles too upon dial file loading, otherwise - // we would end up with an offset when we change a dial file and the needle value - // is not zero at that time. - needle1Target = 0; - needle2Target = 0; - needle3Target = 0; - needle1Value = 0; - needle2Value = 0; - needle3Value = 0; - - } - } - else - { std::cout<<"no file: "<isValid()) { - std::cout<<"Dial file not loaded, not rendering"< 5) { - double needle2Diff; - needle2Diff =(needle2Target - needle2Value)/5; - if (rotateN2) { - m_needle2->setRotation(m_needle2->rotation()+needle2Diff); - } else { - QPointF opd = QPointF(0,0); - if (horizN2) { - opd = QPointF(needle2Diff,0); - } - if (vertN2) { - opd = QPointF(0,needle2Diff); - } - m_needle2->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true); - // Since we have moved the needle, we need to move - // the transform origin point the opposite way - // so that it keeps rotating from the same point. - // (this is only useful if needle1 and needle2 are the - // same object, for combined movement such as attitude indicator). - QPointF oop = m_needle2->transformOriginPoint(); - m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y()); - } - needle2Value += needle2Diff; - } else { - needle2Value = needle2Target; - dialRun--; - } - } else { - dialRun--; - } - - // We assume that needle1 always exists! - if ((abs((needle1Value-needle1Target)*10) > 5)) { - double needle1Diff; - needle1Diff = (needle1Target - needle1Value)/5; - if (rotateN1) { - m_needle1->setRotation(m_needle1->rotation()+needle1Diff); - } else { - QPointF opd = QPointF(0,0); - if (horizN1) { - opd = QPointF(needle1Diff,0); - } - if (vertN1) { - opd = QPointF(0,needle1Diff); - } - m_needle1->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true); - QPointF oop = m_needle1->transformOriginPoint(); - m_needle1->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y())); - } - needle1Value += needle1Diff; - } else { // value is close enough to target, value to exact target - // to cancel out any potential drift - needle1Value = needle1Target; - dialRun--; - } - - if (n3enabled) { - if ((abs((needle3Value-needle3Target)*10) > 5)) { - double needle3Diff; - needle3Diff = (needle3Target - needle3Value)/5; - if (rotateN3) { - m_needle3->setRotation(m_needle3->rotation()+needle3Diff); - } else { - QPointF opd = QPointF(0,0); - if (horizN3) { - opd = QPointF(needle3Diff,0); - } - if (vertN3) { - opd = QPointF(0,needle3Diff); - } - m_needle3->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true); - QPointF oop = m_needle3->transformOriginPoint(); - m_needle3->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y())); - } - needle3Value += needle3Diff; - } else { - needle3Value = needle3Target; - dialRun--; - } - } else { - dialRun--; - } - update(); - // Now check: if dialRun is now zero, we should - // just stop the timer since all needles have finished moving - if (!dialRun) dialTimer.stop(); -} +/** + ****************************************************************************** + * + * @file airspeedgadgetwidget.cpp + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "airspeedgadgetwidget.h" +#include +#include + +AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent) +{ + // TODO: create a proper "needle" object instead of hardcoding all this + // which is ugly (but easy). + + setMinimumSize(64,64); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + setScene(new QGraphicsScene(this)); + setRenderHints(QPainter::Antialiasing); + + m_renderer = new QSvgRenderer(); + + obj1 = NULL; + obj2 = NULL; + obj3 = NULL; + + // This timer mechanism makes needles rotate smoothly + connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles())); + dialTimer.start(20); + +} + +AirspeedGadgetWidget::~AirspeedGadgetWidget() +{ + // Do nothing +} + +/*! + \brief Connects the widget to the relevant UAVObjects + */ +void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1, + QString object2, QString nfield2, + QString object3, QString nfield3) { + if (obj1 != NULL) + disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle1(UAVObject*))); + if (obj2 != NULL) + disconnect(obj2,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle2(UAVObject*))); + if (obj3 != NULL) + disconnect(obj3,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle3(UAVObject*))); + + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager *objManager = pm->getObject(); + + // Check validity of arguments first, reject empty args and unknown fields. + if (!(object1.isEmpty() || nfield1.isEmpty())) { + obj1 = dynamic_cast( objManager->getObject(object1) ); + if (obj1 != NULL ) { + std::cout << "Connected Object 1 (" << object1.toStdString() << ")." << std::endl; + connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle1(UAVObject*))); + field1 = nfield1; + } else { + std::cout << "Error: Object is unknown (" << object1.toStdString() << ")." << std::endl; + } + } + + // And do the same for the second needle. + if (!(object2.isEmpty() || nfield2.isEmpty())) { + obj2 = dynamic_cast( objManager->getObject(object2) ); + if (obj2 != NULL ) { + std::cout << "Connected Object 2 (" << object2.toStdString() << ")." << std::endl; + connect(obj2, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle2(UAVObject*))); + field2 = nfield2; + } else { + std::cout << "Error: Object is unknown (" << object2.toStdString() << ")." << std::endl; + } + } + + // And do the same for the third needle. + if (!(object3.isEmpty() || nfield3.isEmpty())) { + obj3 = dynamic_cast( objManager->getObject(object3) ); + if (obj3 != NULL ) { + std::cout << "Connected Object 3 (" << object3.toStdString() << ")." << std::endl; + connect(obj3, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle3(UAVObject*))); + field3 = nfield3; + } else { + std::cout << "Error: Object is unknown (" << object3.toStdString() << ")." << std::endl; + } + } +} + +/*! + \brief Called by the UAVObject which got updated + */ +void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) { + // Double check that the field exists: + UAVObjectField* field = object1->getField(field1); + if (field) { + setNeedle1(field->getDouble()); + } else { + std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; + } +} + +/*! + \brief Called by the UAVObject which got updated + */ +void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) { + UAVObjectField* field = object2->getField(field2); + if (field) { + setNeedle2(field->getDouble()); + } else { + std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; + } +} + +/*! + \brief Called by the UAVObject which got updated + */ +void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) { + UAVObjectField* field = object3->getField(field3); + if (field) { + setNeedle3(field->getDouble()); + } else { + std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; + } +} + +/* + Initializes the dial file, and does all the one-time calculations for + display later. + */ +void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, + QString n3, QString n1Move, QString n2Move, QString n3Move) +{ + if (QFile::exists(dfn)) + { + m_renderer->load(dfn); + if(m_renderer->isValid()) + { + fgenabled = false; + n2enabled = false; + n3enabled = false; + QGraphicsScene *l_scene = scene(); + l_scene->clear(); // Deletes all items contained in the scene as well. + m_background = new QGraphicsSvgItem(); + // All other items will be clipped to the shape of the background + m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape| + QGraphicsItem::ItemClipsToShape); + m_foreground = new QGraphicsSvgItem(); + m_needle1 = new QGraphicsSvgItem(); + m_needle2 = new QGraphicsSvgItem(); + m_needle3 = new QGraphicsSvgItem(); + m_needle1->setParentItem(m_background); + m_needle2->setParentItem(m_background); + m_needle3->setParentItem(m_background); + m_foreground->setParentItem(m_background); + + // We assume the dial contains at least the background + // and needle1 + m_background->setSharedRenderer(m_renderer); + m_background->setElementId(bg); + l_scene->addItem(m_background); + + m_needle1->setSharedRenderer(m_renderer); + m_needle1->setElementId(n1); + l_scene->addItem(m_needle1); + + // The dial gadget allows Needle1 and Needle2 to be + // the same element, for combined movement. Needle3 + // is always independent. + if (n1 == n2) { + m_needle2 = m_needle1; + n2enabled = true; + } else { + if (m_renderer->elementExists(n2)) { + m_needle2->setSharedRenderer(m_renderer); + m_needle2->setElementId(n2); + l_scene->addItem(m_needle2); + n2enabled = true; + } + } + + if (m_renderer->elementExists(n3)) { + m_needle3->setSharedRenderer(m_renderer); + m_needle3->setElementId(n3); + l_scene->addItem(m_needle3); + n3enabled = true; + } + + if (m_renderer->elementExists(fg)) { + m_foreground->setSharedRenderer(m_renderer); + m_foreground->setElementId(fg); + l_scene->addItem(m_foreground); + fgenabled = true; + } + + rotateN1 = false; + horizN1 = false; + vertN1 = false; + rotateN2 = false; + horizN2 = false; + vertN2 = false; + rotateN3 = false; + horizN3 = false; + vertN3 = false; + + + // Now setup the rotation/translation settings: + // this is UGLY UGLY UGLY, sorry... + if (n1Move.contains("Rotate")) { + rotateN1 = true; + } else if (n1Move.contains("Horizontal")) { + horizN1 = true; + } else if (n1Move.contains("Vertical")) { + vertN1 = true; + } + + if (n2Move.contains("Rotate")) { + rotateN2 = true; + } else if (n2Move.contains("Horizontal")) { + horizN2 = true; + } else if (n2Move.contains("Vertical")) { + vertN2 = true; + } + + if (n3Move.contains("Rotate")) { + rotateN3 = true; + } else if (n3Move.contains("Horizontal")) { + horizN3 = true; + } else if (n3Move.contains("Vertical")) { + vertN3 = true; + } + + l_scene->setSceneRect(m_background->boundingRect()); + + // Now Initialize the center for all transforms of the dial needles to the + // center of the background: + // - Move the center of the needle to the center of the background. + QRectF rectB = m_background->boundingRect(); + QRectF rectN = m_needle1->boundingRect(); + m_needle1->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2); + // - Put the transform origin point of the needle at its center. + m_needle1->setTransformOriginPoint(rectN.width()/2,rectN.height()/2); + if ((n1 != n2) && n2enabled) { + // Only do it for needle1 if it is not the same as n2 + rectN = m_needle2->boundingRect(); + m_needle2->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2); + m_needle2->setTransformOriginPoint(rectN.width()/2,rectN.height()/2); + } + if (n3enabled) { + rectN = m_needle3->boundingRect(); + m_needle3->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2); + m_needle3->setTransformOriginPoint(rectN.width()/2,rectN.height()/2); + } + + // Last: we just loaded the dial file which is by default valid for a "zero" value + // of the needles, so we have to reset the needles too upon dial file loading, otherwise + // we would end up with an offset when we change a dial file and the needle value + // is not zero at that time. + needle1Target = 0; + needle2Target = 0; + needle3Target = 0; + needle1Value = 0; + needle2Value = 0; + needle3Value = 0; + + } + } + else + { std::cout<<"no file: "<isValid()) { + std::cout<<"Dial file not loaded, not rendering"< 5) { + double needle2Diff; + needle2Diff =(needle2Target - needle2Value)/5; + if (rotateN2) { + m_needle2->setRotation(m_needle2->rotation()+needle2Diff); + } else { + QPointF opd = QPointF(0,0); + if (horizN2) { + opd = QPointF(needle2Diff,0); + } + if (vertN2) { + opd = QPointF(0,needle2Diff); + } + m_needle2->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true); + // Since we have moved the needle, we need to move + // the transform origin point the opposite way + // so that it keeps rotating from the same point. + // (this is only useful if needle1 and needle2 are the + // same object, for combined movement such as attitude indicator). + QPointF oop = m_needle2->transformOriginPoint(); + m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y()); + } + needle2Value += needle2Diff; + } else { + needle2Value = needle2Target; + dialRun--; + } + } else { + dialRun--; + } + + // We assume that needle1 always exists! + if ((abs((needle1Value-needle1Target)*10) > 5)) { + double needle1Diff; + needle1Diff = (needle1Target - needle1Value)/5; + if (rotateN1) { + m_needle1->setRotation(m_needle1->rotation()+needle1Diff); + } else { + QPointF opd = QPointF(0,0); + if (horizN1) { + opd = QPointF(needle1Diff,0); + } + if (vertN1) { + opd = QPointF(0,needle1Diff); + } + m_needle1->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true); + QPointF oop = m_needle1->transformOriginPoint(); + m_needle1->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y())); + } + needle1Value += needle1Diff; + } else { // value is close enough to target, value to exact target + // to cancel out any potential drift + needle1Value = needle1Target; + dialRun--; + } + + if (n3enabled) { + if ((abs((needle3Value-needle3Target)*10) > 5)) { + double needle3Diff; + needle3Diff = (needle3Target - needle3Value)/5; + if (rotateN3) { + m_needle3->setRotation(m_needle3->rotation()+needle3Diff); + } else { + QPointF opd = QPointF(0,0); + if (horizN3) { + opd = QPointF(needle3Diff,0); + } + if (vertN3) { + opd = QPointF(0,needle3Diff); + } + m_needle3->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true); + QPointF oop = m_needle3->transformOriginPoint(); + m_needle3->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y())); + } + needle3Value += needle3Diff; + } else { + needle3Value = needle3Target; + dialRun--; + } + } else { + dialRun--; + } + update(); + // Now check: if dialRun is now zero, we should + // just stop the timer since all needles have finished moving + if (!dialRun) dialTimer.stop(); +} diff --git a/ground/src/plugins/airspeed/airspeedgadgetwidget.h b/ground/src/plugins/airspeed/airspeedgadgetwidget.h index e7a1f6e91..92f191623 100644 --- a/ground/src/plugins/airspeed/airspeedgadgetwidget.h +++ b/ground/src/plugins/airspeed/airspeedgadgetwidget.h @@ -1,138 +1,138 @@ -/** - ****************************************************************************** - * - * @file airspeedgadgetwidget.h - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 AIRSPEEDGADGETWIDGET_H_ -#define AIRSPEEDGADGETWIDGET_H_ - -#include "airspeedgadgetconfiguration.h" -#include "extensionsystem/pluginmanager.h" -#include "uavobjects/uavobjectmanager.h" -#include "uavobjects/uavobject.h" -#include -#include -#include - -#include -#include - -class AirspeedGadgetWidget : public QGraphicsView -{ - Q_OBJECT - -public: - AirspeedGadgetWidget(QWidget *parent = 0); - ~AirspeedGadgetWidget(); - void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3, - QString n1Move, QString n2Move, QString n3Move); - void paint(); - // setNeedle1 and setNeedle2 use a timer to simulate - // needle inertia - void setNeedle1(double value); - void setNeedle2(double value); - void setNeedle3(double value); - void setN1Min(double value) {n1MinValue = value;} - void setN1Max(double value) {n1MaxValue = value;} - void setN1Factor(double value) {n1Factor = value;} - void setN2Min(double value) {n2MinValue = value;} - void setN2Max(double value) {n2MaxValue = value;} - void setN2Factor(double value) {n2Factor = value;} - void setN3Min(double value) {n3MinValue = value;} - void setN3Max(double value) {n3MaxValue = value;} - void setN3Factor(double value) {n3Factor = value;} - // Sets up needle/UAVObject connections: - void connectNeedles(QString object1, QString field1, - QString object2, QString field2, - QString object3, QString field3); - -public slots: - void updateNeedle1(UAVObject *object1); // Called by the UAVObject - void updateNeedle2(UAVObject *object2); // Called by the UAVObject - void updateNeedle3(UAVObject *object3); // Called by the UAVObject - -protected: - void paintEvent(QPaintEvent *event); - void resizeEvent(QResizeEvent *event); - - -private slots: - void rotateNeedles(); - -private: - QSvgRenderer *m_renderer; - QGraphicsSvgItem *m_background; - QGraphicsSvgItem *m_foreground; - QGraphicsSvgItem *m_needle1; - QGraphicsSvgItem *m_needle2; - QGraphicsSvgItem *m_needle3; - - bool n3enabled; - bool n2enabled; // Simple flag to skip rendering if the - bool fgenabled; // layer does not exist. - - // Settings concerning move of the dials - bool rotateN1; - bool rotateN2; - bool rotateN3; - bool horizN1; - bool horizN2; - bool horizN3; - bool vertN1; - bool vertN2; - bool vertN3; - - double n1MinValue; - double n1MaxValue; - double n1Factor; - double n2MinValue; - double n2MaxValue; - double n2Factor; - double n3MinValue; - double n3MaxValue; - double n3Factor; - - // The Value and target variables - // are expressed in degrees - double needle1Target; - double needle1Value; - double needle2Target; - double needle2Value; - double needle3Target; - double needle3Value; - - // Name of the fields to read when an update is received: - UAVDataObject* obj1; - UAVDataObject* obj2; - UAVDataObject* obj3; - QString field1; - QString field2; - QString field3; - - // Rotation timer - QTimer dialTimer; - -}; -#endif /* AIRSPEEDGADGETWIDGET_H_ */ +/** + ****************************************************************************** + * + * @file airspeedgadgetwidget.h + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 AIRSPEEDGADGETWIDGET_H_ +#define AIRSPEEDGADGETWIDGET_H_ + +#include "airspeedgadgetconfiguration.h" +#include "extensionsystem/pluginmanager.h" +#include "uavobjects/uavobjectmanager.h" +#include "uavobjects/uavobject.h" +#include +#include +#include + +#include +#include + +class AirspeedGadgetWidget : public QGraphicsView +{ + Q_OBJECT + +public: + AirspeedGadgetWidget(QWidget *parent = 0); + ~AirspeedGadgetWidget(); + void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3, + QString n1Move, QString n2Move, QString n3Move); + void paint(); + // setNeedle1 and setNeedle2 use a timer to simulate + // needle inertia + void setNeedle1(double value); + void setNeedle2(double value); + void setNeedle3(double value); + void setN1Min(double value) {n1MinValue = value;} + void setN1Max(double value) {n1MaxValue = value;} + void setN1Factor(double value) {n1Factor = value;} + void setN2Min(double value) {n2MinValue = value;} + void setN2Max(double value) {n2MaxValue = value;} + void setN2Factor(double value) {n2Factor = value;} + void setN3Min(double value) {n3MinValue = value;} + void setN3Max(double value) {n3MaxValue = value;} + void setN3Factor(double value) {n3Factor = value;} + // Sets up needle/UAVObject connections: + void connectNeedles(QString object1, QString field1, + QString object2, QString field2, + QString object3, QString field3); + +public slots: + void updateNeedle1(UAVObject *object1); // Called by the UAVObject + void updateNeedle2(UAVObject *object2); // Called by the UAVObject + void updateNeedle3(UAVObject *object3); // Called by the UAVObject + +protected: + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + + +private slots: + void rotateNeedles(); + +private: + QSvgRenderer *m_renderer; + QGraphicsSvgItem *m_background; + QGraphicsSvgItem *m_foreground; + QGraphicsSvgItem *m_needle1; + QGraphicsSvgItem *m_needle2; + QGraphicsSvgItem *m_needle3; + + bool n3enabled; + bool n2enabled; // Simple flag to skip rendering if the + bool fgenabled; // layer does not exist. + + // Settings concerning move of the dials + bool rotateN1; + bool rotateN2; + bool rotateN3; + bool horizN1; + bool horizN2; + bool horizN3; + bool vertN1; + bool vertN2; + bool vertN3; + + double n1MinValue; + double n1MaxValue; + double n1Factor; + double n2MinValue; + double n2MaxValue; + double n2Factor; + double n3MinValue; + double n3MaxValue; + double n3Factor; + + // The Value and target variables + // are expressed in degrees + double needle1Target; + double needle1Value; + double needle2Target; + double needle2Value; + double needle3Target; + double needle3Value; + + // Name of the fields to read when an update is received: + UAVDataObject* obj1; + UAVDataObject* obj2; + UAVDataObject* obj3; + QString field1; + QString field2; + QString field3; + + // Rotation timer + QTimer dialTimer; + +}; +#endif /* AIRSPEEDGADGETWIDGET_H_ */ diff --git a/ground/src/plugins/airspeed/airspeedplugin.cpp b/ground/src/plugins/airspeed/airspeedplugin.cpp index cdcb6da11..d65689da2 100644 --- a/ground/src/plugins/airspeed/airspeedplugin.cpp +++ b/ground/src/plugins/airspeed/airspeedplugin.cpp @@ -1,66 +1,66 @@ -/** - ****************************************************************************** - * - * @file airspeedplugin.h - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 "airspeedplugin.h" -#include "airspeedgadgetfactory.h" -#include -#include -#include -#include - - -AirspeedPlugin::AirspeedPlugin() -{ - // Do nothing -} - -AirspeedPlugin::~AirspeedPlugin() -{ - // Do nothing -} - -bool AirspeedPlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mf = new AirspeedGadgetFactory(this); - addAutoReleasedObject(mf); - - return true; -} - -void AirspeedPlugin::extensionsInitialized() -{ - // Do nothing -} - -void AirspeedPlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(AirspeedPlugin) - +/** + ****************************************************************************** + * + * @file airspeedplugin.h + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "airspeedplugin.h" +#include "airspeedgadgetfactory.h" +#include +#include +#include +#include + + +AirspeedPlugin::AirspeedPlugin() +{ + // Do nothing +} + +AirspeedPlugin::~AirspeedPlugin() +{ + // Do nothing +} + +bool AirspeedPlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mf = new AirspeedGadgetFactory(this); + addAutoReleasedObject(mf); + + return true; +} + +void AirspeedPlugin::extensionsInitialized() +{ + // Do nothing +} + +void AirspeedPlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(AirspeedPlugin) + diff --git a/ground/src/plugins/airspeed/airspeedplugin.h b/ground/src/plugins/airspeed/airspeedplugin.h index 0eab9f133..e94060604 100644 --- a/ground/src/plugins/airspeed/airspeedplugin.h +++ b/ground/src/plugins/airspeed/airspeedplugin.h @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file airspeedplugin.h - * @author David "Buzz" Carlson Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup airspeed - * @{ - * - *****************************************************************************/ -/* - * 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 AIRSPEEDPLUGIN_H_ -#define AIRSPEEDPLUGIN_H_ - -#include - -class AirspeedGadgetFactory; - -class AirspeedPlugin : public ExtensionSystem::IPlugin -{ -public: - AirspeedPlugin(); - ~AirspeedPlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - AirspeedGadgetFactory *mf; -}; -#endif /* AIRSPEEDPLUGIN_H_ */ +/** + ****************************************************************************** + * + * @file airspeedplugin.h + * @author David "Buzz" Carlson Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup dialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 AIRSPEEDPLUGIN_H_ +#define AIRSPEEDPLUGIN_H_ + +#include + +class AirspeedGadgetFactory; + +class AirspeedPlugin : public ExtensionSystem::IPlugin +{ +public: + AirspeedPlugin(); + ~AirspeedPlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +private: + AirspeedGadgetFactory *mf; +}; +#endif /* AIRSPEEDPLUGIN_H_ */ diff --git a/ground/src/plugins/config/configfactory.h b/ground/src/plugins/config/configfactory.h index 0fa16f285..3b1d80b5f 100644 --- a/ground/src/plugins/config/configfactory.h +++ b/ground/src/plugins/config/configfactory.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup map + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadget.cpp b/ground/src/plugins/config/configgadget.cpp index d8943336d..199d5c3f4 100644 --- a/ground/src/plugins/config/configgadget.cpp +++ b/ground/src/plugins/config/configgadget.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup map + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadget.h b/ground/src/plugins/config/configgadget.h index f50e86630..eaca34c96 100644 --- a/ground/src/plugins/config/configgadget.h +++ b/ground/src/plugins/config/configgadget.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetconfiguration.cpp b/ground/src/plugins/config/configgadgetconfiguration.cpp index 2c9ea7a53..f91a130a8 100644 --- a/ground/src/plugins/config/configgadgetconfiguration.cpp +++ b/ground/src/plugins/config/configgadgetconfiguration.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetconfiguration.h b/ground/src/plugins/config/configgadgetconfiguration.h index ef5c04bc6..acc50a107 100644 --- a/ground/src/plugins/config/configgadgetconfiguration.h +++ b/ground/src/plugins/config/configgadgetconfiguration.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetfactory.cpp b/ground/src/plugins/config/configgadgetfactory.cpp index 088033711..3a9d00339 100644 --- a/ground/src/plugins/config/configgadgetfactory.cpp +++ b/ground/src/plugins/config/configgadgetfactory.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetfactory.h b/ground/src/plugins/config/configgadgetfactory.h index 0b3dd906a..d41a7e992 100644 --- a/ground/src/plugins/config/configgadgetfactory.h +++ b/ground/src/plugins/config/configgadgetfactory.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup map + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetoptionspage.cpp b/ground/src/plugins/config/configgadgetoptionspage.cpp index de8cb2d1a..cf004dd81 100644 --- a/ground/src/plugins/config/configgadgetoptionspage.cpp +++ b/ground/src/plugins/config/configgadgetoptionspage.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetoptionspage.h b/ground/src/plugins/config/configgadgetoptionspage.h index f891f57b0..98f11b65a 100644 --- a/ground/src/plugins/config/configgadgetoptionspage.h +++ b/ground/src/plugins/config/configgadgetoptionspage.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetwidget.cpp b/ground/src/plugins/config/configgadgetwidget.cpp index e06c9d2da..425a5539c 100644 --- a/ground/src/plugins/config/configgadgetwidget.cpp +++ b/ground/src/plugins/config/configgadgetwidget.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configgadgetwidget.h b/ground/src/plugins/config/configgadgetwidget.h index 97fac6264..f0568f45b 100644 --- a/ground/src/plugins/config/configgadgetwidget.h +++ b/ground/src/plugins/config/configgadgetwidget.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configplugin.cpp b/ground/src/plugins/config/configplugin.cpp index bc9ef96a9..71f9a5acd 100644 --- a/ground/src/plugins/config/configplugin.cpp +++ b/ground/src/plugins/config/configplugin.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/configplugin.h b/ground/src/plugins/config/configplugin.h index 0d0a75305..52dfae933 100644 --- a/ground/src/plugins/config/configplugin.h +++ b/ground/src/plugins/config/configplugin.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup config + * @defgroup configplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/config/ui_configgadget.h b/ground/src/plugins/config/ui_configgadget.h deleted file mode 100644 index a5ec6e8b6..000000000 --- a/ground/src/plugins/config/ui_configgadget.h +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'configgadget.ui' -** -** Created: Wed 19. May 23:01:40 2010 -** by: Qt User Interface Compiler version 4.6.2 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_CONFIGGADGET_H -#define UI_CONFIGGADGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Ui_ConfigGadget -{ -public: - QWidget *horizontalLayoutWidget; - QHBoxLayout *horizontalLayout; - QSpacerItem *horizontalSpacer; - QPushButton *sendButtun; - QTreeView *treeView; - QFrame *frame; - - void setupUi(QWidget *ConfigGadget) - { - if (ConfigGadget->objectName().isEmpty()) - ConfigGadget->setObjectName(QString::fromUtf8("ConfigGadget")); - ConfigGadget->resize(500, 400); - horizontalLayoutWidget = new QWidget(ConfigGadget); - horizontalLayoutWidget->setObjectName(QString::fromUtf8("horizontalLayoutWidget")); - horizontalLayoutWidget->setGeometry(QRect(10, 350, 481, 41)); - horizontalLayout = new QHBoxLayout(horizontalLayoutWidget); - horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); - horizontalLayout->setSizeConstraint(QLayout::SetMinimumSize); - horizontalLayout->setContentsMargins(0, 0, 0, 0); - horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - horizontalLayout->addItem(horizontalSpacer); - - sendButtun = new QPushButton(horizontalLayoutWidget); - sendButtun->setObjectName(QString::fromUtf8("sendButtun")); - - horizontalLayout->addWidget(sendButtun); - - treeView = new QTreeView(ConfigGadget); - treeView->setObjectName(QString::fromUtf8("treeView")); - treeView->setGeometry(QRect(10, 10, 221, 331)); - QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(treeView->sizePolicy().hasHeightForWidth()); - treeView->setSizePolicy(sizePolicy); - frame = new QFrame(ConfigGadget); - frame->setObjectName(QString::fromUtf8("frame")); - frame->setGeometry(QRect(240, 10, 251, 331)); - QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(frame->sizePolicy().hasHeightForWidth()); - frame->setSizePolicy(sizePolicy1); - frame->setFrameShape(QFrame::StyledPanel); - frame->setFrameShadow(QFrame::Raised); - - retranslateUi(ConfigGadget); - - QMetaObject::connectSlotsByName(ConfigGadget); - } // setupUi - - void retranslateUi(QWidget *ConfigGadget) - { - ConfigGadget->setWindowTitle(QApplication::translate("ConfigGadget", "Form", 0, QApplication::UnicodeUTF8)); - sendButtun->setText(QApplication::translate("ConfigGadget", "Send", 0, QApplication::UnicodeUTF8)); - } // retranslateUi - -}; - -namespace Ui { - class ConfigGadget: public Ui_ConfigGadget {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_CONFIGGADGET_H diff --git a/ground/src/plugins/config/ui_configgadgetwidget.h b/ground/src/plugins/config/ui_configgadgetwidget.h deleted file mode 100644 index 3307f844d..000000000 --- a/ground/src/plugins/config/ui_configgadgetwidget.h +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'configgadgetwidget.ui' -** -** Created: Tue 18. May 19:44:42 2010 -** by: Qt User Interface Compiler version 4.6.2 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_CONFIGGADGETWIDGET_H -#define UI_CONFIGGADGETWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Ui_ConfigGadgetWidget -{ -public: - QWidget *horizontalLayoutWidget; - QHBoxLayout *horizontalLayout; - QSpacerItem *horizontalSpacer; - QPushButton *sendButtun; - QTreeView *treeView; - QFrame *frame; - - void setupUi(QWidget *ConfigGadgetWidget) - { - if (ConfigGadgetWidget->objectName().isEmpty()) - ConfigGadgetWidget->setObjectName(QString::fromUtf8("ConfigGadgetWidget")); - ConfigGadgetWidget->resize(500, 400); - horizontalLayoutWidget = new QWidget(ConfigGadgetWidget); - horizontalLayoutWidget->setObjectName(QString::fromUtf8("horizontalLayoutWidget")); - horizontalLayoutWidget->setGeometry(QRect(10, 350, 481, 41)); - horizontalLayout = new QHBoxLayout(horizontalLayoutWidget); - horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); - horizontalLayout->setSizeConstraint(QLayout::SetMinimumSize); - horizontalLayout->setContentsMargins(0, 0, 0, 0); - horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - horizontalLayout->addItem(horizontalSpacer); - - sendButtun = new QPushButton(horizontalLayoutWidget); - sendButtun->setObjectName(QString::fromUtf8("sendButtun")); - - horizontalLayout->addWidget(sendButtun); - - treeView = new QTreeView(ConfigGadgetWidget); - treeView->setObjectName(QString::fromUtf8("treeView")); - treeView->setGeometry(QRect(10, 10, 221, 331)); - QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(treeView->sizePolicy().hasHeightForWidth()); - treeView->setSizePolicy(sizePolicy); - frame = new QFrame(ConfigGadgetWidget); - frame->setObjectName(QString::fromUtf8("frame")); - frame->setGeometry(QRect(240, 10, 251, 331)); - QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(frame->sizePolicy().hasHeightForWidth()); - frame->setSizePolicy(sizePolicy1); - frame->setFrameShape(QFrame::StyledPanel); - frame->setFrameShadow(QFrame::Raised); - - retranslateUi(ConfigGadgetWidget); - - QMetaObject::connectSlotsByName(ConfigGadgetWidget); - } // setupUi - - void retranslateUi(QWidget *ConfigGadgetWidget) - { - ConfigGadgetWidget->setWindowTitle(QApplication::translate("ConfigGadgetWidget", "Form", 0, QApplication::UnicodeUTF8)); - sendButtun->setText(QApplication::translate("ConfigGadgetWidget", "Send", 0, QApplication::UnicodeUTF8)); - } // retranslateUi - -}; - -namespace Ui { - class ConfigGadgetWidget: public Ui_ConfigGadgetWidget {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_CONFIGGADGETWIDGET_H diff --git a/ground/src/plugins/consolegadget/consolegadget.cpp b/ground/src/plugins/consolegadget/consolegadget.cpp index 84c1a2c61..9a7534115 100644 --- a/ground/src/plugins/consolegadget/consolegadget.cpp +++ b/ground/src/plugins/consolegadget/consolegadget.cpp @@ -1,51 +1,51 @@ -/** - ****************************************************************************** - * - * @file consolegadget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 "consolegadget.h" -#include "consolegadgetwidget.h" -#include "texteditloggerengine.h" - -ConsoleGadget::ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget) -{ - m_logger = new TextEditLoggerEngine(widget); - bool suitableName = false; - int i = 0; - QString loggerName; - while (!suitableName) { - loggerName = "TextEditLogger" + QVariant(i).toString(); - if (!qxtLog->isLoggerEngine(loggerName)) - suitableName = true; - ++i; - } - qxtLog->addLoggerEngine(loggerName, m_logger); -} - -ConsoleGadget::~ConsoleGadget() -{ - qxtLog->removeLoggerEngine(m_logger); -} +/** + ****************************************************************************** + * + * @file consolegadget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "consolegadget.h" +#include "consolegadgetwidget.h" +#include "texteditloggerengine.h" + +ConsoleGadget::ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget) +{ + m_logger = new TextEditLoggerEngine(widget); + bool suitableName = false; + int i = 0; + QString loggerName; + while (!suitableName) { + loggerName = "TextEditLogger" + QVariant(i).toString(); + if (!qxtLog->isLoggerEngine(loggerName)) + suitableName = true; + ++i; + } + qxtLog->addLoggerEngine(loggerName, m_logger); +} + +ConsoleGadget::~ConsoleGadget() +{ + qxtLog->removeLoggerEngine(m_logger); +} diff --git a/ground/src/plugins/consolegadget/consolegadget.h b/ground/src/plugins/consolegadget/consolegadget.h index 870ae629e..3f7abd2b0 100644 --- a/ground/src/plugins/consolegadget/consolegadget.h +++ b/ground/src/plugins/consolegadget/consolegadget.h @@ -1,59 +1,59 @@ -/** - ****************************************************************************** - * - * @file consolegadget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 CONSOLEGADGET_H_ -#define CONSOLEGADGET_H_ - -#include - -namespace Core { -class IUAVGadget; -} -class ConsoleGadgetWidget; -class TextEditLoggerEngine; - -using namespace Core; - -class ConsoleGadget : public Core::IUAVGadget -{ - Q_OBJECT -public: - ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent = 0); - ~ConsoleGadget(); - - QList context() const { return m_context; } - QWidget *widget() { return m_widget; } - QString contextHelpId() const { return QString(); } - -private: - QWidget *m_widget; - QList m_context; - TextEditLoggerEngine *m_logger; -}; - - -#endif // CONSOLEGADGET_H_ +/** + ****************************************************************************** + * + * @file consolegadget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 CONSOLEGADGET_H_ +#define CONSOLEGADGET_H_ + +#include + +namespace Core { +class IUAVGadget; +} +class ConsoleGadgetWidget; +class TextEditLoggerEngine; + +using namespace Core; + +class ConsoleGadget : public Core::IUAVGadget +{ + Q_OBJECT +public: + ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent = 0); + ~ConsoleGadget(); + + QList context() const { return m_context; } + QWidget *widget() { return m_widget; } + QString contextHelpId() const { return QString(); } + +private: + QWidget *m_widget; + QList m_context; + TextEditLoggerEngine *m_logger; +}; + + +#endif // CONSOLEGADGET_H_ diff --git a/ground/src/plugins/consolegadget/consolegadgetfactory.cpp b/ground/src/plugins/consolegadget/consolegadgetfactory.cpp index 0c22cd32e..16971f40b 100644 --- a/ground/src/plugins/consolegadget/consolegadgetfactory.cpp +++ b/ground/src/plugins/consolegadget/consolegadgetfactory.cpp @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file consolegadgetfactory.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 "consolegadgetfactory.h" -#include "consolegadgetwidget.h" -#include "consolegadget.h" -#include - -ConsoleGadgetFactory::ConsoleGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("ConsoleGadget"), - tr("Console"), - parent) -{ -} - -ConsoleGadgetFactory::~ConsoleGadgetFactory() -{ - -} - -IUAVGadget* ConsoleGadgetFactory::createGadget(QWidget *parent) { - ConsoleGadgetWidget* gadgetWidget = new ConsoleGadgetWidget(parent); - return new ConsoleGadget(QString("ConsoleGadget"), gadgetWidget, parent); -} +/** + ****************************************************************************** + * + * @file consolegadgetfactory.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "consolegadgetfactory.h" +#include "consolegadgetwidget.h" +#include "consolegadget.h" +#include + +ConsoleGadgetFactory::ConsoleGadgetFactory(QObject *parent) : + IUAVGadgetFactory(QString("ConsoleGadget"), + tr("Console"), + parent) +{ +} + +ConsoleGadgetFactory::~ConsoleGadgetFactory() +{ + +} + +IUAVGadget* ConsoleGadgetFactory::createGadget(QWidget *parent) { + ConsoleGadgetWidget* gadgetWidget = new ConsoleGadgetWidget(parent); + return new ConsoleGadget(QString("ConsoleGadget"), gadgetWidget, parent); +} diff --git a/ground/src/plugins/consolegadget/consolegadgetfactory.h b/ground/src/plugins/consolegadget/consolegadgetfactory.h index f61463ee0..de27a9d09 100644 --- a/ground/src/plugins/consolegadget/consolegadgetfactory.h +++ b/ground/src/plugins/consolegadget/consolegadgetfactory.h @@ -1,50 +1,50 @@ -/** - ****************************************************************************** - * - * @file consolegadgetfactory.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 CONSOLEGADGETFACTORY_H_ -#define CONSOLEGADGETFACTORY_H_ - -#include - -namespace Core { -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class ConsoleGadgetFactory : public IUAVGadgetFactory -{ - Q_OBJECT -public: - ConsoleGadgetFactory(QObject *parent = 0); - ~ConsoleGadgetFactory(); - - IUAVGadget *createGadget(QWidget *parent); -}; - -#endif // CONSOLEGADGETFACTORY_H_ +/** + ****************************************************************************** + * + * @file consolegadgetfactory.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 CONSOLEGADGETFACTORY_H_ +#define CONSOLEGADGETFACTORY_H_ + +#include + +namespace Core { +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class ConsoleGadgetFactory : public IUAVGadgetFactory +{ + Q_OBJECT +public: + ConsoleGadgetFactory(QObject *parent = 0); + ~ConsoleGadgetFactory(); + + IUAVGadget *createGadget(QWidget *parent); +}; + +#endif // CONSOLEGADGETFACTORY_H_ diff --git a/ground/src/plugins/consolegadget/consolegadgetwidget.cpp b/ground/src/plugins/consolegadget/consolegadgetwidget.cpp index 5d0b7c958..7287b65ac 100644 --- a/ground/src/plugins/consolegadget/consolegadgetwidget.cpp +++ b/ground/src/plugins/consolegadget/consolegadgetwidget.cpp @@ -1,44 +1,44 @@ -/** - ****************************************************************************** - * - * @file consolegadgetwidget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 "consolegadgetwidget.h" -#include "qxtlogger.h" - -#include -#include - -ConsoleGadgetWidget::ConsoleGadgetWidget(QWidget *parent) : QTextEdit(parent) -{ - setMinimumSize(64,64); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - setReadOnly(true); -} - -ConsoleGadgetWidget::~ConsoleGadgetWidget() -{ - // Do nothing -} - +/** + ****************************************************************************** + * + * @file consolegadgetwidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "consolegadgetwidget.h" +#include "qxtlogger.h" + +#include +#include + +ConsoleGadgetWidget::ConsoleGadgetWidget(QWidget *parent) : QTextEdit(parent) +{ + setMinimumSize(64,64); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + setReadOnly(true); +} + +ConsoleGadgetWidget::~ConsoleGadgetWidget() +{ + // Do nothing +} + diff --git a/ground/src/plugins/consolegadget/consolegadgetwidget.h b/ground/src/plugins/consolegadget/consolegadgetwidget.h index 252e640e8..d24d938ad 100644 --- a/ground/src/plugins/consolegadget/consolegadgetwidget.h +++ b/ground/src/plugins/consolegadget/consolegadgetwidget.h @@ -1,44 +1,44 @@ -/** - ****************************************************************************** - * - * @file consolegadgetwidget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 CONSOLEGADGETWIDGET_H_ -#define CONSOLEGADGETWIDGET_H_ - -#include - -class ConsoleGadgetWidget : public QTextEdit -{ - Q_OBJECT - -public: - ConsoleGadgetWidget(QWidget *parent = 0); - ~ConsoleGadgetWidget(); - -private: -}; - -#endif /* CONSOLEGADGETWIDGET_H_ */ +/** + ****************************************************************************** + * + * @file consolegadgetwidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 CONSOLEGADGETWIDGET_H_ +#define CONSOLEGADGETWIDGET_H_ + +#include + +class ConsoleGadgetWidget : public QTextEdit +{ + Q_OBJECT + +public: + ConsoleGadgetWidget(QWidget *parent = 0); + ~ConsoleGadgetWidget(); + +private: +}; + +#endif /* CONSOLEGADGETWIDGET_H_ */ diff --git a/ground/src/plugins/consolegadget/consoleplugin.cpp b/ground/src/plugins/consolegadget/consoleplugin.cpp index da62426ec..af6e87c39 100644 --- a/ground/src/plugins/consolegadget/consoleplugin.cpp +++ b/ground/src/plugins/consolegadget/consoleplugin.cpp @@ -1,65 +1,65 @@ -/** - ****************************************************************************** - * - * @file consoleplugin.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 "consoleplugin.h" -#include "consolegadgetfactory.h" -#include -#include -#include -#include - - -ConsolePlugin::ConsolePlugin() -{ - // Do nothing -} - -ConsolePlugin::~ConsolePlugin() -{ - // Do nothing -} - -bool ConsolePlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mf = new ConsoleGadgetFactory(this); - addAutoReleasedObject(mf); - - return true; -} - -void ConsolePlugin::extensionsInitialized() -{ - // Do nothing -} - -void ConsolePlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(ConsolePlugin) - +/** + ****************************************************************************** + * + * @file consoleplugin.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "consoleplugin.h" +#include "consolegadgetfactory.h" +#include +#include +#include +#include + + +ConsolePlugin::ConsolePlugin() +{ + // Do nothing +} + +ConsolePlugin::~ConsolePlugin() +{ + // Do nothing +} + +bool ConsolePlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mf = new ConsoleGadgetFactory(this); + addAutoReleasedObject(mf); + + return true; +} + +void ConsolePlugin::extensionsInitialized() +{ + // Do nothing +} + +void ConsolePlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(ConsolePlugin) + diff --git a/ground/src/plugins/consolegadget/consoleplugin.h b/ground/src/plugins/consolegadget/consoleplugin.h index 08100b3c9..2d415949b 100644 --- a/ground/src/plugins/consolegadget/consoleplugin.h +++ b/ground/src/plugins/consolegadget/consoleplugin.h @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file consoleplugin.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 CONSOLEPLUGIN_H_ -#define CONSOLEPLUGIN_H_ - -#include - -class ConsoleGadgetFactory; - -class ConsolePlugin : public ExtensionSystem::IPlugin -{ -public: - ConsolePlugin(); - ~ConsolePlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - ConsoleGadgetFactory *mf; -}; -#endif /* CONSOLEPLUGIN_H_ */ +/** + ****************************************************************************** + * + * @file consoleplugin.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 CONSOLEPLUGIN_H_ +#define CONSOLEPLUGIN_H_ + +#include + +class ConsoleGadgetFactory; + +class ConsolePlugin : public ExtensionSystem::IPlugin +{ +public: + ConsolePlugin(); + ~ConsolePlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +private: + ConsoleGadgetFactory *mf; +}; +#endif /* CONSOLEPLUGIN_H_ */ diff --git a/ground/src/plugins/consolegadget/texteditloggerengine.cpp b/ground/src/plugins/consolegadget/texteditloggerengine.cpp index 273f02b0b..9da5176cb 100644 --- a/ground/src/plugins/consolegadget/texteditloggerengine.cpp +++ b/ground/src/plugins/consolegadget/texteditloggerengine.cpp @@ -1,135 +1,135 @@ -/** - ****************************************************************************** - * - * @file texteditloggerengine.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Qxt Foundation http://www.libqxt.org Copyright (C) - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 "texteditloggerengine.h" -#include -#include -#include -#include - -#define QXT_REQUIRED_LEVELS (QxtLogger::WarningLevel | QxtLogger::ErrorLevel | QxtLogger::CriticalLevel | QxtLogger::FatalLevel) - -TextEditLoggerEngine::TextEditLoggerEngine(QTextEdit *textEdit) : m_textEdit(textEdit) -{ -#ifndef QT_NO_DEBUG - setLogLevelsEnabled(QXT_REQUIRED_LEVELS); -#else - setLogLevelsEnabled(QXT_REQUIRED_LEVELS | QxtLogger::DebugLevel); -#endif - enableLogging(); -} - -TextEditLoggerEngine::~TextEditLoggerEngine() -{ -} - -void TextEditLoggerEngine::initLoggerEngine() -{ - return; // Should work out of the box! -} - -void TextEditLoggerEngine::killLoggerEngine() -{ - return; // I do nothing. -} - -bool TextEditLoggerEngine::isInitialized() const -{ - return true; -} - -void TextEditLoggerEngine::setLogLevelEnabled(QxtLogger::LogLevels level, bool enable) -{ - QxtLoggerEngine::setLogLevelsEnabled(level | QXT_REQUIRED_LEVELS, enable); - if (!enable) QxtLoggerEngine::setLogLevelsEnabled(QXT_REQUIRED_LEVELS); -} - -void TextEditLoggerEngine::writeFormatted(QxtLogger::LogLevel level, const QList &msgs) -{ - switch (level) - { - case QxtLogger::ErrorLevel: - writeToTextEdit("Error", msgs, Qt::red); - break; - case QxtLogger::WarningLevel: - writeToTextEdit("Warning", msgs, Qt::red); - break; - case QxtLogger::CriticalLevel: - writeToTextEdit("Critical", msgs, Qt::red); - break; - case QxtLogger::FatalLevel: - writeToTextEdit("!!FATAL!!", msgs, Qt::red); - break; - case QxtLogger::TraceLevel: - writeToTextEdit("Trace", msgs, Qt::blue); - break; - case QxtLogger::DebugLevel: - writeToTextEdit("DEBUG", msgs, Qt::blue); - break; - case QxtLogger::InfoLevel: - writeToTextEdit("INFO", msgs); - break; - default: - writeToTextEdit("", msgs); - break; - } -} - -void TextEditLoggerEngine::writeToTextEdit(const QString& level, const QList &msgs, QColor color) -{ - /* Message format... - [time] [error level] First message..... - second message - third message - */ - if (msgs.isEmpty()) - return; - QScrollBar *sb = m_textEdit->verticalScrollBar(); - bool scroll = sb->value() == sb->maximum(); - QString header = '[' + QTime::currentTime().toString("hh:mm:ss.zzz") + "] [" + level + "] "; - QString padding; - QString appendText; - appendText.append(header); - for (int i = 0; i < header.size(); i++) padding.append(' '); - int count = 0; - Q_FOREACH(const QVariant& out, msgs) - { - if (!out.isNull()) - { - if (count != 0) - appendText.append(padding); - appendText.append(out.toString()); - } - count++; - } - Q_ASSERT(m_textEdit); - appendText = QString("%2").arg(color.name()).arg(appendText); - m_textEdit->append(appendText); - if (scroll) - sb->setValue(sb->maximum()); -} +/** + ****************************************************************************** + * + * @file texteditloggerengine.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * Parts by Qxt Foundation http://www.libqxt.org Copyright (C) + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "texteditloggerengine.h" +#include +#include +#include +#include + +#define QXT_REQUIRED_LEVELS (QxtLogger::WarningLevel | QxtLogger::ErrorLevel | QxtLogger::CriticalLevel | QxtLogger::FatalLevel) + +TextEditLoggerEngine::TextEditLoggerEngine(QTextEdit *textEdit) : m_textEdit(textEdit) +{ +#ifndef QT_NO_DEBUG + setLogLevelsEnabled(QXT_REQUIRED_LEVELS); +#else + setLogLevelsEnabled(QXT_REQUIRED_LEVELS | QxtLogger::DebugLevel); +#endif + enableLogging(); +} + +TextEditLoggerEngine::~TextEditLoggerEngine() +{ +} + +void TextEditLoggerEngine::initLoggerEngine() +{ + return; // Should work out of the box! +} + +void TextEditLoggerEngine::killLoggerEngine() +{ + return; // I do nothing. +} + +bool TextEditLoggerEngine::isInitialized() const +{ + return true; +} + +void TextEditLoggerEngine::setLogLevelEnabled(QxtLogger::LogLevels level, bool enable) +{ + QxtLoggerEngine::setLogLevelsEnabled(level | QXT_REQUIRED_LEVELS, enable); + if (!enable) QxtLoggerEngine::setLogLevelsEnabled(QXT_REQUIRED_LEVELS); +} + +void TextEditLoggerEngine::writeFormatted(QxtLogger::LogLevel level, const QList &msgs) +{ + switch (level) + { + case QxtLogger::ErrorLevel: + writeToTextEdit("Error", msgs, Qt::red); + break; + case QxtLogger::WarningLevel: + writeToTextEdit("Warning", msgs, Qt::red); + break; + case QxtLogger::CriticalLevel: + writeToTextEdit("Critical", msgs, Qt::red); + break; + case QxtLogger::FatalLevel: + writeToTextEdit("!!FATAL!!", msgs, Qt::red); + break; + case QxtLogger::TraceLevel: + writeToTextEdit("Trace", msgs, Qt::blue); + break; + case QxtLogger::DebugLevel: + writeToTextEdit("DEBUG", msgs, Qt::blue); + break; + case QxtLogger::InfoLevel: + writeToTextEdit("INFO", msgs); + break; + default: + writeToTextEdit("", msgs); + break; + } +} + +void TextEditLoggerEngine::writeToTextEdit(const QString& level, const QList &msgs, QColor color) +{ + /* Message format... + [time] [error level] First message..... + second message + third message + */ + if (msgs.isEmpty()) + return; + QScrollBar *sb = m_textEdit->verticalScrollBar(); + bool scroll = sb->value() == sb->maximum(); + QString header = '[' + QTime::currentTime().toString("hh:mm:ss.zzz") + "] [" + level + "] "; + QString padding; + QString appendText; + appendText.append(header); + for (int i = 0; i < header.size(); i++) padding.append(' '); + int count = 0; + Q_FOREACH(const QVariant& out, msgs) + { + if (!out.isNull()) + { + if (count != 0) + appendText.append(padding); + appendText.append(out.toString()); + } + count++; + } + Q_ASSERT(m_textEdit); + appendText = QString("%2").arg(color.name()).arg(appendText); + m_textEdit->append(appendText); + if (scroll) + sb->setValue(sb->maximum()); +} diff --git a/ground/src/plugins/consolegadget/texteditloggerengine.h b/ground/src/plugins/consolegadget/texteditloggerengine.h index 2ba40bf83..efab81f8f 100644 --- a/ground/src/plugins/consolegadget/texteditloggerengine.h +++ b/ground/src/plugins/consolegadget/texteditloggerengine.h @@ -1,57 +1,57 @@ -/** - ****************************************************************************** - * - * @file texteditloggerengine.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Qxt Foundation http://www.libqxt.org Copyright (C) - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup consolegadget - * @{ - * - *****************************************************************************/ -/* - * 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 TEXTEDITLOGGERENGINE_H -#define TEXTEDITLOGGERENGINE_H - - -#include "qxtloggerengine.h" -#include "qxtglobal.h" -#include -class QTextEdit; - -class TextEditLoggerEngine : public QxtLoggerEngine -{ - -public: - TextEditLoggerEngine(QTextEdit *textEdit); - ~TextEditLoggerEngine(); - - void initLoggerEngine(); - void killLoggerEngine(); - void writeFormatted(QxtLogger::LogLevel level, const QList &messages); - void setLogLevelEnabled(QxtLogger::LogLevels level, bool enable = true); - - bool isInitialized() const; - -private: - virtual void writeToTextEdit(const QString& str_level, const QList &msgs, QColor color = QColor(0,0,0)); - QTextEdit *m_textEdit; -}; - -#endif // TEXTEDITLOGGERENGINE_H +/** + ****************************************************************************** + * + * @file texteditloggerengine.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * Parts by Qxt Foundation http://www.libqxt.org Copyright (C) + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup consoleplugin + * @{ + * + *****************************************************************************/ +/* + * 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 TEXTEDITLOGGERENGINE_H +#define TEXTEDITLOGGERENGINE_H + + +#include "qxtloggerengine.h" +#include "qxtglobal.h" +#include +class QTextEdit; + +class TextEditLoggerEngine : public QxtLoggerEngine +{ + +public: + TextEditLoggerEngine(QTextEdit *textEdit); + ~TextEditLoggerEngine(); + + void initLoggerEngine(); + void killLoggerEngine(); + void writeFormatted(QxtLogger::LogLevel level, const QList &messages); + void setLogLevelEnabled(QxtLogger::LogLevels level, bool enable = true); + + bool isInitialized() const; + +private: + virtual void writeToTextEdit(const QString& str_level, const QList &msgs, QColor color = QColor(0,0,0)); + QTextEdit *m_textEdit; +}; + +#endif // TEXTEDITLOGGERENGINE_H diff --git a/ground/src/plugins/emptygadget/emptygadget.cpp b/ground/src/plugins/emptygadget/emptygadget.cpp index 7278024bc..ea6c44dad 100644 --- a/ground/src/plugins/emptygadget/emptygadget.cpp +++ b/ground/src/plugins/emptygadget/emptygadget.cpp @@ -1,39 +1,39 @@ -/** - ****************************************************************************** - * - * @file emptygadget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 "emptygadget.h" -#include "emptygadgetwidget.h" - -EmptyGadget::EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget) -{ -} - -EmptyGadget::~EmptyGadget() -{ - -} +/** + ****************************************************************************** + * + * @file emptygadget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "emptygadget.h" +#include "emptygadgetwidget.h" + +EmptyGadget::EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget) +{ +} + +EmptyGadget::~EmptyGadget() +{ + +} diff --git a/ground/src/plugins/emptygadget/emptygadget.h b/ground/src/plugins/emptygadget/emptygadget.h index 7c620d527..62ff61686 100644 --- a/ground/src/plugins/emptygadget/emptygadget.h +++ b/ground/src/plugins/emptygadget/emptygadget.h @@ -1,59 +1,59 @@ -/** - ****************************************************************************** - * - * @file emptygadget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 EMPTYGADGET_H_ -#define EMPTYGADGET_H_ - -#include - -namespace Core { -class IUAVGadget; -} -//class QWidget; -//class QString; -class EmptyGadgetWidget; - -using namespace Core; - -class EmptyGadget : public Core::IUAVGadget -{ - Q_OBJECT -public: - EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent = 0); - ~EmptyGadget(); - - QList context() const { return m_context; } - QWidget *widget() { return m_widget; } - QString contextHelpId() const { return QString(); } - -private: - QWidget *m_widget; - QList m_context; -}; - - -#endif // EMPTYGADGET_H_ +/** + ****************************************************************************** + * + * @file emptygadget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 EMPTYGADGET_H_ +#define EMPTYGADGET_H_ + +#include + +namespace Core { +class IUAVGadget; +} +//class QWidget; +//class QString; +class EmptyGadgetWidget; + +using namespace Core; + +class EmptyGadget : public Core::IUAVGadget +{ + Q_OBJECT +public: + EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent = 0); + ~EmptyGadget(); + + QList context() const { return m_context; } + QWidget *widget() { return m_widget; } + QString contextHelpId() const { return QString(); } + +private: + QWidget *m_widget; + QList m_context; +}; + + +#endif // EMPTYGADGET_H_ diff --git a/ground/src/plugins/emptygadget/emptygadgetfactory.cpp b/ground/src/plugins/emptygadget/emptygadgetfactory.cpp index 1206509e9..fc8927bc6 100644 --- a/ground/src/plugins/emptygadget/emptygadgetfactory.cpp +++ b/ground/src/plugins/emptygadget/emptygadgetfactory.cpp @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file emptygadgetfactory.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 "emptygadgetfactory.h" -#include "emptygadgetwidget.h" -#include "emptygadget.h" -#include - -EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("EmptyGadget"), - tr("Choose Gadget..."), - parent) -{ -} - -EmptyGadgetFactory::~EmptyGadgetFactory() -{ - -} - -IUAVGadget* EmptyGadgetFactory::createGadget(QWidget *parent) { - EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent); - return new EmptyGadget(QString("EmptyGadget"), gadgetWidget, parent); -} +/** + ****************************************************************************** + * + * @file emptygadgetfactory.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "emptygadgetfactory.h" +#include "emptygadgetwidget.h" +#include "emptygadget.h" +#include + +EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) : + IUAVGadgetFactory(QString("EmptyGadget"), + tr("Choose Gadget..."), + parent) +{ +} + +EmptyGadgetFactory::~EmptyGadgetFactory() +{ + +} + +IUAVGadget* EmptyGadgetFactory::createGadget(QWidget *parent) { + EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent); + return new EmptyGadget(QString("EmptyGadget"), gadgetWidget, parent); +} diff --git a/ground/src/plugins/emptygadget/emptygadgetfactory.h b/ground/src/plugins/emptygadget/emptygadgetfactory.h index 93451a6f4..2c0eb163e 100644 --- a/ground/src/plugins/emptygadget/emptygadgetfactory.h +++ b/ground/src/plugins/emptygadget/emptygadgetfactory.h @@ -1,50 +1,50 @@ -/** - ****************************************************************************** - * - * @file emptygadgetfactory.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 EMPTYGADGETFACTORY_H_ -#define EMPTYGADGETFACTORY_H_ - -#include - -namespace Core { -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class EmptyGadgetFactory : public IUAVGadgetFactory -{ - Q_OBJECT -public: - EmptyGadgetFactory(QObject *parent = 0); - ~EmptyGadgetFactory(); - - IUAVGadget *createGadget(QWidget *parent); -}; - -#endif // EMPTYGADGETFACTORY_H_ +/** + ****************************************************************************** + * + * @file emptygadgetfactory.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 EMPTYGADGETFACTORY_H_ +#define EMPTYGADGETFACTORY_H_ + +#include + +namespace Core { +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class EmptyGadgetFactory : public IUAVGadgetFactory +{ + Q_OBJECT +public: + EmptyGadgetFactory(QObject *parent = 0); + ~EmptyGadgetFactory(); + + IUAVGadget *createGadget(QWidget *parent); +}; + +#endif // EMPTYGADGETFACTORY_H_ diff --git a/ground/src/plugins/emptygadget/emptygadgetwidget.cpp b/ground/src/plugins/emptygadget/emptygadgetwidget.cpp index cc75980e0..9382c4610 100644 --- a/ground/src/plugins/emptygadget/emptygadgetwidget.cpp +++ b/ground/src/plugins/emptygadget/emptygadgetwidget.cpp @@ -1,50 +1,50 @@ -/** - ****************************************************************************** - * - * @file emptygadgetwidget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 "emptygadgetwidget.h" - -#include -#include -#include -#include -#include -#include - -EmptyGadgetWidget::EmptyGadgetWidget(QWidget *parent) : QLabel(parent) -{ - setMinimumSize(64,64); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - this-> - setText(tr("Choose a gadget to display in this view.\n") + - tr("You can also split this view in two.\n\n") + - tr("Maybe you first have to choose Edit Gadgets Mode in the Window menu.")); -} - -EmptyGadgetWidget::~EmptyGadgetWidget() -{ - // Do nothing -} - +/** + ****************************************************************************** + * + * @file emptygadgetwidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "emptygadgetwidget.h" + +#include +#include +#include +#include +#include +#include + +EmptyGadgetWidget::EmptyGadgetWidget(QWidget *parent) : QLabel(parent) +{ + setMinimumSize(64,64); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + this-> + setText(tr("Choose a gadget to display in this view.\n") + + tr("You can also split this view in two.\n\n") + + tr("Maybe you first have to choose Edit Gadgets Mode in the Window menu.")); +} + +EmptyGadgetWidget::~EmptyGadgetWidget() +{ + // Do nothing +} + diff --git a/ground/src/plugins/emptygadget/emptygadgetwidget.h b/ground/src/plugins/emptygadget/emptygadgetwidget.h index 600cae2a2..0218ad7f3 100644 --- a/ground/src/plugins/emptygadget/emptygadgetwidget.h +++ b/ground/src/plugins/emptygadget/emptygadgetwidget.h @@ -1,44 +1,44 @@ -/** - ****************************************************************************** - * - * @file emptygadgetwidget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 EMPTYGADGETWIDGET_H_ -#define EMPTYGADGETWIDGET_H_ - -#include - -class EmptyGadgetWidget : public QLabel -{ - Q_OBJECT - -public: - EmptyGadgetWidget(QWidget *parent = 0); - ~EmptyGadgetWidget(); - -private: -}; - -#endif /* EMPTYGADGETWIDGET_H_ */ +/** + ****************************************************************************** + * + * @file emptygadgetwidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 EMPTYGADGETWIDGET_H_ +#define EMPTYGADGETWIDGET_H_ + +#include + +class EmptyGadgetWidget : public QLabel +{ + Q_OBJECT + +public: + EmptyGadgetWidget(QWidget *parent = 0); + ~EmptyGadgetWidget(); + +private: +}; + +#endif /* EMPTYGADGETWIDGET_H_ */ diff --git a/ground/src/plugins/emptygadget/emptyplugin.cpp b/ground/src/plugins/emptygadget/emptyplugin.cpp index 528ed8b4a..ee20e6c24 100644 --- a/ground/src/plugins/emptygadget/emptyplugin.cpp +++ b/ground/src/plugins/emptygadget/emptyplugin.cpp @@ -1,65 +1,65 @@ -/** - ****************************************************************************** - * - * @file emptyplugin.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 "emptyplugin.h" -#include "emptygadgetfactory.h" -#include -#include -#include -#include - - -EmptyPlugin::EmptyPlugin() -{ - // Do nothing -} - -EmptyPlugin::~EmptyPlugin() -{ - // Do nothing -} - -bool EmptyPlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mf = new EmptyGadgetFactory(this); - addAutoReleasedObject(mf); - - return true; -} - -void EmptyPlugin::extensionsInitialized() -{ - // Do nothing -} - -void EmptyPlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(EmptyPlugin) - +/** + ****************************************************************************** + * + * @file emptyplugin.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "emptyplugin.h" +#include "emptygadgetfactory.h" +#include +#include +#include +#include + + +EmptyPlugin::EmptyPlugin() +{ + // Do nothing +} + +EmptyPlugin::~EmptyPlugin() +{ + // Do nothing +} + +bool EmptyPlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mf = new EmptyGadgetFactory(this); + addAutoReleasedObject(mf); + + return true; +} + +void EmptyPlugin::extensionsInitialized() +{ + // Do nothing +} + +void EmptyPlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(EmptyPlugin) + diff --git a/ground/src/plugins/emptygadget/emptyplugin.h b/ground/src/plugins/emptygadget/emptyplugin.h index f189742a0..9e4342f62 100644 --- a/ground/src/plugins/emptygadget/emptyplugin.h +++ b/ground/src/plugins/emptygadget/emptyplugin.h @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file emptyplugin.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup emptygadget - * @{ - * - *****************************************************************************/ -/* - * 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 EMPTYPLUGIN_H_ -#define EMPTYPLUGIN_H_ - -#include - -class EmptyGadgetFactory; - -class EmptyPlugin : public ExtensionSystem::IPlugin -{ -public: - EmptyPlugin(); - ~EmptyPlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - EmptyGadgetFactory *mf; -}; -#endif /* EMPTYPLUGIN_H_ */ +/** + ****************************************************************************** + * + * @file emptyplugin.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup emptyplugin + * @{ + * + *****************************************************************************/ +/* + * 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 EMPTYPLUGIN_H_ +#define EMPTYPLUGIN_H_ + +#include + +class EmptyGadgetFactory; + +class EmptyPlugin : public ExtensionSystem::IPlugin +{ +public: + EmptyPlugin(); + ~EmptyPlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +private: + EmptyGadgetFactory *mf; +}; +#endif /* EMPTYPLUGIN_H_ */ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp index bc6be147a..463d37569 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp @@ -1,52 +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 -} +/** + ****************************************************************************** + * + * @file gpsdisplaygadget.cpp + * @author Edouard Lafargue Copyright (C) 2010. + * @brief GPS gadget to display GPS Status + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index 111874466..bf9f0461a 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.h @@ -1,56 +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_ +/** + ****************************************************************************** + * + * @file gpsdisplaygadget.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief GPS gadget to display GPS Status header + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index 700e9a9cb..44df7ebe6 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.cpp @@ -5,7 +5,7 @@ * @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 + * @defgroup gpsdisplayplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h index 3268d7a79..27ea474ed 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetconfiguration.h @@ -5,7 +5,7 @@ * @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 + * @defgroup gpsdisplayplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp index 6d8c70fba..d338f233c 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.cpp @@ -1,60 +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)); -} - +/** + ****************************************************************************** + * + * @file gpsdisplaygadgetfactory.cpp + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index 99d178c54..218e63098 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetfactory.h @@ -1,52 +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_ +/** + ****************************************************************************** + * + * @file gpsdisplaygadgetfactory.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index 6eb180755..26955bd7a 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.cpp @@ -5,7 +5,7 @@ * @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 + * @defgroup gpsdisplayplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h index c2ace9afc..dc32a4c9b 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadgetoptionspage.h @@ -5,7 +5,7 @@ * @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 + * @defgroup gpsdisplayplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp index 23469d7a3..4c531d8e2 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.cpp @@ -1,65 +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) +/** + ****************************************************************************** + * + * @file gpsdisplayplugin.cpp + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index 7b7d7ad44..88e37170c 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplayplugin.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplayplugin.h @@ -1,47 +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_ */ +/** + ****************************************************************************** + * + * @file gpsdisplayplugin.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index 70a74fdfd..b5a5c88ba 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp @@ -1,60 +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() { -} - - - +/** + ****************************************************************************** + * + * @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 gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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 index cf3acd5f3..f3eccbed1 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h @@ -1,61 +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_ */ +/** + ****************************************************************************** + * + * @file gpsdisplaywidget.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup gpsdisplayplugin + * @{ + * + *****************************************************************************/ +/* + * 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/hitl/flightgearbridge.cpp b/ground/src/plugins/hitl/flightgearbridge.cpp index 9845c23a3..774eeaa83 100644 --- a/ground/src/plugins/hitl/flightgearbridge.cpp +++ b/ground/src/plugins/hitl/flightgearbridge.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl + * @defgroup hitlplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/hitl/flightgearbridge.h b/ground/src/plugins/hitl/flightgearbridge.h index 397c8993e..cec269b5d 100644 --- a/ground/src/plugins/hitl/flightgearbridge.h +++ b/ground/src/plugins/hitl/flightgearbridge.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl + * @defgroup hitlplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/hitl/hitl.cpp b/ground/src/plugins/hitl/hitl.cpp index acfd78d3e..5286c4c72 100644 --- a/ground/src/plugins/hitl/hitl.cpp +++ b/ground/src/plugins/hitl/hitl.cpp @@ -1,49 +1,49 @@ -/** - ****************************************************************************** - * - * @file hitl.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 "hitl.h" -#include "hitlwidget.h" -#include "hitlconfiguration.h" - -HITL::HITL(QString classId, HITLWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget) -{ -} - -HITL::~HITL() -{ - -} - -void HITL::loadConfiguration(IUAVGadgetConfiguration* config) -{ - HITLConfiguration *m = qobject_cast(config); - m_widget->setFGPathBin( m->fgPathBin() ); - m_widget->setFGPathData( m->fgPathData() ); - m_widget->setFGManualControl( m->fgManualControl() ); -} - +/** + ****************************************************************************** + * + * @file hitl.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "hitl.h" +#include "hitlwidget.h" +#include "hitlconfiguration.h" + +HITL::HITL(QString classId, HITLWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget) +{ +} + +HITL::~HITL() +{ + +} + +void HITL::loadConfiguration(IUAVGadgetConfiguration* config) +{ + HITLConfiguration *m = qobject_cast(config); + m_widget->setFGPathBin( m->fgPathBin() ); + m_widget->setFGPathData( m->fgPathData() ); + m_widget->setFGManualControl( m->fgManualControl() ); +} + diff --git a/ground/src/plugins/hitl/hitl.h b/ground/src/plugins/hitl/hitl.h index 7cb312957..168242380 100644 --- a/ground/src/plugins/hitl/hitl.h +++ b/ground/src/plugins/hitl/hitl.h @@ -1,56 +1,56 @@ -/** - ****************************************************************************** - * - * @file hitl.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 HITL_H -#define HITL_H - -#include -#include "hitlwidget.h" - -class IUAVGadget; -class QWidget; -class QString; -class HITLWidget; - -using namespace Core; - -class HITL : public Core::IUAVGadget -{ - Q_OBJECT -public: - HITL(QString classId, HITLWidget *widget, QWidget *parent = 0); - ~HITL(); - - QWidget *widget() { return m_widget; } - void loadConfiguration(IUAVGadgetConfiguration* config); - -private: - HITLWidget *m_widget; -}; - - -#endif // HITL_H +/** + ****************************************************************************** + * + * @file hitl.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 HITL_H +#define HITL_H + +#include +#include "hitlwidget.h" + +class IUAVGadget; +class QWidget; +class QString; +class HITLWidget; + +using namespace Core; + +class HITL : public Core::IUAVGadget +{ + Q_OBJECT +public: + HITL(QString classId, HITLWidget *widget, QWidget *parent = 0); + ~HITL(); + + QWidget *widget() { return m_widget; } + void loadConfiguration(IUAVGadgetConfiguration* config); + +private: + HITLWidget *m_widget; +}; + + +#endif // HITL_H diff --git a/ground/src/plugins/hitl/hitlconfiguration.cpp b/ground/src/plugins/hitl/hitlconfiguration.cpp index 47138428d..382058bdf 100644 --- a/ground/src/plugins/hitl/hitlconfiguration.cpp +++ b/ground/src/plugins/hitl/hitlconfiguration.cpp @@ -1,67 +1,67 @@ -/** - ****************************************************************************** - * - * @file hitlconfiguration.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 "hitlconfiguration.h" -#include - -HITLConfiguration::HITLConfiguration(QString classId, const QByteArray &state, QObject *parent) : - IUAVGadgetConfiguration(classId, parent), - m_fgPathBin(""), m_fgPathData(""), m_fgManualControl(false) -{ - if (state.count() > 0) { - QDataStream stream(state); - QString fgPathBin; - QString fgPathData; - bool fgManualControl; - stream >> fgPathBin; - m_fgPathBin = fgPathBin; - stream >> fgPathData; - m_fgPathData = fgPathData; - stream >> fgManualControl; - m_fgManualControl = fgManualControl; - } -} - -IUAVGadgetConfiguration *HITLConfiguration::clone() -{ - HITLConfiguration *m = new HITLConfiguration(this->classId()); - m->m_fgPathBin = m_fgPathBin; - m->m_fgPathData = m_fgPathData; - m->m_fgManualControl = m_fgManualControl; - return m; -} - -QByteArray HITLConfiguration::saveState() const -{ - QByteArray bytes; - QDataStream stream(&bytes, QIODevice::WriteOnly); - stream << m_fgPathBin; - stream << m_fgPathData; - stream << m_fgManualControl; - return bytes; -} - +/** + ****************************************************************************** + * + * @file hitlconfiguration.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "hitlconfiguration.h" +#include + +HITLConfiguration::HITLConfiguration(QString classId, const QByteArray &state, QObject *parent) : + IUAVGadgetConfiguration(classId, parent), + m_fgPathBin(""), m_fgPathData(""), m_fgManualControl(false) +{ + if (state.count() > 0) { + QDataStream stream(state); + QString fgPathBin; + QString fgPathData; + bool fgManualControl; + stream >> fgPathBin; + m_fgPathBin = fgPathBin; + stream >> fgPathData; + m_fgPathData = fgPathData; + stream >> fgManualControl; + m_fgManualControl = fgManualControl; + } +} + +IUAVGadgetConfiguration *HITLConfiguration::clone() +{ + HITLConfiguration *m = new HITLConfiguration(this->classId()); + m->m_fgPathBin = m_fgPathBin; + m->m_fgPathData = m_fgPathData; + m->m_fgManualControl = m_fgManualControl; + return m; +} + +QByteArray HITLConfiguration::saveState() const +{ + QByteArray bytes; + QDataStream stream(&bytes, QIODevice::WriteOnly); + stream << m_fgPathBin; + stream << m_fgPathData; + stream << m_fgManualControl; + return bytes; +} + diff --git a/ground/src/plugins/hitl/hitlconfiguration.h b/ground/src/plugins/hitl/hitlconfiguration.h index 982acd0da..d0db34c99 100644 --- a/ground/src/plugins/hitl/hitlconfiguration.h +++ b/ground/src/plugins/hitl/hitlconfiguration.h @@ -1,68 +1,68 @@ -/** - ****************************************************************************** - * - * @file hitlconfiguration.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 HITLCONFIGURATION_H -#define HITLCONFIGURATION_H - -#include -#include -#include - -using namespace Core; - -class HITLConfiguration : public IUAVGadgetConfiguration -{ - -Q_OBJECT -Q_PROPERTY(QString m_fgPathBin READ fgPathBin WRITE setFGPathBin) -Q_PROPERTY(QString m_fgPathData READ fgPathData WRITE setFGPathData) -Q_PROPERTY(bool m_fgManualControl READ fgManualControl WRITE setFGManualControl) - -public: - explicit HITLConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0); - QByteArray saveState() const; - IUAVGadgetConfiguration *clone(); - - QString fgPathBin() const { return m_fgPathBin; } - QString fgPathData() const { return m_fgPathData; } - bool fgManualControl() const { return m_fgManualControl; } - -signals: - -public slots: - void setFGPathBin(QString fgPath) { m_fgPathBin = fgPath; } - void setFGPathData(QString fgPath) { m_fgPathData = fgPath; } - void setFGManualControl(bool val) { m_fgManualControl = val; } - -private: - QString m_fgPathBin; - QString m_fgPathData; - bool m_fgManualControl; - -}; - -#endif // HITLCONFIGURATION_H +/** + ****************************************************************************** + * + * @file hitlconfiguration.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 HITLCONFIGURATION_H +#define HITLCONFIGURATION_H + +#include +#include +#include + +using namespace Core; + +class HITLConfiguration : public IUAVGadgetConfiguration +{ + +Q_OBJECT +Q_PROPERTY(QString m_fgPathBin READ fgPathBin WRITE setFGPathBin) +Q_PROPERTY(QString m_fgPathData READ fgPathData WRITE setFGPathData) +Q_PROPERTY(bool m_fgManualControl READ fgManualControl WRITE setFGManualControl) + +public: + explicit HITLConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0); + QByteArray saveState() const; + IUAVGadgetConfiguration *clone(); + + QString fgPathBin() const { return m_fgPathBin; } + QString fgPathData() const { return m_fgPathData; } + bool fgManualControl() const { return m_fgManualControl; } + +signals: + +public slots: + void setFGPathBin(QString fgPath) { m_fgPathBin = fgPath; } + void setFGPathData(QString fgPath) { m_fgPathData = fgPath; } + void setFGManualControl(bool val) { m_fgManualControl = val; } + +private: + QString m_fgPathBin; + QString m_fgPathData; + bool m_fgManualControl; + +}; + +#endif // HITLCONFIGURATION_H diff --git a/ground/src/plugins/hitl/hitlfactory.cpp b/ground/src/plugins/hitl/hitlfactory.cpp index 4b0b36956..57f11789a 100644 --- a/ground/src/plugins/hitl/hitlfactory.cpp +++ b/ground/src/plugins/hitl/hitlfactory.cpp @@ -1,58 +1,58 @@ -/** - ****************************************************************************** - * - * @file hitlfactory.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 "hitlfactory.h" -#include "hitlwidget.h" -#include "hitl.h" -#include "hitlconfiguration.h" -#include "hitloptionspage.h" -#include - -HITLFactory::HITLFactory(QObject *parent) : - IUAVGadgetFactory(QString("HITL"), tr("HITL Simulation"), parent) -{ -} - -HITLFactory::~HITLFactory() -{ -} - -Core::IUAVGadget* HITLFactory::createGadget(QWidget *parent) -{ - HITLWidget* gadgetWidget = new HITLWidget(parent); - return new HITL(QString("HITL"), gadgetWidget, parent); -} - -IUAVGadgetConfiguration *HITLFactory::createConfiguration(const QByteArray &state) -{ - return new HITLConfiguration(QString("HITL"), state); -} - -IOptionsPage *HITLFactory::createOptionsPage(IUAVGadgetConfiguration *config) -{ - return new HITLOptionsPage(qobject_cast(config)); -} - +/** + ****************************************************************************** + * + * @file hitlfactory.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "hitlfactory.h" +#include "hitlwidget.h" +#include "hitl.h" +#include "hitlconfiguration.h" +#include "hitloptionspage.h" +#include + +HITLFactory::HITLFactory(QObject *parent) : + IUAVGadgetFactory(QString("HITL"), tr("HITL Simulation"), parent) +{ +} + +HITLFactory::~HITLFactory() +{ +} + +Core::IUAVGadget* HITLFactory::createGadget(QWidget *parent) +{ + HITLWidget* gadgetWidget = new HITLWidget(parent); + return new HITL(QString("HITL"), gadgetWidget, parent); +} + +IUAVGadgetConfiguration *HITLFactory::createConfiguration(const QByteArray &state) +{ + return new HITLConfiguration(QString("HITL"), state); +} + +IOptionsPage *HITLFactory::createOptionsPage(IUAVGadgetConfiguration *config) +{ + return new HITLOptionsPage(qobject_cast(config)); +} + diff --git a/ground/src/plugins/hitl/hitlfactory.h b/ground/src/plugins/hitl/hitlfactory.h index fb5577251..2a79d1028 100644 --- a/ground/src/plugins/hitl/hitlfactory.h +++ b/ground/src/plugins/hitl/hitlfactory.h @@ -1,52 +1,52 @@ -/** - ****************************************************************************** - * - * @file hitlfactory.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 HITLFACTORY_H -#define HITLFACTORY_H - -#include - -namespace Core { -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class HITLFactory : public Core::IUAVGadgetFactory -{ - Q_OBJECT -public: - HITLFactory(QObject *parent = 0); - ~HITLFactory(); - - Core::IUAVGadget *createGadget(QWidget *parent); - IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); - IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); -}; - -#endif // HITLFACTORY_H +/** + ****************************************************************************** + * + * @file hitlfactory.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 HITLFACTORY_H +#define HITLFACTORY_H + +#include + +namespace Core { +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class HITLFactory : public Core::IUAVGadgetFactory +{ + Q_OBJECT +public: + HITLFactory(QObject *parent = 0); + ~HITLFactory(); + + Core::IUAVGadget *createGadget(QWidget *parent); + IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); + IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); +}; + +#endif // HITLFACTORY_H diff --git a/ground/src/plugins/hitl/hitloptionspage.cpp b/ground/src/plugins/hitl/hitloptionspage.cpp index 68abe443e..ae7ad45f7 100644 --- a/ground/src/plugins/hitl/hitloptionspage.cpp +++ b/ground/src/plugins/hitl/hitloptionspage.cpp @@ -1,73 +1,73 @@ -/** - ****************************************************************************** - * - * @file hitloptionspage.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 "hitloptionspage.h" -#include "hitlconfiguration.h" -#include "ui_hitloptionspage.h" - -#include -#include -#include - -HITLOptionsPage::HITLOptionsPage(HITLConfiguration *config, QObject *parent) : - IOptionsPage(parent), - m_config(config) -{ -} - -QWidget *HITLOptionsPage::createPage(QWidget *parent) -{ - // Create page - m_optionsPage = new Ui::HITLOptionsPage(); - QWidget* optionsPageWidget = new QWidget; - m_optionsPage->setupUi(optionsPageWidget); - - m_optionsPage->executablePathChooser->setExpectedKind(Utils::PathChooser::File); - m_optionsPage->executablePathChooser->setPromptDialogTitle(tr("Choose FlightGear executable")); - m_optionsPage->dataDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory); - m_optionsPage->dataDirectoryPathChooser->setPromptDialogTitle(tr("Choose FlightGear data directory")); - - // Restore the contents from the settings: - m_optionsPage->executablePathChooser->setPath(m_config->fgPathBin()); - m_optionsPage->dataDirectoryPathChooser->setPath(m_config->fgPathData()); - m_optionsPage->fgManualControl->setChecked(m_config->fgManualControl()); - - - return optionsPageWidget; -} - -void HITLOptionsPage::apply() -{ - m_config->setFGPathBin( m_optionsPage->executablePathChooser->path()); - m_config->setFGPathData( m_optionsPage->dataDirectoryPathChooser->path()); - m_config->setFGManualControl( m_optionsPage->fgManualControl->isChecked()); -} - -void HITLOptionsPage::finish() -{ - delete m_optionsPage; -} +/** + ****************************************************************************** + * + * @file hitloptionspage.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "hitloptionspage.h" +#include "hitlconfiguration.h" +#include "ui_hitloptionspage.h" + +#include +#include +#include + +HITLOptionsPage::HITLOptionsPage(HITLConfiguration *config, QObject *parent) : + IOptionsPage(parent), + m_config(config) +{ +} + +QWidget *HITLOptionsPage::createPage(QWidget *parent) +{ + // Create page + m_optionsPage = new Ui::HITLOptionsPage(); + QWidget* optionsPageWidget = new QWidget; + m_optionsPage->setupUi(optionsPageWidget); + + m_optionsPage->executablePathChooser->setExpectedKind(Utils::PathChooser::File); + m_optionsPage->executablePathChooser->setPromptDialogTitle(tr("Choose FlightGear executable")); + m_optionsPage->dataDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory); + m_optionsPage->dataDirectoryPathChooser->setPromptDialogTitle(tr("Choose FlightGear data directory")); + + // Restore the contents from the settings: + m_optionsPage->executablePathChooser->setPath(m_config->fgPathBin()); + m_optionsPage->dataDirectoryPathChooser->setPath(m_config->fgPathData()); + m_optionsPage->fgManualControl->setChecked(m_config->fgManualControl()); + + + return optionsPageWidget; +} + +void HITLOptionsPage::apply() +{ + m_config->setFGPathBin( m_optionsPage->executablePathChooser->path()); + m_config->setFGPathData( m_optionsPage->dataDirectoryPathChooser->path()); + m_config->setFGManualControl( m_optionsPage->fgManualControl->isChecked()); +} + +void HITLOptionsPage::finish() +{ + delete m_optionsPage; +} diff --git a/ground/src/plugins/hitl/hitloptionspage.h b/ground/src/plugins/hitl/hitloptionspage.h index c34a0da18..94262d7dc 100644 --- a/ground/src/plugins/hitl/hitloptionspage.h +++ b/ground/src/plugins/hitl/hitloptionspage.h @@ -1,65 +1,65 @@ -/** - ****************************************************************************** - * - * @file hitloptionspage.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 HITLOPTIONSPAGE_H -#define HITLOPTIONSPAGE_H - -#include "coreplugin/dialogs/ioptionspage.h" - -namespace Core { -class IUAVGadgetConfiguration; -} - -class HITLConfiguration; - -using namespace Core; - -namespace Ui { - class HITLOptionsPage; -} - -class HITLOptionsPage : public IOptionsPage -{ -Q_OBJECT -public: - explicit HITLOptionsPage(HITLConfiguration *config, QObject *parent = 0); - - QWidget *createPage(QWidget *parent); - void apply(); - void finish(); - -signals: - -private slots: - -private: - HITLConfiguration* m_config; - Ui::HITLOptionsPage* m_optionsPage; - -}; - -#endif // HITLOPTIONSPAGE_H +/** + ****************************************************************************** + * + * @file hitloptionspage.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 HITLOPTIONSPAGE_H +#define HITLOPTIONSPAGE_H + +#include "coreplugin/dialogs/ioptionspage.h" + +namespace Core { +class IUAVGadgetConfiguration; +} + +class HITLConfiguration; + +using namespace Core; + +namespace Ui { + class HITLOptionsPage; +} + +class HITLOptionsPage : public IOptionsPage +{ +Q_OBJECT +public: + explicit HITLOptionsPage(HITLConfiguration *config, QObject *parent = 0); + + QWidget *createPage(QWidget *parent); + void apply(); + void finish(); + +signals: + +private slots: + +private: + HITLConfiguration* m_config; + Ui::HITLOptionsPage* m_optionsPage; + +}; + +#endif // HITLOPTIONSPAGE_H diff --git a/ground/src/plugins/hitl/hitlplugin.cpp b/ground/src/plugins/hitl/hitlplugin.cpp index 6d22e2aeb..3dcad2ce9 100644 --- a/ground/src/plugins/hitl/hitlplugin.cpp +++ b/ground/src/plugins/hitl/hitlplugin.cpp @@ -1,63 +1,63 @@ -/** - ****************************************************************************** - * - * @file mapplugin.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 "hitlplugin.h" -#include "hitlfactory.h" -#include -#include -#include - -HITLPlugin::HITLPlugin() -{ - // Do nothing -} - -HITLPlugin::~HITLPlugin() -{ - // Do nothing -} - -bool HITLPlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mf = new HITLFactory(this); - addAutoReleasedObject(mf); - - return true; -} - -void HITLPlugin::extensionsInitialized() -{ - // Do nothing -} - -void HITLPlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(HITLPlugin) - +/** + ****************************************************************************** + * + * @file mapplugin.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "hitlplugin.h" +#include "hitlfactory.h" +#include +#include +#include + +HITLPlugin::HITLPlugin() +{ + // Do nothing +} + +HITLPlugin::~HITLPlugin() +{ + // Do nothing +} + +bool HITLPlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mf = new HITLFactory(this); + addAutoReleasedObject(mf); + + return true; +} + +void HITLPlugin::extensionsInitialized() +{ + // Do nothing +} + +void HITLPlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(HITLPlugin) + diff --git a/ground/src/plugins/hitl/hitlplugin.h b/ground/src/plugins/hitl/hitlplugin.h index ebc00800c..a55fbfe9d 100644 --- a/ground/src/plugins/hitl/hitlplugin.h +++ b/ground/src/plugins/hitl/hitlplugin.h @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file browserplugin.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 HITLPLUGIN_H -#define HITLPLUGIN_H - -#include - -class HITLFactory; - -class HITLPlugin : public ExtensionSystem::IPlugin -{ -public: - HITLPlugin(); - ~HITLPlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - HITLFactory *mf; -}; -#endif /* HITLPLUGIN_H */ +/** + ****************************************************************************** + * + * @file browserplugin.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 HITLPLUGIN_H +#define HITLPLUGIN_H + +#include + +class HITLFactory; + +class HITLPlugin : public ExtensionSystem::IPlugin +{ +public: + HITLPlugin(); + ~HITLPlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +private: + HITLFactory *mf; +}; +#endif /* HITLPLUGIN_H */ diff --git a/ground/src/plugins/hitl/hitlwidget.cpp b/ground/src/plugins/hitl/hitlwidget.cpp index 17128b23e..f54979951 100644 --- a/ground/src/plugins/hitl/hitlwidget.cpp +++ b/ground/src/plugins/hitl/hitlwidget.cpp @@ -1,209 +1,209 @@ -/** - ****************************************************************************** - * - * @file hitlwidget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 "hitlwidget.h" -#include "ui_hitlwidget.h" -#include "qxtlogger.h" -#include -#include "uavobjects/uavobjectmanager.h" -#include -#include - -HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent) -{ - // Note: Only tested on windows 7 -#if defined(Q_WS_WIN) - cmdShell = QString("c:/windows/system32/cmd.exe"); -#else - cmdShell = QString("bash"); -#endif - fgProcess = NULL; - widget = new Ui_HITLWidget(); - widget->setupUi(this); - connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); - connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); -} - -HITLWidget::~HITLWidget() -{ - delete widget; -} - -void HITLWidget::startButtonClicked() -{ - // Stop running process if one is active - if (fgProcess != NULL) - { - stopButtonClicked(); - } - - // Copy FlightGear generic protocol configuration file to the FG protocol directory - // NOTE: Not working on Windows 7, if FG is installed in the "Program Files", - // likelly due to permissions. The file should be manually copied to data/Protocol/opfgprotocol.xml - QFile xmlFile(":/flightgear/genericprotocol/opfgprotocol.xml"); - xmlFile.open(QIODevice::ReadOnly | QIODevice::Text); - QString xml = xmlFile.readAll(); - xmlFile.close(); - QFile xmlFileOut(fgPathData + "/Protocol/opfgprotocol.xml"); - xmlFileOut.open(QIODevice::WriteOnly | QIODevice::Text); - xmlFileOut.write(xml.toAscii()); - xmlFileOut.close(); - - // Setup process - widget->textBrowser->append(QString("Starting FlightGear ...\n")); - qxtLog->info("HITL: Starting FlightGear"); - fgProcess = new QProcess(); - fgProcess->setReadChannelMode(QProcess::MergedChannels); - connect(fgProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(processReadyRead())); - - // Start shell (Note: Could not start FG directly on Windows, only through terminal!) - fgProcess->start(cmdShell); - if (fgProcess->waitForStarted() == false) - { - widget->textBrowser->append("Error:" + fgProcess->errorString()); - } - - // Setup arguments - // Note: The input generic protocol is set to update at a much higher rate than the actual updates are sent by the GCS. - // If this is not done then a lag will be introduced by FlightGear, likelly because the receive socket buffer builds up during startup. - QString args("--fg-root=\"" + fgPathData + "\" --timeofday=dusk --httpd=5400 --enable-hud --in-air --altitude=2000 --vc=100 --generic=socket,out,50,localhost,5500,udp,opfgprotocol"); - if ( !fgManualControl ) - { - args.append(" --generic=socket,in,400,localhost,5501,udp,opfgprotocol"); - } - - // Start FlightGear - QString cmd; - cmd = "\"" + fgPathBin + "\" " + args + "\n"; - fgProcess->write(cmd.toAscii()); - - // Start bridge - qxtLog->info("HITL: Starting bridge, initializing FlighGear and Autopilot connections"); - fgBridge = new FlightGearBridge(); - connect(fgBridge, SIGNAL(autopilotConnected()), this, SLOT(onAutopilotConnect())); - connect(fgBridge, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); - connect(fgBridge, SIGNAL(fgConnected()), this, SLOT(onFGConnect())); - connect(fgBridge, SIGNAL(fgDisconnected()), this, SLOT(onFGDisconnect())); - - // Initialize connection status - if ( fgBridge->isAutopilotConnected() ) - { - onAutopilotConnect(); - } - else - { - onAutopilotDisconnect(); - } - if ( fgBridge->isFGConnected() ) - { - onFGConnect(); - } - else - { - onFGDisconnect(); - } -} - -void HITLWidget::stopButtonClicked() -{ - // NOTE: Does not currently work, may need to send control+c to through the terminal - if (fgProcess != NULL) - { - fgProcess->disconnect(this); - fgProcess->kill(); - delete fgProcess; - fgBridge->disconnect(this); - delete fgBridge; - fgProcess = NULL; - } -} - -void HITLWidget::setFGPathBin(QString fgPath) -{ - this->fgPathBin = fgPath; -} - -void HITLWidget::setFGPathData(QString fgPath) -{ - this->fgPathData = fgPath; -} - -void HITLWidget::setFGManualControl(bool val) -{ - this->fgManualControl = val; -} - -void HITLWidget::processReadyRead() -{ - QByteArray bytes = fgProcess->readAllStandardOutput(); - QString str(bytes); - if ( !str.contains("Error reading data") ) // ignore error - { - widget->textBrowser->append(str); - } -} - -void HITLWidget::onAutopilotConnect() -{ - QPalette pal(widget->apLabel->palette()); - pal.setColor(QPalette::Window, Qt::green); - widget->apLabel->setPalette(pal); - widget->apLabel->setAutoFillBackground(true); - widget->apLabel->setText("AutoPilot Connected"); - qxtLog->info("HITL: Autopilot connected, initializing for HITL simulation"); -} - -void HITLWidget::onAutopilotDisconnect() -{ - QPalette pal(widget->apLabel->palette()); - pal.setColor(QPalette::Window, Qt::red); - widget->apLabel->setPalette(pal); - widget->apLabel->setAutoFillBackground(true); - widget->apLabel->setText("AutoPilot Disconnected"); - qxtLog->info("HITL: Autopilot disconnected"); -} - -void HITLWidget::onFGConnect() -{ - QPalette pal(widget->fgLabel->palette()); - pal.setColor(QPalette::Window, Qt::green); - widget->fgLabel->setPalette(pal); - widget->fgLabel->setAutoFillBackground(true); - widget->fgLabel->setText("FlightGear Connected"); - qxtLog->info("HITL: FlighGear connected"); -} - -void HITLWidget::onFGDisconnect() -{ - QPalette pal(widget->fgLabel->palette()); - pal.setColor(QPalette::Window, Qt::red); - widget->fgLabel->setPalette(pal); - widget->fgLabel->setAutoFillBackground(true); - widget->fgLabel->setText("FlightGear Disconnected"); - qxtLog->info("HITL: FlighGear disconnected"); -} - - +/** + ****************************************************************************** + * + * @file hitlwidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "hitlwidget.h" +#include "ui_hitlwidget.h" +#include "qxtlogger.h" +#include +#include "uavobjects/uavobjectmanager.h" +#include +#include + +HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent) +{ + // Note: Only tested on windows 7 +#if defined(Q_WS_WIN) + cmdShell = QString("c:/windows/system32/cmd.exe"); +#else + cmdShell = QString("bash"); +#endif + fgProcess = NULL; + widget = new Ui_HITLWidget(); + widget->setupUi(this); + connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); + connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); +} + +HITLWidget::~HITLWidget() +{ + delete widget; +} + +void HITLWidget::startButtonClicked() +{ + // Stop running process if one is active + if (fgProcess != NULL) + { + stopButtonClicked(); + } + + // Copy FlightGear generic protocol configuration file to the FG protocol directory + // NOTE: Not working on Windows 7, if FG is installed in the "Program Files", + // likelly due to permissions. The file should be manually copied to data/Protocol/opfgprotocol.xml + QFile xmlFile(":/flightgear/genericprotocol/opfgprotocol.xml"); + xmlFile.open(QIODevice::ReadOnly | QIODevice::Text); + QString xml = xmlFile.readAll(); + xmlFile.close(); + QFile xmlFileOut(fgPathData + "/Protocol/opfgprotocol.xml"); + xmlFileOut.open(QIODevice::WriteOnly | QIODevice::Text); + xmlFileOut.write(xml.toAscii()); + xmlFileOut.close(); + + // Setup process + widget->textBrowser->append(QString("Starting FlightGear ...\n")); + qxtLog->info("HITL: Starting FlightGear"); + fgProcess = new QProcess(); + fgProcess->setReadChannelMode(QProcess::MergedChannels); + connect(fgProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(processReadyRead())); + + // Start shell (Note: Could not start FG directly on Windows, only through terminal!) + fgProcess->start(cmdShell); + if (fgProcess->waitForStarted() == false) + { + widget->textBrowser->append("Error:" + fgProcess->errorString()); + } + + // Setup arguments + // Note: The input generic protocol is set to update at a much higher rate than the actual updates are sent by the GCS. + // If this is not done then a lag will be introduced by FlightGear, likelly because the receive socket buffer builds up during startup. + QString args("--fg-root=\"" + fgPathData + "\" --timeofday=dusk --httpd=5400 --enable-hud --in-air --altitude=2000 --vc=100 --generic=socket,out,50,localhost,5500,udp,opfgprotocol"); + if ( !fgManualControl ) + { + args.append(" --generic=socket,in,400,localhost,5501,udp,opfgprotocol"); + } + + // Start FlightGear + QString cmd; + cmd = "\"" + fgPathBin + "\" " + args + "\n"; + fgProcess->write(cmd.toAscii()); + + // Start bridge + qxtLog->info("HITL: Starting bridge, initializing FlighGear and Autopilot connections"); + fgBridge = new FlightGearBridge(); + connect(fgBridge, SIGNAL(autopilotConnected()), this, SLOT(onAutopilotConnect())); + connect(fgBridge, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); + connect(fgBridge, SIGNAL(fgConnected()), this, SLOT(onFGConnect())); + connect(fgBridge, SIGNAL(fgDisconnected()), this, SLOT(onFGDisconnect())); + + // Initialize connection status + if ( fgBridge->isAutopilotConnected() ) + { + onAutopilotConnect(); + } + else + { + onAutopilotDisconnect(); + } + if ( fgBridge->isFGConnected() ) + { + onFGConnect(); + } + else + { + onFGDisconnect(); + } +} + +void HITLWidget::stopButtonClicked() +{ + // NOTE: Does not currently work, may need to send control+c to through the terminal + if (fgProcess != NULL) + { + fgProcess->disconnect(this); + fgProcess->kill(); + delete fgProcess; + fgBridge->disconnect(this); + delete fgBridge; + fgProcess = NULL; + } +} + +void HITLWidget::setFGPathBin(QString fgPath) +{ + this->fgPathBin = fgPath; +} + +void HITLWidget::setFGPathData(QString fgPath) +{ + this->fgPathData = fgPath; +} + +void HITLWidget::setFGManualControl(bool val) +{ + this->fgManualControl = val; +} + +void HITLWidget::processReadyRead() +{ + QByteArray bytes = fgProcess->readAllStandardOutput(); + QString str(bytes); + if ( !str.contains("Error reading data") ) // ignore error + { + widget->textBrowser->append(str); + } +} + +void HITLWidget::onAutopilotConnect() +{ + QPalette pal(widget->apLabel->palette()); + pal.setColor(QPalette::Window, Qt::green); + widget->apLabel->setPalette(pal); + widget->apLabel->setAutoFillBackground(true); + widget->apLabel->setText("AutoPilot Connected"); + qxtLog->info("HITL: Autopilot connected, initializing for HITL simulation"); +} + +void HITLWidget::onAutopilotDisconnect() +{ + QPalette pal(widget->apLabel->palette()); + pal.setColor(QPalette::Window, Qt::red); + widget->apLabel->setPalette(pal); + widget->apLabel->setAutoFillBackground(true); + widget->apLabel->setText("AutoPilot Disconnected"); + qxtLog->info("HITL: Autopilot disconnected"); +} + +void HITLWidget::onFGConnect() +{ + QPalette pal(widget->fgLabel->palette()); + pal.setColor(QPalette::Window, Qt::green); + widget->fgLabel->setPalette(pal); + widget->fgLabel->setAutoFillBackground(true); + widget->fgLabel->setText("FlightGear Connected"); + qxtLog->info("HITL: FlighGear connected"); +} + +void HITLWidget::onFGDisconnect() +{ + QPalette pal(widget->fgLabel->palette()); + pal.setColor(QPalette::Window, Qt::red); + widget->fgLabel->setPalette(pal); + widget->fgLabel->setAutoFillBackground(true); + widget->fgLabel->setText("FlightGear Disconnected"); + qxtLog->info("HITL: FlighGear disconnected"); +} + + diff --git a/ground/src/plugins/hitl/hitlwidget.h b/ground/src/plugins/hitl/hitlwidget.h index 13182f2b1..9b8f605f3 100644 --- a/ground/src/plugins/hitl/hitlwidget.h +++ b/ground/src/plugins/hitl/hitlwidget.h @@ -1,70 +1,70 @@ -/** - ****************************************************************************** - * - * @file hitlwidget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup hitl - * @{ - * - *****************************************************************************/ -/* - * 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 HITLWIDGET_H -#define HITLWIDGET_H - -#include -#include -#include "flightgearbridge.h" - -class Ui_HITLWidget; - -class HITLWidget : public QWidget -{ - Q_OBJECT - -public: - HITLWidget(QWidget *parent = 0); - ~HITLWidget(); - - void setFGPathBin(QString fgPath); - void setFGPathData(QString fgPath); - void setFGManualControl(bool val); - -public slots: - -private slots: - void startButtonClicked(); - void stopButtonClicked(); - void processReadyRead(); - void onAutopilotConnect(); - void onAutopilotDisconnect(); - void onFGConnect(); - void onFGDisconnect(); - -private: - Ui_HITLWidget* widget; - FlightGearBridge* fgBridge; - QProcess* fgProcess; - QString fgPathBin; - QString fgPathData; - bool fgManualControl; - QString cmdShell; -}; - -#endif /* HITLWIDGET_H */ +/** + ****************************************************************************** + * + * @file hitlwidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup hitlplugin + * @{ + * + *****************************************************************************/ +/* + * 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 HITLWIDGET_H +#define HITLWIDGET_H + +#include +#include +#include "flightgearbridge.h" + +class Ui_HITLWidget; + +class HITLWidget : public QWidget +{ + Q_OBJECT + +public: + HITLWidget(QWidget *parent = 0); + ~HITLWidget(); + + void setFGPathBin(QString fgPath); + void setFGPathData(QString fgPath); + void setFGManualControl(bool val); + +public slots: + +private slots: + void startButtonClicked(); + void stopButtonClicked(); + void processReadyRead(); + void onAutopilotConnect(); + void onAutopilotDisconnect(); + void onFGConnect(); + void onFGDisconnect(); + +private: + Ui_HITLWidget* widget; + FlightGearBridge* fgBridge; + QProcess* fgProcess; + QString fgPathBin; + QString fgPathData; + bool fgManualControl; + QString cmdShell; +}; + +#endif /* HITLWIDGET_H */ diff --git a/ground/src/plugins/lineardial/lineardialgadget.cpp b/ground/src/plugins/lineardial/lineardialgadget.cpp index 180076e8c..eec8147bc 100644 --- a/ground/src/plugins/lineardial/lineardialgadget.cpp +++ b/ground/src/plugins/lineardial/lineardialgadget.cpp @@ -1,58 +1,58 @@ -/** - ****************************************************************************** - * - * @file lineardialgadget.cpp - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 "lineardialgadget.h" -#include "lineardialgadgetwidget.h" -#include "lineardialgadgetconfiguration.h" - -LineardialGadget::LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget) -{ -} - -LineardialGadget::~LineardialGadget() -{ -} - -/* - 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 LineardialGadget::loadConfiguration(IUAVGadgetConfiguration* config) -{ - LineardialGadgetConfiguration *m = qobject_cast(config); - m_widget->setRange(m->getMin(),m->getMax()); - m_widget->setGreenRange(m->getGreenMin(), m->getGreenMax()); - m_widget->setYellowRange(m->getYellowMin(), m->getYellowMax()); - m_widget->setRedRange(m->getRedMin(), m->getRedMax()); - m_widget->connectInput(m->getSourceDataObject(), m->getSourceObjectField()); - m_widget->setDialFile(m->getDialFile()); // Triggers widget repaint - m_widget->setDialFont(m->getFont()); -} +/** + ****************************************************************************** + * + * @file lineardialgadget.cpp + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "lineardialgadget.h" +#include "lineardialgadgetwidget.h" +#include "lineardialgadgetconfiguration.h" + +LineardialGadget::LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget) +{ +} + +LineardialGadget::~LineardialGadget() +{ +} + +/* + 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 LineardialGadget::loadConfiguration(IUAVGadgetConfiguration* config) +{ + LineardialGadgetConfiguration *m = qobject_cast(config); + m_widget->setRange(m->getMin(),m->getMax()); + m_widget->setGreenRange(m->getGreenMin(), m->getGreenMax()); + m_widget->setYellowRange(m->getYellowMin(), m->getYellowMax()); + m_widget->setRedRange(m->getRedMin(), m->getRedMax()); + m_widget->connectInput(m->getSourceDataObject(), m->getSourceObjectField()); + m_widget->setDialFile(m->getDialFile()); // Triggers widget repaint + m_widget->setDialFont(m->getFont()); +} diff --git a/ground/src/plugins/lineardial/lineardialgadget.h b/ground/src/plugins/lineardial/lineardialgadget.h index 424701e0e..64f125df2 100644 --- a/ground/src/plugins/lineardial/lineardialgadget.h +++ b/ground/src/plugins/lineardial/lineardialgadget.h @@ -1,56 +1,56 @@ -/** - ****************************************************************************** - * - * @file lineardialgadget.h - * @author Edouard Lafargue Copyright (C) 2010. - * @brief Bargraph gadget with red/yellow/green zones - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 LINEARDIALGADGET_H_ -#define LINEARDIALGADGET_H_ - -#include -#include "lineardialgadgetwidget.h" - -class IUAVGadget; -class QWidget; -class QString; -class LineardialGadgetWidget; - -using namespace Core; - -class LineardialGadget : public Core::IUAVGadget -{ - Q_OBJECT -public: - LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent = 0); - ~LineardialGadget(); - - QWidget *widget() { return m_widget; } - void loadConfiguration(IUAVGadgetConfiguration* config); - -private: - LineardialGadgetWidget *m_widget; -}; - - -#endif // LINEARDIALGADGET_H_ +/** + ****************************************************************************** + * + * @file lineardialgadget.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief Bargraph gadget with red/yellow/green zones + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 LINEARDIALGADGET_H_ +#define LINEARDIALGADGET_H_ + +#include +#include "lineardialgadgetwidget.h" + +class IUAVGadget; +class QWidget; +class QString; +class LineardialGadgetWidget; + +using namespace Core; + +class LineardialGadget : public Core::IUAVGadget +{ + Q_OBJECT +public: + LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent = 0); + ~LineardialGadget(); + + QWidget *widget() { return m_widget; } + void loadConfiguration(IUAVGadgetConfiguration* config); + +private: + LineardialGadgetWidget *m_widget; +}; + + +#endif // LINEARDIALGADGET_H_ diff --git a/ground/src/plugins/lineardial/lineardialgadgetconfiguration.cpp b/ground/src/plugins/lineardial/lineardialgadgetconfiguration.cpp index 61ea20e38..d8f2b6fc6 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetconfiguration.cpp +++ b/ground/src/plugins/lineardial/lineardialgadgetconfiguration.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Linear dial Plugin Gadget configuration * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial + * @defgroup lineardialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/lineardial/lineardialgadgetconfiguration.h b/ground/src/plugins/lineardial/lineardialgadgetconfiguration.h index f9f463403..43fd1dca2 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetconfiguration.h +++ b/ground/src/plugins/lineardial/lineardialgadgetconfiguration.h @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Airspeed Plugin Gadget configuration * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial + * @defgroup lineardialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/lineardial/lineardialgadgetfactory.cpp b/ground/src/plugins/lineardial/lineardialgadgetfactory.cpp index c1ee706da..e88905f39 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetfactory.cpp +++ b/ground/src/plugins/lineardial/lineardialgadgetfactory.cpp @@ -1,60 +1,60 @@ -/** - ****************************************************************************** - * - * @file lineardialgadgetfactory.cpp - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 "lineardialgadgetfactory.h" -#include "lineardialgadgetwidget.h" -#include "lineardialgadget.h" -#include "lineardialgadgetconfiguration.h" -#include "lineardialgadgetoptionspage.h" -#include - -LineardialGadgetFactory::LineardialGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("LineardialGadget"), - tr("Bargraph Dial Gadget"), - parent) -{ -} - -LineardialGadgetFactory::~LineardialGadgetFactory() -{ -} - -Core::IUAVGadget* LineardialGadgetFactory::createGadget(QWidget *parent) -{ - LineardialGadgetWidget* gadgetWidget = new LineardialGadgetWidget(parent); - return new LineardialGadget(QString("LineardialGadget"), gadgetWidget, parent); -} - -IUAVGadgetConfiguration *LineardialGadgetFactory::createConfiguration(const QByteArray &state) -{ - return new LineardialGadgetConfiguration(QString("LineardialGadget"), state); -} - -IOptionsPage *LineardialGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) -{ - return new LineardialGadgetOptionsPage(qobject_cast(config)); -} - +/** + ****************************************************************************** + * + * @file lineardialgadgetfactory.cpp + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "lineardialgadgetfactory.h" +#include "lineardialgadgetwidget.h" +#include "lineardialgadget.h" +#include "lineardialgadgetconfiguration.h" +#include "lineardialgadgetoptionspage.h" +#include + +LineardialGadgetFactory::LineardialGadgetFactory(QObject *parent) : + IUAVGadgetFactory(QString("LineardialGadget"), + tr("Bargraph Dial Gadget"), + parent) +{ +} + +LineardialGadgetFactory::~LineardialGadgetFactory() +{ +} + +Core::IUAVGadget* LineardialGadgetFactory::createGadget(QWidget *parent) +{ + LineardialGadgetWidget* gadgetWidget = new LineardialGadgetWidget(parent); + return new LineardialGadget(QString("LineardialGadget"), gadgetWidget, parent); +} + +IUAVGadgetConfiguration *LineardialGadgetFactory::createConfiguration(const QByteArray &state) +{ + return new LineardialGadgetConfiguration(QString("LineardialGadget"), state); +} + +IOptionsPage *LineardialGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) +{ + return new LineardialGadgetOptionsPage(qobject_cast(config)); +} + diff --git a/ground/src/plugins/lineardial/lineardialgadgetfactory.h b/ground/src/plugins/lineardial/lineardialgadgetfactory.h index 6c3263a4f..063b7dfaf 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetfactory.h +++ b/ground/src/plugins/lineardial/lineardialgadgetfactory.h @@ -1,52 +1,52 @@ -/** - ****************************************************************************** - * - * @file lineardialgadgetfactory.h - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 LINEARDIALGADGETFACTORY_H_ -#define LINEARDIALGADGETFACTORY_H_ - -#include - -namespace Core { -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class LineardialGadgetFactory : public IUAVGadgetFactory -{ - Q_OBJECT -public: - LineardialGadgetFactory(QObject *parent = 0); - ~LineardialGadgetFactory(); - - Core::IUAVGadget *createGadget(QWidget *parent); - IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); - IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); -}; - -#endif // LINEARDIALGADGETFACTORY_H_ +/** + ****************************************************************************** + * + * @file lineardialgadgetfactory.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 LINEARDIALGADGETFACTORY_H_ +#define LINEARDIALGADGETFACTORY_H_ + +#include + +namespace Core { +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class LineardialGadgetFactory : public IUAVGadgetFactory +{ + Q_OBJECT +public: + LineardialGadgetFactory(QObject *parent = 0); + ~LineardialGadgetFactory(); + + Core::IUAVGadget *createGadget(QWidget *parent); + IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); + IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); +}; + +#endif // LINEARDIALGADGETFACTORY_H_ diff --git a/ground/src/plugins/lineardial/lineardialgadgetoptionspage.cpp b/ground/src/plugins/lineardial/lineardialgadgetoptionspage.cpp index 3df3bcc10..54a13dcee 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetoptionspage.cpp +++ b/ground/src/plugins/lineardial/lineardialgadgetoptionspage.cpp @@ -3,9 +3,9 @@ * * @file lineardialgadgetoptionspage.cpp * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Airspeed Plugin Gadget options page + * @brief Linear Dial Plugin Gadget options page * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial + * @defgroup lineardialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/lineardial/lineardialgadgetoptionspage.h b/ground/src/plugins/lineardial/lineardialgadgetoptionspage.h index d7f07ff1c..d1aa061ab 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetoptionspage.h +++ b/ground/src/plugins/lineardial/lineardialgadgetoptionspage.h @@ -3,9 +3,9 @@ * * @file lineardialgadgetoptionspage.h * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Airspeed Plugin Gadget options page + * @brief Linear Dial Plugin Gadget options page * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial + * @defgroup lineardialplugin * @{ * *****************************************************************************/ diff --git a/ground/src/plugins/lineardial/lineardialgadgetwidget.cpp b/ground/src/plugins/lineardial/lineardialgadgetwidget.cpp index 4ce905984..cbaa22c61 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetwidget.cpp +++ b/ground/src/plugins/lineardial/lineardialgadgetwidget.cpp @@ -1,320 +1,320 @@ -/** - ****************************************************************************** - * - * @file lineardialgadgetwidget.cpp - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 "lineardialgadgetwidget.h" - -#include -#include -#include - -LineardialGadgetWidget::LineardialGadgetWidget(QWidget *parent) : QGraphicsView(parent) -{ - setMinimumSize(32,32); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - setScene(new QGraphicsScene(this)); - - m_renderer = new QSvgRenderer(); - background = new QGraphicsSvgItem(); - foreground = new QGraphicsSvgItem(); - green = new QGraphicsSvgItem(); - yellow = new QGraphicsSvgItem(); - red = new QGraphicsSvgItem(); - index = new QGraphicsSvgItem(); - fieldName = new QGraphicsTextItem("Field"); - fieldName->setDefaultTextColor(QColor("White")); - fieldValue = new QGraphicsTextItem("0.00"); - fieldValue->setDefaultTextColor(QColor("White")); - verticalDial = false; - - paint(); - - obj1 = NULL; - indexTarget = 0; - indexValue = 0; - - // This timer mechanism makes the index rotate smoothly - connect(&dialTimer, SIGNAL(timeout()), this, SLOT(moveIndex())); - dialTimer.start(30); - -#if 0 - // Test code for timer to move the index - testSpeed=0; - connect(&m_testTimer, SIGNAL(timeout()), this, SLOT(testRotate())); - m_testTimer.start(1000); -#endif -} - -LineardialGadgetWidget::~LineardialGadgetWidget() -{ - // Do nothing -} - -/*! - \brief Connects the widget to the relevant UAVObjects - */ -void LineardialGadgetWidget::connectInput(QString object1, QString nfield1) { - - if (obj1 != NULL) - disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateIndex(UAVObject*))); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - - std::cout << "Lineadial Connect needles - " << object1.toStdString() << "-"<< nfield1.toStdString() << std::endl; - - // Check validity of arguments first, reject empty args and unknown fields. - if (!(object1.isEmpty() || nfield1.isEmpty())) { - obj1 = dynamic_cast( objManager->getObject(object1) ); - if (obj1 != NULL ) { - connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateIndex(UAVObject*))); - field1 = nfield1; - fieldName->setPlainText(nfield1); - } else { - std::cout << "Error: Object is unknown (" << object1.toStdString() << ") this should not happen." << std::endl; - } - } -} - -/*! - \brief Called by the UAVObject which got updated - */ -void LineardialGadgetWidget::updateIndex(UAVObject *object1) { - // Double check that the field exists: - UAVObjectField* field = object1->getField(field1); - if (field) { - double v = field->getDouble(); - setIndex(v); - QString s; - s.sprintf("%.2f",v); - fieldValue->setPlainText(s); - } else { - std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; - } -} - -void LineardialGadgetWidget::setDialFile(QString dfn) -{ - if (QFile::exists(dfn)) - { - m_renderer->load(dfn); - if(m_renderer->isValid()) - { - fgenabled = false; - - background->setSharedRenderer(m_renderer); - background->setElementId("background"); - index->setSharedRenderer(m_renderer); - index->setElementId("needle"); - green->setSharedRenderer(m_renderer); - green->setElementId("green"); - yellow->setSharedRenderer(m_renderer); - yellow->setElementId("yellow"); - red->setSharedRenderer(m_renderer); - red->setElementId("red"); - - if (m_renderer->elementExists("foreground")) { - foreground->setSharedRenderer(m_renderer); - foreground->setElementId("foreground"); - fgenabled = true; - } - //std::cout<<"Dial file loaded"<matrixForElement("field"); - startX = textMatrix.mapRect(m_renderer->boundsOnElement("field")).x(); - startY = textMatrix.mapRect(m_renderer->boundsOnElement("field")).y(); - QTransform matrix; - matrix.translate(startX,startY); - fieldName->setTransform(matrix,false); - - textMatrix = m_renderer->matrixForElement("value"); - startX = textMatrix.mapRect(m_renderer->boundsOnElement("value")).x(); - startY = textMatrix.mapRect(m_renderer->boundsOnElement("value")).y(); - matrix.reset(); - matrix.translate(startX,startY); - fieldValue->setTransform(matrix,false); - - // In order to properly render the Green/Yellow/Red graphs, we need to find out - // the starting location of the bargraph rendering area: - textMatrix = m_renderer->matrixForElement("bargraph"); - startX = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).x(); - startY = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).y(); - //std::cout << "StartX: " << startX << std::endl; - //std::cout << "StartY: " << startY << std::endl; - bargraphSize = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).width(); - // Detect if the bargraph is vertical or horizontal. - qreal bargraphHeight = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).height(); - if (bargraphHeight > bargraphSize) { - verticalDial = true; - bargraphSize = bargraphHeight; - } else { - verticalDial = false; - } - - // Move the index to its base position: - indexHeight = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).height(); - indexWidth = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).width(); - matrix.reset(); - matrix.translate(startX-indexWidth/2,startY-indexHeight/2); - index->setTransform(matrix,false); - - // Now adjust the red/yellow/green zones: - double range = maxValue-minValue; - - green->resetTransform(); - double greenScale = (greenMax-greenMin)/range; - double greenStart = verticalDial ? (maxValue-greenMax)/range*green->boundingRect().height() : - (greenMin-minValue)/range*green->boundingRect().width(); - matrix.reset(); - if (verticalDial) { - matrix.scale(1,greenScale); - matrix.translate(startX,(greenStart+startY)/greenScale); - } else { - matrix.scale(greenScale,1); - matrix.translate((greenStart+startX)/greenScale,startY); - } - green->setTransform(matrix,false); - - yellow->resetTransform(); - double yellowScale = (yellowMax-yellowMin)/range; - double yellowStart = verticalDial ? (maxValue-yellowMax)/range*yellow->boundingRect().height() : - (yellowMin-minValue)/range*yellow->boundingRect().width(); - matrix.reset(); - if (verticalDial) { - matrix.scale(1,yellowScale); - matrix.translate(startX,(yellowStart+startY)/yellowScale); - } else { - matrix.scale(yellowScale,1); - matrix.translate((yellowStart+startX)/yellowScale,startY); - } - yellow->setTransform(matrix,false); - - red->resetTransform(); - double redScale = (redMax-redMin)/range; - double redStart = verticalDial ? (maxValue-redMax)/range*red->boundingRect().height() : - (redMin-minValue)/range*red->boundingRect().width(); - matrix.reset(); - if (verticalDial) { - matrix.scale(1,redScale); - matrix.translate(startX,(redStart+startY)/redScale); - } else { - matrix.scale(redScale,1); - matrix.translate((redStart+startX)/redScale,startY); - } - red->setTransform(matrix,false); - - l_scene->setSceneRect(background->boundingRect()); - - } - } - else - { std::cout<<"no file: "<setFont(font); - fieldValue->setFont(font); -} - - -void LineardialGadgetWidget::paint() -{ - QGraphicsScene *l_scene = scene(); - l_scene->clear(); // Beware: clear also deletes all objects - // which are currently in the scene - l_scene->addItem(background); - // Order is important: red, then yellow then green - // overlayed on top of each other - l_scene->addItem(red); - l_scene->addItem(yellow); - l_scene->addItem(green); - l_scene->addItem(index); - l_scene->addItem(fieldName); - l_scene->addItem(fieldValue); - l_scene->addItem(foreground); - update(); -} - -void LineardialGadgetWidget::paintEvent(QPaintEvent *event) -{ - // Skip painting until the dial file is loaded - if (! m_renderer->isValid()) { - std::cout<<"Dial file not loaded, not rendering"< 3)) { - indexValue += (indexTarget - indexValue)/5; - index->resetTransform(); - qreal factor = indexValue*bargraphSize/100; - QTransform matrix; - if (verticalDial) { - matrix.translate(startX-indexWidth/2,factor+startY-indexHeight/2); - } else { - matrix.translate(factor+startX-indexWidth/2,startY-indexHeight/2); - } - index->setTransform(matrix,false); - update(); - } -} - - -// Test function for timer to rotate needles -void LineardialGadgetWidget::testRotate() -{ - testVal=0; - if (testVal > maxValue) testVal=minValue; - setIndex((double)testVal); -} +/** + ****************************************************************************** + * + * @file lineardialgadgetwidget.cpp + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "lineardialgadgetwidget.h" + +#include +#include +#include + +LineardialGadgetWidget::LineardialGadgetWidget(QWidget *parent) : QGraphicsView(parent) +{ + setMinimumSize(32,32); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + setScene(new QGraphicsScene(this)); + + m_renderer = new QSvgRenderer(); + background = new QGraphicsSvgItem(); + foreground = new QGraphicsSvgItem(); + green = new QGraphicsSvgItem(); + yellow = new QGraphicsSvgItem(); + red = new QGraphicsSvgItem(); + index = new QGraphicsSvgItem(); + fieldName = new QGraphicsTextItem("Field"); + fieldName->setDefaultTextColor(QColor("White")); + fieldValue = new QGraphicsTextItem("0.00"); + fieldValue->setDefaultTextColor(QColor("White")); + verticalDial = false; + + paint(); + + obj1 = NULL; + indexTarget = 0; + indexValue = 0; + + // This timer mechanism makes the index rotate smoothly + connect(&dialTimer, SIGNAL(timeout()), this, SLOT(moveIndex())); + dialTimer.start(30); + +#if 0 + // Test code for timer to move the index + testSpeed=0; + connect(&m_testTimer, SIGNAL(timeout()), this, SLOT(testRotate())); + m_testTimer.start(1000); +#endif +} + +LineardialGadgetWidget::~LineardialGadgetWidget() +{ + // Do nothing +} + +/*! + \brief Connects the widget to the relevant UAVObjects + */ +void LineardialGadgetWidget::connectInput(QString object1, QString nfield1) { + + if (obj1 != NULL) + disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateIndex(UAVObject*))); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager *objManager = pm->getObject(); + + std::cout << "Lineadial Connect needles - " << object1.toStdString() << "-"<< nfield1.toStdString() << std::endl; + + // Check validity of arguments first, reject empty args and unknown fields. + if (!(object1.isEmpty() || nfield1.isEmpty())) { + obj1 = dynamic_cast( objManager->getObject(object1) ); + if (obj1 != NULL ) { + connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateIndex(UAVObject*))); + field1 = nfield1; + fieldName->setPlainText(nfield1); + } else { + std::cout << "Error: Object is unknown (" << object1.toStdString() << ") this should not happen." << std::endl; + } + } +} + +/*! + \brief Called by the UAVObject which got updated + */ +void LineardialGadgetWidget::updateIndex(UAVObject *object1) { + // Double check that the field exists: + UAVObjectField* field = object1->getField(field1); + if (field) { + double v = field->getDouble(); + setIndex(v); + QString s; + s.sprintf("%.2f",v); + fieldValue->setPlainText(s); + } else { + std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl; + } +} + +void LineardialGadgetWidget::setDialFile(QString dfn) +{ + if (QFile::exists(dfn)) + { + m_renderer->load(dfn); + if(m_renderer->isValid()) + { + fgenabled = false; + + background->setSharedRenderer(m_renderer); + background->setElementId("background"); + index->setSharedRenderer(m_renderer); + index->setElementId("needle"); + green->setSharedRenderer(m_renderer); + green->setElementId("green"); + yellow->setSharedRenderer(m_renderer); + yellow->setElementId("yellow"); + red->setSharedRenderer(m_renderer); + red->setElementId("red"); + + if (m_renderer->elementExists("foreground")) { + foreground->setSharedRenderer(m_renderer); + foreground->setElementId("foreground"); + fgenabled = true; + } + //std::cout<<"Dial file loaded"<matrixForElement("field"); + startX = textMatrix.mapRect(m_renderer->boundsOnElement("field")).x(); + startY = textMatrix.mapRect(m_renderer->boundsOnElement("field")).y(); + QTransform matrix; + matrix.translate(startX,startY); + fieldName->setTransform(matrix,false); + + textMatrix = m_renderer->matrixForElement("value"); + startX = textMatrix.mapRect(m_renderer->boundsOnElement("value")).x(); + startY = textMatrix.mapRect(m_renderer->boundsOnElement("value")).y(); + matrix.reset(); + matrix.translate(startX,startY); + fieldValue->setTransform(matrix,false); + + // In order to properly render the Green/Yellow/Red graphs, we need to find out + // the starting location of the bargraph rendering area: + textMatrix = m_renderer->matrixForElement("bargraph"); + startX = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).x(); + startY = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).y(); + //std::cout << "StartX: " << startX << std::endl; + //std::cout << "StartY: " << startY << std::endl; + bargraphSize = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).width(); + // Detect if the bargraph is vertical or horizontal. + qreal bargraphHeight = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).height(); + if (bargraphHeight > bargraphSize) { + verticalDial = true; + bargraphSize = bargraphHeight; + } else { + verticalDial = false; + } + + // Move the index to its base position: + indexHeight = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).height(); + indexWidth = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).width(); + matrix.reset(); + matrix.translate(startX-indexWidth/2,startY-indexHeight/2); + index->setTransform(matrix,false); + + // Now adjust the red/yellow/green zones: + double range = maxValue-minValue; + + green->resetTransform(); + double greenScale = (greenMax-greenMin)/range; + double greenStart = verticalDial ? (maxValue-greenMax)/range*green->boundingRect().height() : + (greenMin-minValue)/range*green->boundingRect().width(); + matrix.reset(); + if (verticalDial) { + matrix.scale(1,greenScale); + matrix.translate(startX,(greenStart+startY)/greenScale); + } else { + matrix.scale(greenScale,1); + matrix.translate((greenStart+startX)/greenScale,startY); + } + green->setTransform(matrix,false); + + yellow->resetTransform(); + double yellowScale = (yellowMax-yellowMin)/range; + double yellowStart = verticalDial ? (maxValue-yellowMax)/range*yellow->boundingRect().height() : + (yellowMin-minValue)/range*yellow->boundingRect().width(); + matrix.reset(); + if (verticalDial) { + matrix.scale(1,yellowScale); + matrix.translate(startX,(yellowStart+startY)/yellowScale); + } else { + matrix.scale(yellowScale,1); + matrix.translate((yellowStart+startX)/yellowScale,startY); + } + yellow->setTransform(matrix,false); + + red->resetTransform(); + double redScale = (redMax-redMin)/range; + double redStart = verticalDial ? (maxValue-redMax)/range*red->boundingRect().height() : + (redMin-minValue)/range*red->boundingRect().width(); + matrix.reset(); + if (verticalDial) { + matrix.scale(1,redScale); + matrix.translate(startX,(redStart+startY)/redScale); + } else { + matrix.scale(redScale,1); + matrix.translate((redStart+startX)/redScale,startY); + } + red->setTransform(matrix,false); + + l_scene->setSceneRect(background->boundingRect()); + + } + } + else + { std::cout<<"no file: "<setFont(font); + fieldValue->setFont(font); +} + + +void LineardialGadgetWidget::paint() +{ + QGraphicsScene *l_scene = scene(); + l_scene->clear(); // Beware: clear also deletes all objects + // which are currently in the scene + l_scene->addItem(background); + // Order is important: red, then yellow then green + // overlayed on top of each other + l_scene->addItem(red); + l_scene->addItem(yellow); + l_scene->addItem(green); + l_scene->addItem(index); + l_scene->addItem(fieldName); + l_scene->addItem(fieldValue); + l_scene->addItem(foreground); + update(); +} + +void LineardialGadgetWidget::paintEvent(QPaintEvent *event) +{ + // Skip painting until the dial file is loaded + if (! m_renderer->isValid()) { + std::cout<<"Dial file not loaded, not rendering"< 3)) { + indexValue += (indexTarget - indexValue)/5; + index->resetTransform(); + qreal factor = indexValue*bargraphSize/100; + QTransform matrix; + if (verticalDial) { + matrix.translate(startX-indexWidth/2,factor+startY-indexHeight/2); + } else { + matrix.translate(factor+startX-indexWidth/2,startY-indexHeight/2); + } + index->setTransform(matrix,false); + update(); + } +} + + +// Test function for timer to rotate needles +void LineardialGadgetWidget::testRotate() +{ + testVal=0; + if (testVal > maxValue) testVal=minValue; + setIndex((double)testVal); +} diff --git a/ground/src/plugins/lineardial/lineardialgadgetwidget.h b/ground/src/plugins/lineardial/lineardialgadgetwidget.h index 5806640eb..a123c2e3f 100644 --- a/ground/src/plugins/lineardial/lineardialgadgetwidget.h +++ b/ground/src/plugins/lineardial/lineardialgadgetwidget.h @@ -1,125 +1,125 @@ -/** - ****************************************************************************** - * - * @file lineardialgadgetwidget.h - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 LINEARDIALGADGETWIDGET_H_ -#define LINEARDIALGADGETWIDGET_H_ - -#include "lineardialgadgetconfiguration.h" -#include "extensionsystem/pluginmanager.h" -#include "uavobjects/uavobjectmanager.h" -#include "uavobjects/uavobject.h" -#include -#include -#include - -#include -#include - -class LineardialGadgetWidget : public QGraphicsView -{ - Q_OBJECT - -public: - LineardialGadgetWidget(QWidget *parent = 0); - ~LineardialGadgetWidget(); - void setDialFile(QString dfn); - void paint(); - void setRange(double min, double max) { minValue=min; maxValue=max;} - void setGreenRange(double min, double max) {greenMin=min; greenMax=max;} - void setYellowRange(double min, double max) {yellowMin=min; yellowMax=max;} - void setRedRange(double min, double max) {redMin=min; redMax=max;} - void connectInput(QString obj, QString field); - void setIndex(double val); - void setDialFont(QString fontProps); - -public slots: - void updateIndex(UAVObject *object1); - - -protected: - void paintEvent(QPaintEvent *event); - void resizeEvent(QResizeEvent *event); - -private: - -private slots: - // Test function - void testRotate(); - void moveIndex(); - -private: - QSvgRenderer *m_renderer; - QGraphicsSvgItem *background; - QGraphicsSvgItem *foreground; - QGraphicsSvgItem *index; - QGraphicsSvgItem *green; - QGraphicsSvgItem *yellow; - QGraphicsSvgItem *red; - - QGraphicsTextItem *fieldName; - QGraphicsTextItem *fieldValue; - - // Simple flag to skip rendering if the - bool fgenabled; // layer does not exist. - bool verticalDial; // True if the dials scales vertically. - - qreal startX; // Where we should draw the bargraph - qreal startY; // green/yellow/red zones. - qreal bargraphSize; - qreal indexHeight; - qreal indexWidth; - - double testVal; - - double minValue; - double maxValue; - double greenMin; - double greenMax; - double yellowMin; - double yellowMax; - double redMin; - double redMax; - - // The Value and target variables - // are expressed in degrees - double indexTarget; - double indexValue; - - // Rotation timer - QTimer dialTimer; - - // Name of the fields to read when an update is received: - UAVDataObject* obj1; - QString field1; - - - // Test variables - int testSpeed; - QTimer m_testTimer; - // End test variables -}; -#endif /* LINEARDIALGADGETWIDGET_H_ */ +/** + ****************************************************************************** + * + * @file lineardialgadgetwidget.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 LINEARDIALGADGETWIDGET_H_ +#define LINEARDIALGADGETWIDGET_H_ + +#include "lineardialgadgetconfiguration.h" +#include "extensionsystem/pluginmanager.h" +#include "uavobjects/uavobjectmanager.h" +#include "uavobjects/uavobject.h" +#include +#include +#include + +#include +#include + +class LineardialGadgetWidget : public QGraphicsView +{ + Q_OBJECT + +public: + LineardialGadgetWidget(QWidget *parent = 0); + ~LineardialGadgetWidget(); + void setDialFile(QString dfn); + void paint(); + void setRange(double min, double max) { minValue=min; maxValue=max;} + void setGreenRange(double min, double max) {greenMin=min; greenMax=max;} + void setYellowRange(double min, double max) {yellowMin=min; yellowMax=max;} + void setRedRange(double min, double max) {redMin=min; redMax=max;} + void connectInput(QString obj, QString field); + void setIndex(double val); + void setDialFont(QString fontProps); + +public slots: + void updateIndex(UAVObject *object1); + + +protected: + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + +private: + +private slots: + // Test function + void testRotate(); + void moveIndex(); + +private: + QSvgRenderer *m_renderer; + QGraphicsSvgItem *background; + QGraphicsSvgItem *foreground; + QGraphicsSvgItem *index; + QGraphicsSvgItem *green; + QGraphicsSvgItem *yellow; + QGraphicsSvgItem *red; + + QGraphicsTextItem *fieldName; + QGraphicsTextItem *fieldValue; + + // Simple flag to skip rendering if the + bool fgenabled; // layer does not exist. + bool verticalDial; // True if the dials scales vertically. + + qreal startX; // Where we should draw the bargraph + qreal startY; // green/yellow/red zones. + qreal bargraphSize; + qreal indexHeight; + qreal indexWidth; + + double testVal; + + double minValue; + double maxValue; + double greenMin; + double greenMax; + double yellowMin; + double yellowMax; + double redMin; + double redMax; + + // The Value and target variables + // are expressed in degrees + double indexTarget; + double indexValue; + + // Rotation timer + QTimer dialTimer; + + // Name of the fields to read when an update is received: + UAVDataObject* obj1; + QString field1; + + + // Test variables + int testSpeed; + QTimer m_testTimer; + // End test variables +}; +#endif /* LINEARDIALGADGETWIDGET_H_ */ diff --git a/ground/src/plugins/lineardial/lineardialplugin.cpp b/ground/src/plugins/lineardial/lineardialplugin.cpp index c8587f067..24629ca35 100644 --- a/ground/src/plugins/lineardial/lineardialplugin.cpp +++ b/ground/src/plugins/lineardial/lineardialplugin.cpp @@ -1,66 +1,66 @@ -/** - ****************************************************************************** - * - * @file lineardialplugin.h - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 "lineardialplugin.h" -#include "lineardialgadgetfactory.h" -#include -#include -#include -#include - - -LineardialPlugin::LineardialPlugin() -{ - // Do nothing -} - -LineardialPlugin::~LineardialPlugin() -{ - // Do nothing -} - -bool LineardialPlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mf = new LineardialGadgetFactory(this); - addAutoReleasedObject(mf); - - return true; -} - -void LineardialPlugin::extensionsInitialized() -{ - // Do nothing -} - -void LineardialPlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(LineardialPlugin) - +/** + ****************************************************************************** + * + * @file lineardialplugin.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "lineardialplugin.h" +#include "lineardialgadgetfactory.h" +#include +#include +#include +#include + + +LineardialPlugin::LineardialPlugin() +{ + // Do nothing +} + +LineardialPlugin::~LineardialPlugin() +{ + // Do nothing +} + +bool LineardialPlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mf = new LineardialGadgetFactory(this); + addAutoReleasedObject(mf); + + return true; +} + +void LineardialPlugin::extensionsInitialized() +{ + // Do nothing +} + +void LineardialPlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(LineardialPlugin) + diff --git a/ground/src/plugins/lineardial/lineardialplugin.h b/ground/src/plugins/lineardial/lineardialplugin.h index 55395bce7..9de3de843 100644 --- a/ground/src/plugins/lineardial/lineardialplugin.h +++ b/ground/src/plugins/lineardial/lineardialplugin.h @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file lineardialplugin.h - * @author Edouard Lafargue Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup lineardial - * @{ - * - *****************************************************************************/ -/* - * 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 LINEARDIALPLUGIN_H_ -#define LINEARDIALPLUGIN_H_ - -#include - -class LineardialGadgetFactory; - -class LineardialPlugin : public ExtensionSystem::IPlugin -{ -public: - LineardialPlugin(); - ~LineardialPlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - LineardialGadgetFactory *mf; -}; -#endif /* LINEARDIALPLUGIN_H_ */ +/** + ****************************************************************************** + * + * @file lineardialplugin.h + * @author Edouard Lafargue Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup lineardialplugin + * @{ + * + *****************************************************************************/ +/* + * 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 LINEARDIALPLUGIN_H_ +#define LINEARDIALPLUGIN_H_ + +#include + +class LineardialGadgetFactory; + +class LineardialPlugin : public ExtensionSystem::IPlugin +{ +public: + LineardialPlugin(); + ~LineardialPlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +private: + LineardialGadgetFactory *mf; +}; +#endif /* LINEARDIALPLUGIN_H_ */ diff --git a/ground/src/plugins/modelview/modelviewgadget.cpp b/ground/src/plugins/modelview/modelviewgadget.cpp index 8803da5ce..69e039907 100644 --- a/ground/src/plugins/modelview/modelviewgadget.cpp +++ b/ground/src/plugins/modelview/modelviewgadget.cpp @@ -1,50 +1,50 @@ -/** - ****************************************************************************** - * - * @file modelviewgadget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 "modelviewgadget.h" -#include "modelviewgadgetwidget.h" -#include "modelviewgadgetconfiguration.h" - -ModelViewGadget::ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget) -{ -} - -ModelViewGadget::~ModelViewGadget() -{ - -} - -void ModelViewGadget::loadConfiguration(IUAVGadgetConfiguration* config) -{ - ModelViewGadgetConfiguration *m = qobject_cast(config); - m_widget->setAcFilename(m->acFilename()); - m_widget->setBgFilename(m->bgFilename()); - m_widget->setVboEnable(m->vboEnabled()); - m_widget->reloadScene(); -} - +/** + ****************************************************************************** + * + * @file modelviewgadget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "modelviewgadget.h" +#include "modelviewgadgetwidget.h" +#include "modelviewgadgetconfiguration.h" + +ModelViewGadget::ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget) +{ +} + +ModelViewGadget::~ModelViewGadget() +{ + +} + +void ModelViewGadget::loadConfiguration(IUAVGadgetConfiguration* config) +{ + ModelViewGadgetConfiguration *m = qobject_cast(config); + m_widget->setAcFilename(m->acFilename()); + m_widget->setBgFilename(m->bgFilename()); + m_widget->setVboEnable(m->vboEnabled()); + m_widget->reloadScene(); +} + diff --git a/ground/src/plugins/modelview/modelviewgadget.h b/ground/src/plugins/modelview/modelviewgadget.h index 899bd4c7e..c323e0d07 100644 --- a/ground/src/plugins/modelview/modelviewgadget.h +++ b/ground/src/plugins/modelview/modelviewgadget.h @@ -1,56 +1,56 @@ -/** - ****************************************************************************** - * - * @file modelviewgadget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 MODELVIEWGADGET_H_ -#define MODELVIEWGADGET_H_ - -#include -#include "modelviewgadgetwidget.h" - -class IUAVGadget; -class QWidget; -class QString; -class ModelViewGadgetWidget; - -using namespace Core; - -class ModelViewGadget : public Core::IUAVGadget -{ - Q_OBJECT -public: - ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent = 0); - ~ModelViewGadget(); - - QWidget *widget() { return m_widget; } - void loadConfiguration(IUAVGadgetConfiguration* config); - -private: - ModelViewGadgetWidget *m_widget; -}; - - -#endif // MODELVIEWGADGET_H_ +/** + ****************************************************************************** + * + * @file modelviewgadget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 MODELVIEWGADGET_H_ +#define MODELVIEWGADGET_H_ + +#include +#include "modelviewgadgetwidget.h" + +class IUAVGadget; +class QWidget; +class QString; +class ModelViewGadgetWidget; + +using namespace Core; + +class ModelViewGadget : public Core::IUAVGadget +{ + Q_OBJECT +public: + ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent = 0); + ~ModelViewGadget(); + + QWidget *widget() { return m_widget; } + void loadConfiguration(IUAVGadgetConfiguration* config); + +private: + ModelViewGadgetWidget *m_widget; +}; + + +#endif // MODELVIEWGADGET_H_ diff --git a/ground/src/plugins/modelview/modelviewgadgetconfiguration.cpp b/ground/src/plugins/modelview/modelviewgadgetconfiguration.cpp index 07e473883..a53b89592 100644 --- a/ground/src/plugins/modelview/modelviewgadgetconfiguration.cpp +++ b/ground/src/plugins/modelview/modelviewgadgetconfiguration.cpp @@ -1,64 +1,64 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetconfiguration.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 "modelviewgadgetconfiguration.h" -#include - -ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) : - IUAVGadgetConfiguration(classId, parent), - m_acFilename("../artwork/3D Model/quad.dae"), - m_bgFilename("../artwork/3D Model/default_background.png"), - m_enableVbo(false) -{ - if (state.count() > 0) { - QDataStream stream(state); - stream >> m_acFilename; - stream >> m_bgFilename; - stream >> m_enableVbo; - } -} - -IUAVGadgetConfiguration *ModelViewGadgetConfiguration::clone() -{ - ModelViewGadgetConfiguration *mv = new ModelViewGadgetConfiguration(this->classId()); - mv->m_acFilename = m_acFilename; - mv->m_bgFilename = m_bgFilename; - mv->m_enableVbo = m_enableVbo; - return mv; -} - -QByteArray ModelViewGadgetConfiguration::saveState() const -{ - - QByteArray bytes; - QDataStream stream(&bytes, QIODevice::WriteOnly); - stream << m_acFilename; - stream << m_bgFilename; - stream << m_enableVbo; - return bytes; -} - +/** + ****************************************************************************** + * + * @file modelviewgadgetconfiguration.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "modelviewgadgetconfiguration.h" +#include + +ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) : + IUAVGadgetConfiguration(classId, parent), + m_acFilename("../artwork/3D Model/quad.dae"), + m_bgFilename("../artwork/3D Model/default_background.png"), + m_enableVbo(false) +{ + if (state.count() > 0) { + QDataStream stream(state); + stream >> m_acFilename; + stream >> m_bgFilename; + stream >> m_enableVbo; + } +} + +IUAVGadgetConfiguration *ModelViewGadgetConfiguration::clone() +{ + ModelViewGadgetConfiguration *mv = new ModelViewGadgetConfiguration(this->classId()); + mv->m_acFilename = m_acFilename; + mv->m_bgFilename = m_bgFilename; + mv->m_enableVbo = m_enableVbo; + return mv; +} + +QByteArray ModelViewGadgetConfiguration::saveState() const +{ + + QByteArray bytes; + QDataStream stream(&bytes, QIODevice::WriteOnly); + stream << m_acFilename; + stream << m_bgFilename; + stream << m_enableVbo; + return bytes; +} + diff --git a/ground/src/plugins/modelview/modelviewgadgetconfiguration.h b/ground/src/plugins/modelview/modelviewgadgetconfiguration.h index 8f9f5611a..f975ce920 100644 --- a/ground/src/plugins/modelview/modelviewgadgetconfiguration.h +++ b/ground/src/plugins/modelview/modelviewgadgetconfiguration.h @@ -1,58 +1,58 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetconfiguration.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 MODELVIEWGADGETCONFIGURATION_H -#define MODELVIEWGADGETCONFIGURATION_H - -#include - -using namespace Core; - -class ModelViewGadgetConfiguration : public IUAVGadgetConfiguration -{ -Q_OBJECT -public: - explicit ModelViewGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0); - QByteArray saveState() const; - IUAVGadgetConfiguration *clone(); - QString acFilename() {return m_acFilename;} - void setAcFilename(QString acFile) { m_acFilename = acFile; } - QString bgFilename() { return m_bgFilename; } - void setBgFilename(QString bgFile) { m_bgFilename = bgFile; } - bool vboEnabled() { return m_enableVbo; } - void setVboEnabled(bool vboEnable) { m_enableVbo = vboEnable; } -signals: - -public slots: - -private: - QString m_acFilename; - QString m_bgFilename; - bool m_enableVbo; // Vertex buffer objects, a few GPUs crash if enabled -}; - -#endif // MODELVIEWGADGETCONFIGURATION_H +/** + ****************************************************************************** + * + * @file modelviewgadgetconfiguration.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 MODELVIEWGADGETCONFIGURATION_H +#define MODELVIEWGADGETCONFIGURATION_H + +#include + +using namespace Core; + +class ModelViewGadgetConfiguration : public IUAVGadgetConfiguration +{ +Q_OBJECT +public: + explicit ModelViewGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0); + QByteArray saveState() const; + IUAVGadgetConfiguration *clone(); + QString acFilename() {return m_acFilename;} + void setAcFilename(QString acFile) { m_acFilename = acFile; } + QString bgFilename() { return m_bgFilename; } + void setBgFilename(QString bgFile) { m_bgFilename = bgFile; } + bool vboEnabled() { return m_enableVbo; } + void setVboEnabled(bool vboEnable) { m_enableVbo = vboEnable; } +signals: + +public slots: + +private: + QString m_acFilename; + QString m_bgFilename; + bool m_enableVbo; // Vertex buffer objects, a few GPUs crash if enabled +}; + +#endif // MODELVIEWGADGETCONFIGURATION_H diff --git a/ground/src/plugins/modelview/modelviewgadgetfactory.cpp b/ground/src/plugins/modelview/modelviewgadgetfactory.cpp index ae08a8ba1..f0bfa6b1e 100644 --- a/ground/src/plugins/modelview/modelviewgadgetfactory.cpp +++ b/ground/src/plugins/modelview/modelviewgadgetfactory.cpp @@ -1,59 +1,59 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetfactory.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 "modelviewgadgetfactory.h" -#include "modelviewgadgetwidget.h" -#include "modelviewgadget.h" -#include "modelviewgadgetconfiguration.h" -#include "modelviewgadgetoptionspage.h" -#include -#include - -ModelViewGadgetFactory::ModelViewGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("ModelViewGadget"), tr("ModelView Gadget"), parent) -{ -} - -ModelViewGadgetFactory::~ModelViewGadgetFactory() -{ -} - -Core::IUAVGadget* ModelViewGadgetFactory::createGadget(QWidget *parent) -{ - ModelViewGadgetWidget* gadgetWidget = new ModelViewGadgetWidget(parent); - return new ModelViewGadget(QString("ModelViewGadget"), gadgetWidget, parent); -} - -IUAVGadgetConfiguration *ModelViewGadgetFactory::createConfiguration(const QByteArray &state) -{ - return new ModelViewGadgetConfiguration(QString("ModelViewGadget"), state); -} - -IOptionsPage *ModelViewGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) -{ - return new ModelViewGadgetOptionsPage(qobject_cast(config)); -} - +/** + ****************************************************************************** + * + * @file modelviewgadgetfactory.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "modelviewgadgetfactory.h" +#include "modelviewgadgetwidget.h" +#include "modelviewgadget.h" +#include "modelviewgadgetconfiguration.h" +#include "modelviewgadgetoptionspage.h" +#include +#include + +ModelViewGadgetFactory::ModelViewGadgetFactory(QObject *parent) : + IUAVGadgetFactory(QString("ModelViewGadget"), tr("ModelView Gadget"), parent) +{ +} + +ModelViewGadgetFactory::~ModelViewGadgetFactory() +{ +} + +Core::IUAVGadget* ModelViewGadgetFactory::createGadget(QWidget *parent) +{ + ModelViewGadgetWidget* gadgetWidget = new ModelViewGadgetWidget(parent); + return new ModelViewGadget(QString("ModelViewGadget"), gadgetWidget, parent); +} + +IUAVGadgetConfiguration *ModelViewGadgetFactory::createConfiguration(const QByteArray &state) +{ + return new ModelViewGadgetConfiguration(QString("ModelViewGadget"), state); +} + +IOptionsPage *ModelViewGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) +{ + return new ModelViewGadgetOptionsPage(qobject_cast(config)); +} + diff --git a/ground/src/plugins/modelview/modelviewgadgetfactory.h b/ground/src/plugins/modelview/modelviewgadgetfactory.h index bd7197e48..d834ae86b 100644 --- a/ground/src/plugins/modelview/modelviewgadgetfactory.h +++ b/ground/src/plugins/modelview/modelviewgadgetfactory.h @@ -1,52 +1,52 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetfactory.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 MODELVIEWGADGETFACTORY_H_ -#define MODELVIEWGADGETFACTORY_H_ - -#include - -namespace Core { -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class ModelViewGadgetFactory : public Core::IUAVGadgetFactory -{ - Q_OBJECT -public: - ModelViewGadgetFactory(QObject *parent = 0); - ~ModelViewGadgetFactory(); - - Core::IUAVGadget *createGadget(QWidget *parent); - IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); - IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); -}; - -#endif // MODELVIEWGADGETFACTORY_H_ +/** + ****************************************************************************** + * + * @file modelviewgadgetfactory.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 MODELVIEWGADGETFACTORY_H_ +#define MODELVIEWGADGETFACTORY_H_ + +#include + +namespace Core { +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class ModelViewGadgetFactory : public Core::IUAVGadgetFactory +{ + Q_OBJECT +public: + ModelViewGadgetFactory(QObject *parent = 0); + ~ModelViewGadgetFactory(); + + Core::IUAVGadget *createGadget(QWidget *parent); + IUAVGadgetConfiguration *createConfiguration(const QByteArray &state); + IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); +}; + +#endif // MODELVIEWGADGETFACTORY_H_ diff --git a/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp b/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp index 8ecf48455..f2dac6489 100644 --- a/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp +++ b/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp @@ -1,71 +1,71 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetoptionspage.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 "modelviewgadgetoptionspage.h" -#include "modelviewgadgetconfiguration.h" - -#include "ui_modelviewoptionspage.h" - - -ModelViewGadgetOptionsPage::ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent) : - IOptionsPage(parent), - m_config(config) -{ -} - -QWidget *ModelViewGadgetOptionsPage::createPage(QWidget *parent) -{ - m_page = new Ui::ModelViewOptionsPage(); - QWidget *w = new QWidget(parent); - m_page->setupUi(w); - - m_page->modelPathChooser->setExpectedKind(Utils::PathChooser::File); - m_page->modelPathChooser->setPromptDialogFilter(tr("3D model (*.dae *.3ds)")); - m_page->modelPathChooser->setPromptDialogTitle(tr("Choose 3D model")); - m_page->backgroundPathChooser->setExpectedKind(Utils::PathChooser::File); - m_page->backgroundPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)")); - m_page->backgroundPathChooser->setPromptDialogTitle(tr("Choose background image")); - - - m_page->modelPathChooser->setPath(m_config->acFilename()); - m_page->backgroundPathChooser->setPath(m_config->bgFilename()); - - return w; -} - -void ModelViewGadgetOptionsPage::apply() -{ - m_config->setAcFilename(m_page->modelPathChooser->path()); - m_config->setBgFilename(m_page->backgroundPathChooser->path()); - m_config->setVboEnabled(m_page->enableVbo->isChecked()); -} - -void ModelViewGadgetOptionsPage::finish() -{ - delete m_page; -} - +/** + ****************************************************************************** + * + * @file modelviewgadgetoptionspage.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "modelviewgadgetoptionspage.h" +#include "modelviewgadgetconfiguration.h" + +#include "ui_modelviewoptionspage.h" + + +ModelViewGadgetOptionsPage::ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent) : + IOptionsPage(parent), + m_config(config) +{ +} + +QWidget *ModelViewGadgetOptionsPage::createPage(QWidget *parent) +{ + m_page = new Ui::ModelViewOptionsPage(); + QWidget *w = new QWidget(parent); + m_page->setupUi(w); + + m_page->modelPathChooser->setExpectedKind(Utils::PathChooser::File); + m_page->modelPathChooser->setPromptDialogFilter(tr("3D model (*.dae *.3ds)")); + m_page->modelPathChooser->setPromptDialogTitle(tr("Choose 3D model")); + m_page->backgroundPathChooser->setExpectedKind(Utils::PathChooser::File); + m_page->backgroundPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)")); + m_page->backgroundPathChooser->setPromptDialogTitle(tr("Choose background image")); + + + m_page->modelPathChooser->setPath(m_config->acFilename()); + m_page->backgroundPathChooser->setPath(m_config->bgFilename()); + + return w; +} + +void ModelViewGadgetOptionsPage::apply() +{ + m_config->setAcFilename(m_page->modelPathChooser->path()); + m_config->setBgFilename(m_page->backgroundPathChooser->path()); + m_config->setVboEnabled(m_page->enableVbo->isChecked()); +} + +void ModelViewGadgetOptionsPage::finish() +{ + delete m_page; +} + diff --git a/ground/src/plugins/modelview/modelviewgadgetoptionspage.h b/ground/src/plugins/modelview/modelviewgadgetoptionspage.h index c64ec6f23..fbf2dfc38 100644 --- a/ground/src/plugins/modelview/modelviewgadgetoptionspage.h +++ b/ground/src/plugins/modelview/modelviewgadgetoptionspage.h @@ -1,74 +1,74 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetoptionspage.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 MODELVIEWGADGETOPTIONSPAGE_H -#define MODELVIEWGADGETOPTIONSPAGE_H - -#include "coreplugin/dialogs/ioptionspage.h" -#include -#include -#include -#include -#include - -class ModelViewGadgetConfiguration; -class QFileDialog; -namespace Core { - class IUAVGadgetConfiguration; -} -namespace Ui { - class ModelViewOptionsPage; -} - -using namespace Core; - -class ModelViewGadgetOptionsPage : public IOptionsPage -{ -Q_OBJECT -public: - explicit ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent = 0); - QString id() const { return ""; } - QString trName() const { return ""; } - QString category() const { return ""; } - QString trCategory() const { return ""; } - - QWidget *createPage(QWidget *parent); - void apply(); - void finish(); -private: - -signals: - -public slots: -private slots: - -private: - ModelViewGadgetConfiguration *m_config; - Ui::ModelViewOptionsPage *m_page; -}; - -#endif // MODELVIEWGADGETOPTIONSPAGE_H +/** + ****************************************************************************** + * + * @file modelviewgadgetoptionspage.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 MODELVIEWGADGETOPTIONSPAGE_H +#define MODELVIEWGADGETOPTIONSPAGE_H + +#include "coreplugin/dialogs/ioptionspage.h" +#include +#include +#include +#include +#include + +class ModelViewGadgetConfiguration; +class QFileDialog; +namespace Core { + class IUAVGadgetConfiguration; +} +namespace Ui { + class ModelViewOptionsPage; +} + +using namespace Core; + +class ModelViewGadgetOptionsPage : public IOptionsPage +{ +Q_OBJECT +public: + explicit ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent = 0); + QString id() const { return ""; } + QString trName() const { return ""; } + QString category() const { return ""; } + QString trCategory() const { return ""; } + + QWidget *createPage(QWidget *parent); + void apply(); + void finish(); +private: + +signals: + +public slots: +private slots: + +private: + ModelViewGadgetConfiguration *m_config; + Ui::ModelViewOptionsPage *m_page; +}; + +#endif // MODELVIEWGADGETOPTIONSPAGE_H diff --git a/ground/src/plugins/modelview/modelviewgadgetwidget.cpp b/ground/src/plugins/modelview/modelviewgadgetwidget.cpp index b6c0dacc3..9862358af 100644 --- a/ground/src/plugins/modelview/modelviewgadgetwidget.cpp +++ b/ground/src/plugins/modelview/modelviewgadgetwidget.cpp @@ -1,200 +1,200 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetwidget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 "modelviewgadgetwidget.h" -#include "extensionsystem/pluginmanager.h" -#include - -ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent) -: QGLWidget(parent) -, m_pFactory(GLC_Factory::instance(this->context())) -, m_Light() -, m_World() -, m_GlView(this) -, m_MoverController() -, m_ModelBoundingBox() -, m_MotionTimer() -{ - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - - - m_Light.setPosition(4000.0, 40000.0, 80000.0); - m_Light.setAmbientColor(Qt::lightGray); - - QColor repColor; - repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0); - m_MoverController= m_pFactory->createDefaultMoverController(repColor, &m_GlView); - - m_GlView.cameraHandle()->setDefaultUpVector(glc::Y_AXIS); - m_GlView.cameraHandle()->setRightView(); - //m_GlView.cameraHandle()->setIsoView(); - - // Get required UAVObjects - ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager* objManager = pm->getObject(); - attActual = AttitudeActual::GetInstance(objManager); - - // Create objects to display - CreateScene(); - connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(updateAttitude())); -} - -ModelViewGadgetWidget::~ModelViewGadgetWidget() -{ - delete m_pFactory; -} - -//// Public funcitons //// -void ModelViewGadgetWidget::reloadScene() -{ - CreateScene(); -} - -//// Private functions //// -void ModelViewGadgetWidget::initializeGL() -{ - // OpenGL initialization - m_GlView.initGl(); - if (!vboEnable) - { - GLC_State::setVboUsage(false); - qDebug("VBOs disabled. Enable for better performance if GPU supports it."); - } - - m_GlView.reframe(m_ModelBoundingBox); - // Calculate camera depth of view - m_GlView.setDistMinAndMax(m_World.boundingBox()); - glEnable(GL_NORMALIZE); - - m_MotionTimer.start(100); -} - -void ModelViewGadgetWidget::resizeEvent(QResizeEvent *event) -{ -// m_GlView.setWinGLSize(width(), height()); - QWidget::resizeEvent(event); -} - -void ModelViewGadgetWidget::paintGL() -{ - // Clear screen - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - // Load identity matrix - glLoadIdentity(); - - // define the light - m_Light.enable(); - - // define view matrix - m_GlView.glExecuteCam(); - m_Light.glExecute(); - - // Display the collection of GLC_Object - m_World.glExecute(0, false); - - // Display UI Info (orbit circle) - m_MoverController.drawActiveMoverRep(); -} - -void ModelViewGadgetWidget::resizeGL(int width, int height) -{ - m_GlView.setWinGLSize(width, height); // Compute window aspect ratio -} - -// Create GLC_Object to display -void ModelViewGadgetWidget::CreateScene() -{ - if (QFile::exists(bgFilename)) - { - m_GlView.loadBackGroundImage(bgFilename); - } - //else { std::cout << "File doesn't exist" << bgFilename.toStdString() << std::endl; } - - if (QFile::exists(acFilename)) - { - QFile aircraft(acFilename); - - GLC_World* pWorld= m_pFactory->createWorld(aircraft); - m_World= *pWorld; - delete pWorld; - - m_ModelBoundingBox= m_World.boundingBox(); - } - //else { std::cout << "File doesn't exist" << acFilename.toStdString() << std::endl; } -} - -void ModelViewGadgetWidget::mousePressEvent(QMouseEvent *e) -{ - if (m_MoverController.hasActiveMover()) return; - - switch (e->button()) - { - case (Qt::LeftButton): - m_MotionTimer.stop(); - m_MoverController.setActiveMover(GLC_MoverController::TurnTable, e->x(), e->y()); - updateGL(); - break; - default: - break; - } -} - -void ModelViewGadgetWidget::mouseMoveEvent(QMouseEvent * e) -{ - if (not m_MoverController.hasActiveMover()) return; - m_MoverController.move(e->x(), e->y()); - m_GlView.setDistMinAndMax(m_World.boundingBox()); - updateGL(); -} - -void ModelViewGadgetWidget::mouseReleaseEvent(QMouseEvent*) -{ - if (not m_MoverController.hasActiveMover()) return; - m_MoverController.setNoMover(); - m_MotionTimer.start(); - updateGL(); -} - -////////////////////////////////////////////////////////////////////// -// Private slots Functions -////////////////////////////////////////////////////////////////////// -void ModelViewGadgetWidget::updateAttitude() -{ - // Reset view to zero angles - // NOTE: Some aircraft 3D models have different orientation and axis - m_GlView.cameraHandle()->setTopView(); - m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, 180.0*glc::PI/180.0); - m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, 90.0*glc::PI/180.0); - // Rotate to the actual angles (if a gimbal lock at yaw 90/270 deg, change sequence of rotations) - AttitudeActual::DataFields data = attActual->getData(); - m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, data.Yaw*glc::PI/180.0); - m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, data.Roll*glc::PI/180.0); - m_GlView.cameraHandle()->rotateAroundTarget(glc::Y_AXIS, -data.Pitch*glc::PI/180.0); - updateGL(); -} - - - +/** + ****************************************************************************** + * + * @file modelviewgadgetwidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "modelviewgadgetwidget.h" +#include "extensionsystem/pluginmanager.h" +#include + +ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent) +: QGLWidget(parent) +, m_pFactory(GLC_Factory::instance(this->context())) +, m_Light() +, m_World() +, m_GlView(this) +, m_MoverController() +, m_ModelBoundingBox() +, m_MotionTimer() +{ + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + + + m_Light.setPosition(4000.0, 40000.0, 80000.0); + m_Light.setAmbientColor(Qt::lightGray); + + QColor repColor; + repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0); + m_MoverController= m_pFactory->createDefaultMoverController(repColor, &m_GlView); + + m_GlView.cameraHandle()->setDefaultUpVector(glc::Y_AXIS); + m_GlView.cameraHandle()->setRightView(); + //m_GlView.cameraHandle()->setIsoView(); + + // Get required UAVObjects + ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager* objManager = pm->getObject(); + attActual = AttitudeActual::GetInstance(objManager); + + // Create objects to display + CreateScene(); + connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(updateAttitude())); +} + +ModelViewGadgetWidget::~ModelViewGadgetWidget() +{ + delete m_pFactory; +} + +//// Public funcitons //// +void ModelViewGadgetWidget::reloadScene() +{ + CreateScene(); +} + +//// Private functions //// +void ModelViewGadgetWidget::initializeGL() +{ + // OpenGL initialization + m_GlView.initGl(); + if (!vboEnable) + { + GLC_State::setVboUsage(false); + qDebug("VBOs disabled. Enable for better performance if GPU supports it."); + } + + m_GlView.reframe(m_ModelBoundingBox); + // Calculate camera depth of view + m_GlView.setDistMinAndMax(m_World.boundingBox()); + glEnable(GL_NORMALIZE); + + m_MotionTimer.start(100); +} + +void ModelViewGadgetWidget::resizeEvent(QResizeEvent *event) +{ +// m_GlView.setWinGLSize(width(), height()); + QWidget::resizeEvent(event); +} + +void ModelViewGadgetWidget::paintGL() +{ + // Clear screen + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + // Load identity matrix + glLoadIdentity(); + + // define the light + m_Light.enable(); + + // define view matrix + m_GlView.glExecuteCam(); + m_Light.glExecute(); + + // Display the collection of GLC_Object + m_World.glExecute(0, false); + + // Display UI Info (orbit circle) + m_MoverController.drawActiveMoverRep(); +} + +void ModelViewGadgetWidget::resizeGL(int width, int height) +{ + m_GlView.setWinGLSize(width, height); // Compute window aspect ratio +} + +// Create GLC_Object to display +void ModelViewGadgetWidget::CreateScene() +{ + if (QFile::exists(bgFilename)) + { + m_GlView.loadBackGroundImage(bgFilename); + } + //else { std::cout << "File doesn't exist" << bgFilename.toStdString() << std::endl; } + + if (QFile::exists(acFilename)) + { + QFile aircraft(acFilename); + + GLC_World* pWorld= m_pFactory->createWorld(aircraft); + m_World= *pWorld; + delete pWorld; + + m_ModelBoundingBox= m_World.boundingBox(); + } + //else { std::cout << "File doesn't exist" << acFilename.toStdString() << std::endl; } +} + +void ModelViewGadgetWidget::mousePressEvent(QMouseEvent *e) +{ + if (m_MoverController.hasActiveMover()) return; + + switch (e->button()) + { + case (Qt::LeftButton): + m_MotionTimer.stop(); + m_MoverController.setActiveMover(GLC_MoverController::TurnTable, e->x(), e->y()); + updateGL(); + break; + default: + break; + } +} + +void ModelViewGadgetWidget::mouseMoveEvent(QMouseEvent * e) +{ + if (not m_MoverController.hasActiveMover()) return; + m_MoverController.move(e->x(), e->y()); + m_GlView.setDistMinAndMax(m_World.boundingBox()); + updateGL(); +} + +void ModelViewGadgetWidget::mouseReleaseEvent(QMouseEvent*) +{ + if (not m_MoverController.hasActiveMover()) return; + m_MoverController.setNoMover(); + m_MotionTimer.start(); + updateGL(); +} + +////////////////////////////////////////////////////////////////////// +// Private slots Functions +////////////////////////////////////////////////////////////////////// +void ModelViewGadgetWidget::updateAttitude() +{ + // Reset view to zero angles + // NOTE: Some aircraft 3D models have different orientation and axis + m_GlView.cameraHandle()->setTopView(); + m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, 180.0*glc::PI/180.0); + m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, 90.0*glc::PI/180.0); + // Rotate to the actual angles (if a gimbal lock at yaw 90/270 deg, change sequence of rotations) + AttitudeActual::DataFields data = attActual->getData(); + m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, data.Yaw*glc::PI/180.0); + m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, data.Roll*glc::PI/180.0); + m_GlView.cameraHandle()->rotateAroundTarget(glc::Y_AXIS, -data.Pitch*glc::PI/180.0); + updateGL(); +} + + + diff --git a/ground/src/plugins/modelview/modelviewgadgetwidget.h b/ground/src/plugins/modelview/modelviewgadgetwidget.h index b57effe62..fdba94e88 100644 --- a/ground/src/plugins/modelview/modelviewgadgetwidget.h +++ b/ground/src/plugins/modelview/modelviewgadgetwidget.h @@ -1,96 +1,96 @@ -/** - ****************************************************************************** - * - * @file modelviewgadgetwidget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 MODELVIEWGADGETWIDGET_H_ -#define MODELVIEWGADGETWIDGET_H_ - -#include -#include - -#include -#include -#include -#include -#include - -#include "uavobjects/uavobjectmanager.h" -#include "uavobjects/attitudeactual.h" - - - -class ModelViewGadgetWidget : public QGLWidget -{ - Q_OBJECT - -public: - ModelViewGadgetWidget(QWidget *parent = 0); - ~ModelViewGadgetWidget(); - void setAcFilename(QString acf) { acFilename = acf; } - void setBgFilename(QString bgf) { bgFilename = bgf; } - void setVboEnable(bool eVbo) { vboEnable = eVbo; } - void reloadScene(); - void updateAttitude(int value); - -protected: - void resizeEvent(QResizeEvent *event); - -private: - void initializeGL(); - void paintGL(); - void resizeGL(int width, int height); - // Create GLC_Object to display - void CreateScene(); - - //Mouse events - void mousePressEvent(QMouseEvent * e); - void mouseMoveEvent(QMouseEvent * e); - void mouseReleaseEvent(QMouseEvent * e); - -////////////////////////////////////////////////////////////////////// -// Private slots Functions -////////////////////////////////////////////////////////////////////// -private slots: - void updateAttitude(); - -private: - GLC_Factory* m_pFactory; - GLC_Light m_Light; - GLC_World m_World; - GLC_Viewport m_GlView; - GLC_MoverController m_MoverController; - GLC_BoundingBox m_ModelBoundingBox; - //! The timer used for motion - QTimer m_MotionTimer; - - QString acFilename; - QString bgFilename; - bool vboEnable; - - AttitudeActual* attActual; -}; - -#endif /* MODELVIEWGADGETWIDGET_H_ */ +/** + ****************************************************************************** + * + * @file modelviewgadgetwidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 MODELVIEWGADGETWIDGET_H_ +#define MODELVIEWGADGETWIDGET_H_ + +#include +#include + +#include +#include +#include +#include +#include + +#include "uavobjects/uavobjectmanager.h" +#include "uavobjects/attitudeactual.h" + + + +class ModelViewGadgetWidget : public QGLWidget +{ + Q_OBJECT + +public: + ModelViewGadgetWidget(QWidget *parent = 0); + ~ModelViewGadgetWidget(); + void setAcFilename(QString acf) { acFilename = acf; } + void setBgFilename(QString bgf) { bgFilename = bgf; } + void setVboEnable(bool eVbo) { vboEnable = eVbo; } + void reloadScene(); + void updateAttitude(int value); + +protected: + void resizeEvent(QResizeEvent *event); + +private: + void initializeGL(); + void paintGL(); + void resizeGL(int width, int height); + // Create GLC_Object to display + void CreateScene(); + + //Mouse events + void mousePressEvent(QMouseEvent * e); + void mouseMoveEvent(QMouseEvent * e); + void mouseReleaseEvent(QMouseEvent * e); + +////////////////////////////////////////////////////////////////////// +// Private slots Functions +////////////////////////////////////////////////////////////////////// +private slots: + void updateAttitude(); + +private: + GLC_Factory* m_pFactory; + GLC_Light m_Light; + GLC_World m_World; + GLC_Viewport m_GlView; + GLC_MoverController m_MoverController; + GLC_BoundingBox m_ModelBoundingBox; + //! The timer used for motion + QTimer m_MotionTimer; + + QString acFilename; + QString bgFilename; + bool vboEnable; + + AttitudeActual* attActual; +}; + +#endif /* MODELVIEWGADGETWIDGET_H_ */ diff --git a/ground/src/plugins/modelview/modelviewplugin.cpp b/ground/src/plugins/modelview/modelviewplugin.cpp index c56aafa92..d343abdf1 100644 --- a/ground/src/plugins/modelview/modelviewplugin.cpp +++ b/ground/src/plugins/modelview/modelviewplugin.cpp @@ -1,65 +1,65 @@ -/** - ****************************************************************************** - * - * @file modelviewplugin.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 "modelviewplugin.h" -#include "modelviewgadgetfactory.h" -#include -#include -#include -#include - - -ModelViewPlugin::ModelViewPlugin() -{ - // Do nothing -} - -ModelViewPlugin::~ModelViewPlugin() -{ - // Do nothing -} - -bool ModelViewPlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mvf = new ModelViewGadgetFactory(this); - addAutoReleasedObject(mvf); - - return true; -} - -void ModelViewPlugin::extensionsInitialized() -{ - // Do nothing -} - -void ModelViewPlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(ModelViewPlugin) - +/** + ****************************************************************************** + * + * @file modelviewplugin.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 "modelviewplugin.h" +#include "modelviewgadgetfactory.h" +#include +#include +#include +#include + + +ModelViewPlugin::ModelViewPlugin() +{ + // Do nothing +} + +ModelViewPlugin::~ModelViewPlugin() +{ + // Do nothing +} + +bool ModelViewPlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mvf = new ModelViewGadgetFactory(this); + addAutoReleasedObject(mvf); + + return true; +} + +void ModelViewPlugin::extensionsInitialized() +{ + // Do nothing +} + +void ModelViewPlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(ModelViewPlugin) + diff --git a/ground/src/plugins/modelview/modelviewplugin.h b/ground/src/plugins/modelview/modelviewplugin.h index c28e06ee6..7b6930986 100644 --- a/ground/src/plugins/modelview/modelviewplugin.h +++ b/ground/src/plugins/modelview/modelviewplugin.h @@ -1,47 +1,47 @@ -/** - ****************************************************************************** - * - * @file modelviewplugin.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief - * @see The GNU Public License (GPL) Version 3 - * @defgroup modelview - * @{ - * - *****************************************************************************/ -/* - * 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 MODELVIEWPLUGIN_H_ -#define MODELVIEWPLUGIN_H_ - -#include - -class ModelViewGadgetFactory; - -class ModelViewPlugin : public ExtensionSystem::IPlugin -{ -public: - ModelViewPlugin(); - ~ModelViewPlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - ModelViewGadgetFactory *mvf; -}; -#endif /* MODELVIEWPLUGIN_H_ */ +/** + ****************************************************************************** + * + * @file modelviewplugin.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup modelviewplugin + * @{ + * + *****************************************************************************/ +/* + * 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 MODELVIEWPLUGIN_H_ +#define MODELVIEWPLUGIN_H_ + +#include + +class ModelViewGadgetFactory; + +class ModelViewPlugin : public ExtensionSystem::IPlugin +{ +public: + ModelViewPlugin(); + ~ModelViewPlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +private: + ModelViewGadgetFactory *mvf; +}; +#endif /* MODELVIEWPLUGIN_H_ */ diff --git a/ground/src/plugins/plugins.pro b/ground/src/plugins/plugins.pro index 3f271fc12..db58d9165 100644 --- a/ground/src/plugins/plugins.pro +++ b/ground/src/plugins/plugins.pro @@ -10,6 +10,13 @@ SUBDIRS = plugin_coreplugin #plugin_donothing.subdir = donothing #plugin_donothing.depends = plugin_coreplugin +# Another example, with more details such as options page +# Empty UAVGadget +#plugin_emptygadget.subdir = emptygadget +#plugin_emptygadget.depends = plugin_coreplugin +#SUBDIRS += plugin_emptygadget + + # Core Plugin plugin_coreplugin.subdir = coreplugin @@ -39,11 +46,6 @@ plugin_uavtalk.subdir = uavtalk plugin_uavtalk.depends = plugin_uavobjects plugin_uavtalk.depends += plugin_coreplugin -# Empty UAVGadget -plugin_emptygadget.subdir = emptygadget -plugin_emptygadget.depends = plugin_coreplugin -SUBDIRS += plugin_emptygadget - # Map UAVGadget plugin_map.subdir = map plugin_map.depends = plugin_coreplugin @@ -103,7 +105,7 @@ plugin_notify.depends = plugin_coreplugin plugin_notify.depends = plugin_uavobjects SUBDIRS += plugin_notify -#HITL simulation Gadget +#HITL Simulation Gadget plugin_hitl.subdir = hitl plugin_hitl.depends = plugin_coreplugin plugin_hitl.depends += plugin_uavobjects