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

Andi Fischer andi.fischer at hispeed.ch
Sun Aug 10 08:34:47 UTC 2008


SVN commit 844684 by fischer:

Small refactoring changes.

 M  +25 -32    assocpropdlg.cpp  
 M  +9 -12     assocpropdlg.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/assocpropdlg.cpp #844683:844684
@@ -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,16 +11,6 @@
 // own header
 #include "assocpropdlg.h"
 
-// qt/kde includes
-#include <QtGui/QLayout>
-#include <QtGui/QLabel>
-#include <QtGui/QFrame>
-#include <QtGui/QHBoxLayout>
-#include <klocale.h>
-#include <kmessagebox.h>
-#include <kdebug.h>
-#include <kvbox.h>
-
 // local includes
 #include "assocgenpage.h"
 #include "assocrolepage.h"
@@ -35,7 +24,18 @@
 #include "umlview.h"
 #include "icon_utils.h"
 
+// kde includes
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <kvbox.h>
 
+// qt includes
+#include <QtGui/QLayout>
+#include <QtGui/QLabel>
+#include <QtGui/QFrame>
+#include <QtGui/QHBoxLayout>
+
 AssocPropDlg::AssocPropDlg (QWidget *parent, AssociationWidget * assocWidget, int pageNum)
         : KPageDialog(parent)
 {
@@ -46,16 +46,13 @@
     setModal( true );
     setFaceType( KPageDialog::List );
     showButtonSeparator( true );
-    init();
+
+    m_pGenPage = 0;
+    m_pRolePage = 0;
     m_pAssoc = assocWidget;
 
-    m_pDoc = ((UMLApp *)parent) -> getDocument(); // needed?
-
     setupPages(assocWidget);
-#ifdef __GNUC__
-#warning "kde4: port it"
-#endif
-    //showPage(pageNum);
+
     connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
     connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
 }
@@ -64,13 +61,6 @@
 {
 }
 
-void AssocPropDlg::init ( )
-{
-    m_pAssoc = 0;
-    m_pGenPage = 0;
-    m_pRolePage = 0;
-}
-
 void AssocPropDlg::slotOk()
 {
     slotApply();
@@ -95,6 +85,8 @@
 // void AssocPropDlg::setupPages (UMLObject * c)
 void AssocPropDlg::setupPages (AssociationWidget *assocWidget)
 {
+    UMLDoc* umlDoc = UMLApp::app()->getDocument();
+
     // general page
     QFrame *page = new QFrame();
     KPageWidgetItem *pageItem = new KPageWidgetItem( page, i18nc("general settings", "General"));
@@ -102,9 +94,9 @@
     pageItem->setIcon( Icon_Utils::DesktopIcon(Icon_Utils::it_Properties_General) );
     addPage( pageItem );
     QHBoxLayout *genLayout = new QHBoxLayout(page);
-    page -> setMinimumSize(310, 330);
-    m_pGenPage = new AssocGenPage (m_pDoc, page, assocWidget);
-    genLayout -> addWidget(m_pGenPage);
+    page->setMinimumSize(310, 330);
+    m_pGenPage = new AssocGenPage (umlDoc, page, assocWidget);
+    genLayout->addWidget(m_pGenPage);
 
     // role page
     QFrame *newPage = new QFrame();
@@ -113,17 +105,18 @@
     pageItem->setIcon( Icon_Utils::DesktopIcon(Icon_Utils::it_Properties_Roles) );
     addPage( pageItem );
     QHBoxLayout * roleLayout = new QHBoxLayout(newPage);
-    // newPage -> setMinimumSize(310, 330);
-    m_pRolePage = new AssocRolePage(m_pDoc, newPage, assocWidget);
-    roleLayout -> addWidget(m_pRolePage);
+    // newPage->setMinimumSize(310, 330);
+    m_pRolePage = new AssocRolePage(umlDoc, newPage, assocWidget);
+    roleLayout->addWidget(m_pRolePage);
 
     setupFontPage();
 }
 
 void AssocPropDlg::setupFontPage()
 {
-    if( !m_pAssoc)
+    if ( !m_pAssoc) {
         return;
+    }
 
     KVBox *page = new KVBox();
     KPageWidgetItem* pageItem = new KPageWidgetItem( page, i18n("Font"));
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/assocpropdlg.h #844683:844684
@@ -1,32 +1,33 @@
 /***************************************************************************
- *                                                                         *
  *   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) 2002-2006                                               *
+ *   copyright (C) 2002-2008                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
 #ifndef ASSOCPROPDLG_H
 #define ASSOCPROPDLG_H
 
-//kde class includes
+#include "associationwidget.h"
+
+// kde includes
 #include <kpagedialog.h>
 #include <kfontdialog.h>
-#include "../associationwidget.h"
 
 class AssocRolePage;
 class AssocGenPage;
 class UMLDoc;
-// // //
+
 /**
  * Based off of AssocPropDlg class
  * @author Brian Thomas <Brian.A.Thomas at gsfc.nasa.gov>
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
-class AssocPropDlg : public KPageDialog {
+class AssocPropDlg : public KPageDialog
+{
     Q_OBJECT
 public:
 
@@ -36,7 +37,6 @@
      *  @param  a       The Association Widget to display properties of.
      *  @param  pageNum The page to show first.
      */
-
     AssocPropDlg(QWidget *parent, AssociationWidget *a, int pageNum = 0);
 
     /**
@@ -49,7 +49,6 @@
 protected:
     void setupPages(AssociationWidget * assocWidget);
     void setupFontPage();
-    void init();
 
 protected slots:
     void slotOk();
@@ -58,12 +57,10 @@
 private:
     AssocGenPage *m_pGenPage;
     AssocRolePage *m_pRolePage;
-    KFontChooser * m_pChooser;
+    KFontChooser *m_pChooser;
     AssociationWidget *m_pAssoc;
 
-    UMLDoc *m_pDoc; // is this needed??
-
 };
 
-#endif /* ASSOCPROPDLG_H */
+#endif
 




More information about the umbrello-devel mailing list