1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

All function names changed to a consistent standard.

Cleaned up indentation of appdata.h
This commit is contained in:
Kjell Kernen 2014-02-19 14:01:34 +01:00
parent 82910acffe
commit 80ef2b8d38
18 changed files with 521 additions and 523 deletions

View file

@ -1,4 +1,6 @@
// Companion Application Data Class. // Companion Application Data Class.
// Author Kjell Kernen
// All temporary and permanent global variables are defined here to make // All temporary and permanent global variables are defined here to make
// initialization and storage safe and visible. // initialization and storage safe and visible.
// Do not access variables in QSettings directly, it is not type safe! // Do not access variables in QSettings directly, it is not type safe!
@ -224,27 +226,27 @@ class JStickData:DataObj
private: private:
int index; int index;
int _stick_axe; int _stickAxe;
int _stick_min; int _stickMin;
int _stick_med; int _stickMed;
int _stick_max; int _stickMax;
int _stick_inv; int _stickInv;
public: public:
public: public:
// All the get declarations // All the get declarations
int stick_axe() { return _stick_axe; } int stick_axe() { return _stickAxe; }
int stick_min() { return _stick_min; } int stick_min() { return _stickMin; }
int stick_med() { return _stick_med; } int stick_med() { return _stickMed; }
int stick_max() { return _stick_max; } int stick_max() { return _stickMax; }
int stick_inv() { return _stick_inv; } int stick_inv() { return _stickInv; }
// All the set declarations // All the set declarations
void stick_axe(const int it) { store( it, _stick_axe, QString("stick%1_axe").arg(index), "JsCalibration" );} void stick_axe(const int it) { store( it, _stickAxe, QString("stick%1_axe").arg(index), "JsCalibration" );}
void stick_min(const int it) { store( it, _stick_min, QString("stick%1_min").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, _stick_med, QString("stick%1_med").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, _stick_max, QString("stick%1_max").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, _stick_inv, QString("stick%1_inv").arg(index), "JsCalibration" );} void stick_inv(const int it) { store( it, _stickInv, QString("stick%1_inv").arg(index), "JsCalibration" );}
// Constructor // Constructor
JStickData() JStickData()
@ -281,11 +283,11 @@ public:
void init(int newIndex) void init(int newIndex)
{ {
index = newIndex; index = newIndex;
_stick_axe = -1; _stickAxe = -1;
_stick_min = -32767; _stickMin = -32767;
_stick_med = 0; _stickMed = 0;
_stick_max = 0; _stickMax = 0;
_stick_inv = 0; _stickInv = 0;
// Do not write empty joystick calibrations to disk. // Do not write empty joystick calibrations to disk.
if ( !existsOnDisk() ) if ( !existsOnDisk() )
@ -296,11 +298,11 @@ public:
void flush() void flush()
{ {
getset( _stick_axe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" );
getset( _stick_min, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" );
getset( _stick_med, QString("stick%1_med").arg(index), 0, "JsCalibration" ); getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" );
getset( _stick_max, QString("stick%1_max").arg(index), 0, "JsCalibration" ); getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" );
getset( _stick_inv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" );
} }
}; };
@ -312,81 +314,81 @@ private:
// Application Variables // Application Variables
QString _firmware; QString _firmware;
QString _Name; QString _name;
QString _sdPath; QString _sdPath;
QString _SplashFileName; QString _splashFile;
bool _burnFirmware; bool _burnFirmware;
bool _rename_firmware_files; bool _renameFwFiles;
bool _patchImage; bool _patchImage;
int _default_channel_order; int _channelOrder;
int _default_mode; int _defaultMode;
// Firmware Variables // Firmware Variables
QString _Beeper; QString _beeper;
QString _countryCode; QString _countryCode;
QString _Display; QString _display;
QString _Haptic; QString _haptic;
QString _Speaker; QString _speaker;
QString _StickPotCalib; QString _stickPotCalib;
QString _TrainerCalib; QString _trainerCalib;
int _currentCalib; int _currentCalib;
int _GSStickMode; int _gsStickMode;
int _PPM_Multiplier; int _ppmMultiplier;
int _VbatCalib; int _vBatCalib;
int _vBatWarn; int _vBatWarn;
public: public:
// All the get declarations // All the get declarations
QString firmware() { return _firmware; } QString firmware() { return _firmware; }
QString Name() { return _Name; } QString name() { return _name; }
QString sdPath() { return _sdPath; } QString sdPath() { return _sdPath; }
QString SplashFileName() { return _SplashFileName; } QString splashFile() { return _splashFile; }
bool burnFirmware() { return _burnFirmware; } bool burnFirmware() { return _burnFirmware; }
bool rename_firmware_files() { return _rename_firmware_files; } bool renameFwFiles() { return _renameFwFiles; }
bool patchImage() { return _patchImage; } bool patchImage() { return _patchImage; }
int default_channel_order() { return _default_channel_order; } int channelOrder() { return _channelOrder; }
int default_mode() { return _default_mode; } int defaultMode() { return _defaultMode; }
QString Beeper() { return _Beeper; } QString beeper() { return _beeper; }
QString countryCode() { return _countryCode; } QString countryCode() { return _countryCode; }
QString Display() { return _Display; } QString display() { return _display; }
QString Haptic() { return _Haptic; } QString haptic() { return _haptic; }
QString Speaker() { return _Speaker; } QString speaker() { return _speaker; }
QString StickPotCalib() { return _StickPotCalib; } QString stickPotCalib() { return _stickPotCalib; }
QString TrainerCalib() { return _TrainerCalib; } QString trainerCalib() { return _trainerCalib; }
int currentCalib() { return _currentCalib; } int currentCalib() { return _currentCalib; }
int GSStickMode() { return _GSStickMode; } int gsStickMode() { return _gsStickMode; }
int PPM_Multiplier() { return _PPM_Multiplier; } int ppmMultiplier() { return _ppmMultiplier; }
int VbatCalib() { return _VbatCalib; } int vBatCalib() { return _vBatCalib; }
int vBatWarn() { return _vBatWarn; } int vBatWarn() { return _vBatWarn; }
// All the set declarations // All the set declarations
void Name (const QString str) { if (str.isEmpty()) // Name may never be empty! void name (const QString x) { if (x.isEmpty()) // Name may never be empty!
store("----", _Name, "Name" ,"Profiles", QString("profile%1").arg(index)); store("----", _name, "Name" ,"Profiles", QString("profile%1").arg(index));
else else
store(str, _Name, "Name" ,"Profiles", QString("profile%1").arg(index));} store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));}
void firmware (const QString str) { store(str, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));} void firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));}
void sdPath (const QString str) { store(str, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} void sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));}
void SplashFileName (const QString str) { store(str, _SplashFileName, "SplashFileName" ,"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 bl) { store(bl, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));} void burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));}
void rename_firmware_files (const bool bl) { store(bl, _rename_firmware_files, "rename_firmware_files" ,"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 bl) { store(bl, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));} void patchImage (const bool x) { store(x, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));}
void default_channel_order (const int it) { store(it, _default_channel_order, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));} void channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));}
void default_mode (const int it) { store(it, _default_mode, "default_mode" ,"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 str) { store(str, _Beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));} void beeper (const QString x) { store(x, _beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));}
void countryCode (const QString str) { store(str, _countryCode, "countryCode" ,"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 str) { store(str, _Display, "Display" ,"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 str) { store(str, _Haptic, "Haptic" ,"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 str) { store(str, _Speaker, "Speaker" ,"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 str) { store(str, _StickPotCalib, "StickPotCalib" ,"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 str) { store(str, _TrainerCalib, "TrainerCalib" ,"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 it) { store(it, _currentCalib, "currentCalib" ,"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 it) { store(it, _GSStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));} void gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
void PPM_Multiplier (const int it) { store(it, _PPM_Multiplier, "PPM_Multiplier" ,"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 it) { store(it, _VbatCalib, "VbatCalib" ,"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 it) { store(it, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));} void vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
// Constructor // Constructor
Profile() Profile()
@ -422,32 +424,29 @@ public:
{ {
index = newIndex; index = newIndex;
_firmware = ""; _firmware = "";
_Name = ""; _name = "";
_sdPath = ""; _sdPath = "";
_SplashFileName = ""; _splashFile = "";
_burnFirmware = false; _burnFirmware = false;
_rename_firmware_files = false; _renameFwFiles = false;
_patchImage = false; _patchImage = false;
_default_channel_order = 0; _channelOrder = 0;
_default_mode = 1; _defaultMode = 1;
_Beeper = ""; _beeper = "";
_countryCode = ""; _countryCode = "";
_Display = ""; _display = "";
_Haptic = ""; _haptic = "";
_Speaker = ""; _speaker = "";
_StickPotCalib = ""; _stickPotCalib = "";
_TrainerCalib = ""; _trainerCalib = "";
_currentCalib = 0; _currentCalib = 0;
_GSStickMode = 0; _gsStickMode = 0;
_PPM_Multiplier = 0; _ppmMultiplier = 0;
_VbatCalib = 0; _vBatCalib = 0;
_vBatWarn = 0; _vBatWarn = 0;
QString pName;
retrieve( pName, "Name", "", "Profiles", QString("profile%1").arg(index));
// Do not write empty profiles to disk except the default (0) profile. // Do not write empty profiles to disk except the default (0) profile.
if ( index > 0 && !existsOnDisk()) if ( index > 0 && !existsOnDisk())
@ -459,28 +458,28 @@ public:
void flush() void flush()
{ {
// Load and store all variables. Use default values if setting values are missing // Load and store all variables. Use default values if setting values are missing
getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _Name, "Name" ,"----" ,"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( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _SplashFileName, "SplashFileName" ,"" ,"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( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index));
getset( _rename_firmware_files, "rename_firmware_files" ,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( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index));
getset( _default_channel_order, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _default_mode, "default_mode" ,1 ,"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( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _countryCode, "countryCode" ,"" ,"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( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _Haptic, "Haptic" ,"" ,"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( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _StickPotCalib, "StickPotCalib" ,"" ,"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( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"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( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _PPM_Multiplier, "PPM_Multiplier" ,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( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
} }
}; };
@ -493,168 +492,168 @@ public:
FwRevision fwRev; FwRevision fwRev;
private: private:
QStringList _recentFileList; QStringList _recentFiles;
QByteArray _mainWindowGeometry; QByteArray _mainWinGeo;
QByteArray _mainWindowState; QByteArray _mainWinState;
QByteArray _modelEditGeometry; QByteArray _modelEditGeo;
QString _arm_mcu; QString _armMcu;
QString _avr_arguments; QString _avrArguments;
QString _avr_port; QString _avrPort;
QString _avrdude_location; QString _avrdudeLocation;
QString _cpu_id; QString _cpuId;
QString _dfu_arguments; QString _dfuArguments;
QString _dfu_location; QString _dfuLocation;
QString _lastFw; QString _lastFw;
QString _locale; QString _locale;
QString _mcu; QString _mcu;
QString _programmer; QString _programmer;
QString _samba_location; QString _sambaLocation;
QString _samba_port; QString _sambaPort;
QString _backupPath; QString _backupDir;
QString _compilationServer; QString _compileServer;
QString _gePath; QString _gePath;
QString _lastDir; QString _lastDir;
QString _lastFlashDir; QString _flashDir;
QString _lastImagesDir; QString _imagesDir;
QString _lastLogDir; QString _logDir;
QString _libraryPath; QString _libDir;
QString _snapshotpath; QString _snapshotDir;
bool _backupEnable; bool _enableBackup;
bool _backupOnFlash; bool _backupOnFlash;
bool _maximized; bool _maximized;
bool _js_support; bool _jsSupport;
bool _rev4asupport; bool _rev4aSupport;
bool _show_splash; bool _showSplash;
bool _snapshot_to_clipboard; bool _snapToClpbrd;
bool _startup_check_companion; bool _autoCheckApp;
bool _startup_check_fw; bool _autoCheckFw;
bool _simuSW; bool _simuSW;
bool _wizardEnable; bool _enableWizard;
int _backLight; int _backLight;
int _embedded_splashes; // Shouldn't this be bool ?? int _embedSplashes;
int _fwserver; int _fwServerFails;
int _generalEditTab; int _generalEditTab;
int _icon_size; int _iconSize;
int _js_ctrl; int _jsCtrl;
int _history_size; int _historySize;
int _modelEditTab; int _modelEditTab;
int _profileId; int _id;
int _theme; int _theme;
int _warningId; int _warningId;
public: public:
// All the get declarations // All the get declarations
QStringList recentFileList() { return _recentFileList; } QStringList recentFiles() { return _recentFiles; }
QByteArray mainWindowGeometry(){ return _mainWindowGeometry; } QByteArray mainWinGeo() { return _mainWinGeo; }
QByteArray mainWindowState() { return _mainWindowState; } QByteArray mainWinState() { return _mainWinState; }
QByteArray modelEditGeometry() { return _modelEditGeometry; } QByteArray modelEditGeo() { return _modelEditGeo; }
QString arm_mcu() { return _arm_mcu; } QString armMcu() { return _armMcu; }
QString avr_arguments() { return _avr_arguments; } QString avrArguments() { return _avrArguments; }
QString avr_port() { return _avr_port; } QString avrPort() { return _avrPort; }
QString avrdude_location() { return _avrdude_location; } QString avrdudeLocation() { return _avrdudeLocation; }
QString cpu_id() { return _cpu_id; } QString cpuId() { return _cpuId; }
QString dfu_arguments() { return _dfu_arguments; } QString dfuArguments() { return _dfuArguments; }
QString dfu_location() { return _dfu_location; } QString dfuLocation() { return _dfuLocation; }
QString lastFw() { return _lastFw; } QString lastFw() { return _lastFw; }
QString locale() { return _locale; } QString locale() { return _locale; }
QString mcu() { return _mcu; } QString mcu() { return _mcu; }
QString programmer() { return _programmer; } QString programmer() { return _programmer; }
QString samba_location() { return _samba_location; } QString sambaLocation() { return _sambaLocation; }
QString samba_port() { return _samba_port; } QString sambaPort() { return _sambaPort; }
QString backupPath() { return _backupPath; } QString backupDir() { return _backupDir; }
QString compilationServer() { return _compilationServer; } QString compileServer() { return _compileServer; }
QString gePath() { return _gePath; } QString gePath() { return _gePath; }
QString lastDir() { return _lastDir; } QString lastDir() { return _lastDir; }
QString lastFlashDir() { return _lastFlashDir; } QString flashDir() { return _flashDir; }
QString lastImagesDir() { return _lastImagesDir; } QString imagesDir() { return _imagesDir; }
QString lastLogDir() { return _lastLogDir; } QString logDir() { return _logDir; }
QString libraryPath() { return _libraryPath; } QString libDir() { return _libDir; }
QString snapshotpath() { return _snapshotpath; } QString snapshotDir() { return _snapshotDir; }
bool backupEnable() { return _backupEnable; } bool enableBackup() { return _enableBackup; }
bool backupOnFlash() { return _backupOnFlash; } bool backupOnFlash() { return _backupOnFlash; }
bool js_support() { return _js_support; } bool jsSupport() { return _jsSupport; }
bool rev4asupport() { return _rev4asupport; } bool rev4aSupport() { return _rev4aSupport; }
bool maximized() { return _maximized; } bool maximized() { return _maximized; }
bool show_splash() { return _show_splash; } bool showSplash() { return _showSplash; }
bool snapshot_to_clipboard() { return _snapshot_to_clipboard; } bool snapToClpbrd() { return _snapToClpbrd; }
bool startup_check_companion() { return _startup_check_companion;} bool autoCheckApp() { return _autoCheckApp; }
bool startup_check_fw() { return _startup_check_fw; } bool autoCheckFw() { return _autoCheckFw; }
bool simuSW() { return _simuSW; } bool simuSW() { return _simuSW; }
bool wizardEnable() { return _wizardEnable; } bool enableWizard() { return _enableWizard; }
int backLight() { return _backLight; } int backLight() { return _backLight; }
int embedded_splashes() { return _embedded_splashes; } int embedSplashes() { return _embedSplashes; }
int fwserver() { return _fwserver; } int fwServerFails() { return _fwServerFails; }
int generalEditTab() { return _generalEditTab; } int generalEditTab() { return _generalEditTab; }
int icon_size() { return _icon_size; } int iconSize() { return _iconSize; }
int history_size() { return _history_size; } int historySize() { return _historySize; }
int js_ctrl() { return _js_ctrl; } int jsCtrl() { return _jsCtrl; }
int modelEditTab() { return _modelEditTab; } int modelEditTab() { return _modelEditTab; }
int id() { return _profileId; } int id() { return _id; }
int theme() { return _theme; } int theme() { return _theme; }
int warningId() { return _warningId; } int warningId() { return _warningId; }
// All the set declarations // All the set declarations
void recentFileList (const QStringList l) { store(l, _recentFileList, "recentFileList" );} void recentFiles (const QStringList x) { store(x, _recentFiles, "recentFileList" );}
void mainWindowGeometry (const QByteArray a) { store(a, _mainWindowGeometry, "mainWindowGeometry");} void mainWinGeo (const QByteArray x) { store(x, _mainWinGeo, "mainWindowGeometry" );}
void mainWindowState (const QByteArray a) { store(a, _mainWindowState, "mainWindowState" );} void mainWinState (const QByteArray x) { store(x, _mainWinState, "mainWindowState" );}
void modelEditGeometry (const QByteArray a) { store(a, _modelEditGeometry, "modelEditGeometry" );} void modelEditGeo (const QByteArray x) { store(x, _modelEditGeo, "modelEditGeometry" );}
void arm_mcu (const QString str) { store(str, _arm_mcu, "arm_mcu" );} void armMcu (const QString x) { store(x, _armMcu, "arm_mcu" );}
void avr_arguments (const QString str) { store(str, _avr_arguments, "avr_arguments" );} void avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );}
void avr_port (const QString str) { store(str, _avr_port, "avr_port" );} void avrPort (const QString x) { store(x, _avrPort, "avr_port" );}
void avrdude_location (const QString str) { store(str, _avrdude_location, "avrdude_location" );} void avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );}
void cpu_id (const QString str) { store(str, _cpu_id, "cpu_id" );} void cpuId (const QString x) { store(x, _cpuId, "cpu_id" );}
void dfu_arguments (const QString str) { store(str, _dfu_arguments, "dfu_arguments" );} void dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );}
void dfu_location (const QString str) { store(str, _dfu_location, "dfu_location" );} void dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );}
void lastFw (const QString str) { store(str, _lastFw, "lastFw" );} void lastFw (const QString x) { store(x, _lastFw, "lastFw" );}
void locale (const QString str) { store(str, _locale, "locale" );} void locale (const QString x) { store(x, _locale, "locale" );}
void mcu (const QString str) { store(str, _mcu, "mcu" );} void mcu (const QString x) { store(x, _mcu, "mcu" );}
void programmer (const QString str) { store(str, _programmer, "programmer" );} void programmer (const QString x) { store(x, _programmer, "programmer" );}
void samba_location (const QString str) { store(str, _samba_location, "samba_location" );} void sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
void samba_port (const QString str) { store(str, _samba_port, "samba_port" );} void sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
void backupPath (const QString str) { store(str, _backupPath, "backupPath" );} void backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
void compilationServer (const QString str) { store(str, _compilationServer, "compilation-server");} void compileServer (const QString x) { store(x, _compileServer, "compilation-server" );}
void gePath (const QString str) { store(str, _gePath, "gePath" );} void gePath (const QString x) { store(x, _gePath, "gePath" );}
void lastDir (const QString str) { store(str, _lastDir, "lastDir" );} void lastDir (const QString x) { store(x, _lastDir, "lastDir" );}
void lastFlashDir (const QString str) { store(str, _lastFlashDir, "lastFlashDir" );} void flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );}
void lastImagesDir (const QString str) { store(str, _lastImagesDir, "lastImagesDir" );} void imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );}
void lastLogDir (const QString str) { store(str, _lastLogDir, "lastLogDir" );} void logDir (const QString x) { store(x, _logDir, "lastLogDir" );}
void libraryPath (const QString str) { store(str, _libraryPath, "libraryPath" );} void libDir (const QString x) { store(x, _libDir, "libraryPath" );}
void snapshotpath (const QString str) { store(str, _snapshotpath, "snapshotpath" );} void snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );}
void backupEnable (const bool bl) { store(bl, _backupEnable, "backupEnable" );} void enableBackup (const bool x) { store(x, _enableBackup, "backupEnable" );}
void backupOnFlash (const bool bl) { store(bl, _backupOnFlash, "backupOnFlash" );} void backupOnFlash (const bool x) { store(x, _backupOnFlash, "backupOnFlash" );}
void maximized (const bool bl) { store(bl, _maximized, "maximized" );} void maximized (const bool x) { store(x, _maximized, "maximized" );}
void js_support (const bool bl) { store(bl, _js_support, "js_support" );} void jsSupport (const bool x) { store(x, _jsSupport, "js_support" );}
void rev4asupport (const bool bl) { store(bl, _rev4asupport, "rev4asupport" );} void rev4aSupport (const bool x) { store(x, _rev4aSupport, "rev4asupport" );}
void show_splash (const bool bl) { store(bl, _show_splash, "show_splash" );} void showSplash (const bool x) { store(x, _showSplash, "show_splash" );}
void snapshot_to_clipboard (const bool bl) { store(bl, _snapshot_to_clipboard, "snapshot_to_clipboard" );} void snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );}
void startup_check_companion (const bool bl) { store(bl, _startup_check_companion, "startup_check_companion" );} void autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );}
void startup_check_fw (const bool bl) { store(bl, _startup_check_fw, "startup_check_fw" );} void autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );}
void simuSW (const bool bl) { store(bl, _simuSW, "simuSW" );} void simuSW (const bool x) { store(x, _simuSW, "simuSW" );}
void wizardEnable (const bool bl) { store(bl, _wizardEnable, "wizardEnable" );} void enableWizard (const bool x) { store(x, _enableWizard, "wizardEnable" );}
void backLight (const int it) { store(it, _backLight, "backLight" );} void backLight (const int x) { store(x, _backLight, "backLight" );}
void embedded_splashes (const int it) { store(it, _embedded_splashes, "embedded_splashes" );} void embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );}
void fwserver (const int it) { store(it, _fwserver, "fwserver" );} void fwServerFails (const int x) { store(x, _fwServerFails, "fwserver" );}
void generalEditTab (const int it) { store(it, _generalEditTab, "generalEditTab" );} void generalEditTab (const int x) { store(x, _generalEditTab, "generalEditTab" );}
void icon_size (const int it) { store(it, _icon_size, "icon_size" );} void iconSize (const int x) { store(x, _iconSize, "icon_size" );}
void history_size (const int it) { store(it, _history_size, "history_size" );} void historySize (const int x) { store(x, _historySize, "history_size" );}
void js_ctrl (const int it) { store(it, _js_ctrl, "js_ctrl" );} void jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );}
void modelEditTab (const int it) { store(it, _modelEditTab, "modelEditTab" );} void modelEditTab (const int x) { store(x, _modelEditTab, "modelEditTab" );}
void id (const int it) { store(it, _profileId, "profileId" );} void id (const int x) { store(x, _id, "profileId" );}
void theme (const int it) { store(it, _theme, "theme" );} void theme (const int x) { store(x, _theme, "theme" );}
void warningId (const int it) { store(it, _warningId, "warningId" );} void warningId (const int x) { store(x, _warningId, "warningId" );}
// Constructor // Constructor
AppData() AppData()
@ -684,15 +683,15 @@ public:
firmware.replace("x9da","taranis"); firmware.replace("x9da","taranis");
// Move Companion9x settings to profile0, the new default profile // Move Companion9x settings to profile0, the new default profile
profile[0].firmware(firmware); profile[0].firmware( firmware );
profile[0].Name(settings.value( "Name", "" ).toString()); profile[0].name( settings.value( "Name", "" ).toString());
profile[0].sdPath(settings.value( "sdPath", "" ).toString()); profile[0].sdPath( settings.value( "sdPath", "" ).toString());
profile[0].SplashFileName(settings.value( "SplashFileName", "" ).toString()); profile[0].splashFile( settings.value( "SplashFileName", "" ).toString());
profile[0].burnFirmware(settings.value( "burnFirmware", false ).toBool()); profile[0].burnFirmware( settings.value( "burnFirmware", false ).toBool());
profile[0].rename_firmware_files(settings.value("rename_firmware_files", false ).toBool()); profile[0].renameFwFiles( settings.value( "rename_firmware_files", false ).toBool());
profile[0].patchImage(settings.value( "patchImage", false ).toBool()); profile[0].patchImage( settings.value( "patchImage", false ).toBool());
profile[0].default_channel_order(settings.value("default_channel_order", "0" ).toInt()); profile[0].channelOrder( settings.value( "default_channel_order", "0" ).toInt());
profile[0].default_mode(settings.value( "default_mode", "1" ).toInt()); profile[0].defaultMode( settings.value( "default_mode", "1" ).toInt());
// Delete unused settings // Delete unused settings
settings.remove("firmware"); settings.remove("firmware");
@ -707,60 +706,58 @@ public:
} }
// Load and store all variables. Use default values if setting values are missing // Load and store all variables. Use default values if setting values are missing
getset( _recentFiles, "recentFileList" ,"" );
getset( _mainWinGeo, "mainWindowGeometry" ,"" );
getset( _mainWinState, "mainWindowState" ,"" );
getset( _modelEditGeo, "modelEditGeometry" ,"" );
getset( _recentFileList, "recentFileList" ,"" ); getset( _armMcu, "arm_mcu" ,"at91sam3s4-9x" );
getset( _mainWindowGeometry, "mainWindowGeometry" ,"" ); getset( _avrArguments, "avr_arguments" ,"" );
getset( _mainWindowState, "mainWindowState" ,"" ); getset( _avrPort, "avr_port" ,"" );
getset( _modelEditGeometry, "modelEditGeometry" ,"" ); getset( _avrdudeLocation, "avrdudeLocation" ,"" );
getset( _cpuId, "cpu_id" ,"" );
getset( _dfuArguments, "dfu_arguments" ,"-a 0" );
getset( _dfuLocation, "dfu_location" ,"" );
getset( _lastFw, "lastFw" ,"" );
getset( _locale, "locale" ,"" );
getset( _mcu, "mcu" ,"m64" );
getset( _programmer, "programmer" ,"usbasp" );
getset( _sambaLocation, "samba_location" ,"" );
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
getset( _arm_mcu, "arm_mcu" ,"at91sam3s4-9x" ); getset( _backupDir, "backupPath" ,"" );
getset( _avr_arguments, "avr_arguments" ,"" ); getset( _compileServer, "compilation-server" ,"" );
getset( _avr_port, "avr_port" ,"" ); getset( _gePath, "gePath" ,"" );
getset( _avrdude_location, "avrdude_location" ,"" ); getset( _lastDir, "lastDir" ,"" );
getset( _cpu_id, "cpu_id" ,"" ); getset( _flashDir, "lastFlashDir" ,"" );
getset( _dfu_arguments, "dfu_arguments" ,"-a 0" ); getset( _imagesDir, "lastImagesDir" ,"" );
getset( _dfu_location, "dfu_location" ,"" ); getset( _logDir, "lastLogDir" ,"" );
getset( _lastFw, "lastFw" ,"" ); getset( _libDir, "libraryPath" ,"" );
getset( _locale, "locale" ,"" ); getset( _snapshotDir, "snapshotpath" ,"" );
getset( _mcu, "mcu" ,"m64" );
getset( _programmer, "programmer" ,"usbasp" );
getset( _samba_location, "samba_location" ,"" );
getset( _samba_port, "samba_port" ,"\\USBserial\\COM23" );
getset( _backupPath, "backupPath" ,"" ); getset( _enableBackup, "backupEnable" ,false );
getset( _compilationServer, "compilation-server" ,"" ); getset( _backupOnFlash, "backupOnFlash" ,true );
getset( _gePath, "gePath" ,"" ); getset( _jsSupport, "js_support" ,false );
getset( _lastDir, "lastDir" ,"" ); getset( _rev4aSupport, "rev4asupport" ,false );
getset( _lastFlashDir, "lastFlashDir" ,"" ); getset( _maximized, "maximized" ,false );
getset( _lastImagesDir, "lastImagesDir" ,"" ); getset( _showSplash, "show_splash" ,true );
getset( _lastLogDir, "lastLogDir" ,"" ); getset( _snapToClpbrd, "snapshot_to_clipboard" ,false );
getset( _libraryPath, "libraryPath" ,"" ); getset( _autoCheckApp, "startup_check_companion" ,true );
getset( _snapshotpath, "snapshotpath" ,"" ); getset( _autoCheckFw, "startup_check_fw" ,true );
getset( _simuSW, "simuSW" ,false );
getset( _backupEnable, "backupEnable" ,false ); getset( _enableWizard, "wizardEnable" ,true );
getset( _backupOnFlash, "backupOnFlash" ,true );
getset( _js_support, "js_support" ,false );
getset( _rev4asupport, "rev4asupport" ,false );
getset( _maximized, "maximized" ,false );
getset( _show_splash, "show_splash" ,true );
getset( _snapshot_to_clipboard, "snapshot_to_clipboard" ,false );
getset( _startup_check_companion, "startup_check_companion" ,true );
getset( _startup_check_fw, "startup_check_fw" ,true );
getset( _simuSW, "simuSW" ,false );
getset( _wizardEnable, "wizardEnable" ,true );
getset( _backLight, "backLight" ,0 );
getset( _embedded_splashes, "embedded_splashes" ,0 );
getset( _fwserver, "fwserver" ,0 );
getset( _generalEditTab, "generalEditTab" ,0 );
getset( _icon_size, "icon_size" ,2 );
getset( _js_ctrl, "js_ctrl" ,0 );
getset( _history_size, "history_size" ,10 );
getset( _modelEditTab, "modelEditTab" ,0 );
getset( _profileId, "profileId" ,0 );
getset( _theme, "theme" ,1 );
getset( _warningId, "warningId" ,0 );
getset( _backLight, "backLight" ,0 );
getset( _embedSplashes, "embedded_splashes" ,0 );
getset( _fwServerFails, "fwserver" ,0 );
getset( _generalEditTab, "generalEditTab" ,0 );
getset( _iconSize, "icon_size" ,2 );
getset( _jsCtrl, "js_ctrl" ,0 );
getset( _historySize, "history_size" ,10 );
getset( _modelEditTab, "modelEditTab" ,0 );
getset( _id, "profileId" ,0 );
getset( _theme, "theme" ,1 );
getset( _warningId, "warningId" ,0 );
} }
}; };

View file

@ -36,36 +36,36 @@ appPreferencesDialog::~appPreferencesDialog()
void appPreferencesDialog::writeValues() void appPreferencesDialog::writeValues()
{ {
g.startup_check_companion(ui->startupCheck_companion9x->isChecked()); g.autoCheckApp(ui->startupCheck_companion9x->isChecked());
g.startup_check_fw(ui->startupCheck_fw->isChecked()); g.autoCheckFw(ui->startupCheck_fw->isChecked());
g.wizardEnable(ui->wizardEnable_ChkB->isChecked()); g.enableWizard(ui->wizardEnable_ChkB->isChecked());
g.show_splash(ui->showSplash->isChecked()); g.showSplash(ui->showSplash->isChecked());
g.simuSW(ui->simuSW->isChecked()); g.simuSW(ui->simuSW->isChecked());
g.history_size(ui->historySize->value()); g.historySize(ui->historySize->value());
g.backLight(ui->backLightColor->currentIndex()); g.backLight(ui->backLightColor->currentIndex());
g.libraryPath(ui->libraryPath->text()); g.libDir(ui->libraryPath->text());
g.gePath(ui->ge_lineedit->text()); g.gePath(ui->ge_lineedit->text());
g.embedded_splashes(ui->splashincludeCB->currentIndex()); g.embedSplashes(ui->splashincludeCB->currentIndex());
g.backupEnable(ui->backupEnable->isChecked()); g.enableBackup(ui->backupEnable->isChecked());
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) { if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
g.js_support(ui->joystickChkB ->isChecked()); g.jsSupport(ui->joystickChkB ->isChecked());
g.js_ctrl(ui->joystickCB ->currentIndex()); g.jsCtrl(ui->joystickCB ->currentIndex());
} }
else { else {
g.js_support(false); g.jsSupport(false);
g.js_ctrl(0); g.jsCtrl(0);
} }
g.id(ui->profileIndexLE->text().toInt()); g.id(ui->profileIndexLE->text().toInt());
g.profile[g.id()].default_channel_order(ui->channelorderCB->currentIndex()); g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex());
g.profile[g.id()].default_mode(ui->stickmodeCB->currentIndex()); g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex());
g.profile[g.id()].rename_firmware_files(ui->renameFirmware->isChecked()); g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked());
g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked()); g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked());
g.profile[g.id()].Name(ui->profileNameLE->text()); g.profile[g.id()].name(ui->profileNameLE->text());
g.profile[g.id()].sdPath(ui->sdPath->text()); g.profile[g.id()].sdPath(ui->sdPath->text());
g.profile[g.id()].SplashFileName(ui->SplashFileName->text()); g.profile[g.id()].splashFile(ui->SplashFileName->text());
g.profile[g.id()].firmware(ui->firmwareLE->text()); g.profile[g.id()].firmware(ui->firmwareLE->text());
saveProfile(); saveProfile();
@ -73,50 +73,50 @@ void appPreferencesDialog::writeValues()
void appPreferencesDialog::on_snapshotPathButton_clicked() void appPreferencesDialog::on_snapshotPathButton_clicked()
{ {
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), g.snapshotpath()); QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), g.snapshotDir());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.snapshotpath(fileName); g.snapshotDir(fileName);
g.snapshot_to_clipboard(false); g.snapToClpbrd(false);
ui->snapshotPath->setText(fileName); ui->snapshotPath->setText(fileName);
} }
} }
void appPreferencesDialog::initSettings() void appPreferencesDialog::initSettings()
{ {
ui->snapshotClipboardCKB->setChecked(g.snapshot_to_clipboard()); ui->snapshotClipboardCKB->setChecked(g.snapToClpbrd());
ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware()); ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
ui->snapshotPath->setText(g.snapshotpath()); ui->snapshotPath->setText(g.snapshotDir());
ui->snapshotPath->setReadOnly(true); ui->snapshotPath->setReadOnly(true);
if (ui->snapshotClipboardCKB->isChecked()) if (ui->snapshotClipboardCKB->isChecked())
{ {
ui->snapshotPath->setDisabled(true); ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true); ui->snapshotPathButton->setDisabled(true);
} }
ui->startupCheck_companion9x->setChecked(g.startup_check_companion()); ui->startupCheck_companion9x->setChecked(g.autoCheckApp());
ui->startupCheck_fw->setChecked(g.startup_check_fw()); ui->startupCheck_fw->setChecked(g.autoCheckFw());
ui->wizardEnable_ChkB->setChecked(g.wizardEnable()); ui->wizardEnable_ChkB->setChecked(g.enableWizard());
ui->showSplash->setChecked(g.show_splash()); ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.history_size()); ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight()); ui->backLightColor->setCurrentIndex(g.backLight());
ui->simuSW->setChecked(g.simuSW()); ui->simuSW->setChecked(g.simuSW());
ui->libraryPath->setText(g.libraryPath()); ui->libraryPath->setText(g.libDir());
ui->ge_lineedit->setText(g.gePath()); ui->ge_lineedit->setText(g.gePath());
if (!g.backupPath().isEmpty()) { if (!g.backupDir().isEmpty()) {
if (QDir(g.backupPath()).exists()) { if (QDir(g.backupDir()).exists()) {
ui->backupPath->setText(g.backupPath()); ui->backupPath->setText(g.backupDir());
ui->backupEnable->setEnabled(true); ui->backupEnable->setEnabled(true);
ui->backupEnable->setChecked(g.backupEnable()); ui->backupEnable->setChecked(g.enableBackup());
} else { } else {
ui->backupEnable->setDisabled(true); ui->backupEnable->setDisabled(true);
} }
} else { } else {
ui->backupEnable->setDisabled(true); ui->backupEnable->setDisabled(true);
} }
ui->splashincludeCB->setCurrentIndex(g.embedded_splashes()); ui->splashincludeCB->setCurrentIndex(g.embedSplashes());
#ifdef JOYSTICKS #ifdef JOYSTICKS
ui->joystickChkB->setChecked(g.js_support()); ui->joystickChkB->setChecked(g.jsSupport());
if (ui->joystickChkB->isChecked()) { if (ui->joystickChkB->isChecked()) {
QStringList joystickNames; QStringList joystickNames;
joystickNames << tr("No joysticks found"); joystickNames << tr("No joysticks found");
@ -134,7 +134,7 @@ void appPreferencesDialog::initSettings()
} }
ui->joystickCB->clear(); ui->joystickCB->clear();
ui->joystickCB->insertItems(0, joystickNames); ui->joystickCB->insertItems(0, joystickNames);
ui->joystickCB->setCurrentIndex(g.js_ctrl()); ui->joystickCB->setCurrentIndex(g.jsCtrl());
} }
else { else {
ui->joystickCB->clear(); ui->joystickCB->clear();
@ -143,22 +143,23 @@ void appPreferencesDialog::initSettings()
} }
#endif #endif
// Profile Tab Inits // Profile Tab Inits
ui->channelorderCB->setCurrentIndex(g.profile[g.id()].default_channel_order()); ui->channelorderCB->setCurrentIndex(g.profile[g.id()].channelOrder());
ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].default_mode()); ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode());
ui->renameFirmware->setChecked(g.profile[g.id()].rename_firmware_files()); ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles());
ui->sdPath->setText(g.profile[g.id()].sdPath()); ui->sdPath->setText(g.profile[g.id()].sdPath());
ui->profileIndexLE->setText(QString("%1").arg(g.id())); ui->profileIndexLE->setText(QString("%1").arg(g.id()));
ui->profileNameLE->setText(g.profile[g.id()].Name()); ui->profileNameLE->setText(g.profile[g.id()].name());
ui->firmwareLE->setText(g.profile[g.id()].firmware()); ui->firmwareLE->setText(g.profile[g.id()].firmware());
ui->SplashFileName->setText(g.profile[g.id()].SplashFileName()); ui->SplashFileName->setText(g.profile[g.id()].splashFile());
displayImage( g.profile[g.id()].SplashFileName() );
displayImage( g.profile[g.id()].splashFile() );
} }
void appPreferencesDialog::on_libraryPathButton_clicked() void appPreferencesDialog::on_libraryPathButton_clicked()
{ {
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), g.libraryPath()); QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), g.libDir());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.libraryPath(fileName); g.libDir(fileName);
ui->libraryPath->setText(fileName); ui->libraryPath->setText(fileName);
} }
} }
@ -168,20 +169,20 @@ void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
if (ui->snapshotClipboardCKB->isChecked()) { if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true); ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true); ui->snapshotPathButton->setDisabled(true);
g.snapshot_to_clipboard(true); g.snapToClpbrd(true);
} else { } else {
ui->snapshotPath->setEnabled(true); ui->snapshotPath->setEnabled(true);
ui->snapshotPath->setReadOnly(true); ui->snapshotPath->setReadOnly(true);
ui->snapshotPathButton->setEnabled(true); ui->snapshotPathButton->setEnabled(true);
g.snapshot_to_clipboard(false); g.snapToClpbrd(false);
} }
} }
void appPreferencesDialog::on_backupPathButton_clicked() void appPreferencesDialog::on_backupPathButton_clicked()
{ {
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupPath()); QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.backupPath(fileName); g.backupDir(fileName);
ui->backupPath->setText(fileName); ui->backupPath->setText(fileName);
} }
ui->backupEnable->setEnabled(true); ui->backupEnable->setEnabled(true);
@ -244,13 +245,13 @@ void appPreferencesDialog::saveProfile()
if (ui->profileNameLE->text().isEmpty()) if (ui->profileNameLE->text().isEmpty())
ui->profileNameLE->setText("----"); ui->profileNameLE->setText("----");
g.profile[g.id()].Name( ui->profileNameLE->text() ); g.profile[g.id()].name( ui->profileNameLE->text() );
g.profile[g.id()].default_channel_order( ui->channelorderCB->currentIndex()); g.profile[g.id()].channelOrder( ui->channelorderCB->currentIndex());
g.profile[g.id()].default_mode( ui->stickmodeCB->currentIndex()); g.profile[g.id()].defaultMode( ui->stickmodeCB->currentIndex());
g.profile[g.id()].burnFirmware( ui->burnFirmware->isChecked()); g.profile[g.id()].burnFirmware( ui->burnFirmware->isChecked());
g.profile[g.id()].rename_firmware_files( ui->renameFirmware->isChecked()); g.profile[g.id()].renameFwFiles( ui->renameFirmware->isChecked());
g.profile[g.id()].sdPath( ui->sdPath->text()); g.profile[g.id()].sdPath( ui->sdPath->text());
g.profile[g.id()].SplashFileName( ui->SplashFileName->text()); g.profile[g.id()].splashFile( ui->SplashFileName->text());
g.profile[g.id()].firmware( ui->firmwareLE->text()); g.profile[g.id()].firmware( ui->firmwareLE->text());
} }
@ -313,10 +314,10 @@ void appPreferencesDialog::on_SplashSelect_clicked()
} }
QString fileName = QFileDialog::getOpenFileName(this, QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), g.lastImagesDir(), tr("Images (%1)").arg(supportedImageFormats)); tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()){ if (!fileName.isEmpty()){
g.lastImagesDir(QFileInfo(fileName).dir().absolutePath()); g.imagesDir(QFileInfo(fileName).dir().absolutePath());
displayImage(fileName); displayImage(fileName);
ui->SplashFileName->setText(fileName); ui->SplashFileName->setText(fileName);

View file

@ -84,9 +84,9 @@ burnConfigDialog::~burnConfigDialog()
void burnConfigDialog::getSettings() void burnConfigDialog::getSettings()
{ {
avrLoc = g.avrdude_location(); avrLoc = g.avrdudeLocation();
sambaLoc = g.samba_location(); sambaLoc = g.sambaLocation();
dfuLoc = g.dfu_location(); dfuLoc = g.dfuLocation();
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
if ( avrLoc.isEmpty()) if ( avrLoc.isEmpty())
@ -112,13 +112,13 @@ void burnConfigDialog::getSettings()
#endif #endif
dfuArgs = g.dfu_arguments().split(" ", QString::SkipEmptyParts); dfuArgs = g.dfuArguments().split(" ", QString::SkipEmptyParts);
avrArgs = g.avr_arguments().split(" ", QString::SkipEmptyParts); avrArgs = g.avrArguments().split(" ", QString::SkipEmptyParts);
avrProgrammer = g.programmer(); avrProgrammer = g.programmer();
avrPort = g.avr_port(); avrPort = g.avrPort();
avrMCU = g.mcu(); avrMCU = g.mcu();
armMCU = g.arm_mcu(); armMCU = g.armMcu();
sambaPort = g.samba_port(); sambaPort = g.sambaPort();
ui->avrdude_location->setText(getAVRDUDE()); ui->avrdude_location->setText(getAVRDUDE());
ui->avrArgs->setText(getAVRArgs().join(" ")); ui->avrArgs->setText(getAVRArgs().join(" "));
@ -147,16 +147,16 @@ void burnConfigDialog::getSettings()
void burnConfigDialog::putSettings() void burnConfigDialog::putSettings()
{ {
g.avrdude_location( avrLoc ); g.avrdudeLocation( avrLoc );
g.programmer( avrProgrammer); g.programmer( avrProgrammer);
g.mcu( avrMCU ); g.mcu( avrMCU );
g.avr_port( avrPort ); g.avrPort( avrPort );
g.avr_arguments( avrArgs.join(" ") ); g.avrArguments( avrArgs.join(" ") );
g.samba_location( sambaLoc ); g.sambaLocation( sambaLoc );
g.samba_port( sambaPort ); g.sambaPort( sambaPort );
g.arm_mcu( armMCU ); g.armMcu( armMCU );
g.dfu_location( dfuLoc ); g.dfuLocation( dfuLoc );
g.dfu_arguments( dfuArgs.join(" ") ); g.dfuArguments( dfuArgs.join(" ") );
} }
void burnConfigDialog::populateProgrammers() void burnConfigDialog::populateProgrammers()

View file

@ -59,7 +59,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
else { else {
setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName)); setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName));
} }
ui->profile_label->setText(tr("Current profile")+QString(": ")+g.profile[g.id()].Name()); ui->profile_label->setText(tr("Current profile")+QString(": ")+g.profile[g.id()].name());
} }
if (!hexfileName->isEmpty()) { if (!hexfileName->isEmpty()) {
ui->FWFileName->setText(*hexfileName); ui->FWFileName->setText(*hexfileName);
@ -69,13 +69,13 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
else { else {
burnraw=false; burnraw=false;
if (checkeEprom(*hexfileName)) { if (checkeEprom(*hexfileName)) {
QString Name = g.profile[g.id()].Name(); QString Name = g.profile[g.id()].name();
QString calib = g.profile[g.id()].StickPotCalib(); QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].TrainerCalib(); QString trainercalib = g.profile[g.id()].trainerCalib();
QString DisplaySet = g.profile[g.id()].Display(); QString DisplaySet = g.profile[g.id()].display();
QString BeeperSet = g.profile[g.id()].Beeper(); QString BeeperSet = g.profile[g.id()].beeper();
QString HapticSet = g.profile[g.id()].Haptic(); QString HapticSet = g.profile[g.id()].haptic();
QString SpeakerSet = g.profile[g.id()].Speaker(); QString SpeakerSet = g.profile[g.id()].speaker();
if (!Name.isEmpty()) { if (!Name.isEmpty()) {
ui->profile_label->show(); ui->profile_label->show();
ui->patchcalib_CB->show(); ui->patchcalib_CB->show();
@ -140,7 +140,7 @@ void burnDialog::on_FlashLoadButton_clicked()
ui->EEbackupCB->hide(); ui->EEbackupCB->hide();
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
if (hexType==2) { if (hexType==2) {
fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.lastFlashDir(), FLASH_FILES_FILTER); fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER);
checkFw(fileName); checkFw(fileName);
} }
else { else {
@ -200,7 +200,7 @@ void burnDialog::checkFw(QString fileName)
ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight()); ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
ui->FwImage->show(); ui->FwImage->show();
ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash())); ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash()));
QString ImageStr = g.profile[g.id()].SplashFileName(); QString ImageStr = g.profile[g.id()].splashFile();
bool PatchFwCB = g.profile[g.id()].patchImage(); bool PatchFwCB = g.profile[g.id()].patchImage();
if (!ImageStr.isEmpty()) { if (!ImageStr.isEmpty()) {
QImage Image = qstring2image(ImageStr); QImage Image = qstring2image(ImageStr);
@ -244,7 +244,7 @@ void burnDialog::checkFw(QString fileName)
ui->BurnFlashButton->setEnabled(true); ui->BurnFlashButton->setEnabled(true);
} }
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
g.lastFlashDir( QFileInfo(fileName).dir().absolutePath() ); g.flashDir( QFileInfo(fileName).dir().absolutePath() );
} }
bool burnDialog::checkeEprom(QString fileName) bool burnDialog::checkeEprom(QString fileName)
@ -345,10 +345,10 @@ void burnDialog::on_ImageLoadButton_clicked()
} }
QString fileName = QFileDialog::getOpenFileName(this, QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), g.lastImagesDir(), tr("Images (%1)").arg(supportedImageFormats)); tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.lastImagesDir( QFileInfo(fileName).dir().absolutePath() ); g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
QImage image(fileName); QImage image(fileName);
if (image.isNull()) { if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
@ -425,7 +425,7 @@ void burnDialog::on_BurnFlashButton_clicked()
if (hexType==2) { if (hexType==2) {
QString fileName=ui->FWFileName->text(); QString fileName=ui->FWFileName->text();
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.lastFlashDir( QFileInfo(fileName).dir().absolutePath() ); g.flashDir( QFileInfo(fileName).dir().absolutePath() );
g.lastFw( fileName ); g.lastFw( fileName );
if (ui->PatchFWCB->isChecked()) { if (ui->PatchFWCB->isChecked()) {
g.profile[g.id()].patchImage( true ); g.profile[g.id()].patchImage( true );
@ -461,19 +461,19 @@ void burnDialog::on_BurnFlashButton_clicked()
} }
} }
if (hexType==1) { if (hexType==1) {
QString calib = g.profile[g.id()].StickPotCalib(); QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].TrainerCalib(); QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
int8_t vBatCalib=(int8_t) g.profile[g.id()].VbatCalib(); int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib(); int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].PPM_Multiplier(); int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
uint8_t GSStickMode=(uint8_t) g.profile[g.id()].GSStickMode(); uint8_t GSStickMode=(uint8_t) g.profile[g.id()].gsStickMode();
uint8_t vBatWarn=(uint8_t) g.profile[g.id()].vBatWarn(); uint8_t vBatWarn=(uint8_t) g.profile[g.id()].vBatWarn();
QString DisplaySet= g.profile[g.id()].Display(); QString DisplaySet= g.profile[g.id()].display();
QString BeeperSet= g.profile[g.id()].Beeper(); QString BeeperSet= g.profile[g.id()].beeper();
QString HapticSet= g.profile[g.id()].Haptic(); QString HapticSet= g.profile[g.id()].haptic();
QString SpeakerSet= g.profile[g.id()].Speaker(); QString SpeakerSet= g.profile[g.id()].speaker();
bool patch=false; bool patch=false;
if (ui->patchcalib_CB->isChecked()) { if (ui->patchcalib_CB->isChecked()) {
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
@ -631,7 +631,7 @@ void burnDialog::on_PreferredImageCB_toggled(bool checked)
{ {
QString tmpFileName; QString tmpFileName;
if (checked) { if (checked) {
QString ImageStr = g.profile[g.id()].SplashFileName(); QString ImageStr = g.profile[g.id()].splashFile();
if (!ImageStr.isEmpty()) { if (!ImageStr.isEmpty()) {
QImage Image = qstring2image(ImageStr); QImage Image = qstring2image(ImageStr);
if (ui->imageLabel->width()!=128) { if (ui->imageLabel->width()!=128) {

View file

@ -115,7 +115,7 @@ bool Side::saveImage()
} }
QImage image = imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight()); QImage image = imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
if (flash.setSplash(image) && (flash.saveFlash(*saveToFileName) > 0)) { if (flash.setSplash(image) && (flash.saveFlash(*saveToFileName) > 0)) {
g.lastFlashDir( QFileInfo(*saveToFileName).dir().absolutePath() ); g.flashDir( QFileInfo(*saveToFileName).dir().absolutePath() );
} }
else { else {
return false; return false;
@ -124,7 +124,7 @@ bool Side::saveImage()
else if (*source == PICT) { else if (*source == PICT) {
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8); QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
if (image.save(*saveToFileName)) { if (image.save(*saveToFileName)) {
g.lastImagesDir( QFileInfo(*saveToFileName).dir().absolutePath() ); g.imagesDir( QFileInfo(*saveToFileName).dir().absolutePath() );
} }
else { else {
return false; return false;
@ -181,12 +181,12 @@ void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);}
void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);} void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);}
void customizeSplashDialog::loadFirmware(Side side) void customizeSplashDialog::loadFirmware(Side side)
{ {
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.lastFlashDir(), FLASH_FILES_FILTER); QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER);
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, FW )) if (!side.displayImage( fileName, FW ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load embedded FW image from %1.").arg(fileName)); QMessageBox::critical(this, tr("Error"), tr("Cannot load embedded FW image from %1.").arg(fileName));
else else
g.lastFlashDir( QFileInfo(fileName).dir().absolutePath() ); g.flashDir( QFileInfo(fileName).dir().absolutePath() );
} }
} }
@ -199,13 +199,13 @@ void customizeSplashDialog::loadPicture(Side side)
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
} }
QString fileName = QFileDialog::getOpenFileName(this, QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), g.lastImagesDir(), tr("Images (%1)").arg(supportedImageFormats)); tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PICT )) if (!side.displayImage( fileName, PICT ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load the image file %1.").arg(fileName)); QMessageBox::critical(this, tr("Error"), tr("Cannot load the image file %1.").arg(fileName));
else else
g.lastImagesDir( QFileInfo(fileName).dir().absolutePath() ); g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
} }
} }
@ -213,7 +213,7 @@ void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left
void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);} void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);}
void customizeSplashDialog::loadProfile(Side side) void customizeSplashDialog::loadProfile(Side side)
{ {
QString fileName=g.profile[g.id()].SplashFileName(); QString fileName=g.profile[g.id()].splashFile();
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PROFILE )) if (!side.displayImage( fileName, PROFILE ))

View file

@ -731,24 +731,24 @@ GeneralSettings::GeneralSettings()
calibSpanNeg[i] = 0x180; calibSpanNeg[i] = 0x180;
calibSpanPos[i] = 0x180; calibSpanPos[i] = 0x180;
} }
templateSetup = g.profile[g.id()].default_channel_order(); templateSetup = g.profile[g.id()].channelOrder();
stickMode = g.profile[g.id()].default_mode(); stickMode = g.profile[g.id()].defaultMode();
QString t_calib=g.profile[g.id()].StickPotCalib(); QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
if (t_calib.isEmpty()) { if (t_calib.isEmpty()) {
return; return;
} else { } else {
QString t_trainercalib=g.profile[g.id()].TrainerCalib(); QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].VbatCalib(); int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib(); int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].PPM_Multiplier(); int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].GSStickMode(); uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn(); uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=g.profile[g.id()].Display(); QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=g.profile[g.id()].Beeper(); QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=g.profile[g.id()].Haptic(); QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=g.profile[g.id()].Speaker(); QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode(); QString t_CountrySet=g.profile[g.id()].countryCode();
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) { if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
@ -986,7 +986,7 @@ void RegisterEepromInterfaces()
eepromInterfaces.push_back(new Open9xInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new Open9xInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new Open9xInterface(BOARD_SKY9X)); eepromInterfaces.push_back(new Open9xInterface(BOARD_SKY9X));
eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS)); eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS));
if (g.rev4asupport()) if (g.rev4aSupport())
eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS_REV4a)); eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS_REV4a));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));

View file

@ -934,10 +934,10 @@ bool Open9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esiz
QString geturl( int board) QString geturl( int board)
{ {
QString url = g.compilationServer(); QString url = g.compileServer();
if (url.isEmpty()){ if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS; url= OPENTX_FIRMWARE_DOWNLOADS;
g.compilationServer(url); g.compileServer(url);
} }
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
@ -959,10 +959,10 @@ QString geturl( int board)
QString getstamp( int board) QString getstamp( int board)
{ {
QString url = g.compilationServer(); QString url = g.compileServer();
if (url.isEmpty()){ if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS; url= OPENTX_FIRMWARE_DOWNLOADS;
g.compilationServer(url); g.compileServer(url);
} }
url.append("/stamp-opentx-"); url.append("/stamp-opentx-");
switch(board) { switch(board) {
@ -991,10 +991,10 @@ QString getstamp( int board)
QString getrnurl( int board) QString getrnurl( int board)
{ {
QString url = g.compilationServer(); QString url = g.compileServer();
if (url.isEmpty()){ if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS; url= OPENTX_FIRMWARE_DOWNLOADS;
g.compilationServer(url); g.compileServer(url);
} }
url.append("/releasenotes-"); url.append("/releasenotes-");
switch(board) { switch(board) {
@ -1221,7 +1221,7 @@ void RegisterOpen9xFirmwares()
open9x->addOptions(fai_options); open9x->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(open9x);
if (g.rev4asupport()) { if (g.rev4aSupport()) {
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true); open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu")); open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));

View file

@ -211,7 +211,7 @@ void fwPreferencesDialog::firmwareChanged()
void fwPreferencesDialog::writeValues() void fwPreferencesDialog::writeValues()
{ {
g.cpu_id( ui->CPU_ID_LE->text() ); g.cpuId( ui->CPU_ID_LE->text() );
current_firmware_variant = getFirmwareVariant(); current_firmware_variant = getFirmwareVariant();
g.profile[g.id()].firmware( current_firmware_variant.id ); g.profile[g.id()].firmware( current_firmware_variant.id );
} }
@ -271,7 +271,7 @@ void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
void fwPreferencesDialog::initSettings() void fwPreferencesDialog::initSettings()
{ {
ui->CPU_ID_LE->setText(g.cpu_id()); ui->CPU_ID_LE->setText(g.cpuId());
FirmwareInfo * current_firmware = GetCurrentFirmware(); FirmwareInfo * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) { foreach(FirmwareInfo * firmware, firmwares) {

View file

@ -22,7 +22,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
QString firmware_id = g.profile[g.id()].firmware(); QString firmware_id = g.profile[g.id()].firmware();
ui->tabWidget->setCurrentIndex( g.generalEditTab() ); ui->tabWidget->setCurrentIndex( g.generalEditTab() );
QString name=g.profile[g.id()].Name(); QString name=g.profile[g.id()].name();
if (name.isEmpty()) { if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true); ui->calstore_PB->setDisabled(true);
} }
@ -70,7 +70,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} }
ui->profile_CB->clear(); ui->profile_CB->clear();
for ( int i = 0; i < MAX_PROFILES; ++i) { for ( int i = 0; i < MAX_PROFILES; ++i) {
QString name=g.profile[i].Name(); QString name=g.profile[i].name();
if (!name.isEmpty()) { if (!name.isEmpty()) {
ui->profile_CB->addItem(name, i); ui->profile_CB->addItem(name, i);
if (i==g.id()) { if (i==g.id()) {
@ -1209,21 +1209,21 @@ void GeneralEdit::on_swGEAChkB_stateChanged(int )
void GeneralEdit::on_calretrieve_PB_clicked() void GeneralEdit::on_calretrieve_PB_clicked()
{ {
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString calib=g.profile[profile_id].StickPotCalib(); QString calib=g.profile[profile_id].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
if (calib.isEmpty()) { if (calib.isEmpty()) {
return; return;
} else { } else {
QString trainercalib = g.profile[profile_id].TrainerCalib(); QString trainercalib = g.profile[profile_id].trainerCalib();
int8_t vBatCalib = (int8_t)g.profile[profile_id].VbatCalib(); int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib();
int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib(); int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib();
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].PPM_Multiplier(); int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
uint8_t GSStickMode = (uint8_t)g.profile[profile_id].GSStickMode(); uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode();
uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn(); uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn();
QString DisplaySet = g.profile[profile_id].Display(); QString DisplaySet = g.profile[profile_id].display();
QString BeeperSet = g.profile[profile_id].Beeper(); QString BeeperSet = g.profile[profile_id].beeper();
QString HapticSet = g.profile[profile_id].Haptic(); QString HapticSet = g.profile[profile_id].haptic();
QString SpeakerSet = g.profile[profile_id].Speaker(); QString SpeakerSet = g.profile[profile_id].speaker();
QString CountrySet = g.profile[profile_id].countryCode(); QString CountrySet = g.profile[profile_id].countryCode();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
@ -1319,13 +1319,13 @@ void GeneralEdit::on_calstore_PB_clicked()
{ {
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString name=g.profile[profile_id].Name(); QString name=g.profile[profile_id].name();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
if (name.isEmpty()) { if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true); ui->calstore_PB->setDisabled(true);
return; return;
} else { } else {
QString calib=g.profile[profile_id].StickPotCalib(); QString calib=g.profile[profile_id].stickPotCalib();
if (!(calib.isEmpty())) { if (!(calib.isEmpty())) {
int ret = QMessageBox::question(this, "Companion", int ret = QMessageBox::question(this, "Companion",
tr("Do you want to store calibration in %1 profile<br>overwriting existing calibration?").arg(name) , tr("Do you want to store calibration in %1 profile<br>overwriting existing calibration?").arg(name) ,
@ -1340,21 +1340,21 @@ void GeneralEdit::on_calstore_PB_clicked()
calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanNeg[i], 4, 16, QChar('0'))); calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanNeg[i], 4, 16, QChar('0')));
calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanPos[i], 4, 16, QChar('0'))); calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanPos[i], 4, 16, QChar('0')));
} }
g.profile[profile_id].StickPotCalib( calib ); g.profile[profile_id].stickPotCalib( calib );
calib.clear(); calib.clear();
for (int i=0; i< 4; i++) { for (int i=0; i< 4; i++) {
calib.append(QString("%1").arg((uint16_t)g_eeGeneral.trainer.calib[i], 4, 16, QChar('0'))); calib.append(QString("%1").arg((uint16_t)g_eeGeneral.trainer.calib[i], 4, 16, QChar('0')));
} }
g.profile[profile_id].TrainerCalib( calib ); g.profile[profile_id].trainerCalib( calib );
g.profile[profile_id].VbatCalib( g_eeGeneral.vBatCalib ); g.profile[profile_id].vBatCalib( g_eeGeneral.vBatCalib );
g.profile[profile_id].currentCalib( g_eeGeneral.currentCalib ); g.profile[profile_id].currentCalib( g_eeGeneral.currentCalib );
g.profile[profile_id].vBatWarn( g_eeGeneral.vBatWarn ); g.profile[profile_id].vBatWarn( g_eeGeneral.vBatWarn );
g.profile[profile_id].PPM_Multiplier( g_eeGeneral.PPM_Multiplier ); g.profile[profile_id].ppmMultiplier( g_eeGeneral.PPM_Multiplier );
g.profile[profile_id].GSStickMode( g_eeGeneral.stickMode ); g.profile[profile_id].gsStickMode( g_eeGeneral.stickMode );
g.profile[profile_id].Display( QString("%1%2%3").arg((g_eeGeneral.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.contrast, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.backlightBright, 2, 16, QChar('0')) ); g.profile[profile_id].display( QString("%1%2%3").arg((g_eeGeneral.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.contrast, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.backlightBright, 2, 16, QChar('0')) );
g.profile[profile_id].Beeper( QString("%1%2").arg(((uint8_t)g_eeGeneral.beeperMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.beeperLength, 2, 16, QChar('0'))); g.profile[profile_id].beeper( QString("%1%2").arg(((uint8_t)g_eeGeneral.beeperMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.beeperLength, 2, 16, QChar('0')));
g.profile[profile_id].Haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0'))); g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
g.profile[profile_id].Speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0'))); g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage)); g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved.")); QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
} }

View file

@ -59,10 +59,10 @@ class lcdWidget : public QWidget {
QPixmap buffer(2*lcdWidth, 2*lcdHeight); QPixmap buffer(2*lcdWidth, 2*lcdHeight);
QPainter p(&buffer); QPainter p(&buffer);
doPaint(p); doPaint(p);
bool toclipboard=g.snapshot_to_clipboard(); bool toclipboard=g.snapToClpbrd();
QApplication::clipboard()->setPixmap( buffer ); QApplication::clipboard()->setPixmap( buffer );
if (!toclipboard) { if (!toclipboard) {
QString Path=g.snapshotpath(); QString Path=g.snapshotDir();
if (Path.isEmpty() || !QDir(Path).exists()) { if (Path.isEmpty() || !QDir(Path).exists()) {
Path="."; Path=".";
} }

View file

@ -584,9 +584,9 @@ void logsDialog::moveLegend()
void logsDialog::on_fileOpen_BT_clicked() void logsDialog::on_fileOpen_BT_clicked()
{ {
QString fileName = QFileDialog::getOpenFileName(this,tr("Select your log file"), g.lastLogDir()); QString fileName = QFileDialog::getOpenFileName(this,tr("Select your log file"), g.logDir());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
g.lastLogDir( fileName ); g.logDir( fileName );
ui->FileName_LE->setText(fileName); ui->FileName_LE->setText(fileName);
if (cvsFileParse()) { if (cvsFileParse()) {
ui->FieldsTW->clear(); ui->FieldsTW->clear();

View file

@ -109,7 +109,7 @@ int main(int argc, char *argv[])
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware()); current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware());
MainWindow *mainWin = new MainWindow(); MainWindow *mainWin = new MainWindow();
if (g.show_splash()) { if (g.showSplash()) {
splash->show(); splash->show();
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close())); QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show())); QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));

View file

@ -100,7 +100,7 @@ MainWindow::MainWindow():
createStatusBar(); createStatusBar();
updateMenus(); updateMenus();
restoreState(g.mainWindowState()); restoreState(g.mainWinState());
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
this->setWindowIcon(QIcon(":/icon.png")); this->setWindowIcon(QIcon(":/icon.png"));
@ -110,7 +110,7 @@ MainWindow::MainWindow():
// give time to the splash to disappear and main window to open before starting updates // give time to the splash to disappear and main window to open before starting updates
int updateDelay = 1000; int updateDelay = 1000;
bool showSplash = g.show_splash(); bool showSplash = g.showSplash();
if (showSplash) { if (showSplash) {
updateDelay += (SPLASH_TIME*1000); updateDelay += (SPLASH_TIME*1000);
} }
@ -200,7 +200,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
QString stamp = GetFirmware(fwToUpdate)->stamp; QString stamp = GetFirmware(fwToUpdate)->stamp;
if (!stamp.isEmpty()) { if (!stamp.isEmpty()) {
if (g.startup_check_fw() || ignoreSettings) { if (g.autoCheckFw() || ignoreSettings) {
check1done=false; check1done=false;
manager1 = new QNetworkAccessManager(this); manager1 = new QNetworkAccessManager(this);
connect(manager1, SIGNAL(finished(QNetworkReply*)), this, SLOT(reply1Finished(QNetworkReply*))); connect(manager1, SIGNAL(finished(QNetworkReply*)), this, SLOT(reply1Finished(QNetworkReply*)));
@ -211,7 +211,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
} }
} }
if (g.startup_check_companion() || ignoreSettings) { if (g.autoCheckApp() || ignoreSettings) {
check2done = false; check2done = false;
manager2 = new QNetworkAccessManager(this); manager2 = new QNetworkAccessManager(this);
connect(manager2, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForUpdateFinished(QNetworkReply*))); connect(manager2, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForUpdateFinished(QNetworkReply*)));
@ -302,9 +302,9 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw
{ {
QString url, ext, cpuid; QString url, ext, cpuid;
url = firmware->getUrl(firmwareId); url = firmware->getUrl(firmwareId);
cpuid=g.cpu_id(); cpuid=g.cpuId();
ext = url.mid(url.lastIndexOf(".")); ext = url.mid(url.lastIndexOf("."));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastFlashDir() + "/" + firmwareId + ext); QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmwareId + ext);
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
downloadedFW = firmwareId; downloadedFW = firmwareId;
needRename=true; needRename=true;
@ -313,7 +313,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw
url.append("&cpuid="); url.append("&cpuid=");
url.append(cpuid); url.append(cpuid);
} }
g.lastFlashDir(QFileInfo(fileName).dir().absolutePath()); g.flashDir(QFileInfo(fileName).dir().absolutePath());
downloadDialog * dd = new downloadDialog(this, url, fileName); downloadDialog * dd = new downloadDialog(this, url, fileName);
connect(dd, SIGNAL(accepted()), this, SLOT(reply1Accepted())); connect(dd, SIGNAL(accepted()), this, SLOT(reply1Accepted()));
dd->exec(); dd->exec();
@ -404,7 +404,7 @@ void MainWindow::reply1Accepted()
int pos=rev.lastIndexOf("-r"); int pos=rev.lastIndexOf("-r");
if (pos>0) { if (pos>0) {
currentFWrev=rev.mid(pos+2).toInt(); currentFWrev=rev.mid(pos+2).toInt();
if (g.profile[g.id()].rename_firmware_files() && needRename) { if (g.profile[g.id()].renameFwFiles() && needRename) {
QFileInfo fi(downloadedFWFilename); QFileInfo fi(downloadedFWFilename);
QString path=fi.path()+QDir::separator (); QString path=fi.path()+QDir::separator ();
path.append(fi.completeBaseName()); path.append(fi.completeBaseName());
@ -440,7 +440,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
// TODO delete downloadDialog_forWait? // TODO delete downloadDialog_forWait?
} }
cpuid=g.cpu_id(); cpuid=g.cpuId();
QByteArray qba = reply->readAll(); QByteArray qba = reply->readAll();
int i = qba.indexOf("SVN_VERS"); int i = qba.indexOf("SVN_VERS");
int warning = qba.indexOf("WARNING"); int warning = qba.indexOf("WARNING");
@ -454,7 +454,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
if(!cres) { if(!cres) {
QMessageBox::warning(this, "Companion", tr("Unable to check for updates.")); QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
g.fwserver(g.fwserver()+1); g.fwServerFails(g.fwServerFails()+1);
return; return;
} }
@ -548,12 +548,12 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
QString url = GetFirmware(fwToUpdate)->getUrl(fwToUpdate); QString url = GetFirmware(fwToUpdate)->getUrl(fwToUpdate);
QString ext = url.mid(url.lastIndexOf(".")); QString ext = url.mid(url.lastIndexOf("."));
needRename=false; needRename=false;
bool addversion=g.profile[g.id()].rename_firmware_files(); bool addversion=g.profile[g.id()].renameFwFiles();
QString fileName; QString fileName;
if (addversion) { if (addversion) {
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastFlashDir() + "/" + fwToUpdate + newrev + ext); fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + fwToUpdate + newrev + ext);
} else { } else {
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.lastFlashDir() + "/" + fwToUpdate + ext); fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + fwToUpdate + ext);
} }
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
if (!cpuid.isEmpty()) { if (!cpuid.isEmpty()) {
@ -561,7 +561,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
url.append(cpuid); url.append(cpuid);
} }
downloadedFWFilename = fileName; downloadedFWFilename = fileName;
g.lastFlashDir(QFileInfo(fileName).dir().absolutePath()); g.flashDir(QFileInfo(fileName).dir().absolutePath());
downloadDialog * dd = new downloadDialog(this, url, fileName); downloadDialog * dd = new downloadDialog(this, url, fileName);
currentFWrev_temp = NewFwRev; currentFWrev_temp = NewFwRev;
connect(dd, SIGNAL(accepted()), this, SLOT(reply1Accepted())); connect(dd, SIGNAL(accepted()), this, SLOT(reply1Accepted()));
@ -575,7 +575,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
} else { } else {
if(check1done && check2done) { if(check1done && check2done) {
QMessageBox::warning(this, "Companion", tr("Unable to check for updates.")); QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
g.fwserver(g.fwserver()+1); g.fwServerFails(g.fwServerFails()+1);
return; return;
} }
} }
@ -583,8 +583,8 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
g.mainWindowGeometry(saveGeometry()); g.mainWinGeo(saveGeometry());
g.mainWindowState(saveState()); g.mainWinState(saveState());
mdiArea->closeAllSubWindows(); mdiArea->closeAllSubWindows();
if (mdiArea->currentSubWindow()) { if (mdiArea->currentSubWindow()) {
event->ignore(); event->ignore();
@ -618,7 +618,7 @@ void MainWindow::setTheme(int index)
void MainWindow::setIconThemeSize(int index) void MainWindow::setIconThemeSize(int index)
{ {
g.icon_size( index ); g.iconSize( index );
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(tr("The icon size will be used the next time you start Companion.")); msgBox.setText(tr("The icon size will be used the next time you start Companion."));
@ -1061,8 +1061,8 @@ void MainWindow::writeFileToEeprom()
if (!isValidEEPROM(fileName)) if (!isValidEEPROM(fileName))
ret = QMessageBox::question(this, "Companion", tr("The file %1\nhas not been recognized as a valid Models and Settings file\nWrite anyway ?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No); ret = QMessageBox::question(this, "Companion", tr("The file %1\nhas not been recognized as a valid Models and Settings file\nWrite anyway ?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
if (ret != QMessageBox::Yes) return; if (ret != QMessageBox::Yes) return;
bool backupEnable = g.backupEnable(); bool backupEnable = g.enableBackup();
QString backupPath = g.backupPath(); QString backupPath = g.backupDir();
if (!backupPath.isEmpty()) { if (!backupPath.isEmpty()) {
if (!QDir(backupPath).exists()) { if (!QDir(backupPath).exists()) {
if (backupEnable) { if (backupEnable) {
@ -1316,8 +1316,8 @@ void MainWindow::writeFlash(QString fileToFlash)
if (backup) { if (backup) {
QString tempDir = QDir::tempPath(); QString tempDir = QDir::tempPath();
QString backupFile = tempDir + "/backup.bin"; QString backupFile = tempDir + "/backup.bin";
bool backupEnable=g.backupEnable(); bool backupEnable=g.enableBackup();
QString backupPath=g.backupPath(); QString backupPath=g.backupDir();
if (!backupPath.isEmpty() && !IS_TARANIS(GetEepromInterface()->getBoard())) { if (!backupPath.isEmpty() && !IS_TARANIS(GetEepromInterface()->getBoard())) {
if (!QDir(backupPath).exists()) { if (!QDir(backupPath).exists()) {
if (backupEnable) { if (backupEnable) {
@ -1371,8 +1371,8 @@ void MainWindow::writeFlash(QString fileToFlash)
} }
} }
else { else {
bool backupEnable=g.backupEnable(); bool backupEnable=g.enableBackup();
QString backupPath=g.backupPath(); QString backupPath=g.backupDir();
if (!QDir(backupPath).exists()) { if (!QDir(backupPath).exists()) {
if (backupEnable) { if (backupEnable) {
QMessageBox::warning(this, tr("Backup is impossible"), tr("The backup dir set in preferences does not exist")); QMessageBox::warning(this, tr("Backup is impossible"), tr("The backup dir set in preferences does not exist"));
@ -1432,13 +1432,13 @@ void MainWindow::readEepromToFile()
void MainWindow::readFlash() void MainWindow::readFlash()
{ {
QString fileName = QFileDialog::getSaveFileName(this,tr("Read Tx Firmware to File"), g.lastFlashDir(),tr(FLASH_FILES_FILTER)); QString fileName = QFileDialog::getSaveFileName(this,tr("Read Tx Firmware to File"), g.flashDir(),tr(FLASH_FILES_FILTER));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
if (file.exists()) { if (file.exists()) {
file.remove(); file.remove();
} }
g.lastFlashDir(QFileInfo(fileName).dir().absolutePath()); g.flashDir(QFileInfo(fileName).dir().absolutePath());
QStringList str = GetReceiveFlashCommand(fileName); QStringList str = GetReceiveFlashCommand(fileName);
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx"); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx");
ad->setWindowIcon(CompanionIcon("read_flash.png")); ad->setWindowIcon(CompanionIcon("read_flash.png"));
@ -1517,7 +1517,7 @@ void MainWindow::updateMenus()
updateIconSizeActions(); updateIconSizeActions();
updateIconThemeActions(); updateIconThemeActions();
setWindowTitle(tr("OpenTX Companion - FW: %1 - Profile: %2").arg(GetCurrentFirmware()->name).arg( g.profile[g.id()].Name() )); setWindowTitle(tr("OpenTX Companion - FW: %1 - Profile: %2").arg(GetCurrentFirmware()->name).arg( g.profile[g.id()].name() ));
} }
MdiChild *MainWindow::createMdiChild() MdiChild *MainWindow::createMdiChild()
@ -1770,7 +1770,7 @@ QMenu *MainWindow::createProfilesMenu()
void MainWindow::createToolBars() void MainWindow::createToolBars()
{ {
QSize size; QSize size;
switch(g.icon_size()) { switch(g.iconSize()) {
case 0: case 0:
size=QSize(16,16); size=QSize(16,16);
break; break;
@ -1886,12 +1886,12 @@ void MainWindow::updateRecentFileActions()
int i, numRecentFiles; int i, numRecentFiles;
// Hide all document slots // Hide all document slots
for ( i=0 ; i < g.history_size(); i++) for ( i=0 ; i < g.historySize(); i++)
recentFileActs[i]->setVisible(false); recentFileActs[i]->setVisible(false);
// Fill slots with content and unhide them // Fill slots with content and unhide them
QStringList files = g.recentFileList(); QStringList files = g.recentFiles();
numRecentFiles = qMin(files.size(), g.history_size()); numRecentFiles = qMin(files.size(), g.historySize());
for ( i = 0; i < numRecentFiles; i++) { for ( i = 0; i < numRecentFiles; i++) {
QString text = strippedName(files[i]); QString text = strippedName(files[i]);
@ -1906,7 +1906,7 @@ void MainWindow::updateRecentFileActions()
void MainWindow::updateIconSizeActions() void MainWindow::updateIconSizeActions()
{ {
switch (g.icon_size()) switch (g.iconSize())
{ {
case 0: smallIconAct->setChecked(true); break; case 0: smallIconAct->setChecked(true); break;
case 1: normalIconAct->setChecked(true); break; case 1: normalIconAct->setChecked(true); break;
@ -1961,9 +1961,9 @@ void MainWindow::updateProfilesActions()
{ {
for (int i=0; i<MAX_PROFILES; i++) for (int i=0; i<MAX_PROFILES; i++)
{ {
if (!g.profile[i].Name().isEmpty()) if (!g.profile[i].name().isEmpty())
{ {
QString text = tr("&%1: %2").arg(i).arg(g.profile[i].Name()); QString text = tr("&%1: %2").arg(i).arg(g.profile[i].name());
profileActs[i]->setText(text); profileActs[i]->setText(text);
profileActs[i]->setData(i); profileActs[i]->setData(i);
profileActs[i]->setVisible(true); profileActs[i]->setVisible(true);
@ -1979,13 +1979,13 @@ void MainWindow::updateProfilesActions()
void MainWindow::createProfile() void MainWindow::createProfile()
{ int i; { int i;
for (i=0; i<MAX_PROFILES && !g.profile[i].Name().isEmpty(); i++) for (i=0; i<MAX_PROFILES && !g.profile[i].name().isEmpty(); i++)
; ;
if (i==MAX_PROFILES) //Failed to find free slot if (i==MAX_PROFILES) //Failed to find free slot
return; return;
// Create profile name and force a flush to file // Create profile name and force a flush to file
g.profile[i].Name( QString("profile%1").arg(i)); g.profile[i].name( QString("profile%1").arg(i));
g.profile[i].flush(); g.profile[i].flush();
updateMenus(); updateMenus();

View file

@ -180,7 +180,7 @@ void MdiChild::OpenEditWindow(bool wizard=false)
} }
if (isNew && !wizard) { if (isNew && !wizard) {
int ret; int ret;
bool wizardEnable=g.wizardEnable(); bool wizardEnable=g.enableWizard();
if (wizardEnable) { if (wizardEnable) {
ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No); ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) { if (ret == QMessageBox::Yes) {
@ -189,7 +189,7 @@ void MdiChild::OpenEditWindow(bool wizard=false)
qSleep(500); qSleep(500);
ret = QMessageBox::question(this, tr("Companion"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No); ret = QMessageBox::question(this, tr("Companion"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::No) { if (ret == QMessageBox::No) {
g.wizardEnable( false ); g.enableWizard( false );
} }
} }
} }
@ -367,10 +367,10 @@ bool MdiChild::saveAs(bool isNew)
if (fileName.isEmpty()) if (fileName.isEmpty())
return false; return false;
if (fileName.contains("rev4a")) { if (fileName.contains("rev4a")) {
g.rev4asupport( true ); g.rev4aSupport( true );
} }
if (fileName.contains("norev4a")) { if (fileName.contains("norev4a")) {
g.rev4asupport( false ); g.rev4aSupport( false );
} }
g.lastDir( QFileInfo(fileName).dir().absolutePath() ); g.lastDir( QFileInfo(fileName).dir().absolutePath() );
if (isNew) if (isNew)
@ -489,14 +489,14 @@ void MdiChild::setCurrentFile(const QString &fileName)
fileChanged = false; fileChanged = false;
setWindowModified(false); setWindowModified(false);
updateTitle(); updateTitle();
int MaxRecentFiles = g.history_size(); int MaxRecentFiles = g.historySize();
QStringList files = g.recentFileList(); QStringList files = g.recentFiles();
files.removeAll(fileName); files.removeAll(fileName);
files.prepend(fileName); files.prepend(fileName);
while (files.size() > MaxRecentFiles) while (files.size() > MaxRecentFiles)
files.removeLast(); files.removeLast();
g.recentFileList( files ); g.recentFiles( files );
} }
QString MdiChild::strippedName(const QString &fullFileName) QString MdiChild::strippedName(const QString &fullFileName)
@ -506,8 +506,8 @@ QString MdiChild::strippedName(const QString &fullFileName)
void MdiChild::writeEeprom() // write to Tx void MdiChild::writeEeprom() // write to Tx
{ {
bool backupEnable=g.backupEnable(); bool backupEnable=g.enableBackup();
QString backupPath=g.backupPath(); QString backupPath=g.backupDir();
if (!backupPath.isEmpty()) { if (!backupPath.isEmpty()) {
if (!QDir(backupPath).exists()) { if (!QDir(backupPath).exists()) {
if (backupEnable) { if (backupEnable) {
@ -518,7 +518,7 @@ void MdiChild::writeEeprom() // write to Tx
} else { } else {
backupEnable=false; backupEnable=false;
} }
QString stickCal=g.profile[g.id()].StickPotCalib(); QString stickCal=g.profile[g.id()].stickPotCalib();
burnConfigDialog bcd; burnConfigDialog bcd;
QString tempDir = QDir::tempPath(); QString tempDir = QDir::tempPath();
QString tempFile = tempDir + "/temp.bin"; QString tempFile = tempDir + "/temp.bin";

View file

@ -22,7 +22,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
generalSettings(radioData.generalSettings) generalSettings(radioData.generalSettings)
{ {
ui->setupUi(this); ui->setupUi(this);
restoreGeometry(g.modelEditGeometry()); restoreGeometry(g.modelEditGeo());
ui->pushButton->setIcon(CompanionIcon("simulate.png")); ui->pushButton->setIcon(CompanionIcon("simulate.png"));
addTab(new Setup(this, model), tr("Setup")); addTab(new Setup(this, model), tr("Setup"));
addTab(new HeliPanel(this, model), tr("Heli")); addTab(new HeliPanel(this, model), tr("Heli"));
@ -45,7 +45,7 @@ ModelEdit::~ModelEdit()
void ModelEdit::closeEvent(QCloseEvent *event) void ModelEdit::closeEvent(QCloseEvent *event)
{ {
g.modelEditGeometry( saveGeometry() ); g.modelEditGeo( saveGeometry() );
} }
class VerticalScrollArea : public QScrollArea class VerticalScrollArea : public QScrollArea

View file

@ -75,8 +75,8 @@ simulatorDialog::simulatorDialog(QWidget *parent) :
} }
#ifdef JOYSTICKS #ifdef JOYSTICKS
bool js_enable=g.js_support(); bool js_enable=g.jsSupport();
int js_ctrl=g.js_ctrl(); int js_ctrl=g.jsCtrl();
if (js_enable) { if (js_enable) {
int count=0; int count=0;
for (int j=0; j<8;j++){ for (int j=0; j<8;j++){
@ -209,7 +209,7 @@ void simulatorDialog::setupTimer()
void simulatorDialog::onButtonPressed(int value) void simulatorDialog::onButtonPressed(int value)
{ {
if (value==Qt::Key_Print) { if (value==Qt::Key_Print) {
bool toclipboard=g.snapshot_to_clipboard(); bool toclipboard=g.snapToClpbrd();
QString fileName =""; QString fileName ="";
if (!toclipboard) { if (!toclipboard) {
fileName = QString("screenshot-%1.png").arg(++screenshotIdx); fileName = QString("screenshot-%1.png").arg(++screenshotIdx);

View file

@ -62,7 +62,7 @@ void splashLibrary::setupPage(int page) {
void splashLibrary::getFileList() { void splashLibrary::getFileList() {
imageList.clear(); imageList.clear();
if (g.embedded_splashes() == 0) { if (g.embedSplashes()) {
QDir myRes(":/images/library"); QDir myRes(":/images/library");
QStringList tmp = myRes.entryList(); QStringList tmp = myRes.entryList();
for (int i = 0; i < tmp.size(); i++) { for (int i = 0; i < tmp.size(); i++) {
@ -70,7 +70,7 @@ void splashLibrary::getFileList() {
imageList.append(":/images/library/" + fileInfo.fileName()); imageList.append(":/images/library/" + fileInfo.fileName());
} }
} }
QString libraryPath = g.libraryPath(); QString libraryPath = g.libDir();
if (!libraryPath.isEmpty()) { if (!libraryPath.isEmpty()) {
if (QDir(libraryPath).exists()) { if (QDir(libraryPath).exists()) {
QStringList supportedImageFormats; QStringList supportedImageFormats;

View file

@ -37,9 +37,9 @@ xsimulatorDialog::xsimulatorDialog(QWidget *parent) :
this->setFixedSize(this->width(), this->height()); this->setFixedSize(this->width(), this->height());
bool simuSW = g.simuSW(); bool simuSW = g.simuSW();
#ifdef JOYSTICKS #ifdef JOYSTICKS
int js_ctrl = g.js_ctrl(); int js_ctrl = g.jsCtrl();
if (g.js_support()) { if (g.jsSupport()) {
int count=0; int count=0;
for (int j=0; j<8;j++){ for (int j=0; j<8;j++){
int axe=g.joystick[j].stick_axe(); int axe=g.joystick[j].stick_axe();
@ -177,7 +177,7 @@ void xsimulatorDialog::setupTimer()
void xsimulatorDialog::onButtonPressed(int value) void xsimulatorDialog::onButtonPressed(int value)
{ {
if (value==Qt::Key_Print) { if (value==Qt::Key_Print) {
bool toclipboard=g.snapshot_to_clipboard(); bool toclipboard=g.snapToClpbrd();
QString fileName =""; QString fileName ="";
if (!toclipboard) { if (!toclipboard) {
fileName = QString("screenshot-%1.png").arg(++screenshotIdx); fileName = QString("screenshot-%1.png").arg(++screenshotIdx);