Commit b3c63795 authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann
Browse files

QmlDesigner: Cleanup design document



Change-Id: Iba5a1ba44ec8dc9619eb8fcc93f8498c1d1f2f7f
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 4402d7da
......@@ -120,28 +120,6 @@ Model *DesignDocument::documentModel() const
return m_documentModel.data();
}
void DesignDocument::changeToDocumentModel()
{
viewManager().detachRewriterView();
viewManager().detachViewsExceptRewriterAndComponetView();
m_currentModel = m_documentModel.data();
viewManager().attachRewriterView(m_documentTextModifier.data());
viewManager().attachViewsExceptRewriterAndComponetView();
}
void DesignDocument::changeToInFileComponentModel()
{
viewManager().detachRewriterView();
viewManager().detachViewsExceptRewriterAndComponetView();
m_currentModel = m_inFileComponentModel.data();
viewManager().attachRewriterView(m_inFileComponentTextModifier.data());
viewManager().attachViewsExceptRewriterAndComponetView();
}
QWidget *DesignDocument::centralWidget() const
{
return qobject_cast<QWidget*>(parent());
......@@ -306,13 +284,36 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit)
m_documentLoaded = true;
}
void DesignDocument::changeCurrentModelTo(const ModelNode &node)
void DesignDocument::changeToDocumentModel()
{
viewManager().detachRewriterView();
viewManager().detachViewsExceptRewriterAndComponetView();
m_currentModel = m_documentModel.data();
viewManager().attachRewriterView(m_documentTextModifier.data());
viewManager().attachViewsExceptRewriterAndComponetView();
}
void DesignDocument::changeToInFileComponentModel()
{
viewManager().detachRewriterView();
viewManager().detachViewsExceptRewriterAndComponetView();
m_currentModel = m_inFileComponentModel.data();
viewManager().attachRewriterView(m_inFileComponentTextModifier.data());
viewManager().attachViewsExceptRewriterAndComponetView();
}
void DesignDocument::changeToSubComponentAndPushOnCrumblePath(const ModelNode &componentNode)
{
if (QmlDesignerPlugin::instance()->currentDesignDocument() != this)
return;
changeToSubComponent(componentNode);
changeToSubComponent(node);
QmlDesignerPlugin::instance()->viewManager().pushInFileComponentOnCrambleBar(componentNode.id());
}
void DesignDocument::changeToSubComponent(const ModelNode &componentNode)
......@@ -321,9 +322,8 @@ void DesignDocument::changeToSubComponent(const ModelNode &componentNode)
QWeakPointer<Model> oldModel = m_currentModel;
Q_ASSERT(oldModel.data());
if (m_currentModel.data() == m_inFileComponentModel.data()) {
if (m_currentModel.data() == m_inFileComponentModel.data())
changeToDocumentModel();
}
bool subComponentLoaded = loadInFileComponent(componentNode);
......@@ -339,7 +339,7 @@ void DesignDocument::changeToExternalSubComponent(const QString &fileName)
Core::EditorManager::openEditor(fileName);
}
void DesignDocument::goIntoComponent()
void DesignDocument::goIntoSelectedComponent()
{
if (!m_currentModel)
return;
......@@ -366,14 +366,6 @@ void DesignDocument::activateCurrentModel(TextModifier *textModifier)
viewManager().attachRewriterView(textModifier);
// if (s_clearCrumblePath)
// m_formEditorView->crumblePath()->clear();
// if (s_pushCrumblePath &&
// !differentCrumbleBarOnTop(m_formEditorView.data(), createCrumbleBarInfo().value<CrumbleBarInfo>()))
// m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
Q_ASSERT(m_documentModel);
QApplication::restoreOverrideCursor();
}
......
......@@ -71,7 +71,6 @@ public:
QString simplfiedDisplayName() const;
void loadDocument(QPlainTextEdit *edit);
void activateCurrentModel(TextModifier *textModifier);
void activateDocumentModel();
void close();
void updateSubcomponentManager();
......@@ -99,7 +98,7 @@ public:
void resetToDocumentModel();
void goIntoComponent();
void goIntoSelectedComponent();
void changeToDocumentModel();
......@@ -121,8 +120,8 @@ public slots:
void undo();
void redo();
void updateActiveQtVersion();
void changeCurrentModelTo(const ModelNode &node);
void changeToSubComponent(const ModelNode &node);
void changeToSubComponentAndPushOnCrumblePath(const ModelNode &componentNode);
void changeToSubComponent(const ModelNode &componentNode);
void changeToExternalSubComponent(const QString &m_oldFileName);
private slots:
......@@ -130,6 +129,7 @@ private slots:
private: // functions
void changeToInFileComponentModel();
void activateCurrentModel(TextModifier *textModifier);
QWidget *centralWidget() const;
QString pathToQt() const;
......
......@@ -318,7 +318,7 @@ void ShortCutManager::redoAvailable(bool isAvailable)
void ShortCutManager::goIntoComponent()
{
if (currentDesignDocument())
currentDesignDocument()->goIntoComponent();
currentDesignDocument()->goIntoSelectedComponent();
}
} // namespace QmlDesigner
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