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

Andi Fischer andi.fischer at hispeed.ch
Wed Jun 3 18:47:30 UTC 2009


SVN commit 977275 by fischer:

Some Krazy issues about [foreach] fixed.

 M  +8 -10     dialogs/umlforeignkeyconstraintdialog.cpp  
 M  +3 -9      main.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umlforeignkeyconstraintdialog.cpp #977274:977275
@@ -4,7 +4,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *  copyright (C) 2003-2008                                                *
+ *  copyright (C) 2003-2009                                                *
  *  Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                   *
  ***************************************************************************/
 
@@ -35,7 +35,6 @@
 #include <kmessagebox.h>
 
 #include <QtGui/QLabel>
-#include <QtGui/QLayout>
 #include <QtGui/QGridLayout>
 #include <QtGui/QGroupBox>
 #include <QtGui/QVBoxLayout>
@@ -43,8 +42,10 @@
 #include <QtGui/QApplication>
 #include <QtGui/QTreeWidget>
 
+typedef QPair<UMLEntityAttribute*, UMLEntityAttribute*> EntityAttributePair;
+
 UMLForeignKeyConstraintDialog::UMLForeignKeyConstraintDialog(QWidget* parent, UMLForeignKeyConstraint* pForeignKeyConstraint)
-    : KPageDialog(parent)
+  : KPageDialog(parent)
 {
     setCaption(i18n("Foreign Key Setup"));
     setButtons(Help | Ok | Apply | Cancel);
@@ -94,8 +95,7 @@
     m_pReferencedAttributeList.removeAt(indexR);
 
     // add to local cache of mapping
-    QPair<UMLEntityAttribute*, UMLEntityAttribute*> pair =
-        qMakePair(localColumn, referencedColumn);
+    EntityAttributePair pair = qMakePair(localColumn, referencedColumn);
     m_pAttributeMapList.append(pair);
     // update mapping view
 
@@ -121,7 +121,7 @@
     }
 
     //find pair in local cache
-    QPair<UMLEntityAttribute*, UMLEntityAttribute*> pair = m_pAttributeMapList.at(indexP);
+    EntityAttributePair pair = m_pAttributeMapList.at(indexP);
 
     // remove them from the view and the list
     m_ColumnWidgets.mappingTW->takeTopLevelItem(indexP);
@@ -136,8 +136,7 @@
     m_ColumnWidgets.localColumnCB->addItem((pair.first)->toString(Uml::st_SigNoVis));
     m_ColumnWidgets.referencedColumnCB->addItem((pair.second)->toString(Uml::st_SigNoVis));
 
-    QPair<UMLEntityAttribute*, UMLEntityAttribute*> p;
-    foreach(p, m_pAttributeMapList) {
+    foreach(const EntityAttributePair& p, m_pAttributeMapList) {
         uDebug() << (p.first)->getName() << " " << (p.first)->getBaseType() << " "
                  << (p.second)->getName() << " " << (p.second)->getBaseType();
     }
@@ -175,8 +174,7 @@
     m_pForeignKeyConstraint->clearMappings();
 
     // add all mappings  present in local cache
-    QPair<UMLEntityAttribute*, UMLEntityAttribute*> pair;
-    foreach(pair, m_pAttributeMapList) {
+    foreach(const EntityAttributePair& pair, m_pAttributeMapList) {
         if (!m_pForeignKeyConstraint->addEntityAttributePair(pair.first, pair.second)) {
             return false;
         }
--- trunk/KDE/kdesdk/umbrello/umbrello/main.cpp #977274:977275
@@ -29,26 +29,21 @@
 #include "umlviewimageexportermodel.h"
 #include "umbrellosettings.h"
 
-
 /**
  * Description for this application
  */
 static const char description[] =
     I18N_NOOP("Umbrello UML Modeller");
 
-
 /**
- * @todo Add options to use the documentation generators from command line.
- */
-/**
  * Determines if the application GUI should be shown based on command line arguments.
+ * @todo Add options to use the documentation generators from command line.
  *
  * @param args The command line arguments given.
  * @return True if the GUI should be shown, false otherwise.
  */
 bool getShowGUI(KCmdLineArgs *args);
 
-
 /**
  * Initializes the document used by the application.
  * If a file was specified in command line arguments, opens that file. Else, it
@@ -59,7 +54,6 @@
  */
 void initDocument(KCmdLineArgs *args);
 
-
 /**
  * Export all the views in the document using the command line args set by the user.
  * Errors that occurred while exporting, if any, are shown using uError().
@@ -104,8 +98,8 @@
         initDocument(args);
 
         if (args->isSet("export-formats")) {
-            foreach(QString type, UMLViewImageExporterModel::supportedImageTypes())
-                fprintf(stderr,"%s\n",qPrintable(type));
+            foreach(const QString& type, UMLViewImageExporterModel::supportedImageTypes())
+                fprintf(stderr, "%s\n", qPrintable(type));
             return 0;
         }
         // export option




More information about the umbrello-devel mailing list