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
|
OTHER_FILES += PipXtreme.pluginspec
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
pipxtreme.ui
|
pipxtreme.ui \
|
||||||
|
pipxtremegadgetoptionspage.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
pipxtreme.qrc
|
pipxtreme.qrc
|
||||||
|
@ -31,44 +31,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PipXtremeGadgetConfiguration::PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
|
PipXtremeGadgetConfiguration::PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
|
||||||
IUAVGadgetConfiguration(classId, 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)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
//if a saved configuration exists load it
|
//if a saved configuration exists load it
|
||||||
if (qSettings != 0)
|
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()
|
IUAVGadgetConfiguration *PipXtremeGadgetConfiguration::clone()
|
||||||
{
|
{
|
||||||
PipXtremeGadgetConfiguration *m = new PipXtremeGadgetConfiguration(this->classId());
|
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;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,12 +57,10 @@ IUAVGadgetConfiguration *PipXtremeGadgetConfiguration::clone()
|
|||||||
* Saves a configuration.
|
* Saves a configuration.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void PipXtremeGadgetConfiguration::saveConfig(QSettings* qSettings) const
|
void PipXtremeGadgetConfiguration::saveConfig(QSettings *qSettings) const
|
||||||
{
|
{
|
||||||
qSettings->setValue("defaultSpeed", m_defaultSpeed);
|
if (qSettings)
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
@ -39,35 +39,10 @@ public:
|
|||||||
explicit PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
|
explicit PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
|
||||||
~PipXtremeGadgetConfiguration();
|
~PipXtremeGadgetConfiguration();
|
||||||
|
|
||||||
//set port configuration functions
|
void saveConfig(QSettings *settings) const;
|
||||||
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;
|
|
||||||
IUAVGadgetConfiguration *clone();
|
IUAVGadgetConfiguration *clone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_defaultPort;
|
|
||||||
BaudRateType m_defaultSpeed;
|
|
||||||
DataBitsType m_defaultDataBits;
|
|
||||||
FlowType m_defaultFlow;
|
|
||||||
ParityType m_defaultParity;
|
|
||||||
StopBitsType m_defaultStopBits;
|
|
||||||
long m_defaultTimeOut;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,19 +25,11 @@
|
|||||||
|
|
||||||
#include "pipxtremegadgetoptionspage.h"
|
#include "pipxtremegadgetoptionspage.h"
|
||||||
#include "pipxtremegadgetconfiguration.h"
|
#include "pipxtremegadgetconfiguration.h"
|
||||||
#include <QtGui/QLabel>
|
#include "ui_pipxtremegadgetoptionspage.h"
|
||||||
#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) :
|
PipXtremeGadgetOptionsPage::PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent) :
|
||||||
IOptionsPage(parent),
|
IOptionsPage(parent),
|
||||||
|
options_page(NULL),
|
||||||
m_config(config)
|
m_config(config)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -45,10 +37,17 @@ PipXtremeGadgetOptionsPage::PipXtremeGadgetOptionsPage(PipXtremeGadgetConfigurat
|
|||||||
//creates options page widget
|
//creates options page widget
|
||||||
QWidget *PipXtremeGadgetOptionsPage::createPage(QWidget *parent)
|
QWidget *PipXtremeGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
//main widget
|
// QWidget *widget = new QWidget;
|
||||||
QWidget *widget = new QWidget;
|
// return widget;
|
||||||
|
|
||||||
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.
|
* Called when the user presses apply or OK.
|
||||||
@ -63,7 +62,11 @@ void PipXtremeGadgetOptionsPage::apply()
|
|||||||
|
|
||||||
void PipXtremeGadgetOptionsPage::finish()
|
void PipXtremeGadgetOptionsPage::finish()
|
||||||
{
|
{
|
||||||
|
if (options_page)
|
||||||
|
{
|
||||||
|
delete options_page;
|
||||||
|
options_page = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#ifndef PIPXTREMEGADGETOPTIONSPAGE_H
|
#ifndef PIPXTREMEGADGETOPTIONSPAGE_H
|
||||||
#define PIPXTREMEGADGETOPTIONSPAGE_H
|
#define PIPXTREMEGADGETOPTIONSPAGE_H
|
||||||
|
|
||||||
#include <qextserialport/src/qextserialenumerator.h>
|
#include <qextserialport/src/qextserialenumerator.h>
|
||||||
#include "coreplugin/dialogs/ioptionspage.h"
|
#include "coreplugin/dialogs/ioptionspage.h"
|
||||||
#include "QString"
|
#include "QString"
|
||||||
@ -32,12 +33,14 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IUAVGadgetConfiguration;
|
class IUAVGadgetConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PipXtremeGadgetConfiguration;
|
class PipXtremeGadgetConfiguration;
|
||||||
class QTextEdit;
|
|
||||||
class QComboBox;
|
namespace Ui {
|
||||||
class QSpinBox;
|
class PipXtremeGadgetOptionsPage;
|
||||||
|
}
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
@ -52,23 +55,8 @@ public:
|
|||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Ui::PipXtremeGadgetOptionsPage *options_page;
|
||||||
PipXtremeGadgetConfiguration *m_config;
|
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
|
#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