summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2015-06-21 23:31:15 +0200
committerRalf Habacker <[email protected]>2015-06-21 23:43:06 +0200
commit51d4dfea41473bf9910854f62cc33fbb82045097 (patch)
tree1b5d95b522a6564aa453dfde0145da51862a61c4
parent2641783faaaddecca5ef8864ded10c859abde1a9 (diff)
Merge diagram specific option page create handling complete into class ClassOptionsPage.
Class diagrams use full UIState, while other diagrams only support operation signatures. The refactoring makes it easier to follow the code flow.
-rw-r--r--umbrello/dialogs/pages/classoptionspage.cpp24
-rw-r--r--umbrello/dialogs/umlviewdialog.cpp20
-rw-r--r--umbrello/dialogs/umlviewdialog.h1
3 files changed, 20 insertions, 25 deletions
diff --git a/umbrello/dialogs/pages/classoptionspage.cpp b/umbrello/dialogs/pages/classoptionspage.cpp
index e9b8402..a73a6e5 100644
--- a/umbrello/dialogs/pages/classoptionspage.cpp
+++ b/umbrello/dialogs/pages/classoptionspage.cpp
@@ -43,11 +43,20 @@ ClassOptionsPage::ClassOptionsPage(QWidget* pParent, ClassifierWidget* pWidget)
ClassOptionsPage::ClassOptionsPage(QWidget *pParent, UMLScene *scene)
: QWidget(pParent),
- m_isDiagram(false)
+ m_isDiagram(true)
{
init();
+
m_scene = scene;
- setupPageFromScene();
+
+ // class diagram uses full UIState
+ if (scene->type() == Uml::DiagramType::Class) {
+ m_options = &scene->optionState();
+ setupClassPageOption();
+ }
+ else {
+ setupPageFromScene();
+ }
}
/**
@@ -93,10 +102,10 @@ void ClassOptionsPage::apply()
{
if (m_pWidget) {
applyWidget();
- } else if (m_options) {
- applyOptionState();
} else if (m_scene) {
applyScene();
+ } else if (m_options) {
+ applyOptionState();
}
}
@@ -340,7 +349,12 @@ void ClassOptionsPage::applyOptionState()
*/
void ClassOptionsPage::applyScene()
{
- m_scene->setShowOpSig(m_showOpSigCB->isChecked());
+ if (m_scene->type() == Uml::DiagramType::Class) {
+ applyOptionState();
+ m_scene->setClassWidgetOptions(this);
+ }
+ else
+ m_scene->setShowOpSig(m_showOpSigCB->isChecked());
}
/**
diff --git a/umbrello/dialogs/umlviewdialog.cpp b/umbrello/dialogs/umlviewdialog.cpp
index 7770f96..2a19800 100644
--- a/umbrello/dialogs/umlviewdialog.cpp
+++ b/umbrello/dialogs/umlviewdialog.cpp
@@ -45,7 +45,6 @@ UMLViewDialog::UMLViewDialog(QWidget * pParent, UMLScene * pScene)
{
setCaption(i18n("Properties"));
m_pScene = pScene;
- m_options = m_pScene->optionState();
setupPages();
connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()));
@@ -111,12 +110,7 @@ void UMLViewDialog::setupDisplayPage()
return;
}
- if (m_pScene->type() != Uml::DiagramType::Class) {
- m_pOptionsPage = new ClassOptionsPage(0, m_pScene);
- }
- else {
- m_pOptionsPage = new ClassOptionsPage(0, &m_options);
- }
+ m_pOptionsPage = new ClassOptionsPage(0, m_pScene);
m_pageDisplayItem = createPage(i18nc("classes display options page", "Display"), i18n("Classes Display Options"),
Icon_Utils::it_Properties_Display, m_pOptionsPage);
}
@@ -179,17 +173,5 @@ void UMLViewDialog::applyPage(KPageWidgetItem *item)
else if (item == m_pageDisplayItem)
{
m_pOptionsPage->apply();
- if (m_pScene->type() != Uml::DiagramType::Class) {
- return;
- }
- m_pScene->setClassWidgetOptions(m_pOptionsPage);
- // sig = m_pTempWidget->getShowOpSigs();
- // showSig = !(sig == Uml::st_NoSig || sig == Uml::st_NoSigNoVis);
- // options.classState.showOpSig = showSig;
- // sig = m_pTempWidget->getShowAttSigs();
- // showSig = !(sig == Uml::st_NoSig || sig == Uml::st_NoSigNoVis);
- // options.classState.showAttSig = showSig;
- m_pScene->setOptionState(m_options);
}
}
-
diff --git a/umbrello/dialogs/umlviewdialog.h b/umbrello/dialogs/umlviewdialog.h
index 58fbf04..6713f1c 100644
--- a/umbrello/dialogs/umlviewdialog.h
+++ b/umbrello/dialogs/umlviewdialog.h
@@ -55,7 +55,6 @@ protected:
void checkName();
UMLScene* m_pScene; ///< the scene to represent
- Settings::OptionState m_options;
#if QT_VERSION >= 0x050000
QFontDialog* m_pChooser;
#else