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

Ralf Habacker ralf.habacker at gmail.com
Mon Mar 19 11:49:49 UTC 2012


SVN commit 1286276 by habacker:

Made ActivityWidget, StateWidget and SignalWidget type string
accessable by dot export and layout generator config.

CCBUG: 295600
CCBUG: 67059

 M  +12 -3     dotgenerator.cpp  
 M  +8 -0      widgets/activitywidget.cpp  
 M  +4 -1      widgets/activitywidget.h  
 M  +8 -0      widgets/signalwidget.cpp  
 M  +4 -0      widgets/signalwidget.h  
 M  +8 -0      widgets/statewidget.cpp  
 M  +1 -6      widgets/statewidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/dotgenerator.cpp #1286275:1286276
@@ -12,8 +12,10 @@
 #include "dotgenerator.h"
 
 // app includes
+#include "activitywidget.h"
 #include "associationwidget.h"
 #include "classifierwidget.h"
+#include "signalwidget.h"
 #include "statewidget.h"
 #include "debug_utils.h"
 #include "umlwidget.h"
@@ -309,19 +311,26 @@
             params  << QString("pos=\"%1,%2\"").arg(widget->getX()+widget->getWidth()/2).arg(widget->getY()+widget->getHeight()/2);
 
         QString type = QString(widget->baseTypeStr()).toLower().remove("wt_");
-        QString key = "type::" + type;
 
         if (type == "state") {
             StateWidget *w = static_cast<StateWidget *>(widget);
             type = w->stateTypeStr().toLower();
         }
+        else if (type == "activity") {
+            ActivityWidget *w = static_cast<ActivityWidget *>(widget);
+            type = w->activityTypeStr().toLower();
+        }
+        else if (type == "signal") {
+            SignalWidget *w = static_cast<SignalWidget *>(widget);
+            type = w->signalTypeStr().toLower();
+        }
 
-        key = "type::" + type;
+        QString key = "type::" + type;
 
         QString label;
 
         if (!useFullNodeLabels())
-            label = widget->name();
+            label = widget->name() + "\\n" + type;
         else {
             DotPaintDevice d;
             QPainter p(&d);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.cpp #1286275:1286276
@@ -54,6 +54,14 @@
 }
 
 /**
+ * Returns the type string of activity.
+ */
+QString ActivityWidget::activityTypeStr() const
+{
+    return QLatin1String(ENUM_NAME(ActivityWidget, ActivityType, m_activityType));
+}
+
+/**
  * Sets the type of activity.
  */
 void ActivityWidget::setActivityType( ActivityType activityType )
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.h #1286275:1286276
@@ -11,6 +11,8 @@
 #ifndef ACTIVITYWIDGET_H
 #define ACTIVITYWIDGET_H
 
+#include <QMetaEnum>
+
 #include "umlwidget.h"
 #include "worktoolbar.h"
 
@@ -33,7 +35,7 @@
 class ActivityWidget : public UMLWidget
 {
     Q_OBJECT
-
+    Q_ENUMS(ActivityType)
 public:
     enum ActivityType
     {
@@ -50,6 +52,7 @@
     virtual ~ActivityWidget();
 
     ActivityType activityType() const;
+    QString activityTypeStr() const;
     void setActivityType( ActivityType activityType );
 
     static bool isActivity( WorkToolBar::ToolBar_Buttons tbb,
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/signalwidget.cpp #1286275:1286276
@@ -205,6 +205,14 @@
 }
 
 /**
+ * Returns the type string of Signal.
+ */
+QString SignalWidget::signalTypeStr() const
+{
+    return QLatin1String(ENUM_NAME(SignalWidget, SignalType, m_signalType));
+}
+
+/**
  * Sets the type of Signal.
  */
 void SignalWidget::setSignalType( SignalType signalType )
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/signalwidget.h #1286275:1286276
@@ -11,6 +11,8 @@
 #ifndef SIGNALWIDGET_H
 #define SIGNALWIDGET_H
 
+#include <QMetaEnum>
+
 #include "floatingtextwidget.h"
 #include "linkwidget.h"
 #include "umlwidget.h"
@@ -27,6 +29,7 @@
 class SignalWidget : public UMLWidget
 {
     Q_OBJECT
+    Q_ENUMS(SignalType)
 public:
     /// Enumeration that codes the different types of signal.
     enum SignalType
@@ -48,6 +51,7 @@
     virtual QString getName() const;
 
     SignalType getSignalType() const;
+    QString signalTypeStr() const;
     void setSignalType( SignalType signalType );
 
     virtual void  showPropertiesDialog();
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/statewidget.cpp #1286275:1286276
@@ -274,6 +274,14 @@
 }
 
 /**
+ * Returns the type string of state.
+ */
+QString StateWidget::stateTypeStr() const
+{
+    return QLatin1String(ENUM_NAME(StateWidget, StateType, m_stateType));
+}
+
+/**
  * Sets the type of state.
  */
 void StateWidget::setStateType(StateType stateType)
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/statewidget.h #1286275:1286276
@@ -15,7 +15,6 @@
 #include <QtCore/QStringList>
 #include <QMetaEnum>
 
-#include "debug_utils.h"
 #include "umlwidget.h"
 #include "worktoolbar.h"
 
@@ -69,11 +68,7 @@
     virtual void setName(const QString &strName);
 
     StateType stateType() const;
-    QString stateTypeStr() const
-    {
-        return QLatin1String(ENUM_NAME(StateWidget, StateType, m_stateType));
-    }
-
+    QString stateTypeStr() const;
     void setStateType(StateType stateType);
 
     bool addActivity(const QString &activity);




More information about the umbrello-devel mailing list