[Uml-devel] KDE/kdesdk/umbrello/umbrello

Ralf Habacker ralf.habacker at gmail.com
Mon Mar 12 02:05:50 UTC 2012


SVN commit 1285085 by habacker:

Made dot node attributes overridable through config file.

 M  +19 -6     dotgenerator.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/dotgenerator.h #1285084:1285085
@@ -176,6 +176,15 @@
         return true;
     }
 
+    bool findItem(QStringList &params, const QString &search)
+    {
+        foreach(const QString &s, params) {
+            if (s.startsWith(search))
+                return true;
+        }
+        return false;
+    }
+
     /**
      * Create dot file using displayed widgets
      * and associations of the provided scene
@@ -203,11 +212,8 @@
             QStringList params;
 
             if (m_nodeParameters.contains("all"))
-                params << m_nodeParameters["all"];
+                params << m_nodeParameters["all"].split(',');
 
-            params  << QString("width=\"%1\"").arg(widget->getWidth()/m_scale)
-                    << QString("height=\"%1\"").arg(widget->getHeight()/m_scale);
-
             if (usePosition())
                 params  << QString("pos=\"%1,%2\"").arg(widget->getX()+widget->getWidth()/2).arg(widget->getY()+widget->getHeight()/2);
 
@@ -222,12 +228,19 @@
             QString label = widget->name() + "\\n" + type;
 
             if (m_nodeParameters.contains(key))
-                params << m_nodeParameters[key];
+                params << m_nodeParameters[key].split(',');
             else if (m_nodeParameters.contains("type::default"))
-                params << m_nodeParameters["type::default"];
+                params << m_nodeParameters["type::default"].split(',');
 
+            if (!findItem(params,"label="))
             params << QString("label=\"%1\"").arg(label);
 
+            if (!findItem(params,"width="))
+                params << QString("width=\"%1\"").arg(widget->getWidth()/m_scale);
+
+            if (!findItem(params,"height="))
+                params << QString("height=\"%1\"").arg(widget->getHeight()/m_scale);
+
 #ifdef DOTGENERATOR_DATA_DEBUG
             uDebug() << type << params;
 #endif




More information about the umbrello-devel mailing list