mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 09:45:21 +03:00
The two image labels and complicatd logics replaced by a simpler 4-way image selection and a single image label that simply shows whatever image that will be used as radio splash screen.
This commit is contained in:
parent
eaefefa4f0
commit
6ea9b2c26a
4 changed files with 211 additions and 378 deletions
|
@ -124,7 +124,7 @@ class Profile: protected CompStoreObj
|
||||||
QString splashFile() const;
|
QString splashFile() const;
|
||||||
bool burnFirmware() const;
|
bool burnFirmware() const;
|
||||||
bool renameFwFiles() const;
|
bool renameFwFiles() const;
|
||||||
bool patchImage() const;
|
bool patchImage() const; //TODO This variable is unused and should be removed
|
||||||
int channelOrder() const;
|
int channelOrder() const;
|
||||||
int defaultMode() const;
|
int defaultMode() const;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,18 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||||
hexType(Type)
|
hexType(Type)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->libraryButton->setIcon(CompanionIcon("library.png"));
|
|
||||||
|
if(!g.profile[g.id()].splashFile().isEmpty()){
|
||||||
|
imageSource=PROFILE;
|
||||||
|
imageFile=g.profile[g.id()].splashFile();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ui->useProfileImageCB->setDisabled(true);
|
||||||
|
imageSource=FIRMWARE;
|
||||||
|
imageFile="";
|
||||||
|
}
|
||||||
|
updateUI();
|
||||||
|
|
||||||
ui->SplashFrame->hide();
|
ui->SplashFrame->hide();
|
||||||
ui->FramFWInfo->hide();
|
ui->FramFWInfo->hide();
|
||||||
ui->EEbackupCB->hide();
|
ui->EEbackupCB->hide();
|
||||||
|
@ -27,7 +38,6 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||||
ui->profile_label->hide();
|
ui->profile_label->hide();
|
||||||
ui->patchcalib_CB->hide();
|
ui->patchcalib_CB->hide();
|
||||||
ui->patchhw_CB->hide();
|
ui->patchhw_CB->hide();
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
setWindowTitle(tr("Write firmware to TX"));
|
setWindowTitle(tr("Write firmware to TX"));
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||||
ui->EEbackupCB->hide();
|
ui->EEbackupCB->hide();
|
||||||
|
@ -39,12 +49,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||||
ui->patchcalib_CB->hide();
|
ui->patchcalib_CB->hide();
|
||||||
ui->patchhw_CB->hide();
|
ui->patchhw_CB->hide();
|
||||||
ui->EEpromCB->hide();
|
ui->EEpromCB->hide();
|
||||||
ui->ImageLoadButton->setDisabled(true);
|
|
||||||
ui->libraryButton->setDisabled(true);
|
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
ui->BurnFlashButton->setDisabled(true);
|
ui->BurnFlashButton->setDisabled(true);
|
||||||
ui->ImageFileName->clear();
|
|
||||||
ui->FwImage->clear();
|
|
||||||
ui->FWFileName->clear();
|
ui->FWFileName->clear();
|
||||||
ui->DateField->clear();
|
ui->DateField->clear();
|
||||||
ui->SVNField->clear();
|
ui->SVNField->clear();
|
||||||
|
@ -124,12 +129,7 @@ void burnDialog::on_FlashLoadButton_clicked()
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
|
||||||
ui->ImageLoadButton->setDisabled(true);
|
|
||||||
ui->libraryButton->setDisabled(true);
|
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
ui->BurnFlashButton->setDisabled(true);
|
ui->BurnFlashButton->setDisabled(true);
|
||||||
ui->ImageFileName->clear();
|
|
||||||
ui->FwImage->clear();
|
|
||||||
ui->FWFileName->clear();
|
ui->FWFileName->clear();
|
||||||
ui->DateField->clear();
|
ui->DateField->clear();
|
||||||
ui->SVNField->clear();
|
ui->SVNField->clear();
|
||||||
|
@ -169,6 +169,7 @@ void burnDialog::on_FlashLoadButton_clicked()
|
||||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void burnDialog::checkFw(QString fileName)
|
void burnDialog::checkFw(QString fileName)
|
||||||
|
@ -194,48 +195,28 @@ void burnDialog::checkFw(QString fileName)
|
||||||
ui->BurnFlashButton->setText(tr("Write to TX"));
|
ui->BurnFlashButton->setText(tr("Write to TX"));
|
||||||
if (flash.hasSplash()) {
|
if (flash.hasSplash()) {
|
||||||
ui->SplashFrame->show();
|
ui->SplashFrame->show();
|
||||||
ui->ImageLoadButton->setEnabled(true);
|
|
||||||
ui->libraryButton->setEnabled(true);
|
|
||||||
ui->FwImage->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
|
|
||||||
ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
|
ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
|
||||||
ui->FwImage->show();
|
|
||||||
ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
|
||||||
QString ImageStr = g.profile[g.id()].splashFile();
|
QString ImageStr = g.profile[g.id()].splashFile();
|
||||||
bool PatchFwCB = g.profile[g.id()].patchImage();
|
|
||||||
if (!ImageStr.isEmpty()) {
|
if (!ImageStr.isEmpty()) {
|
||||||
QImage Image;
|
QImage Image;
|
||||||
Image.load(ImageStr);
|
Image.load(ImageStr);
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(Image.convertToFormat(flash.getSplashFormat())));
|
ui->imageLabel->setPixmap(QPixmap::fromImage(Image.convertToFormat(flash.getSplashFormat())));
|
||||||
ui->InvertColorButton->setEnabled(true);
|
|
||||||
ui->PreferredImageCB->setChecked(true);
|
|
||||||
ui->PatchFWCB->setChecked(PatchFwCB);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString fileName=ui->ImageFileName->text();
|
QString fileName=imageFile;
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
QImage image(fileName);
|
QImage image(fileName);
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
ui->InvertColorButton->setEnabled(true);
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat())));
|
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat())));
|
||||||
ui->PatchFWCB->setEnabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(PatchFwCB);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->PatchFWCB->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(false);
|
|
||||||
ui->PreferredImageCB->setDisabled(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->PatchFWCB->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(false);
|
|
||||||
ui->PreferredImageCB->setDisabled(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->FwImage->hide();
|
|
||||||
ui->ImageFileName->setText("");
|
|
||||||
ui->SplashFrame->hide();
|
ui->SplashFrame->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,87 +319,122 @@ bool burnDialog::checkeEprom(QString fileName)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void burnDialog::on_ImageLoadButton_clicked()
|
void burnDialog::displaySplash()
|
||||||
|
{
|
||||||
|
QImage image;
|
||||||
|
if (imageSource == FIRMWARE){
|
||||||
|
FlashInterface flash(ui->FWFileName->text());
|
||||||
|
image = flash.getSplash();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
image.load(imageFile);
|
||||||
|
}
|
||||||
|
if (image.isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ui->imageLabel->width()!=128) {
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void burnDialog::updateUI()
|
||||||
|
{
|
||||||
|
ui->useProfileImageCB->setChecked( imageSource == PROFILE );
|
||||||
|
ui->useFwImageCB->setChecked( imageSource == FIRMWARE );
|
||||||
|
ui->useLibraryImageCB->setChecked( imageSource == LIBRARY );
|
||||||
|
ui->useAnotherImageCB->setChecked( imageSource == ANOTHER );
|
||||||
|
|
||||||
|
displaySplash();
|
||||||
|
}
|
||||||
|
|
||||||
|
void burnDialog::on_useFwImageCB_clicked()
|
||||||
|
{
|
||||||
|
QString fileName = ui->FWFileName->text();
|
||||||
|
FlashInterface flash(fileName);
|
||||||
|
if (!flash.isValid()) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr( "The firmware file is not valid." ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!flash.hasSplash()) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr( "There is no start screen image in the firmware file." ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
imageSource = FIRMWARE;
|
||||||
|
imageFile = fileName;
|
||||||
|
updateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void burnDialog::on_useProfileImageCB_clicked()
|
||||||
|
{
|
||||||
|
QString fileName = g.profile[g.id()].splashFile();
|
||||||
|
if (fileName.isEmpty()){
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr( "The radio profile has no defined start screen." ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QImage image(fileName);
|
||||||
|
if (image.isNull()) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not seem to contain an image.").arg(fileName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
imageSource = PROFILE;
|
||||||
|
imageFile = fileName;
|
||||||
|
updateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void burnDialog::on_useAnotherImageCB_clicked()
|
||||||
{
|
{
|
||||||
QString supportedImageFormats;
|
QString supportedImageFormats;
|
||||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||||
}
|
}
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
if (fileName.isEmpty()){
|
||||||
tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
return;
|
||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
|
||||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
|
||||||
QImage image(fileName);
|
|
||||||
if (image.isNull()) {
|
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
|
||||||
ui->PatchFWCB->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(false);
|
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ui->ImageFileName->setText(fileName);
|
|
||||||
ui->InvertColorButton->setEnabled(true);
|
|
||||||
if (ui->imageLabel->width()!=128) {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
|
|
||||||
}
|
|
||||||
ui->PatchFWCB->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||||
|
QImage image(fileName);
|
||||||
|
if (image.isNull()) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
imageSource = ANOTHER;
|
||||||
|
imageFile = fileName;
|
||||||
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void burnDialog::on_libraryButton_clicked()
|
void burnDialog::on_useLibraryImageCB_clicked()
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName;
|
||||||
splashLibrary *ld = new splashLibrary(this,&fileName);
|
splashLibrary *ld = new splashLibrary(this,&fileName);
|
||||||
ld->exec();
|
ld->exec();
|
||||||
if (!fileName.isEmpty()) {
|
if (fileName.isEmpty()) {
|
||||||
QImage image(fileName);
|
return;
|
||||||
if (image.isNull()) {
|
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
|
||||||
ui->PatchFWCB->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(false);
|
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ui->ImageFileName->setText(fileName);
|
|
||||||
ui->InvertColorButton->setEnabled(true);
|
|
||||||
if (ui->imageLabel->width()!=128) {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
|
||||||
} else {
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
|
|
||||||
}
|
|
||||||
ui->PatchFWCB->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
QImage image(fileName);
|
||||||
|
if (image.isNull()) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
imageSource = LIBRARY;
|
||||||
|
imageFile = fileName;
|
||||||
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void burnDialog::on_BurnFlashButton_clicked()
|
void burnDialog::on_BurnFlashButton_clicked()
|
||||||
|
@ -428,11 +444,10 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||||
g.lastFw( fileName );
|
g.lastFw( fileName );
|
||||||
if (ui->PatchFWCB->isChecked()) {
|
if (!ui->useFwImageCB->isChecked()) {
|
||||||
g.profile[g.id()].patchImage( true );
|
|
||||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
|
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
QString tempDir = QDir::tempPath();
|
QString tempDir = QDir::tempPath();
|
||||||
QString tempFile;
|
QString tempFile;
|
||||||
if (getFileType(fileName) == FILE_TYPE_HEX)
|
if (getFileType(fileName) == FILE_TYPE_HEX)
|
||||||
tempFile = tempDir + "/flash.hex";
|
tempFile = tempDir + "/flash.hex";
|
||||||
|
@ -452,7 +467,6 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||||
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
|
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g.profile[g.id()].patchImage( false );
|
|
||||||
hexfileName->clear();
|
hexfileName->clear();
|
||||||
hexfileName->append(fileName);
|
hexfileName->append(fileName);
|
||||||
}
|
}
|
||||||
|
@ -610,15 +624,6 @@ void burnDialog::on_cancelButton_clicked()
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void burnDialog::on_InvertColorButton_clicked()
|
|
||||||
{
|
|
||||||
if (ui->imageLabel->pixmap()) {
|
|
||||||
QImage image = ui->imageLabel->pixmap()->toImage();
|
|
||||||
image.invertPixels();
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void burnDialog::on_EEpromCB_toggled(bool checked)
|
void burnDialog::on_EEpromCB_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (ui->EEpromCB->isChecked()) {
|
if (ui->EEpromCB->isChecked()) {
|
||||||
|
@ -628,83 +633,6 @@ void burnDialog::on_EEpromCB_toggled(bool checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void burnDialog::on_PreferredImageCB_toggled(bool checked)
|
|
||||||
{
|
|
||||||
QString tmpFileName;
|
|
||||||
if (checked) {
|
|
||||||
QString ImageStr = g.profile[g.id()].splashFile();
|
|
||||||
if (!ImageStr.isEmpty()) {
|
|
||||||
QImage Image;
|
|
||||||
Image.load( ImageStr );
|
|
||||||
if (ui->imageLabel->width()!=128) {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Image=Image.convertToFormat(QImage::Format_Mono);
|
|
||||||
}
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(Image));
|
|
||||||
ui->InvertColorButton->setEnabled(true);
|
|
||||||
ui->PreferredImageCB->setChecked(true);
|
|
||||||
ui->ImageFileName->setDisabled(true);
|
|
||||||
ui->ImageLoadButton->setDisabled(true);
|
|
||||||
ui->libraryButton->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setEnabled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ui->imageLabel->clear();
|
|
||||||
ui->ImageLoadButton->setEnabled(true);
|
|
||||||
ui->libraryButton->setEnabled(true);
|
|
||||||
tmpFileName = ui->ImageFileName->text();
|
|
||||||
if (!tmpFileName.isEmpty()) {
|
|
||||||
QImage image(tmpFileName);
|
|
||||||
if (!image.isNull()) {
|
|
||||||
if (ui->imageLabel->width()!=128) {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
image=image.convertToFormat(QImage::Format_Mono);
|
|
||||||
}
|
|
||||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
|
||||||
ui->InvertColorButton->setEnabled(true);
|
|
||||||
ui->ImageFileName->setEnabled(true);
|
|
||||||
ui->PatchFWCB->setDisabled(false);
|
|
||||||
} else {
|
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ui->InvertColorButton->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setDisabled(true);
|
|
||||||
ui->PatchFWCB->setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void burnDialog::shrink()
|
void burnDialog::shrink()
|
||||||
{
|
{
|
||||||
resize(0,0);
|
resize(0,0);
|
||||||
|
|
|
@ -36,18 +36,22 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_FlashLoadButton_clicked();
|
void on_FlashLoadButton_clicked();
|
||||||
void on_ImageLoadButton_clicked();
|
|
||||||
void on_libraryButton_clicked();
|
|
||||||
void on_BurnFlashButton_clicked();
|
void on_BurnFlashButton_clicked();
|
||||||
void on_cancelButton_clicked();
|
void on_cancelButton_clicked();
|
||||||
void on_InvertColorButton_clicked();
|
|
||||||
void on_EEbackupCB_clicked();
|
void on_EEbackupCB_clicked();
|
||||||
void on_PreferredImageCB_toggled(bool checked);
|
void on_EEpromCB_toggled(bool checked);
|
||||||
void on_EEpromCB_toggled(bool checked);
|
|
||||||
void checkFw(QString fileName);
|
|
||||||
bool checkeEprom(QString fileName);
|
bool checkeEprom(QString fileName);
|
||||||
|
void on_useProfileImageCB_clicked();
|
||||||
|
void on_useFwImageCB_clicked();
|
||||||
|
void on_useLibraryImageCB_clicked();
|
||||||
|
void on_useAnotherImageCB_clicked();
|
||||||
|
|
||||||
|
void checkFw(QString fileName);
|
||||||
|
void displaySplash();
|
||||||
|
void updateUI();
|
||||||
void shrink();
|
void shrink();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::burnDialog *ui;
|
Ui::burnDialog *ui;
|
||||||
QString * hexfileName;
|
QString * hexfileName;
|
||||||
|
@ -55,6 +59,9 @@ private:
|
||||||
int hexType;
|
int hexType;
|
||||||
RadioData radioData;
|
RadioData radioData;
|
||||||
bool burnraw;
|
bool burnraw;
|
||||||
|
enum ImageSource {FIRMWARE, PROFILE, LIBRARY, ANOTHER};
|
||||||
|
ImageSource imageSource;
|
||||||
|
QString imageFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BURNDIALOG_H
|
#endif // BURNDIALOG_H
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>440</width>
|
<width>440</width>
|
||||||
<height>418</height>
|
<height>423</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -30,21 +30,8 @@
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hs2">
|
<spacer name="hs2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -71,19 +58,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="BurnFlashButton">
|
<widget class="QPushButton" name="BurnFlashButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -100,19 +74,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="hs2_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>48</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -152,56 +113,22 @@
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item row="0" column="2" rowspan="3">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="FwImage">
|
<widget class="QLineEdit" name="SVNField">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>128</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>212</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::Panel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="DateField">
|
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="dateLabel">
|
<widget class="QLabel" name="buildLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Date & Time</string>
|
<string>Variant</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="SVNField">
|
<widget class="QLineEdit" name="ModField">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -214,17 +141,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QLineEdit" name="ModField">
|
<widget class="QLabel" name="dateLabel">
|
||||||
<property name="readOnly">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>Date & Time</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="buildLabel">
|
<widget class="QLineEdit" name="DateField">
|
||||||
<property name="text">
|
<property name="readOnly">
|
||||||
<string>Variant</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -325,17 +252,10 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,1">
|
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
|
||||||
<item row="0" column="1" rowspan="4">
|
<item row="0" column="1" rowspan="7">
|
||||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,0">
|
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1">
|
||||||
<item row="1" column="0">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="InvertColorButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Invert Color</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="imageLabel">
|
<widget class="QLabel" name="imageLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
@ -369,10 +289,50 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="PreferredImageCB">
|
<widget class="QCheckBox" name="useFwImageCB">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use firmware start screen</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QCheckBox" name="useAnotherImageCB">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use another start screen</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="useProfileImageCB">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -380,86 +340,14 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use image in settings</string>
|
<string>Use profile start screen</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="PatchFWCB">
|
|
||||||
<property name="text">
|
|
||||||
<string>Substitute image in firmware</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<spacer name="verticalSpacer_3">
|
<widget class="QCheckBox" name="useLibraryImageCB">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>13</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>13</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="ImageFileName">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="ImageLoadButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Image</string>
|
<string>Use library start screen</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="libraryButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Open Splash Library</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -470,14 +358,24 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>FWFileName</tabstop>
|
<tabstop>FWFileName</tabstop>
|
||||||
<tabstop>FlashLoadButton</tabstop>
|
<tabstop>FlashLoadButton</tabstop>
|
||||||
<tabstop>ImageFileName</tabstop>
|
|
||||||
<tabstop>ImageLoadButton</tabstop>
|
|
||||||
<tabstop>libraryButton</tabstop>
|
|
||||||
<tabstop>EEbackupCB</tabstop>
|
<tabstop>EEbackupCB</tabstop>
|
||||||
<tabstop>EEpromCB</tabstop>
|
<tabstop>EEpromCB</tabstop>
|
||||||
<tabstop>cancelButton</tabstop>
|
<tabstop>cancelButton</tabstop>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue