mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Removed unused code, bit of a clean up.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2747 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
2496c41ea2
commit
73d134ad98
@ -29,7 +29,8 @@ SOURCES += pipxtremegadget.cpp \
|
||||
OTHER_FILES += PipXtreme.pluginspec
|
||||
|
||||
FORMS += \
|
||||
pipxtreme.ui
|
||||
pipxtreme.ui \
|
||||
pipxtremegadgetoptionspage.ui
|
||||
|
||||
RESOURCES += \
|
||||
pipxtreme.qrc
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 <QtGui/QLabel>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QDoubleSpinBox>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 <qextserialport/src/qextserialenumerator.h>
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
#include "QString"
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
|
||||
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 <qextserialport/src/qextserialenumerator.h>
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
#include "QString"
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
|
||||
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
|
||||
|
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PipXtremeGadgetOptionsPage</class>
|
||||
<widget class="QWidget" name="PipXtremeGadgetOptionsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>587</width>
|
||||
<height>359</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No options to set</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user