From 5160fd850385b1b80779295d19d00d9108362379 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 18 Jan 2014 07:49:05 +0100 Subject: [PATCH] Issue #555 fixed (core in customizetxdialog) --- companion/src/customizesplashdialog.cpp | 69 +++++++++++++------------ 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp index 01ef16b8f..7912b3ec5 100644 --- a/companion/src/customizesplashdialog.cpp +++ b/companion/src/customizesplashdialog.cpp @@ -21,43 +21,44 @@ customizeSplashDialog::~customizeSplashDialog() { void customizeSplashDialog::on_FlashLoadButton_clicked() { - QString fileName; QSettings settings("companion", "companion"); - ui->ImageLoadButton->setDisabled(true); - ui->libraryButton->setDisabled(true); - ui->SaveFlashButton->setDisabled(true); - ui->SaveImageButton->setDisabled(true); - ui->ImageFileName->clear(); - ui->imageLabel->clear(); - ui->HowToLabel->clear(); - ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)"); - fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER); - QFile file(fileName); - if (!file.exists()) { - ui->FWFileName->clear(); - ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); - return; - } - if (fileName.isEmpty()) { - ui->FWFileName->clear(); - ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); - return; - } + QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER); + if (!fileName.isEmpty()) { + ui->ImageLoadButton->setDisabled(true); + ui->libraryButton->setDisabled(true); + ui->SaveFlashButton->setDisabled(true); + ui->SaveImageButton->setDisabled(true); + ui->ImageFileName->clear(); + ui->imageLabel->clear(); + ui->HowToLabel->clear(); + ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)"); + QFile file(fileName); + if (!file.exists()) { + ui->FWFileName->clear(); + ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); + return; + } + if (fileName.isEmpty()) { + ui->FWFileName->clear(); + ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); + return; + } - ui->FWFileName->setText(fileName); - FlashInterface flash(fileName); - if (flash.hasSplash()) { - ui->HowToLabel->append("
" + tr("Select an image to customize your splash
or save actual firmware splash") + "
"); - ui->ImageLoadButton->setEnabled(true); - ui->libraryButton->setEnabled(true); - ui->SaveImageButton->setEnabled(true); - ui->imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash())); - ui->imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2); - } else { - QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file")); - return; + ui->FWFileName->setText(fileName); + FlashInterface flash(fileName); + if (flash.hasSplash()) { + ui->HowToLabel->append("
" + tr("Select an image to customize your splash
or save actual firmware splash") + "
"); + ui->ImageLoadButton->setEnabled(true); + ui->libraryButton->setEnabled(true); + ui->SaveImageButton->setEnabled(true); + ui->imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash())); + ui->imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2); + } else { + QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file")); + return; + } + settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); } - settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); } void customizeSplashDialog::on_ImageLoadButton_clicked() {