Skip to content
Snippets Groups Projects
Commit fc60d6c6 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Designmode/Designer: Fix uic code model support.


...to use new editor.
Reviewed-by: default avatarLasse Holmstedt <lasse.holmstedt@nokia.com>
parent 13a608f8
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,8 @@
#include <coreplugin/uniqueidmanager.h>
#include <QDebug>
using namespace Designer::Internal;
namespace Designer {
namespace Internal {
DesignerXmlEditor::DesignerXmlEditor(QWidget *parent) : TextEditor::PlainTextEditor(parent)
{
setReadOnly(true);
......@@ -74,11 +74,14 @@ void DesignerXmlEditor::designerOpened()
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_DESIGN);
}
} // namespace Internal
QString DesignerXmlEditorEditable::id() const
{
return QLatin1String(Designer::Constants::K_DESIGNER_XML_EDITOR_ID);
}
DesignerXmlEditorEditable::DesignerXmlEditorEditable(DesignerXmlEditor *editor)
DesignerXmlEditorEditable::DesignerXmlEditorEditable(Internal::DesignerXmlEditor *editor)
: TextEditor::PlainTextEditorEditable(editor)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
......@@ -96,3 +99,4 @@ Core::IEditor *DesignerXmlEditorEditable::duplicate(QWidget *parent)
Q_UNUSED(parent);
return 0;
}
} // namespace Designer
......@@ -30,6 +30,7 @@
#ifndef DESIGNERXMLEDITOR_H
#define DESIGNERXMLEDITOR_H
#include "designer_export.h"
#include <texteditor/plaintexteditor.h>
#include <texteditor/basetexteditor.h>
......@@ -39,15 +40,16 @@ namespace Core {
}
namespace Designer {
namespace Internal {
namespace Internal {
class DesignerXmlEditor;
}
class DesignerXmlEditorEditable : public TextEditor::PlainTextEditorEditable
class DESIGNER_EXPORT DesignerXmlEditorEditable : public TextEditor::PlainTextEditorEditable
{
Q_OBJECT
public:
DesignerXmlEditorEditable(DesignerXmlEditor *editor);
explicit DesignerXmlEditorEditable(Internal::DesignerXmlEditor *editor);
QList<int> context() const;
bool duplicateSupported() const { return false; }
......@@ -63,11 +65,13 @@ private:
* read/write editor too, but due to lack of XML editor, highlighting and other such
* functionality, editing is disabled.
*/
namespace Internal {
class DesignerXmlEditor : public TextEditor::PlainTextEditor
{
Q_OBJECT
public:
DesignerXmlEditor(QWidget *parent = 0);
explicit DesignerXmlEditor(QWidget *parent = 0);
virtual ~DesignerXmlEditor();
bool open(const QString &fileName = QString());
......@@ -79,8 +83,6 @@ protected:
virtual TextEditor::BaseTextEditorEditable *createEditableInterface() { return new DesignerXmlEditorEditable(this); }
private:
};
} // Internal
......
......@@ -43,7 +43,6 @@
namespace Designer {
namespace Internal {
FormEditorStack::FormEditorStack() : activeEditor(0)
{
......
......@@ -40,9 +40,9 @@ namespace Core {
namespace Designer {
class FormWindowEditor;
class DesignerXmlEditorEditable;
namespace Internal {
class DesignerXmlEditorEditable;
/**
* A wrapper for Qt Designer form editors, so that they can be used in Design mode.
......
......@@ -48,7 +48,7 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h>
#include <designer/formwindoweditor.h>
#include <designer/designerxmleditor.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
......@@ -115,7 +115,7 @@ void Qt4Manager::init()
void Qt4Manager::editorChanged(Core::IEditor *editor)
{
// Handle old editor
Designer::FormWindowEditor *lastFormEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor);
Designer::DesignerXmlEditorEditable *lastFormEditor = qobject_cast<Designer::DesignerXmlEditorEditable *>(m_lastEditor);
if (lastFormEditor) {
disconnect(lastFormEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
......@@ -130,7 +130,7 @@ void Qt4Manager::editorChanged(Core::IEditor *editor)
m_lastEditor = editor;
// Handle new editor
if (Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(editor))
if (Designer::DesignerXmlEditorEditable *fw = qobject_cast<Designer::DesignerXmlEditorEditable *>(editor))
connect(fw, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
}
......@@ -139,7 +139,7 @@ void Qt4Manager::editorAboutToClose(Core::IEditor *editor)
if (m_lastEditor == editor) {
// Oh no our editor is going to be closed
// get the content first
Designer::FormWindowEditor *lastEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor);
Designer::DesignerXmlEditorEditable *lastEditor = qobject_cast<Designer::DesignerXmlEditorEditable *>(m_lastEditor);
if (lastEditor) {
disconnect(lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
if (m_dirty) {
......@@ -158,7 +158,7 @@ void Qt4Manager::uiEditorContentsChanged()
// cast sender, get filename
if (m_dirty)
return;
Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(sender());
Designer::DesignerXmlEditorEditable *fw = qobject_cast<Designer::DesignerXmlEditorEditable *>(sender());
if (!fw)
return;
m_dirty = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment