[Uml-devel] KDE/kdesdk/umbrello/umbrello/dialogs
Andi Fischer
andi.fischer at hispeed.ch
Thu Aug 14 13:01:27 UTC 2008
SVN commit 847019 by fischer:
Replacing all q3 widgets.
M +46 -50 statedialog.cpp
M +46 -49 statedialog.h
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/statedialog.cpp #847018:847019
@@ -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,27 +11,26 @@
// own header
#include "statedialog.h"
-//qt includes
-#include <QtGui/QLabel>
-#include <QtGui/QFrame>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QGridLayout>
-#include <q3multilineedit.h>
-#include <q3groupbox.h>
+// local includes
+#include "umlview.h"
+#include "statewidget.h"
+#include "dialog_utils.h"
+#include "icon_utils.h"
-//kde includes
+// kde includes
#include <kvbox.h>
#include <klineedit.h>
#include <klocale.h>
#include <kfontdialog.h>
+#include <ktextedit.h>
-//local includes
-#include "umlview.h"
-#include "statewidget.h"
-#include "dialog_utils.h"
-#include "icon_utils.h"
+// qt includes
+#include <QtGui/QLabel>
+#include <QtGui/QFrame>
+#include <QtGui/QGridLayout>
+#include <QtGui/QGroupBox>
+#include <QtGui/QHBoxLayout>
-
StateDialog::StateDialog( UMLView * pView, StateWidget * pWidget )
: KPageDialog( pView )
{
@@ -69,8 +67,9 @@
void StateDialog::setupPages()
{
setupGeneralPage();
- if( m_pStateWidget -> getStateType() == StateWidget::Normal )
+ if ( m_pStateWidget->getStateType() == StateWidget::Normal ) {
setupActivityPage();
+ }
setupColorPage();
setupFontPage();
}
@@ -78,23 +77,20 @@
void StateDialog::applyPage( KPageWidgetItem*item )
{
m_bChangesMade = true;
- if ( item == pageGeneral )
- {
- m_pStateWidget -> setName( m_GenPageWidgets.nameLE -> text() );
- m_pStateWidget -> setDoc( m_GenPageWidgets.docMLE -> text() );
+ if ( item == pageGeneral ) {
+ m_pStateWidget->setName( m_GenPageWidgets.nameLE->text() );
+ m_pStateWidget->setDoc( m_GenPageWidgets.docMLE->toPlainText() );
}
- else if ( item == pageActivity )
- {
- if( m_pActivityPage )
- m_pActivityPage -> updateActivities();
+ else if ( item == pageActivity ) {
+ if ( m_pActivityPage ) {
+ m_pActivityPage->updateActivities();
+ }
}
- else if ( item == pageColor )
- {
- m_pColorPage -> updateUMLWidget();
+ else if ( item == pageColor ) {
+ m_pColorPage->updateUMLWidget();
}
- else if ( item == pageFont )
- {
- m_pStateWidget -> setFont( m_pChooser -> font() );
+ else if ( item == pageFont ) {
+ m_pStateWidget->setFont( m_pChooser->font() );
}
}
@@ -103,7 +99,7 @@
QString types[ ] = { i18nc("initial state in statechart", "Initial state"),
i18nc("state in statechart", "State"),
i18nc("end state in statechart", "End state") };
- StateWidget::StateType type = m_pStateWidget -> getStateType();
+ StateWidget::StateType type = m_pStateWidget->getStateType();
KVBox * page = new KVBox();
pageGeneral = new KPageWidgetItem( page, i18nc("general page", "General") );
@@ -111,49 +107,50 @@
pageGeneral->setIcon( Icon_Utils::DesktopIcon(Icon_Utils::it_Properties_General) );
addPage( pageGeneral );
- m_GenPageWidgets.generalGB = new Q3GroupBox( i18n( "Properties"), (QWidget *)page );
+ m_GenPageWidgets.generalGB = new QGroupBox( i18n( "Properties"), (QWidget *)page );
QGridLayout * generalLayout = new QGridLayout( m_GenPageWidgets.generalGB );
- generalLayout -> setSpacing( spacingHint() );
- generalLayout -> setMargin( fontMetrics().height() );
+ generalLayout->setSpacing( spacingHint() );
+ generalLayout->setMargin( fontMetrics().height() );
Dialog_Utils::makeLabeledEditField( m_GenPageWidgets.generalGB, generalLayout, 0,
m_GenPageWidgets.typeL, i18n("State type:"),
m_GenPageWidgets.typeLE, types[ (int)type ] );
- m_GenPageWidgets.typeLE -> setEnabled( false );
+ m_GenPageWidgets.typeLE->setEnabled( false );
Dialog_Utils::makeLabeledEditField( m_GenPageWidgets.generalGB, generalLayout, 1,
m_GenPageWidgets.nameL, i18n("State name:"),
m_GenPageWidgets.nameLE );
- m_GenPageWidgets.docGB = new Q3GroupBox( i18n( "Documentation"), (QWidget *)page );
+ m_GenPageWidgets.docGB = new QGroupBox( i18n( "Documentation"), (QWidget *)page );
QHBoxLayout * docLayout = new QHBoxLayout( m_GenPageWidgets.docGB );
- docLayout -> setSpacing( spacingHint() );
- docLayout -> setMargin( fontMetrics().height() );
+ docLayout->setSpacing( spacingHint() );
+ docLayout->setMargin( fontMetrics().height() );
- m_GenPageWidgets.docMLE = new Q3MultiLineEdit( m_GenPageWidgets.docGB );
- m_GenPageWidgets.docMLE -> setText( m_pStateWidget -> getDoc() );
- docLayout -> addWidget( m_GenPageWidgets.docMLE );
+ m_GenPageWidgets.docMLE = new KTextEdit( m_GenPageWidgets.docGB );
+ m_GenPageWidgets.docMLE->setText( m_pStateWidget->getDoc() );
+ docLayout->addWidget( m_GenPageWidgets.docMLE );
- if( type != StateWidget::Normal ) {
- m_GenPageWidgets.nameLE -> setEnabled( false );
- m_GenPageWidgets.nameLE -> setText( "" );
+ if ( type != StateWidget::Normal ) {
+ m_GenPageWidgets.nameLE->setEnabled( false );
+ m_GenPageWidgets.nameLE->setText( "" );
} else
- m_GenPageWidgets.nameLE -> setText( m_pStateWidget -> getName() );
+ m_GenPageWidgets.nameLE->setText( m_pStateWidget->getName() );
}
void StateDialog::setupFontPage()
{
- if ( !m_pStateWidget )
+ if ( !m_pStateWidget ) {
return;
+ }
KVBox * page = new KVBox();
pageFont = new KPageWidgetItem( page,i18n("Font") );
pageFont->setHeader( i18n("Font Settings") );
pageFont->setIcon( Icon_Utils::DesktopIcon(Icon_Utils::it_Properties_Font) );
addPage( pageFont );
m_pChooser = new KFontChooser( (QWidget*)page, false, QStringList(), false);
- m_pChooser -> setFont( m_pStateWidget -> getFont() );
+ m_pChooser->setFont( m_pStateWidget->getFont() );
}
void StateDialog::setupColorPage()
@@ -165,7 +162,7 @@
addPage( pageColor );
QHBoxLayout * m_pColorLayout = new QHBoxLayout(colorPage);
m_pColorPage = new UMLWidgetColorPage( colorPage, m_pStateWidget );
- m_pColorLayout -> addWidget(m_pColorPage);
+ m_pColorLayout->addWidget(m_pColorPage);
}
void StateDialog::setupActivityPage()
@@ -178,8 +175,7 @@
QHBoxLayout * activityLayout = new QHBoxLayout( activityPage );
m_pActivityPage = new ActivityPage( activityPage, m_pStateWidget );
- activityLayout -> addWidget( m_pActivityPage );
+ activityLayout->addWidget( m_pActivityPage );
}
-
#include "statedialog.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/statedialog.h #847018:847019
@@ -1,53 +1,49 @@
/***************************************************************************
- * *
* 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 STATEDIALOG_H
#define STATEDIALOG_H
-//kde class includes
-#include <kpagedialog.h>
-
-//local class includes
+// local class includes
#include "umlwidgetcolorpage.h"
#include "activitypage.h"
-//Added by qt3to4:
-#include <QLabel>
+// kde class includes
+#include <kpagedialog.h>
+
//forward declarations
class UMLView;
class StateWidget;
-class QLabel;
-class KLineEdit;
-class Q3MultiLineEdit;
-class Q3GroupBox;
class KFontChooser;
+class KLineEdit;
+class QGroupBox;
+class QLabel;
+class KTextEdit;
/**
* Displays the properties for a @ref StateWidget
- *
* @author Paul Hensgen
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
-
-class StateDialog : public KPageDialog {
+class StateDialog : public KPageDialog
+{
Q_OBJECT
public:
/**
- * Constructor
+ * Constructor
*/
StateDialog( UMLView * pView, StateWidget * pWidget );
/**
- * Returns whether changes were made.
+ * Returns whether changes were made.
*/
bool getChangesMade() {
return m_bChangesMade;
@@ -56,84 +52,85 @@
protected slots:
/**
- * Entered when OK button pressed.
- */
+ * Entered when OK button pressed.
+ */
void slotOk();
/**
- * Entered when Apply button pressed.
- */
+ * Entered when Apply button pressed.
+ */
void slotApply();
+
protected:
/**
- * Sets up the pages of the dialog.
- */
+ * Sets up the pages of the dialog.
+ */
void setupPages();
/**
- * Sets up the general page of the dialog.
- */
+ * Sets up the general page of the dialog.
+ */
void setupGeneralPage();
/**
- * Sets up the color page.
- */
+ * Sets up the color page.
+ */
void setupColorPage();
/**
- * Sets up the font selection page.
- */
+ * Sets up the font selection page.
+ */
void setupFontPage();
/**
- * Sets up the activity page.
- */
+ * Sets up the activity page.
+ */
void setupActivityPage();
/**
- * Applys changes to the given page.
- */
+ * Applys changes to the given page.
+ */
void applyPage( KPageWidgetItem*item );
/**
- * Font chooser widget for font page.
- */
+ * Font chooser widget for font page.
+ */
KFontChooser * m_pChooser;
/**
- * Color page
- */
+ * Color page
+ */
UMLWidgetColorPage * m_pColorPage;
/**
- * Activity page.
- */
+ * Activity page.
+ */
ActivityPage * m_pActivityPage;
/**
- * The widget to represent.
- */
+ * The widget to represent.
+ */
StateWidget * m_pStateWidget;
/**
- * The diagram the widget is on.
- */
+ * The diagram the widget is on.
+ */
UMLView * m_pView;
/**
- * Holds whether changes in the dialog have been made.
- */
+ * Holds whether changes in the dialog have been made.
+ */
bool m_bChangesMade;
struct GeneralPageWidgets {
QLabel * nameL, * typeL;
KLineEdit * nameLE, * typeLE;
- Q3MultiLineEdit * docMLE;
-
- Q3GroupBox * docGB, * generalGB;
+ KTextEdit * docMLE;
+ QGroupBox * docGB, * generalGB;
}
m_GenPageWidgets;
- KPageWidgetItem *pageColor,*pageActivity,*pageFont,*pageGeneral;
+
+ KPageWidgetItem *pageColor, *pageActivity, *pageFont, *pageGeneral;
};
#endif
More information about the umbrello-devel
mailing list