diff --git a/ground/openpilotgcs/src/plugins/logging/LoggingGadget.pluginspec b/ground/openpilotgcs/src/plugins/logging/LoggingGadget.pluginspec index 91e512d82..b6f9214d0 100644 --- a/ground/openpilotgcs/src/plugins/logging/LoggingGadget.pluginspec +++ b/ground/openpilotgcs/src/plugins/logging/LoggingGadget.pluginspec @@ -6,5 +6,6 @@ http://www.openpilot.org + diff --git a/ground/openpilotgcs/src/plugins/logging/logging.pro b/ground/openpilotgcs/src/plugins/logging/logging.pro index b0a4fa7e3..8d10d54a3 100644 --- a/ground/openpilotgcs/src/plugins/logging/logging.pro +++ b/ground/openpilotgcs/src/plugins/logging/logging.pro @@ -3,8 +3,6 @@ TARGET = LoggingGadget DEFINES += LOGGING_LIBRARY QT += svg include(../../openpilotgcsplugin.pri) -include(../../plugins/uavobjects/uavobjects.pri) -include(../../plugins/uavtalk/uavtalk.pri) include(logging_dependencies.pri) HEADERS += loggingplugin.h \ logfile.h \ diff --git a/ground/openpilotgcs/src/plugins/logging/logging.ui b/ground/openpilotgcs/src/plugins/logging/logging.ui index e3a3812e7..b5fa5b110 100644 --- a/ground/openpilotgcs/src/plugins/logging/logging.ui +++ b/ground/openpilotgcs/src/plugins/logging/logging.ui @@ -27,16 +27,16 @@ - + - + QLayout::SetNoConstraint - + 30 0 @@ -59,7 +59,7 @@ - + 30 0 @@ -79,31 +79,6 @@ - - - - - 100 - 0 - - - - -100 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 50 - - - @@ -120,6 +95,43 @@ + + + + + + Playback speed: + + + + + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/ground/openpilotgcs/src/plugins/logging/logging_dependencies.pri b/ground/openpilotgcs/src/plugins/logging/logging_dependencies.pri index a64caedc1..563cb1ff1 100644 --- a/ground/openpilotgcs/src/plugins/logging/logging_dependencies.pri +++ b/ground/openpilotgcs/src/plugins/logging/logging_dependencies.pri @@ -1 +1,4 @@ include(../../plugins/coreplugin/coreplugin.pri) +include(../../plugins/uavobjects/uavobjects.pri) +include(../../plugins/uavtalk/uavtalk.pri) +include(../../plugins/scope/scope.pri) diff --git a/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.cpp b/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.cpp index 6c5b5303e..2d4063b66 100644 --- a/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.cpp @@ -1,68 +1,75 @@ -/** - ****************************************************************************** - * - * @file GCSControlgadgetwidget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin - * @{ - * @brief A gadget to control the UAV, either from the keyboard or a joystick - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * 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 "logginggadgetwidget.h" -#include "ui_logging.h" - -#include -#include -#include -#include -#include -#include -#include - -LoggingGadgetWidget::LoggingGadgetWidget(QWidget *parent) : QLabel(parent) -{ - m_logging = new Ui_Logging(); - m_logging->setupUi(this); -} - -LoggingGadgetWidget::~LoggingGadgetWidget() -{ - // Do nothing -} - -void LoggingGadgetWidget::setPlugin(LoggingPlugin * p) -{ - loggingPlugin = p; - connect(p,SIGNAL(stateChanged(QString)),this,SLOT(stateChanged(QString))); - connect(m_logging->playButton,SIGNAL(clicked()),p->getLogfile(),SLOT(resumeReplay())); - connect(m_logging->pauseButton,SIGNAL(clicked()),p->getLogfile(),SLOT(pauseReplay())); - connect(m_logging->playbackSpeed,SIGNAL(valueChanged(int)),p->getLogfile(),SLOT(setReplaySpeed(int))); - void pauseReplay(); - void resumeReplay(); -} - -void LoggingGadgetWidget::stateChanged(QString status) -{ - m_logging->statusLabel->setText(status); -} - -/** - * @} - * @} - */ +/** + ****************************************************************************** + * + * @file GCSControlgadgetwidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin + * @{ + * @brief A gadget to control the UAV, either from the keyboard or a joystick + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * 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 "logginggadgetwidget.h" +#include "ui_logging.h" + +#include +#include +#include +#include +#include +#include +#include + +LoggingGadgetWidget::LoggingGadgetWidget(QWidget *parent) : QLabel(parent) +{ + m_logging = new Ui_Logging(); + m_logging->setupUi(this); + + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + scpPlugin = pm->getObject(); + +} + +LoggingGadgetWidget::~LoggingGadgetWidget() +{ + // Do nothing +} + +void LoggingGadgetWidget::setPlugin(LoggingPlugin * p) +{ + loggingPlugin = p; + connect(p,SIGNAL(stateChanged(QString)),this,SLOT(stateChanged(QString))); + connect(m_logging->playButton,SIGNAL(clicked()),p->getLogfile(),SLOT(resumeReplay())); + connect(m_logging->playButton, SIGNAL(clicked()), scpPlugin, SLOT(startPlotting())); + connect(m_logging->pauseButton,SIGNAL(clicked()),p->getLogfile(),SLOT(pauseReplay())); + connect(m_logging->pauseButton, SIGNAL(clicked()), scpPlugin, SLOT(stopPlotting())); + connect(m_logging->playbackSpeed,SIGNAL(valueChanged(int)),p->getLogfile(),SLOT(setReplaySpeed(int))); + void pauseReplay(); + void resumeReplay(); +} + + +void LoggingGadgetWidget::stateChanged(QString status) +{ + m_logging->statusLabel->setText(status); +} + +/** + * @} + * @} + */ diff --git a/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.h b/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.h index fa362cc66..bee7028f3 100644 --- a/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/logging/logginggadgetwidget.h @@ -1,59 +1,64 @@ -/** - ****************************************************************************** - * - * @file GCSControlgadgetwidget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin - * @{ - * @brief A place holder gadget plugin - *****************************************************************************/ -/* - * 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 LoggingGADGETWIDGET_H_ -#define LoggingGADGETWIDGET_H_ - -#include - -class Ui_Logging; -class LoggingPlugin; - -class LoggingGadgetWidget : public QLabel -{ - Q_OBJECT - -public: - LoggingGadgetWidget(QWidget *parent = 0); - ~LoggingGadgetWidget(); - void setPlugin(LoggingPlugin * p); - -protected slots: - void stateChanged(QString status); - -signals: - void pause(); - void play(); - -private: - Ui_Logging *m_logging; - LoggingPlugin * loggingPlugin; - - -}; - -#endif /* LoggingGADGETWIDGET_H_ */ +/** + ****************************************************************************** + * + * @file GCSControlgadgetwidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin + * @{ + * @brief A place holder gadget plugin + *****************************************************************************/ +/* + * 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 LoggingGADGETWIDGET_H_ +#define LoggingGADGETWIDGET_H_ + +#include +#include "extensionsystem/pluginmanager.h" +#include "scope/scopeplugin.h" +#include "scope/scopegadgetfactory.h" + + +class Ui_Logging; +class LoggingPlugin; + +class LoggingGadgetWidget : public QLabel +{ + Q_OBJECT + +public: + LoggingGadgetWidget(QWidget *parent = 0); + ~LoggingGadgetWidget(); + void setPlugin(LoggingPlugin * p); + +protected slots: + void stateChanged(QString status); + +signals: + void pause(); + void play(); + +private: + Ui_Logging *m_logging; + LoggingPlugin * loggingPlugin; + ScopeGadgetFactory * scpPlugin; + + +}; + +#endif /* LoggingGADGETWIDGET_H_ */ diff --git a/ground/openpilotgcs/src/plugins/scope/scope.pri b/ground/openpilotgcs/src/plugins/scope/scope.pri new file mode 100644 index 000000000..99588122d --- /dev/null +++ b/ground/openpilotgcs/src/plugins/scope/scope.pri @@ -0,0 +1,3 @@ +include(scope_dependencies.pri) + +LIBS *= -l$$qtLibraryTarget(ScopeGadget) diff --git a/ground/openpilotgcs/src/plugins/scope/scope.pro b/ground/openpilotgcs/src/plugins/scope/scope.pro index c3e023d7a..7fef56df4 100644 --- a/ground/openpilotgcs/src/plugins/scope/scope.pro +++ b/ground/openpilotgcs/src/plugins/scope/scope.pro @@ -1,12 +1,11 @@ TEMPLATE = lib TARGET = ScopeGadget +DEFINES += SCOPE_LIBRARY include(../../openpilotgcsplugin.pri) -include(../../plugins/coreplugin/coreplugin.pri) -include(../../plugins/uavobjects/uavobjects.pri) -include(../../plugins/uavtalk/uavtalk.pri) -include(../../libs/qwt/qwt.pri) +include (scope_dependencies.pri) HEADERS += scopeplugin.h \ - plotdata.h + plotdata.h \ + scope_global.h HEADERS += scopegadgetoptionspage.h HEADERS += scopegadgetconfiguration.h HEADERS += scopegadget.h diff --git a/ground/openpilotgcs/src/plugins/scope/scope_dependencies.pri b/ground/openpilotgcs/src/plugins/scope/scope_dependencies.pri new file mode 100644 index 000000000..f743801a6 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/scope/scope_dependencies.pri @@ -0,0 +1,5 @@ +include(../../plugins/uavobjects/uavobjects.pri) +include(../../plugins/coreplugin/coreplugin.pri) +include(../../libs/utils/utils.pri) +include(../../plugins/uavtalk/uavtalk.pri) +include(../../libs/qwt/qwt.pri) diff --git a/ground/openpilotgcs/src/plugins/scope/scope_global.h b/ground/openpilotgcs/src/plugins/scope/scope_global.h new file mode 100644 index 000000000..6da462245 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/scope/scope_global.h @@ -0,0 +1,41 @@ +/** + ****************************************************************************** + * + * @file uavobjects_global.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @see The GNU Public License (GPL) Version 3 + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectsPlugin UAVObjects Plugin + * @{ + * @brief The UAVUObjects GCS plugin + *****************************************************************************/ +/* + * 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 SCOPE_GLOBAL_H +#define SCOPE_GLOBAL_H + +#include + +#if defined(SCOPE_LIBRARY) +# define SCOPE_EXPORT Q_DECL_EXPORT +#else +# define SCOPE_EXPORT Q_DECL_IMPORT +#endif + +#endif // UAVOBJECTS_GLOBAL_H + diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadget.cpp b/ground/openpilotgcs/src/plugins/scope/scopegadget.cpp index 3589a982d..41e126399 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadget.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopegadget.cpp @@ -1,80 +1,82 @@ -/** - ****************************************************************************** - * - * @file scopegadget.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ScopePlugin Scope Gadget Plugin - * @{ - * @brief The scope Gadget, graphically plots the states of UAVObjects - *****************************************************************************/ -/* - * 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 "scopegadget.h" -#include "scopegadgetconfiguration.h" -#include "scopegadgetwidget.h" - -#include - -ScopeGadget::ScopeGadget(QString classId, ScopeGadgetWidget *widget, QWidget *parent) : - IUAVGadget(classId, parent), - m_widget(widget), - configLoaded(false) -{ -} - -void ScopeGadget::loadConfiguration(IUAVGadgetConfiguration* config) -{ - - ScopeGadgetConfiguration *sgConfig = qobject_cast(config); - ScopeGadgetWidget* widget = qobject_cast(m_widget); - - widget->setXWindowSize(sgConfig->dataSize()); - widget->setRefreshInterval(sgConfig->refreshInterval()); - - if(sgConfig->plotType() == SequencialPlot ) - widget->setupSequencialPlot(); - else if(sgConfig->plotType() == ChronoPlot) - widget->setupChronoPlot(); - // else if(sgConfig->plotType() == UAVObjectPlot) - // widget->setupUAVObjectPlot(); - - foreach (PlotCurveConfiguration* plotCurveConfig, sgConfig->plotCurveConfigs()) { - - QString uavObject = plotCurveConfig->uavObject; - QString uavField = plotCurveConfig->uavField; - int scale = plotCurveConfig->yScalePower; - QRgb color = plotCurveConfig->color; - - widget->addCurvePlot( - uavObject, - uavField, - scale, - QPen( QBrush(QColor(color),Qt::SolidPattern), - (qreal)2, - Qt::SolidLine, - Qt::SquareCap, - Qt::BevelJoin) - ); - } -} - -ScopeGadget::~ScopeGadget() -{ - -} +/** + ****************************************************************************** + * + * @file scopegadget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ScopePlugin Scope Gadget Plugin + * @{ + * @brief The scope Gadget, graphically plots the states of UAVObjects + *****************************************************************************/ +/* + * 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 "scopeplugin.h" +#include "scopegadget.h" +#include "scopegadgetconfiguration.h" +#include "scopegadgetwidget.h" + +#include + +ScopeGadget::ScopeGadget(QString classId, ScopeGadgetWidget *widget, QWidget *parent) : + IUAVGadget(classId, parent), + m_widget(widget), + configLoaded(false) +{ + +} + +void ScopeGadget::loadConfiguration(IUAVGadgetConfiguration* config) +{ + + ScopeGadgetConfiguration *sgConfig = qobject_cast(config); + ScopeGadgetWidget* widget = qobject_cast(m_widget); + + widget->setXWindowSize(sgConfig->dataSize()); + widget->setRefreshInterval(sgConfig->refreshInterval()); + + if(sgConfig->plotType() == SequencialPlot ) + widget->setupSequencialPlot(); + else if(sgConfig->plotType() == ChronoPlot) + widget->setupChronoPlot(); + // else if(sgConfig->plotType() == UAVObjectPlot) + // widget->setupUAVObjectPlot(); + + foreach (PlotCurveConfiguration* plotCurveConfig, sgConfig->plotCurveConfigs()) { + + QString uavObject = plotCurveConfig->uavObject; + QString uavField = plotCurveConfig->uavField; + int scale = plotCurveConfig->yScalePower; + QRgb color = plotCurveConfig->color; + + widget->addCurvePlot( + uavObject, + uavField, + scale, + QPen( QBrush(QColor(color),Qt::SolidPattern), + (qreal)2, + Qt::SolidLine, + Qt::SquareCap, + Qt::BevelJoin) + ); + } +} + +ScopeGadget::~ScopeGadget() +{ + +} diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.cpp b/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.cpp index bed659405..1c62c1f57 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.cpp @@ -1,59 +1,72 @@ -/** - ****************************************************************************** - * - * @file scopegadgetfactory.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ScopePlugin Scope Gadget Plugin - * @{ - * @brief The scope Gadget, graphically plots the states of UAVObjects - *****************************************************************************/ -/* - * 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 "scopegadgetfactory.h" -#include "scopegadgetwidget.h" -#include "scopegadgetconfiguration.h" -#include "scopegadgetoptionspage.h" -#include "scopegadget.h" -#include - -ScopeGadgetFactory::ScopeGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("ScopeGadget"), - tr("Scope Gadget"), - parent) -{ -} - -ScopeGadgetFactory::~ScopeGadgetFactory() -{ -} - -Core::IUAVGadget* ScopeGadgetFactory::createGadget(QWidget *parent) -{ - ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent); - return new ScopeGadget(QString("ScopeGadget"), gadgetWidget, parent); -} - -IUAVGadgetConfiguration *ScopeGadgetFactory::createConfiguration(QSettings* qSettings) -{ - return new ScopeGadgetConfiguration(QString("ScopeGadget"), qSettings); -} - -IOptionsPage *ScopeGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) -{ - return new ScopeGadgetOptionsPage(qobject_cast(config)); -} +/** + ****************************************************************************** + * + * @file scopegadgetfactory.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ScopePlugin Scope Gadget Plugin + * @{ + * @brief The scope Gadget, graphically plots the states of UAVObjects + *****************************************************************************/ +/* + * 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 "scopegadgetfactory.h" +#include "scopegadgetwidget.h" +#include "scopegadgetconfiguration.h" +#include "scopegadgetoptionspage.h" +#include "scopegadget.h" +#include + +ScopeGadgetFactory::ScopeGadgetFactory(QObject *parent) : + IUAVGadgetFactory(QString("ScopeGadget"), + tr("Scope Gadget"), + parent) +{ +} + +ScopeGadgetFactory::~ScopeGadgetFactory() +{ +} + +void ScopeGadgetFactory::stopPlotting() +{ + emit onStopPlotting(); +} + +void ScopeGadgetFactory::startPlotting() +{ + emit onStartPlotting(); +} + + +Core::IUAVGadget* ScopeGadgetFactory::createGadget(QWidget *parent) +{ + ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent); + connect(this,SIGNAL(onStartPlotting()), gadgetWidget, SLOT(startPlotting())); + connect(this,SIGNAL(onStopPlotting()), gadgetWidget, SLOT(stopPlotting())); + return new ScopeGadget(QString("ScopeGadget"), gadgetWidget, parent); +} + +IUAVGadgetConfiguration *ScopeGadgetFactory::createConfiguration(QSettings* qSettings) +{ + return new ScopeGadgetConfiguration(QString("ScopeGadget"), qSettings); +} + +IOptionsPage *ScopeGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) +{ + return new ScopeGadgetOptionsPage(qobject_cast(config)); +} diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.h b/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.h index a3ccc5e97..16fd4f431 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.h +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetfactory.h @@ -1,53 +1,63 @@ -/** - ****************************************************************************** - * - * @file scopegadgetfactory.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ScopePlugin Scope Gadget Plugin - * @{ - * @brief The scope Gadget, graphically plots the states of UAVObjects - *****************************************************************************/ -/* - * 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 SCOPEGADGETFACTORY_H_ -#define SCOPEGADGETFACTORY_H_ - -#include - -namespace Core -{ -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class ScopeGadgetFactory : public IUAVGadgetFactory -{ - Q_OBJECT -public: - ScopeGadgetFactory(QObject *parent = 0); - ~ScopeGadgetFactory(); - - Core::IUAVGadget *createGadget(QWidget *parent); - IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings); - IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); -}; - -#endif // SCOPEGADGETFACTORY_H_ +/** + ****************************************************************************** + * + * @file scopegadgetfactory.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ScopePlugin Scope Gadget Plugin + * @{ + * @brief The scope Gadget, graphically plots the states of UAVObjects + *****************************************************************************/ +/* + * 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 SCOPEGADGETFACTORY_H_ +#define SCOPEGADGETFACTORY_H_ + +#include "scope_global.h" +#include + +namespace Core +{ +class IUAVGadget; +class IUAVGadgetFactory; +} + +using namespace Core; + +class SCOPE_EXPORT ScopeGadgetFactory : public IUAVGadgetFactory +{ + Q_OBJECT +public: + ScopeGadgetFactory(QObject *parent = 0); + ~ScopeGadgetFactory(); + + Core::IUAVGadget *createGadget(QWidget *parent); + IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings); + IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); + +public slots: + void stopPlotting(); + void startPlotting(); + +signals: + void onStopPlotting(); + void onStartPlotting(); + +}; + +#endif // SCOPEGADGETFACTORY_H_ diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp index 93ab97da0..03dac9afb 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp @@ -67,21 +67,21 @@ ScopeGadgetWidget::ScopeGadgetWidget(QWidget *parent) : QwtPlot(parent) // running the scopes if we are not connected and not replaying logs // Also listen to disconnect actions from the user Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager(); - connect(cm, SIGNAL(deviceDisconnected()), this, SLOT(onTelemetryDisconnected())); - connect(cm, SIGNAL(deviceConnected(QIODevice*)), this, SLOT(onTelemetryConnected())); + connect(cm, SIGNAL(deviceDisconnected()), this, SLOT(stopPlotting())); + connect(cm, SIGNAL(deviceConnected(QIODevice*)), this, SLOT(startPlotting())); } /** * Starts/stops telemetry */ -void ScopeGadgetWidget::onTelemetryConnected() +void ScopeGadgetWidget::startPlotting() { if(!replotTimer->isActive()) replotTimer->start(m_refreshInterval); } -void ScopeGadgetWidget::onTelemetryDisconnected() +void ScopeGadgetWidget::stopPlotting() { replotTimer->stop(); } diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.h b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.h index 936addd0d..e74fdc2b1 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.h @@ -120,8 +120,8 @@ private slots: void uavObjectReceived(UAVObject*); void replotNewData(); void showCurve(QwtPlotItem *item, bool on); - void onTelemetryConnected(); - void onTelemetryDisconnected(); + void startPlotting(); + void stopPlotting(); private: diff --git a/ground/openpilotgcs/src/plugins/scope/scopeplugin.cpp b/ground/openpilotgcs/src/plugins/scope/scopeplugin.cpp index e1c11f2f9..889c29f3b 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopeplugin.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopeplugin.cpp @@ -1,66 +1,67 @@ -/** - ****************************************************************************** - * - * @file scopeplugin.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ScopePlugin Scope Gadget Plugin - * @{ - * @brief The scope Gadget, graphically plots the states of UAVObjects - *****************************************************************************/ -/* - * 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 "scopeplugin.h" -#include "scopegadgetfactory.h" -#include -#include -#include -#include - - -ScopePlugin::ScopePlugin() -{ - // Do nothing -} - -ScopePlugin::~ScopePlugin() -{ - // Do nothing -} - -bool ScopePlugin::initialize(const QStringList& args, QString *errMsg) -{ - Q_UNUSED(args); - Q_UNUSED(errMsg); - mf = new ScopeGadgetFactory(this); - addAutoReleasedObject(mf); - - return true; -} - -void ScopePlugin::extensionsInitialized() -{ - // Do nothing -} - -void ScopePlugin::shutdown() -{ - // Do nothing -} -Q_EXPORT_PLUGIN(ScopePlugin) - +/** + ****************************************************************************** + * + * @file scopeplugin.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ScopePlugin Scope Gadget Plugin + * @{ + * @brief The scope Gadget, graphically plots the states of UAVObjects + *****************************************************************************/ +/* + * 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 "scopeplugin.h" +#include "scopegadgetfactory.h" +#include +#include +#include +#include + + +ScopePlugin::ScopePlugin() +{ + // Do nothing +} + +ScopePlugin::~ScopePlugin() +{ + // Do nothing +} + + +bool ScopePlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + Q_UNUSED(errMsg); + mf = new ScopeGadgetFactory(this); + addAutoReleasedObject(mf); + + return true; +} + +void ScopePlugin::extensionsInitialized() +{ + // Do nothing +} + +void ScopePlugin::shutdown() +{ + // Do nothing +} +Q_EXPORT_PLUGIN(ScopePlugin) + diff --git a/ground/openpilotgcs/src/plugins/scope/scopeplugin.h b/ground/openpilotgcs/src/plugins/scope/scopeplugin.h index c2a0e501e..1abadcfee 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopeplugin.h +++ b/ground/openpilotgcs/src/plugins/scope/scopeplugin.h @@ -1,46 +1,50 @@ -/** - ****************************************************************************** - * - * @file scopeplugin.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ScopePlugin Scope Gadget Plugin - * @{ - * @brief The scope Gadget, graphically plots the states of UAVObjects - *****************************************************************************/ -/* - * 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 SCOPEPLUGIN_H_ -#define SCOPEPLUGIN_H_ - -#include - -class ScopeGadgetFactory; - -class ScopePlugin : public ExtensionSystem::IPlugin -{ -public: - ScopePlugin(); - ~ScopePlugin(); - - void extensionsInitialized(); - bool initialize(const QStringList & arguments, QString * errorString); - void shutdown(); -private: - ScopeGadgetFactory *mf; -}; -#endif /* SCOPEPLUGIN_H_ */ +/** + ****************************************************************************** + * + * @file scopeplugin.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup ScopePlugin Scope Gadget Plugin + * @{ + * @brief The scope Gadget, graphically plots the states of UAVObjects + *****************************************************************************/ +/* + * 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 SCOPEPLUGIN_H_ +#define SCOPEPLUGIN_H_ + +#include "scope_global.h" +#include + +class ScopeGadgetFactory; + +class ScopePlugin : public ExtensionSystem::IPlugin +{ +public: + ScopePlugin(); + ~ScopePlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); + +private: + ScopeGadgetFactory *mf; + + +}; +#endif /* SCOPEPLUGIN_H_ */