1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 17:55:19 +03:00

Made the Splash editor respect the 9x/Taranis LCD widths in a consistent way. Previously everything was displayed as a Taranis bitmap.

Pictures larger than 9x width will get scaled to Taranis width (212 pix).
This commit is contained in:
Kjell Kernen 2014-02-11 18:08:54 +01:00
parent 9caa0f1e3b
commit 48af7aefd0
2 changed files with 19 additions and 3 deletions

View file

@ -15,6 +15,7 @@ Side::Side(){
saveButton = 0;
saveToFileName = new QString("");
source = new Source(UNDEFINED);
format = new LCDFormat(LCDTARANIS);
}
void Side::copyImage( Side side )
@ -36,14 +37,17 @@ bool Side::displayImage( QString fileName, Source pictSource )
return false;
else
image = flash.getSplash();
*format = flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X;
}
else {
image.load(fileName);
if (pictSource== PICT)
*format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X;
}
if (image.isNull()) {
return false;
}
if (imageLabel->width()==424) {
if (*format==LCDTARANIS) {
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
@ -58,9 +62,14 @@ bool Side::displayImage( QString fileName, Source pictSource )
}
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2)));
}
else {
else
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
}
if (*format == LCD9X)
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
else
imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2);
switch (pictSource){
case FW:
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));