Commit 8d9ccd8d authored by Dmitry Kazakov's avatar Dmitry Kazakov

Ask the user about the resolution he wants to use for loading SVG images

BUG:395074
parent 92ef7958
......@@ -210,6 +210,16 @@ void KisConfig::defImageResolution(qreal res) const
m_cfg.writeEntry("imageResolutionDef", res*72.0);
}
int KisConfig::preferredVectorImportResolutionPPI(bool defaultValue) const
{
return defaultValue ? 100.0 : m_cfg.readEntry("preferredVectorImportResolution", 100.0);
}
void KisConfig::setPreferredVectorImportResolutionPPI(int value) const
{
m_cfg.writeEntry("preferredVectorImportResolution", value);
}
void cleanOldCursorStyleKeys(KConfigGroup &cfg)
{
if (cfg.hasKey("newCursorStyle") &&
......
......@@ -73,6 +73,9 @@ public:
qreal defImageResolution(bool defaultValue = false) const;
void defImageResolution(qreal res) const;
int preferredVectorImportResolutionPPI(bool defaultValue = false) const;
void setPreferredVectorImportResolutionPPI(int value) const;
/**
* @return the id of the default color model used for creating new images.
*/
......
......@@ -21,7 +21,9 @@
#include <kpluginfactory.h>
#include <QFileInfo>
#include "kis_config.h"
#include <QInputDialog>
#include <KisDocument.h>
#include <kis_image.h>
......@@ -48,7 +50,26 @@ KisImportExportFilter::ConversionStatus KisSVGImport::convert(KisDocument *docum
const QString baseXmlDir = QFileInfo(filename()).canonicalPath();
const qreal resolutionPPI = 100;
KisConfig cfg;
qreal resolutionPPI = cfg.preferredVectorImportResolutionPPI(true);
if (!batchMode()) {
bool okay = false;
const QString name = QFileInfo(filename()).fileName();
resolutionPPI = QInputDialog::getInt(0,
i18n("Import SVG"),
i18n("Enter preferred resolution (PPI) for \"%1\"", name),
cfg.preferredVectorImportResolutionPPI(),
0, 100000, 1, &okay);
if (!okay) {
return KisImportExportFilter::UserCancelled;
}
cfg.setPreferredVectorImportResolutionPPI(resolutionPPI);
}
const qreal resolution = resolutionPPI / 72.0;
QSizeF fragmentSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment