Commit fcf19f1a authored by Erik Verbruggen's avatar Erik Verbruggen

Renamed the DUI editor to QML editor.

parent df13733b
include(duieditor_dependencies.pri)
LIBS *= -l$$qtLibraryTarget(DuiEditor)
\ No newline at end of file
<RCC>
<qresource prefix="/duieditor" >
<file>DuiEditor.mimetypes.xml</file>
</qresource>
</RCC>
#ifndef DUIEDITOR_GLOBAL_H
#define DUIEDITOR_GLOBAL_H
#include <QtGlobal>
#if defined(DUIEDITOR_LIBRARY)
# define DUIEDITOR_EXPORT Q_DECL_EXPORT
#else
# define DUIEDITOR_EXPORT Q_DECL_IMPORT
#endif
#endif // DUIEDITOR_GLOBAL_H
......@@ -32,7 +32,7 @@ SUBDIRS = plugin_coreplugin \
plugin_designer \
plugin_resourceeditor \
plugin_genericprojectmanager \
plugin_duieditor \
plugin_qmleditor \
plugin_qmlprojectmanager \
debugger/dumper.pro
......@@ -169,12 +169,12 @@ plugin_genericprojectmanager.depends += plugin_projectexplorer
plugin_genericprojectmanager.depends += plugin_cpptools
plugin_genericprojectmanager.depends += plugin_cppeditor
plugin_duieditor.subdir = duieditor
plugin_duieditor.depends = plugin_texteditor
plugin_duieditor.depends += plugin_coreplugin
plugin_qmleditor.subdir = qmleditor
plugin_qmleditor.depends = plugin_texteditor
plugin_qmleditor.depends += plugin_coreplugin
plugin_qmlprojectmanager.subdir = qmlprojectmanager
plugin_qmlprojectmanager.depends = plugin_texteditor
plugin_qmlprojectmanager.depends += plugin_projectexplorer
plugin_qmlprojectmanager.depends += plugin_help
plugin_qmlprojectmanager.depends += plugin_duieditor
plugin_qmlprojectmanager.depends += plugin_qmleditor
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-dui">
<mime-type type="application/x-qml">
<sub-class-of type="text/plain"/>
<comment>QML file</comment>
<glob pattern="*.qml"/>
......
<plugin name="DuiEditor" version="1.2.91" compatVersion="1.2.91">
<plugin name="QmlEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license>
......@@ -16,7 +16,7 @@ General Public License version 2.1 as published by the Free Software
Foundation. Please review the following information to
ensure the GNU Lesser General Public License version 2.1 requirements
will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Editor for DUI.</description>
<description>Editor for QML.</description>
<url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="Core" version="1.2.91"/>
......
......@@ -4,8 +4,8 @@
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace DuiEditor;
using namespace DuiEditor::Internal;
using namespace QmlEditor;
using namespace QmlEditor::Internal;
QMap<QString, QmlIdSymbol*> IdCollector::operator()(const QString &fileName, QmlJS::AST::UiProgram *ast)
{
......
......@@ -9,7 +9,7 @@
#include "qmljsastvisitor_p.h"
#include "qmlsymbol.h"
namespace DuiEditor {
namespace QmlEditor {
namespace Internal {
class IdCollector: protected QmlJS::AST::Visitor
......@@ -35,6 +35,6 @@ private:
};
} // namespace Internal
} // namespace DuiEditor
} // namespace QmlEditor
#endif // IDCOLLECTOR_H
#include "duicompletionvisitor.h"
#include "duicodecompletion.h"
#include "duieditor.h"
#include "qmlcompletionvisitor.h"
#include "qmlcodecompletion.h"
#include "qmleditor.h"
#include <texteditor/basetexteditor.h>
#include <QtDebug>
using namespace DuiEditor::Internal;
using namespace QmlEditor::Internal;
DuiCodeCompletion::DuiCodeCompletion(QObject *parent)
QmlCodeCompletion::QmlCodeCompletion(QObject *parent)
: TextEditor::ICompletionCollector(parent),
m_editor(0),
m_startPosition(0),
m_caseSensitivity(Qt::CaseSensitive)
{ }
DuiCodeCompletion::~DuiCodeCompletion()
QmlCodeCompletion::~QmlCodeCompletion()
{ }
Qt::CaseSensitivity DuiCodeCompletion::caseSensitivity() const
Qt::CaseSensitivity QmlCodeCompletion::caseSensitivity() const
{ return m_caseSensitivity; }
void DuiCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
void QmlCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
{ m_caseSensitivity = caseSensitivity; }
bool DuiCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
bool QmlCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
{
if (qobject_cast<ScriptEditor *>(editor->widget()))
return true;
......@@ -30,10 +30,10 @@ bool DuiCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
return false;
}
bool DuiCodeCompletion::triggersCompletion(TextEditor::ITextEditable *)
bool QmlCodeCompletion::triggersCompletion(TextEditor::ITextEditable *)
{ return false; }
int DuiCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{
m_editor = editor;
......@@ -61,12 +61,12 @@ int DuiCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
m_completions.append(item);
}
DuiDocument::Ptr duiDocument = edit->duiDocument();
if (!duiDocument.isNull()) {
QmlJS::AST::UiProgram *program = duiDocument->program();
QmlDocument::Ptr qmlDocument = edit->qmlDocument();
if (!qmlDocument.isNull()) {
QmlJS::AST::UiProgram *program = qmlDocument->program();
if (program) {
DuiCompletionVisitor visitor;
QmlCompletionVisitor visitor;
foreach (const QString &word, visitor(program, m_startPosition)) {
TextEditor::CompletionItem item(this);
......@@ -79,7 +79,7 @@ int DuiCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
return pos;
}
void DuiCodeCompletion::completions(QList<TextEditor::CompletionItem> *completions)
void QmlCodeCompletion::completions(QList<TextEditor::CompletionItem> *completions)
{
// ### FIXME: this code needs to be generalized.
......@@ -128,7 +128,7 @@ void DuiCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio
}
}
void DuiCodeCompletion::complete(const TextEditor::CompletionItem &item)
void QmlCodeCompletion::complete(const TextEditor::CompletionItem &item)
{
const QString toInsert = item.m_text;
const int length = m_editor->position() - m_startPosition;
......@@ -136,7 +136,7 @@ void DuiCodeCompletion::complete(const TextEditor::CompletionItem &item)
m_editor->replace(length, toInsert);
}
bool DuiCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem> &completionItems)
bool QmlCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem> &completionItems)
{
if (completionItems.count() == 1) {
complete(completionItems.first());
......@@ -163,7 +163,7 @@ bool DuiCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
return false;
}
void DuiCodeCompletion::cleanup()
void QmlCodeCompletion::cleanup()
{
m_editor = 0;
m_startPosition = 0;
......
#ifndef DUICODECOMPLETION_H
#define DUICODECOMPLETION_H
#ifndef QMLCODECOMPLETION_H
#define QMLCODECOMPLETION_H
#include <texteditor/icompletioncollector.h>
......@@ -7,16 +7,16 @@ namespace TextEditor {
class ITextEditable;
}
namespace DuiEditor {
namespace QmlEditor {
namespace Internal {
class DuiCodeCompletion: public TextEditor::ICompletionCollector
class QmlCodeCompletion: public TextEditor::ICompletionCollector
{
Q_OBJECT
public:
DuiCodeCompletion(QObject *parent = 0);
virtual ~DuiCodeCompletion();
QmlCodeCompletion(QObject *parent = 0);
virtual ~QmlCodeCompletion();
Qt::CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
......@@ -38,6 +38,6 @@ private:
} // end of namespace Internal
} // end of namespace DuiEditor
} // end of namespace QmlEditor
#endif // DUICODECOMPLETION_H
#endif // QMLCODECOMPLETION_H
#include "duicodeformatter.h"
#include "qmlcodeformatter.h"
#include "qmljsast_p.h"
using namespace DuiEditor::Internal;
using namespace QmlEditor::Internal;
using namespace QmlJS;
using namespace QmlJS::AST;
DuiCodeFormatter::DuiCodeFormatter()
QmlCodeFormatter::QmlCodeFormatter()
{
}
DuiCodeFormatter::~DuiCodeFormatter()
QmlCodeFormatter::~QmlCodeFormatter()
{
}
bool DuiCodeFormatter::visit(QmlJS::AST::UiProgram *ast)
bool QmlCodeFormatter::visit(QmlJS::AST::UiProgram *ast)
{
Node::accept(ast->imports, this);
......@@ -25,7 +25,7 @@ bool DuiCodeFormatter::visit(QmlJS::AST::UiProgram *ast)
return false;
}
QString DuiCodeFormatter::operator()(QmlJS::AST::UiProgram *ast, const QString &originalSource, const QList<QmlJS::AST::SourceLocation> &comments, int start, int end)
QString QmlCodeFormatter::operator()(QmlJS::AST::UiProgram *ast, const QString &originalSource, const QList<QmlJS::AST::SourceLocation> &comments, int start, int end)
{
m_result.clear();
m_result.reserve(originalSource.length() * 2);
......@@ -38,7 +38,7 @@ QString DuiCodeFormatter::operator()(QmlJS::AST::UiProgram *ast, const QString &
return m_result;
}
bool DuiCodeFormatter::visit(UiImport *ast)
bool QmlCodeFormatter::visit(UiImport *ast)
{
append("import ");
append(ast->fileNameToken);
......@@ -61,7 +61,7 @@ bool DuiCodeFormatter::visit(UiImport *ast)
return false;
}
bool DuiCodeFormatter::visit(UiObjectDefinition *ast)
bool QmlCodeFormatter::visit(UiObjectDefinition *ast)
{
indent();
Node::accept(ast->qualifiedTypeNameId, this);
......@@ -72,7 +72,7 @@ bool DuiCodeFormatter::visit(UiObjectDefinition *ast)
return false;
}
bool DuiCodeFormatter::visit(QmlJS::AST::UiQualifiedId *ast)
bool QmlCodeFormatter::visit(QmlJS::AST::UiQualifiedId *ast)
{
for (UiQualifiedId *it = ast; it; it = it->next) {
append(it->name->asString());
......@@ -84,7 +84,7 @@ bool DuiCodeFormatter::visit(QmlJS::AST::UiQualifiedId *ast)
return false;
}
bool DuiCodeFormatter::visit(QmlJS::AST::UiObjectInitializer *ast)
bool QmlCodeFormatter::visit(QmlJS::AST::UiObjectInitializer *ast)
{
append(ast->lbraceToken.offset, ast->rbraceToken.end() - ast->lbraceToken.offset);
......
#ifndef DUICODEFORMATTER_H
#define DUICODEFORMATTER_H
#ifndef QMLCODEFORMATTER_H
#define QMLCODEFORMATTER_H
#include <QString>
......@@ -7,14 +7,14 @@
#include "qmljsastvisitor_p.h"
#include "qmljsengine_p.h"
namespace DuiEditor {
namespace QmlEditor {
namespace Internal {
class DuiCodeFormatter: protected QmlJS::AST::Visitor
class QmlCodeFormatter: protected QmlJS::AST::Visitor
{
public:
DuiCodeFormatter();
~DuiCodeFormatter();
QmlCodeFormatter();
~QmlCodeFormatter();
QString operator()(QmlJS::AST::UiProgram *ast, const QString &originalSource, const QList<QmlJS::AST::SourceLocation> &comments, int start = -1, int end = -1);
......@@ -77,6 +77,6 @@ private:
};
} // namespace Internal
} // namespace DuiEditor
} // namespace QmlEditor
#endif // DUICODEFORMATTER_H
#endif // QMLCODEFORMATTER_H
#include <QtCore/QDebug>
#include "duicompletionvisitor.h"
#include "qmlcompletionvisitor.h"
#include "qmljsast_p.h"
using namespace QmlJS;
using namespace QmlJS::AST;
namespace DuiEditor {
namespace QmlEditor {
namespace Internal {
DuiCompletionVisitor::DuiCompletionVisitor()
QmlCompletionVisitor::QmlCompletionVisitor()
{
}
QSet<QString> DuiCompletionVisitor::operator()(QmlJS::AST::UiProgram *ast, int pos)
QSet<QString> QmlCompletionVisitor::operator()(QmlJS::AST::UiProgram *ast, int pos)
{
m_completions.clear();
m_pos = (quint32) pos;
......@@ -23,7 +23,7 @@ QSet<QString> DuiCompletionVisitor::operator()(QmlJS::AST::UiProgram *ast, int p
return m_completions;
}
bool DuiCompletionVisitor::preVisit(QmlJS::AST::Node *node)
bool QmlCompletionVisitor::preVisit(QmlJS::AST::Node *node)
{
if (!m_parentStack.isEmpty())
m_nodeParents[node] = m_parentStack.top();
......@@ -42,7 +42,7 @@ static QString toString(Statement *stmt)
return QString();
}
bool DuiCompletionVisitor::visit(UiScriptBinding *ast)
bool QmlCompletionVisitor::visit(UiScriptBinding *ast)
{
if (!ast)
return false;
......@@ -71,7 +71,7 @@ bool DuiCompletionVisitor::visit(UiScriptBinding *ast)
return true;
}
UiObjectDefinition *DuiCompletionVisitor::findParentObject(Node *node) const
UiObjectDefinition *QmlCompletionVisitor::findParentObject(Node *node) const
{
if (!node)
return 0;
......@@ -87,4 +87,4 @@ UiObjectDefinition *DuiCompletionVisitor::findParentObject(Node *node) const
}
} // namespace Internal
} // namespace DuiEditor
} // namespace QmlEditor
......@@ -10,13 +10,13 @@
#include "qmljsastvisitor_p.h"
#include "qmljsengine_p.h"
namespace DuiEditor {
namespace QmlEditor {
namespace Internal {
class DuiCompletionVisitor: protected QmlJS::AST::Visitor
class QmlCompletionVisitor: protected QmlJS::AST::Visitor
{
public:
DuiCompletionVisitor();
QmlCompletionVisitor();
QSet<QString> operator()(QmlJS::AST::UiProgram *ast, int pos);
......@@ -38,6 +38,6 @@ private:
};
} // namespace Internal
} // namespace DuiEditor
} // namespace QmlEditor
#endif // COMPLETIONVISITOR_H
......@@ -28,17 +28,17 @@
**************************************************************************/
#include "idcollector.h"
#include "duidocument.h"
#include "qmldocument.h"
#include "qmljsast_p.h"
#include "qmljslexer_p.h"
#include "qmljsparser_p.h"
#include "qmljsengine_p.h"
#include "qmljsnodepool_p.h"
using namespace DuiEditor;
using namespace QmlEditor;
using namespace QmlJS;
DuiDocument::DuiDocument(const QString &fileName)
QmlDocument::QmlDocument(const QString &fileName)
: _engine(0)
, _pool(0)
, _program(0)
......@@ -53,7 +53,7 @@ DuiDocument::DuiDocument(const QString &fileName)
_componentName = fileName.mid(slashIdx + 1, fileName.size() - (slashIdx + 1) - 4);
}
DuiDocument::~DuiDocument()
QmlDocument::~QmlDocument()
{
if (_engine)
delete _engine;
......@@ -64,33 +64,33 @@ DuiDocument::~DuiDocument()
qDeleteAll(_ids.values());
}
DuiDocument::Ptr DuiDocument::create(const QString &fileName)
QmlDocument::Ptr QmlDocument::create(const QString &fileName)
{
DuiDocument::Ptr doc(new DuiDocument(fileName));
QmlDocument::Ptr doc(new QmlDocument(fileName));
return doc;
}
AST::UiProgram *DuiDocument::program() const
AST::UiProgram *QmlDocument::program() const
{
return _program;
}
QList<DiagnosticMessage> DuiDocument::diagnosticMessages() const
QList<DiagnosticMessage> QmlDocument::diagnosticMessages() const
{
return _diagnosticMessages;
}
QString DuiDocument::source() const
QString QmlDocument::source() const
{
return _source;
}
void DuiDocument::setSource(const QString &source)
void QmlDocument::setSource(const QString &source)
{
_source = source;
}
bool DuiDocument::parse()
bool QmlDocument::parse()
{
Q_ASSERT(! _engine);
Q_ASSERT(! _pool);
......@@ -125,18 +125,18 @@ Snapshot::~Snapshot()
{
}
void Snapshot::insert(const DuiDocument::Ptr &document)
void Snapshot::insert(const QmlDocument::Ptr &document)
{
QMap<QString, DuiDocument::Ptr>::insert(document->fileName(), document);
QMap<QString, QmlDocument::Ptr>::insert(document->fileName(), document);
}
DuiDocument::PtrList Snapshot::importedDocuments(const DuiDocument::Ptr &doc, const QString &importPath) const
QmlDocument::PtrList Snapshot::importedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const
{
DuiDocument::PtrList result;
QmlDocument::PtrList result;
const QString docPath = doc->path() + '/' + importPath;
foreach (DuiDocument::Ptr candidate, *this) {
foreach (QmlDocument::Ptr candidate, *this) {
if (candidate == doc)
continue;
......@@ -147,13 +147,13 @@ DuiDocument::PtrList Snapshot::importedDocuments(const DuiDocument::Ptr &doc, co
return result;
}
QMap<QString, DuiDocument::Ptr> Snapshot::componentsDefinedByImportedDocuments(const DuiDocument::Ptr &doc, const QString &importPath) const
QMap<QString, QmlDocument::Ptr> Snapshot::componentsDefinedByImportedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const
{
QMap<QString, DuiDocument::Ptr> result;
QMap<QString, QmlDocument::Ptr> result;
const QString docPath = doc->path() + '/' + importPath;
foreach (DuiDocument::Ptr candidate, *this) {
foreach (QmlDocument::Ptr candidate, *this) {
if (candidate == doc)
continue;
......
......@@ -26,8 +26,8 @@
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DUIDOCUMENT_H
#define DUIDOCUMENT_H
#ifndef QMLDOCUMENT_H
#define QMLDOCUMENT_H
#include <QtCore/QList>
#include <QtCore/QMap>
......@@ -35,27 +35,27 @@
#include <QtCore/QSharedPointer>