diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.pro b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.pro index 39985b04c..4ddbd9986 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.pro +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.pro @@ -29,7 +29,8 @@ SOURCES += pipxtremegadget.cpp \ OTHER_FILES += PipXtreme.pluginspec FORMS += \ - pipxtreme.ui + pipxtreme.ui \ + pipxtremegadgetoptionspage.ui RESOURCES += \ pipxtreme.qrc diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.cpp b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.cpp index 546a095f2..c59d49ea6 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.cpp +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.cpp @@ -31,44 +31,11 @@ * */ PipXtremeGadgetConfiguration::PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) : - IUAVGadgetConfiguration(classId, parent), - m_defaultPort("Unknown"), - m_defaultSpeed(BAUD57600), - m_defaultDataBits(DATA_8), - m_defaultFlow(FLOW_OFF), - m_defaultParity(PAR_NONE), - m_defaultStopBits(STOP_1), - m_defaultTimeOut(5000) - + IUAVGadgetConfiguration(classId, parent) { //if a saved configuration exists load it if (qSettings != 0) { - BaudRateType speed; - DataBitsType databits; - FlowType flow; - ParityType parity; - StopBitsType stopbits; - - int ispeed = qSettings->value("defaultSpeed").toInt(); - int idatabits = qSettings->value("defaultDataBits").toInt(); - int iflow = qSettings->value("defaultFlow").toInt(); - int iparity = qSettings->value("defaultParity").toInt(); - int istopbits = qSettings->value("defaultStopBits").toInt(); - QString port = qSettings->value("defaultPort").toString(); - - databits=(DataBitsType) idatabits; - flow=(FlowType)iflow; - parity=(ParityType)iparity; - stopbits=(StopBitsType)istopbits; - speed=(BaudRateType)ispeed; - - m_defaultPort=port; - m_defaultSpeed=speed; - m_defaultDataBits=databits; - m_defaultFlow=flow; - m_defaultParity=parity; - m_defaultStopBits=stopbits; } } @@ -83,14 +50,6 @@ PipXtremeGadgetConfiguration::~PipXtremeGadgetConfiguration() IUAVGadgetConfiguration *PipXtremeGadgetConfiguration::clone() { PipXtremeGadgetConfiguration *m = new PipXtremeGadgetConfiguration(this->classId()); - - m->m_defaultSpeed = m_defaultSpeed; - m->m_defaultDataBits = m_defaultDataBits; - m->m_defaultFlow = m_defaultFlow; - m->m_defaultParity = m_defaultParity; - m->m_defaultStopBits = m_defaultStopBits; - m->m_defaultPort = m_defaultPort; - return m; } @@ -98,12 +57,10 @@ IUAVGadgetConfiguration *PipXtremeGadgetConfiguration::clone() * Saves a configuration. * */ -void PipXtremeGadgetConfiguration::saveConfig(QSettings* qSettings) const +void PipXtremeGadgetConfiguration::saveConfig(QSettings *qSettings) const { - qSettings->setValue("defaultSpeed", m_defaultSpeed); - qSettings->setValue("defaultDataBits", m_defaultDataBits); - qSettings->setValue("defaultFlow", m_defaultFlow); - qSettings->setValue("defaultParity", m_defaultParity); - qSettings->setValue("defaultStopBits", m_defaultStopBits); - qSettings->setValue("defaultPort", m_defaultPort); + if (qSettings) + { + + } } diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.h b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.h index fad1ad014..e65a5368c 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.h +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetconfiguration.h @@ -39,35 +39,10 @@ public: explicit PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0); ~PipXtremeGadgetConfiguration(); - //set port configuration functions - void setSpeed(BaudRateType speed) {m_defaultSpeed=speed;} - void setDataBits(DataBitsType databits) {m_defaultDataBits=databits;} - void setFlow(FlowType flow) {m_defaultFlow=flow;} - void setParity(ParityType parity) {m_defaultParity=parity;} - void setStopBits(StopBitsType stopbits) {m_defaultStopBits=stopbits;} - void setPort(QString port){m_defaultPort=port;} - void setTimeOut(long timeout){m_defaultTimeOut=timeout;} - - //get port configuration functions - BaudRateType Speed() {return m_defaultSpeed;} - DataBitsType DataBits() {return m_defaultDataBits;} - FlowType Flow() {return m_defaultFlow;} - ParityType Parity() {return m_defaultParity;} - StopBitsType StopBits() {return m_defaultStopBits;} - QString Port(){return m_defaultPort;} - long TimeOut(){return m_defaultTimeOut;} - - void saveConfig(QSettings* settings) const; + void saveConfig(QSettings *settings) const; IUAVGadgetConfiguration *clone(); private: - QString m_defaultPort; - BaudRateType m_defaultSpeed; - DataBitsType m_defaultDataBits; - FlowType m_defaultFlow; - ParityType m_defaultParity; - StopBitsType m_defaultStopBits; - long m_defaultTimeOut; }; #endif diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.cpp b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.cpp index 59eb68e0f..2fd8057af 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.cpp +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.cpp @@ -1,69 +1,72 @@ -/** - ****************************************************************************** - * - * @file pipxtremegadgetoptionspage.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @{ - *****************************************************************************/ -/* - * 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 "pipxtremegadgetoptionspage.h" -#include "pipxtremegadgetconfiguration.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -PipXtremeGadgetOptionsPage::PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent) : - IOptionsPage(parent), - m_config(config) -{ -} - -//creates options page widget -QWidget *PipXtremeGadgetOptionsPage::createPage(QWidget *parent) -{ - //main widget - QWidget *widget = new QWidget; - - return widget; -} -/** - * Called when the user presses apply or OK. - * - * Saves the current values - * - */ -void PipXtremeGadgetOptionsPage::apply() -{ - -} - -void PipXtremeGadgetOptionsPage::finish() -{ - -} - - +/** + ****************************************************************************** + * + * @file pipxtremegadgetoptionspage.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @{ + *****************************************************************************/ +/* + * 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 "pipxtremegadgetoptionspage.h" +#include "pipxtremegadgetconfiguration.h" +#include "ui_pipxtremegadgetoptionspage.h" + +PipXtremeGadgetOptionsPage::PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent) : + IOptionsPage(parent), + options_page(NULL), + m_config(config) +{ +} + +//creates options page widget +QWidget *PipXtremeGadgetOptionsPage::createPage(QWidget *parent) +{ +// QWidget *widget = new QWidget; +// return widget; + + options_page = new Ui::PipXtremeGadgetOptionsPage(); + QWidget *optionsPageWidget = new QWidget; + options_page->setupUi(optionsPageWidget); + + + + + return optionsPageWidget; +} +/** + * Called when the user presses apply or OK. + * + * Saves the current values + * + */ +void PipXtremeGadgetOptionsPage::apply() +{ + +} + +void PipXtremeGadgetOptionsPage::finish() +{ + if (options_page) + { + delete options_page; + options_page = NULL; + } +} + + diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.h b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.h index 8189728a2..97aa0006e 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.h +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.h @@ -1,74 +1,62 @@ -/** - ****************************************************************************** - * - * @file pipxtremegadgetoptionspage.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @{ - *****************************************************************************/ -/* - * 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 PIPXTREMEGADGETOPTIONSPAGE_H -#define PIPXTREMEGADGETOPTIONSPAGE_H -#include -#include "coreplugin/dialogs/ioptionspage.h" -#include "QString" -#include -#include - -namespace Core { -class IUAVGadgetConfiguration; -} -class PipXtremeGadgetConfiguration; -class QTextEdit; -class QComboBox; -class QSpinBox; - -using namespace Core; - -class PipXtremeGadgetOptionsPage : public IOptionsPage -{ -Q_OBJECT -public: - explicit PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent = 0); - - QWidget *createPage(QWidget *parent); - void apply(); - void finish(); - -private: - PipXtremeGadgetConfiguration *m_config; - QComboBox *m_portCB; - QComboBox *m_speedCB; - QComboBox *m_databitsCB; - QComboBox *m_flowCB; - QComboBox *m_parityCB; - QComboBox *m_stopbitsCB; - QSpinBox *m_timeoutSpin; - QStringList BaudRateTypeString; - QStringList BaudRateTypeStringALL; - QStringList DataBitsTypeStringALL; - QStringList ParityTypeStringALL; - QStringList StopBitsTypeStringALL; - QStringList DataBitsTypeString; - QStringList ParityTypeString; - QStringList StopBitsTypeString; - QStringList FlowTypeString; -}; - -#endif +/** + ****************************************************************************** + * + * @file pipxtremegadgetoptionspage.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @{ + *****************************************************************************/ +/* + * 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 PIPXTREMEGADGETOPTIONSPAGE_H +#define PIPXTREMEGADGETOPTIONSPAGE_H + +#include +#include "coreplugin/dialogs/ioptionspage.h" +#include "QString" +#include +#include + +namespace Core { + class IUAVGadgetConfiguration; +} + +class PipXtremeGadgetConfiguration; + +namespace Ui { + class PipXtremeGadgetOptionsPage; +} + +using namespace Core; + +class PipXtremeGadgetOptionsPage : public IOptionsPage +{ +Q_OBJECT +public: + explicit PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent = 0); + + QWidget *createPage(QWidget *parent); + void apply(); + void finish(); + +private: + Ui::PipXtremeGadgetOptionsPage *options_page; + PipXtremeGadgetConfiguration *m_config; +}; + +#endif diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.ui new file mode 100644 index 000000000..3436b9567 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetoptionspage.ui @@ -0,0 +1,51 @@ + + + PipXtremeGadgetOptionsPage + + + + 0 + 0 + 587 + 359 + + + + + 0 + 0 + + + + Form + + + + 0 + + + + + + + + + 10 + + + + No options to set + + + Qt::AlignCenter + + + + + + + + + + +