Moved selection of radio type from download dialog to profile tab. This was a bit tricky.

This commit is contained in:
Kjell Kernen
2014-02-26 01:38:13 +01:00
parent c5edba2188
commit 5ece7d9934
6 changed files with 129 additions and 114 deletions
+19 -24
View File
@@ -60,13 +60,22 @@ void appPreferencesDialog::writeValues()
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()].fwName(ui->fwNameLE->text());
g.profile[g.id()].fwType(ui->fwTypeLE->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()
@@ -146,10 +155,11 @@ void appPreferencesDialog::initSettings()
ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles());
ui->sdPath->setText(g.profile[g.id()].sdPath());
ui->profileNameLE->setText(g.profile[g.id()].name());
ui->fwNameLE->setText(g.profile[g.id()].fwName());
ui->fwTypeLE->setText(g.profile[g.id()].fwType());
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() );
}
@@ -237,23 +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()].fwName( ui->fwNameLE->text());
g.profile[g.id()].fwType( ui->fwTypeLE->text());
}
void appPreferencesDialog::on_removeProfileButton_clicked()
{
if ( g.id() == 0 )
@@ -266,6 +259,7 @@ void appPreferencesDialog::on_removeProfileButton_clicked()
}
}
bool appPreferencesDialog::displayImage( QString fileName )
{
// Start by clearing the pixmap
@@ -310,3 +304,4 @@ void appPreferencesDialog::on_clearImageButton_clicked() {