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

Merge remote-tracking branch 'origin/next' into andreas/Issue020_ThrWarnPotsAndTransmitterFix_Merged

This commit is contained in:
openfsguruh 2014-02-11 17:10:18 +01:00
commit 45ba06c7b9
26 changed files with 2514 additions and 2057 deletions

View file

@ -155,7 +155,6 @@ SET( companion_SRCS
modelslist.cpp
mountlist.cpp
avroutputdialog.cpp
preferencesdialog.cpp
apppreferencesdialog.cpp
fwpreferencesdialog.cpp
burnconfigdialog.cpp
@ -178,7 +177,6 @@ SET( companion_SRCS
SET( companion_MOC_HDRS
avroutputdialog.h
preferencesdialog.h
apppreferencesdialog.h
fwpreferencesdialog.h
burnconfigdialog.h
@ -214,7 +212,6 @@ SET( companion_UIS
comparedialog.ui
fusesdialog.ui
logsdialog.ui
preferencesdialog.ui
apppreferencesdialog.ui
fwpreferencesdialog.ui
simulatordialog.ui

View file

@ -14,7 +14,7 @@ appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
ui(new Ui::appPreferencesDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("preferences.png"));
setWindowIcon(CompanionIcon("apppreferences.png"));
initSettings();
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
#ifndef JOYSTICKS
@ -56,8 +56,19 @@ void appPreferencesDialog::writeValues()
settings.remove("js_ctrl");
}
MainWindow * mw = (MainWindow *)this->parent();
mw->unloadProfile();
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
settings.setValue("profileId", ui->profileIndexLE->text());
settings.setValue("Name", ui->profileNameLE->text());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
if (!ui->SplashFileName->text().isEmpty())
settings.setValue("SplashImage", "");
settings.setValue("firmware", ui->firmwareLE->text());
saveProfile();
}
void appPreferencesDialog::on_snapshotPathButton_clicked()
@ -75,6 +86,7 @@ void appPreferencesDialog::initSettings()
{
QSettings settings;
ui->snapshotClipboardCKB->setChecked(settings.value("snapshot_to_clipboard", false).toBool());
ui->burnFirmware->setChecked(settings.value("burnFirmware", true).toBool());
QString Path=settings.value("snapshotPath", "").toString();
if (QDir(Path).exists()) {
@ -142,6 +154,26 @@ void appPreferencesDialog::initSettings()
ui->joystickcalButton->setDisabled(true);
}
#endif
// Profile Tab Inits
ui->channelorderCB->setCurrentIndex(settings.value("default_channel_order", 0).toInt());
ui->stickmodeCB->setCurrentIndex(settings.value("default_mode", 1).toInt());
ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool());
Path=settings.value("sdPath", "").toString();
if (QDir(Path).exists()) {
ui->sdPath->setText(Path);
}
ui->profileIndexLE->setText(settings.value("profileId", "").toString());
ui->profileNameLE->setText(settings.value("Name", "").toString());
QString fileName=settings.value("SplashFileName","").toString();
if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.exists()){
ui->SplashFileName->setText(fileName);
displayImage( fileName );
}
}
ui->firmwareLE->setText(settings.value("firmware","").toString());
}
void appPreferencesDialog::on_libraryPathButton_clicked()
@ -222,3 +254,142 @@ void appPreferencesDialog::on_joystickcalButton_clicked() {
}
#endif
// ******** Profile tab functions
void appPreferencesDialog::on_sdPathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), settings.value("sdPath").toString());
if (!fileName.isEmpty()) {
ui->sdPath->setText(fileName);
}
}
void appPreferencesDialog::saveProfile()
{
QSettings settings;
QString profile=QString("profile") + settings.value("profileId").toString();
QString name=ui->profileNameLE->text();
if (name.isEmpty()) {
name = profile;
ui->profileNameLE->setText(name);
}
settings.beginGroup("Profiles");
settings.beginGroup(profile);
settings.setValue("Name",name);
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
settings.setValue("firmware", ui->firmwareLE->text());
settings.endGroup();
settings.endGroup();
}
void appPreferencesDialog::loadProfileString(QString profile, QString label)
{
QSettings settings;
QString value;
settings.beginGroup("Profiles");
settings.beginGroup(profile);
value = settings.value(label).toString();
settings.endGroup();
settings.endGroup();
settings.setValue( label, value );
}
void appPreferencesDialog::loadProfile()
{
QSettings settings;
QString profile=QString("profile") + settings.value("profileId").toString();
loadProfileString( profile, "Name" );
loadProfileString( profile, "default_channel_order" );
loadProfileString( profile, "default_mode" );
loadProfileString( profile, "burnFirmware" );
loadProfileString( profile, "rename_firmware_files" );
loadProfileString( profile, "sdPath" );
loadProfileString( profile, "SplashFileName" );
loadProfileString( profile, "firmware" );
}
void appPreferencesDialog::on_removeProfileButton_clicked()
{
QSettings settings;
QString profileId = settings.value("profileId").toString();
if ( profileId == "1" )
QMessageBox::information(this, tr("Not possible to remove profile"), tr("The default profile can not be removed."));
else
{
QString profile=QString("profile") + profileId;
settings.beginGroup("Profiles");
settings.remove(profile);
settings.endGroup();
settings.setValue("profileId", "1");
loadProfile();
initSettings();
}
}
bool appPreferencesDialog::displayImage( QString fileName )
{
QImage image(fileName);
if (image.isNull())
{
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return false;
}
int width=ui->imageLabel->width();
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(width, 64)));
if (width==212) {
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)));
}
return true;
}
void appPreferencesDialog::on_SplashSelect_clicked()
{
QString supportedImageFormats;
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
}
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) {
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
if (displayImage(fileName))
ui->SplashFileName->setText(fileName);
}
}
void appPreferencesDialog::on_clearImageButton_clicked() {
ui->imageLabel->clear();
ui->SplashFileName->clear();
}

View file

@ -23,6 +23,10 @@ public:
private:
Ui::appPreferencesDialog *ui;
void initSettings();
bool displayImage( QString fileName );
void saveProfile();
void loadProfileString(QString profile, QString label);
void loadProfile();
private slots:
void writeValues();
@ -31,6 +35,12 @@ private slots:
void on_snapshotClipboardCKB_clicked();
void on_backupPathButton_clicked();
void on_ge_pathButton_clicked();
void on_sdPathButton_clicked();
void on_removeProfileButton_clicked();
void on_SplashSelect_clicked();
void on_clearImageButton_clicked();
#ifdef JOYSTICKS
void on_joystickChkB_clicked();
void on_joystickcalButton_clicked();

File diff suppressed because it is too large Load diff

View file

@ -7,19 +7,128 @@
#include "splashlibrary.h"
#include "flashinterface.h"
//*** Side Class ***
Side::Side(){
imageLabel = 0;
fileNameEdit = 0;
saveButton = 0;
source=new Source;
*source = UNDEFINED;
saveToFileName = new QString("");
source = new Source(UNDEFINED);
}
void Side::copyImage( Side side ){
void Side::copyImage( Side side )
{
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
imageLabel->setPixmap(*side.imageLabel->pixmap());
}
bool Side::displayImage( QString fileName, Source pictSource )
{
QImage image;
if (fileName.isEmpty()) {
return false;
}
if (pictSource == FW ){
FlashInterface flash(fileName);
if (!flash.hasSplash())
return false;
else
image = flash.getSplash();
}
else {
image.load(fileName);
}
if (image.isNull()) {
return false;
}
if (imageLabel->width()==424) {
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)));
}
switch (pictSource){
case FW:
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
*saveToFileName = fileName;
*source=FW;
break;
case PICT:
fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName));
*saveToFileName = fileName;
*source=PICT;
break;
case PROFILE:
fileNameEdit->setText(QObject::tr("Profile image"));
*saveToFileName = fileName;
*source=PROFILE;
break;
default:
break;
}
saveButton->setEnabled(true);
libraryButton->setEnabled(true);
invertButton->setEnabled(true);
return true;
}
bool Side::refreshImage()
{
return displayImage( *saveToFileName, *source );
}
bool Side::saveImage()
{
QSettings settings;
if (*source == FW )
{
FlashInterface flash(*saveToFileName);
if (!flash.hasSplash()) {
return false;
}
QImage image = imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
if (flash.setSplash(image) && (flash.saveFlash(*saveToFileName) > 0)) {
settings.setValue("lastFlashDir", QFileInfo(*saveToFileName).dir().absolutePath());
}
else {
return false;
}
}
else if (*source == PICT) {
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
if (image.save(*saveToFileName)) {
settings.setValue("lastImagesDir", QFileInfo(*saveToFileName).dir().absolutePath());
}
else {
return false;
}
}
else if (*source == PROFILE) {
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
if (!image.save(*saveToFileName)) {
return false;
}
}
return true;
}
//*** customizeSplashDialog Class ***
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::customizeSplashDialog)
@ -39,6 +148,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
left.invertButton = ui->leftInvertButton;
right.invertButton = ui->rightInvertButton;
loadProfile(left);
resize(0,0);
}
@ -62,25 +172,10 @@ void customizeSplashDialog::loadFirmware(Side side)
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
if (!fileName.isEmpty()) {
QFile file(fileName);
if (fileName.isEmpty() || !file.exists())
return;
FlashInterface flash(fileName);
if (!flash.hasSplash()) {
QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file"));
return;
}
side.saveButton->setEnabled(true);
side.imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
side.imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
side.fileNameEdit->setText(fileName);
if (!side.displayImage( fileName, FW ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load embedded FW image from %1.").arg(fileName));
else
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
*side.source=FW;
side.saveButton->setEnabled(true);
side.libraryButton->setEnabled(true);
side.invertButton->setEnabled(true);
}
}
@ -96,46 +191,25 @@ void customizeSplashDialog::loadPicture(Side side)
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
if (fileName.isEmpty()){
return;
}
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
if (side.imageLabel->width()==424) {
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));
}
}
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
} else {
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
}
if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PICT ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load the image file %1.").arg(fileName));
else
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
side.fileNameEdit->setText(fileName);
*side.source=PICT;
side.saveButton->setEnabled(true);
side.libraryButton->setEnabled(true);
side.invertButton->setEnabled(true);
}
}
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);}
void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);}
void customizeSplashDialog::loadProfile(Side side)
{
QSettings settings;
QString fileName=settings.value("SplashFileName","").toString();
if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PROFILE ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
}
}
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
@ -143,67 +217,26 @@ void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicke
void customizeSplashDialog::libraryButton_clicked( Side side )
{
QString fileName;
splashLibrary *ld = new splashLibrary(this,&fileName);
ld->exec();
if (!fileName.isEmpty()) {
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
if (side.imageLabel->width()==424) {
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));
}
}
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
} else {
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
}
if (!side.displayImage( fileName, UNDEFINED ))
QMessageBox::critical(this, tr("Error"), tr("Cannot load the library image %1.").arg(fileName));
}
}
void customizeSplashDialog::on_leftSaveButton_clicked(){saveButton_clicked(left);}
void customizeSplashDialog::on_rightSaveButton_clicked(){saveButton_clicked(right);}
void customizeSplashDialog::saveButton_clicked(Side side)
void customizeSplashDialog::saveButton_clicked( Side side )
{
QSettings settings;
QString fileName = side.fileNameEdit->text();
if (*side.source == FW)
{
FlashInterface flash(fileName);
if (!flash.hasSplash()) {
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
return;
if (side.saveImage()){
QMessageBox::information(this, tr("File Saved"), tr("The image was saved to the file %1").arg(*side.saveToFileName));
if ( !side.refreshImage()){
QMessageBox::critical(this, tr("Image Refresh Error"), tr("Failed to refresh image from file %1").arg(*side.saveToFileName));
}
}
QImage image = side.imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
if (flash.setSplash(image) && (flash.saveFlash(fileName) > 0))
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
else
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
}
else if (*side.source == PICT)
{
if (!fileName.isEmpty()) {
QImage image = side.imageLabel->pixmap()->toImage().scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
if (image.save(fileName))
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
else
QMessageBox::critical(this, tr("Error"), tr("The image file %1 could not be stored").arg(fileName));
}
}
QMessageBox::critical(this, tr("File Save Error"), tr("Failed to write image to %1").arg(*side.saveToFileName));
}
void customizeSplashDialog::on_leftInvertButton_clicked(){invertButton_clicked(left);}

View file

@ -17,6 +17,9 @@ class Side
public:
Side();
void copyImage( Side );
bool displayImage( QString fileName, Source source );
bool saveImage();
bool refreshImage();
QLabel *imageLabel;
QLineEdit *fileNameEdit;
@ -24,6 +27,9 @@ public:
QPushButton *invertButton;
QToolButton *libraryButton;
QString *saveToFileName;
private:
Source *source;
};

View file

@ -254,6 +254,16 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="leftLoadProfileButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Load Profile</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="leftLoadFwButton">
<property name="text">
@ -268,16 +278,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="leftLoadProfileButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load Profile</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@ -550,6 +550,16 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="rightLoadProfileButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Load Profile</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="rightLoadFwButton">
<property name="enabled">
@ -567,16 +577,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="rightLoadProfileButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load Profile</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
@ -625,12 +625,17 @@
<tabstops>
<tabstop>leftFileNameEdit</tabstop>
<tabstop>leftInvertButton</tabstop>
<tabstop>leftLibraryButton</tabstop>
<tabstop>leftLoadProfileButton</tabstop>
<tabstop>leftLoadFwButton</tabstop>
<tabstop>leftLoadPictButton</tabstop>
<tabstop>leftSaveButton</tabstop>
<tabstop>copyLeftToRightButton</tabstop>
<tabstop>copyRightToLeftButton</tabstop>
<tabstop>rightFileNameEdit</tabstop>
<tabstop>rightInvertButton</tabstop>
<tabstop>rightLibraryButton</tabstop>
<tabstop>rightLoadProfileButton</tabstop>
<tabstop>rightLoadFwButton</tabstop>
<tabstop>rightLoadPictButton</tabstop>
<tabstop>rightSaveButton</tabstop>

View file

@ -734,7 +734,7 @@ GeneralSettings::GeneralSettings()
QSettings settings;
templateSetup = settings.value("default_channel_order", 0).toInt();
stickMode = settings.value("default_mode", 1).toInt();
int profile_id = settings.value("ActiveProfile", 0).toInt();
int profile_id = settings.value("profileId", 0).toInt();
if (profile_id>0) {
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profile_id);

View file

@ -12,7 +12,7 @@ fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
updateLock(false)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("preferences.png"));
setWindowIcon(CompanionIcon("fwpreferences.png"));
QCheckBox * OptionCheckBox[]= {
ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7,
@ -38,7 +38,7 @@ fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
resize(0,0);
shrink();
}
@ -47,32 +47,43 @@ fwPreferencesDialog::~fwPreferencesDialog()
delete ui;
}
void fwPreferencesDialog::showVoice(bool show)
{
if (show)
showVoice();
else
hideVoice();
}
void fwPreferencesDialog::showVoice()
{
ui->voiceLine->show();
ui->voiceLabel->show();
ui->voiceCombo->show();
ui->voice_dnld->show();
}
void fwPreferencesDialog::hideVoice()
{
ui->voiceLine->hide();
ui->voiceLabel->hide();
ui->voiceCombo->hide();
ui->voice_dnld->hide();
QTimer::singleShot(0, this, SLOT(shrink()));
}
void fwPreferencesDialog::shrink()
{
resize(0,0);
}
void fwPreferencesDialog::baseFirmwareChanged()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL;
foreach(FirmwareInfo * firmware, firmwares) {
if (firmware->id == selected_firmware) {
if (firmware->voice) {
ui->voiceLabel->show();
ui->voiceCombo->show();
ui->voice_dnld->show();
ui->sdPathButton->show();
ui->sdPath->show();
ui->sdPathLabel->show();
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
} else {
ui->voiceLabel->hide();
ui->voiceCombo->hide();
ui->voice_dnld->hide();
ui->sdPathButton->hide();
ui->sdPath->hide();
ui->sdPathLabel->hide();
}
showVoice(firmware->voice);
populateFirmwareOptions(firmware);
break;
}
@ -109,11 +120,6 @@ FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
return default_firmware_variant;
}
void fwPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void fwPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
@ -134,19 +140,7 @@ void fwPreferencesDialog::firmwareOptionChanged(bool state)
}
}
if (voice) {
if (voice->isChecked()) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
} else {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setDisabled(true);
ui->sdPath->setDisabled(true);
}
showVoice(voice->isChecked());
}
return firmwareChanged();
@ -157,37 +151,24 @@ void fwPreferencesDialog::firmwareOptionChanged(bool state)
}
} else if (cb && !state) {
if (cb->text()=="voice") {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
hideVoice();
}
}
if (voice ) {
if (voice->isChecked()) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
} else {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setDisabled(true);
ui->sdPath->setDisabled(true);
}
if (voice) {
showVoice(voice->isChecked());
} else if (firmware) {
if (firmware->voice) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
showVoice();
}
}
return firmwareChanged();
}
void fwPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void fwPreferencesDialog::firmwareChanged()
{
if (updateLock)
@ -233,21 +214,10 @@ void fwPreferencesDialog::firmwareChanged()
void fwPreferencesDialog::writeValues()
{
QSettings settings;
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("cpu_id", ui->CPU_ID_LE->text());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id);
settings.setValue("profileId", ui->ProfSlot_SB->value());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
if (!ui->SplashFileName->text().isEmpty())
settings.setValue("SplashImage", "");
MainWindow * mw = (MainWindow *)this->parent();
mw->unloadProfile();
}
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
@ -269,14 +239,7 @@ void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
if (ui->langCombo->count()) {
ui->langCombo->show();
ui->langLabel->show();
}
else {
ui->langCombo->hide();
ui->langLabel->hide();
}
showVoice(ui->langCombo->count()!=0);
int index = 0;
foreach(QList<Option> opts, parent->opts) {
@ -294,25 +257,7 @@ void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
if (opt.name==QString("voice")) {
voice=cb;
ui->voiceLabel->show();
ui->voiceCombo->show();
ui->voice_dnld->show();
ui->sdPathButton->show();
ui->sdPath->show();
ui->sdPathLabel->show();
if (current_firmware_variant.id.contains(opt.name) ||firmware->voice) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
} else {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setDisabled(true);
ui->sdPath->setDisabled(true);
}
showVoice(current_firmware_variant.id.contains(opt.name) ||firmware->voice);
}
}
}
@ -331,16 +276,8 @@ void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
void fwPreferencesDialog::initSettings()
{
QSettings settings;
ui->channelorderCB->setCurrentIndex(settings.value("default_channel_order", 0).toInt());
ui->stickmodeCB->setCurrentIndex(settings.value("default_mode", 1).toInt());
ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool());
ui->burnFirmware->setChecked(settings.value("burnFirmware", true).toBool());
ui->CPU_ID_LE->setText(settings.value("cpu_id", "").toString());
QString Path=settings.value("sdPath", "").toString();
if (QDir(Path).exists()) {
ui->sdPath->setText(Path);
}
ui->CPU_ID_LE->setText(settings.value("cpu_id", "").toString());
FirmwareInfo * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) {
@ -351,27 +288,31 @@ void fwPreferencesDialog::initSettings()
}
baseFirmwareChanged();
firmwareChanged();
}
ui->ProfSlot_SB->setValue(settings.value("profileId", 1).toInt());
on_ProfSlot_SB_valueChanged();
QString fileName=settings.value("SplashFileName","").toString();
if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.exists()){
ui->SplashFileName->setText(fileName);
}
void fwPreferencesDialog::on_checkFWUpdates_clicked()
{
QSettings settings;
FirmwareVariant variant = getFirmwareVariant();
if (settings.value("burnFirmware", true).toBool()) {
current_firmware_variant = variant;
settings.setValue("firmware", variant.id);
}
MainWindow * mw = (MainWindow *)this->parent();
mw->checkForUpdates(true, variant.id);
firmwareChanged();
}
void fwPreferencesDialog::on_fw_dnld_clicked()
{
QSettings settings;
MainWindow * mw = (MainWindow *)this->parent();
FirmwareVariant variant = getFirmwareVariant();
writeValues();
if (!variant.firmware->getUrl(variant.id).isNull()) {
if (ui->burnFirmware->isChecked()) {
QSettings settings;
if (settings.value("burnFirmware", true).toBool()) {
current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id);
}
@ -382,126 +323,10 @@ void fwPreferencesDialog::on_fw_dnld_clicked()
void fwPreferencesDialog::on_voice_dnld_clicked()
{
ui->ProfSave_PB->setEnabled(true);
QString url="http://fw.opentx.it/voices/";
FirmwareVariant variant = getFirmwareVariant();
url.append(QString("%1/%2/").arg(variant.firmware->id).arg(ui->voiceCombo->currentText()));
QDesktopServices::openUrl(url);
}
void fwPreferencesDialog::on_sdPathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), settings.value("sdPath").toString());
if (!fileName.isEmpty()) {
ui->sdPath->setText(fileName);
}
ui->ProfSave_PB->setEnabled(true);
}
void fwPreferencesDialog::on_ProfSlot_SB_valueChanged()
{
QSettings settings;
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
ui->ProfName_LE->setText(name);
/* if (!(name.isEmpty())) {
QString firmwarename=settings.value("firmware", default_firmware_id).toString();
FirmwareInfo * fw = getFirmware(firmwarename);
int i=0;
foreach(FirmwareInfo * firmware, firmwares) {
if (fw == firmware) {
qDebug() << fw->id;
qDebug() << firmware->id;
qDebug() << i;
ui->downloadVerCB->setCurrentIndex(i);
break;
}
i++;
}
baseFirmwareChanged();
populateFirmwareOptions(fw);
}*/
settings.endGroup();
settings.endGroup();
}
void fwPreferencesDialog::on_ProfSave_PB_clicked()
{
QSettings settings;
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
QString name=ui->ProfName_LE->text();
if (name.isEmpty()) {
int ret = QMessageBox::question(this, "Companion",
tr("Profile name is empty, profile slot %1 will be deleted.<br>Are you sure ?").arg(ui->ProfSlot_SB->value()) ,
QMessageBox::Yes | QMessageBox::No);
if (ret==QMessageBox::Yes) {
settings.remove(profile);
} else {
settings.beginGroup(profile);
ui->ProfName_LE->setText(settings.value("Name","").toString());
}
} else {
settings.beginGroup(profile);
settings.setValue("Name",name);
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id);
settings.endGroup();
settings.endGroup();
}
}
void fwPreferencesDialog::on_SplashSelect_clicked()
{
QString supportedImageFormats;
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
}
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) {
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
ui->SplashFileName->setText(fileName);
}
}
void fwPreferencesDialog::on_clearImageButton_clicked() {
ui->SplashFileName->clear();
}
void fwPreferencesDialog::on_checkFWUpdates_clicked()
{
FirmwareVariant variant = getFirmwareVariant();
if (ui->burnFirmware->isChecked()) {
QSettings settings;
current_firmware_variant = variant;
settings.setValue("firmware", variant.id);
}
MainWindow * mw = (MainWindow *)this->parent();
mw->checkForUpdates(true, variant.id);
firmwareChanged();
}
void fwPreferencesDialog::shrink()
{
resize(0,0);
}

View file

@ -24,6 +24,9 @@ private:
QList<QCheckBox *> optionsCheckBoxes;
bool updateLock;
void showVoice(bool);
void showVoice();
void hideVoice();
void populateLocale();
void populateFirmwareOptions(const FirmwareInfo *);
FirmwareVariant getFirmwareVariant();
@ -39,12 +42,7 @@ private slots:
void firmwareChanged();
void on_fw_dnld_clicked();
void on_voice_dnld_clicked();
void on_sdPathButton_clicked();
void on_checkFWUpdates_clicked();
void on_ProfSlot_SB_valueChanged();
void on_ProfSave_PB_clicked();
void on_SplashSelect_clicked();
void on_clearImageButton_clicked();
};
#endif // FWPREFERENCESDIALOG_H

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>620</width>
<height>658</height>
<height>437</height>
</rect>
</property>
<property name="sizePolicy">
@ -32,181 +32,13 @@
<property name="margin">
<number>6</number>
</property>
<item row="21" column="5">
<widget class="QPushButton" name="voice_dnld">
<property name="text">
<string>Download Voice</string>
<item row="38" column="5">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="35" column="2" 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="10" column="2">
<widget class="QCheckBox" name="optionCheckBox_9">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="10" column="3">
<widget class="QCheckBox" name="optionCheckBox_10">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="18" column="5">
<widget class="QPushButton" name="fw_dnld">
<property name="text">
<string>Download FW</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="12" column="4">
<widget class="QCheckBox" name="optionCheckBox_19">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="5">
<widget class="QCheckBox" name="optionCheckBox_8">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QCheckBox" name="optionCheckBox_25">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QCheckBox" name="optionCheckBox_7">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="11" column="4">
<widget class="QCheckBox" name="optionCheckBox_15">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QCheckBox" name="optionCheckBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="CPU_ID_LABEL">
<property name="text">
<string>Processor ID</string>
</property>
</widget>
</item>
<item row="17" column="4">
<widget class="QCheckBox" name="optionCheckBox_39">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="4">
<widget class="QLabel" name="FwInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FwInfo</string>
</property>
</widget>
</item>
<item row="17" column="5">
<widget class="QCheckBox" name="optionCheckBox_40">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@ -223,6 +55,19 @@
</property>
</widget>
</item>
<item row="15" column="5">
<widget class="QCheckBox" name="optionCheckBox_32">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="11" column="5">
<widget class="QCheckBox" name="optionCheckBox_16">
<property name="sizePolicy">
@ -246,35 +91,6 @@
</property>
</widget>
</item>
<item row="32" column="0" colspan="2">
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Default Stick Mode</string>
</property>
</widget>
</item>
<item row="33" column="0" colspan="2">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Channel Order</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QCheckBox" name="optionCheckBox_2">
<property name="sizePolicy">
@ -301,60 +117,6 @@
</property>
</widget>
</item>
<item row="32" column="2" colspan="2">
<widget class="QComboBox" name="stickmodeCB">
<property name="maximumSize">
<size>
<width>190</width>
<height>16777215</height>
</size>
</property>
<property name="whatsThis">
<string>Mode selection:
Mode 1:
Left stick: Elevator, Rudder
Right stick: Throttle, Aileron
Mode 2:
Left stick: Throttle, Rudder
Right stick: Elevator, Aileron
Mode 3:
Left stick: Elevator, Aileron
Right stick: Throttle, Rudder
Mode 4:
Left stick: Throttle, Aileron
Right stick: Elevator, Rudder
</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Mode 1 (RUD ELE THR AIL)</string>
</property>
</item>
<item>
<property name="text">
<string>Mode 2 (RUD THR ELE AIL)</string>
</property>
</item>
<item>
<property name="text">
<string>Mode 3 (AIL ELE THR RUD)</string>
</property>
</item>
<item>
<property name="text">
<string>Mode 4 (AIL THR ELE RUD)</string>
</property>
</item>
</widget>
</item>
<item row="15" column="2">
<widget class="QCheckBox" name="optionCheckBox_29">
<property name="sizePolicy">
@ -394,6 +156,9 @@ Mode 4:
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QComboBox" name="downloadVerCB"/>
</item>
<item row="7" column="2">
<widget class="QComboBox" name="langCombo">
<property name="sizePolicy">
@ -410,8 +175,8 @@ Mode 4:
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QComboBox" name="downloadVerCB"/>
<item row="5" column="2" colspan="3">
<widget class="QLineEdit" name="CPU_ID_LE"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_6">
@ -436,159 +201,6 @@ Mode 4:
</property>
</widget>
</item>
<item row="5" column="2" colspan="3">
<widget class="QLineEdit" name="CPU_ID_LE"/>
</item>
<item row="33" column="2" colspan="2">
<widget class="QComboBox" name="channelorderCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="whatsThis">
<string>Channel order
This is used by the templated to determine which channel goes to what number output.</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>R E T A</string>
</property>
</item>
<item>
<property name="text">
<string>R E A T</string>
</property>
</item>
<item>
<property name="text">
<string>R T E A</string>
</property>
</item>
<item>
<property name="text">
<string>R T A E</string>
</property>
</item>
<item>
<property name="text">
<string>R A E T</string>
</property>
</item>
<item>
<property name="text">
<string>R A T E</string>
</property>
</item>
<item>
<property name="text">
<string>E R T A</string>
</property>
</item>
<item>
<property name="text">
<string>E R A T</string>
</property>
</item>
<item>
<property name="text">
<string>E T R A</string>
</property>
</item>
<item>
<property name="text">
<string>E T A R</string>
</property>
</item>
<item>
<property name="text">
<string>E A R T</string>
</property>
</item>
<item>
<property name="text">
<string>E A T R</string>
</property>
</item>
<item>
<property name="text">
<string>T R E A</string>
</property>
</item>
<item>
<property name="text">
<string>T R A E</string>
</property>
</item>
<item>
<property name="text">
<string>T E R A</string>
</property>
</item>
<item>
<property name="text">
<string>T E A R</string>
</property>
</item>
<item>
<property name="text">
<string>T A R E</string>
</property>
</item>
<item>
<property name="text">
<string>T A E R</string>
</property>
</item>
<item>
<property name="text">
<string>A R E T</string>
</property>
</item>
<item>
<property name="text">
<string>A R T E</string>
</property>
</item>
<item>
<property name="text">
<string>A E R T</string>
</property>
</item>
<item>
<property name="text">
<string>A E T R</string>
</property>
</item>
<item>
<property name="text">
<string>A T R E</string>
</property>
</item>
<item>
<property name="text">
<string>A T E R</string>
</property>
</item>
</widget>
</item>
<item row="8" column="5">
<widget class="QCheckBox" name="optionCheckBox_4">
<property name="sizePolicy">
@ -641,19 +253,6 @@ This is used by the templated to determine which channel goes to what number out
</property>
</widget>
</item>
<item row="15" column="5">
<widget class="QCheckBox" name="optionCheckBox_32">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QCheckBox" name="optionCheckBox_17">
<property name="sizePolicy">
@ -914,40 +513,6 @@ This is used by the templated to determine which channel goes to what number out
</property>
</widget>
</item>
<item row="34" column="2" colspan="3">
<widget class="QCheckBox" name="renameFirmware">
<property name="text">
<string>Append version number to FW file name</string>
</property>
</widget>
</item>
<item row="46" column="5">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QLabel" name="label_16">
<property name="font">
<font>
<family>Sans Serif</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Profile</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="5">
<widget class="QPushButton" name="checkFWUpdates">
<property name="minimumSize">
@ -961,37 +526,6 @@ This is used by the templated to determine which channel goes to what number out
</property>
</widget>
</item>
<item row="25" column="2" colspan="3">
<widget class="QLineEdit" name="SplashFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="21" column="2">
<widget class="QComboBox" name="voiceCombo">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set language of voice.
May be different from firmware language</string>
</property>
</widget>
</item>
<item row="25" column="5">
<widget class="QPushButton" name="SplashSelect">
<property name="text">
<string>Open Image</string>
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="voiceLabel">
<property name="font">
@ -1006,109 +540,202 @@ May be different from firmware language</string>
</property>
</widget>
</item>
<item row="25" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Splash Screen</string>
</property>
</widget>
</item>
<item row="32" column="5">
<widget class="QPushButton" name="clearImageButton">
<property name="text">
<string>Clear Image</string>
</property>
</widget>
</item>
<item row="23" column="3" colspan="2">
<widget class="QLineEdit" name="ProfName_LE"/>
</item>
<item row="23" column="2">
<widget class="QSpinBox" name="ProfSlot_SB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="21" column="2">
<widget class="QComboBox" name="voiceCombo">
<property name="maximumSize">
<size>
<width>16777215</width>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
<property name="toolTip">
<string>Set language of voice.
May be different from firmware language</string>
</property>
</widget>
</item>
<item row="22" column="0" colspan="6">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="20" column="0" colspan="6">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="45" column="0" colspan="6">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="24" column="5">
<widget class="QPushButton" name="sdPathButton">
<item row="21" column="5">
<widget class="QPushButton" name="voice_dnld">
<property name="text">
<string>Open Folder</string>
<string>Download Voice</string>
</property>
</widget>
</item>
<item row="24" column="2" colspan="3">
<widget class="QLineEdit" name="sdPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="24" column="0">
<widget class="QLabel" name="sdPathLabel">
<item row="10" column="2">
<widget class="QCheckBox" name="optionCheckBox_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SD Structure path</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="35" column="5">
<widget class="QPushButton" name="ProfSave_PB">
<item row="10" column="3">
<widget class="QCheckBox" name="optionCheckBox_10">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Save Profile</string>
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="18" column="5">
<widget class="QPushButton" name="fw_dnld">
<property name="text">
<string>Download FW</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="12" column="4">
<widget class="QCheckBox" name="optionCheckBox_19">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="5">
<widget class="QCheckBox" name="optionCheckBox_8">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QCheckBox" name="optionCheckBox_25">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QCheckBox" name="optionCheckBox_7">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="11" column="4">
<widget class="QCheckBox" name="optionCheckBox_15">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QCheckBox" name="optionCheckBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="CPU_ID_LABEL">
<property name="text">
<string>Processor ID</string>
</property>
</widget>
</item>
<item row="17" column="4">
<widget class="QCheckBox" name="optionCheckBox_39">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="4">
<widget class="QLabel" name="FwInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FwInfo</string>
</property>
</widget>
</item>
<item row="17" column="5">
<widget class="QCheckBox" name="optionCheckBox_40">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="20" column="1" colspan="5">
<widget class="Line" name="voiceLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="37" column="1" colspan="5">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
@ -1161,10 +788,6 @@ May be different from firmware language</string>
<tabstop>optionCheckBox_40</tabstop>
<tabstop>optionCheckBox_41</tabstop>
<tabstop>optionCheckBox_42</tabstop>
<tabstop>stickmodeCB</tabstop>
<tabstop>channelorderCB</tabstop>
<tabstop>renameFirmware</tabstop>
<tabstop>burnFirmware</tabstop>
</tabstops>
<resources>
<include location="companion.qrc"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

View file

@ -124,12 +124,6 @@ MainWindow::MainWindow():
updateMenus();
readSettings();
FirmwareInfo *firmware = GetCurrentFirmware();
if (ActiveProfile) {
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
} else {
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
setUnifiedTitleAndToolBarOnMac(true);
this->setWindowIcon(QIcon(":/icon.png"));
this->setIconSize(QSize(32,32));
@ -752,23 +746,20 @@ void MainWindow::loadProfile()
{
QSettings settings;
QAction *action = qobject_cast<QAction *>(sender());
int chord,defmod, burnfw;
bool renfw;
if (action) {
int profnum=action->data().toInt();
QSettings settings;
settings.setValue("ActiveProfile",profnum);
settings.setValue("profileId",profnum);
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(profnum);
settings.beginGroup(profile);
ActiveProfile=profnum;
ActiveProfileName=settings.value("Name", "").toString();
chord=settings.value("default_channel_order", 0).toInt();
defmod=settings.value("default_mode", 0).toInt();
burnfw=settings.value("burnFirmware", 0).toInt();
QString profileName=settings.value("Name", "").toString();
int chord=settings.value("default_channel_order", 0).toInt();
int defmod=settings.value("default_mode", 0).toInt();
bool burnfw=settings.value("burnFirmware", false).toBool();
QString sdPath=settings.value("sdPath", ".").toString();
renfw=settings.value("rename_firmware_files", false).toBool();
bool renfw=settings.value("rename_firmware_files", false).toBool();
QString SplashFileName=settings.value("SplashFileName","").toString();
QString SplashImage=settings.value("SplashImage", "").toString();
QString firmware_id=settings.value("firmware", default_firmware_variant.id).toString();
@ -777,6 +768,7 @@ void MainWindow::loadProfile()
settings.setValue("firmware", firmware_id);
settings.endGroup();
settings.endGroup();
settings.setValue("Name", profileName );
settings.setValue("default_channel_order", chord);
settings.setValue("default_mode", defmod);
settings.setValue("burnFirmware", burnfw);
@ -785,46 +777,15 @@ void MainWindow::loadProfile()
settings.setValue("SplashFileName", SplashFileName);
settings.setValue("SplashImage", SplashImage);
settings.setValue("firmware", firmware_id);
settings.setValue("profileId", profnum);
current_firmware_variant = GetFirmwareVariant(firmware_id);
FirmwareInfo *firmware = GetCurrentFirmware();
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
// settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
mdiChild->eepromInterfaceChanged();
}
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
}
}
void MainWindow::unloadProfile()
{
ActiveProfile=0;
ActiveProfileName="";
QSettings settings;
settings.setValue("ActiveProfile", 0);
FirmwareInfo *firmware = GetCurrentFirmware();
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
void MainWindow::preferences()
{
preferencesDialog *pd = new preferencesDialog(this);
pd->exec();
FirmwareInfo *firmware = GetCurrentFirmware();
if (ActiveProfile) {
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
}
else {
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
mdiChild->eepromInterfaceChanged();
}
updateMenus();
}
}
void MainWindow::appPreferences()
@ -838,14 +799,6 @@ void MainWindow::fwPreferences()
{
fwPreferencesDialog *pd = new fwPreferencesDialog(this);
pd->exec();
FirmwareInfo *firmware = GetCurrentFirmware();
if (ActiveProfile) {
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
}
else {
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
mdiChild->eepromInterfaceChanged();
@ -1640,19 +1593,9 @@ void MainWindow::updateMenus()
compareAct->setEnabled(activeMdiChild());
updateRecentFileActions();
updateProfilesActions();
bool notfound=true;
QSettings settings;
settings.beginGroup("Profiles");
for (int i=0; i<MAX_PROFILES; i++) {
QString profile=QString("profile%1").arg(i+1);
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
if (!name.isEmpty()) {
notfound=false;
}
settings.endGroup();
}
profileButton->setDisabled(notfound);
setWindowTitle(tr("OpenTX Companion - FW: %1 - Profile: %2").arg(GetCurrentFirmware()->name).arg(settings.value("profileId").toString()));
}
MdiChild *MainWindow::createMdiChild()
@ -1701,16 +1644,12 @@ void MainWindow::createActions()
logsAct->setStatusTip(tr("Open log file"));
connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile()));
preferencesAct = new QAction(tr("&Old Preferences Dialog..."), this);
preferencesAct->setStatusTip(tr("Used the old Preferences Dialog"));
connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences()));
appPreferencesAct = new QAction(CompanionIcon("apppreferences.png"), tr("&Application Preferences..."), this);
appPreferencesAct->setStatusTip(tr("Edit application preferences"));
appPreferencesAct = new QAction(CompanionIcon("apppreferences.png"), tr("&Setting..."), this);
appPreferencesAct->setStatusTip(tr("Edit Settings"));
connect(appPreferencesAct, SIGNAL(triggered()), this, SLOT(appPreferences()));
fwPreferencesAct = new QAction(CompanionIcon("fwpreferences.png"), tr("&Downloads and Profiles..."), this);
fwPreferencesAct->setStatusTip(tr("Firmware and voice file downloads as well as profile definition."));
fwPreferencesAct = new QAction(CompanionIcon("fwpreferences.png"), tr("&Downloads..."), this);
fwPreferencesAct->setStatusTip(tr("Download firmware and voice files"));
connect(fwPreferencesAct, SIGNAL(triggered()), this, SLOT(fwPreferences()));
checkForUpdatesAct = new QAction(CompanionIcon("update.png"), tr("&Check for updates..."), this);
@ -1833,6 +1772,9 @@ void MainWindow::createActions()
connect(profileActs[i], SIGNAL(triggered()), this, SLOT(loadProfile()));
}
updateProfilesActions();
createProfileAct = new QAction(tr("New Profile"), this);
createProfileAct->setStatusTip(tr("Create a new Radio Setting Profile"));
connect(createProfileAct, SIGNAL(triggered()), this, SLOT(createProfile()));
classicThemeAct = new QAction(tr("Classic"), this);
classicThemeAct->setStatusTip(tr("The multicolor classical Companion icon theme"));
@ -1917,7 +1859,6 @@ void MainWindow::createMenus()
{
QMenu *recentFileMenu=new QMenu(tr("Recent Files"));
QMenu *profilesMenu=new QMenu(tr("Firmware Profiles"));
QMenu *languageMenu=new QMenu(tr("Set Menu Language"));
QMenu *themeMenu=new QMenu(tr("Set Icon Theme"));
QMenu *iconThemeSizeMenu=new QMenu(tr("Set Icon Size"));
@ -1939,11 +1880,7 @@ void MainWindow::createMenus()
fileMenu->addAction(compareAct);
fileMenu->addSeparator();
fileMenu->addAction(fwPreferencesAct);
fileMenu->addMenu(profilesMenu);
profilesMenu->setIcon(CompanionIcon("profiles.png"));
for (int i=0; i<MAX_PROFILES; ++i)
profilesMenu->addAction(profileActs[i]);
fileMenu->addMenu(createProfilesMenu());
fileMenu->addAction(exitAct);
editMenu = menuBar()->addMenu(tr("&Edit"));
@ -1977,7 +1914,6 @@ void MainWindow::createMenus()
settingsMenu->addSeparator();
settingsMenu->addAction(appPreferencesAct);
settingsMenu->addAction(customizeSplashAct);
settingsMenu->addAction(preferencesAct);
settingsMenu->addAction(burnConfigAct);
burnMenu = menuBar()->addMenu(tr("&Read/Write"));
@ -2021,9 +1957,15 @@ QMenu *MainWindow::createRecentFileMenu()
QMenu *MainWindow::createProfilesMenu()
{
QMenu *profilesMenu = new QMenu(this);
for ( int i = 0; i < MAX_PROFILES; ++i)
QMenu *profilesMenu=new QMenu(tr("Radio Settings Profiles"));
int i;
for ( i = 0; i < MAX_PROFILES; ++i) {
profilesMenu->addAction(profileActs[i]);
}
if ( i>0 )
profilesMenu->addSeparator();
profilesMenu->addAction(createProfileAct);
profilesMenu->setIcon(CompanionIcon("profiles.png"));
return profilesMenu;
}
@ -2039,11 +1981,14 @@ void MainWindow::createToolBars()
case 1:
size=QSize(24,24);
break;
case 2:
size=QSize(32,32);
break;
case 3:
size=QSize(48,48);
break;
default:
size=QSize(32,32);
size=QSize(24,24);
break;
}
fileToolBar = addToolBar(tr("File"));
@ -2069,18 +2014,6 @@ void MainWindow::createToolBars()
profileButton->setIcon(CompanionIcon("profiles.png"));
profileButton->setToolTip(tr("Firmware Profiles"));
fileToolBar->addWidget(profileButton);
bool notfound=true;
settings.beginGroup("Profiles");
for (int i=0; i<MAX_PROFILES; i++) {
QString profile=QString("profile%1").arg(i+1);
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
if (!name.isEmpty()) {
notfound=false;
}
settings.endGroup();
}
profileButton->setDisabled(notfound);
fileToolBar->addSeparator();
fileToolBar->addAction(simulateAct);
fileToolBar->addAction(printAct);
@ -2093,7 +2026,6 @@ void MainWindow::createToolBars()
editToolBar->addAction(copyAct);
editToolBar->addAction(pasteAct);
burnToolBar = new QToolBar(tr("Write"));
addToolBar( Qt::LeftToolBarArea, burnToolBar );
burnToolBar->setIconSize(size);
@ -2128,14 +2060,10 @@ void MainWindow::readSettings()
checkCompanion9x = settings.value("startup_check_companion", true).toBool();
checkFW = settings.value("startup_check_fw", true).toBool();
MaxRecentFiles =settings.value("history_size",10).toInt();
ActiveProfile=settings.value("activeprofile",0).toInt();
if (ActiveProfile) {
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(ActiveProfile);
settings.beginGroup(profile);
ActiveProfileName=settings.value("Name","").toString();
settings.endGroup();
settings.endGroup();
if (settings.value("profileId",0).toInt() == 0)
{
createProfile();
settings.setValue("profileId", "1");
}
}
@ -2189,6 +2117,8 @@ void MainWindow::updateProfilesActions()
{
int i;
QSettings settings;
int activeProfile = settings.value("profileId").toInt();
settings.beginGroup("Profiles");
for (i=0; i<MAX_PROFILES; i++) {
QString profile=QString("profile%1").arg(i+1);
@ -2199,14 +2129,43 @@ void MainWindow::updateProfilesActions()
profileActs[i]->setText(text);
profileActs[i]->setData(i+1);
profileActs[i]->setVisible(true);
if ((i+1) == activeProfile)
profileActs[i]->setIcon(CompanionIcon("arrow-right.png"));
else
profileActs[i]->setIcon(CompanionIcon(""));
} else {
profileActs[i]->setVisible(false);
}
settings.endGroup();
}
// separatorAct->setVisible(numRecentFiles > 0);
}
void MainWindow::createProfile()
{
int firstFreeIndex = 0;
QSettings settings;
settings.beginGroup("Profiles");
for (int i=0; firstFreeIndex ==0 && i<MAX_PROFILES; i++) {
QString profile=QString("profile%1").arg(i+1);
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
if (name.isEmpty())
firstFreeIndex = i+1;
settings.endGroup();
}
settings.endGroup();
if (firstFreeIndex == 0) // Could not find free index
return;
settings.beginGroup("Profiles");
settings.beginGroup(QString("profile%1").arg(firstFreeIndex));
settings.setValue("Name",QString("profile%1").arg(firstFreeIndex));
settings.endGroup();
settings.endGroup();
updateMenus();
}
QString MainWindow::strippedName(const QString &fullFileName)
{

View file

@ -63,7 +63,6 @@ QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
friend class preferencesDialog;
friend class fwPreferencesDialog;
friend class MdiChild; // TODO GetAvrdudeArgs could be external to this class
@ -80,7 +79,6 @@ protected:
public slots:
void downloadLatestFW(FirmwareInfo *firmware, const QString & firmwareId);
void unloadProfile();
private slots:
void openDocumentURL();
@ -146,10 +144,10 @@ private slots:
void compare();
void print();
void loadBackup();
void preferences();
void appPreferences();
void fwPreferences();
void updateMenus();
void createProfile();
MdiChild *createMdiChild();
void setActiveSubWindow(QWidget *window);
QMenu * createRecentFileMenu();
@ -191,7 +189,6 @@ private:
QString installer_fileName;
QString downloadedFW;
QString downloadedFWFilename;
QString ActiveProfileName;
downloadDialog * downloadDialog_forWait;
bool checkCompanion9x;
@ -199,7 +196,7 @@ private:
bool needRename;
bool showcheckForUpdatesResult;
int MaxRecentFiles;
int ActiveProfile;
// int ActiveProfile;
int currentFWrev;
int currentFWrev_temp;
int NewFwRev;
@ -224,7 +221,6 @@ private:
QAction *saveAct;
QAction *saveAsAct;
QAction *exitAct;
QAction *preferencesAct;
QAction *appPreferencesAct;
QAction *fwPreferencesAct;
QAction *checkForUpdatesAct;
@ -253,6 +249,7 @@ private:
QAction *logsAct;
QAction *recentFileActs[MAX_RECENT];
QAction *profileActs[MAX_PROFILES];
QAction *createProfileAct;
QAction *classicThemeAct;
QAction *monoThemeAct;
QAction *monoBlueThemeAct;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 876 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

File diff suppressed because it is too large Load diff

View file

@ -10,3 +10,6 @@
/*.o
/*.bin
/*.lst
/SCRIPTS
/SOUNDS
/LOGS

View file

@ -111,8 +111,6 @@ PACK(typedef struct {
}) MixData_v215;
#endif
PACK(typedef struct {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t start:12;
@ -220,15 +218,38 @@ void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
}
#if defined(PCBTARANIS)
int ConvertSource_215_to_216(int source, bool insertZero=false)
{
if (insertZero)
source += 1;
// Virtual Inputs and Lua Outputs added
if (source > 0)
source += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
// 4 GVARS added
if (source > MIXSRC_GVAR1+4)
source += 4;
return source;
}
int ConvertSwitch_215_to_216(int swtch)
{
if (swtch <= SWSRC_LAST_SWITCH)
if (swtch < 0)
return -ConvertSwitch_215_to_216(-swtch);
else if (swtch <= SWSRC_LAST_SWITCH)
return swtch;
else
return swtch + (2*4) + (2*6); // 4 trims and 2 * 6-pos added as switches
}
#else
inline int ConvertSwitch_215_to_216(int swtch)
int ConvertSource_215_to_216(int source, bool removeZero=false)
{
// 4 GVARS added
if (source > MIXSRC_GVAR1+4)
source += 4;
return source;
}
int ConvertSwitch_215_to_216(int swtch)
{
if (swtch <= SWSRC_LAST_SWITCH)
return swtch;
@ -250,22 +271,28 @@ void ConvertModel_215_to_216(ModelData &model)
// Mixes: GVARS in weight moved from 512 to 4096 and -512 to -4096, because GVARS may be used in limits [-1250:1250]
// Switches: two 6-pos pots added, REa added to Sky9x
TRACE("Model conversion from v215 to v216");
assert(sizeof(ModelData_v215) <= sizeof(ModelData));
ModelData_v215 oldModel;
memcpy(&oldModel, &model, sizeof(oldModel));
memset(&model, 0, sizeof(ModelData));
char name[LEN_MODEL_NAME+1];
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
TRACE("Model %s conversion from v215 to v216", name);
memcpy(&g_model.header, &oldModel.header, sizeof(g_model.header));
for (uint8_t i=0; i<2; i++) {
g_model.timers[i].mode = oldModel.timers[i].mode;
g_model.timers[i].start = oldModel.timers[i].start;
g_model.timers[i].minuteBeep = oldModel.timers[i].minuteBeep;
g_model.timers[i].persistent = oldModel.timers[i].persistent;
g_model.timers[i].countdownBeep = oldModel.timers[i].countdownBeep;
g_model.timers[i].value = oldModel.timers[i].value;
TimerData & timer = g_model.timers[i];
if (oldModel.timers[i].mode >= TMRMODE_FIRST_SWITCH)
timer.mode = TMRMODE_FIRST_SWITCH + ConvertSwitch_215_to_216(oldModel.timers[i].mode - TMRMODE_FIRST_SWITCH + 1) - 1;
else
timer.mode = oldModel.timers[i].mode;
timer.start = oldModel.timers[i].start;
timer.minuteBeep = oldModel.timers[i].minuteBeep;
timer.persistent = oldModel.timers[i].persistent;
timer.countdownBeep = oldModel.timers[i].countdownBeep;
timer.value = oldModel.timers[i].value;
}
g_model.protocol = oldModel.protocol;
g_model.thrTrim = oldModel.thrTrim;
@ -277,43 +304,44 @@ void ConvertModel_215_to_216(ModelData &model)
g_model.beepANACenter = oldModel.beepANACenter;
for (uint8_t i=0; i<64; i++) {
MixData & mix = g_model.mixData[i];
#if defined(PCBTARANIS)
g_model.mixData[i].destCh = oldModel.mixData[i].destCh;
g_model.mixData[i].phases = oldModel.mixData[i].phases;
g_model.mixData[i].mltpx = oldModel.mixData[i].mltpx;
g_model.mixData[i].weight = oldModel.mixData[i].weight;
g_model.mixData[i].swtch = ConvertSwitch_215_to_216(oldModel.mixData[i].swtch);
mix.destCh = oldModel.mixData[i].destCh;
mix.phases = oldModel.mixData[i].phases;
mix.mltpx = oldModel.mixData[i].mltpx;
mix.weight = oldModel.mixData[i].weight;
mix.swtch = ConvertSwitch_215_to_216(oldModel.mixData[i].swtch);
if (oldModel.mixData[i].curveMode==0/*differential*/) {
g_model.mixData[i].curve.type = CURVE_REF_DIFF;
g_model.mixData[i].curve.value = oldModel.mixData[i].curveParam;
mix.curve.type = CURVE_REF_DIFF;
mix.curve.value = oldModel.mixData[i].curveParam;
}
else if (oldModel.mixData[i].curveParam <= 6) {
g_model.mixData[i].curve.type = CURVE_REF_FUNC;
g_model.mixData[i].curve.value = oldModel.mixData[i].curveParam;
mix.curve.type = CURVE_REF_FUNC;
mix.curve.value = oldModel.mixData[i].curveParam;
}
else {
g_model.mixData[i].curve.type = CURVE_REF_CUSTOM;
g_model.mixData[i].curve.value = oldModel.mixData[i].curveParam - 6;
mix.curve.type = CURVE_REF_CUSTOM;
mix.curve.value = oldModel.mixData[i].curveParam - 6;
}
g_model.mixData[i].mixWarn = oldModel.mixData[i].mixWarn;
g_model.mixData[i].delayUp = oldModel.mixData[i].delayUp;
g_model.mixData[i].delayDown = oldModel.mixData[i].delayDown;
g_model.mixData[i].speedUp = oldModel.mixData[i].speedUp;
g_model.mixData[i].speedDown = oldModel.mixData[i].speedDown;
g_model.mixData[i].srcRaw = oldModel.mixData[i].srcRaw;
if (g_model.mixData[i].srcRaw > 4 || oldModel.mixData[i].noExpo)
g_model.mixData[i].srcRaw += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
g_model.mixData[i].offset = oldModel.mixData[i].offset;
memcpy(g_model.mixData[i].name, oldModel.mixData[i].name, LEN_EXPOMIX_NAME);
mix.mixWarn = oldModel.mixData[i].mixWarn;
mix.delayUp = oldModel.mixData[i].delayUp;
mix.delayDown = oldModel.mixData[i].delayDown;
mix.speedUp = oldModel.mixData[i].speedUp;
mix.speedDown = oldModel.mixData[i].speedDown;
mix.srcRaw = oldModel.mixData[i].srcRaw;
if (mix.srcRaw > 4 || oldModel.mixData[i].noExpo)
mix.srcRaw = ConvertSource_215_to_216(mix.srcRaw);
mix.offset = oldModel.mixData[i].offset;
memcpy(mix.name, oldModel.mixData[i].name, LEN_EXPOMIX_NAME);
#else
memcpy(&g_model.mixData[i], &oldModel.mixData[i], sizeof(g_model.mixData[i]));
memcpy(&mix, &oldModel.mixData[i], sizeof(mix));
#endif
if (g_model.mixData[i].weight <= -508)
g_model.mixData[i].weight = g_model.mixData[i].weight + 512 - 4096;
else if (g_model.mixData[i].weight >= 507)
g_model.mixData[i].weight = g_model.mixData[i].weight - 512 + 4096;
if (mix.weight <= -508)
mix.weight = mix.weight + 512 - 4096;
else if (mix.weight >= 507)
mix.weight = mix.weight - 512 + 4096;
else
g_model.mixData[i].offset = g_model.mixData[i].offset * g_model.mixData[i].weight / 100;
mix.offset = mix.offset * mix.weight / 100;
}
for (uint8_t i=0; i<32; i++) {
g_model.limitData[i].min = 10 * oldModel.limitData[i].min;
@ -414,10 +442,12 @@ void ConvertModel_215_to_216(ModelData &model)
sw.andsw = oldModel.customSw[i].andsw;
#if defined(PCBTARANIS)
uint8_t cstate = cswFamily(sw.func);
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
if (sw.v1 > 0) sw.v1 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
if (sw.v1 > MIXSRC_GVAR1+4) sw.v1 += 4;
if (cstate == LS_FAMILY_BOOL) {
sw.v1 = ConvertSwitch_215_to_216(sw.v1);
sw.v2 = ConvertSwitch_215_to_216(sw.v2);
}
else if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
sw.v1 = ConvertSource_215_to_216(sw.v1);
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_DIFF) {
if (sw.v1 >= MIXSRC_FIRST_TELEM) {
switch ((uint8_t)sw.v1) {
@ -463,14 +493,14 @@ void ConvertModel_215_to_216(ModelData &model)
}
}
if (cstate == LS_FAMILY_COMP) {
if (sw.v2 > 0) sw.v2 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
if (sw.v2 > MIXSRC_GVAR1+4) sw.v2 += 4;
sw.v2 = ConvertSource_215_to_216(sw.v2);
}
}
#endif
}
for (uint8_t i=0; i<32; i++) {
CustomFnData & fn = g_model.funcSw[i];
fn.swtch = oldModel.funcSw[i].swtch;
fn.swtch = ConvertSwitch_215_to_216(oldModel.funcSw[i].swtch);
fn.func = oldModel.funcSw[i].func;
if (fn.func <= 15) {
fn.all.param = fn.func;
@ -537,17 +567,13 @@ void ConvertModel_215_to_216(ModelData &model)
}
if (fn.func == FUNC_PLAY_VALUE || fn.func == FUNC_VOLUME || (IS_ADJUST_GV_FUNC(fn.func) && fn.all.mode == FUNC_ADJUST_GVAR_SOURCE)) {
#if defined(PCBTARANIS)
fn.all.param += 1 + MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
fn.all.param = ConvertSource_215_to_216(fn.all.param, true);
#endif
if (fn.all.param > MIXSRC_GVAR1+4) fn.all.param += 4;
}
}
g_model.swashR = oldModel.swashR;
#if defined(PCBTARANIS)
if (g_model.swashR.collectiveSource > 0) g_model.swashR.collectiveSource += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
if (g_model.swashR.collectiveSource > MIXSRC_GVAR1+4) g_model.swashR.collectiveSource += 4;
#endif
g_model.swashR.collectiveSource = ConvertSource_215_to_216(g_model.swashR.collectiveSource);
for (uint8_t i=0; i<9; i++) {
memcpy(&g_model.phaseData[i], &oldModel.phaseData[i], sizeof(oldModel.phaseData[i])); // the last 4 gvars will remain blank

View file

@ -4543,10 +4543,11 @@ void menuModelLogicalSwitches(uint8_t event)
// CSW params
uint8_t cstate = cswFamily(cs->func);
#if defined(CPUARM)
int16_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
int16_t v1_unsigned=(uint8_t)cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
int16_t v3_min=0, v3_max=100;
#else
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
uint8_t v1_unsigned = cs->v1;
#endif
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
@ -4582,7 +4583,7 @@ void menuModelLogicalSwitches(uint8_t event)
}
#endif
else if (cstate == LS_FAMILY_COMP) {
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, attr1);
putsMixerSource(CSW_2ND_COLUMN, y, v1_unsigned, attr1);
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, attr2);
INCDEC_SET_FLAG(INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
@ -4596,7 +4597,7 @@ void menuModelLogicalSwitches(uint8_t event)
INCDEC_ENABLE_CHECK(NULL);
}
else {
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, attr1);
putsMixerSource(CSW_2ND_COLUMN, y, v1_unsigned, attr1);
if (horz == 1) {
INCDEC_SET_FLAG(INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
@ -4606,11 +4607,11 @@ void menuModelLogicalSwitches(uint8_t event)
INCDEC_ENABLE_CHECK(NULL);
}
#if defined(FRSKY)
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2);
v2_max = maxTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1);
if (v1_unsigned >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_unsigned - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2);
v2_max = maxTelemValue(v1_unsigned - MIXSRC_FIRST_TELEM + 1);
#if defined(CPUARM)
v2_min = minTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1);
v2_min = minTelemValue(v1_unsigned - MIXSRC_FIRST_TELEM + 1);
if (cs->v2 < v2_min || cs->v2 > v2_max) {
cs->v2 = 0;
eeDirty(EE_MODEL);
@ -4635,8 +4636,8 @@ void menuModelLogicalSwitches(uint8_t event)
v2_min = -125; v2_max = 125;
}
#else
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2);
if (v1_unsigned >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_unsigned - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2);
v2_min = -128; v2_max = 127;
}
else {
@ -4711,17 +4712,17 @@ void menuModelLogicalSwitches(uint8_t event)
break;
}
case LS_FIELD_V1:
cs->v1 = CHECK_INCDEC_PARAM(event, cs->v1, v1_min, v1_max);
cs->v1 = CHECK_INCDEC_PARAM(event, v1_unsigned, v1_min, v1_max);
break;
case LS_FIELD_V2:
cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max);
#if defined(PCBTARANIS)
if (cstate==LS_FAMILY_OFS && cs->v1!=0 && event==EVT_KEY_LONG(KEY_ENTER)) {
if (cstate==LS_FAMILY_OFS && v1_unsigned!=0 && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
getvalue_t x = getValue(cs->v1);
if (cs->v1 < MIXSRC_GVAR1)
getvalue_t x = getValue(v1_unsigned);
if (v1_unsigned < MIXSRC_GVAR1)
cs->v2 = calcRESXto100(x);
else if (cs->v1 - MIXSRC_FIRST_TELEM + 1 == TELEM_ALT)
else if (v1_unsigned - MIXSRC_FIRST_TELEM + 1 == TELEM_ALT)
cs->v2 *= 100;
eeDirty(EE_MODEL);
}

View file

@ -164,14 +164,10 @@ void varioWakeup()
if (verticalSpeed < 0 || (int16_t)(s_varioTmr-tmr10ms) < 0) {
#if defined(CPUARM)
uint16_t SoundVarioBeepTime;
uint16_t SoundVarioBeepFreq;
int SoundVarioBeepTime;
int SoundVarioBeepFreq;
if (verticalSpeed > 0) {
if (verticalSpeed > 1276) {
SoundVarioBeepTime=5;
} else {
SoundVarioBeepTime = 320 - (verticalSpeed >> 2);
}
SoundVarioBeepTime = min(5, 320 - (verticalSpeed >> 2));
SoundVarioBeepFreq = 1000 + verticalSpeed;
}
else {

View file

@ -1404,11 +1404,14 @@ enum MixSources {
#define MIN_POINTS 3
#define MAX_POINTS 17
#define TMRMODE_NONE 0
#define TMRMODE_ABS 1
#define TMRMODE_THR 2
#define TMRMODE_THR_REL 3
#define TMRMODE_THR_TRG 4
enum TimerModes {
TMRMODE_NONE,
TMRMODE_ABS,
TMRMODE_THR,
TMRMODE_THR_REL,
TMRMODE_THR_TRG,
TMRMODE_FIRST_SWITCH
};
#define COUNTDOWN_SILENT 0
#define COUNTDOWN_BEEPS 1
@ -1504,7 +1507,7 @@ enum FailsafeModes {
#define BeepANACenter uint8_t
#endif
PACK(typedef struct t_ModelHeader {
PACK(typedef struct {
char name[LEN_MODEL_NAME]; // must be first for eeLoadModelName
uint8_t modelId;
MODELDATA_BITMAP

View file

@ -201,7 +201,7 @@ char idx2char(int8_t idx)
return ' ';
}
#if defined(PCBTARANIS)
#if defined(CPUARM)
int8_t char2idx(char c)
{
if (c == '_') return 37;
@ -1248,6 +1248,7 @@ getvalue_t getValue(uint8_t i)
else if (i==MIXSRC_SF) return (switchState(SW_SF0) ? -1024 : 1024);
else if (i==MIXSRC_SG) return (switchState(SW_SG0) ? -1024 : (switchState(SW_SG1) ? 0 : 1024));
else if (i==MIXSRC_SH) return (switchState(SW_SH0) ? -1024 : 1024);
else if (i<=MIXSRC_LAST_CSW) return getSwitch(SWSRC_FIRST_CSW+i-MIXSRC_FIRST_CSW) ? 1024 : -1024;
#else
else if (i==MIXSRC_3POS) return (getSwitch(SW_ID0-SW_BASE+1) ? -1024 : (getSwitch(SW_ID1-SW_BASE+1) ? 0 : 1024));
// don't use switchState directly to give getSwitch possibility to hack values if needed for switch warning
@ -1255,10 +1256,9 @@ getvalue_t getValue(uint8_t i)
else if (i==MIXSRC_3POS2) return (getSwitch(SW_ID3-SW_BASE+1) ? -1024 : (getSwitch(SW_ID4-SW_BASE+1) ? 0 : 1024));
// don't use switchState directly to give getSwitch possibility to hack values if needed for switch warning
#endif
else if (i<=MIXSRC_LAST_CSW) return getSwitch(SWSRC_THR+i-MIXSRC_THR) ? 1024 : -1024;
#endif
else if (i<=MIXSRC_LAST_CSW) return getSwitch(SWSRC_FIRST_CSW+i-MIXSRC_FIRST_CSW) ? 1024 : -1024;
else if (i<=MIXSRC_LAST_PPM) { int16_t x = g_ppmIns[i-MIXSRC_FIRST_PPM]; if (i<MIXSRC_FIRST_PPM+NUM_CAL_PPM) { x-= g_eeGeneral.trainer.calib[i-MIXSRC_FIRST_PPM]; } return x*2; }
else if (i<=MIXSRC_LAST_CH) return ex_chans[i-MIXSRC_CH1];

View file

@ -749,7 +749,7 @@ extern uint8_t pxxFlag[NUM_MODULES];
#define ZCHAR_MAX (LEN_STD_CHARS + LEN_SPECIAL_CHARS)
char idx2char(int8_t idx);
#if defined(PCBTARANIS)
#if defined(CPUARM)
int8_t char2idx(char c);
void str2zchar(char *dest, const char *src, int size);
void zchar2str(char *dest, const char *src, int size);