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

Andi Fischer andi.fischer at hispeed.ch
Tue Jan 10 17:08:11 UTC 2012


SVN commit 1272976 by fischer:

Some sync between branch and trunk.

 M  +73 -12    statewidget.cpp  
 M  +8 -78     statewidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/statewidget.cpp #1272975:1272976
@@ -4,21 +4,13 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2002-2011                                               *
+ *   copyright (C) 2002-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
 // own header
 #include "statewidget.h"
 
-// qt includes
-#include <QtCore/QPointer>
-#include <QtCore/QEvent>
-
-// kde includes
-#include <klocale.h>
-#include <kinputdialog.h>
-
 // app includes
 #include "debug_utils.h"
 #include "uml.h"
@@ -29,6 +21,21 @@
 #include "statedialog.h"
 #include "listpopupmenu.h"
 
+// kde includes
+#include <klocale.h>
+#include <kinputdialog.h>
+
+// qt includes
+#include <QtCore/QPointer>
+#include <QtCore/QEvent>
+
+/**
+ * Creates a State widget.
+ *
+ * @param scene       The parent of the widget.
+ * @param stateType   The type of state.
+ * @param id          The ID to assign (-1 will prompt a new ID.)
+ */
 StateWidget::StateWidget(UMLScene * scene, StateType stateType, Uml::IDType id)
   : UMLWidget(scene, WidgetBase::wt_State, id)
 {
@@ -37,10 +44,16 @@
     updateComponentSize();
 }
 
+/**
+ * Destructor.
+ */
 StateWidget::~StateWidget()
 {
 }
 
+/**
+ * Overrides the standard paint event.
+ */
 void StateWidget::paint(QPainter & p, int offsetX, int offsetY)
 {
     setPenFromSettings(p);
@@ -113,6 +126,9 @@
         drawSelected(&p, offsetX, offsetY);
 }
 
+/**
+ * Overrides method from UMLWidget
+ */
 QSize StateWidget::calculateSize()
 {
     int width = 10, height = 10;
@@ -141,6 +157,9 @@
     return QSize(width, height);
 }
 
+/**
+ * Sets the name of the State.
+ */
 void StateWidget::setName(const QString &strName)
 {
     m_Text = strName;
@@ -148,21 +167,33 @@
     adjustAssocs( getX(), getY() );
 }
 
+/**
+ * Returns the name of the State.
+ */
 QString StateWidget::name() const
 {
     return m_Text;
 }
 
+/**
+ * Returns the type of state.
+ */
 StateWidget::StateType StateWidget::stateType() const
 {
     return m_StateType;
 }
 
+/**
+ * Sets the type of state.
+ */
 void StateWidget::setStateType( StateType stateType )
 {
     m_StateType = stateType;
 }
 
+/**
+ * Captures any popup menu signals for menus it created.
+ */
 void StateWidget::slotMenuSelection(QAction* action)
 {
     bool ok = false;
@@ -191,6 +222,9 @@
     }
 }
 
+/**
+ * Adds the given activity to the state.
+ */
 bool StateWidget::addActivity( const QString &activity )
 {
     m_Activities.append( activity );
@@ -198,6 +232,9 @@
     return true;
 }
 
+/**
+ * Removes the given activity from the state.
+ */
 bool StateWidget::removeActivity( const QString &activity )
 {
     if( m_Activities.removeAll( activity ) == 0 )
@@ -206,17 +243,26 @@
     return true;
 }
 
-void StateWidget::setActivities( QStringList & list )
+/**
+ * Sets the states activities to the ones given.
+ */
+void StateWidget::setActivities(const QStringList &list)
 {
     m_Activities = list;
     updateComponentSize();
 }
 
-QStringList & StateWidget::activities()
+/**
+ * Returns the list of activities.
+ */
+QStringList StateWidget::activities() const
 {
     return m_Activities;
 }
 
+/**
+ * Renames the given activity.
+ */
 bool StateWidget::renameActivity( const QString &activity, const QString &newName )
 {
     int index = - 1;
@@ -226,6 +272,9 @@
     return true;
 }
 
+/**
+ * Show a properties dialog for a StateWidget.
+ */
 void StateWidget::showPropertiesDialog()
 {
     DocWindow *docwindow = UMLApp::app()->docWindow();
@@ -239,6 +288,13 @@
     delete dialog;
 }
 
+/**
+ * Returns true if the given toolbar button represents a State.
+ *
+ * @param tbb          Input value of type WorkToolBar::ToolBar_Buttons.
+ * @param resultType   Output value, the StateType that corresponds to tbb.
+ *                     Only set if the method returns true.
+ */
 bool StateWidget::isState(WorkToolBar::ToolBar_Buttons tbb, StateType& resultType)
 {
     bool status = true;
@@ -259,6 +315,9 @@
     return status;
 }
 
+/**
+ * Creates the "statewidget" XMI element.
+ */
 void StateWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement )
 {
     QDomElement stateElement = qDoc.createElement( "statewidget" );
@@ -279,6 +338,9 @@
     qElement.appendChild( stateElement );
 }
 
+/**
+ * Loads a "statewidget" XMI element.
+ */
 bool StateWidget::loadFromXMI( QDomElement & qElement )
 {
     if( !UMLWidget::loadFromXMI( qElement ) )
@@ -307,4 +369,3 @@
 }
 
 #include "statewidget.moc"
-
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/statewidget.h #1272975:1272976
@@ -4,7 +4,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2002-2009                                               *
+ *   copyright (C) 2002-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
 ***************************************************************************/
 
@@ -39,8 +39,8 @@
 class StateWidget : public UMLWidget
 {
     Q_OBJECT
+    Q_ENUMS(StateType)
 public:
-
     /// Enumeration that codes the different types of state.
     enum StateType
     {
@@ -49,110 +49,40 @@
         End
     };
 
-    /**
-     * Creates a State widget.
-     *
-     * @param scene              The parent of the widget.
-     * @param stateType The type of state.
-     * @param id                The ID to assign (-1 will prompt a new ID.)
-     */
     explicit StateWidget( UMLScene * scene, StateType stateType = Normal, Uml::IDType id = Uml::id_None );
-
-    /**
-     * destructor
-     */
     virtual ~StateWidget();
 
-    /**
-     * Overrides the standard paint event.
-     */
     void paint(QPainter & p, int offsetX, int offsetY);
 
-    /**
-     * Sets the name of the State.
-     */
     virtual void setName(const QString &strName);
-
-    /**
-     * Returns the name of the State.
-     */
     virtual QString name() const;
 
-    /**
-     * Returns the type of state.
-     */
     StateType stateType() const;
-
-    /**
-     * Sets the type of state.
-     */
     void setStateType( StateType stateType );
 
-    /**
-     * Adds the given activity to the state.
-     */
     bool addActivity( const QString &activity );
-
-    /**
-     * Removes the given activity from the state.
-     */
     bool removeActivity( const QString &activity );
-
-    /**
-     * Renames the given activity.
-     */
     bool renameActivity( const QString &activity, const QString &newName );
 
-    /**
-     * Sets the states activities to the ones given.
-     */
-    void setActivities( QStringList & list );
+    QStringList activities() const;
+    void setActivities(const QStringList &list);
 
-    /**
-     * Returns the list of activities.
-     */
-    QStringList & activities();
+    virtual void showPropertiesDialog();
 
-    /**
-     * Show a properties dialog for a StateWidget.
-     */
-    void showPropertiesDialog();
-
-    /**
-     * Returns true if the given toolbar button represents a State.
-     *
-     * @param tbb               Input value of type WorkToolBar::ToolBar_Buttons.
-     * @param resultType        Output value, the StateType that corresponds to tbb.
-     *                  Only set if the method returns true.
-     */
     static bool isState( WorkToolBar::ToolBar_Buttons tbb,
                          StateType& resultType );
 
-    /**
-     * Creates the "statewidget" XMI element.
-     */
-    void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
+    virtual bool loadFromXMI(QDomElement & qElement);
+    virtual void saveToXMI(QDomDocument & qDoc, QDomElement & qElement);
 
-    /**
-     * Loads a "statewidget" XMI element.
-     */
-    bool loadFromXMI( QDomElement & qElement );
-
 protected:
-    /**
-     * Overrides method from UMLWidget
-     */
     QSize calculateSize();
 
     StateType   m_StateType;   ///< Type of state.
     QStringList m_Activities;  ///< List of activities for the state.
 
 public slots:
-
-    /**
-     * Captures any popup menu signals for menus it created.
-     */
-    void slotMenuSelection(QAction* action);
+    virtual void slotMenuSelection(QAction* action);
 };
 
 #endif




More information about the umbrello-devel mailing list