[Uml-devel] branches/work/soc-umbrello/umbrello
Gopala Krishna A
krishna.ggk at gmail.com
Wed Jun 11 20:15:31 UTC 2008
SVN commit 819703 by gopala:
A new class NewUMLWidget added which will be the main base widget class for all the UMLWidgets.
CCMAIL:umbrello-devel at kde.org
M +1 -0 CMakeLists.txt
A newumlwidget.cpp [License: UNKNOWN]
A newumlwidget.h [License: GPL (v2+)]
M +4 -0 umlnamespace.h
M +43 -29 widget_utils.cpp
M +64 -19 widget_utils.h
--- branches/work/soc-umbrello/umbrello/CMakeLists.txt #819702:819703
@@ -298,6 +298,7 @@
messagewidget.cpp
messagewidgetcontroller.cpp
model_utils.cpp
+ newumlwidget.cpp
node.cpp
nodewidget.cpp
notewidget.cpp
--- branches/work/soc-umbrello/umbrello/umlnamespace.h #819702:819703
@@ -331,4 +331,8 @@
} // end namespace Uml
+#define DISABLE_COPY(Class) \
+ Class(const Class &); \
+ Class &operator=(const Class &);
+
#endif
--- branches/work/soc-umbrello/umbrello/widget_utils.cpp #819702:819703
@@ -25,44 +25,58 @@
#include "umlscene.h"
-namespace Widget_Utils {
+namespace Widget_Utils
+{
-UMLWidget* findWidget(Uml::IDType id,
- const UMLWidgetList& widgets,
- const MessageWidgetList* pMessages /* = NULL */)
-{
- UMLWidgetListIt it( widgets );
- foreach ( UMLWidget* obj , widgets ) {
- if (obj->getBaseType() == Uml::wt_Object) {
- if (static_cast<ObjectWidget *>(obj)->getLocalID() == id)
+ UMLWidget* findWidget(Uml::IDType id,
+ const UMLWidgetList& widgets,
+ const MessageWidgetList* pMessages /* = NULL */)
+ {
+ UMLWidgetListIt it( widgets );
+ foreach ( UMLWidget* obj , widgets ) {
+ if (obj->getBaseType() == Uml::wt_Object) {
+ if (static_cast<ObjectWidget *>(obj)->getLocalID() == id)
+ return obj;
+ } else if (obj->getID() == id) {
return obj;
- } else if (obj->getID() == id) {
- return obj;
+ }
}
- }
- if (pMessages == NULL)
+ if (pMessages == NULL)
+ return NULL;
+
+ foreach ( UMLWidget* obj , *pMessages ) {
+ if( obj -> getID() == id )
+ return obj;
+ }
return NULL;
+ }
- foreach ( UMLWidget* obj , *pMessages ) {
- if( obj -> getID() == id )
- return obj;
+ QGraphicsRectItem *decoratePoint(const QPointF& p)
+ {
+ const int SIZE = 4;
+ UMLView *currentView = UMLApp::app()->getCurrentView();
+ QGraphicsRectItem *rect = new QGraphicsRectItem(0, 0, SIZE, SIZE);
+ currentView->umlScene()->addItem(rect);
+ rect->setPos(p.x() - SIZE / 2, p.y() - SIZE / 2);
+ rect->setBrush( QBrush(Qt::blue) );
+ rect->setPen( QPen(Qt::blue) );
+ return rect;
}
- return NULL;
-}
-QGraphicsRectItem *decoratePoint(const QPointF& p)
-{
- const int SIZE = 4;
- UMLView *currentView = UMLApp::app()->getCurrentView();
- QGraphicsRectItem *rect = new QGraphicsRectItem(0, 0, SIZE, SIZE);
- currentView->umlScene()->addItem(rect);
- rect->setPos(p.x() - SIZE / 2, p.y() - SIZE / 2);
- rect->setBrush( QBrush(Qt::blue) );
- rect->setPen( QPen(Qt::blue) );
- return rect;
-}
+ void loadPainterInfoFromXMI(const QDomElement &qElement, QPen &pen,
+ QBrush &brush, QFont &font)
+ {
+ //TODO: Implement this
+ }
+ void savePainterInfoToXMI(QDomDocument &qDoc, QDomElement &qElement,
+ const QPen &pen, const QBrush &brush,
+ const QFont &font)
+ {
+ //TODO: Implement this
+ }
+
} // namespace Widget_Utils
--- branches/work/soc-umbrello/umbrello/widget_utils.h #819702:819703
@@ -13,6 +13,11 @@
#define WIDGET_UTILS_H
#include <QtCore/QPoint>
+#include <QtXml/QDomDocument>
+#include <QtGui/QBrush>
+#include <QtGui/QPen>
+#include <QtGui/QFont>
+
#include "umlnamespace.h"
#include "umlwidgetlist.h"
#include "messagewidgetlist.h"
@@ -24,28 +29,68 @@
* General purpose widget utilities.
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
-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 pMessages Optional pointer to a MessageWidgetList to
- * search in.
- */
-UMLWidget* findWidget(Uml::IDType id,
- const UMLWidgetList& widgets,
- const MessageWidgetList* pMessages = NULL);
+ /**
+ * 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.
+ */
+ UMLWidget* findWidget(Uml::IDType id,
+ const UMLWidgetList& widgets,
+ const MessageWidgetList* pMessages = NULL);
-/**
- * Creates the decoration point.
- * @param p the base point
- * @return the decoration point
- */
-QGraphicsRectItem *decoratePoint(const QPointF& p);
+ /**
+ * Creates the decoration point.
+ * @param p the base point
+ * @return the decoration point
+ */
+ QGraphicsRectItem *decoratePoint(const QPointF& p);
+ /**
+ * Extracts the QPen properties into pen, QBrush properties into
+ * brush and QFont properties into font from the XMI xml element
+ * qElement.
+ *
+ * @param qElement The dom element from which the xmi info should
+ * be extracted.
+ *
+ * @param pen The QPen object into which pen details should be
+ * read into.
+ *
+ * @param brush The QBrush object into which brush details should
+ * be read into.
+ *
+ * @param font The QFont object into which font details should be
+ * read into.
+ * @todo Implement
+ */
+ void loadPainterInfoFromXMI(const QDomElement &qElement, QPen &pen,
+ QBrush &brush, QFont &font);
+
+ /**
+ * Saves the pen, brush and font info as xmi into the dom element
+ * \a qElement.
+ *
+ * @param qDoc The QDomDocument object pointing to the xmi document.
+ *
+ * @param qElement The element into which the pen, brush and font
+ * info should be saved.
+ *
+ * @param pen The QPen whose details should be saved.
+ * @param brush The QBrush whose details should be saved.
+ * @param font The QFont whose details should be saved.
+ * @todo Implement
+ */
+ void savePainterInfoToXMI(QDomDocument &qDoc, QDomElement &qElement,
+ const QPen &pen, const QBrush &brush,
+ const QFont &font);
+
}
#endif
More information about the umbrello-devel
mailing list