diff options
author | Georg Zotti <Georg.Zotti@univie.ac.at> | 2023-03-18 19:25:12 +0100 |
---|---|---|
committer | Georg Zotti <Georg.Zotti@univie.ac.at> | 2023-03-18 19:25:12 +0100 |
commit | 67d8bc6e97a2ef14258e5a8baa3d11a6c7de0d73 (patch) | |
tree | 66077c1ef07ae49417683b8728e8fc2b0ac42e2d | |
parent | 468ab9b2b8379442948cb70118cf3e640a0e7108 (diff) |
Add a check for screenshot file format
-rw-r--r-- | src/scripting/StelMainScriptAPI.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/scripting/StelMainScriptAPI.cpp b/src/scripting/StelMainScriptAPI.cpp index a1fbaeec54..a652166061 100644 --- a/src/scripting/StelMainScriptAPI.cpp +++ b/src/scripting/StelMainScriptAPI.cpp @@ -342,11 +342,18 @@ QStringList StelMainScriptAPI::getAllTimezoneNames() void StelMainScriptAPI::screenshot(const QString& prefix, bool invert, const QString& dir, const bool overwrite, const QString &format) { - bool oldInvertSetting = StelMainView::getInstance().getFlagInvertScreenShotColors(); - QString oldFormat=StelMainView::getInstance().getScreenshotFormat(); - StelMainView::getInstance().setFlagInvertScreenShotColors(invert); + const bool oldInvertSetting = StelMainView::getInstance().getFlagInvertScreenShotColors(); + const QString oldFormat=StelMainView::getInstance().getScreenshotFormat(); if ((format.length()>0) && (format.length()<=4)) StelMainView::getInstance().setScreenshotFormat(format); + // Check requested against set image format. + if (StelMainView::getInstance().getScreenshotFormat() != format) + { + qWarning() << "Screenshot format" << format << "not supported. Not saving screenshot."; + return; + } + + StelMainView::getInstance().setFlagInvertScreenShotColors(invert); StelMainView::getInstance().setFlagOverwriteScreenShots(overwrite); StelMainView::getInstance().saveScreenShot(prefix, dir, overwrite); StelMainView::getInstance().setFlagInvertScreenShotColors(oldInvertSetting); |