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

Sharan Rao sharanrao at gmail.com
Wed Nov 7 16:02:35 UTC 2007


SVN commit 733930 by sharan:

Fix regression due to removal of Qt3Support in Settings Dialog.
The order in which the items were added in the "Start Diagram" Combo box were reversed!

Also made this more non-hard-coded by adding a diagramTypeToString function in Model_Utils



 M  +5 -8      dialogs/settingsdlg.cpp  
 M  +29 -1     model_utils.cpp  
 M  +6 -0      model_utils.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/settingsdlg.cpp #733929:733930
@@ -199,15 +199,12 @@
     m_GeneralWidgets.diagramKB->setCompletionMode( KGlobalSettings::CompletionPopup );
     startupLayout -> addWidget( m_GeneralWidgets.diagramKB, 1, 1 );
 
-    QString diagrams [] = { i18n("No Diagram"), i18n("Class Diagram"),
-                            i18n("Use Case Diagram"), i18n("Sequence Diagram"),
-                            i18n("Collaboration Diagram"), i18n("State Diagram"),
-                            i18n("Activity Diagram"), i18n("Component Diagram"),
-                            i18n("Deployment Diagram"), i18n("Entity Relationship Diagram") };
 
-    //start at 1 because we don't allow No Diagram any more
-    for (int i=1; i<10; i++) {
-        insertDiagram( diagrams[i] );
+    // start at 1 because we don't allow No Diagram any more
+    // diagramNo 1 is Uml::dt_Class
+    // digaramNo 9 is Uml::dt_EntityRelationship
+    for (int diagramNo=1; diagramNo < 10; diagramNo++) {
+        insertDiagram( Model_Utils::diagramTypeToString( ( Uml::Diagram_Type )diagramNo ), /*index*/ diagramNo - 1  );
     }
 
     m_GeneralWidgets.diagramKB->setCurrentIndex( (int)m_pOptionState->generalState.diagram-1 );
--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.cpp #733929:733930
@@ -1336,5 +1336,33 @@
     }
 }
 
+
+QString diagramTypeToString(Uml::Diagram_Type dt) {
+
+    switch( dt ) {
+
+       case Uml::dt_Class:
+           return i18n( "Class Diagram" );
+       case Uml::dt_UseCase:
+           return i18n( "Use Case Diagram" );
+       case Uml::dt_Sequence:
+           return i18n( "Sequence Diagram" );
+       case Uml::dt_Collaboration:
+           return i18n( "Collaboration Diagram" );
+       case Uml::dt_State:
+           return i18n( "State Diagram" );
+       case Uml::dt_Activity:
+           return i18n( "Activity Diagram" );
+       case Uml::dt_Component:
+           return i18n( "Component Diagram" );
+       case Uml::dt_Deployment:
+           return i18n( "Deployment Diagram" );
+       case Uml::dt_EntityRelationship:
+           return i18n( "Entity Relationship Diagram" );
+       default:
+           return i18n( "No Diagram" );
+    }
+
+}
+
 }  // namespace Model_Utils
-
--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.h #733929:733930
@@ -236,7 +236,13 @@
  */
 Uml::Programming_Language stringToProgLang(QString str);
 
+
 /**
+ * Return string corresponding to Uml::Diagram_Type
+ */
+QString diagramTypeToString(Uml::Diagram_Type dt); 
+
+/**
  * Return type of parseOperation()
  */
 enum Parse_Status {




More information about the umbrello-devel mailing list