Little optimization

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-03-22 20:46:17 +02:00
parent 1d959cb747
commit ecfdafddfc

View File

@ -663,16 +663,16 @@ void DialogPatternProperties::SetNewImage()
QFileInfo f(fileName); QFileInfo f(fileName);
QString extension = f.suffix().toUpper(); QString extension = f.suffix().toUpper();
if (extension == "JPEG") if (extension == QLatin1String("JPEG"))
{ {
extension = "JPG"; extension = "JPG";
} }
if (extension == "PNG" || extension == "JPG" || extension == "BMP") if (extension == QLatin1String("PNG") || extension == QLatin1String("JPG") || extension == QLatin1String("BMP"))
{ {
QByteArray byteArray; QByteArray byteArray;
QBuffer buffer(&byteArray); QBuffer buffer(&byteArray);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
image.save(&buffer, extension.toLatin1().data()); // writes the image in 'extension' format inside the buffer image.save(&buffer, extension.toLatin1().data()); //writes the image in 'extension' format inside the buffer
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data()); QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
// save our image to file.val // save our image to file.val