1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Merge branch 'next' of https://github.com/opentx/opentx into bsongis/vario_improvements

Conflicts:
	radio/src/audio_arm.cpp
This commit is contained in:
Andre Bernet 2014-02-25 19:02:36 +01:00
commit 94afb88f8b
241 changed files with 6655 additions and 7360 deletions

View file

@ -325,3 +325,5 @@ Reginald H Millsom
Emanuel Stassar Emanuel Stassar
Pierluigi Sommaruga Pierluigi Sommaruga
Rafael Eric Suarez Nordlow Rafael Eric Suarez Nordlow
A Harris
Stefan Grunenberg

View file

@ -96,102 +96,103 @@ include_directories(
add_subdirectory(modeledit) add_subdirectory(modeledit)
add_subdirectory(simulation) add_subdirectory(simulation)
SET( companion_SRCS set(companion_SRCS
eeprominterface.cpp eeprominterface.cpp
hexinterface.cpp hexinterface.cpp
flashinterface.cpp flashinterface.cpp
file.cpp file.cpp
xmlinterface.cpp xmlinterface.cpp
${PROJECT_BINARY_DIR}/radio.cxx ${PROJECT_BINARY_DIR}/radio.cxx
firmwares/th9x/th9xeeprom.cpp firmwares/th9x/th9xeeprom.cpp
firmwares/th9x/th9xinterface.cpp firmwares/th9x/th9xinterface.cpp
firmwares/er9x/er9xeeprom.cpp firmwares/er9x/er9xeeprom.cpp
firmwares/er9x/er9xinterface.cpp firmwares/er9x/er9xinterface.cpp
firmwares/gruvin9x/gruvin9xeeprom.cpp firmwares/gruvin9x/gruvin9xeeprom.cpp
firmwares/gruvin9x/gruvin9xinterface.cpp firmwares/gruvin9x/gruvin9xinterface.cpp
firmwares/opentx/opentxeeprom.cpp firmwares/opentx/opentxeeprom.cpp
firmwares/opentx/open9xStockeeprom.cpp firmwares/opentx/open9xStockeeprom.cpp
firmwares/opentx/open9xGruvin9xeeprom.cpp firmwares/opentx/open9xGruvin9xeeprom.cpp
firmwares/opentx/open9xSky9xeeprom.cpp firmwares/opentx/open9xSky9xeeprom.cpp
firmwares/opentx/opentxinterface.cpp firmwares/opentx/opentxinterface.cpp
firmwares/opentx/opentxTaranisSimulator.cpp firmwares/opentx/opentxTaranisSimulator.cpp
firmwares/opentx/opentxSky9xsimulator.cpp firmwares/opentx/opentxSky9xsimulator.cpp
firmwares/opentx/opentxGruvin9xsimulator.cpp firmwares/opentx/opentxGruvin9xsimulator.cpp
firmwares/opentx/opentxM128simulator.cpp firmwares/opentx/opentxM128simulator.cpp
firmwares/opentx/opentxsimulator.cpp firmwares/opentx/opentxsimulator.cpp
firmwares/ersky9x/ersky9xeeprom.cpp firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp firmwares/ersky9x/ersky9xinterface.cpp
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
helpers.cpp appdata.cpp
mdichild.cpp helpers.cpp
generaledit.cpp mdichild.cpp
modelslist.cpp generaledit.cpp
mountlist.cpp modelslist.cpp
avroutputdialog.cpp mountlist.cpp
apppreferencesdialog.cpp avroutputdialog.cpp
fwpreferencesdialog.cpp apppreferencesdialog.cpp
burnconfigdialog.cpp fwpreferencesdialog.cpp
comparedialog.cpp burnconfigdialog.cpp
contributorsdialog.cpp comparedialog.cpp
customizesplashdialog.cpp contributorsdialog.cpp
burndialog.cpp customizesplashdialog.cpp
printdialog.cpp burndialog.cpp
fusesdialog.cpp printdialog.cpp
logsdialog.cpp fusesdialog.cpp
downloaddialog.cpp logsdialog.cpp
splashlibrary.cpp downloaddialog.cpp
mainwindow.cpp splashlibrary.cpp
main.cpp mainwindow.cpp
modelconfigdialog.cpp companion.cpp
qcustomplot.cpp modelconfigdialog.cpp
qcustomplot.cpp
) )
SET( companion_MOC_HDRS set(companion_MOC_HDRS
avroutputdialog.h avroutputdialog.h
apppreferencesdialog.h apppreferencesdialog.h
fwpreferencesdialog.h fwpreferencesdialog.h
burnconfigdialog.h burnconfigdialog.h
comparedialog.h comparedialog.h
printdialog.h printdialog.h
fusesdialog.h fusesdialog.h
logsdialog.h logsdialog.h
contributorsdialog.h contributorsdialog.h
customizesplashdialog.h customizesplashdialog.h
splashlibrary.h splashlibrary.h
splashlabel.h splashlabel.h
burndialog.h burndialog.h
downloaddialog.h downloaddialog.h
generaledit.h generaledit.h
modelslist.h modelslist.h
mdichild.h mdichild.h
mainwindow.h mainwindow.h
modelconfigdialog.h modelconfigdialog.h
qcustomplot.h qcustomplot.h
helpers.h helpers.h
) )
SET( companion_UIS set(companion_UIS
mdichild.ui mdichild.ui
avroutputdialog.ui avroutputdialog.ui
comparedialog.ui comparedialog.ui
fusesdialog.ui fusesdialog.ui
logsdialog.ui logsdialog.ui
apppreferencesdialog.ui apppreferencesdialog.ui
fwpreferencesdialog.ui fwpreferencesdialog.ui
burnconfigdialog.ui burnconfigdialog.ui
downloaddialog.ui downloaddialog.ui
generaledit.ui generaledit.ui
printdialog.ui printdialog.ui
contributorsdialog.ui contributorsdialog.ui
customizesplashdialog.ui customizesplashdialog.ui
splashlibrary.ui splashlibrary.ui
burndialog.ui burndialog.ui
modelconfigdialog.ui modelconfigdialog.ui
) )
SET( companion_RCS set(companion_RCS
companion.qrc companion.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
) )
MACRO (TODAY RESULT) MACRO (TODAY RESULT)
@ -315,7 +316,8 @@ set(simu_SRCS
file.cpp # TODO not needed file.cpp # TODO not needed
modeledit/node.cpp modeledit/node.cpp
modeledit/edge.cpp # TODO not needed modeledit/edge.cpp # TODO not needed
simulation/main.cpp appdata.cpp
simulator.cpp
) )
set(simu_HDRS set(simu_HDRS

678
companion/src/appdata.cpp Normal file
View file

@ -0,0 +1,678 @@
// Companion Application Data Class Definition.
// Author Kjell Kernen
#include "appdata.h"
// Global data and storage object
AppData g;
// ** CompStoreObj class********************
void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3)
{
QSettings settings(PRODUCT, COMPANY);
if (tag2.isEmpty())
{
settings.remove(tag1);
}
else if (tag3.isEmpty())
{
settings.beginGroup(tag1);
settings.remove(tag2);
settings.endGroup();
}
else
{
settings.beginGroup(tag1);
settings.beginGroup(tag2);
settings.remove(tag3);
settings.endGroup();
settings.endGroup();
}
}
void CompStoreObj::store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
settings.setValue(tag, newArray);
array = newArray;
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
settings.setValue(tag, newSList);
stringList = newSList;
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::store(const QString newString, QString &string, const QString tag, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
settings.setValue(tag, newString);
string = newString;
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::store(const bool newTruth, bool &truth, const QString tag, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
settings.setValue(tag, newTruth);
truth = newTruth;
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::store(const int newNumber, int &number, const QString tag, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
settings.setValue(tag, newNumber);
number = newNumber;
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
// Retrieval functions
void CompStoreObj::retrieve( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
array = settings.value(tag, def).toByteArray();
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
stringList = settings.value(tag, def).toStringList();
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::retrieve( QString &string, const QString tag, const QString def, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
string = settings.value(tag, def).toString();
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::retrieve( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
truth = settings.value(tag, def).toBool();
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
void CompStoreObj::retrieve( int &number, const QString tag, const int def, const QString group1, const QString group2 )
{
QSettings settings(PRODUCT, COMPANY);
if (!group1.isEmpty()) settings.beginGroup(group1);
if (!group2.isEmpty()) settings.beginGroup(group2);
number = settings.value(tag, def).toInt();
if (!group1.isEmpty()) settings.endGroup();
if (!group2.isEmpty()) settings.endGroup();
}
// Retrieve and Store functions
void CompStoreObj::getset( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 )
{
retrieve( array, tag, def, group1, group2);
store(array, array, tag, group1, group2);
}
void CompStoreObj::getset( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 )
{
retrieve( stringList, tag, def, group1, group2);
store(stringList, stringList, tag, group1, group2);
}
void CompStoreObj::getset( QString &string, const QString tag, const QString def, const QString group1, const QString group2 )
{
retrieve( string, tag, def, group1, group2);
store(string, string, tag, group1, group2);
}
void CompStoreObj::getset( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 )
{
retrieve( truth, tag, def, group1, group2);
store(truth, truth, tag, group1, group2);
}
void CompStoreObj::getset( int &number, const QString tag, const int def, const QString group1, const QString group2 )
{
retrieve( number, tag, def, group1, group2);
store(number, number, tag, group1, group2);
}
// ** FwRevision class********************
int FwRevision::get( const QString fwType )
{
QString result;
retrieve( result, fwType, "", "FwRevisions" );
return result.toInt();
}
void FwRevision::set( const QString fwType, const int fwRevision )
{
QString tempString= QString("%1").arg(fwRevision);
store( tempString, tempString, fwType, "FwRevisions" );
}
void FwRevision::remove( const QString tag )
{
clear( "FwRevisions", tag );
}
// ** JStickData class********************
// Get declarations
int JStickData::stick_axe() { return _stickAxe; }
int JStickData::stick_min() { return _stickMin; }
int JStickData::stick_med() { return _stickMed; }
int JStickData::stick_max() { return _stickMax; }
int JStickData::stick_inv() { return _stickInv; }
// Set declarations
void JStickData::stick_axe(const int it) { store( it, _stickAxe, QString("stick%1_axe").arg(index), "JsCalibration" );}
void JStickData::stick_min(const int it) { store( it, _stickMin, QString("stick%1_min").arg(index), "JsCalibration" );}
void JStickData::stick_med(const int it) { store( it, _stickMed, QString("stick%1_med").arg(index), "JsCalibration" );}
void JStickData::stick_max(const int it) { store( it, _stickMax, QString("stick%1_max").arg(index), "JsCalibration" );}
void JStickData::stick_inv(const int it) { store( it, _stickInv, QString("stick%1_inv").arg(index), "JsCalibration" );}
// Constructor
JStickData::JStickData()
{
index = -1;
}
void JStickData::remove()
{
// Remove all JStickData values from settings file
QSettings settings(PRODUCT, COMPANY);
settings.beginGroup( "JsCalibration" );
settings.remove( QString( "stick%1_axe").arg(index) );
settings.remove( QString( "stick%1_min").arg(index) );
settings.remove( QString( "stick%1_med").arg(index) );
settings.remove( QString( "stick%1_max").arg(index) );
settings.remove( QString( "stick%1_inv").arg(index) );
settings.endGroup();
// Reset all JStickData variables to initial values
init(index);
}
bool JStickData::existsOnDisk()
{
QSettings settings(PRODUCT, COMPANY);
settings.beginGroup("JsCalibration");
int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt();
settings.endGroup();
return (axe > -1);
}
void JStickData::init(int newIndex)
{
index = newIndex;
_stickAxe = -1;
_stickMin = -32767;
_stickMed = 0;
_stickMax = 0;
_stickInv = 0;
// Do not write empty joystick calibrations to disk.
if ( !existsOnDisk() )
return;
flush();
}
void JStickData::flush()
{
getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" );
getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" );
getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" );
getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" );
getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" );
}
// ** Profile class********************
// Get declarations
QString Profile::fwName() const { return _fwName; }
QString Profile::fwType() const { return _fwType; }
QString Profile::name() const { return _name; }
QString Profile::sdPath() const { return _sdPath; }
QString Profile::splashFile() const { return _splashFile; }
bool Profile::burnFirmware() const { return _burnFirmware; }
bool Profile::renameFwFiles() const { return _renameFwFiles; }
int Profile::channelOrder() const { return _channelOrder; }
int Profile::defaultMode() const { return _defaultMode; }
QString Profile::beeper() const { return _beeper; }
QString Profile::countryCode() const { return _countryCode; }
QString Profile::display() const { return _display; }
QString Profile::haptic() const { return _haptic; }
QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; }
int Profile::gsStickMode() const { return _gsStickMode; }
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
int Profile::vBatCalib() const { return _vBatCalib; }
int Profile::vBatWarn() const { return _vBatWarn; }
// Set declarations
void Profile::name (const QString x) { store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));}
void Profile::fwName (const QString x) { store(x, _fwName, "fwName" ,"Profiles", QString("profile%1").arg(index));}
void Profile::fwType (const QString x) { store(x, _fwType, "fwType" ,"Profiles", QString("profile%1").arg(index));}
void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));}
void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));}
void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));}
void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));}
void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));}
void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::beeper (const QString x) { store(x, _beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));}
void Profile::countryCode (const QString x) { store(x, _countryCode, "countryCode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::display (const QString x) { store(x, _display, "Display" ,"Profiles", QString("profile%1").arg(index));}
void Profile::haptic (const QString x) { store(x, _haptic, "Haptic" ,"Profiles", QString("profile%1").arg(index));}
void Profile::speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));}
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
// Constructor
Profile::Profile()
{
index = -1;
}
// The default copy operator can not be used since the index variable would be destroyed
Profile& Profile::operator=(const Profile& rhs)
{
name ( rhs.name() );
fwName ( rhs.fwName() );
fwType ( rhs.fwType() );
sdPath ( rhs.sdPath() );
splashFile ( rhs.splashFile() );
burnFirmware ( rhs.burnFirmware() );
renameFwFiles( rhs.renameFwFiles() );
channelOrder ( rhs.channelOrder() );
defaultMode ( rhs.defaultMode() );
beeper ( rhs.beeper() );
countryCode ( rhs.countryCode() );
display ( rhs.display() );
haptic ( rhs.haptic() );
speaker ( rhs.speaker() );
stickPotCalib( rhs.stickPotCalib() );
trainerCalib ( rhs.trainerCalib() );
currentCalib ( rhs.currentCalib() );
gsStickMode ( rhs.gsStickMode() );
ppmMultiplier( rhs.ppmMultiplier() );
vBatCalib ( rhs.vBatCalib() );
vBatWarn ( rhs.vBatWarn() );
return *this;
}
void Profile::remove()
{
// Remove all profile values from settings file
QSettings settings(PRODUCT, COMPANY);
settings.beginGroup("Profiles");
settings.remove(QString("profile%1").arg(index));
settings.endGroup();
// Reset all profile variables to initial values
init(index);
}
bool Profile::existsOnDisk()
{
QSettings settings(PRODUCT, COMPANY);
settings.beginGroup("Profiles");
settings.beginGroup(QString("profile%1").arg(index));
QStringList keyList = settings.allKeys();
settings.endGroup();
settings.endGroup();
return (keyList.length() > 0);
}
void Profile::init(int newIndex)
{
index = newIndex;
_fwName = "";
_fwType = "";
_name = "";
_sdPath = "";
_splashFile = "";
_burnFirmware = false;
_renameFwFiles = false;
_channelOrder = 0;
_defaultMode = 1;
_beeper = "";
_countryCode = "";
_display = "";
_haptic = "";
_speaker = "";
_stickPotCalib = "";
_trainerCalib = "";
_currentCalib = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_vBatWarn = 0;
// Do not write empty profiles to disk except the default (0) profile.
if ( index > 0 && !existsOnDisk())
return;
flush();
}
void Profile::flush()
{
// Load and store all variables. Use default values if setting values are missing
getset( _fwName, "fwName" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _fwType, "fwType" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index));
getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index));
getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index));
getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
}
// ** AppData class********************
// Get declarations
QStringList AppData::recentFiles() { return _recentFiles; }
QByteArray AppData::mainWinGeo() { return _mainWinGeo; }
QByteArray AppData::mainWinState() { return _mainWinState; }
QByteArray AppData::modelEditGeo() { return _modelEditGeo; }
QString AppData::armMcu() { return _armMcu; }
QString AppData::avrArguments() { return _avrArguments; }
QString AppData::avrPort() { return _avrPort; }
QString AppData::avrdudeLocation() { return _avrdudeLocation; }
QString AppData::compileServer() { return _compileServer; }
QString AppData::cpuId() { return _cpuId; }
QString AppData::dfuArguments() { return _dfuArguments; }
QString AppData::dfuLocation() { return _dfuLocation; }
QString AppData::locale() { return _locale; }
QString AppData::mcu() { return _mcu; }
QString AppData::programmer() { return _programmer; }
QString AppData::sambaLocation() { return _sambaLocation; }
QString AppData::sambaPort() { return _sambaPort; }
QString AppData::backupDir() { return _backupDir; }
QString AppData::gePath() { return _gePath; }
QString AppData::eepromDir() { return _eepromDir; }
QString AppData::flashDir() { return _flashDir; }
QString AppData::imagesDir() { return _imagesDir; }
QString AppData::logDir() { return _logDir; }
QString AppData::libDir() { return _libDir; }
QString AppData::snapshotDir() { return _snapshotDir; }
QString AppData::updatesDir() { return _updatesDir; }
bool AppData::enableBackup() { return _enableBackup; }
bool AppData::backupOnFlash() { return _backupOnFlash; }
bool AppData::jsSupport() { return _jsSupport; }
bool AppData::rev4aSupport() { return _rev4aSupport; }
bool AppData::maximized() { return _maximized; }
bool AppData::showSplash() { return _showSplash; }
bool AppData::snapToClpbrd() { return _snapToClpbrd; }
bool AppData::autoCheckApp() { return _autoCheckApp; }
bool AppData::autoCheckFw() { return _autoCheckFw; }
bool AppData::simuSW() { return _simuSW; }
bool AppData::enableWizard() { return _enableWizard; }
int AppData::backLight() { return _backLight; }
int AppData::embedSplashes() { return _embedSplashes; }
int AppData::fwServerFails() { return _fwServerFails; }
int AppData::generalEditTab() { return _generalEditTab; }
int AppData::iconSize() { return _iconSize; }
int AppData::historySize() { return _historySize; }
int AppData::jsCtrl() { return _jsCtrl; }
int AppData::modelEditTab() { return _modelEditTab; }
int AppData::id() { return _id; }
int AppData::theme() { return _theme; }
int AppData::warningId() { return _warningId; }
// Set declarations
void AppData::recentFiles (const QStringList x) { store(x, _recentFiles, "recentFileList" );}
void AppData::mainWinGeo (const QByteArray x) { store(x, _mainWinGeo, "mainWindowGeometry" );}
void AppData::mainWinState (const QByteArray x) { store(x, _mainWinState, "mainWindowState" );}
void AppData::modelEditGeo (const QByteArray x) { store(x, _modelEditGeo, "modelEditGeometry" );}
void AppData::armMcu (const QString x) { store(x, _armMcu, "arm_mcu" );}
void AppData::avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );}
void AppData::avrPort (const QString x) { store(x, _avrPort, "avr_port" );}
void AppData::avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );}
void AppData::compileServer (const QString x) { store(x, _compileServer, "compilation-server" );}
void AppData::cpuId (const QString x) { store(x, _cpuId, "cpu_id" );}
void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );}
void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );}
void AppData::locale (const QString x) { store(x, _locale, "locale" );}
void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );}
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );}
void AppData::eepromDir (const QString x) { store(x, _eepromDir, "lastDir" );}
void AppData::flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );}
void AppData::imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );}
void AppData::logDir (const QString x) { store(x, _logDir, "lastLogDir" );}
void AppData::libDir (const QString x) { store(x, _libDir, "libraryPath" );}
void AppData::snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );}
void AppData::updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );}
void AppData::enableBackup (const bool x) { store(x, _enableBackup, "backupEnable" );}
void AppData::backupOnFlash (const bool x) { store(x, _backupOnFlash, "backupOnFlash" );}
void AppData::maximized (const bool x) { store(x, _maximized, "maximized" );}
void AppData::jsSupport (const bool x) { store(x, _jsSupport, "js_support" );}
void AppData::rev4aSupport (const bool x) { store(x, _rev4aSupport, "rev4asupport" );}
void AppData::showSplash (const bool x) { store(x, _showSplash, "show_splash" );}
void AppData::snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );}
void AppData::autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );}
void AppData::autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );}
void AppData::simuSW (const bool x) { store(x, _simuSW, "simuSW" );}
void AppData::enableWizard (const bool x) { store(x, _enableWizard, "wizardEnable" );}
void AppData::backLight (const int x) { store(x, _backLight, "backLight" );}
void AppData::embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );}
void AppData::fwServerFails (const int x) { store(x, _fwServerFails, "fwserver" );}
void AppData::generalEditTab (const int x) { store(x, _generalEditTab, "generalEditTab" );}
void AppData::iconSize (const int x) { store(x, _iconSize, "icon_size" );}
void AppData::historySize (const int x) { store(x, _historySize, "history_size" );}
void AppData::jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );}
void AppData::modelEditTab (const int x) { store(x, _modelEditTab, "modelEditTab" );}
void AppData::id (const int x) { store(x, _id, "profileId" );}
void AppData::theme (const int x) { store(x, _theme, "theme" );}
void AppData::warningId (const int x) { store(x, _warningId, "warningId" );}
// Constructor
AppData::AppData()
{
//Initialize the profiles
for (int i=0; i<MAX_PROFILES; i++)
profile[i].init( i );
//Initialize the joysticks
for (int i=0; i<MAX_JOYSTICKS; i++)
joystick[i].init( i );
// Import settings from companion9x, but only do it one time.
QSettings c9x_settings("companion9x", "companion9x");
QSettings settings(PRODUCT, COMPANY);
if (profile[0].name().isEmpty() )
{
// Copy all settings from companion9x to companion
QStringList keys = c9x_settings.allKeys();
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
{
settings.setValue(*i, c9x_settings.value(*i));
}
// Store old values in new locations
autoCheckApp(settings.value("startup_check_companion9x", true).toBool());
// Convert and store the firmware type
QString fwType = settings.value("firmware", "").toString();
fwType.replace("open9x","opentx");
fwType.replace("x9da","taranis");
profile[0].fwType( fwType );
// Move the Companion9x profile settings to profile0, the new default profile
profile[0].name( settings.value( "Name", "" ).toString());
profile[0].sdPath( settings.value( "sdPath", "" ).toString());
profile[0].splashFile( settings.value( "SplashFileName", "" ).toString());
profile[0].burnFirmware( settings.value( "burnFirmware", false ).toBool());
profile[0].renameFwFiles( settings.value( "rename_firmware_files", false ).toBool());
profile[0].channelOrder( settings.value( "default_channel_order", "0" ).toInt());
profile[0].defaultMode( settings.value( "default_mode", "1" ).toInt());
// Ensure that the default profile has a name
if ( profile[0].name().isEmpty() )
profile[0].name("My Radio");
// Delete obsolete settings fields
settings.remove("ActiveProfile");
settings.remove("burnFirmware");
settings.remove("custom_id");
settings.remove("default_channel_order");
settings.remove("default_mode");
settings.remove("firmware");
settings.remove("lastFw");
settings.remove("Name");
settings.remove("patchImage");
settings.remove("rename_firmware_files");
settings.remove("sdPath");
settings.remove("SplashFileName");
settings.remove("startup_check_companion9x");
// Select the new default profile as current profile
id( 0 );
}
// 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( _armMcu, "arm_mcu" ,"at91sam3s4-9x" );
getset( _avrArguments, "avr_arguments" ,"" );
getset( _avrPort, "avr_port" ,"" );
getset( _avrdudeLocation, "avrdudeLocation" ,"" );
getset( _compileServer, "compilation-server" ,"" );
getset( _cpuId, "cpu_id" ,"" );
getset( _dfuArguments, "dfu_arguments" ,"-a 0" );
getset( _dfuLocation, "dfu_location" ,"" );
getset( _locale, "locale" ,"" );
getset( _mcu, "mcu" ,"m64" );
getset( _programmer, "programmer" ,"usbasp" );
getset( _sambaLocation, "samba_location" ,"" );
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
getset( _backupDir, "backupPath" ,"" );
getset( _gePath, "gePath" ,"" );
getset( _eepromDir, "lastDir" ,"" );
getset( _flashDir, "lastFlashDir" ,"" );
getset( _imagesDir, "lastImagesDir" ,"" );
getset( _logDir, "lastLogDir" ,"" );
getset( _libDir, "libraryPath" ,"" );
getset( _snapshotDir, "snapshotpath" ,"" );
getset( _updatesDir, "lastUpdatesDir" ,"" );
getset( _enableBackup, "backupEnable" ,false );
getset( _backupOnFlash, "backupOnFlash" ,true );
getset( _jsSupport, "js_support" ,false );
getset( _rev4aSupport, "rev4asupport" ,false );
getset( _maximized, "maximized" ,false );
getset( _showSplash, "show_splash" ,true );
getset( _snapToClpbrd, "snapshot_to_clipboard" ,false );
getset( _autoCheckApp, "startup_check_companion" ,true );
getset( _autoCheckFw, "startup_check_fw" ,true );
getset( _simuSW, "simuSW" ,false );
getset( _enableWizard, "wizardEnable" ,true );
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 );
}

355
companion/src/appdata.h Normal file
View file

@ -0,0 +1,355 @@
// Companion Application Data Class Declaration.
// Author Kjell Kernen
// All temporary and permanent global variables are defined here to make
// initialization and storage safe and visible.
// Do not access variables in QSettings directly, it is not type safe!
#ifndef COMPANION_APPDATA_H
#define COMPANION_APPDATA_H
#include <QByteArray>
#include <QStringList>
#include <QString>
#include <QSettings>
#define COMPANY "OpenTX Companion"
#define PRODUCT "OpenTX"
#define MAX_PROFILES 15
#define MAX_JOYSTICKS 8
class CompStoreObj
{
public:
void clear (const QString tag1="", const QString tag2="", const QString tag3="");
void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" );
void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" );
void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" );
void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" );
void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" );
// Retrieval functions
void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" );
void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" );
void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" );
void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" );
void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" );
// Retrieve and Store functions
void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" );
void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" );
void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" );
void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" );
void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" );
};
class FwRevision: protected CompStoreObj
{
public:
int get( const QString);
void set( const QString, const int );
void remove( const QString );
};
class JStickData: protected CompStoreObj
{
private:
int index;
int _stickAxe;
int _stickMin;
int _stickMed;
int _stickMax;
int _stickInv;
public:
// All the get definitions
int stick_axe();
int stick_min();
int stick_med();
int stick_max();
int stick_inv();
// All the set definitions
void stick_axe(const int);
void stick_min(const int);
void stick_med(const int);
void stick_max(const int);
void stick_inv(const int);
JStickData();
void remove();
bool existsOnDisk();
void init(int index);
void flush();
};
class Profile: protected CompStoreObj
{
private:
// Class Internal Variable
int index;
// Application Variables
QString _fwName;
QString _fwType;
QString _name;
QString _sdPath;
QString _splashFile;
bool _burnFirmware;
bool _renameFwFiles;
int _channelOrder;
int _defaultMode;
// Firmware Variables
QString _beeper;
QString _countryCode;
QString _display;
QString _haptic;
QString _speaker;
QString _stickPotCalib;
QString _trainerCalib;
int _currentCalib;
int _gsStickMode;
int _ppmMultiplier;
int _vBatCalib;
int _vBatWarn;
public:
// All the get definitions
QString fwName() const;
QString fwType() const;
QString name() const;
QString sdPath() const;
QString splashFile() const;
bool burnFirmware() const;
bool renameFwFiles() const;
int channelOrder() const;
int defaultMode() const;
QString beeper() const;
QString countryCode() const;
QString display() const;
QString haptic() const;
QString speaker() const;
QString stickPotCalib() const;
QString trainerCalib() const;
int currentCalib() const;
int gsStickMode() const;
int ppmMultiplier() const;
int vBatCalib() const;
int vBatWarn() const;
// All the set definitions
void name (const QString);
void fwName (const QString);
void fwType (const QString);
void sdPath (const QString);
void splashFile (const QString);
void burnFirmware (const bool);
void renameFwFiles (const bool);
void channelOrder (const int);
void defaultMode (const int);
void beeper (const QString);
void countryCode (const QString);
void display (const QString);
void haptic (const QString);
void speaker (const QString);
void stickPotCalib (const QString);
void trainerCalib (const QString);
void currentCalib (const int);
void gsStickMode (const int);
void ppmMultiplier (const int);
void vBatCalib (const int);
void vBatWarn (const int);
Profile();
Profile& operator=(const Profile&);
void remove();
bool existsOnDisk();
void init(int newIndex);
void flush();
};
class AppData: protected CompStoreObj
{
// All the global variables
public:
Profile profile[MAX_PROFILES];
JStickData joystick[MAX_JOYSTICKS];
FwRevision fwRev;
private:
QStringList _recentFiles;
QByteArray _mainWinGeo;
QByteArray _mainWinState;
QByteArray _modelEditGeo;
QString _armMcu;
QString _avrArguments;
QString _avrPort;
QString _avrdudeLocation;
QString _compileServer;
QString _cpuId;
QString _dfuArguments;
QString _dfuLocation;
QString _locale;
QString _mcu;
QString _programmer;
QString _sambaLocation;
QString _sambaPort;
QString _backupDir;
QString _gePath;
QString _eepromDir;
QString _flashDir;
QString _imagesDir;
QString _logDir;
QString _libDir;
QString _snapshotDir;
QString _updatesDir;
bool _enableBackup;
bool _backupOnFlash;
bool _maximized;
bool _jsSupport;
bool _rev4aSupport;
bool _showSplash;
bool _snapToClpbrd;
bool _autoCheckApp;
bool _autoCheckFw;
bool _simuSW;
bool _enableWizard;
int _backLight;
int _embedSplashes;
int _fwServerFails;
int _generalEditTab;
int _iconSize;
int _jsCtrl;
int _historySize;
int _modelEditTab;
int _id;
int _theme;
int _warningId;
public:
// All the get definitions
QStringList recentFiles();
QByteArray mainWinGeo();
QByteArray mainWinState();
QByteArray modelEditGeo();
QString armMcu();
QString avrArguments();
QString avrPort();
QString avrdudeLocation();
QString compileServer();
QString cpuId();
QString dfuArguments();
QString dfuLocation();
QString lastFw();
QString locale();
QString mcu();
QString programmer();
QString sambaLocation();
QString sambaPort();
QString backupDir();
QString gePath();
QString eepromDir();
QString flashDir();
QString imagesDir();
QString logDir();
QString libDir();
QString snapshotDir();
QString updatesDir();
bool enableBackup();
bool backupOnFlash();
bool jsSupport();
bool rev4aSupport();
bool maximized();
bool showSplash();
bool snapToClpbrd();
bool autoCheckApp();
bool autoCheckFw();
bool simuSW();
bool enableWizard();
int backLight();
int embedSplashes();
int fwServerFails();
int generalEditTab();
int iconSize();
int historySize();
int jsCtrl();
int modelEditTab(); // This variable is unused an can be removed
int id();
int theme();
int warningId();
// All the set definitions
void recentFiles (const QStringList x);
void mainWinGeo (const QByteArray);
void mainWinState (const QByteArray);
void modelEditGeo (const QByteArray);
void armMcu (const QString);
void avrArguments (const QString);
void avrPort (const QString);
void avrdudeLocation (const QString);
void compileServer (const QString);
void cpuId (const QString);
void dfuArguments (const QString);
void dfuLocation (const QString);
void lastFw (const QString);
void locale (const QString);
void mcu (const QString);
void programmer (const QString);
void sambaLocation (const QString);
void sambaPort (const QString);
void backupDir (const QString);
void gePath (const QString);
void eepromDir (const QString);
void flashDir (const QString);
void imagesDir (const QString);
void logDir (const QString);
void libDir (const QString);
void snapshotDir (const QString);
void updatesDir (const QString);
void enableBackup (const bool);
void backupOnFlash (const bool);
void maximized (const bool);
void jsSupport (const bool);
void rev4aSupport (const bool);
void showSplash (const bool);
void snapToClpbrd (const bool);
void autoCheckApp (const bool);
void autoCheckFw (const bool);
void simuSW (const bool);
void enableWizard (const bool);
void backLight (const int);
void embedSplashes (const int);
void fwServerFails (const int);
void generalEditTab (const int);
void iconSize (const int);
void historySize (const int);
void jsCtrl (const int);
void modelEditTab (const int);
void id (const int);
void theme (const int);
void warningId (const int);
// Constructor
AppData();
};
extern AppData g;
#endif // COMPANION_APPDATA_H

View file

@ -1,6 +1,7 @@
#include "apppreferencesdialog.h" #include "apppreferencesdialog.h"
#include "ui_apppreferencesdialog.h" #include "ui_apppreferencesdialog.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "appdata.h"
#include "helpers.h" #include "helpers.h"
#include "flashinterface.h" #include "flashinterface.h"
#ifdef JOYSTICKS #ifdef JOYSTICKS
@ -35,101 +36,85 @@ appPreferencesDialog::~appPreferencesDialog()
void appPreferencesDialog::writeValues() void appPreferencesDialog::writeValues()
{ {
QSettings settings; g.autoCheckApp(ui->startupCheck_companion9x->isChecked());
settings.setValue("startup_check_companion", ui->startupCheck_companion9x->isChecked()); g.autoCheckFw(ui->startupCheck_fw->isChecked());
settings.setValue("startup_check_fw", ui->startupCheck_fw->isChecked()); g.enableWizard(ui->wizardEnable_ChkB->isChecked());
settings.setValue("wizardEnable", ui->wizardEnable_ChkB->isChecked()); g.showSplash(ui->showSplash->isChecked());
settings.setValue("show_splash", ui->showSplash->isChecked()); g.simuSW(ui->simuSW->isChecked());
settings.setValue("simuSW", ui->simuSW->isChecked()); g.historySize(ui->historySize->value());
settings.setValue("history_size", ui->historySize->value()); g.backLight(ui->backLightColor->currentIndex());
settings.setValue("backLight", ui->backLightColor->currentIndex()); g.libDir(ui->libraryPath->text());
settings.setValue("libraryPath", ui->libraryPath->text()); g.gePath(ui->ge_lineedit->text());
settings.setValue("gePath", ui->ge_lineedit->text()); g.embedSplashes(ui->splashincludeCB->currentIndex());
settings.setValue("embedded_splashes", ui->splashincludeCB->currentIndex()); g.enableBackup(ui->backupEnable->isChecked());
settings.setValue("backupEnable", ui->backupEnable->isChecked());
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) { if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
settings.setValue("js_support", ui->joystickChkB ->isChecked()); g.jsSupport(ui->joystickChkB ->isChecked());
settings.setValue("js_ctrl", ui->joystickCB ->currentIndex()); g.jsCtrl(ui->joystickCB ->currentIndex());
} }
else { else {
settings.remove("js_support"); g.jsSupport(false);
settings.remove("js_ctrl"); g.jsCtrl(0);
} }
g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex());
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex()); g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex()); g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked()); g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked()); g.profile[g.id()].name(ui->profileNameLE->text());
settings.setValue("profileId", ui->profileIndexLE->text()); g.profile[g.id()].sdPath(ui->sdPath->text());
settings.setValue("Name", ui->profileNameLE->text()); g.profile[g.id()].splashFile(ui->SplashFileName->text());
settings.setValue("sdPath", ui->sdPath->text()); g.profile[g.id()].fwName(ui->fwNameLE->text());
settings.setValue("SplashFileName", ui->SplashFileName->text()); g.profile[g.id()].fwType(ui->fwTypeLE->text());
if (!ui->SplashFileName->text().isEmpty())
settings.setValue("SplashImage", "");
settings.setValue("firmware", ui->firmwareLE->text());
saveProfile(); saveProfile();
} }
void appPreferencesDialog::on_snapshotPathButton_clicked() void appPreferencesDialog::on_snapshotPathButton_clicked()
{ {
QSettings settings; QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), g.snapshotDir());
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), settings.value("snapshotPath").toString());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
settings.setValue("snapshotpath", fileName); g.snapshotDir(fileName);
settings.setValue("snapshot_to_clipboard", false); g.snapToClpbrd(false);
ui->snapshotPath->setText(fileName); ui->snapshotPath->setText(fileName);
} }
} }
void appPreferencesDialog::initSettings() void appPreferencesDialog::initSettings()
{ {
QSettings settings; ui->snapshotClipboardCKB->setChecked(g.snapToClpbrd());
ui->snapshotClipboardCKB->setChecked(settings.value("snapshot_to_clipboard", false).toBool()); ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
ui->burnFirmware->setChecked(settings.value("burnFirmware", true).toBool()); ui->snapshotPath->setText(g.snapshotDir());
ui->snapshotPath->setReadOnly(true);
QString Path=settings.value("snapshotPath", "").toString(); if (ui->snapshotClipboardCKB->isChecked())
if (QDir(Path).exists()) { {
ui->snapshotPath->setText(Path);
ui->snapshotPath->setReadOnly(true);
}
if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true); ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true); ui->snapshotPathButton->setDisabled(true);
} }
ui->startupCheck_companion9x->setChecked(settings.value("startup_check_companion", true).toBool()); ui->startupCheck_companion9x->setChecked(g.autoCheckApp());
ui->startupCheck_fw->setChecked(settings.value("startup_check_fw", true).toBool()); ui->startupCheck_fw->setChecked(g.autoCheckFw());
ui->wizardEnable_ChkB->setChecked(settings.value("wizardEnable", true).toBool()); ui->wizardEnable_ChkB->setChecked(g.enableWizard());
ui->showSplash->setChecked(settings.value("show_splash", true).toBool()); ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(settings.value("history_size", 10).toInt()); ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(settings.value("backLight", 0).toInt()); ui->backLightColor->setCurrentIndex(g.backLight());
ui->simuSW->setChecked(settings.value("simuSW", false).toBool()); ui->simuSW->setChecked(g.simuSW());
ui->libraryPath->setText(g.libDir());
ui->ge_lineedit->setText(g.gePath());
Path=settings.value("libraryPath", "").toString(); if (!g.backupDir().isEmpty()) {
if (QDir(Path).exists()) { if (QDir(g.backupDir()).exists()) {
ui->libraryPath->setText(Path); ui->backupPath->setText(g.backupDir());
}
Path=settings.value("gePath", "").toString();
if (QFile(Path).exists()) {
ui->ge_lineedit->setText(Path);
}
Path=settings.value("backupPath", "").toString();
if (!Path.isEmpty()) {
if (QDir(Path).exists()) {
ui->backupPath->setText(Path);
ui->backupEnable->setEnabled(true); ui->backupEnable->setEnabled(true);
ui->backupEnable->setChecked(settings.value("backupEnable", true).toBool()); 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(settings.value("embedded_splashes", 0).toInt()); ui->splashincludeCB->setCurrentIndex(g.embedSplashes());
#ifdef JOYSTICKS #ifdef JOYSTICKS
ui->joystickChkB->setChecked(settings.value("js_support", false).toBool()); 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");
@ -147,7 +132,7 @@ void appPreferencesDialog::initSettings()
} }
ui->joystickCB->clear(); ui->joystickCB->clear();
ui->joystickCB->insertItems(0, joystickNames); ui->joystickCB->insertItems(0, joystickNames);
ui->joystickCB->setCurrentIndex(settings.value("js_ctrl", 0).toInt()); ui->joystickCB->setCurrentIndex(g.jsCtrl());
} }
else { else {
ui->joystickCB->clear(); ui->joystickCB->clear();
@ -156,58 +141,46 @@ void appPreferencesDialog::initSettings()
} }
#endif #endif
// Profile Tab Inits // Profile Tab Inits
ui->channelorderCB->setCurrentIndex(settings.value("default_channel_order", 0).toInt()); ui->channelorderCB->setCurrentIndex(g.profile[g.id()].channelOrder());
ui->stickmodeCB->setCurrentIndex(settings.value("default_mode", 1).toInt()); ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode());
ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool()); ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles());
Path=settings.value("sdPath", "").toString(); ui->sdPath->setText(g.profile[g.id()].sdPath());
if (QDir(Path).exists()) { ui->profileNameLE->setText(g.profile[g.id()].name());
ui->sdPath->setText(Path); ui->fwNameLE->setText(g.profile[g.id()].fwName());
} ui->fwTypeLE->setText(g.profile[g.id()].fwType());
ui->profileIndexLE->setText(settings.value("profileId", "").toString()); ui->SplashFileName->setText(g.profile[g.id()].splashFile());
ui->profileNameLE->setText(settings.value("Name", "").toString());
QString fileName=settings.value("SplashFileName","").toString(); displayImage( g.profile[g.id()].splashFile() );
if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.exists()){
ui->SplashFileName->setText(fileName);
displayImage( fileName );
}
}
ui->firmwareLE->setText(settings.value("firmware","").toString());
} }
void appPreferencesDialog::on_libraryPathButton_clicked() void appPreferencesDialog::on_libraryPathButton_clicked()
{ {
QSettings settings; QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), g.libDir());
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), settings.value("libraryPath").toString());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
settings.setValue("libraryPath", fileName); g.libDir(fileName);
ui->libraryPath->setText(fileName); ui->libraryPath->setText(fileName);
} }
} }
void appPreferencesDialog::on_snapshotClipboardCKB_clicked() void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
{ {
QSettings settings;
if (ui->snapshotClipboardCKB->isChecked()) { if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true); ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true); ui->snapshotPathButton->setDisabled(true);
settings.setValue("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);
settings.setValue("snapshot_to_clipboard", false); g.snapToClpbrd(false);
} }
} }
void appPreferencesDialog::on_backupPathButton_clicked() void appPreferencesDialog::on_backupPathButton_clicked()
{ {
QSettings settings; QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), settings.value("backupPath").toString());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
settings.setValue("backupPath", fileName); g.backupDir(fileName);
ui->backupPath->setText(fileName); ui->backupPath->setText(fileName);
} }
ui->backupEnable->setEnabled(true); ui->backupEnable->setEnabled(true);
@ -215,7 +188,6 @@ void appPreferencesDialog::on_backupPathButton_clicked()
void appPreferencesDialog::on_ge_pathButton_clicked() void appPreferencesDialog::on_ge_pathButton_clicked()
{ {
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text()); QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
ui->ge_lineedit->setText(fileName); ui->ge_lineedit->setText(fileName);
@ -259,8 +231,7 @@ void appPreferencesDialog::on_joystickcalButton_clicked() {
void appPreferencesDialog::on_sdPathButton_clicked() void appPreferencesDialog::on_sdPathButton_clicked()
{ {
QSettings settings; QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), g.profile[g.id()].sdPath());
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), settings.value("sdPath").toString());
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
ui->sdPath->setText(fileName); ui->sdPath->setText(fileName);
} }
@ -268,118 +239,49 @@ void appPreferencesDialog::on_sdPathButton_clicked()
void appPreferencesDialog::saveProfile() void appPreferencesDialog::saveProfile()
{ {
QSettings settings; // The profile name may NEVER be empty
if (ui->profileNameLE->text().isEmpty())
ui->profileNameLE->setText("----");
QString profile=QString("profile") + settings.value("profileId").toString(); g.profile[g.id()].name( ui->profileNameLE->text() );
QString name=ui->profileNameLE->text(); g.profile[g.id()].channelOrder( ui->channelorderCB->currentIndex());
if (name.isEmpty()) { g.profile[g.id()].defaultMode( ui->stickmodeCB->currentIndex());
name = profile; g.profile[g.id()].burnFirmware( ui->burnFirmware->isChecked());
ui->profileNameLE->setText(name); g.profile[g.id()].renameFwFiles( ui->renameFirmware->isChecked());
} g.profile[g.id()].sdPath( ui->sdPath->text());
settings.beginGroup("Profiles"); g.profile[g.id()].splashFile( ui->SplashFileName->text());
settings.beginGroup(profile); g.profile[g.id()].fwName( ui->fwNameLE->text());
settings.setValue("Name",name); g.profile[g.id()].fwType( ui->fwTypeLE->text());
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
settings.setValue("firmware", ui->firmwareLE->text());
settings.endGroup();
settings.endGroup();
}
void appPreferencesDialog::loadProfileString(QString profile, QString label)
{
QSettings settings;
QString value;
settings.beginGroup("Profiles");
settings.beginGroup(profile);
value = settings.value(label).toString();
settings.endGroup();
settings.endGroup();
settings.setValue( label, value );
}
void appPreferencesDialog::loadProfile()
{
QSettings settings;
QString profile=QString("profile") + settings.value("profileId").toString();
loadProfileString( profile, "Name" );
loadProfileString( profile, "default_channel_order" );
loadProfileString( profile, "default_mode" );
loadProfileString( profile, "burnFirmware" );
loadProfileString( profile, "rename_firmware_files" );
loadProfileString( profile, "sdPath" );
loadProfileString( profile, "SplashFileName" );
loadProfileString( profile, "firmware" );
} }
void appPreferencesDialog::on_removeProfileButton_clicked() void appPreferencesDialog::on_removeProfileButton_clicked()
{ {
QSettings settings; if ( g.id() == 0 )
QString profileId = settings.value("profileId").toString();
if ( profileId == "1" )
QMessageBox::information(this, tr("Not possible to remove profile"), tr("The default profile can not be removed.")); QMessageBox::information(this, tr("Not possible to remove profile"), tr("The default profile can not be removed."));
else else
{ {
QString profile=QString("profile") + profileId; g.profile[g.id()].remove();
settings.beginGroup("Profiles"); g.id( 0 );
settings.remove(profile);
settings.endGroup();
settings.setValue("profileId", "1");
loadProfile();
initSettings(); initSettings();
} }
} }
bool appPreferencesDialog::displayImage( QString fileName ) bool appPreferencesDialog::displayImage( QString fileName )
{ {
QSettings settings; // Start by clearing the pixmap
ui->imageLabel->setPixmap(QPixmap());
QImage image(fileName); QImage image(fileName);
if (image.isNull()) if (image.isNull())
return false; return false;
// This code below just figures out if the width of the latest firmware is 128 or 212. It works , but... // Use the firmware name to determine splash width
QString filePath1 = settings.value("lastFlashDir", "").toString() + "/" + settings.value("firmware", "").toString() + ".bin";
QString filePath2 = settings.value("lastFlashDir", "").toString() + "/" + settings.value("firmware", "").toString() + ".hex";
QFile file(filePath1);
if (!file.exists())
filePath1 = filePath2;
int width = SPLASH_WIDTH; int width = SPLASH_WIDTH;
FlashInterface flash(filePath1); if (g.profile[g.id()].fwType().contains("taranis"))
if (flash.hasSplash()) width = SPLASHX9D_WIDTH;
width = flash.getSplashWidth(); // Returns SPLASHX9D_HEIGHT if filePath1 does not exist!
// There must be a cleaner way of finding out the width of the firmware splash! ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType()));
ui->imageLabel->setFixedSize(width, SPLASH_HEIGHT);
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(width, SPLASH_HEIGHT)));
if (width==SPLASHX9D_WIDTH) {
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray, height = image.height();
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
}
else {
ui->imageLabel->setPixmap(QPixmap::fromImage(image.convertToFormat(QImage::Format_Mono)));
}
if (width == SPLASH_WIDTH)
ui->imageLabel->setFixedSize(SPLASH_WIDTH, SPLASH_HEIGHT);
else
ui->imageLabel->setFixedSize(SPLASHX9D_WIDTH, SPLASHX9D_HEIGHT);
return true; return true;
} }
@ -390,15 +292,14 @@ void appPreferencesDialog::on_SplashSelect_clicked()
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
} }
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this, QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats)); tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()){
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath()); g.imagesDir(QFileInfo(fileName).dir().absolutePath());
if (displayImage(fileName)) displayImage(fileName);
ui->SplashFileName->setText(fileName); ui->SplashFileName->setText(fileName);
} }
} }

View file

@ -26,7 +26,7 @@ private:
bool displayImage( QString fileName ); bool displayImage( QString fileName );
void saveProfile(); void saveProfile();
void loadProfileString(QString profile, QString label); void loadProfileString(QString profile, QString label);
void loadProfile(); void loadFromProfile();
private slots: private slots:
void writeValues(); void writeValues();

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>685</width> <width>685</width>
<height>462</height> <height>442</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -26,12 +26,21 @@
<string>Edit Settings</string> <string>Edit Settings</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>2</number> <number>2</number>
</property> </property>
<property name="margin">
<number>6</number>
</property>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
@ -124,12 +133,12 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Include companion splashes</string> <string>Only show user splash images</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Only user defined splashes</string> <string>Show user and companion splash images</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -490,10 +499,10 @@
</widget> </widget>
<widget class="QWidget" name="profileTab"> <widget class="QWidget" name="profileTab">
<attribute name="title"> <attribute name="title">
<string>Radio Settings</string> <string>Radio Settings Profile</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="10" column="1" colspan="4"> <item row="11" column="1" colspan="4">
<widget class="QComboBox" name="stickmodeCB"> <widget class="QComboBox" name="stickmodeCB">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -547,7 +556,7 @@ Mode 4:
</item> </item>
</widget> </widget>
</item> </item>
<item row="12" column="1" colspan="4"> <item row="13" column="1" colspan="4">
<widget class="QComboBox" name="channelorderCB"> <widget class="QComboBox" name="channelorderCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@ -697,14 +706,7 @@ This is used by the templated to determine which channel goes to what number out
</item> </item>
</widget> </widget>
</item> </item>
<item row="3" column="1" colspan="5"> <item row="11" column="0">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="label_14">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -720,11 +722,11 @@ This is used by the templated to determine which channel goes to what number out
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Settings Profile</string> <string>Profile Name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1"> <item row="16" column="1">
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -737,7 +739,7 @@ This is used by the templated to determine which channel goes to what number out
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -750,7 +752,7 @@ This is used by the templated to determine which channel goes to what number out
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="0"> <item row="13" column="0">
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="label_13">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@ -766,14 +768,14 @@ This is used by the templated to determine which channel goes to what number out
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="1" colspan="4"> <item row="14" column="1" colspan="4">
<widget class="QCheckBox" name="renameFirmware"> <widget class="QCheckBox" name="renameFirmware">
<property name="text"> <property name="text">
<string>Append version number to FW file name</string> <string>Append version number to FW file name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="sdPathLabel"> <widget class="QLabel" name="sdPathLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -789,7 +791,7 @@ This is used by the templated to determine which channel goes to what number out
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="3"> <item row="3" column="1" colspan="3">
<widget class="QLineEdit" name="sdPath"> <widget class="QLineEdit" name="sdPath">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -800,12 +802,18 @@ This is used by the templated to determine which channel goes to what number out
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="5"> <item row="3" column="5">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -818,88 +826,113 @@ This is used by the templated to determine which channel goes to what number out
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="14" column="1" colspan="4"> <item row="15" column="1" colspan="4">
<widget class="QCheckBox" name="burnFirmware"> <widget class="QCheckBox" name="burnFirmware">
<property name="text"> <property name="text">
<string>Offer to write FW to Tx after download</string> <string>Offer to write FW to Tx after download</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="6"> <item row="15" column="6">
<widget class="QPushButton" name="removeProfileButton"> <widget class="QPushButton" name="removeProfileButton">
<property name="text"> <property name="text">
<string>Remove Profile</string> <string>Remove Profile</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="6"> <item row="3" column="6">
<widget class="QPushButton" name="sdPathButton"> <widget class="QPushButton" name="sdPathButton">
<property name="text"> <property name="text">
<string>Open Folder</string> <string>Open Folder</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="10" column="1" colspan="6">
<widget class="QLineEdit" name="profileNameLE">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="9" column="1" colspan="6">
<widget class="Line" name="line_6"> <widget class="Line" name="line_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1" colspan="3"> <item row="5" column="1" colspan="3">
<widget class="QLineEdit" name="SplashFileName"> <widget class="QLineEdit" name="SplashFileName">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>350</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="0">
<widget class="QLineEdit" name="profileIndexLE"> <widget class="QLabel" name="label">
<property name="text">
<string>Firmware Variant</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="fwTypeLE">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>30</width> <width>350</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="5" column="6">
<widget class="QLabel" name="label"> <widget class="QPushButton" name="SplashSelect">
<property name="text"> <property name="text">
<string>Firmware</string> <string>Select Image</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="8" column="6">
<widget class="QLineEdit" name="firmwareLE"> <widget class="QPushButton" name="clearImageButton">
<property name="enabled"> <property name="text">
<bool>false</bool> <string>Clear Image</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="profileNameLE">
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="imageLabel"> <widget class="QLabel" name="imageLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@ -923,7 +956,10 @@ This is used by the templated to determine which channel goes to what number out
<enum>QFrame::Panel</enum> <enum>QFrame::Panel</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -933,17 +969,36 @@ This is used by the templated to determine which channel goes to what number out
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="6"> <item row="4" column="1" colspan="6">
<widget class="QPushButton" name="SplashSelect"> <widget class="Line" name="line_3">
<property name="text"> <property name="orientation">
<string>Select Image</string> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="6"> <item row="2" column="0">
<widget class="QPushButton" name="clearImageButton"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Clear Image</string> <string>Firmware File</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="fwNameLE">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -3,6 +3,7 @@
#include "avroutputdialog.h" #include "avroutputdialog.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include "helpers.h" #include "helpers.h"
#include "appdata.h"
#include <QtGui> #include <QtGui>
#if !defined WIN32 && defined __GNUC__ #if !defined WIN32 && defined __GNUC__
@ -83,33 +84,42 @@ burnConfigDialog::~burnConfigDialog()
void burnConfigDialog::getSettings() void burnConfigDialog::getSettings()
{ {
QSettings settings; avrLoc = g.avrdudeLocation();
sambaLoc = g.sambaLocation();
dfuLoc = g.dfuLocation();
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
avrLoc = settings.value("avrdude_location", QFileInfo("avrdude.exe").absoluteFilePath()).toString(); if ( avrLoc.isEmpty())
sambaLoc = settings.value("samba_location", QFileInfo("sam-ba.exe").absoluteFilePath()).toString(); avrLoc = QFileInfo("avrdude.exe").absoluteFilePath();
dfuLoc = settings.value("dfu_location", QFileInfo("dfu-util.exe").absoluteFilePath()).toString(); if ( sambaLoc.isEmpty())
sambaLoc = QFileInfo("sam-ba.exe").absoluteFilePath();
if ( dfuLoc.isEmpty())
dfuLoc = QFileInfo("dfu-util.exe").absoluteFilePath();
#elif defined __APPLE__ #elif defined __APPLE__
avrLoc = settings.value("avrdude_location", "/usr/local/bin/avrdude").toString(); if ( avrLoc.isEmpty())
sambaLoc = settings.value("samba_location", "/usr/local/bin/sam-ba").toString(); avrLoc = "/usr/local/bin/avrdude";
dfuLoc = settings.value("dfu_location", QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath()).toString(); if ( sambaLoc.isEmpty())
sambaLoc = "/usr/local/bin/sam-ba";
if ( dfuLoc.isEmpty())
dfuLoc = QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath();
#else #else
avrLoc = settings.value("avrdude_location", "/usr/bin/avrdude").toString(); if ( avrLoc.isEmpty())
sambaLoc = settings.value("samba_location", "/usr/bin/sam-ba").toString(); avrLoc = "/usr/bin/avrdude";
dfuLoc = settings.value("dfu_location", QFileInfo("/usr/bin/dfu-util").absoluteFilePath()).toString(); if ( sambaLoc.isEmpty())
sambaLoc = "/usr/bin/sam-ba";
if ( dfuLoc.isEmpty())
dfuLoc = QFileInfo("/usr/bin/dfu-util").absoluteFilePath();
#endif #endif
QString str = settings.value("avr_arguments").toString();
avrArgs = str.split(" ", QString::SkipEmptyParts);
avrProgrammer = settings.value("programmer", QString("usbasp")).toString();
avrMCU = settings.value("mcu", QString("m64")).toString(); dfuArgs = g.dfuArguments().split(" ", QString::SkipEmptyParts);
armMCU = settings.value("arm_mcu", QString("at91sam3s4-9x")).toString(); avrArgs = g.avrArguments().split(" ", QString::SkipEmptyParts);
avrProgrammer = g.programmer();
avrPort = g.avrPort();
avrMCU = g.mcu();
armMCU = g.armMcu();
sambaPort = g.sambaPort();
avrPort = settings.value("avr_port", "").toString();
sambaPort = settings.value("samba_port", "\\USBserial\\COM23").toString();
str = settings.value("dfu_arguments", "-a 0").toString();
dfuArgs = str.split(" ", QString::SkipEmptyParts);
ui->avrdude_location->setText(getAVRDUDE()); ui->avrdude_location->setText(getAVRDUDE());
ui->avrArgs->setText(getAVRArgs().join(" ")); ui->avrArgs->setText(getAVRArgs().join(" "));
@ -137,17 +147,16 @@ void burnConfigDialog::getSettings()
void burnConfigDialog::putSettings() void burnConfigDialog::putSettings()
{ {
QSettings settings; g.avrdudeLocation( avrLoc );
settings.setValue("avrdude_location", avrLoc); g.programmer( avrProgrammer);
settings.setValue("programmer", avrProgrammer); g.mcu( avrMCU );
settings.setValue("mcu", avrMCU); g.avrPort( avrPort );
settings.setValue("avr_port", avrPort); g.avrArguments( avrArgs.join(" ") );
settings.setValue("avr_arguments", avrArgs.join(" ")); g.sambaLocation( sambaLoc );
settings.setValue("samba_location", sambaLoc); g.sambaPort( sambaPort );
settings.setValue("samba_port", sambaPort); g.armMcu( armMCU );
settings.setValue("arm_mcu", armMCU); g.dfuLocation( dfuLoc );
settings.setValue("dfu_location", dfuLoc); g.dfuArguments( dfuArgs.join(" ") );
settings.setValue("dfu_arguments", dfuArgs.join(" "));
} }
void burnConfigDialog::populateProgrammers() void burnConfigDialog::populateProgrammers()

View file

@ -7,7 +7,9 @@
#include "splashlibrary.h" #include "splashlibrary.h"
#include "flashinterface.h" #include "flashinterface.h"
#include "hexinterface.h" #include "hexinterface.h"
#include "appdata.h"
// Type 1 = Burn EEPROM, Type 2= Burn Flash
burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * backupEE, QString DocName): burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * backupEE, QString DocName):
QDialog(parent), QDialog(parent),
ui(new Ui::burnDialog), ui(new Ui::burnDialog),
@ -16,17 +18,25 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
hexType(Type) hexType(Type)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->libraryButton->setIcon(CompanionIcon("library.png"));
if(!g.profile[g.id()].splashFile().isEmpty()){
imageSource=PROFILE;
imageFile=g.profile[g.id()].splashFile();
}
else{
ui->useProfileImageCB->setDisabled(true);
imageSource=FIRMWARE;
imageFile="";
}
ui->SplashFrame->hide(); ui->SplashFrame->hide();
ui->FramFWInfo->hide(); ui->FramFWInfo->hide();
ui->EEbackupCB->hide(); ui->EEbackupCB->hide();
ui->EEbackupCB->setCheckState(*backup ? Qt::Checked : Qt::Unchecked); ui->EEbackupCB->setCheckState(*backup ? Qt::Checked : Qt::Unchecked);
if (Type == 2) { if (Type == FLASH_FILE_TYPE ) {
ui->EEpromCB->hide(); ui->EEpromCB->hide();
ui->profile_label->hide(); ui->profile_label->hide();
ui->patchcalib_CB->hide(); ui->patchcalib_CB->hide();
ui->patchhw_CB->hide(); ui->patchhw_CB->hide();
ui->InvertColorButton->setDisabled(true);
setWindowTitle(tr("Write firmware to TX")); setWindowTitle(tr("Write firmware to TX"));
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->EEbackupCB->hide(); ui->EEbackupCB->hide();
@ -38,12 +48,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->patchcalib_CB->hide(); ui->patchcalib_CB->hide();
ui->patchhw_CB->hide(); ui->patchhw_CB->hide();
ui->EEpromCB->hide(); ui->EEpromCB->hide();
ui->ImageLoadButton->setDisabled(true);
ui->libraryButton->setDisabled(true);
ui->InvertColorButton->setDisabled(true);
ui->BurnFlashButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true);
ui->ImageFileName->clear();
ui->FwImage->clear();
ui->FWFileName->clear(); ui->FWFileName->clear();
ui->DateField->clear(); ui->DateField->clear();
ui->SVNField->clear(); ui->SVNField->clear();
@ -58,38 +63,23 @@ 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));
} }
QSettings settings; ui->profile_label->setText(tr("Current profile")+QString(": ")+g.profile[g.id()].name());
int profileid=settings.value("profileId", 1).toInt();
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profileid);
settings.beginGroup(profile);
QString Name=settings.value("Name","").toString();
settings.endGroup();
settings.endGroup();
ui->profile_label->setText(tr("Current profile")+QString(": ")+Name);
} }
if (!hexfileName->isEmpty()) { if (!hexfileName->isEmpty()) {
ui->FWFileName->setText(*hexfileName); ui->FWFileName->setText(*hexfileName);
if (Type==2) { if (Type==FLASH_FILE_TYPE) {
checkFw(*hexfileName); checkFw(*hexfileName);
} }
else { else {
burnraw=false; burnraw=false;
if (checkeEprom(*hexfileName)) { if (checkeEprom(*hexfileName)) {
QSettings settings; QString Name = g.profile[g.id()].name();
int profileid=settings.value("profileId", 1).toInt(); QString calib = g.profile[g.id()].stickPotCalib();
settings.beginGroup("Profiles"); QString trainercalib = g.profile[g.id()].trainerCalib();
QString profile=QString("profile%1").arg(profileid); QString DisplaySet = g.profile[g.id()].display();
settings.beginGroup(profile); QString BeeperSet = g.profile[g.id()].beeper();
QString Name=settings.value("Name","").toString(); QString HapticSet = g.profile[g.id()].haptic();
QString calib=settings.value("StickPotCalib","").toString(); QString SpeakerSet = g.profile[g.id()].speaker();
QString trainercalib=settings.value("TrainerCalib","").toString();
QString DisplaySet=settings.value("Display","").toString();
QString BeeperSet=settings.value("Beeper","").toString();
QString HapticSet=settings.value("Haptic","").toString();
QString SpeakerSet=settings.value("Speaker","").toString();
settings.endGroup();
settings.endGroup();
if (!Name.isEmpty()) { if (!Name.isEmpty()) {
ui->profile_label->show(); ui->profile_label->show();
ui->patchcalib_CB->show(); ui->patchcalib_CB->show();
@ -118,15 +108,14 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->FlashLoadButton->hide(); ui->FlashLoadButton->hide();
hexfileName->clear(); hexfileName->clear();
} }
else if (Type==2) { else if (Type==FLASH_FILE_TYPE) {
QSettings settings; QString FileName = g.profile[g.id()].fwName();
QString FileName;
FileName = settings.value("lastFw").toString();
QFile file(FileName); QFile file(FileName);
if (file.exists()) { if (file.exists()) {
checkFw(FileName); checkFw(FileName);
} }
} }
updateUI();
resize(0, 0); resize(0, 0);
} }
@ -138,13 +127,8 @@ burnDialog::~burnDialog()
void burnDialog::on_FlashLoadButton_clicked() void burnDialog::on_FlashLoadButton_clicked()
{ {
QString fileName; QString fileName;
QSettings settings;
ui->ImageLoadButton->setDisabled(true);
ui->libraryButton->setDisabled(true);
ui->InvertColorButton->setDisabled(true);
ui->BurnFlashButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true);
ui->ImageFileName->clear();
ui->FwImage->clear();
ui->FWFileName->clear(); ui->FWFileName->clear();
ui->DateField->clear(); ui->DateField->clear();
ui->SVNField->clear(); ui->SVNField->clear();
@ -154,12 +138,14 @@ void burnDialog::on_FlashLoadButton_clicked()
ui->BurnFlashButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true);
ui->EEbackupCB->hide(); ui->EEbackupCB->hide();
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
if (hexType==2) { if (hexType==FLASH_FILE_TYPE) {
fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER); fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
if(fileName.isEmpty())
return;
checkFw(fileName); checkFw(fileName);
} }
else { else {
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), settings.value("lastDir").toString(), tr(EXTERNAL_EEPROM_FILES_FILTER)); QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
if (checkeEprom(fileName)) { if (checkeEprom(fileName)) {
if (burnraw==false) { if (burnraw==false) {
ui->BurnFlashButton->setEnabled(true); ui->BurnFlashButton->setEnabled(true);
@ -184,6 +170,7 @@ void burnDialog::on_FlashLoadButton_clicked()
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
} }
} }
updateUI();
} }
void burnDialog::checkFw(QString fileName) void burnDialog::checkFw(QString fileName)
@ -191,7 +178,7 @@ void burnDialog::checkFw(QString fileName)
if (fileName.isEmpty()) { if (fileName.isEmpty()) {
return; return;
} }
QSettings settings;
if (!IS_TARANIS(GetEepromInterface()->getBoard())) { if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->EEbackupCB->show(); ui->EEbackupCB->show();
} }
@ -206,61 +193,19 @@ void burnDialog::checkFw(QString fileName)
ui->DateField->setText(flash.getDate() + " " + flash.getTime()); ui->DateField->setText(flash.getDate() + " " + flash.getTime());
ui->SVNField->setText(flash.getSvn()); ui->SVNField->setText(flash.getSvn());
ui->ModField->setText(flash.getBuild()); ui->ModField->setText(flash.getBuild());
ui->BurnFlashButton->setEnabled(true);
ui->BurnFlashButton->setText(tr("Write to TX")); ui->SplashFrame->hide();
if (flash.hasSplash()) { if (flash.hasSplash()) {
ui->SplashFrame->show(); ui->SplashFrame->show();
ui->ImageLoadButton->setEnabled(true);
ui->libraryButton->setEnabled(true);
ui->FwImage->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight()); ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
ui->FwImage->show();
ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash()));
QString ImageStr = settings.value("SplashImage", "").toString();
bool PatchFwCB = settings.value("patchImage", false).toBool();
if (!ImageStr.isEmpty()) {
QImage Image = qstring2image(ImageStr);
ui->imageLabel->setPixmap(QPixmap::fromImage(Image.convertToFormat(flash.getSplashFormat())));
ui->InvertColorButton->setEnabled(true);
ui->PreferredImageCB->setChecked(true);
ui->PatchFWCB->setChecked(PatchFwCB);
}
else {
QString fileName=ui->ImageFileName->text();
if (!fileName.isEmpty()) {
QImage image(fileName);
if (!image.isNull()) {
ui->InvertColorButton->setEnabled(true);
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat())));
ui->PatchFWCB->setEnabled(true);
ui->PatchFWCB->setChecked(PatchFwCB);
}
else {
ui->PatchFWCB->setDisabled(true);
ui->PatchFWCB->setChecked(false);
ui->PreferredImageCB->setDisabled(true);
}
}
else {
ui->PatchFWCB->setDisabled(true);
ui->PatchFWCB->setChecked(false);
ui->PreferredImageCB->setDisabled(true);
}
}
}
else {
ui->FwImage->hide();
ui->ImageFileName->setText("");
ui->SplashFrame->hide();
} }
} }
else { else {
QMessageBox::warning(this, tr("Warning"), tr("%1 is not a known firmware").arg(fileName)); QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fileName));
ui->BurnFlashButton->setText(tr("Burn anyway !"));
ui->BurnFlashButton->setEnabled(true);
} }
ui->BurnFlashButton->setEnabled(true);
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); g.flashDir( QFileInfo(fileName).dir().absolutePath() );
} }
bool burnDialog::checkeEprom(QString fileName) bool burnDialog::checkeEprom(QString fileName)
@ -353,52 +298,92 @@ bool burnDialog::checkeEprom(QString fileName)
return true; return true;
} }
void burnDialog::on_ImageLoadButton_clicked() void burnDialog::displaySplash()
{
QImage image;
if (imageSource == FIRMWARE){
FlashInterface flash(ui->FWFileName->text());
image = flash.getSplash();
}
else{
image.load(imageFile);
}
if (image.isNull()) {
return;
}
ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType()));
}
void burnDialog::updateUI()
{
if (hexType==EEPROM_FILE_TYPE)
return;
ui->useProfileImageCB->setChecked( imageSource == PROFILE );
ui->useFwImageCB->setChecked( imageSource == FIRMWARE );
ui->useLibraryImageCB->setChecked( imageSource == LIBRARY );
ui->useAnotherImageCB->setChecked( imageSource == ANOTHER );
displaySplash();
}
void burnDialog::on_useFwImageCB_clicked()
{
QString fileName = ui->FWFileName->text();
FlashInterface flash(fileName);
if (!flash.isValid()) {
QMessageBox::critical(this, tr("Error"), tr( "The firmware file is not valid." ));
}
else {
if (!flash.hasSplash()) {
QMessageBox::critical(this, tr("Error"), tr( "There is no start screen image in the firmware file." ));
}
else{
imageSource = FIRMWARE;
imageFile = fileName;
}
}
updateUI();
}
void burnDialog::on_useProfileImageCB_clicked()
{
QString fileName = g.profile[g.id()].splashFile();
if (!fileName.isEmpty()){
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not contain an image.").arg(fileName));
}
else {
imageSource = PROFILE;
imageFile = fileName;
}
}
updateUI();
}
void burnDialog::on_useAnotherImageCB_clicked()
{ {
QString supportedImageFormats; QString supportedImageFormats;
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) { for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
} }
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
QSettings settings; if (!fileName.isEmpty()){
QString fileName = QFileDialog::getOpenFileName(this, g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) {
settings.setValue("lastImagesDir", 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("Image could not be loaded from %1").arg(fileName));
ui->PatchFWCB->setDisabled(true);
ui->PatchFWCB->setChecked(false);
ui->InvertColorButton->setDisabled(true);
return;
} }
ui->ImageFileName->setText(fileName); else{
ui->InvertColorButton->setEnabled(true); imageSource = ANOTHER;
if (ui->imageLabel->width()!=128) { imageFile = fileName;
image=image.convertToFormat(QImage::Format_RGB32); }
QRgb col;
int gray;
int width = image.width();
int height = image.height();
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
}
else {
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
}
ui->PatchFWCB->setEnabled(true);
} }
updateUI();
} }
void burnDialog::on_libraryButton_clicked() void burnDialog::on_useLibraryImageCB_clicked()
{ {
QString fileName; QString fileName;
splashLibrary *ld = new splashLibrary(this,&fileName); splashLibrary *ld = new splashLibrary(this,&fileName);
@ -406,50 +391,26 @@ void burnDialog::on_libraryButton_clicked()
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
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("The library image could not be loaded"));
ui->PatchFWCB->setDisabled(true);
ui->PatchFWCB->setChecked(false);
ui->InvertColorButton->setDisabled(true);
return;
} }
ui->ImageFileName->setText(fileName); else{
ui->InvertColorButton->setEnabled(true); imageSource = LIBRARY;
if (ui->imageLabel->width()!=128) { imageFile = fileName;
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
int width = image.width();
int height = image.height();
for (int i = 0; i < width; ++i)
{
for (int j = 0; j < height; ++j)
{
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
} else {
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
} }
ui->PatchFWCB->setEnabled(true);
} }
updateUI();
} }
void burnDialog::on_BurnFlashButton_clicked() void burnDialog::on_BurnFlashButton_clicked()
{ {
if (hexType==2) { if (hexType==FLASH_FILE_TYPE) {
QString fileName=ui->FWFileName->text(); QString fileName=ui->FWFileName->text();
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QSettings settings; g.flashDir( QFileInfo(fileName).dir().absolutePath() );
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); if (!ui->useFwImageCB->isChecked()) {
settings.setValue("lastFw", fileName);
if (ui->PatchFWCB->isChecked()) {
settings.setValue("patchImage", true);
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height()); QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
if (!image.isNull()) { if (!image.isNull()) {
QString tempDir = QDir::tempPath(); QString tempDir = QDir::tempPath();
QString tempFile; QString tempFile;
if (getFileType(fileName) == FILE_TYPE_HEX) if (getFileType(fileName) == FILE_TYPE_HEX)
tempFile = tempDir + "/flash.hex"; tempFile = tempDir + "/flash.hex";
@ -469,7 +430,6 @@ void burnDialog::on_BurnFlashButton_clicked()
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found")); QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
} }
} else { } else {
settings.setValue("patchImage", false);
hexfileName->clear(); hexfileName->clear();
hexfileName->append(fileName); hexfileName->append(fileName);
} }
@ -478,27 +438,20 @@ void burnDialog::on_BurnFlashButton_clicked()
hexfileName->clear(); hexfileName->clear();
} }
} }
if (hexType==1) { if (hexType==EEPROM_FILE_TYPE) {
QSettings settings; QString calib = g.profile[g.id()].stickPotCalib();
int profileid=settings.value("profileId", 1).toInt(); QString trainercalib = g.profile[g.id()].trainerCalib();
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profileid);
settings.beginGroup(profile);
QString calib=settings.value("StickPotCalib","").toString();
QString trainercalib=settings.value("TrainerCalib","").toString();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
int8_t vBatCalib=(int8_t)settings.value("VbatCalib", radioData.generalSettings.vBatCalib).toInt(); int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
int8_t currentCalib=(int8_t)settings.value("currentCalib", radioData.generalSettings.currentCalib).toInt(); int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
int8_t PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", radioData.generalSettings.PPM_Multiplier).toInt(); int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
uint8_t GSStickMode=(uint8_t)settings.value("GSStickMode", radioData.generalSettings.stickMode).toUInt(); uint8_t GSStickMode=(uint8_t) g.profile[g.id()].gsStickMode();
uint8_t vBatWarn=(uint8_t)settings.value("vBatWarn",radioData.generalSettings.vBatWarn).toUInt(); uint8_t vBatWarn=(uint8_t) g.profile[g.id()].vBatWarn();
QString DisplaySet=settings.value("Display","").toString(); QString DisplaySet= g.profile[g.id()].display();
QString BeeperSet=settings.value("Beeper","").toString(); QString BeeperSet= g.profile[g.id()].beeper();
QString HapticSet=settings.value("Haptic","").toString(); QString HapticSet= g.profile[g.id()].haptic();
QString SpeakerSet=settings.value("Speaker","").toString(); QString SpeakerSet= g.profile[g.id()].speaker();
settings.endGroup();
settings.endGroup();
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)) {
@ -634,99 +587,9 @@ void burnDialog::on_cancelButton_clicked()
this->close(); this->close();
} }
void burnDialog::on_InvertColorButton_clicked()
{
if (ui->imageLabel->pixmap()) {
QImage image = ui->imageLabel->pixmap()->toImage();
image.invertPixels();
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
}
}
void burnDialog::on_EEpromCB_toggled(bool checked) void burnDialog::on_EEpromCB_toggled(bool checked)
{ {
if (ui->EEpromCB->isChecked()) { *backup = ui->EEpromCB->isChecked();
*backup=true;
} else {
*backup=false;
}
}
void burnDialog::on_PreferredImageCB_toggled(bool checked)
{
QString tmpFileName;
if (checked) {
QSettings settings;
QString ImageStr = settings.value("SplashImage", "").toString();
if (!ImageStr.isEmpty()) {
QImage Image = qstring2image(ImageStr);
if (ui->imageLabel->width()!=128) {
Image=Image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
int width = Image.width();
int height = Image.height();
for (int i = 0; i < width; ++i)
{
for (int j = 0; j < height; ++j)
{
col = Image.pixel(i, j);
gray = qGray(col);
Image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
} else {
Image=Image.convertToFormat(QImage::Format_Mono);
}
ui->imageLabel->setPixmap(QPixmap::fromImage(Image));
ui->InvertColorButton->setEnabled(true);
ui->PreferredImageCB->setChecked(true);
ui->ImageFileName->setDisabled(true);
ui->ImageLoadButton->setDisabled(true);
ui->libraryButton->setDisabled(true);
ui->PatchFWCB->setEnabled(true);
}
} else {
ui->imageLabel->clear();
ui->ImageLoadButton->setEnabled(true);
ui->libraryButton->setEnabled(true);
tmpFileName = ui->ImageFileName->text();
if (!tmpFileName.isEmpty()) {
QImage image(tmpFileName);
if (!image.isNull()) {
if (ui->imageLabel->width()!=128) {
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
int width = image.width();
int height = image.height();
for (int i = 0; i < width; ++i)
{
for (int j = 0; j < height; ++j)
{
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
} else {
image=image.convertToFormat(QImage::Format_Mono);
}
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
ui->InvertColorButton->setEnabled(true);
ui->ImageFileName->setEnabled(true);
ui->PatchFWCB->setDisabled(false);
} else {
ui->InvertColorButton->setDisabled(true);
ui->PatchFWCB->setDisabled(true);
ui->PatchFWCB->setChecked(false);
}
} else {
ui->InvertColorButton->setDisabled(true);
ui->PatchFWCB->setDisabled(true);
ui->PatchFWCB->setChecked(false);
}
}
} }
void burnDialog::shrink() void burnDialog::shrink()
@ -736,9 +599,5 @@ void burnDialog::shrink()
void burnDialog::on_EEbackupCB_clicked() void burnDialog::on_EEbackupCB_clicked()
{ {
if (ui->EEbackupCB->isChecked()) { *backup = ui->EEbackupCB->isChecked();
*backup=true;
} else {
*backup=false;
}
} }

View file

@ -19,6 +19,8 @@
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE" #define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
#define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE" #define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE"
#define EEPROM_FILE_TYPE 1
#define FLASH_FILE_TYPE 2
namespace Ui namespace Ui
@ -36,18 +38,22 @@ public:
private slots: private slots:
void on_FlashLoadButton_clicked(); void on_FlashLoadButton_clicked();
void on_ImageLoadButton_clicked();
void on_libraryButton_clicked();
void on_BurnFlashButton_clicked(); void on_BurnFlashButton_clicked();
void on_cancelButton_clicked(); void on_cancelButton_clicked();
void on_InvertColorButton_clicked();
void on_EEbackupCB_clicked(); void on_EEbackupCB_clicked();
void on_PreferredImageCB_toggled(bool checked); void on_EEpromCB_toggled(bool checked);
void on_EEpromCB_toggled(bool checked);
void checkFw(QString fileName);
bool checkeEprom(QString fileName); bool checkeEprom(QString fileName);
void on_useProfileImageCB_clicked();
void on_useFwImageCB_clicked();
void on_useLibraryImageCB_clicked();
void on_useAnotherImageCB_clicked();
void checkFw(QString fileName);
void displaySplash();
void updateUI();
void shrink(); void shrink();
private: private:
Ui::burnDialog *ui; Ui::burnDialog *ui;
QString * hexfileName; QString * hexfileName;
@ -55,6 +61,9 @@ private:
int hexType; int hexType;
RadioData radioData; RadioData radioData;
bool burnraw; bool burnraw;
enum ImageSource {FIRMWARE, PROFILE, LIBRARY, ANOTHER};
ImageSource imageSource;
QString imageFile;
}; };
#endif // BURNDIALOG_H #endif // BURNDIALOG_H

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>440</width> <width>440</width>
<height>418</height> <height>423</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -30,21 +30,8 @@
<normaloff>:/icon.png</normaloff>:/icon.png</iconset> <normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="0"> <item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<spacer name="hs2"> <spacer name="hs2">
<property name="orientation"> <property name="orientation">
@ -71,19 +58,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QPushButton" name="BurnFlashButton"> <widget class="QPushButton" name="BurnFlashButton">
<property name="enabled"> <property name="enabled">
@ -100,19 +74,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="hs2_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
@ -152,56 +113,22 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="2" rowspan="3"> <item row="1" column="1">
<widget class="QLabel" name="FwImage"> <widget class="QLineEdit" name="SVNField">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="DateField">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="2" column="0">
<widget class="QLabel" name="dateLabel"> <widget class="QLabel" name="buildLabel">
<property name="text"> <property name="text">
<string>Date &amp; Time</string> <string>Variant</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="SVNField"> <widget class="QLineEdit" name="ModField">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -214,17 +141,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="0">
<widget class="QLineEdit" name="ModField"> <widget class="QLabel" name="dateLabel">
<property name="readOnly"> <property name="text">
<bool>true</bool> <string>Date &amp; Time</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="1">
<widget class="QLabel" name="buildLabel"> <widget class="QLineEdit" name="DateField">
<property name="text"> <property name="readOnly">
<string>Variant</string> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -325,17 +252,10 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,1"> <layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
<item row="0" column="1" rowspan="4"> <item row="0" column="1" rowspan="7">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,0"> <layout class="QGridLayout" name="gridLayout_2" rowstretch="1">
<item row="1" column="0"> <item row="0" column="1">
<widget class="QPushButton" name="InvertColorButton">
<property name="text">
<string>Invert Color</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="imageLabel"> <widget class="QLabel" name="imageLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@ -359,7 +279,7 @@
<enum>QFrame::Panel</enum> <enum>QFrame::Panel</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -369,10 +289,50 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="PreferredImageCB"> <widget class="QCheckBox" name="useFwImageCB">
<property name="text">
<string>Use firmware start screen</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="useAnotherImageCB">
<property name="text">
<string>Use another start screen</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="useProfileImageCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -380,86 +340,14 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Use image in settings</string> <string>Use profile start screen</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="PatchFWCB">
<property name="text">
<string>Substitute image in firmware</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<spacer name="verticalSpacer_3"> <widget class="QCheckBox" name="useLibraryImageCB">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="ImageFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ImageLoadButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Load Image</string> <string>Use library start screen</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="libraryButton">
<property name="toolTip">
<string>Open Splash Library</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
@ -470,18 +358,37 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>BurnFlashButton</tabstop>
<tabstop>FWFileName</tabstop> <tabstop>FWFileName</tabstop>
<tabstop>FlashLoadButton</tabstop> <tabstop>FlashLoadButton</tabstop>
<tabstop>ImageFileName</tabstop> <tabstop>DateField</tabstop>
<tabstop>ImageLoadButton</tabstop> <tabstop>SVNField</tabstop>
<tabstop>libraryButton</tabstop> <tabstop>ModField</tabstop>
<tabstop>useProfileImageCB</tabstop>
<tabstop>useFwImageCB</tabstop>
<tabstop>useLibraryImageCB</tabstop>
<tabstop>useAnotherImageCB</tabstop>
<tabstop>EEbackupCB</tabstop> <tabstop>EEbackupCB</tabstop>
<tabstop>patchcalib_CB</tabstop>
<tabstop>patchhw_CB</tabstop>
<tabstop>EEpromCB</tabstop> <tabstop>EEpromCB</tabstop>
<tabstop>cancelButton</tabstop> <tabstop>cancelButton</tabstop>
<tabstop>BurnFlashButton</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="companion.qrc"/> <include location="companion.qrc"/>

View file

@ -45,12 +45,12 @@
#include <QString> #include <QString>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QSettings>
#include <QSplashScreen> #include <QSplashScreen>
#include <QThread> #include <QThread>
#include <iostream> #include <iostream>
#include "mainwindow.h" #include "mainwindow.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include "appdata.h"
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
#include <windows.h> #include <windows.h>
@ -86,46 +86,30 @@ int main(int argc, char *argv[])
app.setStyle(new MyProxyStyle); app.setStyle(new MyProxyStyle);
#endif #endif
// Start by borrowing any left over settings from companion9x
QSettings c9x_settings("companion9x", "companion9x");
QSettings settings;
if (!settings.contains("pos")) {
QStringList keys = c9x_settings.allKeys();
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++) {
settings.setValue(*i, c9x_settings.value(*i));
}
}
QString dir;
if (argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";
QString locale = settings.value("locale",QLocale::system().name()).toString();
bool showSplash = settings.value("show_splash", true).toBool();
QTranslator companionTranslator; QTranslator companionTranslator;
companionTranslator.load(":/companion_" + locale); companionTranslator.load(":/companion_" + g.locale());
QTranslator qtTranslator; QTranslator qtTranslator;
qtTranslator.load((QString)"qt_" + locale.left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); qtTranslator.load((QString)"qt_" + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&companionTranslator); app.installTranslator(&companionTranslator);
app.installTranslator(&qtTranslator); app.installTranslator(&qtTranslator);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString(); if (g.profile[g.id()].fwType().isEmpty()){
firmware_id.replace("open9x", "opentx"); g.profile[g.id()].fwType(default_firmware_variant.id);
firmware_id.replace("x9da", "taranis"); g.profile[g.id()].fwName("");
}
QPixmap pixmap = QPixmap(firmware_id.contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png"); QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap); QSplashScreen *splash = new QSplashScreen(pixmap);
RegisterFirmwares(); RegisterFirmwares();
settings.setValue("firmware", firmware_id); current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
current_firmware_variant = GetFirmwareVariant(firmware_id);
MainWindow *mainWin = new MainWindow(); MainWindow *mainWin = new MainWindow();
if (showSplash) { 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

@ -168,131 +168,57 @@
<file>images/library/00009.png</file> <file>images/library/00009.png</file>
<file>images/library/00010.png</file> <file>images/library/00010.png</file>
<file>images/library/00011.png</file> <file>images/library/00011.png</file>
<file>images/library/00012.png</file>
<file>images/library/00013.png</file> <file>images/library/00013.png</file>
<file>images/library/00014.png</file> <file>images/library/00014.png</file>
<file>images/library/00015.png</file> <file>images/library/00015.png</file>
<file>images/library/00016.png</file> <file>images/library/00016.png</file>
<file>images/library/01001.png</file> <file>images/library/00017.png</file>
<file>images/library/01002.png</file> <file>images/library/00018.png</file>
<file>images/library/01003.png</file> <file>images/library/00019.png</file>
<file>images/library/01004.png</file> <file>images/library/00020.png</file>
<file>images/library/01005.png</file> <file>images/library/00021.png</file>
<file>images/library/01006.png</file> <file>images/library/00022.png</file>
<file>images/library/01007.png</file> <file>images/library/00023.png</file>
<file>images/library/01008.png</file> <file>images/library/00024.png</file>
<file>images/library/00051.png</file>
<file>images/library/00100.png</file>
<file>images/library/00101.png</file>
<file>images/library/00102.png</file>
<file>images/library/00103.png</file>
<file>images/library/00104.png</file>
<file>images/library/00105.png</file>
<file>images/library/00106.png</file>
<file>images/library/00201.png</file>
<file>images/library/00202.png</file>
<file>images/library/00203.png</file>
<file>images/library/00204.png</file>
<file>images/library/00301.png</file>
<file>images/library/00302.png</file>
<file>images/library/00303.png</file>
<file>images/library/00304.png</file>
<file>images/library/00401.png</file>
<file>images/library/00402.png</file>
<file>images/library/00403.png</file>
<file>images/library/00404.png</file>
<file>images/library/00501.png</file>
<file>images/library/10001.png</file> <file>images/library/10001.png</file>
<file>images/library/10002.png</file> <file>images/library/10002.png</file>
<file>images/library/10003.png</file> <file>images/library/10003.png</file>
<file>images/library/10004.png</file>
<file>images/library/10005.png</file>
<file>images/library/10006.png</file>
<file>images/library/10007.png</file>
<file>images/library/10008.png</file>
<file>images/library/10009.png</file>
<file>images/library/10010.png</file>
<file>images/library/10011.png</file>
<file>images/library/10012.png</file>
<file>images/library/10013.png</file>
<file>images/library/10014.png</file>
<file>images/library/10015.png</file>
<file>images/library/10016.png</file>
<file>images/library/10017.png</file>
<file>images/library/10018.png</file>
<file>images/library/10019.png</file>
<file>images/library/10020.png</file>
<file>images/library/10021.png</file>
<file>images/library/10022.png</file>
<file>images/library/10023.png</file>
<file>images/library/10024.png</file>
<file>images/library/10033.png</file>
<file>images/library/10034.png</file>
<file>images/library/10035.png</file>
<file>images/library/10036.png</file>
<file>images/library/10049.png</file>
<file>images/library/10050.png</file>
<file>images/library/10051.png</file>
<file>images/library/10052.png</file>
<file>images/library/10037.png</file>
<file>images/library/10038.png</file>
<file>images/library/10039.png</file>
<file>images/library/10040.png</file>
<file>images/library/10053.png</file>
<file>images/library/10054.png</file>
<file>images/library/10055.png</file>
<file>images/library/10056.png</file>
<file>images/library/10025.png</file>
<file>images/library/10026.png</file>
<file>images/library/10027.png</file>
<file>images/library/10028.png</file>
<file>images/library/10029.png</file>
<file>images/library/10030.png</file>
<file>images/library/10031.png</file>
<file>images/library/10032.png</file>
<file>images/library/10041.png</file>
<file>images/library/10042.png</file>
<file>images/library/10043.png</file>
<file>images/library/10044.png</file>
<file>images/library/10057.png</file>
<file>images/library/10058.png</file>
<file>images/library/10059.png</file>
<file>images/library/10060.png</file>
<file>images/library/10045.png</file>
<file>images/library/10046.png</file>
<file>images/library/10047.png</file>
<file>images/library/10048.png</file>
<file>images/library/10061.png</file>
<file>images/library/10062.png</file>
<file>images/library/10063.png</file>
<file>images/library/10064.png</file>
<file>images/library/10065.png</file>
<file>images/library/10066.png</file>
<file>images/library/10067.png</file>
<file>images/library/10068.png</file>
<file>images/library/10081.png</file>
<file>images/library/10082.png</file>
<file>images/library/10083.png</file>
<file>images/library/10084.png</file>
<file>images/library/10069.png</file>
<file>images/library/10070.png</file>
<file>images/library/10071.png</file>
<file>images/library/10072.png</file>
<file>images/library/10085.png</file>
<file>images/library/10086.png</file>
<file>images/library/10087.png</file>
<file>images/library/10088.png</file>
<file>images/library/10073.png</file>
<file>images/library/10074.png</file>
<file>images/library/10075.png</file>
<file>images/library/10076.png</file>
<file>images/library/10089.png</file>
<file>images/library/10090.png</file>
<file>images/library/10091.png</file>
<file>images/library/10092.png</file>
<file>images/library/10077.png</file>
<file>images/library/10078.png</file>
<file>images/library/10079.png</file>
<file>images/library/10080.png</file>
<file>images/library/10093.png</file>
<file>images/library/10094.png</file>
<file>images/library/10095.png</file>
<file>images/library/10096.png</file>
<file>images/library/10097.png</file>
<file>images/library/10098.png</file>
<file>images/library/10099.png</file>
<file>images/library/10100.png</file>
<file>images/library/10101.png</file> <file>images/library/10101.png</file>
<file>images/library/10102.png</file> <file>images/library/10102.png</file>
<file>images/library/10103.png</file> <file>images/library/10103.png</file>
<file>images/library/10104.png</file> <file>images/library/10501.png</file>
<file>images/library/20001.png</file> <file>images/library/10502.png</file>
<file>images/library/20002.png</file> <file>images/library/10503.png</file>
<file>images/library/20003.png</file> <file>images/library/10504.png</file>
<file>images/library/20004.png</file> <file>images/library/10505.png</file>
<file>images/library/30001.png</file> <file>images/library/10506.png</file>
<file>images/library/30002.png</file> <file>images/library/10508.png</file>
<file>images/library/30003.png</file> <file>images/library/10601.png</file>
<file>images/library/30004.png</file> <file>images/library/10701.png</file>
<file>images/library/10702.png</file>
<file>images/library/10801.png</file>
<file>images/library/10802.png</file>
<file>themes/monochrome/16/paintbrush.png</file> <file>themes/monochrome/16/paintbrush.png</file>
<file>themes/monochrome/16/open.png</file> <file>themes/monochrome/16/open.png</file>
<file>themes/monochrome/16/edit.png</file> <file>themes/monochrome/16/edit.png</file>

View file

@ -2,6 +2,7 @@
#include "ui_customizesplashdialog.h" #include "ui_customizesplashdialog.h"
#include <QtGui> #include <QtGui>
#include "appdata.h"
#include "helpers.h" #include "helpers.h"
#include "burndialog.h" #include "burndialog.h"
#include "splashlibrary.h" #include "splashlibrary.h"
@ -13,11 +14,21 @@ Side::Side(){
imageLabel = 0; imageLabel = 0;
fileNameEdit = 0; fileNameEdit = 0;
saveButton = 0; saveButton = 0;
loadFwButton=0;
loadPictButton = 0;
loadProfileButton = 0;
saveToFileName = new QString(""); saveToFileName = new QString("");
source = new Source(UNDEFINED); source = new Source(UNDEFINED);
format = new LCDFormat(LCDTARANIS); format = new LCDFormat(LCDTARANIS);
} }
void Side::markSourceButton()
{
loadFwButton->setChecked(*source == FW ? true : false );
loadPictButton->setChecked(*source == PICT ? true : false );
loadProfileButton->setChecked(*source == PROFILE ? true : false );
}
void Side::copyImage( Side side ) void Side::copyImage( Side side )
{ {
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED)) if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
@ -28,66 +39,56 @@ bool Side::displayImage( QString fileName, Source pictSource )
{ {
QImage image; QImage image;
if (fileName.isEmpty()) { if (fileName.isEmpty())
return false; return false;
}
// Determine which picture format to use
if (pictSource == FW ){ if (pictSource == FW ){
FlashInterface flash(fileName); FlashInterface flash(fileName);
if (!flash.hasSplash()) if (!flash.hasSplash())
return false; return false;
else else
image = flash.getSplash(); image = flash.getSplash();
*format = (flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X); *format = (flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X);
} }
else { else {
image.load(fileName); image.load(fileName);
if (pictSource== PICT) if (pictSource== PICT)
*format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X; *format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X;
else if (pictSource == PROFILE)
*format = (g.profile[g.id()].fwType().contains("taranis")) ? LCDTARANIS : LCD9X;
} }
if (image.isNull()) { if (image.isNull()) {
return false; return false;
} }
// Load image
if (*format==LCDTARANIS) { if (*format==LCDTARANIS) {
image=image.convertToFormat(QImage::Format_RGB32); imageLabel->setPixmap( makePixMap( image, "taranis" ));
QRgb col; imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2);
int gray;
int width = image.width();
int height = image.height();
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2)));
} }
else else {
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Mono))); imageLabel->setPixmap( makePixMap( image, "9x" ));
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
if (*format == LCD9X) }
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
else
imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2);
switch (pictSource){ switch (pictSource){
case FW: case FW:
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName)); fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
*saveToFileName = fileName; *saveToFileName = fileName;
*source=FW; *source=FW;
break; break;
case PICT: case PICT:
fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName)); fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName));
*saveToFileName = fileName; *saveToFileName = fileName;
*source=PICT; *source=PICT;
break; break;
case PROFILE: case PROFILE:
fileNameEdit->setText(QObject::tr("Profile image")); fileNameEdit->setText(QObject::tr("Profile image"));
*saveToFileName = fileName; *saveToFileName = fileName;
*source=PROFILE; *source=PROFILE;
break; break;
default: default:
break; break;
} }
saveButton->setEnabled(true); saveButton->setEnabled(true);
libraryButton->setEnabled(true); libraryButton->setEnabled(true);
@ -102,8 +103,6 @@ bool Side::refreshImage()
bool Side::saveImage() bool Side::saveImage()
{ {
QSettings settings;
if (*source == FW ) if (*source == FW )
{ {
FlashInterface flash(*saveToFileName); FlashInterface flash(*saveToFileName);
@ -112,7 +111,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)) {
settings.setValue("lastFlashDir", QFileInfo(*saveToFileName).dir().absolutePath()); g.flashDir( QFileInfo(*saveToFileName).dir().absolutePath() );
} }
else { else {
return false; return false;
@ -121,7 +120,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)) {
settings.setValue("lastImagesDir", QFileInfo(*saveToFileName).dir().absolutePath()); g.imagesDir( QFileInfo(*saveToFileName).dir().absolutePath() );
} }
else { else {
return false; return false;
@ -157,8 +156,17 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
right.libraryButton = ui->rightLibraryButton; right.libraryButton = ui->rightLibraryButton;
left.invertButton = ui->leftInvertButton; left.invertButton = ui->leftInvertButton;
right.invertButton = ui->rightInvertButton; right.invertButton = ui->rightInvertButton;
left.loadFwButton = ui->leftLoadFwButton;
right.loadFwButton = ui->rightLoadFwButton;
left.loadPictButton = ui->leftLoadPictButton;
right.loadPictButton = ui->rightLoadPictButton;
left.loadProfileButton = ui->leftLoadProfileButton;
right.loadProfileButton = ui->rightLoadProfileButton;
loadProfile(left); loadProfile(left);
left.markSourceButton();
resize(0,0); resize(0,0);
} }
@ -179,14 +187,14 @@ 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)
{ {
QSettings settings; QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), 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("Can not load embedded image from firmware file %1.").arg(fileName));
else else
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); g.flashDir( QFileInfo(fileName).dir().absolutePath() );
} }
side.markSourceButton();
} }
void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);} void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);}
@ -197,29 +205,29 @@ void customizeSplashDialog::loadPicture(Side side)
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) { for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
} }
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this, QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), 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
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath()); g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
} }
side.markSourceButton();
} }
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);} 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)
{ {
QSettings settings; QString fileName=g.profile[g.id()].splashFile();
QString fileName=settings.value("SplashFileName","").toString();
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PROFILE )) if (!side.displayImage( fileName, PROFILE ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName)); QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
} }
side.markSourceButton();
} }
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);} void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}

View file

@ -22,6 +22,7 @@ class Side
{ {
public: public:
Side(); Side();
void markSourceButton();
void copyImage( Side ); void copyImage( Side );
bool displayImage( QString fileName, Source source ); bool displayImage( QString fileName, Source source );
bool saveImage(); bool saveImage();
@ -32,6 +33,9 @@ public:
QPushButton *saveButton; QPushButton *saveButton;
QPushButton *invertButton; QPushButton *invertButton;
QToolButton *libraryButton; QToolButton *libraryButton;
QPushButton *loadFwButton;
QPushButton *loadPictButton;
QPushButton *loadProfileButton;
QString *saveToFileName; QString *saveToFileName;

View file

@ -258,6 +258,9 @@
<property name="text"> <property name="text">
<string>Load Profile</string> <string>Load Profile</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -265,6 +268,9 @@
<property name="text"> <property name="text">
<string>Load FW</string> <string>Load FW</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -272,6 +278,9 @@
<property name="text"> <property name="text">
<string>Load Pict</string> <string>Load Pict</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -554,6 +563,9 @@
<property name="text"> <property name="text">
<string>Load Profile</string> <string>Load Profile</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -564,6 +576,9 @@
<property name="text"> <property name="text">
<string>Load FW</string> <string>Load FW</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -571,6 +586,9 @@
<property name="text"> <property name="text">
<string>Load Pict</string> <string>Load Pict</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>

View file

@ -6,7 +6,7 @@
#include "firmwares/gruvin9x/gruvin9xinterface.h" #include "firmwares/gruvin9x/gruvin9xinterface.h"
#include "firmwares/opentx/opentxinterface.h" #include "firmwares/opentx/opentxinterface.h"
#include "firmwares/ersky9x/ersky9xinterface.h" #include "firmwares/ersky9x/ersky9xinterface.h"
#include "qsettings.h" #include "appdata.h"
#include "helpers.h" #include "helpers.h"
QString EEPROMWarnings; QString EEPROMWarnings;
@ -772,34 +772,25 @@ GeneralSettings::GeneralSettings()
calibSpanNeg[i] = 0x180; calibSpanNeg[i] = 0x180;
calibSpanPos[i] = 0x180; calibSpanPos[i] = 0x180;
} }
QSettings settings; templateSetup = g.profile[g.id()].channelOrder();
templateSetup = settings.value("default_channel_order", 0).toInt(); stickMode = g.profile[g.id()].defaultMode();
stickMode = settings.value("default_mode", 1).toInt();
int profile_id = settings.value("profileId", 0).toInt(); QString t_calib=g.profile[g.id()].stickPotCalib();
if (profile_id>0) {
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profile_id);
settings.beginGroup(profile);
QString t_calib=settings.value("StickPotCalib","").toString();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
if (t_calib.isEmpty()) { if (t_calib.isEmpty()) {
settings.endGroup();
settings.endGroup();
return; return;
} else { } else {
QString t_trainercalib=settings.value("TrainerCalib","").toString(); QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)settings.value("VbatCalib", vBatCalib).toInt(); int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)settings.value("currentCalib", currentCalib).toInt(); int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", PPM_Multiplier).toInt(); int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)settings.value("GSStickMode", stickMode).toUInt(); uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)settings.value("vBatWarn",vBatWarn).toUInt(); uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
QString t_DisplaySet=settings.value("Display","").toString(); QString t_DisplaySet=g.profile[g.id()].display();
QString t_BeeperSet=settings.value("Beeper","").toString(); QString t_BeeperSet=g.profile[g.id()].beeper();
QString t_HapticSet=settings.value("Haptic","").toString(); QString t_HapticSet=g.profile[g.id()].haptic();
QString t_SpeakerSet=settings.value("Speaker","").toString(); QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=settings.value("countryCode","").toString(); QString t_CountrySet=g.profile[g.id()].countryCode();
settings.endGroup();
settings.endGroup();
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) { if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte; QString Byte;
@ -881,7 +872,7 @@ GeneralSettings::GeneralSettings()
} }
} }
} }
}
} }
ModelData::ModelData() ModelData::ModelData()
@ -1031,14 +1022,12 @@ ModelData ModelData::removeGlobalVars()
QList<EEPROMInterface *> eepromInterfaces; QList<EEPROMInterface *> eepromInterfaces;
void RegisterEepromInterfaces() void RegisterEepromInterfaces()
{ {
QSettings settings;
int rev4a = settings.value("rev4asupport",0).toInt();
eepromInterfaces.push_back(new OpenTxInterface(BOARD_STOCK)); eepromInterfaces.push_back(new OpenTxInterface(BOARD_STOCK));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_M128)); eepromInterfaces.push_back(new OpenTxInterface(BOARD_M128));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new OpenTxInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_SKY9X)); eepromInterfaces.push_back(new OpenTxInterface(BOARD_SKY9X));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS)); eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS));
if (rev4a) if (g.rev4aSupport())
eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS_REV4a)); eepromInterfaces.push_back(new OpenTxInterface(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

@ -74,7 +74,7 @@ const uint8_t modn12x3[4][4]= {
#define C9X_MAX_ENCODERS 2 #define C9X_MAX_ENCODERS 2
#define C9X_NUM_CHNOUT 32 // number of real output channels #define C9X_NUM_CHNOUT 32 // number of real output channels
#define C9X_NUM_CSW 32 // number of custom switches #define C9X_NUM_CSW 32 // number of custom switches
#define C9X_MAX_CUSTOM_FUNCTIONS 32 // number of functions assigned to switches #define C9X_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches
#define C9X_NUM_MODULES 2 #define C9X_NUM_MODULES 2
#define STK_RUD 1 #define STK_RUD 1
@ -859,7 +859,7 @@ class ModuleData {
void clear() { memset(this, 0, sizeof(ModuleData)); } void clear() { memset(this, 0, sizeof(ModuleData)); }
}; };
#define C9X_MAX_SCRIPTS 3 #define C9X_MAX_SCRIPTS 7
#define C9X_MAX_SCRIPT_INPUTS 10 #define C9X_MAX_SCRIPT_INPUTS 10
class ScriptData { class ScriptData {
public: public:

View file

@ -19,6 +19,7 @@
#include "er9xeeprom.h" #include "er9xeeprom.h"
#include "er9xsimulator.h" #include "er9xsimulator.h"
#include "file.h" #include "file.h"
#include "appdata.h"
#define FILE_TYP_GENERAL 1 #define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2 #define FILE_TYP_MODEL 2
@ -44,8 +45,7 @@ const char * Er9xInterface::getName()
const int Er9xInterface::getEEpromSize() const int Er9xInterface::getEEpromSize()
{ {
QSettings settings; QString avrMCU = g.mcu();
QString avrMCU = settings.value("mcu", QString("m64")).toString();
if (avrMCU==QString("m128")) { if (avrMCU==QString("m128")) {
return 2*EESIZE_STOCK; return 2*EESIZE_STOCK;
} }

View file

@ -18,6 +18,7 @@
#include "gruvin9xinterface.h" #include "gruvin9xinterface.h"
#include "gruvin9xeeprom.h" #include "gruvin9xeeprom.h"
#include "file.h" #include "file.h"
#include "appdata.h"
#define FILE_TYP_GENERAL 1 #define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2 #define FILE_TYP_MODEL 2
@ -47,8 +48,7 @@ const char * Gruvin9xInterface::getName()
const int Gruvin9xInterface::getEEpromSize() const int Gruvin9xInterface::getEEpromSize()
{ {
if (board == BOARD_STOCK) { if (board == BOARD_STOCK) {
QSettings settings; QString avrMCU = g.mcu();
QString avrMCU = settings.value("mcu", QString("m64")).toString();
if (avrMCU==QString("m128")) { if (avrMCU==QString("m128")) {
return EESIZE_STOCK*2; return EESIZE_STOCK*2;
} }

View file

@ -16,6 +16,7 @@
#include "opentxSky9xsimulator.h" #include "opentxSky9xsimulator.h"
#include "opentxinterface.h" #include "opentxinterface.h"
#include "appdata.h"
#define SIMU #define SIMU
#define SIMU_EXCEPTIONS #define SIMU_EXCEPTIONS
@ -135,8 +136,7 @@ using namespace Open9xSky9x;
Open9xSky9xSimulator::Open9xSky9xSimulator(OpenTxInterface * open9xInterface): Open9xSky9xSimulator::Open9xSky9xSimulator(OpenTxInterface * open9xInterface):
open9xInterface(open9xInterface) open9xInterface(open9xInterface)
{ {
QSettings settings; QString path=g.profile[g.id()].sdPath()+"/";
QString path=settings.value("sdPath", ".").toString()+"/";
int i=0; int i=0;
for (i=0; i< std::min(path.length(),1022); i++) { for (i=0; i< std::min(path.length(),1022); i++) {
simuSdDirectory[i]=path.at(i).toAscii(); simuSdDirectory[i]=path.at(i).toAscii();

View file

@ -16,6 +16,7 @@
#include "opentxTaranisSimulator.h" #include "opentxTaranisSimulator.h"
#include "opentxinterface.h" #include "opentxinterface.h"
#include "appdata.h"
#define SIMU #define SIMU
#define SIMU_EXCEPTIONS #define SIMU_EXCEPTIONS
@ -181,8 +182,7 @@ OpentxTaranisSimulator::OpentxTaranisSimulator(OpenTxInterface * open9xInterface
open9xInterface(open9xInterface) open9xInterface(open9xInterface)
{ {
taranisSimulatorBoard = GetEepromInterface()->getBoard(); taranisSimulatorBoard = GetEepromInterface()->getBoard();
QSettings settings; QString path=g.profile[g.id()].sdPath()+"/";
QString path=settings.value("sdPath", ".").toString()+"/";
int i=0; int i=0;
for (i=0; i< std::min(path.length(),1022); i++) { for (i=0; i< std::min(path.length(),1022); i++) {
simuSdDirectory[i]=path.at(i).toAscii(); simuSdDirectory[i]=path.at(i).toAscii();

View file

@ -20,7 +20,7 @@
#define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16) #define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16)
#define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14)) #define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14))
#define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 15 : 12)) #define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 15 : 12))
#define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 24 : 16)) #define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? (version >= 216 ? 64 : 32) : (IS_DBLEEPROM(board, version) ? 24 : 16))
#define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : O9X_MAX_CURVES) #define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : O9X_MAX_CURVES)
#define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5) #define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5)
@ -164,7 +164,7 @@ class SourcesConversionTable: public ConversionTable {
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<32; i++) for (int i=0; i<32; i++)
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++); addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
for (int i=0; i<3; i++) { for (int i=0; i<7; i++) {
for (int j=0; j<6; j++) { for (int j=0; j<6; j++) {
addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++); addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++);
} }
@ -896,7 +896,12 @@ class ExpoField: public TransformedField {
virtual void afterImport() virtual void afterImport()
{ {
expo.weight = smallGvarToC9x(_weight); if (IS_TARANIS(board) && version < 216) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
expo.weight = smallGvarToC9x(_weight);
if (!IS_TARANIS(board) || version < 216) { if (!IS_TARANIS(board) || version < 216) {
if (!_curveMode) if (!_curveMode)
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam)); expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
@ -1424,7 +1429,9 @@ class ArmCustomFunctionField: public TransformedField {
internalField.Append(new SwitchField<8>(fn.swtch, board, version)); internalField.Append(new SwitchField<8>(fn.swtch, board, version));
internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
if (IS_TARANIS(board)) if (IS_TARANIS(board) && version >= 216)
internalField.Append(new CharField<8>(_param, false));
else if (IS_TARANIS(board))
internalField.Append(new CharField<10>(_param, false)); internalField.Append(new CharField<10>(_param, false));
else else
internalField.Append(new CharField<6>(_param, false)); internalField.Append(new CharField<6>(_param, false));
@ -2203,7 +2210,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
} }
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<3; i++) { for (int i=0; i<7; i++) {
ScriptData & script = modelData.scriptData[i]; ScriptData & script = modelData.scriptData[i];
internalField.Append(new ZCharField<10>(script.filename)); internalField.Append(new ZCharField<10>(script.filename));
internalField.Append(new ZCharField<10>(script.name)); internalField.Append(new ZCharField<10>(script.name));

View file

@ -26,6 +26,7 @@
#include "opentxSky9xsimulator.h" #include "opentxSky9xsimulator.h"
#include "opentxTaranisSimulator.h" #include "opentxTaranisSimulator.h"
#include "file.h" #include "file.h"
#include "appdata.h"
#define FILE_TYP_GENERAL 1 #define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2 #define FILE_TYP_MODEL 2
@ -516,7 +517,7 @@ int OpenTxInterface::getCapability(const Capability capability)
return (IS_TARANIS(board) ? 22 : 9); return (IS_TARANIS(board) ? 22 : 9);
case CustomFunctions: case CustomFunctions:
if (IS_ARM(board)) if (IS_ARM(board))
return 32; return 64;
else if (board==BOARD_GRUVIN9X||board==BOARD_M128) else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
return 24; return 24;
else else
@ -549,7 +550,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case VoicesAsNumbers: case VoicesAsNumbers:
return (IS_ARM(board) ? 0 : 1); return (IS_ARM(board) ? 0 : 1);
case VoicesMaxLength: case VoicesMaxLength:
return (IS_ARM(board) ? (IS_TARANIS(board) ? 10 : 6) : 0); return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : 0);
case MultiLangVoice: case MultiLangVoice:
return (IS_ARM(board) ? 1 : 0); return (IS_ARM(board) ? 1 : 0);
case SoundPitch: case SoundPitch:
@ -934,9 +935,11 @@ bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esiz
QString geturl( int board) QString geturl( int board)
{ {
QSettings settings; QString url = g.compileServer();
QString url = settings.value("compilation-server", OPENTX_FIRMWARE_DOWNLOADS).toString(); if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
case BOARD_M128: case BOARD_M128:
@ -957,8 +960,11 @@ QString geturl( int board)
QString getstamp( int board) QString getstamp( int board)
{ {
QSettings settings; QString url = g.compileServer();
QString url = settings.value("compilation-server", OPENTX_FIRMWARE_DOWNLOADS).toString(); if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
url.append("/stamp-opentx-"); url.append("/stamp-opentx-");
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
@ -986,8 +992,11 @@ QString getstamp( int board)
QString getrnurl( int board) QString getrnurl( int board)
{ {
QSettings settings; QString url = g.compileServer();
QString url = settings.value("compilation-server", OPENTX_FIRMWARE_DOWNLOADS).toString(); if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url);
}
url.append("/releasenotes-"); url.append("/releasenotes-");
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
@ -1213,9 +1222,7 @@ void RegisterOpen9xFirmwares()
open9x->addOptions(fai_options); open9x->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(open9x);
QSettings settings; if (g.rev4aSupport()) {
int rev4a = settings.value("rev4asupport",0).toInt();
if (rev4a) {
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new OpenTxInterface(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 OpenTxInterface(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

@ -19,6 +19,7 @@
#include "th9xeeprom.h" #include "th9xeeprom.h"
#include "th9xsimulator.h" #include "th9xsimulator.h"
#include "file.h" #include "file.h"
#include "appdata.h"
#define FILE_TYP_GENERAL 1 #define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2 #define FILE_TYP_MODEL 2
@ -44,8 +45,7 @@ const char * Th9xInterface::getName()
const int Th9xInterface::getEEpromSize() const int Th9xInterface::getEEpromSize()
{ {
QSettings settings; QString avrMCU = g.mcu();
QString avrMCU = settings.value("mcu", QString("m64")).toString();
if (avrMCU==QString("m128")) { if (avrMCU==QString("m128")) {
return 2*EESIZE_STOCK; return 2*EESIZE_STOCK;
} }

View file

@ -3,6 +3,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include "helpers.h" #include "helpers.h"
#include "appdata.h"
#include <QDesktopServices> #include <QDesktopServices>
#include <QtGui> #include <QtGui>
@ -187,11 +188,8 @@ void fwPreferencesDialog::firmwareChanged()
ui->CPU_ID_LE->hide(); ui->CPU_ID_LE->hide();
ui->CPU_ID_LABEL->hide(); ui->CPU_ID_LABEL->hide();
} }
QSettings settings; int fwrev = g.fwRev.get(variant.id);
settings.beginGroup("FwRevisions"); if (fwrev != 0) {
int fwrev = settings.value(variant.id, -1).toInt();
settings.endGroup();
if (fwrev != -1) {
ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev)); ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev));
if (!stamp.isEmpty()) { if (!stamp.isEmpty()) {
ui->checkFWUpdates->show(); ui->checkFWUpdates->show();
@ -213,11 +211,9 @@ void fwPreferencesDialog::firmwareChanged()
void fwPreferencesDialog::writeValues() void fwPreferencesDialog::writeValues()
{ {
QSettings settings; g.cpuId( ui->CPU_ID_LE->text() );
settings.setValue("cpu_id", ui->CPU_ID_LE->text());
current_firmware_variant = getFirmwareVariant(); current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id); g.profile[g.id()].fwType( current_firmware_variant.id );
} }
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware) void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
@ -275,9 +271,7 @@ void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
void fwPreferencesDialog::initSettings() void fwPreferencesDialog::initSettings()
{ {
QSettings settings; ui->CPU_ID_LE->setText(g.cpuId());
ui->CPU_ID_LE->setText(settings.value("cpu_id", "").toString());
FirmwareInfo * current_firmware = GetCurrentFirmware(); FirmwareInfo * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) { foreach(FirmwareInfo * firmware, firmwares) {
@ -293,12 +287,10 @@ void fwPreferencesDialog::initSettings()
void fwPreferencesDialog::on_checkFWUpdates_clicked() void fwPreferencesDialog::on_checkFWUpdates_clicked()
{ {
QSettings settings;
FirmwareVariant variant = getFirmwareVariant(); FirmwareVariant variant = getFirmwareVariant();
if (settings.value("burnFirmware", true).toBool()) { if (g.profile[g.id()].burnFirmware()) {
current_firmware_variant = variant; current_firmware_variant = variant;
settings.setValue("firmware", variant.id); g.profile[g.id()].fwType( variant.id );
} }
MainWindow * mw = (MainWindow *)this->parent(); MainWindow * mw = (MainWindow *)this->parent();
mw->checkForUpdates(true, variant.id); mw->checkForUpdates(true, variant.id);
@ -307,14 +299,13 @@ void fwPreferencesDialog::on_checkFWUpdates_clicked()
void fwPreferencesDialog::on_fw_dnld_clicked() void fwPreferencesDialog::on_fw_dnld_clicked()
{ {
QSettings settings;
MainWindow * mw = (MainWindow *)this->parent(); MainWindow * mw = (MainWindow *)this->parent();
FirmwareVariant variant = getFirmwareVariant(); FirmwareVariant variant = getFirmwareVariant();
writeValues(); writeValues();
if (!variant.firmware->getUrl(variant.id).isNull()) { if (!variant.firmware->getUrl(variant.id).isNull()) {
if (settings.value("burnFirmware", true).toBool()) { if (g.profile[g.id()].burnFirmware()) {
current_firmware_variant = getFirmwareVariant(); current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id); g.profile[g.id()].fwType( current_firmware_variant.id );
} }
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id); mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id);
} }

View file

@ -1,9 +1,9 @@
#include "generaledit.h" #include "generaledit.h"
#include "ui_generaledit.h" #include "ui_generaledit.h"
#include "helpers.h" #include "helpers.h"
#include "appdata.h"
#include <QtGui> #include <QtGui>
#define MAX_PROFILES 10
#define BIT_WARN_THR ( 0x01 ) #define BIT_WARN_THR ( 0x01 )
#define BIT_WARN_SW ( 0x02 ) #define BIT_WARN_SW ( 0x02 )
#define BIT_WARN_MEM ( 0x04 ) #define BIT_WARN_MEM ( 0x04 )
@ -20,18 +20,12 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
this->setWindowIcon(CompanionIcon("open.png")); this->setWindowIcon(CompanionIcon("open.png"));
QSettings settings; QString firmware_id = g.profile[g.id()].fwType();
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString(); ui->tabWidget->setCurrentIndex( g.generalEditTab() );
ui->tabWidget->setCurrentIndex(settings.value("generalEditTab", 0).toInt()); QString name=g.profile[g.id()].name();
int profile_id=settings.value("profileId", 0).toInt();
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profile_id);
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
if (name.isEmpty()) { if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true); ui->calstore_PB->setDisabled(true);
} }
settings.endGroup();
EEPROMInterface *eepromInterface = GetEepromInterface(); EEPROMInterface *eepromInterface = GetEepromInterface();
QLabel * pmsl[] = {ui->ro_label,ui->ro1_label,ui->ro2_label,ui->ro3_label,ui->ro4_label,ui->ro5_label,ui->ro6_label,ui->ro7_label,ui->ro8_label, NULL}; QLabel * pmsl[] = {ui->ro_label,ui->ro1_label,ui->ro2_label,ui->ro3_label,ui->ro4_label,ui->ro5_label,ui->ro6_label,ui->ro7_label,ui->ro8_label, NULL};
QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL}; QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
@ -76,18 +70,14 @@ 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 profile=QString("profile%1").arg(i+1); QString name=g.profile[i].name();
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
if (!name.isEmpty()) { if (!name.isEmpty()) {
ui->profile_CB->addItem(name, i+1); ui->profile_CB->addItem(name, i);
if ((i+1)==profile_id) { if (i==g.id()) {
ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1); ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1);
} }
} }
settings.endGroup();
} }
settings.endGroup();
QRegExp rx(CHAR_FOR_NAMES_REGEX); QRegExp rx(CHAR_FOR_NAMES_REGEX);
ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this)); ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));
@ -970,9 +960,7 @@ void GeneralEdit::on_PPM4_editingFinished()
void GeneralEdit::on_tabWidget_currentChanged(int index) void GeneralEdit::on_tabWidget_currentChanged(int index)
{ {
// TODO why er9x here g.generalEditTab(index);
QSettings settings;
settings.setValue("generalEditTab",index);//ui->tabWidget->currentIndex());
} }
@ -1220,31 +1208,23 @@ void GeneralEdit::on_swGEAChkB_stateChanged(int )
void GeneralEdit::on_calretrieve_PB_clicked() void GeneralEdit::on_calretrieve_PB_clicked()
{ {
QSettings settings;
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
settings.beginGroup("Profiles"); QString calib=g.profile[profile_id].stickPotCalib();
QString profile=QString("profile%1").arg(profile_id);
settings.beginGroup(profile);
QString calib=settings.value("StickPotCalib","").toString();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetEepromInterface()->getCapability(Pots);
if (calib.isEmpty()) { if (calib.isEmpty()) {
settings.endGroup();
settings.endGroup();
return; return;
} else { } else {
QString trainercalib=settings.value("TrainerCalib","").toString(); QString trainercalib = g.profile[profile_id].trainerCalib();
int8_t vBatCalib=(int8_t)settings.value("VbatCalib", g_eeGeneral.vBatCalib).toInt(); int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib();
int8_t currentCalib=(int8_t)settings.value("currentCalib", g_eeGeneral.currentCalib).toInt(); int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib();
int8_t PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", g_eeGeneral.PPM_Multiplier).toInt(); int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
uint8_t GSStickMode=(uint8_t)settings.value("GSStickMode", g_eeGeneral.stickMode).toUInt(); uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode();
uint8_t vBatWarn=(uint8_t)settings.value("vBatWarn",g_eeGeneral.vBatWarn).toUInt(); uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn();
QString DisplaySet=settings.value("Display","").toString(); QString DisplaySet = g.profile[profile_id].display();
QString BeeperSet=settings.value("Beeper","").toString(); QString BeeperSet = g.profile[profile_id].beeper();
QString HapticSet=settings.value("Haptic","").toString(); QString HapticSet = g.profile[profile_id].haptic();
QString SpeakerSet=settings.value("Speaker","").toString(); QString SpeakerSet = g.profile[profile_id].speaker();
QString CountrySet=settings.value("countryCode","").toString(); QString CountrySet = g.profile[profile_id].countryCode();
settings.endGroup();
settings.endGroup();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
QString Byte; QString Byte;
@ -1337,27 +1317,20 @@ void GeneralEdit::on_calretrieve_PB_clicked()
void GeneralEdit::on_calstore_PB_clicked() void GeneralEdit::on_calstore_PB_clicked()
{ {
QSettings settings;
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profile_id); QString name=g.profile[profile_id].name();
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
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);
settings.endGroup();
settings.endGroup();
return; return;
} else { } else {
QString calib=settings.value("StickPotCalib","").toString(); 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) ,
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::No) { if (ret == QMessageBox::No) {
settings.endGroup();
settings.endGroup();
return; return;
} }
} }
@ -1367,24 +1340,22 @@ 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')));
} }
settings.setValue("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')));
} }
settings.setValue("TrainerCalib",calib); g.profile[profile_id].trainerCalib( calib );
settings.setValue("VbatCalib",g_eeGeneral.vBatCalib); g.profile[profile_id].vBatCalib( g_eeGeneral.vBatCalib );
settings.setValue("currentCalib",g_eeGeneral.currentCalib); g.profile[profile_id].currentCalib( g_eeGeneral.currentCalib );
settings.setValue("vBatWarn",g_eeGeneral.vBatWarn); g.profile[profile_id].vBatWarn( g_eeGeneral.vBatWarn );
settings.setValue("PPM_Multiplier",g_eeGeneral.PPM_Multiplier); g.profile[profile_id].ppmMultiplier( g_eeGeneral.PPM_Multiplier );
settings.setValue("GSStickMode",g_eeGeneral.stickMode); g.profile[profile_id].gsStickMode( g_eeGeneral.stickMode );
settings.setValue("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')) );
settings.setValue("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')));
settings.setValue("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')));
settings.setValue("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')));
settings.setValue("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));
settings.endGroup();
settings.endGroup();
QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved.")); QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
} }
} }

View file

@ -1,6 +1,8 @@
#include <QtGui> #include <QtGui>
#include "appdata.h"
#include "helpers.h" #include "helpers.h"
#include "simulatordialog.h" #include "simulatordialog.h"
#include "flashinterface.h"
QString getPhaseName(int val, char * phasename) QString getPhaseName(int val, char * phasename)
{ {
@ -693,6 +695,14 @@ QString image2qstring(QImage image)
return ImageStr; return ImageStr;
} }
// TODO KKERNEN 20140222
// I am sure that this code has had some kind of function, but now it only seems to cause
// problems. I think it is an attempt to open an image file from a double byte string which
// is first converted to a single byte string. Only used in burndialog.cpp
// It doesn't work for me in 2.0. I do not know why. I doubt it has ever worked for files or
// file paths containing non-english characters.
// Code can be removed ,when 2.0 is tested.
QImage qstring2image(QString imagestr) QImage qstring2image(QString imagestr)
{ {
bool ok; bool ok;
@ -875,8 +885,7 @@ QString getCenterBeep(ModelData * g_model)
QString getTheme() QString getTheme()
{ {
QSettings settings; int theme_set = g.theme();
int theme_set = settings.value("theme", 1).toInt();
QString Theme; QString Theme;
switch(theme_set) { switch(theme_set) {
case 0: case 0:
@ -938,3 +947,24 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
QObject::tr("Simulator for this firmware is not yet available")); QObject::tr("Simulator for this firmware is not yet available"));
} }
} }
QPixmap makePixMap( QImage image, QString firmwareType )
{
if (firmwareType.contains( "taranis" )) {
image = image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
for (int i = 0; i < image.width(); ++i) {
for (int j = 0; j < image.height(); ++j) {
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
image = image.scaled(SPLASHX9D_WIDTH, SPLASHX9D_HEIGHT);
}
else {
image = image.scaled(SPLASH_WIDTH, SPLASH_HEIGHT).convertToFormat(QImage::Format_Mono);
}
return(QPixmap::fromImage(image));
}

View file

@ -128,4 +128,6 @@ QString getFrSkySrc(int index);
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx); void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
QPixmap makePixMap( QImage image, QString firmwareType );
#endif // HELPERS_H #endif // HELPERS_H

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 7.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 209 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 209 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 209 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 209 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 209 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 353 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 546 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 872 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 929 B

After

Width:  |  Height:  |  Size: 929 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 720 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 590 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 563 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 612 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 889 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Some files were not shown because too many files have changed in this diff Show more