Add support for more images formats (#436)

* Add support for more images formats

* Resolves extension verifying  in case of empty save path string

* Code formatting
This commit is contained in:
Pavel Makarenko
2019-01-30 17:37:56 +03:00
committed by Dharkael
parent 25246a79f0
commit 8887b4e7ce

View File

@@ -60,15 +60,19 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap &capture) {
QString savePath = QFileDialog::getSaveFileName(
nullptr,
QString(),
FileNameHandler().absoluteSavePath() + ".png");
FileNameHandler().absoluteSavePath() + ".png",
QLatin1String("Portable Network Graphic file (PNG) (*.png);;BMP file (*.bmp);;JPEG file (*.jpg)"));
if (savePath.isNull()) {
break;
}
if (!savePath.endsWith(QLatin1String(".png"))) {
savePath += QLatin1String(".png");
}
if (!savePath.endsWith(QLatin1String(".png"), Qt::CaseInsensitive) &&
!savePath.endsWith(QLatin1String(".bmp"), Qt::CaseInsensitive) &&
!savePath.endsWith(QLatin1String(".jpg"), Qt::CaseInsensitive)) {
savePath += QLatin1String(".png");
}
ok = capture.save(savePath);