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:
@@ -15,6 +15,7 @@ Side::Side(){
|
|||||||
saveButton = 0;
|
saveButton = 0;
|
||||||
saveToFileName = new QString("");
|
saveToFileName = new QString("");
|
||||||
source = new Source(UNDEFINED);
|
source = new Source(UNDEFINED);
|
||||||
|
format = new LCDFormat(LCDTARANIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Side::copyImage( Side side )
|
void Side::copyImage( Side side )
|
||||||
@@ -36,14 +37,17 @@ bool Side::displayImage( QString fileName, Source pictSource )
|
|||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
image = flash.getSplash();
|
image = flash.getSplash();
|
||||||
|
*format = flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
image.load(fileName);
|
image.load(fileName);
|
||||||
|
if (pictSource== PICT)
|
||||||
|
*format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X;
|
||||||
}
|
}
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (imageLabel->width()==424) {
|
if (*format==LCDTARANIS) {
|
||||||
image=image.convertToFormat(QImage::Format_RGB32);
|
image=image.convertToFormat(QImage::Format_RGB32);
|
||||||
QRgb col;
|
QRgb col;
|
||||||
int gray;
|
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)));
|
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)));
|
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){
|
switch (pictSource){
|
||||||
case FW:
|
case FW:
|
||||||
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
|
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
|
||||||
|
|||||||
@@ -10,7 +10,13 @@ namespace Ui
|
|||||||
class customizeSplashDialog;
|
class customizeSplashDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int WIDTH_TARANIS = 212;
|
||||||
|
const int HEIGHT_TARANIS = 64;
|
||||||
|
const int WIDTH_9X = 128;
|
||||||
|
const int HEIGHT_9X = 64;
|
||||||
|
|
||||||
enum Source {FW, PICT, PROFILE, UNDEFINED};
|
enum Source {FW, PICT, PROFILE, UNDEFINED};
|
||||||
|
enum LCDFormat {LCD9X, LCDTARANIS};
|
||||||
|
|
||||||
class Side
|
class Side
|
||||||
{
|
{
|
||||||
@@ -31,6 +37,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Source *source;
|
Source *source;
|
||||||
|
LCDFormat *format;
|
||||||
};
|
};
|
||||||
|
|
||||||
class customizeSplashDialog : public QDialog
|
class customizeSplashDialog : public QDialog
|
||||||
|
|||||||
Reference in New Issue
Block a user