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

Ralf Habacker ralf.habacker at gmail.com
Tue Dec 13 14:09:48 UTC 2011


SVN commit 1268459 by habacker:

fixed method documentation locations and ordering according to class definition

 MM +106 -67   enumwidget.cpp  
 MM +6 -51     enumwidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/enumwidget.cpp #1268458:1268459
@@ -11,28 +11,41 @@
 // own header
 #include "enumwidget.h"
 
-// qt/kde includes
-#include <QtGui/QPainter>
-
 // app includes
+#include "classifier.h"
+#include "classifierlistitem.h"
 #include "debug_utils.h"
 #include "enum.h"
 #include "enumliteral.h"
-#include "classifier.h"
+#include "listpopupmenu.h"
+#include "object_factory.h"
+#include "uml.h"
 #include "umlclassifierlistitemlist.h"
-#include "classifierlistitem.h"
 #include "umlview.h"
 #include "umldoc.h"
-#include "uml.h"
-#include "listpopupmenu.h"
-#include "object_factory.h"
 
+/**
+ * Constructs an instance of EnumWidget.
+ *
+ * @param view      The parent of this EnumWidget.
+ * @param o         The UMLObject this will be representing.
+ */
 EnumWidget::EnumWidget(UMLView* view, UMLObject* o)
   : UMLWidget(view, o)
 {
     init();
 }
 
+/**
+ * Destructor.
+ */
+EnumWidget::~EnumWidget()
+{
+}
+
+/**
+ * Initializes key variables of the class.
+ */
 void EnumWidget::init()
 {
     UMLWidget::setBaseType(WidgetBase::wt_Enum);
@@ -50,10 +63,41 @@
         updateComponentSize();
 }
 
-EnumWidget::~EnumWidget()
+/**
+ * Returns the status of whether to show Package.
+ *
+ * @return  True if package is shown.
+ */
+bool EnumWidget::getShowPackage() const
 {
+    return m_bShowPackage;
 }
 
+/**
+ * Set the status of whether to show Package.
+ *
+ * @param _status             True if package shall be shown.
+ */
+void EnumWidget::setShowPackage(bool _status)
+{
+    m_bShowPackage = _status;
+    updateComponentSize();
+    update();
+}
+
+/**
+ * Toggles the status of whether to show package.
+ */
+void EnumWidget::toggleShowPackage()
+{
+    m_bShowPackage = !m_bShowPackage;
+    updateComponentSize();
+    update();
+}
+
+/**
+ * Draws the enum as a rectangle with a box underneith with a list of literals
+ */
 void EnumWidget::draw(QPainter& p, int offsetX, int offsetY)
 {
     setPenFromSettings(p);
@@ -115,6 +159,59 @@
     }
 }
 
+/**
+ * Loads from an "enumwidget" XMI element.
+ */
+bool EnumWidget::loadFromXMI( QDomElement & qElement )
+{
+    if ( !UMLWidget::loadFromXMI(qElement) ) {
+        return false;
+    }
+    QString showpackage = qElement.attribute("showpackage", "0");
+
+    m_bShowPackage = (bool)showpackage.toInt();
+
+    return true;
+}
+
+/**
+ * Saves to the "enumwidget" XMI element.
+ */
+void EnumWidget::saveToXMI( QDomDocument& qDoc, QDomElement& qElement )
+{
+    QDomElement conceptElement = qDoc.createElement("enumwidget");
+    UMLWidget::saveToXMI(qDoc, conceptElement);
+
+    conceptElement.setAttribute("showpackage", m_bShowPackage);
+    qElement.appendChild(conceptElement);
+}
+
+/**
+ * Will be called when a menu selection has been made from the
+ * popup menu.
+ *
+ * @param action       The action that has been selected.
+ */
+void EnumWidget::slotMenuSelection(QAction* action)
+{
+    ListPopupMenu::MenuType sel = m_pMenu->getMenuType(action);
+    if (sel == ListPopupMenu::mt_EnumLiteral) {
+        if (Object_Factory::createChildObject(static_cast<UMLClassifier*>(m_pObject),
+                                              UMLObject::ot_EnumLiteral) )  {
+            /* I don't know why it works without these calls:
+            updateComponentSize();
+            update();
+             */
+            UMLApp::app()->document()->setModified();
+        }
+        return;
+    }
+    UMLWidget::slotMenuSelection(action);
+}
+
+/**
+ * Overrides method from UMLWidget.
+ */
 QSize EnumWidget::calculateSize()
 {
     if (!m_pObject) {
@@ -170,61 +267,3 @@
 
     return QSize(width, height);
 }
-
-void EnumWidget::slotMenuSelection(QAction* action)
-{
-    ListPopupMenu::MenuType sel = m_pMenu->getMenuType(action);
-    if (sel == ListPopupMenu::mt_EnumLiteral) {
-        if (Object_Factory::createChildObject(static_cast<UMLClassifier*>(m_pObject),
-                                              UMLObject::ot_EnumLiteral) )  {
-            /* I don't know why it works without these calls:
-            updateComponentSize();
-            update();
-             */
-            UMLApp::app()->document()->setModified();
-        }
-        return;
-    }
-    UMLWidget::slotMenuSelection(action);
-}
-
-void EnumWidget::setShowPackage(bool _status)
-{
-    m_bShowPackage = _status;
-    updateComponentSize();
-    update();
-}
-
-bool EnumWidget::getShowPackage() const
-{
-    return m_bShowPackage;
-}
-
-void EnumWidget::saveToXMI( QDomDocument& qDoc, QDomElement& qElement )
-{
-    QDomElement conceptElement = qDoc.createElement("enumwidget");
-    UMLWidget::saveToXMI(qDoc, conceptElement);
-
-    conceptElement.setAttribute("showpackage", m_bShowPackage);
-    qElement.appendChild(conceptElement);
-}
-
-bool EnumWidget::loadFromXMI( QDomElement & qElement )
-{
-    if ( !UMLWidget::loadFromXMI(qElement) ) {
-        return false;
-    }
-    QString showpackage = qElement.attribute("showpackage", "0");
-
-    m_bShowPackage = (bool)showpackage.toInt();
-
-    return true;
-}
-
-void EnumWidget::toggleShowPackage()
-{
-    m_bShowPackage = !m_bShowPackage;
-    updateComponentSize();
-    update();
-}
-
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/enumwidget.h #1268458:1268459
@@ -12,6 +12,7 @@
 #ifndef ENUMWIDGET_H
 #define ENUMWIDGET_H
 
+
 #include "umlwidget.h"
 
 class UMLView;
@@ -29,77 +30,31 @@
  */
 class EnumWidget : public UMLWidget {
 public:
-
-    /**
-     * Constructs an EnumWidget.
-     *
-     * @param view              The parent of this EnumWidget.
-     * @param o         The UMLObject this will be representing.
-     */
     EnumWidget(UMLView* view, UMLObject* o);
-
-    /**
-     * Standard deconstructor.
-     */
     ~EnumWidget();
 
-    /**
-     * Initializes key variables of the class.
-     */
     void init();
 
-    /**
-     * Returns the status of whether to show Package.
-     *
-     * @return  True if package is shown.
-     */
+    // TODO: is this a generic pattern and should be moved to a base class ? 
     bool getShowPackage() const;
-
-    /**
-     * Toggles the status of whether to show package.
-     */
+    void setShowPackage(bool _status);
     void toggleShowPackage();
 
-    /**
-     * Set the status of whether to show Package.
-     *
-     * @param _status             True if package shall be shown.
-     */
-    void setShowPackage(bool _status);
-
-    /**
-     * Draws the enum as a rectangle with a box underneith with a list of literals
-     */
     void draw(QPainter& p, int offsetX, int offsetY);
 
-    /**
-     * Saves to the "enumwidget" XMI element.
-     */
+    bool loadFromXMI(QDomElement& qElement);
     void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
 
-    /**
-     * Loads from an "enumwidget" XMI element.
-     */
-    bool loadFromXMI(QDomElement& qElement);
+public slots:
+    void slotMenuSelection(QAction* action);
 
 protected:
-    /**
-     * Overrides method from UMLWidget.
-     */
     QSize calculateSize();
 
     bool m_bShowPackage;
 
 private:
 
-public slots:
-    /**
-     * Will be called when a menu selection has been made from the
-     * popup menu.
-     *
-     * @param action       The action that has been selected.
-     */
-    void slotMenuSelection(QAction* action);
 };
 
 #endif




More information about the umbrello-devel mailing list