[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Mon Sep 15 10:00:25 UTC 2008
SVN commit 861148 by fischer:
r861147 from trunk applied.
M +47 -43 dialogs/classgenpage.cpp
M +5 -4 dialogs/classgenpage.h
M +17 -0 dialogs/classwizard.cpp
M +2 -2 umlobject.cpp
--- branches/work/soc-umbrello/umbrello/dialogs/classgenpage.cpp #861147:861148
@@ -46,45 +46,56 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QGridLayout>
-ClassGenPage::ClassGenPage(UMLDoc* d, QWidget* parent, UMLObject* o) : QWidget(parent)
+ClassGenPage::ClassGenPage(UMLDoc* d, QWidget* parent, UMLObject* o)
+ : QWidget(parent), m_pObject(o), m_pWidget(0), m_pInstanceWidget(0), m_pUmldoc(d)
{
- m_pWidget = 0;
- m_pObject = 0;
- m_pInstanceWidget = 0;
+ int margin = fontMetrics().height();
+
+ setMinimumSize(310,330);
+ QVBoxLayout * topLayout = new QVBoxLayout(this);
+ topLayout->setSpacing(6);
+
+ // setup name
QString name;
- int margin = fontMetrics().height();
Uml::Object_Type t = o->getBaseType();
- m_pUmldoc = d;
- if (t == Uml::ot_Class) {
+ switch (t) {
+ case Uml::ot_Class:
name = i18n("Class &name:");
- } else if (t == Uml::ot_Actor) {
+ break;
+ case Uml::ot_Actor:
name = i18n("Actor &name:");
- } else if (t == Uml::ot_Package) {
+ break;
+ case Uml::ot_Package:
name = i18n("Package &name:");
- } else if (t == Uml::ot_UseCase) {
+ break;
+ case Uml::ot_UseCase:
name = i18n("Use case &name:");
- } else if (t == Uml::ot_Interface) {
+ break;
+ case Uml::ot_Interface:
name = i18n("Interface &name:");
- } else if (t == Uml::ot_Component) {
+ break;
+ case Uml::ot_Component:
name = i18n("Component &name:");
- } else if (t == Uml::ot_Node) {
+ break;
+ case Uml::ot_Node:
name = i18n("Node &name:");
- } else if (t == Uml::ot_Artifact) {
+ break;
+ case Uml::ot_Artifact:
name = i18n("Artifact &name:");
- } else if (t == Uml::ot_Enum) {
+ break;
+ case Uml::ot_Enum:
name = i18n("Enum &name:");
- } else if (t == Uml::ot_Datatype) {
+ break;
+ case Uml::ot_Datatype:
name = i18n("Datatype &name:");
- } else if (t == Uml::ot_Entity) {
+ break;
+ case Uml::ot_Entity:
name = i18n("Entity &name:");
- } else {
+ break;
+ default:
uWarning() << "creating class gen page for unknown widget type";
+ break;
}
- setMinimumSize(310,330);
- QVBoxLayout * topLayout = new QVBoxLayout(this);
- topLayout->setSpacing(6);
-
- // setup name
QGridLayout * m_pNameLayout = new QGridLayout();
m_pNameLayout->setSpacing(6);
topLayout->addLayout(m_pNameLayout, 4);
@@ -220,7 +231,6 @@
docLayout->addWidget(m_pDoc);
topLayout->addWidget(m_pDocGB);
- m_pObject = o;
// setup fields
m_pClassNameLE->setText(o->getName());
m_pDoc->setText(o->getDoc());
@@ -242,16 +252,14 @@
m_pDoc->setLineWrapMode(QTextEdit::WidgetWidth);
}
-ClassGenPage::ClassGenPage(UMLDoc* d, QWidget* parent, ObjectWidget* o) : QWidget(parent)
+ClassGenPage::ClassGenPage(UMLDoc* d, QWidget* parent, ObjectWidget* o)
+ : QWidget(parent), m_pObject(0), m_pWidget(o), m_pInstanceWidget(0), m_pUmldoc(d)
{
- m_pObject = 0;
- m_pInstanceWidget = 0;
- m_pWidget = o;
m_pDeconCB = 0;
m_pMultiCB = 0;
+
int margin = fontMetrics().height();
- //int t = o->getBaseType();
- m_pUmldoc = d;
+
setMinimumSize(310,330);
QGridLayout * topLayout = new QGridLayout(this);
topLayout->setSpacing(6);
@@ -288,8 +296,7 @@
if ( m_pDrawActorCB->isChecked() )
m_pMultiCB->setEnabled( false );
}
- else // sequence diagram
- {
+ else { // sequence diagram
m_pDeconCB = new QCheckBox(i18n("Show destruction"), this);
m_pDeconCB->setChecked(o->showDestruction());
m_pNameLayout->addWidget(m_pDeconCB, 2,1);
@@ -305,22 +312,19 @@
m_pDoc->setLineWrapMode(QTextEdit::WidgetWidth);
m_pDoc->setText(o->documentation());
docLayout->addWidget(m_pDoc);
- m_pObject = 0; // needs to be set to zero
if (m_pMultiCB) {
connect( m_pDrawActorCB, SIGNAL( toggled( bool ) ), this, SLOT( slotActorToggled( bool ) ) );
}
}
-ClassGenPage::ClassGenPage(UMLDoc* d, QWidget* parent, UMLWidget* widget) : QWidget(parent)
+ClassGenPage::ClassGenPage(UMLDoc* d, QWidget* parent, UMLWidget* widget)
+ : QWidget(parent), m_pObject(0), m_pWidget(0), m_pInstanceWidget(widget), m_pUmldoc(d)
{
- m_pWidget = 0;
- m_pObject = 0;
- m_pInstanceWidget = widget;
m_pDeconCB = 0;
m_pMultiCB = 0;
+
int margin = fontMetrics().height();
- //int t = o->getBaseType();
- m_pUmldoc = d;
+
setMinimumSize(310,330);
QGridLayout* topLayout = new QGridLayout(this);
topLayout->setSpacing(6);
@@ -371,7 +375,6 @@
m_pDoc->setLineWrapMode(QTextEdit::WidgetWidth);
m_pDoc->setText(widget->documentation());
docLayout->addWidget(m_pDoc);
- m_pObject = 0; // needs to be set to zero
}
ClassGenPage::~ClassGenPage()
@@ -451,6 +454,7 @@
} else {
m_pObject->setName(name);
}
+
Uml::Visibility s;
if (m_pPublicRB->isChecked())
s = Uml::Visibility::Public;
@@ -480,7 +484,6 @@
(static_cast<UMLArtifact*>(m_pObject))->setDrawAsType(drawAsType);
m_pObject->emitModified();
}
-
} // end if m_pObject
else if (m_pWidget) {
m_pWidget->setInstanceName(m_pInstanceLE->text());
@@ -501,7 +504,8 @@
} else {
o->setName(name);
}
- } else if (m_pInstanceWidget) {
+ } // end if m_pWidget
+ else if (m_pInstanceWidget) {
m_pInstanceWidget->setInstanceName(m_pInstanceLE->text());
QString name = m_pClassNameLE->text();
m_pInstanceWidget->setDocumentation(m_pDoc->toPlainText());
@@ -514,7 +518,7 @@
o->setName(name);
}
o->setStereotype( m_pStereoTypeCB->currentText() );
- }
+ } // end if m_pInstanceWidget
}
/**
--- branches/work/soc-umbrello/umbrello/dialogs/classgenpage.h #861147:861148
@@ -73,6 +73,11 @@
void updateObject();
private:
+ UMLObject * m_pObject;
+ ObjectWidget * m_pWidget;
+ UMLWidget * m_pInstanceWidget;
+ UMLDoc * m_pUmldoc;
+
QGroupBox * m_pDocGB;
QGroupBox * m_pButtonGB;
QLabel * m_pNameL, * m_pInstanceL, * m_pStereoTypeL, * m_pPackageL;
@@ -81,10 +86,6 @@
QRadioButton * m_pPublicRB, * m_pPrivateRB, * m_pProtectedRB, * m_pImplementationRB;
QCheckBox * m_pMultiCB, * m_pDrawActorCB, * m_pAbstractCB, * m_pDeconCB;
KTextEdit * m_pDoc;
- UMLObject * m_pObject;
- UMLDoc * m_pUmldoc;
- ObjectWidget * m_pWidget;
- UMLWidget * m_pInstanceWidget;
QGroupBox * m_pDrawAsGB;
QRadioButton * m_pDefaultRB, * m_pFileRB, * m_pLibraryRB, * m_pTableRB;
QCheckBox * m_pExecutableCB;
--- branches/work/soc-umbrello/umbrello/dialogs/classwizard.cpp #861147:861148
@@ -23,6 +23,7 @@
#include "umlclassifierlistitemlist.h"
// kde includes
+#include <kdebug.h>
#include <khelpmenu.h>
#include <klocale.h>
@@ -127,6 +128,9 @@
return m_OperationsPage;
}
+/**
+ * Advances to the next page. Is called when the next button is pressed.
+ */
void ClassWizard::next()
{
QWizardPage* page = currentPage();
@@ -138,6 +142,9 @@
QWizard::next();
}
+/**
+ * Back button was called.
+ */
void ClassWizard::back()
{
QWizardPage* page = currentPage();
@@ -149,8 +156,15 @@
QWizard::back();
}
+/**
+ * Finish button was called.
+ * @todo Calling m_pGenPage->updateObject() twice is ugly,
+ * but without the first call the documentation of the class is cleared.
+ */
void ClassWizard::accept()
{
+ m_pGenPage->updateObject();
+
m_pDoc->addUMLObject(m_pClass);
m_pDoc->signalUMLObjectCreated(m_pClass);
@@ -161,6 +175,9 @@
QWizard::accept();
}
+/**
+ * Cancel button was called.
+ */
void ClassWizard::reject()
{
m_pDoc->removeUMLObject(m_pClass);
--- branches/work/soc-umbrello/umbrello/umlobject.cpp #861147:861148
@@ -449,8 +449,8 @@
*/
void UMLObject::setStereotype(const QString &_name)
{
- // UMLDoc* m_doc = UMLApp::app()->getDocument();
- //m_doc->executeCommand(new cmdSetStereotype(this,_name));
+ // UMLDoc* pDoc = UMLApp::app()->getDocument();
+ // pDoc->executeCommand(new cmdSetStereotype(this,_name));
if (_name.isEmpty()) {
setUMLStereotype(NULL);
return;
More information about the umbrello-devel
mailing list