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

Andi Fischer andi.fischer at hispeed.ch
Sun Jul 27 10:15:55 UTC 2008


SVN commit 838231 by fischer:

Removing from umlwidget the dependencies to codegenerator and simplecodegenerator.

 M  +50 -42    uml.cpp  
 M  +11 -4     uml.h  
 M  +1 -6      umlwidget.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #838230:838231
@@ -1,5 +1,4 @@
 /***************************************************************************
- *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
@@ -12,46 +11,6 @@
 // own header
 #include "uml.h"
 
-// qt includes
-#include <QtCore/QTimer>
-#include <QtCore/QRegExp>
-#include <QtGui/QClipboard>
-#include <QtGui/QSlider>
-#include <QtGui/QToolButton>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QMenuItem>
-#include <QtGui/QDockWidget>
-#include <QtGui/QStackedWidget>
-#include <QtGui/QPrinter>
-#include <QtGui/QPrintDialog>
-
-// kde includes
-#include <kaction.h>
-#include <kactioncollection.h>
-#include <kstandardaction.h>
-#include <ktoggleaction.h>
-#include <krecentfilesaction.h>
-#include <kconfig.h>
-#include <kcursor.h>
-#include <kdebug.h>
-#ifdef Q_WS_WIN
-#include <QtGui/QFileDialog>
-#else
-#include <kfiledialog.h>
-#endif
-#include <klocale.h>
-#include <kmenubar.h>
-#include <kmessagebox.h>
-#include <kstandarddirs.h>
-#include <kstatusbar.h>
-#include <ktip.h>
-#include <ktabwidget.h>
-#include <kactionmenu.h>
-#include <kmenu.h>
-#include <kxmlguifactory.h>
-#include <kapplication.h>
-#include <kdeprintdialog.h>
-
 // app includes
 #include "umldoc.h"
 #include "umllistview.h"
@@ -91,7 +50,46 @@
 #include "docgenerators/docbookgenerator.h"
 #include "docgenerators/xhtmlgenerator.h"
 
+// kde includes
+#include <kaction.h>
+#include <kactioncollection.h>
+#include <kstandardaction.h>
+#include <ktoggleaction.h>
+#include <krecentfilesaction.h>
+#include <kconfig.h>
+#include <kcursor.h>
+#include <kdebug.h>
+#ifdef Q_WS_WIN
+#include <QtGui/QFileDialog>
+#else
+#include <kfiledialog.h>
+#endif
+#include <klocale.h>
+#include <kmenubar.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <kstatusbar.h>
+#include <ktip.h>
+#include <ktabwidget.h>
+#include <kactionmenu.h>
+#include <kmenu.h>
+#include <kxmlguifactory.h>
+#include <kapplication.h>
+#include <kdeprintdialog.h>
 
+// qt includes
+#include <QtCore/QTimer>
+#include <QtCore/QRegExp>
+#include <QtGui/QClipboard>
+#include <QtGui/QSlider>
+#include <QtGui/QToolButton>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QMenuItem>
+#include <QtGui/QDockWidget>
+#include <QtGui/QStackedWidget>
+#include <QtGui/QPrinter>
+#include <QtGui/QPrintDialog>
+
 // Static pointer, holding the last created instance.
 UMLApp* UMLApp::s_instance;
 
@@ -779,7 +777,7 @@
     UmbrelloSettings::setAutoGenerateAttributeAccessorsJava(optionState.codeGenerationState.javaCodeGenerationState.autoGenerateAttributeAccessors);
     UmbrelloSettings::setAutoGenerateAssocAccessorsJava(optionState.codeGenerationState.javaCodeGenerationState.autoGenerateAssocAccessors);
 
-//     CodeGenerator *codegen = UMLApp::app()->getGenerator();
+//     CodeGenerator *codegen = getGenerator();
 //     JavaCodeGenerator *javacodegen = dynamic_cast<JavaCodeGenerator*>(codegen);
 //     if (javacodegen)
 //         UmbrelloSettings::setBuildANTDocumentJava( javacodegen->getCreateANTBuildFile());
@@ -1598,6 +1596,16 @@
     return m_codegen;
 }
 
+bool UMLApp::isSimpleCodeGeneratorActive()
+{
+    if (m_codegen && dynamic_cast<SimpleCodeGenerator*>(m_codegen)) {
+        return true;
+    }
+    else {
+        return false;
+    }
+}
+
 void UMLApp::generateAllCode()
 {
     if (m_codegen) {
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.h #838230:838231
@@ -14,16 +14,16 @@
 
 #include "umlnamespace.h"
 
-#include <QtGui/QKeyEvent>
-#include <QtGui/QMenu>
-#include <QtGui/QUndoView>
-
 #include <kxmlguiwindow.h>
 #include <kdeversion.h>
 #include <kurl.h>
 #include <ksharedconfig.h>
 #include <kundostack.h>
 
+#include <QtGui/QKeyEvent>
+#include <QtGui/QMenu>
+#include <QtGui/QUndoView>
+
 // forward declaration of the UML classes
 class AlignToolBar;
 class CodeDocument;
@@ -205,6 +205,13 @@
     CodeGenerator* getGenerator();
 
     /**
+     * Determines if SimpleCodeGenerator is active.
+     *
+     * @return  true if SimpleCodeGenerator is active.
+     */
+    bool isSimpleCodeGeneratorActive();
+
+    /**
      * Set the current generator for this app.
      * If giveWarning is true, then a popup box warning that the
      * code generation library is out-of-date will show if you
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidget.cpp #838230:838231
@@ -1,5 +1,4 @@
 /***************************************************************************
- *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
@@ -28,8 +27,6 @@
 #include "umldoc.h"
 #include "umlview.h"
 #include "umlclassifierlistitemlist.h"
-#include "codegenerator.h"
-#include "codegenerators/simplecodegenerator.h"
 #include "listpopupmenu.h"
 #include "associationwidget.h"
 #include "dialogs/settingsdlg.h"
@@ -38,7 +35,6 @@
 #include "docwindow.h"
 #include "dialogs/classpropdlg.h"
 #include "clipboard/idchangelog.h"
-
 #include "cmds.h"
 
 using namespace Uml;
@@ -680,8 +676,7 @@
     m_pMenu = new ListPopupMenu(m_pView, this, multi, unique);
 
     // disable the "view code" menu for simple code generators
-    CodeGenerator * currentCG = UMLApp::app()->getGenerator();
-    if (currentCG && dynamic_cast<SimpleCodeGenerator*>(currentCG))
+    if (UMLApp::app()->isSimpleCodeGeneratorActive())
         m_pMenu->setActionEnabled(ListPopupMenu::mt_ViewCode, false);
 
     connect(m_pMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotMenuSelection(QAction*)));




More information about the umbrello-devel mailing list