[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun Jul 15 10:55:32 UTC 2007


SVN commit 688199 by okellogg:

sync with branches/KDE/3.5 up to commit 688175

 M  +1 -0      ChangeLog  
 M  +0 -2      umbrello/activitywidget.cpp  
 M  +3 -2      umbrello/attribute.cpp  
 M  +6 -3      umbrello/classifier.cpp  
 M  +1 -1      umbrello/codedocument.cpp  
 M  +25 -25    umbrello/entityattribute.h  
 M  +4 -0      umbrello/linepath.cpp  
 M  +18 -18    umbrello/umlwidgetcontroller.cpp  
 M  +12 -1     umbrello/umlwidgetcontroller.h  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #688198:688199
@@ -7,6 +7,7 @@
 * End Activity Symbol gets invalid when line thickness is increased (146925)
 * The size of a fork/join is not restored (147069)
 * Crash when changing the association type to containment (147202)
+* Moving component on diagram results in absurd shape of self-association (147810)
 
 Version 1.5.71
 
--- trunk/KDE/kdesdk/umbrello/umbrello/activitywidget.cpp #688198:688199
@@ -14,13 +14,11 @@
 
 // qt includes
 #include <qpainter.h>
-//#include <pen.h>
 
 // kde includes
 #include <klocale.h>
 #include <kdebug.h>
 #include <kinputdialog.h>
-#include <cmath>
 
 // app includes
 #include "uml.h"
--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.cpp #688198:688199
@@ -296,8 +296,9 @@
     UMLClassifierList templateParamList;
     QString type = getType()->getName();
     QString templateParam;
-    //template and generic only in C++ and Java ?
-    if (UMLApp::app()->getActiveLanguage() == Uml::pl_Cpp || UMLApp::app()->getActiveLanguage() == Uml::pl_Java || UMLApp::app()->getActiveLanguage() == Uml::pl_D) {
+    // Handle C++/D/Java template/generic parameters
+    const Uml::Programming_Language pl = UMLApp::app()->getActiveLanguage();
+    if (pl == Uml::pl_Cpp || pl == Uml::pl_Java || pl == Uml::pl_D) {
         int start = type.find(QChar('<'));
         if (start >= 0 ) {
             int end = type.findRev(QChar('>'));
--- trunk/KDE/kdesdk/umbrello/umbrello/classifier.cpp #688198:688199
@@ -971,8 +971,10 @@
                 tagEq(tag, "Classifier.feature") ||
                 tagEq(tag, "Namespace.ownedElement") ||
                 tagEq(tag, "Namespace.contents")) {
-            if (! load(element))
-                return false;
+            load(element);
+            // Not evaluating the return value from load()
+            // because we want a best effort.
+
         } else if ((child = makeChildObject(tag)) != NULL) {
             if (child->loadFromXMI(element)) {
                 switch (child->getBaseType()) {
@@ -1001,7 +1003,8 @@
         } else if (!Model_Utils::isCommonXMIAttribute(tag)) {
             UMLObject *pObject = Object_Factory::makeObjectFromXMI(tag);
             if (pObject == NULL) {
-                totalSuccess = false;
+                // Not setting totalSuccess to false
+                // because we want a best effort.
                 continue;
             }
             pObject->setUMLPackage(this);
--- trunk/KDE/kdesdk/umbrello/umbrello/codedocument.cpp #688198:688199
@@ -109,7 +109,7 @@
     QString path = getPackage();
 
     // Replace all white spaces with blanks
-    path.simplified();
+    path = path.simplified();
 
     // Replace all blanks with underscore
     path.replace(QRegExp(" "), "_");
--- trunk/KDE/kdesdk/umbrello/umbrello/entityattribute.h #688198:688199
@@ -71,65 +71,65 @@
     virtual UMLObject* clone() const;
 
     /**
-     * Returns The value of the UMLEntityAttribute's attributes property.
+     * Returns the value of the UMLEntityAttribute's attributes property.
      *
      * @return  The value of the UMLEntityAttribute's attributes property.
      */
     QString getAttributes() const;
 
     /**
-     * Sets the initial value of the UMLEntityAttribute's attributes property.
+     * Sets the UMLEntityAttribute's attributes property.
      *
-     * @param attributes  The initial value of the UMLEntityAttribute's attributes property.
+     * @param attributes  The new value for the attributes property.
      */
     void setAttributes(const QString& attributes);
 
-     /** 
-      * Returns The initial value of the UMLEntityAttribute's index type property. 
-      * 
-      * @return  The initial value of the UMLEntityAttribute's index type property. 
-      */ 
-     Uml::DBIndex_Type getIndexType() const; 
+    /** 
+     * Returns the UMLEntityAttribute's index type property. 
+     * 
+     * @return  The value of the UMLEntityAttribute's index type property. 
+     */ 
+    Uml::DBIndex_Type getIndexType() const; 
 
-     /** 
-      * Sets the initial value of the UMLEntityAttribute's index type property. 
-      * 
-      * @param indexType  The initial value of the UMLEntityAttribute's index type property. 
-      */ 
-     void setIndexType(const Uml::DBIndex_Type indexType); 
+    /** 
+     * Sets the initial value of the UMLEntityAttribute's index type property. 
+     * 
+     * @param indexType  The initial value of the UMLEntityAttribute's index type property. 
+     */ 
+    void setIndexType(const Uml::DBIndex_Type indexType); 
 
     /**
-     * Returns The initial value of the UMLEntityAttribute's length/values property.
+     * Returns the UMLEntityAttribute's length/values property.
      *
-     * @return  The initial value of the UMLEntityAttribute's length/values property.
+     * @return  The new value of the length/values property.
      */
     QString getValues() const;
 
     /**
-     * Sets the initial value of the UMLEntityAttribute's length/values property.
+     * Sets the UMLEntityAttribute's length/values property.
      *
-     * @param values        The initial value of the UMLEntityAttribute's length/values property.
+     * @param values    The new value of the length/values property.
      */
     void setValues(const QString& values);
 
     /**
-     * Returns The initial value of the UMLEntityAttribute's auto_increment boolean
+     * Returns the UMLEntityAttribute's auto_increment boolean
      *
-     * @return  The initial value of the UMLEntityAttribute's auto_increment boolean
+     * @return  The UMLEntityAttribute's auto_increment boolean
      */
     bool getAutoIncrement() const;
 
     /**
-     * Sets the initial value of the UMLEntityAttribute's auto_increment boolean
+     * Sets the UMLEntityAttribute's auto_increment boolean
      *
-     * @param autoIncrement        The initial value of the UMLEntityAttribute's auto_increment boolean
+     * @param autoIncrement  The UMLEntityAttribute's auto_increment boolean
      */
     void setAutoIncrement(const bool autoIncrement);
 
     /**
-     * Returns The initial value of the UMLEntityAttribute's allow null value.
+     * Returns the UMLEntityAttribute's allow null value.
      *
-     * @return  The initial value of the UMLEntityAttribute's allow null value.
+     * @return  The UMLEntityAttribute's allow null value.
      */
     bool getNull() const;
 
--- trunk/KDE/kdesdk/umbrello/umbrello/linepath.cpp #688198:688199
@@ -107,6 +107,10 @@
     int count = m_LineList.count();
     if( count == 0 || pointIndex > count  || pointIndex < 0)
         return false;
+    if (point.x() == 0 && point.y() == 0) {
+        kError() << "LinePath::setPoint:ignoring request for (0,0)" << endl;
+        return false;
+    }
 
     if( pointIndex == count) {
         Q3CanvasLine * line = m_LineList.last();
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #688198:688199
@@ -138,9 +138,9 @@
         setSelectionBounds();
     }
 
-    QPoint positionDifference = getPositionDifference(me);
-    int diffX = positionDifference.x();
-    int diffY = positionDifference.y();
+    QPoint position = getPosition(me);
+    int diffX = position.x() - m_widget->getX();
+    int diffY = position.y() - m_widget->getY();
 
     if ((me->modifiers() & Qt::ShiftModifier) && (me->modifiers() & Qt::ControlModifier)) {
         //Move in Y axis
@@ -176,10 +176,7 @@
         update = true;
         lastUpdate.restart();
 
-        // CHECK: UMLWidget::adjustUnselectedAssocs(x,y) appears to take absolute
-        //      values for x and y. Surprisingly, supplying diffX and diffY seems
-        //      to work all the same ?!?
-        m_widget->adjustUnselectedAssocs(diffX, diffY);
+        m_widget->adjustUnselectedAssocs(m_widget->getX(), m_widget->getY());
     }
 
     while ((widget = it.current()) != 0) {
@@ -534,12 +531,12 @@
     return biggestY;
 }
 
-QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
+QPoint UMLWidgetController::getPosition(QMouseEvent* me) {
     /*
-    kDebug() << "UMLWidgetController::getPositionDifference: me->x=" << me->x()
+    kDebug() << "UMLWidgetController::getPosition: me->x=" << me->x()
         << " m_widget->getX=" << m_widget->getX() << ", m_oldX=" << m_oldX
         << ", m_pressOffsetX=" << m_pressOffsetX << endl;
-    kDebug() << "UMLWidgetController::getPositionDifference: me->y=" << me->y()
+    kDebug() << "UMLWidgetController::getPosition: me->y=" << me->y()
         << " m_widget->getY=" << m_widget->getY() << ", m_oldY=" << m_oldY
         << ", m_pressOffsetY=" << m_pressOffsetY << endl;
      */
@@ -552,28 +549,31 @@
     m_oldY = newY;
 
     if (newX + (m_minSelectedX - m_widget->getX()) < 0) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.1" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.1" << endl;
         newX = m_widget->getX() - m_minSelectedX;
     }
     if (newY + (m_minSelectedY - m_widget->getY()) < 0) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.2" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.2" << endl;
         newY = m_widget->getY() - m_minSelectedY;
     }
     if (newX + (m_maxSelectedX - m_widget->getX()) > maxX) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.3" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.3" << endl;
         newX = maxX - (m_maxSelectedX - m_widget->getX());
     }
     if (newY + (m_maxSelectedY - m_widget->getY()) > maxY) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.4" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.4" << endl;
         newY = maxY - (m_maxSelectedY - m_widget->getY());
     }
-
-    newX -= m_widget->getX();
-    newY -= m_widget->getY();
-
     return QPoint(newX, newY);
 }
 
+QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
+    QPoint newPoint = getPosition(me);
+    const int diffX = newPoint.x() - m_widget->getX();
+    const int diffY = newPoint.y() - m_widget->getY();
+    return QPoint(diffX, diffY);
+}
+
 void UMLWidgetController::showPopupMenu(QMouseEvent *me) {
     //TODO why this condition?
     if (m_widget->m_pMenu) {
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidgetcontroller.h #688198:688199
@@ -383,10 +383,21 @@
     int getBiggestY(const UMLWidgetList &widgetList);
 
     /**
+     * Returns the adjusted position for the given mouse event.
+     * The adjusted position is computed using the current widget position
+     * m_widget->get{X,Y}(), the previous position m_old{X,Y}, and the
+     * mouse press offset m_pressOffset{X,Y}.
+     *
+     * @param me The QMouseEvent for which to get the adjusted position.
+     * @return A QPoint with the adjusted position.
+     */
+    QPoint getPosition(QMouseEvent *me);
+
+    /**
      * Returns a QPoint with the new X and Y position difference of the mouse event
      * respect to the position of the widget.
      *
-     * @param me The QMouseEVent to get the position to compare.
+     * @param me The QMouseEvent to get the position to compare.
      * @return A QPoint with the position difference.
      */
     QPoint getPositionDifference(QMouseEvent *me);




More information about the umbrello-devel mailing list