chore(cpn): refactor firmware flashing to use edgetx rs_dfu (#6521)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
raphaelcoeffic
parent
23830197b3
commit
dbce54dec6
@@ -56,6 +56,10 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget * parent, UpdateFactories * f
|
||||
connect(ui->boardCB, SIGNAL(currentIndexChanged(int)), this, SLOT(onBaseFirmwareChanged()));
|
||||
connect(ui->opt_appDebugLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||
connect(ui->opt_fwTraceLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||
connect(ui->backupPath, &QLineEdit::editingFinished, this, &AppPreferencesDialog::onBackupPathEditingFinished);
|
||||
connect(ui->backupPathButton, &QPushButton::clicked, this, &AppPreferencesDialog::onBackupPathButtonClicked);
|
||||
connect(ui->profileBackupPath, &QLineEdit::editingFinished, this, &AppPreferencesDialog::onProfileBackupPathEditingFinished);
|
||||
connect(ui->profileBackupPathButton, &QPushButton::clicked, this, &AppPreferencesDialog::onProfileBackupPathButtonClicked);
|
||||
|
||||
#if !defined(USE_SDL)
|
||||
ui->joystickCB->hide();
|
||||
@@ -172,8 +176,8 @@ void AppPreferencesDialog::accept()
|
||||
profile.defaultMode(ui->stickmodeCB->currentData().toInt());
|
||||
profile.burnFirmware(ui->burnFirmware->isChecked());
|
||||
profile.sdPath(ui->sdPath->text());
|
||||
profile.pBackupDir(ui->profilebackupPath->text());
|
||||
profile.penableBackup(ui->pbackupEnable->isChecked());
|
||||
profile.pBackupDir(ui->profileBackupPath->text());
|
||||
profile.penableBackup(ui->profileBackupEnable->isChecked());
|
||||
profile.splashFile(ui->SplashFileName->text());
|
||||
profile.runSDSync(ui->chkPromptSDSync->isChecked());
|
||||
profile.radioSimCaseColor(ui->lblRadioColorSample->palette().button().color());
|
||||
@@ -243,7 +247,7 @@ void AppPreferencesDialog::on_btnRadioColor_clicked()
|
||||
|
||||
void AppPreferencesDialog::initSettings()
|
||||
{
|
||||
const Profile & profile = g.currentProfile();
|
||||
Profile & profile = g.currentProfile();
|
||||
|
||||
ui->burnFirmware->setChecked(profile.burnFirmware());
|
||||
|
||||
@@ -257,19 +261,15 @@ void AppPreferencesDialog::initSettings()
|
||||
ui->libraryPath->setText(g.libDir());
|
||||
ui->ge_lineedit->setText(g.gePath());
|
||||
|
||||
if (!g.backupDir().isEmpty()) {
|
||||
if (QDir(g.backupDir()).exists()) {
|
||||
ui->backupPath->setText(g.backupDir());
|
||||
ui->backupEnable->setEnabled(true);
|
||||
ui->backupEnable->setChecked(g.enableBackup());
|
||||
}
|
||||
else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
ui->backupPath->setText(g.backupDir());
|
||||
if (!ui->backupPath->text().isEmpty() && QDir(ui->backupPath->text()).exists()) {
|
||||
ui->backupEnable->setEnabled(true);
|
||||
ui->backupEnable->setChecked(g.enableBackup());
|
||||
} else {
|
||||
ui->backupEnable->setChecked(false);
|
||||
ui->backupEnable->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->splashincludeCB->setCurrentIndex(g.embedSplashes());
|
||||
|
||||
ui->opt_appDebugLog->setChecked(g.appDebugLog());
|
||||
@@ -336,17 +336,22 @@ void AppPreferencesDialog::initSettings()
|
||||
ui->stickmodeCB->setModel(GeneralSettings::stickModeItemModel());
|
||||
ui->stickmodeCB->setCurrentIndex(ui->stickmodeCB->findData(profile.defaultMode()));
|
||||
ui->sdPath->setText(profile.sdPath());
|
||||
if (!profile.pBackupDir().isEmpty()) {
|
||||
if (QDir(profile.pBackupDir()).exists()) {
|
||||
ui->profilebackupPath->setText(profile.pBackupDir());
|
||||
ui->pbackupEnable->setEnabled(true);
|
||||
ui->pbackupEnable->setChecked(profile.penableBackup());
|
||||
|
||||
ui->profileBackupPath->setText(profile.pBackupDir());
|
||||
if (!ui->profileBackupPath->text().isEmpty()) {
|
||||
if (QDir(ui->profileBackupPath->text()).exists()) {
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
ui->profileBackupEnable->setChecked(profile.penableBackup());
|
||||
} else {
|
||||
ui->pbackupEnable->setDisabled(true);
|
||||
ui->profileBackupEnable->setChecked(false);
|
||||
ui->profileBackupEnable->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->pbackupEnable->setDisabled(true);
|
||||
} else if (!ui->backupPath->text().isEmpty() && QDir(ui->backupPath->text()).exists()) {
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
ui->profileBackupEnable->setChecked(profile.penableBackup());
|
||||
} else {
|
||||
ui->profileBackupEnable->setChecked(false);
|
||||
ui->profileBackupEnable->setEnabled(false);
|
||||
}
|
||||
|
||||
if (Boards::isSurface()) {
|
||||
@@ -584,26 +589,33 @@ void AppPreferencesDialog::on_snapshotClipboardCKB_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_backupPathButton_clicked()
|
||||
void AppPreferencesDialog::onBackupPathButtonClicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your global backup folder"), g.backupDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.backupDir(fileName);
|
||||
ui->backupPath->setText(fileName);
|
||||
ui->backupEnable->setEnabled(true);
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
} else {
|
||||
ui->backupEnable->setEnabled(false);
|
||||
if (!g.currentProfile().pBackupDir().isEmpty() && QFileInfo(g.currentProfile().pBackupDir()).exists()) {
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
} else {
|
||||
ui->profileBackupEnable->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_ProfilebackupPathButton_clicked()
|
||||
void AppPreferencesDialog::onProfileBackupPathButtonClicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your profile backup folder"), g.backupDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->profilebackupPath->setText(fileName);
|
||||
ui->pbackupEnable->setEnabled(true);
|
||||
ui->profileBackupPath->setText(fileName);
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AppPreferencesDialog::on_btn_appLogsDir_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this, tr("Select a folder for application logs"), ui->appLogsDir->text());
|
||||
@@ -857,3 +869,32 @@ void AppPreferencesDialog::shrink()
|
||||
{
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::onBackupPathEditingFinished()
|
||||
{
|
||||
if(!ui->backupPath->text().isEmpty() && QFileInfo(ui->backupPath->text()).exists()) {
|
||||
ui->backupEnable->setEnabled(true);
|
||||
} else {
|
||||
ui->backupEnable->setChecked(false);
|
||||
ui->backupEnable->setEnabled(false);
|
||||
}
|
||||
|
||||
onProfileBackupPathEditingFinished();
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::onProfileBackupPathEditingFinished()
|
||||
{
|
||||
if (!ui->profileBackupPath->text().isEmpty()) {
|
||||
if (QDir(ui->profileBackupPath->text()).exists()) {
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
} else {
|
||||
ui->profileBackupEnable->setChecked(false);
|
||||
ui->profileBackupEnable->setEnabled(false);
|
||||
}
|
||||
} else if (!ui->backupPath->text().isEmpty() && QDir(ui->backupPath->text()).exists()) {
|
||||
ui->profileBackupEnable->setEnabled(true);
|
||||
} else {
|
||||
ui->profileBackupEnable->setChecked(false);
|
||||
ui->profileBackupEnable->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user