1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

GCS: Drop read support for binary plugin configuration. If you haven't converted your old ini yet, load it up once in a revision built from source before this change.

See also: http://forums.openpilot.org/topic/1850-existing-configuration-files-read-this-if-you-have-them/

Note: Reading binary layout (which gadgets are shown in each workspace and how they are split) still is available, since that was a later change. That'll get done somewhere in the future :)


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1720 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
cranphin 2010-09-22 19:57:02 +00:00 committed by cranphin
parent c734584b01
commit e4d317f40e
56 changed files with 19 additions and 604 deletions

View File

@ -26,14 +26,6 @@
*/
#include "configgadgetconfiguration.h"
#include <QtCore/QDataStream>
ConfigGadgetConfiguration::ConfigGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent)
{
}
ConfigGadgetConfiguration::ConfigGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent)
{

View File

@ -36,7 +36,6 @@ class ConfigGadgetConfiguration : public IUAVGadgetConfiguration
Q_OBJECT
public:
explicit ConfigGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit ConfigGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings* settings) const;
IUAVGadgetConfiguration *clone();

View File

@ -46,11 +46,6 @@ Core::IUAVGadget* ConfigGadgetFactory::createGadget(QWidget *parent)
return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *ConfigGadgetFactory::createConfiguration(const QByteArray &state)
{
return new ConfigGadgetConfiguration(QString("ConfigGadget"), state);
}
IUAVGadgetConfiguration *ConfigGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new ConfigGadgetConfiguration(QString("ConfigGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~ConfigGadgetFactory();
IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -54,7 +54,6 @@ public:
virtual ~IUAVGadgetFactory() {}
virtual IUAVGadget *createGadget(QWidget *parent) = 0;
virtual IUAVGadgetConfiguration *createConfiguration(const QByteArray &/*state*/) { return 0; }
virtual IUAVGadgetConfiguration *createConfiguration(QSettings* /*qSettings*/) { return 0; }
virtual IOptionsPage *createOptionsPage(IUAVGadgetConfiguration */*config*/) { return 0; }
QString classId() const { return m_classId; }

View File

@ -99,63 +99,29 @@ void UAVGadgetInstanceManager::readConfigs_1_0_0(QSettings *qs)
IUAVGadgetFactory *f = factory(classId);
qs->beginGroup(classId);
// New style: each config is a group, old style: each config is a value
QStringList groups = qs->childGroups();
bool oldStyle = groups.size() == 0;
QStringList configs = QStringList();
if(oldStyle) {
// Old style configuration
configs = qs->childKeys();
foreach (QString configName, configs) {
QByteArray ba = QByteArray::fromBase64(qs->value(configName).toByteArray());
QDataStream stream(ba);
bool locked;
stream >> locked;
QByteArray state;
stream >> state;
IUAVGadgetConfiguration *config = f->createConfiguration(state);
if (config){
config->setName(configName);
config->setProvisionalName(configName);
config->setLocked(locked);
int idx = indexForConfig(m_configurations, classId, configName);
if ( idx >= 0 ){
// We should replace the config, but it might be used, so just
// throw it out of the list. The GCS should be reinitialised soon.
m_configurations[idx] = config;
}
else{
m_configurations.append(config);
}
configs = qs->childGroups();
foreach (QString configName, configs) {
qDebug() << "Loading config: " << classId << "," << configName;
qs->beginGroup(configName);
bool locked = qs->value("config.locked").toBool();
IUAVGadgetConfiguration *config = f->createConfiguration(qs);
if (config){
config->setName(configName);
config->setProvisionalName(configName);
config->setLocked(locked);
int idx = indexForConfig(m_configurations, classId, configName);
if ( idx >= 0 ){
// We should replace the config, but it might be used, so just
// throw it out of the list. The GCS should be reinitialised soon.
m_configurations[idx] = config;
}
else{
m_configurations.append(config);
}
}
} else {
// New style configuration
configs = qs->childGroups();
foreach (QString configName, configs) {
qDebug() << "Loading config: " << classId << "," << configName;
qs->beginGroup(configName);
bool locked = qs->value("config.locked").toBool();
IUAVGadgetConfiguration *config = f->createConfiguration(qs);
if (config){
config->setName(configName);
config->setProvisionalName(configName);
config->setLocked(locked);
int idx = indexForConfig(m_configurations, classId, configName);
if ( idx >= 0 ){
// We should replace the config, but it might be used, so just
// throw it out of the list. The GCS should be reinitialised soon.
m_configurations[idx] = config;
}
else{
m_configurations.append(config);
}
}
qs->endGroup();
}
qs->endGroup();
}
if (configs.count() == 0) {

View File

@ -28,67 +28,6 @@
#include "dialgadgetconfiguration.h"
#include "utils/pathutils.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
DialGadgetConfiguration::DialGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_defaultDial("Unknown"),
dialBackgroundID("background"),
dialForegroundID("foreground"),
dialNeedleID1("needle"),
dialNeedleID2("needle2"),
dialNeedleID3("needle3"),
needle1MinValue(0),
needle1MaxValue(100),
needle2MinValue(0),
needle2MaxValue(100),
needle3MinValue(0),
needle3MaxValue(100),
needle1Factor(1),
needle2Factor(1),
needle3Factor(1),
needle1Move("Rotate"),
needle2Move("Rotate"),
needle3Move("Rotate")
{
//if a saved configuration exists load it
if (state.count() > 0) {
QDataStream stream(state);
QString dialFile;
stream >> dialFile;
m_defaultDial=Utils::PathUtils().InsertDataPath(dialFile);
stream >> dialBackgroundID;
stream >> dialForegroundID;
stream >> dialNeedleID1;
stream >> dialNeedleID2;
stream >> dialNeedleID3;
stream >> needle1MinValue;
stream >> needle1MaxValue;
stream >> needle2MinValue;
stream >> needle2MaxValue;
stream >> needle3MinValue;
stream >> needle3MaxValue;
stream >> needle1DataObject;
stream >> needle1ObjectField;
stream >> needle2DataObject;
stream >> needle2ObjectField;
stream >> needle3DataObject;
stream >> needle3ObjectField;
stream >> needle1Factor;
stream >> needle2Factor;
stream >> needle3Factor;
stream >> needle1Move;
stream >> needle2Move;
stream >> needle3Move;
stream >> font;
}
}
/**
* Loads a saved configuration or defaults if non exist.

View File

@ -40,7 +40,6 @@ class DialGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit DialGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit DialGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);

View File

@ -49,11 +49,6 @@ Core::IUAVGadget* DialGadgetFactory::createGadget(QWidget *parent)
return new DialGadget(QString("DialGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *DialGadgetFactory::createConfiguration(const QByteArray &state)
{
return new DialGadgetConfiguration(QString("DialGadget"), state);
}
IUAVGadgetConfiguration *DialGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new DialGadgetConfiguration(QString("DialGadget"), qSettings);

View File

@ -46,7 +46,6 @@ public:
~DialGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -26,64 +26,8 @@
*/
#include "gpsdisplaygadgetconfiguration.h"
#include <QtCore/QDataStream>
#include <qextserialport/src/qextserialport.h>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_connectionMode("Serial"),
m_defaultPort("Unknown"),
m_defaultSpeed(BAUD4800),
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 (state.count() > 0) {
QDataStream stream(state);
BaudRateType speed;
DataBitsType databits;
FlowType flow;
ParityType parity;
StopBitsType stopbits;
int ispeed;
int idatabits;
int iflow;
int iparity;
int istopbits;
QString port;
QString conMode;
stream >> ispeed;
stream >> idatabits;
stream >>iflow;
stream >>iparity;
stream >> istopbits;
stream >> port;
stream >> conMode;
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;
m_connectionMode = conMode;
}
}
/**
* Loads a saved configuration or defaults if non exist.
*

View File

@ -37,7 +37,6 @@ class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit GpsDisplayGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void setConnectionMode(QString mode) { m_connectionMode = mode; }

View File

@ -48,11 +48,6 @@ Core::IUAVGadget* GpsDisplayGadgetFactory::createGadget(QWidget *parent)
return new GpsDisplayGadget(QString("GpsDisplayGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *GpsDisplayGadgetFactory::createConfiguration(const QByteArray &state)
{
return new GpsDisplayGadgetConfiguration(QString("GpsDisplayGadget"), state);
}
IUAVGadgetConfiguration *GpsDisplayGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new GpsDisplayGadgetConfiguration(QString("GpsDisplayGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~GpsDisplayGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -26,35 +26,6 @@
*/
#include "hitlconfiguration.h"
#include <QtCore/QDataStream>
HITLConfiguration::HITLConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent)
{
settings.simulatorId = "";
settings.binPath = "";
settings.dataPath = "";
settings.manual = false;
settings.hostAddress = "127.0.0.1";
settings.outPort = 0;
settings.inPort = 0;
settings.latitude = "";
settings.longitude = "";
if (state.count() > 0) {
QDataStream stream(state);
stream >> settings.simulatorId;
stream >> settings.binPath;
stream >> settings.dataPath;
stream >> settings.manual;
stream >> settings.hostAddress;
stream >> settings.outPort;
stream >> settings.inPort;
stream >> settings.latitude;
stream >> settings.longitude;
}
}
HITLConfiguration::HITLConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent)

View File

@ -44,7 +44,6 @@ class HITLConfiguration : public IUAVGadgetConfiguration
Q_PROPERTY(SimulatorSettings settings READ Settings WRITE setSimulatorSettings)
public:
explicit HITLConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit HITLConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings* settings) const;

View File

@ -49,11 +49,6 @@ Core::IUAVGadget* HITLFactory::createGadget(QWidget *parent)
return new HITLGadget(QString("HITL"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *HITLFactory::createConfiguration(const QByteArray &state)
{
return new HITLConfiguration(QString("HITL"), state);
}
IUAVGadgetConfiguration *HITLFactory::createConfiguration(QSettings* qSettings)
{
return new HITLConfiguration(QString("HITL"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~HITLFactory();
IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -28,22 +28,6 @@
*/
#include "importexportgadgetconfiguration.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
ImportExportGadgetConfiguration::ImportExportGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
dialFile("gcs.ini")
{
//if a saved configuration exists load it
if (state.count() > 0) {
QDataStream stream(state);
stream >> dialFile;
}
}
/**
* Loads a saved configuration or defaults if non exist.

View File

@ -39,7 +39,6 @@ class IMPORTEXPORT_EXPORT ImportExportGadgetConfiguration : public IUAVGadgetCon
{
Q_OBJECT
public:
explicit ImportExportGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit ImportExportGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
//set dial configuration functions

View File

@ -50,12 +50,6 @@ Core::IUAVGadget* ImportExportGadgetFactory::createGadget(QWidget *parent)
return new ImportExportGadget(QString("ImportExportGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *ImportExportGadgetFactory::createConfiguration(const QByteArray &state)
{
lastConfig = new ImportExportGadgetConfiguration(QString("ImportExportGadget"), state);
return lastConfig;
}
IUAVGadgetConfiguration *ImportExportGadgetFactory::createConfiguration(QSettings* qSettings)
{
lastConfig = new ImportExportGadgetConfiguration(QString("ImportExportGadget"), qSettings);

View File

@ -47,7 +47,6 @@ public:
ImportExportGadgetConfiguration *getLastConfig(){ return lastConfig;}
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);

View File

@ -26,18 +26,8 @@
*/
#include "ipconnectionconfiguration.h"
#include <QtCore/QDataStream>
#include <coreplugin/icore.h>
IPconnectionConfiguration::IPconnectionConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_HostName("127.0.0.1"),
m_Port(1000),
m_UseTCP(1)
{
settings = Core::ICore::instance()->settings();
}
IPconnectionConfiguration::IPconnectionConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_HostName("127.0.0.1"),

View File

@ -42,7 +42,6 @@ Q_PROPERTY(int Port READ Port WRITE setPort)
Q_PROPERTY(int UseTCP READ UseTCP WRITE setUseTCP)
public:
explicit IPconnectionConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit IPconnectionConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
virtual ~IPconnectionConfiguration();

View File

@ -27,49 +27,6 @@
#include "lineardialgadgetconfiguration.h"
#include "utils/pathutils.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
LineardialGadgetConfiguration::LineardialGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
dialFile("Unknown"),
sourceDataObject("Unknown"),
sourceObjectField("Unknown"),
minValue(0),
maxValue(100),
redMin(0),
redMax(33),
yellowMin(33),
yellowMax(66),
greenMin(66),
greenMax(100),
factor(1.00),
decimalPlaces(0)
{
//if a saved configuration exists load it
if (state.count() > 0) {
QDataStream stream(state);
QString dFile;
stream >> dFile;
dialFile = Utils::PathUtils().InsertDataPath(dFile);
stream >> sourceDataObject;
stream >> sourceObjectField;
stream >> minValue;
stream >> maxValue;
stream >> redMin;
stream >> redMax;
stream >> yellowMin;
stream >> yellowMax;
stream >> greenMin;
stream >> greenMax;
stream >> font;
stream >> decimalPlaces;
stream >> factor;
}
}
/**
* Loads a saved configuration or defaults if non exist.

View File

@ -39,7 +39,6 @@ class LineardialGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit LineardialGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit LineardialGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
//set dial configuration functions

View File

@ -48,11 +48,6 @@ Core::IUAVGadget* LineardialGadgetFactory::createGadget(QWidget *parent)
return new LineardialGadget(QString("LineardialGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *LineardialGadgetFactory::createConfiguration(const QByteArray &state)
{
return new LineardialGadgetConfiguration(QString("LineardialGadget"), state);
}
IUAVGadgetConfiguration *LineardialGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new LineardialGadgetConfiguration(QString("LineardialGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~LineardialGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -27,25 +27,6 @@
#include "modelviewgadgetconfiguration.h"
#include "utils/pathutils.h"
#include <QtCore/QDataStream>
ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_acFilename("../share/models/Easystar/EasyStar.3ds"),
m_bgFilename(""),
m_enableVbo(false)
{
if (state.count() > 0) {
QDataStream stream(state);
QString modelFile;
QString bgFile;
stream >> modelFile;
stream >> bgFile;
stream >> m_enableVbo;
m_acFilename = Utils::PathUtils().InsertDataPath(modelFile);
m_bgFilename = Utils::PathUtils().InsertDataPath(bgFile);
}
}
ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),

View File

@ -36,7 +36,6 @@ class ModelViewGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit ModelViewGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit ModelViewGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings* settings) const;

View File

@ -47,11 +47,6 @@ Core::IUAVGadget* ModelViewGadgetFactory::createGadget(QWidget *parent)
return new ModelViewGadget(QString("ModelViewGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *ModelViewGadgetFactory::createConfiguration(const QByteArray &state)
{
return new ModelViewGadgetConfiguration(QString("ModelViewGadget"), state);
}
IUAVGadgetConfiguration *ModelViewGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new ModelViewGadgetConfiguration(QString("ModelViewGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~ModelViewGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -27,59 +27,8 @@
#include "opmapgadgetconfiguration.h"
#include "utils/pathutils.h"
#include <QtCore/QDataStream>
#include <QDir>
OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_mapProvider("GoogleHybrid"),
m_defaultZoom(2),
m_defaultLatitude(0),
m_defaultLongitude(0),
m_useOpenGL(false),
m_showTileGridLines(false),
m_accessMode("ServerAndCache"),
m_useMemoryCache(true),
m_cacheLocation(Utils::PathUtils().GetStoragePath() + "mapscache" + QDir::separator())
{
if (state.count() > 0)
{
QDataStream stream(state);
QString mapProvider;
int zoom;
double latitude;
double longitude;
bool useOpenGL;
bool showTileGridLines;
QString accessMode;
bool useMemoryCache;
QString cacheLocation;
stream >> mapProvider;
stream >> zoom;
stream >> latitude;
stream >> longitude;
stream >> useOpenGL;
stream >> showTileGridLines;
stream >> accessMode;
stream >> useMemoryCache;
stream >> cacheLocation;
if (!mapProvider.isEmpty()) m_mapProvider = mapProvider;
m_defaultZoom = zoom;
m_defaultLatitude = latitude;
m_defaultLongitude = longitude;
m_useOpenGL = useOpenGL;
m_showTileGridLines = showTileGridLines;
if (!accessMode.isEmpty()) m_accessMode = accessMode;
m_useMemoryCache = useMemoryCache;
if (!cacheLocation.isEmpty()) m_cacheLocation = Utils::PathUtils().InsertStoragePath(cacheLocation);
}
}
OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_mapProvider("GoogleHybrid"),

View File

@ -48,7 +48,6 @@ Q_PROPERTY(bool useMemoryCache READ useMemoryCache WRITE setUseMemoryCache)
Q_PROPERTY(QString cacheLocation READ cacheLocation WRITE setCacheLocation)
public:
explicit OPMapGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit OPMapGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings* settings) const;

View File

@ -46,11 +46,6 @@ Core::IUAVGadget * OPMapGadgetFactory::createGadget(QWidget *parent)
return new OPMapGadget(QString("OPMapGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration * OPMapGadgetFactory::createConfiguration(const QByteArray &state)
{
return new OPMapGadgetConfiguration(QString("OPMapGadget"), state);
}
IUAVGadgetConfiguration *OPMapGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new OPMapGadgetConfiguration(QString("OPMapGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~OPMapGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -27,26 +27,6 @@
#include "pfdgadgetconfiguration.h"
#include "utils/pathutils.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
PFDGadgetConfiguration::PFDGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_defaultDial("Unknown")
{
//if a saved configuration exists load it
if (state.count() > 0) {
QDataStream stream(state);
QString dialFile;
stream >> dialFile;
stream >> useOpenGLFlag;
stream >> hqFonts;
m_defaultDial=Utils::PathUtils().InsertDataPath(dialFile);
}
}
/**
* Loads a saved configuration or defaults if non exist.

View File

@ -36,7 +36,6 @@ class PFDGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit PFDGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit PFDGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
//set dial configuration functions

View File

@ -48,11 +48,6 @@ Core::IUAVGadget* PFDGadgetFactory::createGadget(QWidget *parent)
return new PFDGadget(QString("PFDGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *PFDGadgetFactory::createConfiguration(const QByteArray &state)
{
return new PFDGadgetConfiguration(QString("PFDGadget"), state);
}
IUAVGadgetConfiguration *PFDGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new PFDGadgetConfiguration(QString("PFDGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~PFDGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -26,57 +26,6 @@
*/
#include "scopegadgetconfiguration.h"
#include <QtCore/QDataStream>
ScopeGadgetConfiguration::ScopeGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_plotType((int)ChronoPlot),
m_dataSize(60),
m_refreshInterval(1000)
{
uint currentStreamVersion = 0;
int plotCurveCount = 0;
if (state.count() > 0) {
QDataStream stream(state);
stream >> currentStreamVersion;
if(currentStreamVersion != m_configurationStreamVersion)
return;
stream >> m_plotType;
stream >> m_dataSize;
stream >> m_refreshInterval;
stream >> plotCurveCount;
while(plotCurveCount-- > 0)
{
QString uavObject;
QString uavField;
QRgb color;
PlotCurveConfiguration* plotCurveConf = new PlotCurveConfiguration();
stream >> uavObject;
plotCurveConf->uavObject = uavObject;
stream >> uavField;
plotCurveConf->uavField = uavField;
stream >> color;
plotCurveConf->color = color;
stream >> plotCurveConf->yScalePower;
stream >> plotCurveConf->yMinimum;
stream >> plotCurveConf->yMaximum;
m_PlotCurveConfigs.append(plotCurveConf);
}
//The value is converted to milliseconds, so if it is < 100, it is still seconds
if(m_refreshInterval < 100)
m_refreshInterval *= 1000;
}
}
ScopeGadgetConfiguration::ScopeGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),

View File

@ -49,7 +49,6 @@ class ScopeGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit ScopeGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit ScopeGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
~ScopeGadgetConfiguration();

View File

@ -48,11 +48,6 @@ Core::IUAVGadget* ScopeGadgetFactory::createGadget(QWidget *parent)
return new ScopeGadget(QString("ScopeGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *ScopeGadgetFactory::createConfiguration(const QByteArray &state)
{
return new ScopeGadgetConfiguration(QString("ScopeGadget"), state);
}
IUAVGadgetConfiguration *ScopeGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new ScopeGadgetConfiguration(QString("ScopeGadget"), qSettings);

View File

@ -46,7 +46,6 @@ public:
~ScopeGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -27,24 +27,6 @@
#include "systemhealthgadgetconfiguration.h"
#include "utils/pathutils.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
SystemHealthGadgetConfiguration::SystemHealthGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
systemFile("Unknown")
{
//if a saved configuration exists load it
if (state.count() > 0) {
QDataStream stream(state);
QString diagram;
stream >> diagram;
systemFile = Utils::PathUtils().InsertDataPath(diagram);
}
}
/**
* Loads a saved configuration or defaults if non exist.

View File

@ -39,7 +39,6 @@ class SystemHealthGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit SystemHealthGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit SystemHealthGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
//set system health configuration functions

View File

@ -48,11 +48,6 @@ Core::IUAVGadget* SystemHealthGadgetFactory::createGadget(QWidget *parent)
return new SystemHealthGadget(QString("SystemHealthGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *SystemHealthGadgetFactory::createConfiguration(const QByteArray &state)
{
return new SystemHealthGadgetConfiguration(QString("SystemHealthGadget"), state);
}
IUAVGadgetConfiguration *SystemHealthGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new SystemHealthGadgetConfiguration(QString("SystemHealthGadget"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~SystemHealthGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -26,27 +26,6 @@
*/
#include "uavobjectbrowserconfiguration.h"
#include <QtCore/QDataStream>
UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_recentlyUpdatedColor(QColor(255, 230, 230)),
m_manuallyChangedColor(QColor(230, 230, 255)),
m_recentlyUpdatedTimeout(500)
{
if (state.count() > 0) {
QDataStream stream(state);
QColor recent;
QColor manual;
int timeout;
stream >> recent;
stream >> manual;
stream >> timeout;
m_recentlyUpdatedColor = recent;
m_manuallyChangedColor = manual;
m_recentlyUpdatedTimeout = timeout;
}
}
UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),

View File

@ -40,7 +40,6 @@ Q_PROPERTY(QColor m_recentlyUpdatedColor READ recentlyUpdatedColor WRITE setRece
Q_PROPERTY(QColor m_manuallyChangedColor READ manuallyChangedColor WRITE setManuallyChangedColor)
Q_PROPERTY(int m_recentlyUpdatedTimeout READ recentlyUpdatedTimeout WRITE setRecentlyUpdatedTimeout)
public:
explicit UAVObjectBrowserConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit UAVObjectBrowserConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings* settings) const;

View File

@ -46,11 +46,6 @@ Core::IUAVGadget* UAVObjectBrowserFactory::createGadget(QWidget *parent)
return new UAVObjectBrowser(QString("UAVObjectBrowser"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *UAVObjectBrowserFactory::createConfiguration(const QByteArray &state)
{
return new UAVObjectBrowserConfiguration(QString("UAVObjectBrowser"), state);
}
IUAVGadgetConfiguration *UAVObjectBrowserFactory::createConfiguration(QSettings* qSettings)
{
return new UAVObjectBrowserConfiguration(QString("UAVObjectBrowser"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~UAVObjectBrowserFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};

View File

@ -26,62 +26,8 @@
*/
#include "uploadergadgetconfiguration.h"
#include <QtCore/QDataStream>
#include <qextserialport/src/qextserialport.h>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
UploaderGadgetConfiguration::UploaderGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_defaultPort("Unknown"),
m_defaultSpeed(BAUD19200),
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 (state.count() > 0) {
QDataStream stream(state);
BaudRateType speed;
DataBitsType databits;
FlowType flow;
ParityType parity;
StopBitsType stopbits;
int ispeed;
int idatabits;
int iflow;
int iparity;
int istopbits;
QString port;
stream >> ispeed;
stream >> idatabits;
stream >>iflow;
stream >>iparity;
stream >> istopbits;
stream >> port;
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;
}
}
/**
* Loads a saved configuration or defaults if non exist.
*

View File

@ -37,7 +37,6 @@ class UploaderGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit UploaderGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent = 0);
explicit UploaderGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
//set port configuration functions

View File

@ -47,11 +47,6 @@ Core::IUAVGadget* UploaderGadgetFactory::createGadget(QWidget *parent)
return new UploaderGadget(QString("Uploader"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *UploaderGadgetFactory::createConfiguration(const QByteArray &state)
{
return new UploaderGadgetConfiguration(QString("Uploader"), state);
}
IUAVGadgetConfiguration *UploaderGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new UploaderGadgetConfiguration(QString("Uploader"), qSettings);

View File

@ -45,7 +45,6 @@ public:
~UploaderGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};