Merge branch 'next' of https://github.com/opentx/opentx into bsongis/spare_values_in_telemetry_and_functions
|
@ -325,3 +325,8 @@ Reginald H Millsom
|
|||
Emanuel Stassar
|
||||
Pierluigi Sommaruga
|
||||
Rafael Eric Suarez Nordlow
|
||||
A Harris
|
||||
Stefan Grunenberg
|
||||
Francisco Gutierrez Muñoz
|
||||
Steve Coley
|
||||
|
||||
|
|
|
@ -188,17 +188,17 @@ void CompStoreObj::getset( int &number, const QString tag, const int def, const
|
|||
}
|
||||
|
||||
// ** FwRevision class********************
|
||||
int FwRevision::get( const QString fwName )
|
||||
int FwRevision::get( const QString fwType )
|
||||
{
|
||||
QString result;
|
||||
retrieve( result, fwName, "", "FwRevisions" );
|
||||
retrieve( result, fwType, "", "FwRevisions" );
|
||||
return result.toInt();
|
||||
}
|
||||
|
||||
void FwRevision::set( const QString fwName, const int fwRevision )
|
||||
void FwRevision::set( const QString fwType, const int fwRevision )
|
||||
{
|
||||
QString tempString= QString("%1").arg(fwRevision);
|
||||
store( tempString, tempString, fwName, "FwRevisions" );
|
||||
store( tempString, tempString, fwType, "FwRevisions" );
|
||||
}
|
||||
|
||||
void FwRevision::remove( const QString tag )
|
||||
|
@ -280,41 +280,37 @@ void JStickData::flush()
|
|||
|
||||
// ** Profile class********************
|
||||
// Get declarations
|
||||
QString Profile::firmware() { return _firmware; }
|
||||
QString Profile::name() { return _name; }
|
||||
QString Profile::sdPath() { return _sdPath; }
|
||||
QString Profile::splashFile() { return _splashFile; }
|
||||
bool Profile::burnFirmware() { return _burnFirmware; }
|
||||
bool Profile::renameFwFiles() { return _renameFwFiles; }
|
||||
bool Profile::patchImage() { return _patchImage; }
|
||||
int Profile::channelOrder() { return _channelOrder; }
|
||||
int Profile::defaultMode() { return _defaultMode; }
|
||||
QString Profile::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() { return _beeper; }
|
||||
QString Profile::countryCode() { return _countryCode; }
|
||||
QString Profile::display() { return _display; }
|
||||
QString Profile::haptic() { return _haptic; }
|
||||
QString Profile::speaker() { return _speaker; }
|
||||
QString Profile::stickPotCalib() { return _stickPotCalib; }
|
||||
QString Profile::trainerCalib() { return _trainerCalib; }
|
||||
int Profile::currentCalib() { return _currentCalib; }
|
||||
int Profile::gsStickMode() { return _gsStickMode; }
|
||||
int Profile::ppmMultiplier() { return _ppmMultiplier; }
|
||||
int Profile::vBatCalib() { return _vBatCalib; }
|
||||
int Profile::vBatWarn() { return _vBatWarn; }
|
||||
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) { if (x.isEmpty()) // Name may never be empty!
|
||||
store("----", _name, "Name", "Profiles", QString("profile%1").arg(index));
|
||||
else
|
||||
store(x, _name, "Name", "Profiles", QString("profile%1").arg(index));}
|
||||
|
||||
void Profile::firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::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::patchImage (const bool x) { store(x, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));}
|
||||
|
||||
|
@ -337,6 +333,34 @@ 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
|
||||
|
@ -365,13 +389,13 @@ void Profile::init(int newIndex)
|
|||
{
|
||||
index = newIndex;
|
||||
|
||||
_firmware = "";
|
||||
_fwName = "";
|
||||
_fwType = "";
|
||||
_name = "";
|
||||
_sdPath = "";
|
||||
_splashFile = "";
|
||||
_burnFirmware = false;
|
||||
_renameFwFiles = false;
|
||||
_patchImage = false;
|
||||
_channelOrder = 0;
|
||||
_defaultMode = 1;
|
||||
|
||||
|
@ -399,13 +423,13 @@ void Profile::init(int newIndex)
|
|||
void Profile::flush()
|
||||
{
|
||||
// Load and store all variables. Use default values if setting values are missing
|
||||
getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _name, "Name" ,"----" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _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( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index));
|
||||
|
||||
|
@ -440,7 +464,6 @@ QString AppData::compileServer() { return _compileServer; }
|
|||
QString AppData::cpuId() { return _cpuId; }
|
||||
QString AppData::dfuArguments() { return _dfuArguments; }
|
||||
QString AppData::dfuLocation() { return _dfuLocation; }
|
||||
QString AppData::lastFw() { return _lastFw; }
|
||||
QString AppData::locale() { return _locale; }
|
||||
QString AppData::mcu() { return _mcu; }
|
||||
QString AppData::programmer() { return _programmer; }
|
||||
|
@ -495,7 +518,6 @@ void AppData::compileServer (const QString x) { store(x, _compileServer,
|
|||
void AppData::cpuId (const QString x) { store(x, _cpuId, "cpu_id" );}
|
||||
void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );}
|
||||
void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );}
|
||||
void AppData::lastFw (const QString x) { store(x, _lastFw, "lastFw" );}
|
||||
void AppData::locale (const QString x) { store(x, _locale, "locale" );}
|
||||
void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );}
|
||||
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
|
||||
|
@ -548,42 +570,56 @@ AppData::AppData()
|
|||
joystick[i].init( i );
|
||||
|
||||
// Import settings from companion9x, but only do it one time.
|
||||
// Use "location" tag as an indicator that the settings are missing
|
||||
QSettings c9x_settings("companion9x", "companion9x");
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!settings.contains("locale"))
|
||||
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));
|
||||
}
|
||||
// Convert firmware name
|
||||
QString firmware = settings.value("firmware", "").toString();
|
||||
firmware.replace("open9x","opentx");
|
||||
firmware.replace("x9da","taranis");
|
||||
|
||||
// Move Companion9x settings to profile0, the new default profile
|
||||
profile[0].firmware( firmware );
|
||||
// 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].patchImage( settings.value( "patchImage", false ).toBool());
|
||||
profile[0].channelOrder( settings.value( "default_channel_order", "0" ).toInt());
|
||||
profile[0].defaultMode( settings.value( "default_mode", "1" ).toInt());
|
||||
|
||||
// Delete unused settings
|
||||
settings.remove("firmware");
|
||||
settings.remove("Name");
|
||||
settings.remove("sdPath");
|
||||
settings.remove("SplashFileName");
|
||||
// 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("rename_firmware_files");
|
||||
settings.remove("patchImage");
|
||||
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
|
||||
|
@ -600,7 +636,6 @@ AppData::AppData()
|
|||
getset( _cpuId, "cpu_id" ,"" );
|
||||
getset( _dfuArguments, "dfu_arguments" ,"-a 0" );
|
||||
getset( _dfuLocation, "dfu_location" ,"" );
|
||||
getset( _lastFw, "lastFw" ,"" );
|
||||
getset( _locale, "locale" ,"" );
|
||||
getset( _mcu, "mcu" ,"m64" );
|
||||
getset( _programmer, "programmer" ,"usbasp" );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Companion Application Data Class Definition.
|
||||
// Companion Application Data Class Declaration.
|
||||
// Author Kjell Kernen
|
||||
|
||||
// All temporary and permanent global variables are defined here to make
|
||||
|
@ -92,13 +92,13 @@ class Profile: protected CompStoreObj
|
|||
int index;
|
||||
|
||||
// Application Variables
|
||||
QString _firmware;
|
||||
QString _fwName;
|
||||
QString _fwType;
|
||||
QString _name;
|
||||
QString _sdPath;
|
||||
QString _splashFile;
|
||||
bool _burnFirmware;
|
||||
bool _renameFwFiles;
|
||||
bool _patchImage;
|
||||
int _channelOrder;
|
||||
int _defaultMode;
|
||||
|
||||
|
@ -118,37 +118,37 @@ class Profile: protected CompStoreObj
|
|||
|
||||
public:
|
||||
// All the get definitions
|
||||
QString firmware();
|
||||
QString name();
|
||||
QString sdPath();
|
||||
QString splashFile();
|
||||
bool burnFirmware();
|
||||
bool renameFwFiles();
|
||||
bool patchImage();
|
||||
int channelOrder();
|
||||
int defaultMode();
|
||||
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();
|
||||
QString countryCode();
|
||||
QString display();
|
||||
QString haptic();
|
||||
QString speaker();
|
||||
QString stickPotCalib();
|
||||
QString trainerCalib();
|
||||
int currentCalib();
|
||||
int gsStickMode();
|
||||
int ppmMultiplier();
|
||||
int vBatCalib();
|
||||
int vBatWarn();
|
||||
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 firmware (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 patchImage (const bool);
|
||||
void channelOrder (const int);
|
||||
void defaultMode (const int);
|
||||
|
||||
|
@ -166,6 +166,7 @@ class Profile: protected CompStoreObj
|
|||
void vBatWarn (const int);
|
||||
|
||||
Profile();
|
||||
Profile& operator=(const Profile&);
|
||||
void remove();
|
||||
bool existsOnDisk();
|
||||
void init(int newIndex);
|
||||
|
@ -194,7 +195,6 @@ class AppData: protected CompStoreObj
|
|||
QString _cpuId;
|
||||
QString _dfuArguments;
|
||||
QString _dfuLocation;
|
||||
QString _lastFw;
|
||||
QString _locale;
|
||||
QString _mcu;
|
||||
QString _programmer;
|
||||
|
@ -286,7 +286,7 @@ class AppData: protected CompStoreObj
|
|||
int iconSize();
|
||||
int historySize();
|
||||
int jsCtrl();
|
||||
int modelEditTab();
|
||||
int modelEditTab(); // This variable is unused an can be removed
|
||||
int id();
|
||||
int theme();
|
||||
int warningId();
|
||||
|
|
|
@ -56,19 +56,26 @@ void appPreferencesDialog::writeValues()
|
|||
g.jsSupport(false);
|
||||
g.jsCtrl(0);
|
||||
}
|
||||
|
||||
g.id(ui->profileIndexLE->text().toInt());
|
||||
|
||||
g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex());
|
||||
g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex());
|
||||
g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked());
|
||||
g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked());
|
||||
g.profile[g.id()].name(ui->profileNameLE->text());
|
||||
g.profile[g.id()].sdPath(ui->sdPath->text());
|
||||
g.profile[g.id()].splashFile(ui->SplashFileName->text());
|
||||
g.profile[g.id()].firmware(ui->firmwareLE->text());
|
||||
|
||||
saveProfile();
|
||||
// The profile name may NEVER be empty
|
||||
if (ui->profileNameLE->text().isEmpty())
|
||||
g.profile[g.id()].name(tr("My Radio"));
|
||||
else
|
||||
g.profile[g.id()].name(ui->profileNameLE->text());
|
||||
|
||||
// If a new radio type has been choosen, several things need to change
|
||||
if ( initialRadioType != ui->radioCB->currentIndex())
|
||||
{
|
||||
g.profile[g.id()].fwName("");
|
||||
g.profile[g.id()].fwType(getDefaultFwType(ui->radioCB->currentIndex()));
|
||||
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_snapshotPathButton_clicked()
|
||||
|
@ -147,11 +154,12 @@ void appPreferencesDialog::initSettings()
|
|||
ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode());
|
||||
ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles());
|
||||
ui->sdPath->setText(g.profile[g.id()].sdPath());
|
||||
ui->profileIndexLE->setText(QString("%1").arg(g.id()));
|
||||
ui->profileNameLE->setText(g.profile[g.id()].name());
|
||||
ui->firmwareLE->setText(g.profile[g.id()].firmware());
|
||||
ui->SplashFileName->setText(g.profile[g.id()].splashFile());
|
||||
|
||||
initialRadioType = getRadioType(g.profile[g.id()].fwType());
|
||||
ui->radioCB->setCurrentIndex(initialRadioType);
|
||||
|
||||
displayImage( g.profile[g.id()].splashFile() );
|
||||
}
|
||||
|
||||
|
@ -239,22 +247,6 @@ void appPreferencesDialog::on_sdPathButton_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::saveProfile()
|
||||
{
|
||||
// The profile name may NEVER be empty
|
||||
if (ui->profileNameLE->text().isEmpty())
|
||||
ui->profileNameLE->setText("----");
|
||||
|
||||
g.profile[g.id()].name( ui->profileNameLE->text() );
|
||||
g.profile[g.id()].channelOrder( ui->channelorderCB->currentIndex());
|
||||
g.profile[g.id()].defaultMode( ui->stickmodeCB->currentIndex());
|
||||
g.profile[g.id()].burnFirmware( ui->burnFirmware->isChecked());
|
||||
g.profile[g.id()].renameFwFiles( ui->renameFirmware->isChecked());
|
||||
g.profile[g.id()].sdPath( ui->sdPath->text());
|
||||
g.profile[g.id()].splashFile( ui->SplashFileName->text());
|
||||
g.profile[g.id()].firmware( ui->firmwareLE->text());
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_removeProfileButton_clicked()
|
||||
{
|
||||
if ( g.id() == 0 )
|
||||
|
@ -267,6 +259,7 @@ void appPreferencesDialog::on_removeProfileButton_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool appPreferencesDialog::displayImage( QString fileName )
|
||||
{
|
||||
// Start by clearing the pixmap
|
||||
|
@ -278,31 +271,11 @@ bool appPreferencesDialog::displayImage( QString fileName )
|
|||
|
||||
// Use the firmware name to determine splash width
|
||||
int width = SPLASH_WIDTH;
|
||||
if (g.profile[g.id()].firmware().contains("taranis"))
|
||||
if (g.profile[g.id()].fwType().contains("taranis"))
|
||||
width = SPLASHX9D_WIDTH;
|
||||
|
||||
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);
|
||||
|
||||
ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType()));
|
||||
ui->imageLabel->setFixedSize(width, SPLASH_HEIGHT);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -331,3 +304,4 @@ void appPreferencesDialog::on_clearImageButton_clicked() {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ public:
|
|||
Joystick *joystick;
|
||||
|
||||
private:
|
||||
int initialRadioType;
|
||||
Ui::appPreferencesDialog *ui;
|
||||
void initSettings();
|
||||
bool displayImage( QString fileName );
|
||||
void saveProfile();
|
||||
void loadProfileString(QString profile, QString label);
|
||||
void loadFromProfile();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>685</width>
|
||||
<height>446</height>
|
||||
<height>462</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -124,12 +124,12 @@
|
|||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Include companion splashes</string>
|
||||
<string>Only show user splash images</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Only user defined splashes</string>
|
||||
<string>Show user and companion splash images</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
@ -490,10 +490,10 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="profileTab">
|
||||
<attribute name="title">
|
||||
<string>Radio Settings</string>
|
||||
<string>Radio Settings Profile</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="10" column="1" colspan="4">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="stickmodeCB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
@ -547,7 +547,7 @@ Mode 4:
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="4">
|
||||
<item row="12" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="channelorderCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
|
@ -697,13 +697,6 @@ This is used by the templated to determine which channel goes to what number out
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="5">
|
||||
<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">
|
||||
<property name="sizePolicy">
|
||||
|
@ -720,7 +713,7 @@ This is used by the templated to determine which channel goes to what number out
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Settings Profile</string>
|
||||
<string>Profile Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -766,7 +759,7 @@ This is used by the templated to determine which channel goes to what number out
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="4">
|
||||
<item row="13" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="renameFirmware">
|
||||
<property name="text">
|
||||
<string>Append version number to FW file name</string>
|
||||
|
@ -789,7 +782,7 @@ This is used by the templated to determine which channel goes to what number out
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="sdPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
|
@ -800,12 +793,18 @@ This is used by the templated to determine which channel goes to what number out
|
|||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<item row="2" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -818,88 +817,81 @@ This is used by the templated to determine which channel goes to what number out
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="14" column="1" colspan="4">
|
||||
<item row="14" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="burnFirmware">
|
||||
<property name="text">
|
||||
<string>Offer to write FW to Tx after download</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="6">
|
||||
<item row="14" column="5">
|
||||
<widget class="QPushButton" name="removeProfileButton">
|
||||
<property name="text">
|
||||
<string>Remove Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<item row="2" column="5">
|
||||
<widget class="QPushButton" name="sdPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="6">
|
||||
<item row="9" column="1" colspan="5">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="SplashFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>350</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="firmwareLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<item row="4" column="5">
|
||||
<widget class="QPushButton" name="SplashSelect">
|
||||
<property name="text">
|
||||
<string>Select Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="6">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Radio Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="5">
|
||||
<widget class="QPushButton" name="clearImageButton">
|
||||
<property name="text">
|
||||
<string>Clear Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLineEdit" name="profileIndexLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
<item row="3" column="1" colspan="5">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -907,10 +899,16 @@ This is used by the templated to determine which channel goes to what number out
|
|||
<widget class="QLineEdit" name="profileNameLE">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>350</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
|
@ -937,7 +935,10 @@ This is used by the templated to determine which channel goes to what number out
|
|||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
@ -947,6 +948,45 @@ This is used by the templated to determine which channel goes to what number out
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="radioCB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9X</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9X with m128</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9XR</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9XR with m128</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gruvin9x Board</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sky9x Board</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Taranis</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#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):
|
||||
QDialog(parent),
|
||||
ui(new Ui::burnDialog),
|
||||
|
@ -17,17 +18,25 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
hexType(Type)
|
||||
{
|
||||
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->FramFWInfo->hide();
|
||||
ui->EEbackupCB->hide();
|
||||
ui->EEbackupCB->setCheckState(*backup ? Qt::Checked : Qt::Unchecked);
|
||||
if (Type == 2) {
|
||||
if (Type == FLASH_FILE_TYPE ) {
|
||||
ui->EEpromCB->hide();
|
||||
ui->profile_label->hide();
|
||||
ui->patchcalib_CB->hide();
|
||||
ui->patchhw_CB->hide();
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
setWindowTitle(tr("Write firmware to TX"));
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEbackupCB->hide();
|
||||
|
@ -39,12 +48,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
ui->patchcalib_CB->hide();
|
||||
ui->patchhw_CB->hide();
|
||||
ui->EEpromCB->hide();
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->ImageFileName->clear();
|
||||
ui->FwImage->clear();
|
||||
ui->FWFileName->clear();
|
||||
ui->DateField->clear();
|
||||
ui->SVNField->clear();
|
||||
|
@ -63,7 +67,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
}
|
||||
if (!hexfileName->isEmpty()) {
|
||||
ui->FWFileName->setText(*hexfileName);
|
||||
if (Type==2) {
|
||||
if (Type==FLASH_FILE_TYPE) {
|
||||
checkFw(*hexfileName);
|
||||
}
|
||||
else {
|
||||
|
@ -104,14 +108,14 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
ui->FlashLoadButton->hide();
|
||||
hexfileName->clear();
|
||||
}
|
||||
else if (Type==2) {
|
||||
QString FileName;
|
||||
FileName = g.lastFw();
|
||||
else if (Type==FLASH_FILE_TYPE) {
|
||||
QString FileName = g.profile[g.id()].fwName();
|
||||
QFile file(FileName);
|
||||
if (file.exists()) {
|
||||
checkFw(FileName);
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
|
@ -124,12 +128,7 @@ void burnDialog::on_FlashLoadButton_clicked()
|
|||
{
|
||||
QString fileName;
|
||||
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->ImageFileName->clear();
|
||||
ui->FwImage->clear();
|
||||
ui->FWFileName->clear();
|
||||
ui->DateField->clear();
|
||||
ui->SVNField->clear();
|
||||
|
@ -139,8 +138,10 @@ void burnDialog::on_FlashLoadButton_clicked()
|
|||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->EEbackupCB->hide();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
if (hexType==2) {
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if (hexType==FLASH_FILE_TYPE) {
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if(fileName.isEmpty())
|
||||
return;
|
||||
checkFw(fileName);
|
||||
}
|
||||
else {
|
||||
|
@ -169,6 +170,7 @@ void burnDialog::on_FlashLoadButton_clicked()
|
|||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void burnDialog::checkFw(QString fileName)
|
||||
|
@ -176,6 +178,7 @@ void burnDialog::checkFw(QString fileName)
|
|||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEbackupCB->show();
|
||||
}
|
||||
|
@ -190,59 +193,17 @@ void burnDialog::checkFw(QString fileName)
|
|||
ui->DateField->setText(flash.getDate() + " " + flash.getTime());
|
||||
ui->SVNField->setText(flash.getSvn());
|
||||
ui->ModField->setText(flash.getBuild());
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
ui->BurnFlashButton->setText(tr("Write to TX"));
|
||||
|
||||
ui->SplashFrame->hide();
|
||||
if (flash.hasSplash()) {
|
||||
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->FwImage->show();
|
||||
ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
||||
QString ImageStr = g.profile[g.id()].splashFile();
|
||||
bool PatchFwCB = g.profile[g.id()].patchImage();
|
||||
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);
|
||||
QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->FwImage->hide();
|
||||
ui->ImageFileName->setText("");
|
||||
ui->SplashFrame->hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("%1 is not a known firmware").arg(fileName));
|
||||
ui->BurnFlashButton->setText(tr("Burn anyway !"));
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
}
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
|
@ -337,51 +298,92 @@ bool burnDialog::checkeEprom(QString fileName)
|
|||
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;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
if (!fileName.isEmpty()){
|
||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
return;
|
||||
QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName));
|
||||
}
|
||||
ui->ImageFileName->setText(fileName);
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
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{
|
||||
imageSource = ANOTHER;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
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;
|
||||
splashLibrary *ld = new splashLibrary(this,&fileName);
|
||||
|
@ -389,46 +391,23 @@ void burnDialog::on_libraryButton_clicked()
|
|||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
return;
|
||||
QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded"));
|
||||
}
|
||||
ui->ImageFileName->setText(fileName);
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
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{
|
||||
imageSource = LIBRARY;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
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()
|
||||
{
|
||||
if (hexType==2) {
|
||||
if (hexType==FLASH_FILE_TYPE) {
|
||||
QString fileName=ui->FWFileName->text();
|
||||
if (!fileName.isEmpty()) {
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
g.lastFw( fileName );
|
||||
if (ui->PatchFWCB->isChecked()) {
|
||||
g.profile[g.id()].patchImage( true );
|
||||
if (!ui->useFwImageCB->isChecked()) {
|
||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
|
||||
if (!image.isNull()) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
|
@ -451,7 +430,6 @@ void burnDialog::on_BurnFlashButton_clicked()
|
|||
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
|
||||
}
|
||||
} else {
|
||||
g.profile[g.id()].patchImage( false );
|
||||
hexfileName->clear();
|
||||
hexfileName->append(fileName);
|
||||
}
|
||||
|
@ -460,7 +438,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
|||
hexfileName->clear();
|
||||
}
|
||||
}
|
||||
if (hexType==1) {
|
||||
if (hexType==EEPROM_FILE_TYPE) {
|
||||
QString calib = g.profile[g.id()].stickPotCalib();
|
||||
QString trainercalib = g.profile[g.id()].trainerCalib();
|
||||
int potsnum=GetEepromInterface()->getCapability(Pots);
|
||||
|
@ -609,98 +587,9 @@ void burnDialog::on_cancelButton_clicked()
|
|||
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)
|
||||
{
|
||||
if (ui->EEpromCB->isChecked()) {
|
||||
*backup=true;
|
||||
} else {
|
||||
*backup=false;
|
||||
}
|
||||
}
|
||||
|
||||
void burnDialog::on_PreferredImageCB_toggled(bool checked)
|
||||
{
|
||||
QString tmpFileName;
|
||||
if (checked) {
|
||||
QString ImageStr = g.profile[g.id()].splashFile();
|
||||
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);
|
||||
}
|
||||
}
|
||||
*backup = ui->EEpromCB->isChecked();
|
||||
}
|
||||
|
||||
void burnDialog::shrink()
|
||||
|
@ -710,9 +599,5 @@ void burnDialog::shrink()
|
|||
|
||||
void burnDialog::on_EEbackupCB_clicked()
|
||||
{
|
||||
if (ui->EEbackupCB->isChecked()) {
|
||||
*backup=true;
|
||||
} else {
|
||||
*backup=false;
|
||||
}
|
||||
*backup = ui->EEbackupCB->isChecked();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
|
||||
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
|
||||
#define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE"
|
||||
#define EEPROM_FILE_TYPE 1
|
||||
#define FLASH_FILE_TYPE 2
|
||||
|
||||
|
||||
namespace Ui
|
||||
|
@ -36,18 +38,22 @@ public:
|
|||
|
||||
private slots:
|
||||
void on_FlashLoadButton_clicked();
|
||||
void on_ImageLoadButton_clicked();
|
||||
void on_libraryButton_clicked();
|
||||
void on_BurnFlashButton_clicked();
|
||||
void on_cancelButton_clicked();
|
||||
void on_InvertColorButton_clicked();
|
||||
void on_EEbackupCB_clicked();
|
||||
void on_PreferredImageCB_toggled(bool checked);
|
||||
void on_EEpromCB_toggled(bool checked);
|
||||
void checkFw(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();
|
||||
|
||||
|
||||
private:
|
||||
Ui::burnDialog *ui;
|
||||
QString * hexfileName;
|
||||
|
@ -55,6 +61,9 @@ private:
|
|||
int hexType;
|
||||
RadioData radioData;
|
||||
bool burnraw;
|
||||
enum ImageSource {FIRMWARE, PROFILE, LIBRARY, ANOTHER};
|
||||
ImageSource imageSource;
|
||||
QString imageFile;
|
||||
};
|
||||
|
||||
#endif // BURNDIALOG_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>440</width>
|
||||
<height>418</height>
|
||||
<height>423</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -30,21 +30,8 @@
|
|||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<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>
|
||||
<spacer name="hs2">
|
||||
<property name="orientation">
|
||||
|
@ -71,19 +58,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QPushButton" name="BurnFlashButton">
|
||||
<property name="enabled">
|
||||
|
@ -100,19 +74,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
|
@ -152,56 +113,22 @@
|
|||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="2" rowspan="3">
|
||||
<widget class="QLabel" name="FwImage">
|
||||
<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">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="SVNField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="buildLabel">
|
||||
<property name="text">
|
||||
<string>Date & Time</string>
|
||||
<string>Variant</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="SVNField">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="ModField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -214,17 +141,17 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="ModField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>Date & Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="buildLabel">
|
||||
<property name="text">
|
||||
<string>Variant</string>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="DateField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -325,17 +252,10 @@
|
|||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,1">
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="InvertColorButton">
|
||||
<property name="text">
|
||||
<string>Invert Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
|
||||
<item row="0" column="1" rowspan="7">
|
||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
|
@ -359,7 +279,7 @@
|
|||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
@ -369,10 +289,50 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
<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">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -380,108 +340,55 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use image in settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="PatchFWCB">
|
||||
<property name="text">
|
||||
<string>Substitute image in firmware</string>
|
||||
<string>Use profile start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<widget class="QCheckBox" name="useLibraryImageCB">
|
||||
<property name="text">
|
||||
<string>Use library start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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>13</height>
|
||||
<height>0</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">
|
||||
<string>Load Image</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>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>BurnFlashButton</tabstop>
|
||||
<tabstop>FWFileName</tabstop>
|
||||
<tabstop>FlashLoadButton</tabstop>
|
||||
<tabstop>ImageFileName</tabstop>
|
||||
<tabstop>ImageLoadButton</tabstop>
|
||||
<tabstop>libraryButton</tabstop>
|
||||
<tabstop>DateField</tabstop>
|
||||
<tabstop>SVNField</tabstop>
|
||||
<tabstop>ModField</tabstop>
|
||||
<tabstop>useProfileImageCB</tabstop>
|
||||
<tabstop>useFwImageCB</tabstop>
|
||||
<tabstop>useLibraryImageCB</tabstop>
|
||||
<tabstop>useAnotherImageCB</tabstop>
|
||||
<tabstop>EEbackupCB</tabstop>
|
||||
<tabstop>patchcalib_CB</tabstop>
|
||||
<tabstop>patchhw_CB</tabstop>
|
||||
<tabstop>EEpromCB</tabstop>
|
||||
<tabstop>cancelButton</tabstop>
|
||||
<tabstop>BurnFlashButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
|
|
|
@ -95,15 +95,18 @@ int main(int argc, char *argv[])
|
|||
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
if (g.profile[g.id()].firmware().isEmpty())
|
||||
g.profile[g.id()].firmware(default_firmware_variant.id);
|
||||
if (g.profile[g.id()].fwType().isEmpty()){
|
||||
g.profile[g.id()].fwType(default_firmware_variant.id);
|
||||
g.profile[g.id()].fwName("");
|
||||
}
|
||||
|
||||
QPixmap pixmap = QPixmap(g.profile[g.id()].firmware().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);
|
||||
|
||||
RegisterFirmwares();
|
||||
|
||||
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware());
|
||||
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
|
||||
|
||||
MainWindow *mainWin = new MainWindow();
|
||||
if (g.showSplash()) {
|
||||
|
|
|
@ -173,126 +173,65 @@
|
|||
<file>images/library/00014.png</file>
|
||||
<file>images/library/00015.png</file>
|
||||
<file>images/library/00016.png</file>
|
||||
<file>images/library/01001.png</file>
|
||||
<file>images/library/01002.png</file>
|
||||
<file>images/library/01003.png</file>
|
||||
<file>images/library/01004.png</file>
|
||||
<file>images/library/01005.png</file>
|
||||
<file>images/library/01006.png</file>
|
||||
<file>images/library/01007.png</file>
|
||||
<file>images/library/01008.png</file>
|
||||
<file>images/library/00017.png</file>
|
||||
<file>images/library/00018.png</file>
|
||||
<file>images/library/00019.png</file>
|
||||
<file>images/library/00020.png</file>
|
||||
<file>images/library/00050.png</file>
|
||||
<file>images/library/00051.png</file>
|
||||
<file>images/library/00052.png</file>
|
||||
<file>images/library/00053.png</file>
|
||||
<file>images/library/00054.png</file>
|
||||
<file>images/library/00055.png</file>
|
||||
<file>images/library/00056.png</file>
|
||||
<file>images/library/00057.png</file>
|
||||
<file>images/library/00058.png</file>
|
||||
<file>images/library/00059.png</file>
|
||||
<file>images/library/00060.png</file>
|
||||
<file>images/library/00061.png</file>
|
||||
<file>images/library/00062.png</file>
|
||||
<file>images/library/00063.png</file>
|
||||
<file>images/library/00064.png</file>
|
||||
<file>images/library/00065.png</file>
|
||||
<file>images/library/00066.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/10002.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/10102.png</file>
|
||||
<file>images/library/10103.png</file>
|
||||
<file>images/library/10104.png</file>
|
||||
<file>images/library/20001.png</file>
|
||||
<file>images/library/20002.png</file>
|
||||
<file>images/library/20003.png</file>
|
||||
<file>images/library/20004.png</file>
|
||||
<file>images/library/30001.png</file>
|
||||
<file>images/library/30002.png</file>
|
||||
<file>images/library/30003.png</file>
|
||||
<file>images/library/30004.png</file>
|
||||
<file>images/library/10501.png</file>
|
||||
<file>images/library/10502.png</file>
|
||||
<file>images/library/10503.png</file>
|
||||
<file>images/library/10504.png</file>
|
||||
<file>images/library/10505.png</file>
|
||||
<file>images/library/10506.png</file>
|
||||
<file>images/library/10508.png</file>
|
||||
<file>images/library/10601.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/open.png</file>
|
||||
<file>themes/monochrome/16/edit.png</file>
|
||||
|
|
|
@ -14,11 +14,21 @@ Side::Side(){
|
|||
imageLabel = 0;
|
||||
fileNameEdit = 0;
|
||||
saveButton = 0;
|
||||
loadFwButton=0;
|
||||
loadPictButton = 0;
|
||||
loadProfileButton = 0;
|
||||
saveToFileName = new QString("");
|
||||
source = new Source(UNDEFINED);
|
||||
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 )
|
||||
{
|
||||
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
|
||||
|
@ -46,34 +56,20 @@ bool Side::displayImage( QString fileName, Source pictSource )
|
|||
if (pictSource== PICT)
|
||||
*format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X;
|
||||
else if (pictSource == PROFILE)
|
||||
*format = (g.profile[g.id()].firmware().contains("taranis")) ? LCDTARANIS : LCD9X;
|
||||
*format = (g.profile[g.id()].fwType().contains("taranis")) ? LCDTARANIS : LCD9X;
|
||||
}
|
||||
if (image.isNull()) {
|
||||
return false;
|
||||
}
|
||||
// Prepare and display image
|
||||
// Load image
|
||||
if (*format==LCDTARANIS) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2)));
|
||||
}
|
||||
else
|
||||
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
|
||||
if (*format == LCD9X)
|
||||
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
|
||||
else
|
||||
imageLabel->setPixmap( makePixMap( image, "taranis" ));
|
||||
imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2);
|
||||
}
|
||||
else {
|
||||
imageLabel->setPixmap( makePixMap( image, "9x" ));
|
||||
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
|
||||
}
|
||||
|
||||
switch (pictSource){
|
||||
case FW:
|
||||
|
@ -161,7 +157,16 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
|||
left.invertButton = ui->leftInvertButton;
|
||||
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);
|
||||
left.markSourceButton();
|
||||
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
|
@ -182,13 +187,14 @@ void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);}
|
|||
void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);}
|
||||
void customizeSplashDialog::loadFirmware(Side side)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
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
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);}
|
||||
|
@ -208,6 +214,7 @@ void customizeSplashDialog::loadPicture(Side side)
|
|||
else
|
||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);}
|
||||
|
@ -220,6 +227,7 @@ void customizeSplashDialog::loadProfile(Side side)
|
|||
if (!side.displayImage( fileName, PROFILE ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
|
||||
|
|
|
@ -22,6 +22,7 @@ class Side
|
|||
{
|
||||
public:
|
||||
Side();
|
||||
void markSourceButton();
|
||||
void copyImage( Side );
|
||||
bool displayImage( QString fileName, Source source );
|
||||
bool saveImage();
|
||||
|
@ -32,6 +33,9 @@ public:
|
|||
QPushButton *saveButton;
|
||||
QPushButton *invertButton;
|
||||
QToolButton *libraryButton;
|
||||
QPushButton *loadFwButton;
|
||||
QPushButton *loadPictButton;
|
||||
QPushButton *loadProfileButton;
|
||||
|
||||
QString *saveToFileName;
|
||||
|
||||
|
|
|
@ -258,6 +258,9 @@
|
|||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -265,6 +268,9 @@
|
|||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -272,6 +278,9 @@
|
|||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -554,6 +563,9 @@
|
|||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -564,6 +576,9 @@
|
|||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -571,6 +586,9 @@
|
|||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -650,12 +650,14 @@ class ConversionField: public TransformedField {
|
|||
if (!error.isEmpty())
|
||||
EEPROMWarnings += error + "\n";
|
||||
}
|
||||
else if (shift) {
|
||||
|
||||
if (shift) {
|
||||
if (val < min) _field = min + shift;
|
||||
else if (val > max) _field = max + shift;
|
||||
else _field = val + shift;
|
||||
}
|
||||
else {
|
||||
|
||||
if (exportFunc) {
|
||||
_field = exportFunc(val);
|
||||
}
|
||||
}
|
||||
|
@ -666,10 +668,10 @@ class ConversionField: public TransformedField {
|
|||
if (table->importValue(_field, field))
|
||||
return;
|
||||
}
|
||||
else if (shift) {
|
||||
|
||||
field = _field - shift;
|
||||
}
|
||||
else {
|
||||
|
||||
if (importFunc) {
|
||||
field = importFunc(_field);
|
||||
}
|
||||
|
||||
|
|
|
@ -438,6 +438,8 @@ QString LogicalSwitchData::funcToString()
|
|||
case LS_FN_DAPOS:
|
||||
return QObject::tr("|d|>=x");
|
||||
case LS_FN_VEQUAL:
|
||||
return QObject::tr("a=x");
|
||||
case LS_FN_VALMOSTEQUAL:
|
||||
return QObject::tr("a~x");
|
||||
case LS_FN_TIMER:
|
||||
return QObject::tr("Timer");
|
||||
|
@ -549,9 +551,9 @@ QString LogicalSwitchData::toString(const ModelData & model)
|
|||
|
||||
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||
if (delay)
|
||||
result += QObject::tr(" Delay %1 sec").arg(delay/2.0);
|
||||
result += QObject::tr(" Delay %1 sec").arg(delay/10.0);
|
||||
if (duration)
|
||||
result += QObject::tr(" Duration %1 sec").arg(duration/2.0);
|
||||
result += QObject::tr(" Duration %1 sec").arg(duration/10.0);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -950,6 +952,7 @@ void ModelData::setDefault(uint8_t id)
|
|||
clear();
|
||||
used = true;
|
||||
sprintf(name, "MODEL%02d", id+1);
|
||||
modelId = id+1;
|
||||
}
|
||||
|
||||
int ModelData::getTrimValue(int phaseIdx, int trimIdx)
|
||||
|
@ -1058,7 +1061,7 @@ void RegisterFirmwares()
|
|||
RegisterEepromInterfaces();
|
||||
}
|
||||
|
||||
bool LoadEeprom(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
|
||||
{
|
||||
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
|
||||
if (eepromInterface->load(radioData, eeprom, size))
|
||||
|
|
|
@ -74,7 +74,7 @@ const uint8_t modn12x3[4][4]= {
|
|||
#define C9X_MAX_ENCODERS 2
|
||||
#define C9X_NUM_CHNOUT 32 // number of real output channels
|
||||
#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 STK_RUD 1
|
||||
|
@ -468,6 +468,9 @@ class GeneralSettings {
|
|||
int beepVolume;
|
||||
int wavVolume;
|
||||
int varioVolume;
|
||||
int varioPitch;
|
||||
int varioRange;
|
||||
int varioRepeat;
|
||||
int backgroundVolume;
|
||||
unsigned int mavbaud;
|
||||
unsigned int switchUnlockStates;
|
||||
|
@ -603,6 +606,7 @@ enum CSFunction {
|
|||
LS_FN_DPOS,
|
||||
LS_FN_DAPOS,
|
||||
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
LS_FN_VALMOSTEQUAL,
|
||||
LS_FN_TIMER,
|
||||
LS_FN_STICKY,
|
||||
LS_FN_STAY,
|
||||
|
@ -863,7 +867,7 @@ class ModuleData {
|
|||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
};
|
||||
|
||||
#define C9X_MAX_SCRIPTS 3
|
||||
#define C9X_MAX_SCRIPTS 7
|
||||
#define C9X_MAX_SCRIPT_INPUTS 10
|
||||
class ScriptData {
|
||||
public:
|
||||
|
@ -1085,7 +1089,7 @@ class EEPROMInterface
|
|||
|
||||
inline BoardEnum getBoard() { return board; }
|
||||
|
||||
virtual bool load(RadioData &radioData, uint8_t *eeprom, int size) = 0;
|
||||
virtual bool load(RadioData &radioData, const uint8_t *eeprom, int size) = 0;
|
||||
|
||||
virtual bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0;
|
||||
|
||||
|
@ -1214,7 +1218,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
|||
void RegisterFirmwares();
|
||||
|
||||
bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
|
||||
bool LoadEeprom(RadioData &radioData, uint8_t *eeprom, int size);
|
||||
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size);
|
||||
bool LoadEepromXml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
struct Option {
|
||||
|
|
|
@ -114,7 +114,7 @@ bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Er9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying er9x import... ";
|
||||
|
||||
|
@ -123,7 +123,7 @@ bool Er9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Er9xInterface : public EEPROMInterface
|
|||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t * eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Ersky9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying ersky9x import... ";
|
||||
|
||||
|
@ -160,7 +160,7 @@ bool Ersky9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_SKY9X)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Ersky9xInterface : public EEPROMInterface
|
|||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t * eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ bool Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
|||
}
|
||||
|
||||
|
||||
bool Gruvin9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import... ";
|
||||
|
||||
|
@ -108,7 +108,7 @@ bool Gruvin9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class Gruvin9xInterface : public EEPROMInterface
|
|||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t *eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#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_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_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5)
|
||||
|
||||
|
@ -164,7 +164,7 @@ class SourcesConversionTable: public ConversionTable {
|
|||
if (IS_TARANIS(board) && version >= 216) {
|
||||
for (int i=0; i<32; i++)
|
||||
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++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++);
|
||||
}
|
||||
|
@ -1167,8 +1167,10 @@ class LogicalSwitchesFunctionsTable: public ConversionTable {
|
|||
int val=0;
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
addConversion(LS_FN_OFF, val++);
|
||||
if (afterrelease21March2013)
|
||||
if (IS_ARM(board) && version >= 216)
|
||||
addConversion(LS_FN_VEQUAL, val++);
|
||||
if (afterrelease21March2013)
|
||||
addConversion(LS_FN_VALMOSTEQUAL, val++);
|
||||
addConversion(LS_FN_VPOS, val++);
|
||||
addConversion(LS_FN_VNEG, val++);
|
||||
if (IS_ARM(board) && version >= 216) val++; // later RANGE
|
||||
|
@ -1300,8 +1302,9 @@ class LogicalSwitchField: public TransformedField {
|
|||
|
||||
if (IS_ARM(board)) {
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(csw.func, &functionsConversionTable, "Function"));
|
||||
internalField.Append(new UnsignedField<8>(csw.delay));
|
||||
internalField.Append(new UnsignedField<8>(csw.duration));
|
||||
int scale = (version >= 216 ? 0 : 5);
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(csw.delay, 0, scale));
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(csw.duration, 0, scale));
|
||||
if (version >= 214) {
|
||||
internalField.Append(new ConversionField< SignedField<8> >((int &)csw.andsw, andswitchesConversionTable, "AND switch"));
|
||||
}
|
||||
|
@ -1364,6 +1367,49 @@ class LogicalSwitchField: public TransformedField {
|
|||
else if (csw.func != LS_FN_OFF) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
csw.val2 = v2;
|
||||
RawSource val1(csw.val1);
|
||||
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
|
||||
switch (val1.index) {
|
||||
case TELEMETRY_SOURCE_TIMER1:
|
||||
case TELEMETRY_SOURCE_TIMER2:
|
||||
csw.val2 = (csw.val2 + 128) * 3;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_ALT:
|
||||
case TELEMETRY_SOURCE_GPS_ALT:
|
||||
case TELEMETRY_SOURCE_ALT_MIN:
|
||||
case TELEMETRY_SOURCE_ALT_MAX:
|
||||
csw.val2 = (csw.val2 + 128) * 8 - 500;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_RPM:
|
||||
case TELEMETRY_SOURCE_RPM_MAX:
|
||||
csw.val2 = (csw.val2 + 128) * 50;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_T1:
|
||||
case TELEMETRY_SOURCE_T2:
|
||||
case TELEMETRY_SOURCE_T1_MAX:
|
||||
case TELEMETRY_SOURCE_T2_MAX:
|
||||
csw.val2 = (csw.val2 + 128) + 30;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_CELL:
|
||||
case TELEMETRY_SOURCE_HDG:
|
||||
csw.val2 = (csw.val2 + 128) * 2;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_DIST:
|
||||
case TELEMETRY_SOURCE_DIST_MAX:
|
||||
csw.val2 = (csw.val2 + 128) * 8;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_CURRENT:
|
||||
case TELEMETRY_SOURCE_POWER:
|
||||
csw.val2 = (csw.val2 + 128) * 5;
|
||||
break;
|
||||
case TELEMETRY_SOURCE_CONSUMPTION:
|
||||
csw.val2 = (csw.val2 + 128) * 20;
|
||||
break;
|
||||
default:
|
||||
csw.val2 += 128;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1542,7 +1588,9 @@ class ArmCustomFunctionField: public TransformedField {
|
|||
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")));
|
||||
|
||||
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));
|
||||
else
|
||||
internalField.Append(new CharField<6>(_param, false));
|
||||
|
@ -2283,7 +2331,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
|||
}
|
||||
|
||||
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];
|
||||
internalField.Append(new ZCharField<10>(script.filename));
|
||||
internalField.Append(new ZCharField<10>(script.name));
|
||||
|
@ -2450,6 +2498,11 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
|
|||
internalField.Append(new SignedField<8>(generalData.beepVolume));
|
||||
internalField.Append(new SignedField<8>(generalData.wavVolume));
|
||||
internalField.Append(new SignedField<8>(generalData.varioVolume));
|
||||
if (version >= 216) {
|
||||
internalField.Append(new SignedField<8>(generalData.varioPitch));
|
||||
internalField.Append(new SignedField<8>(generalData.varioRange));
|
||||
internalField.Append(new SignedField<8>(generalData.varioRepeat));
|
||||
}
|
||||
internalField.Append(new SignedField<8>(generalData.backgroundVolume));
|
||||
}
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
|
|
|
@ -290,7 +290,7 @@ bool OpenTxInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import...";
|
||||
|
||||
|
@ -305,7 +305,8 @@ bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
if (notnull) {
|
||||
std::cout << " wrong size (" << size << ")\n";
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(NULL, "companion", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"));
|
||||
size=2048;
|
||||
}
|
||||
|
@ -315,7 +316,7 @@ bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
}
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, board)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, board)) {
|
||||
std::cout << " wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
|
@ -517,7 +518,7 @@ int OpenTxInterface::getCapability(const Capability capability)
|
|||
return (IS_TARANIS(board) ? 22 : 9);
|
||||
case CustomFunctions:
|
||||
if (IS_ARM(board))
|
||||
return 32;
|
||||
return 64;
|
||||
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
||||
return 24;
|
||||
else
|
||||
|
@ -550,7 +551,7 @@ int OpenTxInterface::getCapability(const Capability capability)
|
|||
case VoicesAsNumbers:
|
||||
return (IS_ARM(board) ? 0 : 1);
|
||||
case VoicesMaxLength:
|
||||
return (IS_ARM(board) ? (IS_TARANIS(board) ? 10 : 6) : 0);
|
||||
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : 0);
|
||||
case MultiLangVoice:
|
||||
return (IS_ARM(board) ? 1 : 0);
|
||||
case SoundPitch:
|
||||
|
|
|
@ -37,7 +37,7 @@ class OpenTxInterface : public EEPROMInterface
|
|||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t *eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ bool Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Th9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying th9x import... ";
|
||||
|
||||
|
@ -71,7 +71,7 @@ bool Th9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Th9xInterface : public EEPROMInterface
|
|||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t *eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ void fwPreferencesDialog::writeValues()
|
|||
{
|
||||
g.cpuId( ui->CPU_ID_LE->text() );
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
g.profile[g.id()].firmware( current_firmware_variant.id );
|
||||
g.profile[g.id()].fwType( current_firmware_variant.id );
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
|
||||
|
@ -290,7 +290,7 @@ void fwPreferencesDialog::on_checkFWUpdates_clicked()
|
|||
FirmwareVariant variant = getFirmwareVariant();
|
||||
if (g.profile[g.id()].burnFirmware()) {
|
||||
current_firmware_variant = variant;
|
||||
g.profile[g.id()].firmware( variant.id );
|
||||
g.profile[g.id()].fwType( variant.id );
|
||||
}
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->checkForUpdates(true, variant.id);
|
||||
|
@ -305,7 +305,7 @@ void fwPreferencesDialog::on_fw_dnld_clicked()
|
|||
if (!variant.firmware->getUrl(variant.id).isNull()) {
|
||||
if (g.profile[g.id()].burnFirmware()) {
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
g.profile[g.id()].firmware( current_firmware_variant.id );
|
||||
g.profile[g.id()].fwType( current_firmware_variant.id );
|
||||
}
|
||||
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="3">
|
||||
<widget class="QComboBox" name="downloadVerCB"/>
|
||||
<widget class="QComboBox" name="downloadVerCB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QComboBox" name="langCombo">
|
||||
|
|
|
@ -20,7 +20,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("open.png"));
|
||||
|
||||
QString firmware_id = g.profile[g.id()].firmware();
|
||||
QString firmware_id = g.profile[g.id()].fwType();
|
||||
ui->tabWidget->setCurrentIndex( g.generalEditTab() );
|
||||
QString name=g.profile[g.id()].name();
|
||||
if (name.isEmpty()) {
|
||||
|
@ -74,7 +74,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||
if (!name.isEmpty()) {
|
||||
ui->profile_CB->addItem(name, i);
|
||||
if (i==g.id()) {
|
||||
ui->profile_CB->setCurrentIndex(ui->profile_CB->count());
|
||||
ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "simulatordialog.h"
|
||||
#include "flashinterface.h"
|
||||
|
||||
QString getPhaseName(int val, char * phasename)
|
||||
{
|
||||
|
@ -642,6 +643,7 @@ void populateCSWCB(QComboBox *b, int value)
|
|||
int order[] = {
|
||||
LS_FN_OFF,
|
||||
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
LS_FN_VALMOSTEQUAL, // added at the end to avoid everything renumbered
|
||||
LS_FN_VPOS,
|
||||
LS_FN_VNEG,
|
||||
// LS_FN_RANGE,
|
||||
|
@ -694,6 +696,14 @@ QString image2qstring(QImage image)
|
|||
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)
|
||||
{
|
||||
bool ok;
|
||||
|
@ -938,3 +948,48 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
|||
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));
|
||||
}
|
||||
|
||||
int getRadioType(QString firmwareType)
|
||||
{
|
||||
if (firmwareType.contains( "taranis" )) return 6;
|
||||
if (firmwareType.contains( "sky9x" )) return 5;
|
||||
if (firmwareType.contains( "gruvin9x")) return 4;
|
||||
if (firmwareType.contains( "9xr128" )) return 3;
|
||||
if (firmwareType.contains( "9xr" )) return 2;
|
||||
if (firmwareType.contains( "9x128" )) return 1;
|
||||
return 0; // 9x
|
||||
}
|
||||
|
||||
QString getDefaultFwType( int radioType )
|
||||
{
|
||||
switch (radioType){
|
||||
case 6: return "opentx-taranis-en";
|
||||
case 5: return "opentx-sky9x-en";
|
||||
case 4: return "opentx-gruvin9x-en";
|
||||
case 3: return "opentx-9xr128-en";
|
||||
case 2: return "opentx-9xr-en";
|
||||
case 1: return "opentx-9x128-en";
|
||||
default: return "opentx-9x-en";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,4 +128,13 @@ QString getFrSkySrc(int index);
|
|||
|
||||
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
|
||||
|
||||
// Format a pixmap to fit on the radio using a specific firmware
|
||||
QPixmap makePixMap( QImage image, QString firmwareType );
|
||||
|
||||
// Return a radio type derived from a firmware type string
|
||||
int getRadioType(QString firmwareType);
|
||||
|
||||
// Return the default firmware string for a specified radio
|
||||
QString getDefaultFwType( int radioType );
|
||||
|
||||
#endif // HELPERS_H
|
||||
|
|
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 831 B After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 451 B After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 209 B |
BIN
companion/src/images/library/00017.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
companion/src/images/library/00018.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
companion/src/images/library/00019.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
companion/src/images/library/00020.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
companion/src/images/library/00050.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
companion/src/images/library/00051.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
companion/src/images/library/00052.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
companion/src/images/library/00053.png
Normal file
After Width: | Height: | Size: 425 B |
BIN
companion/src/images/library/00054.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
companion/src/images/library/00055.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
companion/src/images/library/00056.png
Normal file
After Width: | Height: | Size: 603 B |
BIN
companion/src/images/library/00057.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
companion/src/images/library/00058.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
companion/src/images/library/00059.png
Normal file
After Width: | Height: | Size: 451 B |
BIN
companion/src/images/library/00060.png
Normal file
After Width: | Height: | Size: 764 B |
BIN
companion/src/images/library/00061.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
companion/src/images/library/00062.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
companion/src/images/library/00063.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
companion/src/images/library/00064.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
companion/src/images/library/00065.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
companion/src/images/library/00066.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
companion/src/images/library/00100.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
companion/src/images/library/00101.png
Normal file
After Width: | Height: | Size: 712 B |
BIN
companion/src/images/library/00102.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
companion/src/images/library/00103.png
Normal file
After Width: | Height: | Size: 609 B |
BIN
companion/src/images/library/00104.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
companion/src/images/library/00105.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
companion/src/images/library/00106.png
Normal file
After Width: | Height: | Size: 624 B |
BIN
companion/src/images/library/00201.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
Before Width: | Height: | Size: 872 B After Width: | Height: | Size: 872 B |
Before Width: | Height: | Size: 929 B After Width: | Height: | Size: 929 B |
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
BIN
companion/src/images/library/00304.png
Normal file
After Width: | Height: | Size: 865 B |
BIN
companion/src/images/library/00401.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
companion/src/images/library/00402.png
Normal file
After Width: | Height: | Size: 682 B |
BIN
companion/src/images/library/00403.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
companion/src/images/library/00404.png
Normal file
After Width: | Height: | Size: 887 B |
BIN
companion/src/images/library/00501.png
Normal file
After Width: | Height: | Size: 863 B |
Before Width: | Height: | Size: 911 B |
Before Width: | Height: | Size: 855 B |
Before Width: | Height: | Size: 840 B |
Before Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 840 B |
Before Width: | Height: | Size: 855 B |
Before Width: | Height: | Size: 911 B |
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 566 B After Width: | Height: | Size: 563 B |