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

Andi Fischer andi.fischer at hispeed.ch
Tue Apr 10 17:26:19 UTC 2012


SVN commit 1288786 by fischer:

Differences to gsoc-branch reduced.

 M  +1 -1      messagewidgetlist.h  
 M  +1 -3      widgets/associationwidget.cpp  
 M  +13 -0     widgets/umlwidget.cpp  
 M  +4 -23     widgets/umlwidget.h  
 M  +26 -15    widgets/widget_utils.cpp  
 M  +8 -22     widgets/widget_utils.h  
 M  +4 -12     widgets/widgetbase.cpp  
 M  +1 -3      widgets/widgetbase.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/messagewidgetlist.h #1288785:1288786
@@ -12,7 +12,7 @@
 #ifndef MESSAGEWIDGETLIST_H
 #define MESSAGEWIDGETLIST_H
 
-#include <qlist.h>
+#include <QtCore/QList>
 
 class MessageWidget;
 
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationwidget.cpp #1288785:1288786
@@ -3915,7 +3915,7 @@
 {
     UMLAttribute *attr = attribute();
     if (attr == NULL) {
-        uError() << "getAttribute returns NULL";
+        uError() << "attribute() returns NULL";
         return;
     }
     setVisibility(attr->visibility(), B);
@@ -3927,8 +3927,6 @@
  */
 void AssociationWidget::init()
 {
-    WidgetBase::init();
-
     // pointers to floating text widgets objects owned by this association
     m_pName = 0;
     m_role[A].changeabilityWidget = 0;
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.cpp #1288785:1288786
@@ -1316,6 +1316,9 @@
     setSize(clipWidth, clipHeight);
 }
 
+/**
+ * Template Method, override this to set the default font metric.
+ */
 void UMLWidget::setDefaultFontMetrics(UMLWidget::FontType fontType)
 {
     setupFontType(m_Font, fontType);
@@ -1369,6 +1372,9 @@
     }
 }
 
+/**
+ * Template Method, override this to set the default font metric.
+ */
 void UMLWidget::setDefaultFontMetrics(UMLWidget::FontType fontType, QPainter &painter)
 {
     setupFontType(m_Font, fontType);
@@ -1376,6 +1382,10 @@
     setFontMetrics(fontType, painter.fontMetrics());
 }
 
+/**
+ * Returns the font metric used by this object for Text
+ * which uses bold/italic fonts.
+ */
 QFontMetrics &UMLWidget::getFontMetrics(UMLWidget::FontType fontType)
 {
     if (m_pFontMetrics[fontType] == 0) {
@@ -1384,6 +1394,9 @@
     return *m_pFontMetrics[fontType];
 }
 
+/**
+ * Set the font metric to use.
+ */
 void UMLWidget::setFontMetrics(UMLWidget::FontType fontType, QFontMetrics fm)
 {
     delete m_pFontMetrics[fontType];
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.h #1288785:1288786
@@ -261,15 +261,10 @@
         FT_INVALID = 8
     } FontType;
 
-    /** Template Method, override this to set the default
-     *  font metric.
-     */
     virtual void setDefaultFontMetrics(UMLWidget::FontType fontType);
     virtual void setDefaultFontMetrics(UMLWidget::FontType fontType, QPainter &painter);
 
-    /** Returns the font metric used by this object for Text which uses bold/italic fonts */
     QFontMetrics &getFontMetrics(UMLWidget::FontType fontType);
-    /** set the font metric to use */
     void setFontMetrics(UMLWidget::FontType fontType, QFontMetrics fm);
     void setupFontType(QFont &font, UMLWidget::FontType fontType);
 
@@ -289,26 +284,12 @@
      */
     QString m_Text;
 
-    /**
-     *  The font the widget will use.
-     */
-    QFont m_Font;
+    QFont m_Font;   ///< the font the widget will use
 
-    /**
-     * Holds whether this widget is a component instance (i.e. on a deployment diagram)
-     */
-    bool m_isInstance;
+    QString m_instanceName;  ///< instance name (used if on a deployment diagram)
+    bool m_isInstance;       ///< holds whether this widget is a component instance (i.e. on a deployment diagram)
+    bool m_showStereotype;   ///< should the stereotype be displayed
 
-    /**
-     * The instance name (used if on a deployment diagram)
-     */
-    QString m_instanceName;
-
-    /**
-     * Should the stereotype be displayed
-     */
-    bool m_showStereotype;
-
     ///////////////// End of Data Loaded/Saved //////////////////////////
 
     bool m_selected, m_startMove;
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widget_utils.cpp #1288785:1288786
@@ -4,30 +4,38 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
 // own header
 #include "widget_utils.h"
 
-// qt includes
-#include <QtGui/QBrush>
-#include <QtGui/QPen>
-
 // app includes
 #include "debug_utils.h"
+#include "objectwidget.h"
 #include "uml.h"
 #include "umlview.h"
 #include "umlwidget.h"
-#include "objectwidget.h"
 
+// qt includes
+#include <QtGui/QBrush>
+#include <QtGui/QPen>
 
-namespace Widget_Utils {
+namespace Widget_Utils
+{
 
+/**
+ * Find the widget identified by the given ID in the given widget
+ * or message list.
+ *
+ * @param id         The unique ID to find.
+ * @param widgets    The UMLWidgetList to search in.
+ * @param messages   Optional pointer to a MessageWidgetList to search in.
+ */
 UMLWidget* findWidget(Uml::IDType id,
                       const UMLWidgetList& widgets,
-                      const MessageWidgetList* pMessages /* = NULL */)
+                      const MessageWidgetList* messages /* = 0 */)
 {
     UMLWidgetListIt it( widgets );
     foreach ( UMLWidget* obj , widgets ) {
@@ -39,17 +47,22 @@
         }
     }
 
-    if (pMessages == NULL)
-        return NULL;
+    if (messages == 0)
+        return 0;
 
-    foreach ( UMLWidget* obj , *pMessages ) {
+    foreach (UMLWidget* obj, *messages) {
         if( obj->id() == id )
             return obj;
     }
-    return NULL;
+    return 0;
 }
 
-UMLSceneRectItem *decoratePoint(const QPoint& p)
+/**
+ * Creates the decoration point.
+ * @param p   the base point
+ * @return    the decoration point
+ */
+UMLSceneRectItem* decoratePoint(const UMLScenePoint& p)
 {
     const int SIZE = 4;
     UMLView *currentView = UMLApp::app()->currentView();
@@ -64,6 +77,4 @@
     return rect;
 }
 
-
 }  // namespace Widget_Utils
-
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widget_utils.h #1288785:1288786
@@ -4,45 +4,31 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
 #ifndef WIDGET_UTILS_H
 #define WIDGET_UTILS_H
 
-#include <QtCore/QPoint>
-
 #include "basictypes.h"
-#include "umlwidgetlist.h"
 #include "messagewidgetlist.h"
 #include "umlscene.h"
+#include "umlwidgetlist.h"
 
+#include <QtCore/QPoint>
+
 /**
  * General purpose widget utilities.
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
-namespace Widget_Utils {
-
-/**
- * Find the widget identified by the given ID in the given widget
- * or message list.
- *
- * @param id            The unique ID to find.
- * @param widgets       The UMLWidgetList to search in.
- * @param pMessages     Optional pointer to a MessageWidgetList to
- *                      search in.
- */
+namespace Widget_Utils
+{
 UMLWidget* findWidget(Uml::IDType id,
                       const UMLWidgetList& widgets,
-                      const MessageWidgetList* pMessages = NULL);
+                          const MessageWidgetList* messages = 0);
 
-/**
- * Creates the decoration point.
- * @param p   the base point
- * @return    the decoration point
- */
-UMLSceneRectItem *decoratePoint(const QPoint& p);
+    UMLSceneRectItem* decoratePoint(const UMLScenePoint& p);
 
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widgetbase.cpp #1288785:1288786
@@ -25,17 +25,9 @@
 WidgetBase::WidgetBase(UMLScene *scene, WidgetType type)
   : QObject(scene),
     m_Type(type),
-    m_scene(scene)
+    m_scene(scene),
+    m_pObject(0)
 {
-    init();
-}
-
-/**
- * Initialize members.
- */
-void WidgetBase::init()
-{
-    m_pObject = 0;
     if (m_scene) {
         m_usesDiagramLineColor = true;
         m_usesDiagramLineWidth  = true;
@@ -120,9 +112,9 @@
  *
  * @param o The object to represent.
  */
-void WidgetBase::setUMLObject(UMLObject * o)
+void WidgetBase::setUMLObject(UMLObject *obj)
 {
-    m_pObject = o;
+    m_pObject = obj;
 }
 
 /**
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widgetbase.h #1288785:1288786
@@ -73,7 +73,7 @@
     virtual ~WidgetBase();
 
     UMLObject* umlObject() const;
-    virtual void setUMLObject(UMLObject * o);
+    virtual void setUMLObject(UMLObject *obj);
 
     Uml::IDType id() const;
     void setID(Uml::IDType id);
@@ -124,8 +124,6 @@
     WidgetBase& operator=(const WidgetBase& other);
 
 protected:
-    void init();
-
     WidgetType  m_Type;  ///< Type of widget.
     UMLScene   *m_scene;
     UMLObject  *m_pObject;




More information about the umbrello-devel mailing list