[Uml-devel] branches/work/soc-umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Sat May 19 23:13:45 UTC 2012


SVN commit 1295735 by fischer:

Differences to trunk reduced.

 M  +0 -33     assocrules.cpp  
 M  +0 -1      clipboard/umldragdata.cpp  
 M  +1 -0      cmds/cmd_create_diagram.cpp  
 M  +2 -0      dialogs/umlviewdialog.cpp  
 M  +2 -0      dialogs/umlwidgetstylepage.cpp  
 M  +0 -1      toolbarstatearrow.h  
 M  +7 -5      toolbarstateassociation.cpp  
 M  +1 -0      umllistviewitem.cpp  
 M  +0 -3      umlscene.cpp  
 M  +6 -6      umlview.cpp  
 M  +12 -12    umlview.h  
 M  +7 -2      umlviewimageexportermodel.cpp  
 M  +1 -6      widgets/artifactwidget.cpp  
 M  +1 -2      widgets/artifactwidget.h  
 M  +9 -0      widgets/messagewidget.cpp  
 M  +4 -7      widgets/messagewidget.h  


--- branches/work/soc-umbrello/umbrello/assocrules.cpp #1295734:1295735
@@ -165,38 +165,6 @@
         }
     }
 
-    return bValid;
-
-/* TODO:
-   - Check the below code
-   - Check its callers - example: On making a Containment from a Package to a Class,
-     the assoc is already inserted in widgetB->associationWidgetList()
-     when we get here. The assoc SHOULD NOT already be there - therefore the
-     precondition of the below tests is not met, thus they fail, and
-     toolbarstateassociation.cpp:311 says "delete assoc" - but that's too late
-     because the assoc is already being referenced. Valgrind report:
-Invalid read of size 4
-   at 0x82EA890: AssociationWidget::getTextWidgetByRole(Uml::TextRole) (associationwidget.cpp:819)
-   by 0x82EE799: AssociationWidget::calculateTextPosition(Uml::TextRole) (associationwidget.cpp:2411)
-   by 0x82EEC23: AssociationWidget::saveIdealTextPositions() (associationwidget.cpp:1833)
-   by 0x832E676: UMLWidget::adjustAssocs(int, int) (umlwidget.cpp:782)
-   by 0x832CDF8: UMLWidget::updateComponentSize() (umlwidget.cpp:1240)
-   by 0x832CEC1: UMLWidget::updateWidget() (umlwidget.cpp:230)
-   by 0x832DAC2: UMLWidget::qt_metacall(QMetaObject::Call, int, void**) (umlwidget.moc:86)
-   by 0x598D863: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)
-   by 0x598E584: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3)
-   by 0x83F6168: UMLObject::modified() (umlobject.moc:122)
-   by 0x83F61FD: UMLObject::setUMLPackage(UMLPackage*) (umlobject.cpp:552)
-   by 0x83E2341: UMLListView::moveObject(std::string, UMLListViewItem::ListViewType, UMLListViewItem*) (umllistview.cpp:1772)
- Address 0x68e6e24 is 92 bytes inside a block of size 708 free'd
-   at 0x40265BD: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
-   by 0x83A6BE4: ToolBarStateAssociation::addAssociationInViewAndDoc(AssociationWidget*) (toolbarstateassociation.cpp:311)
-   by 0x83A6DA1: ToolBarStateAssociation::setSecondWidget() (toolbarstateassociation.cpp:230)
-   by 0x83A70DF: ToolBarStateAssociation::mouseReleaseWidget() (toolbarstateassociation.cpp:149)
-   by 0x83A5255: ToolBarState::mouseRelease(UMLSceneMouseEvent*) (toolbarstate.cpp:123)
- */
-
-#if 0
     if (!bValid) {
         return false;
     }
@@ -328,7 +296,6 @@
         break;
     }
     return false;
-#endif
 }
 
 /**
--- branches/work/soc-umbrello/umbrello/clipboard/umldragdata.cpp #1295734:1295735
@@ -694,7 +694,6 @@
         if (associationWidget->loadFromXMI(associationWidgetElement, widgets, 0))
             associations.append(associationWidget);
         else {
-            //associationWidget->cleanup();
             delete associationWidget;
         }
         associationWidgetNode = associationWidgetNode.nextSibling();
--- branches/work/soc-umbrello/umbrello/cmds/cmd_create_diagram.cpp #1295734:1295735
@@ -12,6 +12,7 @@
 
 #include "model_utils.h"
 #include "umldoc.h"
+#include "umlscene.h"
 #include "umlview.h"
 
 #include <klocale.h>
--- branches/work/soc-umbrello/umbrello/dialogs/umlviewdialog.cpp #1295734:1295735
@@ -181,7 +181,9 @@
     {
         uDebug() << "setting colors ";
         m_pStylePage->updateUMLWidget();
+        m_pScene->setLineWidth(m_options.uiState.lineWidth);
         m_pScene->setUseFillColor( m_options.uiState.useFillColor );
+        m_pScene->setTextColor(m_options.uiState.textColor);
         m_pScene->setLineColor( m_options.uiState.lineColor );
         m_pScene->setBrush( m_options.uiState.fillColor );
         m_pScene->setBackgroundBrush(m_options.uiState.backgroundColor);
--- branches/work/soc-umbrello/umbrello/dialogs/umlwidgetstylepage.cpp #1295734:1295735
@@ -10,6 +10,7 @@
 
 #include "umlwidgetstylepage.h"
 
+#include "debug_utils.h"
 #include "optionstate.h"
 #include "uml.h"
 #include "umlscene.h"
@@ -259,6 +260,7 @@
         if (view) {
             UMLScene* scene = view->umlScene();
             if (scene) {
+                uDebug() << "Setting background and grid dot color.";
                 scene->setBackgroundBrush(m_BackgroundColorB->color());
                 scene->setGridDotColor(m_GridDotColorB->color());
             }
--- branches/work/soc-umbrello/umbrello/toolbarstatearrow.h #1295734:1295735
@@ -17,7 +17,6 @@
 #include <QtCore/QList>
 
 class UMLScene;
-class QGraphicsLineItem;
 
 /**
  * Arrow tool for select, move and resize widgets and associations.
--- branches/work/soc-umbrello/umbrello/toolbarstateassociation.cpp #1295734:1295735
@@ -20,9 +20,10 @@
 #include "folder.h"
 #include "model_utils.h"
 #include "uml.h"
+#include "umldoc.h"
 #include "umlobject.h"
 #include "umlscene.h"
-#include "umldoc.h"
+#include "umlview.h"
 #include "umlwidget.h"
 
 // kde includes
@@ -35,10 +36,10 @@
  * @param umlScene The UMLScene to use.
  */
 ToolBarStateAssociation::ToolBarStateAssociation(UMLScene *umlScene)
-  : ToolBarStatePool(umlScene)
+  : ToolBarStatePool(umlScene),
+    m_firstWidget(0),
+    m_associationLine(0)
 {
-    m_firstWidget = 0;
-    m_associationLine = 0;
 }
 
 /**
@@ -223,7 +224,7 @@
     }
     if (valid) {
         AssociationWidget *temp = new AssociationWidget(widgetA, type, widgetB);
-        addAssociationInViewAndDoc(temp);
+        if (addAssociationInViewAndDoc(temp)) {
         if (type == Uml::AssociationType::Containment) {
             UMLObject *newContainer = widgetA->umlObject();
             UMLObject *objToBeMoved = widgetB->umlObject();
@@ -232,6 +233,7 @@
             }
         }
         UMLApp::app()->document()->setModified();
+        }
     } else {
         //TODO improve error feedback: tell the user what are the valid type of associations for
         //the second widget using the first widget
--- branches/work/soc-umbrello/umbrello/umllistviewitem.cpp #1295734:1295735
@@ -23,6 +23,7 @@
 #include "umldoc.h"
 #include "umllistview.h"
 #include "umlobjectlist.h"
+#include "umlscene.h"
 #include "umlview.h"
 #include "model_utils.h"
 #include "uniqueid.h"
--- branches/work/soc-umbrello/umbrello/umlscene.cpp #1295734:1295735
@@ -2237,8 +2237,6 @@
 
     emit sigAssociationRemoved(pAssoc);
 
-    // [PORT]
-    // pAssoc->cleanup();
     m_AssociationList.removeAll(pAssoc);
     pAssoc->deleteLater();
     m_doc->setModified();
@@ -4121,7 +4119,6 @@
             } else {
                 if (!addAssociation(assoc, false)) {
                     uError() << "Could not addAssociation(" << assoc << ") to UMLScene, deleting.";
-                    //assoc->cleanup();
                     delete assoc;
                     //return false; // soften error.. may not be that bad
                 }
--- branches/work/soc-umbrello/umbrello/umlview.cpp #1295734:1295735
@@ -23,16 +23,16 @@
 /**
  * Constructor
  */
-UMLView::UMLView(UMLFolder *f)
-  : QGraphicsView(UMLApp::app()->mainViewWidget())
+UMLView::UMLView(UMLFolder *parentFolder)
+  : QGraphicsView(UMLApp::app()->mainViewWidget()),
+    m_nZoom(100)
 {
-    m_nZoom = 100;
     setAcceptDrops(true);
     setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
     setDragMode(RubberBandDrag);
     // [PORT] For now the following is used. Shd check for creation of
     // new scene later.
-    UMLScene *scene = new UMLScene(f);
+    UMLScene *scene = new UMLScene(parentFolder);
     setScene(scene);
     setSceneRect(scene->sceneRect());
 
@@ -292,9 +292,9 @@
 /**
  * Override standard method.
  */
-void UMLView::closeEvent(QCloseEvent * e)
+void UMLView::closeEvent(QCloseEvent* ce)
 {
-    QWidget::closeEvent(e);
+    QWidget::closeEvent(ce);
 }
 
 /**
--- branches/work/soc-umbrello/umbrello/umlview.h #1295734:1295735
@@ -4,7 +4,7 @@
  *   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>                  *
  ***************************************************************************/
 
@@ -16,8 +16,8 @@
 class QHideEvent;
 class QCloseEvent;
 class QShowEvent;
+class UMLFolder;
 class UMLScene;
-class UMLFolder;
 
 /**
  * UMLView instances represent diagrams.
@@ -33,35 +33,35 @@
 {
     Q_OBJECT
 public:
-    UMLView(UMLFolder *f );
+    UMLView(UMLFolder *parentFolder);
     virtual ~UMLView();
 
     UMLScene* umlScene() const;
+
     int zoom() const { return m_nZoom; }
     void setZoom(int zoom);
     int currentZoom();
 
-    void hideEvent(QHideEvent *he);
-    void showEvent(QShowEvent *se);
+public slots:
+    void zoomIn();
+    void zoomOut();
+    void show();
 
+protected:
+    virtual void closeEvent(QCloseEvent* ce);
 
-
-protected:
     void setCenter(const QPointF& centerPoint);
     QPointF center();
 
     virtual void wheelEvent(QWheelEvent* event);
     virtual void resizeEvent(QResizeEvent* event);
-    void closeEvent(QCloseEvent * e);
+    void hideEvent(QHideEvent *he);
+    void showEvent(QShowEvent *se);
 
     QPointF m_currentCenterPoint;  ///< holds the current centerpoint for the view, used for panning and zooming
     QPoint  m_lastPanPoint;        ///< from panning the view
     int     m_nZoom;               ///< zoom level in percent, default 100
 
-public slots:
-    void zoomIn();
-    void zoomOut();
-    void show();
 };
 
 #endif // UMLVIEW_H
--- branches/work/soc-umbrello/umbrello/umlviewimageexportermodel.cpp #1295734:1295735
@@ -465,12 +465,16 @@
     QSvgGenerator generator;
     generator.setFileName(fileName);
     generator.setSize(rect.toRect().size());
+    generator.setViewBox(QRect(0, 0, rect.width(), rect.height()));
     QPainter painter(&generator);
 
     // make sure the widget sizes will be according to the
     // actually used printer font, important for diagramRect()
     // and the actual painting
-    scene->forceUpdateWidgetFontMetrics(&painter);
+//    scene->forceUpdateWidgetFontMetrics(&painter);
+    //Note: The above was commented out because other exportViewTo...
+    //      do not have it and it forces a resize of the widgets,
+    //      which is not correctly implemented for now.
 
     painter.translate(-rect.x(),-rect.y());
     scene->getDiagram(rect, painter);
@@ -480,7 +484,8 @@
     exportSuccessful = true;
 
     // next painting will most probably be to a different device (i.e. the screen)
-    scene->forceUpdateWidgetFontMetrics(0);
+//    scene->forceUpdateWidgetFontMetrics(0);
+    //Note: See comment above.
 
     DEBUG(DBG_IEM) << "saving to file " << fileName << " successful=" << exportSuccessful;
     return exportSuccessful;
--- branches/work/soc-umbrello/umbrello/widgets/artifactwidget.cpp #1295734:1295735
@@ -52,31 +52,26 @@
     if(umlObject()) {
         UMLArtifact *umlart = static_cast<UMLArtifact*>(umlObject());
         UMLArtifact::Draw_Type drawType = umlart->getDrawAsType();
-
         switch (drawType) {
         case UMLArtifact::defaultDraw:
             drawAsNormal(painter);
             break;
-
         case UMLArtifact::file:
             drawAsFile(painter);
             break;
-
         case UMLArtifact::library:
             drawAsLibrary(painter);
             break;
-
         case UMLArtifact::table:
             drawAsTable(painter);
             break;
-
         default:
             uWarning() << "Artifact drawn as unknown type";
             break;
         }
     }
     else {
-        uWarning() << "Cannot draw as there is no UMLArtifact for this widget";
+        uWarning() << "Cannot draw as there is no UMLArtifact for this widget.";
     }
 }
 
--- branches/work/soc-umbrello/umbrello/widgets/artifactwidget.h #1295734:1295735
@@ -33,8 +33,7 @@
 
     virtual void paint(QPainter *p, const QStyleOptionGraphicsItem *item, QWidget *w);
 
-    // Note: For loading from XMI, the inherited parent method is
-    //       used.
+    // Note: For loading from XMI, the inherited parent method is used.
     virtual void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
 
 protected:
--- branches/work/soc-umbrello/umbrello/widgets/messagewidget.cpp #1295734:1295735
@@ -298,6 +298,15 @@
 
 // End of link widget interface methods
 
+/**
+ * Getter for property m_sequenceNumber.
+ * @return sequence number as string
+ */
+QString MessageWidget::sequenceNumber() const
+{
+    return m_sequenceNumber;
+}
+
 void MessageWidget::setSequenceNumber(const QString &sequenceNumber)
 {
     m_sequenceNumber = sequenceNumber;
--- branches/work/soc-umbrello/umbrello/widgets/messagewidget.h #1295734:1295735
@@ -75,10 +75,7 @@
 
     //---------- End LinkWidget Interface methods implemementation.
 
-    /// @return The sequence number of this widget.
-    QString sequenceNumber() const {
-        return m_sequenceNumber;
-    }
+    QString sequenceNumber() const;
     void setSequenceNumber(const QString &sequenceNumber);
 
     /// @return Whether the message is synchronous or asynchronous
@@ -114,8 +111,8 @@
 
     virtual void setupContextMenuActions(ListPopupMenu &menu);
 
-    virtual bool loadFromXMI(QDomElement & qElement);
     virtual void saveToXMI(QDomDocument & qDoc, QDomElement & qElement);
+    virtual bool loadFromXMI(QDomElement & qElement);
 
 protected:
     virtual void updateGeometry();
@@ -135,9 +132,9 @@
 
     void drawSynchronous(QPainter *painter);
     void drawAsynchronous(QPainter *painter);
-    void drawFound(QPainter *painter);
-    void drawLost(QPainter *painter);
     void drawCreation(QPainter *painter);
+    void drawLost(QPainter *painter);
+    void drawFound(QPainter *painter);
 
     void init();
 




More information about the umbrello-devel mailing list