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

Andi Fischer andi.fischer at hispeed.ch
Sun Dec 26 16:00:58 UTC 2010


SVN commit 1209429 by fischer:

Adding a new code edit widget with code highlighting.

 M  +12 -0     CMakeLists.txt  
 M  +4 -3      dialogs/classifierlistpage.cpp  
 M  +2 -1      dialogs/classifierlistpage.h  
 M  +22 -1     dialogs/classpropdlg.cpp  
 M  +1 -46     dialogs/classpropdlg.h  
 M  +1 -1      dialogs/codeeditor.cpp  
 A             dialogs/codetextedit.cpp   [License: GPL (v2/3)]
 A             dialogs/codetextedit.h   [License: GPL (v2/3)]
 A             dialogs/codetexthighlighter.cpp   [License: GPL (v2/3)]
 A             dialogs/codetexthighlighter.h   [License: GPL (v2/3)]
 M  +4 -4      dialogs/codeviewerdialog.cpp  
 M  +5 -11     dialogs/codeviewerdialog.h  
 M  +2 -1      uml.cpp  
 M  +1 -2      umlclassifierlist.h  
 M  +2 -3      umlentitylist.h  


--- branches/work/soc-umbrello/umbrello/CMakeLists.txt #1209428:1209429
@@ -3,6 +3,16 @@
 
 add_definitions (-DQT3_SUPPORT_WARNINGS)
 
+# Some definitions for experimental code or debugging
+#add_definitions(-DWANT_LVTOOLTIP)                # umllistiew
+#add_definitions(-DXMI_FLAT_PACKAGES)             # umlobject
+#add_definitions(-DDEBUG_LVITEM_INSERTION_ORDER)  # umllistviewitem
+#add_definitions(-DTRY_BUGFIX_120682)             # model_utils
+#add_definitions(-DQ_CC_MSVC)                     # preprocesslexer
+#add_definitions(-DDEBUG_PRINTING)                # umlview
+#add_definitions(-DVERBOSE_DEBUGGING)             # listpopupmenu, association, petaltree2uml,
+                                                  # umlobject, umldoc, classifierlistpage
+
 # Some Boost require exceptions
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  ${KDE4_ENABLE_EXCEPTIONS}")
 
@@ -164,6 +174,8 @@
     dialogs/codegenerationpolicypage.cpp
     dialogs/codeviewerdialog.cpp
     dialogs/codevieweroptionspage.cpp
+    dialogs/codetextedit.cpp
+    dialogs/codetexthighlighter.cpp
     dialogs/defaultcodegenpolicypage.cpp
     dialogs/diagramprintpage.cpp
     dialogs/dialog_utils.cpp
--- branches/work/soc-umbrello/umbrello/dialogs/classifierlistpage.cpp #1209428:1209429
@@ -11,6 +11,7 @@
 #include "classifierlistpage.h"
 
 #include "classifierlistitem.h"
+#include "codetextedit.h"
 #include "umldoc.h"
 #include "classifier.h"
 #include "enum.h"
@@ -221,7 +222,7 @@
     docLayout->setMargin(margin);
     if (m_itemType == ot_Operation) {
         m_pDocTE = new KTextEdit();
-        m_pCodeTE = new KTextEdit();
+        m_pCodeTE = new CodeTextEdit();
         KTabWidget* tabWidget = new KTabWidget();
         tabWidget->addTab(m_pDocTE, i18n("Comment"));
         tabWidget->addTab(m_pCodeTE, i18n("Source Code"));
@@ -265,7 +266,7 @@
     if ( !state ) {
         m_pDocTE->setText( "" );
         if (m_itemType == ot_Operation) {
-            m_pCodeTE->setText( "" );
+            m_pCodeTE->setPlainText( "" );
         }
         m_pTopArrowB->setEnabled( false );
         m_pUpArrowB->setEnabled( false );
@@ -353,7 +354,7 @@
         //now update screen
         m_pDocTE->setText( listItem->doc() );
         if (m_itemType == ot_Operation) {
-            m_pCodeTE->setText( dynamic_cast<UMLOperation*>(listItem)->getSourceCode() );
+            m_pCodeTE->setPlainText( dynamic_cast<UMLOperation*>(listItem)->getSourceCode() );
         }
         enableWidgets(true);
         m_pOldListItem = listItem;
--- branches/work/soc-umbrello/umbrello/dialogs/classifierlistpage.h #1209428:1209429
@@ -18,6 +18,7 @@
 //qt  includes
 #include <QtGui/QWidget>
 
+class CodeTextEdit;
 class ListPopupMenu;
 class UMLObject;
 class UMLClassifier;
@@ -76,7 +77,7 @@
     QGroupBox* m_pDocGB;
     QGroupBox* m_pItemListGB;
     KTextEdit* m_pDocTE;
-    KTextEdit* m_pCodeTE;
+    CodeTextEdit*  m_pCodeTE;
     QListWidget* m_pItemListLB;
 
     QToolButton* m_pTopArrowB;
--- branches/work/soc-umbrello/umbrello/dialogs/classpropdlg.cpp #1209428:1209429
@@ -38,6 +38,13 @@
 #include <QtGui/QHBoxLayout>
 
 
+/**
+ *  Sets up a ClassPropDlg.
+ *
+ *  @param parent    The parent of the ClassPropDlg
+ *  @param c         The UMLObject to display properties of.
+ *  @param assoc     Determines whether to display associations
+ */
 ClassPropDlg::ClassPropDlg(QWidget *parent, UMLObject * c, bool assoc)
         : KPageDialog(parent)
 {
@@ -52,6 +59,12 @@
     connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
 }
 
+/**
+ *  Sets up a ClassPropDlg.
+ *
+ *  @param  parent  The parent of the ClassPropDlg
+ *  @param  o       The ObjectWidget to display properties of.
+ */
 ClassPropDlg::ClassPropDlg(QWidget *parent, ObjectWidget *o)
         : KPageDialog(parent)
 {
@@ -70,6 +83,12 @@
     connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
 }
 
+/**
+ *  Sets up a ClassPropDlg.
+ *
+ *  @param  parent  The parent of the ClassPropDlg
+ *  @param  o       The UMLWidget to display properties of.
+ */
 ClassPropDlg::ClassPropDlg(QWidget *parent, UMLWidget *w)
         : KPageDialog(parent)
 {
@@ -124,6 +143,9 @@
     m_pDoc = UMLApp::app()->document();
 }
 
+/**
+ *  Standard destructor.
+ */
 ClassPropDlg::~ClassPropDlg()
 {
 }
@@ -384,5 +406,4 @@
     m_pChooser->setFont( m_pWidget->font() );
 }
 
-
 #include "classpropdlg.moc"
--- branches/work/soc-umbrello/umbrello/dialogs/classpropdlg.h #1209428:1209429
@@ -1,11 +1,10 @@
 /***************************************************************************
- *                                                                         *
  *   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     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2003-2008                                               *
+ *   copyright (C) 2003-2010                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -43,79 +42,36 @@
 {
     Q_OBJECT
 public:
-
-    /**
-     *  Sets up a ClassPropDlg.
-     *
-     *  @param parent    The parent of the ClassPropDlg
-     *  @param c         The UMLObject to display properties of.
-     *  @param assoc     Determines whether to display associations
-     */
     ClassPropDlg(QWidget *parent, UMLObject *c, bool assoc = false);
-
-    /**
-     *  Sets up a ClassPropDlg.
-     *
-     *  @param  parent  The parent of the ClassPropDlg
-     *  @param  o       The ObjectWidget to display properties of.
-     */
     ClassPropDlg(QWidget *parent, ObjectWidget * o);
-
-    /**
-     *  Sets up a ClassPropDlg.
-     *
-     *  @param  parent  The parent of the ClassPropDlg
-     *  @param  o       The UMLWidget to display properties of.
-     */
     ClassPropDlg(QWidget *parent, UMLWidget * o);
 
-
-    /**
-     *  Standard deconstructor.
-     */
     ~ClassPropDlg();
 
     enum Page{page_gen = 0, page_att, page_op, page_entatt, page_constraint , page_template,
               page_assoc, page_options, page_color, page_font};
 
 protected slots:
-
     void slotOk();
-
     void slotApply();
 
 protected:
-
     void setupPages(bool assoc = false);
-
     void setupGeneralPage();
-
     void setupColorPage();
-
     void setupDisplayPage();
-
     void setupAttributesPage();
-
     void setupOperationsPage();
-
     void setupTemplatesPage();
-
     void setupEnumLiteralsPage();
-
     void setupEntityAttributesPage();
-
     void setupEntityConstraintsPage();
-
     void setupContentsPage();
-
     void setupAssociationsPage();
-
     void setupInstancePages();
-
     void setupFontPage();
 
 private:
-
     KFontChooser*        m_pChooser;
     ClassGenPage*        m_pGenPage;
     ClassifierListPage*  m_pAttPage;
@@ -142,7 +98,6 @@
     Page_Type m_Type;
 
 private:
-
     void init();
 
     QFrame* createPage(const QString& name, const QString& header, Icon_Utils::Icon_Type icon);
--- branches/work/soc-umbrello/umbrello/dialogs/codeeditor.cpp #1209428:1209429
@@ -90,7 +90,7 @@
 
 Settings::CodeViewerState CodeEditor::getState()
 {
-    return m_parentDlg->getState();
+    return m_parentDlg->state();
 }
 
 QLabel * CodeEditor::getComponentLabel()
--- branches/work/soc-umbrello/umbrello/dialogs/codeviewerdialog.cpp #1209428:1209429
@@ -52,10 +52,10 @@
         setObjectName( "CodeViewerDialog" );
     }
 
-    setFont( getState().font );
+    setFont( state().font );
 
-    m_highlightCheckBox->setChecked( getState().blocksAreHighlighted );
-    m_showHiddenCodeCB->setChecked ( getState().showHiddenBlocks );
+    m_highlightCheckBox->setChecked( state().blocksAreHighlighted );
+    m_showHiddenCodeCB->setChecked ( state().showHiddenBlocks );
 
     int margin = fontMetrics().height();
     CodeViewerDialogBase::gridLayout->setMargin(margin);
@@ -79,7 +79,7 @@
 /**
  * Return the code viewer state.
  */
-Settings::CodeViewerState CodeViewerDialog::getState()
+Settings::CodeViewerState CodeViewerDialog::state()
 {
     return m_state;
 }
--- branches/work/soc-umbrello/umbrello/dialogs/codeviewerdialog.h #1209428:1209429
@@ -1,19 +1,13 @@
-
 /***************************************************************************
-                          codeviewerdialog.h  -  description
-                             -------------------
-    begin                : Fri Aug 1 2003
-    copyright            : (C) 2003 by Brian Thomas
-    email                : brian.thomas at gsfc.nasa.gov
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
  *   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     *
  *   (at your option) any later version.                                   *
  *                                                                         *
+ *   copyright (C) 2003                                                    *
+ *   Brian Thomas <brian.thomas at gsfc.nasa.gov>                             *
+ *   copyright (C) 2004-2010                                               *
+ *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
 #ifndef CODEVIEWERDIALOG_H
@@ -40,7 +34,7 @@
 
     ~CodeViewerDialog ();
 
-    Settings::CodeViewerState getState( );
+    Settings::CodeViewerState state( );
 
     void addCodeDocument( CodeDocument * doc);
 
--- branches/work/soc-umbrello/umbrello/uml.cpp #1209428:1209429
@@ -209,6 +209,7 @@
 /**
  * Initializes the KActions and the status bar of the application 
  * and calls setupGUI().
+ * Note: Check also the file umbrelloui.rc and add actions there too.
  */
 void UMLApp::initActions()
 {
@@ -1860,7 +1861,7 @@
                 Settings::OptionState& optionState = Settings::getOptionState();
                 CodeViewerDialog * dialog = currentGen->getCodeViewerDialog(this,cdoc,optionState.codeViewerState);
                 dialog->exec();
-                optionState.codeViewerState = dialog->getState();
+                optionState.codeViewerState = dialog->state();
                 delete dialog;
                 dialog = NULL;
             } else {
--- branches/work/soc-umbrello/umbrello/umlclassifierlist.h #1209428:1209429
@@ -1,11 +1,10 @@
 /***************************************************************************
- *                                                                         *
  *   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     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2003-2007                                               *
+ *   copyright (C) 2003-2010                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
--- branches/work/soc-umbrello/umbrello/umlentitylist.h #1209428:1209429
@@ -1,18 +1,17 @@
 /***************************************************************************
- *                                                                         *
  *   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     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2003-2006                                               *
+ *   copyright (C) 2003-2010                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
 #ifndef UMLENTITYLIST_H
 #define UMLENTITYLIST_H
 
-#include <qlist.h>
+#include <QtCore/QList>
 
 // forward declaration
 class UMLEntity;




More information about the umbrello-devel mailing list