[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello

Caroline Bourdeu d'Aguerre cbda at free.fr
Fri Feb 23 15:11:18 UTC 2007


SVN commit 636615 by bourdeu:

Add the the possibility to model an activity invok.


 M  +35 -4     activitywidget.cpp  
 M  +17 -0     activitywidget.h  
 M  +6 -0      dialogs/activitydialog.cpp  
 M  +1 -1      dialogs/activitydialog.h  


--- branches/work/isi-umbrello/umbrello/umbrello/activitywidget.cpp #636614:636615
@@ -40,6 +40,7 @@
     UMLWidget::setBaseType( Uml::wt_Activity );
     setActivityType( activityType );
     updateComponentSize();
+    setShowInvok( false );
 }
 
 ActivityWidget::~ActivityWidget() {}
@@ -47,11 +48,10 @@
 void ActivityWidget::draw(QPainter & p, int offsetX, int offsetY) {
     int w = width();
     int h = height();
-
+kDebug ()<<"tata!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!le draw"<<endl;
     // Only for the final activity
-    float delta;
-    float x,x0,temp;
-    float y,y0;
+    float x;
+    float y;
     QPen pen = p.pen();
 
     switch ( m_ActivityType )
@@ -71,6 +71,18 @@
             p.setFont( UMLWidget::getFont() );
             p.drawText(offsetX + ACTIVITY_MARGIN, offsetY + textStartY,
                        w - ACTIVITY_MARGIN * 2, fontHeight, Qt::AlignCenter, getName());
+
+            // if the activity is an invok activity
+            if ( m_NormalActivityType )
+            {
+                 x = offsetX + w - (w/5);
+                 y = offsetY + h - (h/3);
+
+                 p.drawLine(x,      y,      x,      y + 20);
+                 p.drawLine(x - 10, y + 10, x + 10, y + 10);
+                 p.drawLine(x - 10, y + 10, x - 10, y + 20);
+                 p.drawLine(x + 10, y + 10, x + 10, y + 20);
+            }
         }
         UMLWidget::setPen(p);
         break;
@@ -139,6 +151,12 @@
         height = height > ACTIVITY_HEIGHT ? height : ACTIVITY_HEIGHT;
         width += ACTIVITY_MARGIN * 2;
         height += ACTIVITY_MARGIN * 2;
+
+        if (m_NormalActivityType)
+        {
+             height += 40;
+        }
+
     } else if ( m_ActivityType == Branch ) {
         width = height = 20;
     }
@@ -154,6 +172,16 @@
     UMLWidget::m_bResizable = (m_ActivityType == Normal);
 }
 
+void ActivityWidget::setShowInvok(bool invok)
+{
+    m_NormalActivityType = invok;
+    updateComponentSize();
+}
+
+bool ActivityWidget::getShowInvok()
+{
+     return ( m_NormalActivityType);
+}
 void ActivityWidget::slotMenuSelection(int sel) {
     bool done = false;
 
@@ -230,6 +258,7 @@
     activityElement.setAttribute( "activityname", m_Text );
     activityElement.setAttribute( "documentation", m_Doc );
     activityElement.setAttribute( "activitytype", m_ActivityType );
+    activityElement.setAttribute( "normalactivitytype", m_NormalActivityType );
     qElement.appendChild( activityElement );
 }
 
@@ -240,6 +269,8 @@
     m_Doc = qElement.attribute( "documentation", "" );
     QString type = qElement.attribute( "activitytype", "1" );
     setActivityType( (ActivityType)type.toInt() );
+    type = qElement.attribute( "normalactivitytype");
+    setShowInvok( (bool)type.toInt() );
     return true;
 }
 
--- branches/work/isi-umbrello/umbrello/umbrello/activitywidget.h #636614:636615
@@ -95,6 +95,16 @@
                             ActivityType& resultType );
 
     /**
+     * Sets the type of a normal activity: invok or not.
+     */
+    void setShowInvok(bool invok);
+
+    /**
+     * Return the type of a normal activity: invok or not.
+     */
+    bool getShowInvok();
+
+    /**
      * Saves the widget to the <activitywidget> XMI element.
      */
     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
@@ -115,6 +125,13 @@
      */
     ActivityType m_ActivityType;
 
+
+    /**
+     * Type of normal activity (Invok or not).
+     * This function is call by the dialog box properties
+     */
+    bool m_NormalActivityType;
+
 public slots:
 
     /**
--- branches/work/isi-umbrello/umbrello/umbrello/dialogs/activitydialog.cpp #636614:636615
@@ -19,6 +19,7 @@
 #include <QFrame>
 #include <QHBoxLayout>
 #include <QGridLayout>
+#include <QCheckBox>
 #include <kvbox.h>
 //kde includes
 #include <kiconloader.h>
@@ -68,6 +69,7 @@
     {
         m_pActivityWidget -> setName( m_GenPageWidgets.nameLE -> text() );
         m_pActivityWidget -> setDoc( m_GenPageWidgets.docMLE -> text() );
+        m_pActivityWidget -> setShowInvok (m_GenPageWidgets.InvokCB->isChecked() );
     }
     else if ( item == pageItemFont )
     {
@@ -106,6 +108,10 @@
                                     m_GenPageWidgets.nameL, i18n("Activity name:"),
                                     m_GenPageWidgets.nameLE );
 
+    m_GenPageWidgets.InvokCB = new QCheckBox( i18n("&Invoke action "),(QWidget *)page);
+    generalLayout -> addWidget( m_GenPageWidgets.InvokCB );
+    m_GenPageWidgets.InvokCB->setChecked(m_pActivityWidget -> getShowInvok() );
+
     m_GenPageWidgets.docGB = new Q3GroupBox( i18n( "Documentation"), (QWidget *)page );
 
     QHBoxLayout * docLayout = new QHBoxLayout( m_GenPageWidgets.docGB );
--- branches/work/isi-umbrello/umbrello/umbrello/dialogs/activitydialog.h #636614:636615
@@ -119,7 +119,7 @@
         QLabel * nameL, * typeL;
         QLineEdit * nameLE, * typeLE;
         Q3MultiLineEdit * docMLE;
-
+        QCheckBox * InvokCB;
         Q3GroupBox * docGB, * generalGB;
     }
     m_GenPageWidgets;




More information about the umbrello-devel mailing list