Commit bd7859a0 authored by Ralf Habacker's avatar Ralf Habacker

Refactor class AssociationGeneralPage to use class DocumentationWidget.

CCBUG:381391
parent d6da482b
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "assocrules.h" #include "assocrules.h"
#include "debug_utils.h" #include "debug_utils.h"
#include "dialog_utils.h" #include "dialog_utils.h"
#include "documentationwidget.h"
#include "objectwidget.h" #include "objectwidget.h"
#include "umldoc.h" #include "umldoc.h"
#include "umlobject.h" #include "umlobject.h"
...@@ -77,11 +78,8 @@ void AssociationGeneralPage::constructWidget() ...@@ -77,11 +78,8 @@ void AssociationGeneralPage::constructWidget()
// group boxes for name+type, documentation properties // group boxes for name+type, documentation properties
QGroupBox *nameAndTypeGB = new QGroupBox(this); QGroupBox *nameAndTypeGB = new QGroupBox(this);
QGroupBox *docGB = new QGroupBox(this);
nameAndTypeGB->setTitle(i18n("Properties")); nameAndTypeGB->setTitle(i18n("Properties"));
docGB->setTitle(i18n("Documentation"));
topLayout->addWidget(nameAndTypeGB); topLayout->addWidget(nameAndTypeGB);
topLayout->addWidget(docGB);
m_pNameAndTypeLayout = new QGridLayout(nameAndTypeGB); m_pNameAndTypeLayout = new QGridLayout(nameAndTypeGB);
m_pNameAndTypeLayout->setSpacing(6); m_pNameAndTypeLayout->setSpacing(6);
...@@ -182,14 +180,9 @@ void AssociationGeneralPage::constructWidget() ...@@ -182,14 +180,9 @@ void AssociationGeneralPage::constructWidget()
#endif #endif
m_pNameAndTypeLayout->addWidget(m_pTypeCB, 1, 1); m_pNameAndTypeLayout->addWidget(m_pTypeCB, 1, 1);
// document // documentation
QHBoxLayout * docLayout = new QHBoxLayout(docGB); m_docWidget = new DocumentationWidget(m_pAssociationWidget, this);
docLayout->setMargin(margin); topLayout->addWidget(m_docWidget);
m_doc = new KTextEdit(docGB);
docLayout->addWidget(m_doc);
m_doc->setText(m_pAssociationWidget->documentation());
m_doc->setWordWrapMode(QTextOption::WordWrap);
} }
void AssociationGeneralPage::slotStereoCheckboxChanged(int state) void AssociationGeneralPage::slotStereoCheckboxChanged(int state)
...@@ -222,7 +215,7 @@ void AssociationGeneralPage::apply() ...@@ -222,7 +215,7 @@ void AssociationGeneralPage::apply()
int comboBoxItem = m_pTypeCB->currentIndex(); int comboBoxItem = m_pTypeCB->currentIndex();
Uml::AssociationType::Enum newType = m_AssocTypes[comboBoxItem]; Uml::AssociationType::Enum newType = m_AssocTypes[comboBoxItem];
m_pAssociationWidget->setAssociationType(newType); m_pAssociationWidget->setAssociationType(newType);
m_pAssociationWidget->setDocumentation(m_doc->toPlainText()); m_docWidget->apply();
if (m_pStereoChkB && m_pStereoChkB->isChecked()) { if (m_pStereoChkB && m_pStereoChkB->isChecked()) {
QString stereo = m_pAssocNameComB->currentText(); QString stereo = m_pAssocNameComB->currentText();
// keep the order // keep the order
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
#include <QWidget> #include <QWidget>
class AssociationWidget; class AssociationWidget;
class DocumentationWidget;
class QCheckBox; class QCheckBox;
class QGridLayout; class QGridLayout;
class QLabel; class QLabel;
class KComboBox; class KComboBox;
class KLineEdit; class KLineEdit;
class KTextEdit;
class ObjectWidget; class ObjectWidget;
class UMLDoc; class UMLDoc;
class UMLObject; class UMLObject;
...@@ -57,7 +57,7 @@ private: ...@@ -57,7 +57,7 @@ private:
so we can translate both ways */ so we can translate both ways */
QList<Uml::AssociationType::Enum> m_AssocTypes; QList<Uml::AssociationType::Enum> m_AssocTypes;
QStringList m_AssocTypeStrings; QStringList m_AssocTypeStrings;
KTextEdit *m_doc; DocumentationWidget *m_docWidget;
AssociationWidget *m_pAssociationWidget; AssociationWidget *m_pAssociationWidget;
ObjectWidget *m_pWidget; ObjectWidget *m_pWidget;
......
...@@ -36,7 +36,7 @@ DocumentationWidget::DocumentationWidget(UMLObject *o, QWidget *parent) : ...@@ -36,7 +36,7 @@ DocumentationWidget::DocumentationWidget(UMLObject *o, QWidget *parent) :
init(o->doc()); init(o->doc());
} }
DocumentationWidget::DocumentationWidget(UMLWidget *w, QWidget *parent) : DocumentationWidget::DocumentationWidget(WidgetBase *w, QWidget *parent) :
QWidget(parent), QWidget(parent),
m_object(0), m_object(0),
m_widget(w) m_widget(w)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
class CodeTextEdit; class CodeTextEdit;
class UMLObject; class UMLObject;
class UMLWidget; class WidgetBase;
class KTextEdit; class KTextEdit;
...@@ -27,7 +27,7 @@ class DocumentationWidget : public QWidget ...@@ -27,7 +27,7 @@ class DocumentationWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit DocumentationWidget(UMLObject *o, QWidget *parent = 0); explicit DocumentationWidget(UMLObject *o, QWidget *parent = 0);
explicit DocumentationWidget(UMLWidget *w, QWidget *parent = 0); explicit DocumentationWidget(WidgetBase *w, QWidget *parent = 0);
~DocumentationWidget(); ~DocumentationWidget();
void apply(); void apply();
...@@ -37,7 +37,7 @@ protected: ...@@ -37,7 +37,7 @@ protected:
KTextEdit *m_editField; KTextEdit *m_editField;
CodeTextEdit *m_codeEditField; CodeTextEdit *m_codeEditField;
UMLObject *m_object; UMLObject *m_object;
UMLWidget *m_widget; WidgetBase *m_widget;
void init(const QString &text); void init(const QString &text);
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment