[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    [calligra/calligra/2.9] krita/image/brushengine: Remove the texture options if the texture option is
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2015-04-19 20:42:14
Message-ID: E1Yjw2g-0005OS-1J () scm ! kde ! org
[Download RAW message or body]

Git commit 6b1ba119aeda74d7837e9cd329f11a7be5ecb842 by Boudewijn Rempt.
Committed on 19/04/2015 at 20:40.
Pushed by rempt into branch 'calligra/2.9'.

Remove the texture options if the texture option is unchecked on load and save

We always saved a big texture to our presets, no matter whether the
option was enabled or not. This really killed us on loading presets,
because they were all as huge as the currently selected preset!

Our presets and especially the default presets can be cleaned up now.

CCMAIL:kimageshop@kde.org

M  +19   -1    krita/image/brushengine/kis_paintop_preset.cpp

http://commits.kde.org/calligra/6b1ba119aeda74d7837e9cd329f11a7be5ecb842

diff --git a/krita/image/brushengine/kis_paintop_preset.cpp \
b/krita/image/brushengine/kis_paintop_preset.cpp index b48214a..6ff30e5 100644
--- a/krita/image/brushengine/kis_paintop_preset.cpp
+++ b/krita/image/brushengine/kis_paintop_preset.cpp
@@ -264,6 +264,16 @@ void KisPaintOpPreset::toXML(QDomDocument& doc, QDomElement& \
elt) const  elt.setAttribute("paintopid", paintopid);
     elt.setAttribute("name", name());
 
+    // sanitize the settings
+    bool hasTexture = m_d->settings->getBool("Texture/Pattern/Enabled");
+    if (!hasTexture) {
+        foreach(const QString & key, m_d->settings->getProperties().keys()) {
+            if (key.startsWith("Texture") && key != "Texture/Pattern/Enabled") {
+                m_d->settings->removeProperty(key);
+            }
+        }
+    }
+
     m_d->settings->toXML(doc, elt);
 }
 
@@ -294,7 +304,15 @@ void KisPaintOpPreset::fromXML(const QDomElement& presetElt)
     }
 
     settings->fromXML(presetElt);
-
+    // sanitize the settings
+    bool hasTexture = settings->getBool("Texture/Pattern/Enabled");
+    if (!hasTexture) {
+        foreach(const QString & key, settings->getProperties().keys()) {
+            if (key.startsWith("Texture") && key != "Texture/Pattern/Enabled") {
+                settings->removeProperty(key);
+            }
+        }
+    }
     setSettings(settings);
 
 }

_______________________________________________
Krita mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic