[Uml-devel] branches/work/umbrello-qgv-port/umbrello

Camila San Martin Ayres smayres at gmail.com
Tue Aug 2 16:52:29 UTC 2011


SVN commit 1244399 by ayres:

Fixing bugs in the new branche.

 M  +1 -1      uml.cpp  
 M  +2 -46     umldoc.cpp  
 M  +4 -2      umldoc.h  
 M  +50 -0     umllistview.cpp  
 M  +16 -0     umllistview.h  


--- branches/work/umbrello-qgv-port/umbrello/uml.cpp #1244398:1244399
@@ -1877,7 +1877,7 @@
                 foreach (QGV::UMLView *view_new, views_new) {
                     m_viewStack_new->removeWidget(view_new);
                     int tabIndex_new = m_tabWidget_new->addTab(view_new, view_new->diagram()->name());
-                    m_tabWidget_new->setTabIcon(tabIndex_new, Icon_Utils::iconSet(view_new->diagram()->typeDiagram()));
+                    m_tabWidget_new->setTabIcon(tabIndex_new, Icon_Utils::iconSet(currentView->type()));
                     m_tabWidget_new->setTabToolTip(tabIndex_new, view_new->diagram()->name());
                 }
                 m_layout->addWidget(m_tabWidget_new);
--- branches/work/umbrello-qgv-port/umbrello/umldoc.cpp #1244398:1244399
@@ -260,7 +260,7 @@
     f->removeView(view);
     UMLView *currentView = UMLApp::app()->currentView();
     if (currentView == view) {
-        UMLApp::app()->setCurrentView(0);
+        UMLApp::app()->setCurrentView((UMLView*)0);
         UMLViewList viewList;
         m_root[Uml::ModelType::Logical]->appendViews(viewList);
         UMLView* firstView = 0;
@@ -1392,7 +1392,7 @@
 }
 
 #ifdef SOC2011
-QGV::UMLView* UMLDoc::create_Diagram(UMLFolder *folder, QGV::Uml::Diagram_Type type, bool askForName /*= true */)
+QGV::UMLView* UMLDoc::create_Diagram(UMLFolder *folder, Uml::Diagram_Type type, bool askForName /*= true */)
 {
     bool ok = true;
     QString name,
@@ -3206,51 +3206,7 @@
         uWarning() << "unknown diagram type " << view->type();
         return;
     }//end switch
-#ifdef SOC2011
-    switch ( view->type() ) {
-    case dt_Class:
-        type = lvt_Class_Diagram;
-        break;
 
-    case dt_UseCase:
-        type = lvt_UseCase_Diagram;
-        break;
-
-    case dt_Sequence:
-        type = lvt_Sequence_Diagram;
-        break;
-
-    case dt_Collaboration:
-        type = lvt_Collaboration_Diagram;
-        break;
-
-    case dt_State:
-        type = lvt_State_Diagram;
-        break;
-
-    case dt_Activity:
-        type = lvt_Activity_Diagram;
-        break;
-
-    case dt_Component:
-        type = lvt_Component_Diagram;
-        break;
-
-    case dt_Deployment:
-        type = lvt_Deployment_Diagram;
-        break;
-
-    case dt_EntityRelationship:
-        type = lvt_EntityRelationship_Diagram;
-        break;
-
-    default:
-        uWarning() << "unknown NEW diagram type " << view->type();
-        return;
-    }//end switch
-
-#endif
-
     // DEBUG(DBG_SRC) << "create popup for ListView_Type " << type;
     m_pTabPopupMenu = new ListPopupMenu(UMLApp::app()->mainViewWidget(), type, 0);
     m_pTabPopupMenu->popup(point);
--- branches/work/umbrello-qgv-port/umbrello/umldoc.h #1244398:1244399
@@ -123,7 +123,7 @@
     UMLView* createDiagram(UMLFolder *folder, Uml::DiagramType type, bool askForName = true);
 
 #ifdef SOC2011
-    QGV::UMLView* create_Diagram(UMLFolder *folder, QGV::Uml::Diagram_Type type, bool askForName /*= true */);
+    QGV::UMLView* create_Diagram(UMLFolder *folder, Uml::DiagramType type, bool askForName /*= true */);
 #endif
     
     void removeDiagram(Uml::IDType id);
@@ -352,7 +352,9 @@
     void sigDiagramRemoved(Uml::IDType id);
     void sigDiagramRenamed(Uml::IDType t);
     void sigDiagramChanged(Uml::DiagramType);
-
+#ifdef SOC2011
+    void sigDiagramChanged(QGV::Uml::Diagram_Type);
+#endif
     void sigObjectCreated(UMLObject *);
     void sigObjectRemoved(UMLObject *);
 
--- branches/work/umbrello-qgv-port/umbrello/umllistview.cpp #1244398:1244399
@@ -72,6 +72,10 @@
 #include "umlforeignkeyconstraintdialog.h"
 #include "umlcheckconstraintdialog.h"
 
+//new canvas
+#include "soc-umbrello-2011/umlview.h"
+#include "soc-umbrello-2011/diagram.h"
+
 #ifdef WANT_LVTOOLTIP
 class LVToolTip : public QToolTip
 {
@@ -1183,6 +1187,41 @@
     return foundItem;
 }
 
+#ifdef SOC2011
+UMLListViewItem* UMLListView::findView(QGV::UMLView* v)
+{
+    if (!v) {
+        uWarning() << "returning 0";
+        return 0;
+    }
+    UMLListViewItem* item;
+    Uml::DiagramType dType = v->diagram()->typeDiagram();
+    UMLListViewItem::ListViewType type = Model_Utils::convert_DT_LVT(dType);
+    Uml::IDType id = v->diagram()->id();
+    if (dType == Uml::DiagramType::UseCase) {
+        item = m_lv[Uml::ModelType::UseCase];
+    } else if (dType == Uml::DiagramType::Component) {
+        item = m_lv[Uml::ModelType::Component];
+    } else if (dType == Uml::DiagramType::Deployment) {
+        item = m_lv[Uml::ModelType::Deployment];
+    } else if (dType == Uml::DiagramType::EntityRelationship) {
+        item = m_lv[Uml::ModelType::EntityRelationship];
+    } else {
+        item = m_lv[Uml::ModelType::Logical];
+    }
+
+    UMLListViewItem* searchStartItem = (UMLListViewItem *)item->findChildObject();
+
+    UMLListViewItem* foundItem = recursiveSearchForView(searchStartItem, type, id);
+
+    if (!foundItem) {
+        uWarning() << "returning 0 at UMLListView::findView";
+    }
+    return foundItem;
+}
+
+#endif
+
 /**
  * Searches the tree for a diagram (view).
  * Used by findView().
@@ -1278,6 +1317,17 @@
         setSelected(temp, true);
 }
 
+#ifdef SOC2011
+void UMLListView::setView(QGV::UMLView * view)
+{
+    if (!view)
+        return;
+    UMLListViewItem * temp = findView(view);
+    if (temp)
+        setSelected(temp, true);
+}
+#endif
+
 void UMLListView::contentsMouseDoubleClickEvent(QMouseEvent * me)
 {
     UMLListViewItem * item = static_cast<UMLListViewItem *>(currentItem());
--- branches/work/umbrello-qgv-port/umbrello/umllistview.h #1244398:1244399
@@ -37,6 +37,12 @@
 class UMLClassifierListItem;
 class UMLDragData;
 
+//new canvas
+#define SOC2011 1
+namespace QGV {
+  class UMLView;
+}
+
 /**
  * This is one of the main classes used in this program.
  * Information is displayed here in a tree view. No objects are created
@@ -61,6 +67,9 @@
     void init();
 
     void setView(UMLView* view);
+#ifdef SOC2011
+    void setView(QGV::UMLView* view);
+#endif
 
     UMLListViewItemList selectedItems();
     UMLListViewItemList selectedItemsRoot();
@@ -68,6 +77,10 @@
 
     UMLListViewItem* createDiagramItem(UMLView *view);
 
+#ifdef SOC2011
+    UMLListViewItem* createDiagramItem(QGV::UMLView *view);
+#endif
+
     UMLListViewItem* createItem(UMLListViewItem& Data, IDChangeLog& IDChanges,
                                 UMLListViewItem* parent = 0);
 
@@ -82,6 +95,9 @@
 
     UMLListViewItem * findUMLObject(const UMLObject *p) const;
     UMLListViewItem * findView(UMLView *v);
+#ifdef SOC2011
+    UMLListViewItem * findView(QGV::UMLView *v);
+#endif
     UMLListViewItem * findItem(Uml::IDType id);
 
     UMLListViewItem *rootView(UMLListViewItem::ListViewType type);




More information about the umbrello-devel mailing list