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