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

Andi Fischer andi.fischer at hispeed.ch
Wed Jun 6 20:13:29 UTC 2012


SVN commit 1298649 by fischer:

Documentation moved to implementation file. Includes cleaned up.

 M  +48 -28    regionwidget.cpp  
 M  +6 -38     regionwidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/regionwidget.cpp #1298648:1298649
@@ -4,57 +4,63 @@
  *   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 "regionwidget.h"
 
-// qt includes
-#include <QtCore/QEvent>
-#include <QtGui/QPolygon>
+// app includes
+#include "basictypes.h"
+#include "debug_utils.h"
 
 // kde includes
 #include <klocale.h>
-#include <kinputdialog.h>
 
-// app includes
-#include "debug_utils.h"
-#include "uml.h"
-#include "umldoc.h"
-#include "docwindow.h"
-#include "umlwidget.h"
-#include "umlview.h"
-#include "floatingtextwidget.h"
-
+/**
+ * Creates a Region widget.
+ *
+ * @param scene   The parent of the widget.
+ * @param id      The ID to assign (-1 will prompt a new ID.)
+ */
 RegionWidget::RegionWidget(UMLScene * scene, Uml::IDType id)
   : UMLWidget(scene, WidgetBase::wt_Region, id)
 {
 }
 
-RegionWidget::~RegionWidget() {}
+/**
+ * Destructor.
+ */
+RegionWidget::~RegionWidget()
+{
+}
 
+/**
+ * Overrides the standard paint event.
+ */
 void RegionWidget::paint(QPainter & p, int offsetX, int offsetY)
 {
     setPenFromSettings(p);
     const int w = width();
     const int h = height();
     QPen pen = p.pen();
-    {
         setPenFromSettings(p);
         pen.setColor ( Qt::red );
         pen.setStyle ( Qt::DashLine );
         p.setPen( pen );
         p.drawRoundRect(offsetX, offsetY, w, h, (h * 60) / w, 60);
 
-    }
-    if(m_selected)
+    if (m_selected) {
         drawSelected(&p, offsetX, offsetY);
 }
+}
 
-UMLSceneSize RegionWidget::minimumSize() {
-
+/**
+ * Overrides method from UMLWidget
+ */
+UMLSceneSize RegionWidget::minimumSize()
+{
     int width = 10, height = 10;
     const QFontMetrics &fm = getFontMetrics(FT_NORMAL);
     const int fontHeight  = fm.lineSpacing();
@@ -69,18 +75,29 @@
     return UMLSceneSize(width, height);
 }
 
-void RegionWidget::setName(const QString &strName) {
+/**
+ * Sets the name of the REGION.
+ */
+void RegionWidget::setName(const QString& strName)
+{
     m_Text = strName;
     updateComponentSize();
     adjustAssocs( x(), y() );
 }
 
-QString RegionWidget::getName() const {
+/**
+ * Returns the name of the Region.
+ */
+QString RegionWidget::getName() const
+{
     return m_Text;
 }
 
-
-void RegionWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
+/**
+ * Creates the "REGIONwidget" XMI element.
+ */
+void RegionWidget::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
+{
     QDomElement regionElement = qDoc.createElement( "regionwidget" );
     UMLWidget::saveToXMI( qDoc, regionElement );
     regionElement.setAttribute( "regionname", m_Text );
@@ -89,14 +106,17 @@
     qElement.appendChild( regionElement );
 }
 
-bool RegionWidget::loadFromXMI( QDomElement & qElement ) {
-    if( !UMLWidget::loadFromXMI( qElement ) )
+/**
+ * Loads a "REGIONwidget" XMI element.
+ */
+bool RegionWidget::loadFromXMI(QDomElement& qElement)
+{
+    if (!UMLWidget::loadFromXMI(qElement)) {
         return false;
+    }
     m_Text = qElement.attribute( "regionname", "" );
     m_Doc = qElement.attribute( "documentation", "" );
     return true;
 }
 
-
 #include "regionwidget.moc"
-
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/regionwidget.h #1298648:1298649
@@ -4,69 +4,37 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2002-2006                                               *
+ *   copyright (C) 2002-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
 ***************************************************************************/
 
 #ifndef REGIONWIDGET_H
 #define REGIONWIDGET_H
-#include <qpainter.h>
-#include <qstringlist.h>
+
 #include "umlwidget.h"
-#include "worktoolbar.h"
-#include "floatingtextwidget.h"
 
+#include <QPainter>
+
 #define REGION_MARGIN 5
 #define REGION_WIDTH 90
 #define REGION_HEIGHT 45
 
-class RegionWidget: public UMLWidget {
+class RegionWidget: public UMLWidget
+{
     Q_OBJECT
 public:
-
-    /**
-     * Creates a Region widget.
-     *
-     * @param scene              The parent of the widget.
-     * @param id                The ID to assign (-1 will prompt a new ID.)
-     */
     explicit RegionWidget( UMLScene * scene, Uml::IDType id = Uml::id_None );
-
-    /**
-     * destructor
-     */
     virtual ~RegionWidget();
 
-    /**
-     * Overrides the standard paint event.
-     */
     void paint(QPainter & p, int offsetX, int offsetY);
 
-    /**
-     * Sets the name of the REGION.
-     */
     virtual void setName(const QString &strName);
-
-    /**
-     * Returns the name of the Region.
-     */
     virtual QString getName() const;
 
-
-    /**
-     * Creates the "REGIONwidget" XMI element.
-     */
     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
-
-    /**
-     * Loads a "REGIONwidget" XMI element.
-     */
     bool loadFromXMI( QDomElement & qElement );
 
 protected:
-    /**
-     * Overrides method from UMLWidget
-     */
     UMLSceneSize minimumSize();
 
 };




More information about the umbrello-devel mailing list