Little fixes

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-04-04 20:57:36 +03:00
parent 84d6e157bb
commit c002aec49a
2 changed files with 3 additions and 7 deletions

View File

@ -620,10 +620,6 @@ QImage DialogPatternProperties::GetImage()
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::ReadOnly); buffer.open(QIODevice::ReadOnly);
QString extension = doc->GetImageExtension(); QString extension = doc->GetImageExtension();
if (extension.isEmpty())
{
extension = "PNG";
}
image.load(&buffer, extension.toLatin1().data()); // writes image into ba in 'extension' format image.load(&buffer, extension.toLatin1().data()); // writes image into ba in 'extension' format
return image; return image;
} }
@ -661,7 +657,7 @@ void DialogPatternProperties::ChangeImage()
} }
else else
{ {
if (!image.load(fileName)) if (not image.load(fileName))
{ {
return; return;
} }
@ -700,7 +696,7 @@ void DialogPatternProperties::SaveImage()
QByteArray byteArray; QByteArray byteArray;
byteArray.append(doc->GetImage().toUtf8()); byteArray.append(doc->GetImage().toUtf8());
QByteArray ba = QByteArray::fromBase64(byteArray); QByteArray ba = QByteArray::fromBase64(byteArray);
const QString extension = "." + doc->GetImageExtension(); const QString extension = QLatin1String(".") + doc->GetImageExtension();
QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")"); QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")");
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter); QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter);
if (not filename.isEmpty()) if (not filename.isEmpty())

View File

@ -968,7 +968,7 @@ void VAbstractPattern::SetImage(const QString &text, const QString &extension)
void VAbstractPattern::DeleteImage() void VAbstractPattern::DeleteImage()
{ {
QDomElement pattern = documentElement(); QDomElement pattern = documentElement();
QDomNodeList images = this->elementsByTagName(TagImage); const QDomNodeList images = this->elementsByTagName(TagImage);
for (int i=0; i<images.count(); ++i) for (int i=0; i<images.count(); ++i)
{ {
QDomNode image = images.at(i); QDomNode image = images.at(i);