From c7b7cd2ba90337d4fa4c0b42e9edf46d496f4792 Mon Sep 17 00:00:00 2001 From: Kjell Kernen Date: Thu, 6 Feb 2014 18:54:45 +0100 Subject: [PATCH] Splash Editor modified --- companion/src/customizesplashdialog.cpp | 82 ++-- companion/src/customizesplashdialog.h | 15 +- companion/src/customizesplashdialog.ui | 619 ++++++++++++++---------- companion/src/fwpreferencesdialog.ui | 20 +- companion/src/images/customize.png | Bin 381 -> 477 bytes 5 files changed, 432 insertions(+), 304 deletions(-) diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp index 30762142f..bef28a0dc 100644 --- a/companion/src/customizesplashdialog.cpp +++ b/companion/src/customizesplashdialog.cpp @@ -12,7 +12,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) : ui(new Ui::customizeSplashDialog) { ui->setupUi(this); - ui->libraryButton->setIcon(CompanionIcon("library.png")); + ui->leftLibraryButton->setIcon(CompanionIcon("library.png")); ui->HowToLabel->clear(); ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); } @@ -22,40 +22,40 @@ customizeSplashDialog::~customizeSplashDialog() delete ui; } -void customizeSplashDialog::on_FlashLoadButton_clicked() +void customizeSplashDialog::on_leftLoadButton_clicked() { QSettings settings; 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->rightLoadButton->setDisabled(true); + ui->leftLibraryButton->setDisabled(true); + ui->leftSaveButton->setDisabled(true); + ui->rightSaveButton->setDisabled(true); + ui->rightFileName->clear(); + ui->leftImageLabel->clear(); ui->HowToLabel->clear(); ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)"); QFile file(fileName); if (!file.exists()) { - ui->FWFileName->clear(); + ui->leftFileName->clear(); ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); return; } if (fileName.isEmpty()) { - ui->FWFileName->clear(); + ui->leftFileName->clear(); ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); return; } - ui->FWFileName->setText(fileName); + ui->leftFileName->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); + ui->rightLoadButton->setEnabled(true); + ui->leftLibraryButton->setEnabled(true); + ui->rightSaveButton->setEnabled(true); + ui->leftImageLabel->setPixmap(QPixmap::fromImage(flash.getSplash())); + ui->leftImageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2); } else { QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file")); return; @@ -64,7 +64,7 @@ void customizeSplashDialog::on_FlashLoadButton_clicked() } } -void customizeSplashDialog::on_ImageLoadButton_clicked() { +void customizeSplashDialog::on_rightLoadButton_clicked() { QString supportedImageFormats; for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) { supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; @@ -82,8 +82,8 @@ void customizeSplashDialog::on_ImageLoadButton_clicked() { return; } ui->HowToLabel->clear(); - ui->ImageFileName->setText(fileName); - if (ui->imageLabel->width()==424) { + ui->rightFileName->setText(fileName); + if (ui->leftImageLabel->width()==424) { image=image.convertToFormat(QImage::Format_RGB32); QRgb col; int gray; @@ -98,16 +98,19 @@ void customizeSplashDialog::on_ImageLoadButton_clicked() { image.setPixel(i, j, qRgb(gray, gray, gray)); } } - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2))); + ui->leftImageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->leftImageLabel->width()/2, ui->leftImageLabel->height()/2))); } else { - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono))); + ui->leftImageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->leftImageLabel->width()/2, ui->leftImageLabel->height()/2).convertToFormat(QImage::Format_Mono))); } - ui->SaveFlashButton->setEnabled(true); + ui->leftSaveButton->setEnabled(true); ui->HowToLabel->append("
" + tr("Save your custimized firmware") + "
"); } } -void customizeSplashDialog::on_libraryButton_clicked() { +void customizeSplashDialog::on_rightLibraryButton_clicked() { +} + +void customizeSplashDialog::on_leftLibraryButton_clicked() { QString fileName; splashLibrary *ld = new splashLibrary(this,&fileName); @@ -119,8 +122,8 @@ void customizeSplashDialog::on_libraryButton_clicked() { return; } ui->HowToLabel->clear(); - ui->ImageFileName->setText(fileName); - if (ui->imageLabel->width()==424) { + ui->rightFileName->setText(fileName); + if (ui->leftImageLabel->width()==424) { image=image.convertToFormat(QImage::Format_RGB32); QRgb col; int gray; @@ -135,16 +138,16 @@ void customizeSplashDialog::on_libraryButton_clicked() { image.setPixel(i, j, qRgb(gray, gray, gray)); } } - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2))); + ui->leftImageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->leftImageLabel->width()/2, ui->leftImageLabel->height()/2))); } else { - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono))); + ui->leftImageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->leftImageLabel->width()/2, ui->leftImageLabel->height()/2).convertToFormat(QImage::Format_Mono))); } - ui->SaveFlashButton->setEnabled(true); + ui->leftSaveButton->setEnabled(true); ui->HowToLabel->append("
" + tr("Save your custimized firmware") + "
"); } } -void customizeSplashDialog::on_SaveFlashButton_clicked() +void customizeSplashDialog::on_leftSaveButton_clicked() { QString fileName; QSettings settings; @@ -153,13 +156,13 @@ void customizeSplashDialog::on_SaveFlashButton_clicked() if (fileName.isEmpty()) { return; } - FlashInterface flash(ui->FWFileName->text()); + FlashInterface flash(ui->leftFileName->text()); if (!flash.hasSplash()) { QMessageBox::critical(this, tr("Error"), tr("Error reading file %1").arg(fileName)); return; } settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); - QImage image = ui->imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight()); + QImage image = ui->leftImageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight()); flash.setSplash(image); if (flash.saveFlash(fileName) > 0) { ui->HowToLabel->setStyleSheet("background:rgb(0,255.0);"); @@ -170,14 +173,21 @@ void customizeSplashDialog::on_SaveFlashButton_clicked() } } -void customizeSplashDialog::on_InvertColorButton_clicked() +void customizeSplashDialog::on_rightInvertButton_clicked() { - QImage image = ui->imageLabel->pixmap()->toImage(); + QImage image = ui->rightImageLabel->pixmap()->toImage(); image.invertPixels(); - ui->imageLabel->setPixmap(QPixmap::fromImage(image)); + ui->rightImageLabel->setPixmap(QPixmap::fromImage(image)); } -void customizeSplashDialog::on_SaveImageButton_clicked() +void customizeSplashDialog::on_leftInvertButton_clicked() +{ + QImage image = ui->leftImageLabel->pixmap()->toImage(); + image.invertPixels(); + ui->leftImageLabel->setPixmap(QPixmap::fromImage(image)); +} + +void customizeSplashDialog::on_rightSaveButton_clicked() { QString fileName; QSettings settings; @@ -185,7 +195,7 @@ void customizeSplashDialog::on_SaveImageButton_clicked() fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastImagesDir").toString(), tr("PNG images (*.png);;"), 0, QFileDialog::DontConfirmOverwrite); if (!fileName.isEmpty()) { settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath()); - QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8); + QImage image = ui->leftImageLabel->pixmap()->toImage().scaled(ui->leftImageLabel->width()/2, ui->leftImageLabel->height()/2).convertToFormat(QImage::Format_Indexed8); image.save(fileName, "PNG"); } } diff --git a/companion/src/customizesplashdialog.h b/companion/src/customizesplashdialog.h index f5a7acd6d..1abdfa62a 100644 --- a/companion/src/customizesplashdialog.h +++ b/companion/src/customizesplashdialog.h @@ -19,12 +19,15 @@ public: ~customizeSplashDialog(); private slots: - void on_FlashLoadButton_clicked(); - void on_ImageLoadButton_clicked(); - void on_libraryButton_clicked(); - void on_SaveFlashButton_clicked(); - void on_InvertColorButton_clicked(); - void on_SaveImageButton_clicked(); + void on_leftLoadButton_clicked(); + void on_leftLibraryButton_clicked(); + void on_leftSaveButton_clicked(); + void on_leftInvertButton_clicked(); + + void on_rightLoadButton_clicked(); + void on_rightLibraryButton_clicked(); + void on_rightSaveButton_clicked(); + void on_rightInvertButton_clicked(); private: Ui::customizeSplashDialog *ui; diff --git a/companion/src/customizesplashdialog.ui b/companion/src/customizesplashdialog.ui index 56a043740..75c2b03d1 100644 --- a/companion/src/customizesplashdialog.ui +++ b/companion/src/customizesplashdialog.ui @@ -6,8 +6,8 @@ 0 0 - 739 - 238 + 892 + 299 @@ -17,18 +17,266 @@ - Customize Splash + Transmitter Splash Screen Editor :/icon.png:/icon.png + + + true + + + + 460 + 0 + 424 + 25 + + + + + 424 + 0 + + + + + 424 + 16777215 + + + + true + + + + + + 10 + 210 + 81 + 27 + + + + Load + + + + + + 90 + 210 + 26 + 23 + + + + Open Splash Library + + + ... + + + + 16 + 16 + + + + + + false + + + + 460 + 210 + 90 + 27 + + + + Load + + + + + true + + + + 10 + 0 + 424 + 25 + + + + + 424 + 0 + + + + + 424 + 16777215 + + + + true + + + + + false + + + + 350 + 210 + 81 + 27 + + + + Save + + + + + + 460 + 30 + 424 + 128 + + + + + 0 + 0 + + + + + 424 + 128 + + + + + 424 + 128 + + + + QFrame::Panel + + + QFrame::Raised + + + + + + :/images/customize.png + + + true + + + + + + 10 + 30 + 424 + 128 + + + + + 0 + 0 + + + + + 424 + 128 + + + + + 424 + 128 + + + + QFrame::Panel + + + QFrame::Raised + + + + + + :/images/customize.png + + + true + + + + + + 460 + 160 + 85 + 27 + + + + Invert + + + + + + 790 + 210 + 90 + 27 + + + + Save + + + + + + 10 + 160 + 81 + 27 + + + + Invert + + - 100 - 190 - 541 + 10 + 250 + 871 40 @@ -45,7 +293,7 @@ - background:rgb(255, 255, 0); + background:rgb(235, 235, 235); Qt::ScrollBarAlwaysOff @@ -67,82 +315,108 @@ p, li { white-space: pre-wrap; } true - + - 350 - 30 - 31 - 27 - - - - - Courier 10 Pitch - 10 - 75 - true - - - - => - - - - - - 350 - 60 - 31 - 27 - - - - - Courier 10 Pitch - 10 - 75 - true - - - - <= - - - - - true - - - - 390 - 130 - 251 - 25 - - - - true - - - - - - 90 - 160 - 108 - 27 + 437 + 120 + 20 + 23 - Load Firmware + ... + + + Qt::RightArrow - + - 200 - 160 + 437 + 40 + 20 + 23 + + + + ... + + + Qt::LeftArrow + + + + + + 442 + 5 + 10 + 31 + + + + Qt::Vertical + + + + + + 442 + 70 + 10 + 41 + + + + Qt::Vertical + + + + + + 442 + 150 + 10 + 91 + + + + Qt::Vertical + + + + + + 10 + 190 + 421 + 16 + + + + Qt::Horizontal + + + + + + 460 + 190 + 421 + 16 + + + + Qt::Horizontal + + + + + + 550 + 210 26 23 @@ -160,185 +434,26 @@ p, li { white-space: pre-wrap; } - - - false - - - - 390 - 160 - 90 - 27 - - - - Load Image - - - - - true - - - - 90 - 130 - 251 - 25 - - - - true - - - - - false - - - - 230 - 160 - 108 - 27 - - - - Save Firmware - - - - - - 390 - 0 - 256 - 128 - - - - - 0 - 0 - - - - - 256 - 128 - - - - - 424 - 128 - - - - QFrame::Panel - - - QFrame::Raised - - - - - - :/images/customize.png - - - true - - - - - - 91 - 1 - 256 - 128 - - - - - 0 - 0 - - - - - 256 - 128 - - - - - 424 - 128 - - - - QFrame::Panel - - - QFrame::Raised - - - - - - :/images/customize.png - - - true - - - - - - 0 - 0 - 90 - 27 - - - - Invert - - - - - - 550 - 160 - 90 - 27 - - - - Save Image - - - - - - 650 - 0 - 90 - 27 - - - - Invert - - + rightFileName + leftLoadButton + leftLibraryButton + rightLoadButton + leftFileName + leftSaveButton + rightImageLabel + rightInvertButton + rightSaveButton + leftInvertButton + leftImageLabel HowToLabel - layoutWidget - layoutWidget_2 - imageLabel - pushButton - pushButton_2 + copyLeftToRight + copyRightToLeft + line + line_2 + line_3 + line_4 + line_5 + rightLibraryButton diff --git a/companion/src/fwpreferencesdialog.ui b/companion/src/fwpreferencesdialog.ui index 9cb406bc7..97b89b481 100644 --- a/companion/src/fwpreferencesdialog.ui +++ b/companion/src/fwpreferencesdialog.ui @@ -301,7 +301,7 @@ Mode 4: - Firmware Type + Firmware Type Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -1017,7 +1017,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -1030,14 +1030,7 @@ This is used by the templated to determine which channel goes to what number out - - - - Download FW - - - - + @@ -1050,6 +1043,13 @@ This is used by the templated to determine which channel goes to what number out + + + + Download FW + + + diff --git a/companion/src/images/customize.png b/companion/src/images/customize.png index 078d0af75638cd472e47a5ff15d3e72407d5f23b..7bec20a70bc0a8bb593f0d031249d191b578822e 100644 GIT binary patch literal 477 zcmeAS@N?(olHy`uVBq!ia0y~yU|a!YH*hck$%_$L6+ntD$=lt9;Xep2*t>i(P=vF< zBeIx*f$sIt$g+mQ{^wlJ0N0J^MG~LuLUx20}y&zrzm(LIe@!2-p!} s4p0dp_kgV;vy7(2H~0V9IJ)78&qol`;+0F?=lGynhq literal 381 zcmV-@0fPRCP)