diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp new file mode 100644 index 000000000..9cbf38ca4 --- /dev/null +++ b/companion/src/appdata.cpp @@ -0,0 +1,640 @@ +// Companion Application Data Class Definition. +// Author Kjell Kernen + +#include "appdata.h" + +// ** CompStoreObj class******************** +void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3) +{ + QSettings settings(PRODUCT, COMPANY); + if (tag2.isEmpty()) + { + settings.remove(tag1); + } + else if (tag3.isEmpty()) + { + settings.beginGroup(tag1); + settings.remove(tag2); + settings.endGroup(); + } + else + { + settings.beginGroup(tag1); + settings.beginGroup(tag2); + settings.remove(tag3); + settings.endGroup(); + settings.endGroup(); + } +} + +void CompStoreObj::store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + settings.setValue(tag, newArray); + array = newArray; + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + settings.setValue(tag, newSList); + stringList = newSList; + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::store(const QString newString, QString &string, const QString tag, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + settings.setValue(tag, newString); + string = newString; + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::store(const bool newTruth, bool &truth, const QString tag, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + settings.setValue(tag, newTruth); + truth = newTruth; + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::store(const int newNumber, int &number, const QString tag, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + settings.setValue(tag, newNumber); + number = newNumber; + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +// Retrieval functions +void CompStoreObj::retrieve( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + array = settings.value(tag, def).toByteArray(); + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + stringList = settings.value(tag, def).toStringList(); + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::retrieve( QString &string, const QString tag, const QString def, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + string = settings.value(tag, def).toString(); + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::retrieve( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + truth = settings.value(tag, def).toBool(); + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +void CompStoreObj::retrieve( int &number, const QString tag, const int def, const QString group1, const QString group2 ) +{ + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); + + number = settings.value(tag, def).toInt(); + + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); +} + +// Retrieve and Store functions +void CompStoreObj::getset( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 ) +{ + retrieve( array, tag, def, group1, group2); + store(array, array, tag, group1, group2); +} + +void CompStoreObj::getset( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 ) +{ + retrieve( stringList, tag, def, group1, group2); + store(stringList, stringList, tag, group1, group2); +} + +void CompStoreObj::getset( QString &string, const QString tag, const QString def, const QString group1, const QString group2 ) +{ + retrieve( string, tag, def, group1, group2); + store(string, string, tag, group1, group2); +} + +void CompStoreObj::getset( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 ) +{ + retrieve( truth, tag, def, group1, group2); + store(truth, truth, tag, group1, group2); +} + +void CompStoreObj::getset( int &number, const QString tag, const int def, const QString group1, const QString group2 ) +{ + retrieve( number, tag, def, group1, group2); + store(number, number, tag, group1, group2); +} + +// ** FwRevision class******************** +int FwRevision::get( const QString fwName ) +{ + QString result; + retrieve( result, fwName, "", "FwRevisions" ); + return result.toInt(); +} + +void FwRevision::set( const QString fwName, const int fwRevision ) +{ + QString tempString= QString("%1").arg(fwRevision); + store( tempString, tempString, fwName, "FwRevisions" ); +} + +void FwRevision::remove( const QString tag ) +{ + clear( "FwRevisions", tag ); +} + +// ** JStickData class******************** +// Get declarations +int JStickData::stick_axe() { return _stickAxe; } +int JStickData::stick_min() { return _stickMin; } +int JStickData::stick_med() { return _stickMed; } +int JStickData::stick_max() { return _stickMax; } +int JStickData::stick_inv() { return _stickInv; } + +// Set declarations +void JStickData::stick_axe(const int it) { store( it, _stickAxe, QString("stick%1_axe").arg(index), "JsCalibration" );} +void JStickData::stick_min(const int it) { store( it, _stickMin, QString("stick%1_min").arg(index), "JsCalibration" );} +void JStickData::stick_med(const int it) { store( it, _stickMed, QString("stick%1_med").arg(index), "JsCalibration" );} +void JStickData::stick_max(const int it) { store( it, _stickMax, QString("stick%1_max").arg(index), "JsCalibration" );} +void JStickData::stick_inv(const int it) { store( it, _stickInv, QString("stick%1_inv").arg(index), "JsCalibration" );} + +// Constructor +JStickData::JStickData() +{ + index = -1; +} + +void JStickData::remove() +{ + // Remove all JStickData values from settings file + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup( "JsCalibration" ); + settings.remove( QString( "stick%1_axe").arg(index) ); + settings.remove( QString( "stick%1_min").arg(index) ); + settings.remove( QString( "stick%1_med").arg(index) ); + settings.remove( QString( "stick%1_max").arg(index) ); + settings.remove( QString( "stick%1_inv").arg(index) ); + settings.endGroup(); + + // Reset all JStickData variables to initial values + init(index); +} + +bool JStickData::existsOnDisk() +{ + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("JsCalibration"); + int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt(); + settings.endGroup(); + + return (axe > -1); +} + +void JStickData::init(int newIndex) +{ + index = newIndex; + _stickAxe = -1; + _stickMin = -32767; + _stickMed = 0; + _stickMax = 0; + _stickInv = 0; + + // Do not write empty joystick calibrations to disk. + if ( !existsOnDisk() ) + return; + + flush(); +} + +void JStickData::flush() +{ + getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); + getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); + getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" ); + getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" ); + getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); +} + +// ** Profile class******************** +// Get declarations +QString Profile::firmware() { return _firmware; } +QString Profile::name() { return _name; } +QString Profile::sdPath() { return _sdPath; } +QString Profile::splashFile() { return _splashFile; } +bool Profile::burnFirmware() { return _burnFirmware; } +bool Profile::renameFwFiles() { return _renameFwFiles; } +bool Profile::patchImage() { return _patchImage; } +int Profile::channelOrder() { return _channelOrder; } +int Profile::defaultMode() { return _defaultMode; } + +QString Profile::beeper() { return _beeper; } +QString Profile::countryCode() { return _countryCode; } +QString Profile::display() { return _display; } +QString Profile::haptic() { return _haptic; } +QString Profile::speaker() { return _speaker; } +QString Profile::stickPotCalib() { return _stickPotCalib; } +QString Profile::trainerCalib() { return _trainerCalib; } +int Profile::currentCalib() { return _currentCalib; } +int Profile::gsStickMode() { return _gsStickMode; } +int Profile::ppmMultiplier() { return _ppmMultiplier; } +int Profile::vBatCalib() { return _vBatCalib; } +int Profile::vBatWarn() { return _vBatWarn; } + +// Set declarations +void Profile::name (const QString x) { if (x.isEmpty()) // Name may never be empty! + store("----", _name, "Name", "Profiles", QString("profile%1").arg(index)); +else + store(x, _name, "Name", "Profiles", QString("profile%1").arg(index));} + +void Profile::firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));} +void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} +void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));} +void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));} +void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));} +void Profile::patchImage (const bool x) { store(x, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));} +void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));} +void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));} + +void Profile::beeper (const QString x) { store(x, _beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));} +void Profile::countryCode (const QString x) { store(x, _countryCode, "countryCode" ,"Profiles", QString("profile%1").arg(index));} +void Profile::display (const QString x) { store(x, _display, "Display" ,"Profiles", QString("profile%1").arg(index));} +void Profile::haptic (const QString x) { store(x, _haptic, "Haptic" ,"Profiles", QString("profile%1").arg(index));} +void Profile::speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));} +void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));} +void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));} +void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));} +void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));} +void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));} +void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));} +void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));} + +// Constructor +Profile::Profile() +{ + index = -1; +} + +void Profile::remove() +{ + // Remove all profile values from settings file + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("Profiles"); + settings.remove(QString("profile%1").arg(index)); + settings.endGroup(); + + // Reset all profile variables to initial values + init(index); +} + +bool Profile::existsOnDisk() +{ + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("Profiles"); + settings.beginGroup(QString("profile%1").arg(index)); + QStringList keyList = settings.allKeys(); + settings.endGroup(); + settings.endGroup(); + + return (keyList.length() > 0); +} + +void Profile::init(int newIndex) +{ + index = newIndex; + + _firmware = ""; + _name = ""; + _sdPath = ""; + _splashFile = ""; + _burnFirmware = false; + _renameFwFiles = false; + _patchImage = false; + _channelOrder = 0; + _defaultMode = 1; + + _beeper = ""; + _countryCode = ""; + _display = ""; + _haptic = ""; + _speaker = ""; + _stickPotCalib = ""; + _trainerCalib = ""; + + _currentCalib = 0; + _gsStickMode = 0; + _ppmMultiplier = 0; + _vBatCalib = 0; + _vBatWarn = 0; + + // Do not write empty profiles to disk except the default (0) profile. + if ( index > 0 && !existsOnDisk()) + return; + + flush(); +} + +void Profile::flush() +{ + // Load and store all variables. Use default values if setting values are missing + getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _name, "Name" ,"----" ,"Profiles", QString("profile%1").arg(index)); + getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); + + getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); +} + + +// ** AppData class******************** + +// Get declarations +QStringList AppData::recentFiles() { return _recentFiles; } +QByteArray AppData::mainWinGeo() { return _mainWinGeo; } +QByteArray AppData::mainWinState() { return _mainWinState; } +QByteArray AppData::modelEditGeo() { return _modelEditGeo; } + +QString AppData::armMcu() { return _armMcu; } +QString AppData::avrArguments() { return _avrArguments; } +QString AppData::avrPort() { return _avrPort; } +QString AppData::avrdudeLocation() { return _avrdudeLocation; } +QString AppData::compileServer() { return _compileServer; } +QString AppData::cpuId() { return _cpuId; } +QString AppData::dfuArguments() { return _dfuArguments; } +QString AppData::dfuLocation() { return _dfuLocation; } +QString AppData::lastFw() { return _lastFw; } +QString AppData::locale() { return _locale; } +QString AppData::mcu() { return _mcu; } +QString AppData::programmer() { return _programmer; } +QString AppData::sambaLocation() { return _sambaLocation; } +QString AppData::sambaPort() { return _sambaPort; } + +QString AppData::backupDir() { return _backupDir; } +QString AppData::gePath() { return _gePath; } +QString AppData::eepromDir() { return _eepromDir; } +QString AppData::flashDir() { return _flashDir; } +QString AppData::imagesDir() { return _imagesDir; } +QString AppData::logDir() { return _logDir; } +QString AppData::libDir() { return _libDir; } +QString AppData::snapshotDir() { return _snapshotDir; } +QString AppData::updatesDir() { return _updatesDir; } + +bool AppData::enableBackup() { return _enableBackup; } +bool AppData::backupOnFlash() { return _backupOnFlash; } +bool AppData::jsSupport() { return _jsSupport; } +bool AppData::rev4aSupport() { return _rev4aSupport; } +bool AppData::maximized() { return _maximized; } +bool AppData::showSplash() { return _showSplash; } +bool AppData::snapToClpbrd() { return _snapToClpbrd; } +bool AppData::autoCheckApp() { return _autoCheckApp; } +bool AppData::autoCheckFw() { return _autoCheckFw; } +bool AppData::simuSW() { return _simuSW; } +bool AppData::enableWizard() { return _enableWizard; } + +int AppData::backLight() { return _backLight; } +int AppData::embedSplashes() { return _embedSplashes; } +int AppData::fwServerFails() { return _fwServerFails; } +int AppData::generalEditTab() { return _generalEditTab; } +int AppData::iconSize() { return _iconSize; } +int AppData::historySize() { return _historySize; } +int AppData::jsCtrl() { return _jsCtrl; } +int AppData::modelEditTab() { return _modelEditTab; } +int AppData::id() { return _id; } +int AppData::theme() { return _theme; } +int AppData::warningId() { return _warningId; } + +// Set declarations +void AppData::recentFiles (const QStringList x) { store(x, _recentFiles, "recentFileList" );} +void AppData::mainWinGeo (const QByteArray x) { store(x, _mainWinGeo, "mainWindowGeometry" );} +void AppData::mainWinState (const QByteArray x) { store(x, _mainWinState, "mainWindowState" );} +void AppData::modelEditGeo (const QByteArray x) { store(x, _modelEditGeo, "modelEditGeometry" );} + +void AppData::armMcu (const QString x) { store(x, _armMcu, "arm_mcu" );} +void AppData::avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );} +void AppData::avrPort (const QString x) { store(x, _avrPort, "avr_port" );} +void AppData::avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );} +void AppData::compileServer (const QString x) { store(x, _compileServer, "compilation-server" );} +void AppData::cpuId (const QString x) { store(x, _cpuId, "cpu_id" );} +void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );} +void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );} +void AppData::lastFw (const QString x) { store(x, _lastFw, "lastFw" );} +void AppData::locale (const QString x) { store(x, _locale, "locale" );} +void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );} +void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );} +void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );} +void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );} + +void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );} +void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );} +void AppData::eepromDir (const QString x) { store(x, _eepromDir, "lastDir" );} +void AppData::flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );} +void AppData::imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );} +void AppData::logDir (const QString x) { store(x, _logDir, "lastLogDir" );} +void AppData::libDir (const QString x) { store(x, _libDir, "libraryPath" );} +void AppData::snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );} +void AppData::updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );} + +void AppData::enableBackup (const bool x) { store(x, _enableBackup, "backupEnable" );} +void AppData::backupOnFlash (const bool x) { store(x, _backupOnFlash, "backupOnFlash" );} +void AppData::maximized (const bool x) { store(x, _maximized, "maximized" );} +void AppData::jsSupport (const bool x) { store(x, _jsSupport, "js_support" );} +void AppData::rev4aSupport (const bool x) { store(x, _rev4aSupport, "rev4asupport" );} +void AppData::showSplash (const bool x) { store(x, _showSplash, "show_splash" );} +void AppData::snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );} +void AppData::autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );} +void AppData::autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );} +void AppData::simuSW (const bool x) { store(x, _simuSW, "simuSW" );} +void AppData::enableWizard (const bool x) { store(x, _enableWizard, "wizardEnable" );} + +void AppData::backLight (const int x) { store(x, _backLight, "backLight" );} +void AppData::embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );} +void AppData::fwServerFails (const int x) { store(x, _fwServerFails, "fwserver" );} +void AppData::generalEditTab (const int x) { store(x, _generalEditTab, "generalEditTab" );} +void AppData::iconSize (const int x) { store(x, _iconSize, "icon_size" );} +void AppData::historySize (const int x) { store(x, _historySize, "history_size" );} +void AppData::jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );} +void AppData::modelEditTab (const int x) { store(x, _modelEditTab, "modelEditTab" );} +void AppData::id (const int x) { store(x, _id, "profileId" );} +void AppData::theme (const int x) { store(x, _theme, "theme" );} +void AppData::warningId (const int x) { store(x, _warningId, "warningId" );} + +// Constructor +AppData::AppData() +{ + //Initialize the profiles + for (int i=0; i +#ifndef COMPANION_APPDATA_H +#define COMPANION_APPDATA_H +#include +#include +#include +#include #define COMPANY "OpenTX Companion" #define PRODUCT "OpenTX" + #define MAX_PROFILES 15 #define MAX_JOYSTICKS 8 -class CompanionDataObj +class CompStoreObj { public: - void clear (const QString tag1="", const QString tag2="", const QString tag3="") - { - QSettings settings(PRODUCT, COMPANY); - if (tag2.isEmpty()) - { - settings.remove(tag1); - } - else if (tag3.isEmpty()) - { - settings.beginGroup(tag1); - settings.remove(tag2); - settings.endGroup(); - } - else - { - settings.beginGroup(tag1); - settings.beginGroup(tag2); - settings.remove(tag3); - settings.endGroup(); - settings.endGroup(); - } - } - - void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - settings.setValue(tag, newArray); - array = newArray; - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - settings.setValue(tag, newSList); - stringList = newSList; - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - settings.setValue(tag, newString); - string = newString; - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - settings.setValue(tag, newTruth); - truth = newTruth; - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - settings.setValue(tag, newNumber); - number = newNumber; - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } + void clear (const QString tag1="", const QString tag2="", const QString tag3=""); + void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" ); + void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" ); + void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" ); + void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" ); + void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" ); // Retrieval functions - void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - array = settings.value(tag, def).toByteArray(); - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - stringList = settings.value(tag, def).toStringList(); - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - string = settings.value(tag, def).toString(); - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - truth = settings.value(tag, def).toBool(); - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } - - void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ) - { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); - - number = settings.value(tag, def).toInt(); - - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); - } + void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ); + void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ); // Retrieve and Store functions - void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ) - { - retrieve( array, tag, def, group1, group2); - store(array, array, tag, group1, group2); - } - - void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ) - { - retrieve( stringList, tag, def, group1, group2); - store(stringList, stringList, tag, group1, group2); - } - - void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ) - { - retrieve( string, tag, def, group1, group2); - store(string, string, tag, group1, group2); - } - - void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ) - { - retrieve( truth, tag, def, group1, group2); - store(truth, truth, tag, group1, group2); - } - - void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ) - { - retrieve( number, tag, def, group1, group2); - store(number, number, tag, group1, group2); - } + void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ); + void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ); }; -class FwRevision:CompanionDataObj +class FwRevision:protected CompStoreObj { public: - int get( const QString fwName ) - { - QString result; - retrieve( result, fwName, "", "FwRevisions" ); - return result.toInt(); - } - - void set( const QString fwName, const int fwRevision ) - { - QString tempString= QString("%1").arg(fwRevision); - store( tempString, tempString, fwName, "FwRevisions" ); - } - - void remove( const QString tag ) - { - clear( "FwRevisions", tag ); - } + int get( const QString); + void set( const QString, const int ); + void remove( const QString ); }; -class JStickData:CompanionDataObj +class JStickData:protected CompStoreObj { private: int index; @@ -233,80 +64,28 @@ private: int _stickInv; public: -public: - // All the get declarations - int stick_axe() { return _stickAxe; } - int stick_min() { return _stickMin; } - int stick_med() { return _stickMed; } - int stick_max() { return _stickMax; } - int stick_inv() { return _stickInv; } + // All the get definitions + int stick_axe(); + int stick_min(); + int stick_med(); + int stick_max(); + int stick_inv(); - // All the set declarations - void stick_axe(const int it) { store( it, _stickAxe, QString("stick%1_axe").arg(index), "JsCalibration" );} - void stick_min(const int it) { store( it, _stickMin, QString("stick%1_min").arg(index), "JsCalibration" );} - void stick_med(const int it) { store( it, _stickMed, QString("stick%1_med").arg(index), "JsCalibration" );} - void stick_max(const int it) { store( it, _stickMax, QString("stick%1_max").arg(index), "JsCalibration" );} - void stick_inv(const int it) { store( it, _stickInv, QString("stick%1_inv").arg(index), "JsCalibration" );} + // All the set definitions + void stick_axe(const int); + void stick_min(const int); + void stick_med(const int); + void stick_max(const int); + void stick_inv(const int); - // Constructor - JStickData() - { - index = -1; - } - - void remove() - { - // Remove all JStickData values from settings file - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup( "JsCalibration" ); - settings.remove( QString( "stick%1_axe").arg(index) ); - settings.remove( QString( "stick%1_min").arg(index) ); - settings.remove( QString( "stick%1_med").arg(index) ); - settings.remove( QString( "stick%1_max").arg(index) ); - settings.remove( QString( "stick%1_inv").arg(index) ); - settings.endGroup(); - - // Reset all JStickData variables to initial values - init(index); - } - - bool existsOnDisk() - { - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("JsCalibration"); - int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt(); - settings.endGroup(); - - return (axe > -1); - } - - void init(int newIndex) - { - index = newIndex; - _stickAxe = -1; - _stickMin = -32767; - _stickMed = 0; - _stickMax = 0; - _stickInv = 0; - - // Do not write empty joystick calibrations to disk. - if ( !existsOnDisk() ) - return; - - flush(); - } - - void flush() - { - getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); - getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); - getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" ); - getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" ); - getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); - } + JStickData(); + void remove(); + bool existsOnDisk(); + void init(int index); + void flush(); }; -class Profile:CompanionDataObj +class Profile:protected CompStoreObj { private: // Class Internal Variable @@ -338,152 +117,62 @@ private: int _vBatWarn; public: - // All the get declarations - QString firmware() { return _firmware; } - QString name() { return _name; } - QString sdPath() { return _sdPath; } - QString splashFile() { return _splashFile; } - bool burnFirmware() { return _burnFirmware; } - bool renameFwFiles() { return _renameFwFiles; } - bool patchImage() { return _patchImage; } - int channelOrder() { return _channelOrder; } - int defaultMode() { return _defaultMode; } + // All the get definitions + QString firmware(); + QString name(); + QString sdPath(); + QString splashFile(); + bool burnFirmware(); + bool renameFwFiles(); + bool patchImage(); + int channelOrder(); + int defaultMode(); - QString beeper() { return _beeper; } - QString countryCode() { return _countryCode; } - QString display() { return _display; } - QString haptic() { return _haptic; } - QString speaker() { return _speaker; } - QString stickPotCalib() { return _stickPotCalib; } - QString trainerCalib() { return _trainerCalib; } - int currentCalib() { return _currentCalib; } - int gsStickMode() { return _gsStickMode; } - int ppmMultiplier() { return _ppmMultiplier; } - int vBatCalib() { return _vBatCalib; } - int vBatWarn() { return _vBatWarn; } + QString beeper(); + QString countryCode(); + QString display(); + QString haptic(); + QString speaker(); + QString stickPotCalib(); + QString trainerCalib(); + int currentCalib(); + int gsStickMode(); + int ppmMultiplier(); + int vBatCalib(); + int vBatWarn(); - // All the set declarations - void name (const QString x) { if (x.isEmpty()) // Name may never be empty! - store("----", _name, "Name" ,"Profiles", QString("profile%1").arg(index)); - else - store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));} + // All the set definitions + void name (const QString); + void firmware (const QString); + void sdPath (const QString); + void splashFile (const QString); + void burnFirmware (const bool); + void renameFwFiles (const bool); + void patchImage (const bool); + void channelOrder (const int); + void defaultMode (const int); - void firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));} - void sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} - void splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));} - void burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));} - void renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));} - void patchImage (const bool x) { store(x, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));} - void channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));} - void defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));} + void beeper (const QString); + void countryCode (const QString); + void display (const QString); + void haptic (const QString); + void speaker (const QString); + void stickPotCalib (const QString); + void trainerCalib (const QString); + void currentCalib (const int); + void gsStickMode (const int); + void ppmMultiplier (const int); + void vBatCalib (const int); + void vBatWarn (const int); - void beeper (const QString x) { store(x, _beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));} - void countryCode (const QString x) { store(x, _countryCode, "countryCode" ,"Profiles", QString("profile%1").arg(index));} - void display (const QString x) { store(x, _display, "Display" ,"Profiles", QString("profile%1").arg(index));} - void haptic (const QString x) { store(x, _haptic, "Haptic" ,"Profiles", QString("profile%1").arg(index));} - void speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));} - void stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));} - void trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));} - void currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));} - void gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));} - void ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));} - void vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));} - void vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));} - - // Constructor - Profile() - { - index = -1; - } - - void remove() - { - // Remove all profile values from settings file - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("Profiles"); - settings.remove(QString("profile%1").arg(index)); - settings.endGroup(); - - // Reset all profile variables to initial values - init(index); - } - - bool existsOnDisk() - { - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("Profiles"); - settings.beginGroup(QString("profile%1").arg(index)); - QStringList keyList = settings.allKeys(); - settings.endGroup(); - settings.endGroup(); - - return (keyList.length() > 0); - } - - void init(int newIndex) - { - index = newIndex; - - _firmware = ""; - _name = ""; - _sdPath = ""; - _splashFile = ""; - _burnFirmware = false; - _renameFwFiles = false; - _patchImage = false; - _channelOrder = 0; - _defaultMode = 1; - - _beeper = ""; - _countryCode = ""; - _display = ""; - _haptic = ""; - _speaker = ""; - _stickPotCalib = ""; - _trainerCalib = ""; - - _currentCalib = 0; - _gsStickMode = 0; - _ppmMultiplier = 0; - _vBatCalib = 0; - _vBatWarn = 0; - - // Do not write empty profiles to disk except the default (0) profile. - if ( index > 0 && !existsOnDisk()) - return; - - flush(); - } - - void flush() - { - // Load and store all variables. Use default values if setting values are missing - getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _name, "Name" ,"----" ,"Profiles", QString("profile%1").arg(index)); - getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); - - getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); - } + Profile(); + void remove(); + bool existsOnDisk(); + void init(int newIndex); + void flush(); }; -class AppData:CompanionDataObj +class AppData:protected CompStoreObj { // All the global variables public: @@ -548,223 +237,120 @@ private: public: - // All the get declarations - QStringList recentFiles() { return _recentFiles; } - QByteArray mainWinGeo() { return _mainWinGeo; } - QByteArray mainWinState() { return _mainWinState; } - QByteArray modelEditGeo() { return _modelEditGeo; } + // All the get definitions + QStringList recentFiles(); + QByteArray mainWinGeo(); + QByteArray mainWinState(); + QByteArray modelEditGeo(); - QString armMcu() { return _armMcu; } - QString avrArguments() { return _avrArguments; } - QString avrPort() { return _avrPort; } - QString avrdudeLocation() { return _avrdudeLocation; } - QString compileServer() { return _compileServer; } - QString cpuId() { return _cpuId; } - QString dfuArguments() { return _dfuArguments; } - QString dfuLocation() { return _dfuLocation; } - QString lastFw() { return _lastFw; } - QString locale() { return _locale; } - QString mcu() { return _mcu; } - QString programmer() { return _programmer; } - QString sambaLocation() { return _sambaLocation; } - QString sambaPort() { return _sambaPort; } + QString armMcu(); + QString avrArguments(); + QString avrPort(); + QString avrdudeLocation(); + QString compileServer(); + QString cpuId(); + QString dfuArguments(); + QString dfuLocation(); + QString lastFw(); + QString locale(); + QString mcu(); + QString programmer(); + QString sambaLocation(); + QString sambaPort(); - QString backupDir() { return _backupDir; } - QString gePath() { return _gePath; } - QString eepromDir() { return _eepromDir; } - QString flashDir() { return _flashDir; } - QString imagesDir() { return _imagesDir; } - QString logDir() { return _logDir; } - QString libDir() { return _libDir; } - QString snapshotDir() { return _snapshotDir; } - QString updatesDir() { return _updatesDir; } + QString backupDir(); + QString gePath(); + QString eepromDir(); + QString flashDir(); + QString imagesDir(); + QString logDir(); + QString libDir(); + QString snapshotDir(); + QString updatesDir(); - bool enableBackup() { return _enableBackup; } - bool backupOnFlash() { return _backupOnFlash; } - bool jsSupport() { return _jsSupport; } - bool rev4aSupport() { return _rev4aSupport; } - bool maximized() { return _maximized; } - bool showSplash() { return _showSplash; } - bool snapToClpbrd() { return _snapToClpbrd; } - bool autoCheckApp() { return _autoCheckApp; } - bool autoCheckFw() { return _autoCheckFw; } - bool simuSW() { return _simuSW; } - bool enableWizard() { return _enableWizard; } + bool enableBackup(); + bool backupOnFlash(); + bool jsSupport(); + bool rev4aSupport(); + bool maximized(); + bool showSplash(); + bool snapToClpbrd(); + bool autoCheckApp(); + bool autoCheckFw(); + bool simuSW(); + bool enableWizard(); - int backLight() { return _backLight; } - int embedSplashes() { return _embedSplashes; } - int fwServerFails() { return _fwServerFails; } - int generalEditTab() { return _generalEditTab; } - int iconSize() { return _iconSize; } - int historySize() { return _historySize; } - int jsCtrl() { return _jsCtrl; } - int modelEditTab() { return _modelEditTab; } - int id() { return _id; } - int theme() { return _theme; } - int warningId() { return _warningId; } + int backLight(); + int embedSplashes(); + int fwServerFails(); + int generalEditTab(); + int iconSize(); + int historySize(); + int jsCtrl(); + int modelEditTab(); + int id(); + int theme(); + int warningId(); - // All the set declarations - void recentFiles (const QStringList x) { store(x, _recentFiles, "recentFileList" );} - void mainWinGeo (const QByteArray x) { store(x, _mainWinGeo, "mainWindowGeometry" );} - void mainWinState (const QByteArray x) { store(x, _mainWinState, "mainWindowState" );} - void modelEditGeo (const QByteArray x) { store(x, _modelEditGeo, "modelEditGeometry" );} + // All the set definitions + void recentFiles (const QStringList x); + void mainWinGeo (const QByteArray); + void mainWinState (const QByteArray); + void modelEditGeo (const QByteArray); - void armMcu (const QString x) { store(x, _armMcu, "arm_mcu" );} - void avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );} - void avrPort (const QString x) { store(x, _avrPort, "avr_port" );} - void avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );} - void compileServer (const QString x) { store(x, _compileServer, "compilation-server" );} - void cpuId (const QString x) { store(x, _cpuId, "cpu_id" );} - void dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );} - void dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );} - void lastFw (const QString x) { store(x, _lastFw, "lastFw" );} - void locale (const QString x) { store(x, _locale, "locale" );} - void mcu (const QString x) { store(x, _mcu, "mcu" );} - void programmer (const QString x) { store(x, _programmer, "programmer" );} - void sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );} - void sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );} + void armMcu (const QString); + void avrArguments (const QString); + void avrPort (const QString); + void avrdudeLocation (const QString); + void compileServer (const QString); + void cpuId (const QString); + void dfuArguments (const QString); + void dfuLocation (const QString); + void lastFw (const QString); + void locale (const QString); + void mcu (const QString); + void programmer (const QString); + void sambaLocation (const QString); + void sambaPort (const QString); - void backupDir (const QString x) { store(x, _backupDir, "backupPath" );} - void gePath (const QString x) { store(x, _gePath, "gePath" );} - void eepromDir (const QString x) { store(x, _eepromDir, "lastDir" );} - void flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );} - void imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );} - void logDir (const QString x) { store(x, _logDir, "lastLogDir" );} - void libDir (const QString x) { store(x, _libDir, "libraryPath" );} - void snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );} - void updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );} + void backupDir (const QString); + void gePath (const QString); + void eepromDir (const QString); + void flashDir (const QString); + void imagesDir (const QString); + void logDir (const QString); + void libDir (const QString); + void snapshotDir (const QString); + void updatesDir (const QString); - void enableBackup (const bool x) { store(x, _enableBackup, "backupEnable" );} - void backupOnFlash (const bool x) { store(x, _backupOnFlash, "backupOnFlash" );} - void maximized (const bool x) { store(x, _maximized, "maximized" );} - void jsSupport (const bool x) { store(x, _jsSupport, "js_support" );} - void rev4aSupport (const bool x) { store(x, _rev4aSupport, "rev4asupport" );} - void showSplash (const bool x) { store(x, _showSplash, "show_splash" );} - void snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );} - void autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );} - void autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );} - void simuSW (const bool x) { store(x, _simuSW, "simuSW" );} - void enableWizard (const bool x) { store(x, _enableWizard, "wizardEnable" );} + void enableBackup (const bool); + void backupOnFlash (const bool); + void maximized (const bool); + void jsSupport (const bool); + void rev4aSupport (const bool); + void showSplash (const bool); + void snapToClpbrd (const bool); + void autoCheckApp (const bool); + void autoCheckFw (const bool); + void simuSW (const bool); + void enableWizard (const bool); - void backLight (const int x) { store(x, _backLight, "backLight" );} - void embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );} - void fwServerFails (const int x) { store(x, _fwServerFails, "fwserver" );} - void generalEditTab (const int x) { store(x, _generalEditTab, "generalEditTab" );} - void iconSize (const int x) { store(x, _iconSize, "icon_size" );} - void historySize (const int x) { store(x, _historySize, "history_size" );} - void jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );} - void modelEditTab (const int x) { store(x, _modelEditTab, "modelEditTab" );} - void id (const int x) { store(x, _id, "profileId" );} - void theme (const int x) { store(x, _theme, "theme" );} - void warningId (const int x) { store(x, _warningId, "warningId" );} + void backLight (const int); + void embedSplashes (const int); + void fwServerFails (const int); + void generalEditTab (const int); + void iconSize (const int); + void historySize (const int); + void jsCtrl (const int); + void modelEditTab (const int); + void id (const int); + void theme (const int); + void warningId (const int); // Constructor - AppData() - { - //Initialize the profiles - for (int i=0; i