QMLJSEditor Exporting few classes

These changes are required for the new Binding Editor

Change-Id: Ic1e833819c69831aa1a930ab668a644ae4ccdd6f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Aleksei German
2019-08-07 17:04:47 +02:00
parent 2feb3e5585
commit 735cdf88df
10 changed files with 40 additions and 47 deletions

View File

@@ -46,6 +46,7 @@ namespace QmlJS { class Value; }
namespace QmlJSEditor { namespace QmlJSEditor {
class QmlJSCompletionAssistInterface; class QmlJSCompletionAssistInterface;
class QmlJSCompletionAssistProvider;
namespace Internal { namespace Internal {
@@ -72,19 +73,6 @@ public:
}; };
class QmlJSCompletionAssistProvider : public TextEditor::CompletionAssistProvider
{
Q_OBJECT
public:
TextEditor::IAssistProcessor *createProcessor() const override;
int activationCharSequenceLength() const override;
bool isActivationCharSequence(const QString &sequence) const override;
bool isContinuationChar(const QChar &c) const override;
};
class QmlJSCompletionAssistProcessor : public TextEditor::IAssistProcessor class QmlJSCompletionAssistProcessor : public TextEditor::IAssistProcessor
{ {
public: public:
@@ -131,6 +119,20 @@ private:
QmlJSTools::SemanticInfo m_semanticInfo; QmlJSTools::SemanticInfo m_semanticInfo;
}; };
class QMLJSEDITOR_EXPORT QmlJSCompletionAssistProvider : public TextEditor::CompletionAssistProvider
{
Q_OBJECT
public:
TextEditor::IAssistProcessor *createProcessor() const override;
int activationCharSequenceLength() const override;
bool isActivationCharSequence(const QString &sequence) const override;
bool isContinuationChar(const QChar &c) const override;
};
QStringList QMLJSEDITOR_EXPORT qmlJSAutoComplete(QTextDocument *textDocument, QStringList QMLJSEDITOR_EXPORT qmlJSAutoComplete(QTextDocument *textDocument,
int position, int position,
const QString &fileName, const QString &fileName,

View File

@@ -102,7 +102,6 @@ using namespace QmlJSTools;
using namespace TextEditor; using namespace TextEditor;
namespace QmlJSEditor { namespace QmlJSEditor {
namespace Internal {
// //
// QmlJSEditorWidget // QmlJSEditorWidget
@@ -132,7 +131,7 @@ void QmlJSEditorWidget::finalizeInitialization()
textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8 textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
m_modelManager = ModelManagerInterface::instance(); m_modelManager = ModelManagerInterface::instance();
m_contextPane = QmlJSEditorPlugin::quickToolBar(); m_contextPane = Internal::QmlJSEditorPlugin::quickToolBar();
m_modelManager->activateScan(); m_modelManager->activateScan();
@@ -269,12 +268,11 @@ void QmlJSEditorWidget::updateOutlineIndexNow()
m_outlineCombo->setRootModelIndex(QModelIndex()); m_outlineCombo->setRootModelIndex(QModelIndex());
} }
} }
} // namespace Internal
} // namespace QmlJSEditor } // namespace QmlJSEditor
namespace QmlJSEditor { namespace QmlJSEditor {
namespace Internal {
void QmlJSEditorWidget::updateContextPane() void QmlJSEditorWidget::updateContextPane()
{ {
@@ -507,7 +505,7 @@ void QmlJSEditorWidget::createToolBar()
auto itemDelegate = new Utils::AnnotatedItemDelegate(this); auto itemDelegate = new Utils::AnnotatedItemDelegate(this);
itemDelegate->setDelimiter(QLatin1String(" ")); itemDelegate->setDelimiter(QLatin1String(" "));
itemDelegate->setAnnotationRole(QmlOutlineModel::AnnotationRole); itemDelegate->setAnnotationRole(Internal::QmlOutlineModel::AnnotationRole);
treeView->setItemDelegateForColumn(0, itemDelegate); treeView->setItemDelegateForColumn(0, itemDelegate);
treeView->header()->hide(); treeView->header()->hide();
@@ -525,7 +523,7 @@ void QmlJSEditorWidget::createToolBar()
connect(m_outlineCombo, QOverload<int>::of(&QComboBox::activated), connect(m_outlineCombo, QOverload<int>::of(&QComboBox::activated),
this, &QmlJSEditorWidget::jumpToOutlineElement); this, &QmlJSEditorWidget::jumpToOutlineElement);
connect(m_qmlJsEditorDocument->outlineModel(), &QmlOutlineModel::updated, connect(m_qmlJsEditorDocument->outlineModel(), &Internal::QmlOutlineModel::updated,
static_cast<QTreeView *>(m_outlineCombo->view()), &QTreeView::expandAll); static_cast<QTreeView *>(m_outlineCombo->view()), &QTreeView::expandAll);
connect(this, &QmlJSEditorWidget::cursorPositionChanged, connect(this, &QmlJSEditorWidget::cursorPositionChanged,
@@ -830,7 +828,7 @@ void QmlJSEditorWidget::contextMenuEvent(QContextMenuEvent *e)
AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked); AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
if (interface) { if (interface) {
QScopedPointer<IAssistProcessor> processor( QScopedPointer<IAssistProcessor> processor(
QmlJSEditorPlugin::quickFixAssistProvider()->createProcessor()); Internal::QmlJSEditorPlugin::quickFixAssistProvider()->createProcessor());
QScopedPointer<IAssistProposal> proposal(processor->perform(interface)); QScopedPointer<IAssistProposal> proposal(processor->perform(interface));
if (!proposal.isNull()) { if (!proposal.isNull()) {
GenericProposalModelPtr model = proposal->model().staticCast<GenericProposalModel>(); GenericProposalModelPtr model = proposal->model().staticCast<GenericProposalModel>();
@@ -939,7 +937,7 @@ QModelIndex QmlJSEditorWidget::indexForPosition(unsigned cursorPosition, const Q
{ {
QModelIndex lastIndex = rootIndex; QModelIndex lastIndex = rootIndex;
QmlOutlineModel *model = m_qmlJsEditorDocument->outlineModel(); Internal::QmlOutlineModel *model = m_qmlJsEditorDocument->outlineModel();
const int rowCount = model->rowCount(rootIndex); const int rowCount = model->rowCount(rootIndex);
for (int i = 0; i < rowCount; ++i) { for (int i = 0; i < rowCount; ++i) {
QModelIndex childIndex = model->index(i, 0, rootIndex); QModelIndex childIndex = model->index(i, 0, rootIndex);
@@ -979,7 +977,7 @@ AssistInterface *QmlJSEditorWidget::createAssistInterface(
reason, reason,
m_qmlJsEditorDocument->semanticInfo()); m_qmlJsEditorDocument->semanticInfo());
} else if (assistKind == QuickFix) { } else if (assistKind == QuickFix) {
return new QmlJSQuickFixAssistInterface(const_cast<QmlJSEditorWidget *>(this), reason); return new Internal::QmlJSQuickFixAssistInterface(const_cast<QmlJSEditorWidget *>(this), reason);
} }
return nullptr; return nullptr;
} }
@@ -1043,7 +1041,7 @@ QmlJSEditorFactory::QmlJSEditorFactory()
setDocumentCreator([]() { return new QmlJSEditorDocument; }); setDocumentCreator([]() { return new QmlJSEditorDocument; });
setEditorWidgetCreator([]() { return new QmlJSEditorWidget; }); setEditorWidgetCreator([]() { return new QmlJSEditorWidget; });
setEditorCreator([]() { return new QmlJSEditor; }); setEditorCreator([]() { return new QmlJSEditor; });
setAutoCompleterCreator([]() { return new AutoCompleter; }); setAutoCompleterCreator([]() { return new Internal::AutoCompleter; });
setCommentDefinition(Utils::CommentDefinition::CppStyle); setCommentDefinition(Utils::CommentDefinition::CppStyle);
setParenthesesMatchingEnabled(true); setParenthesesMatchingEnabled(true);
setCodeFoldingSupported(true); setCodeFoldingSupported(true);
@@ -1060,9 +1058,8 @@ QmlJSEditorFactory::QmlJSEditorFactory()
void QmlJSEditorFactory::decorateEditor(TextEditorWidget *editor) void QmlJSEditorFactory::decorateEditor(TextEditorWidget *editor)
{ {
editor->textDocument()->setSyntaxHighlighter(new QmlJSHighlighter); editor->textDocument()->setSyntaxHighlighter(new QmlJSHighlighter);
editor->textDocument()->setIndenter(new Indenter(editor->textDocument()->document())); editor->textDocument()->setIndenter(new Internal::Indenter(editor->textDocument()->document()));
editor->setAutoCompleter(new AutoCompleter); editor->setAutoCompleter(new Internal::AutoCompleter);
} }
} // namespace Internal
} // namespace QmlJSEditor } // namespace QmlJSEditor

View File

@@ -52,9 +52,7 @@ class QmlJSEditorDocument;
class QuickToolBar; class QuickToolBar;
class FindReferences; class FindReferences;
namespace Internal { class QMLJSEDITOR_EXPORT QmlJSEditorWidget : public TextEditor::TextEditorWidget
class QmlJSEditorWidget : public TextEditor::TextEditorWidget
{ {
Q_OBJECT Q_OBJECT
@@ -131,7 +129,7 @@ private:
}; };
class QmlJSEditor : public TextEditor::BaseTextEditor class QMLJSEDITOR_EXPORT QmlJSEditor : public TextEditor::BaseTextEditor
{ {
Q_OBJECT Q_OBJECT
@@ -141,7 +139,7 @@ public:
bool isDesignModePreferred() const override; bool isDesignModePreferred() const override;
}; };
class QmlJSEditorFactory : public TextEditor::TextEditorFactory class QMLJSEDITOR_EXPORT QmlJSEditorFactory : public TextEditor::TextEditorFactory
{ {
Q_OBJECT Q_OBJECT
@@ -151,5 +149,4 @@ public:
static void decorateEditor(TextEditor::TextEditorWidget *editor); static void decorateEditor(TextEditor::TextEditorWidget *editor);
}; };
} // namespace Internal
} // namespace QmlJSEditor } // namespace QmlJSEditor

View File

@@ -37,11 +37,12 @@ namespace TextEditor { class TextMark; }
namespace QmlJSEditor { namespace QmlJSEditor {
class QmlJSEditorDocument; class QmlJSEditorDocument;
class SemanticHighlighter;
namespace Internal { namespace Internal {
class QmlOutlineModel; class QmlOutlineModel;
class SemanticHighlighter;
class SemanticInfoUpdater; class SemanticInfoUpdater;
class QmlJSEditorDocumentPrivate : public QObject class QmlJSEditorDocumentPrivate : public QObject
@@ -72,7 +73,7 @@ public:
SemanticInfoUpdater *m_semanticInfoUpdater; SemanticInfoUpdater *m_semanticInfoUpdater;
QmlJSTools::SemanticInfo m_semanticInfo; QmlJSTools::SemanticInfo m_semanticInfo;
QVector<QTextLayout::FormatRange> m_diagnosticRanges; QVector<QTextLayout::FormatRange> m_diagnosticRanges;
Internal::SemanticHighlighter *m_semanticHighlighter = nullptr; SemanticHighlighter *m_semanticHighlighter = nullptr;
bool m_semanticHighlightingNecessary = false; bool m_semanticHighlightingNecessary = false;
bool m_outlineModelNeedsUpdate = false; bool m_outlineModelNeedsUpdate = false;
bool m_firstSementicInfo = true; bool m_firstSementicInfo = true;

View File

@@ -59,7 +59,6 @@ using namespace QmlJS;
using namespace TextEditor; using namespace TextEditor;
namespace QmlJSEditor { namespace QmlJSEditor {
namespace Internal {
namespace { namespace {
@@ -517,6 +516,5 @@ bool QmlJSHoverHandler::setQmlHelpItem(const ScopeChain &scopeChain,
return false; return false;
} }
} // namespace Internal
} // namespace QmlJSEditor } // namespace QmlJSEditor

View File

@@ -25,6 +25,7 @@
#pragma once #pragma once
#include <qmljseditor/qmljseditor_global.h>
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <texteditor/basehoverhandler.h> #include <texteditor/basehoverhandler.h>
@@ -44,11 +45,10 @@ class ObjectValue;
} }
namespace QmlJSEditor { namespace QmlJSEditor {
namespace Internal {
class QmlJSEditorWidget; class QmlJSEditorWidget;
class QmlJSHoverHandler : public TextEditor::BaseHoverHandler class QMLJSEDITOR_EXPORT QmlJSHoverHandler : public TextEditor::BaseHoverHandler
{ {
Q_DECLARE_TR_FUNCTIONS(QmlJSHoverHandler) Q_DECLARE_TR_FUNCTIONS(QmlJSHoverHandler)
@@ -86,5 +86,4 @@ private:
QColor m_colorTip; QColor m_colorTip;
}; };
} // namespace Internal
} // namespace QmlJSEditor } // namespace QmlJSEditor

View File

@@ -38,9 +38,11 @@ namespace Core { class IEditor; }
namespace QmlJS { class Editor; } namespace QmlJS { class Editor; }
namespace QmlJSEditor { namespace QmlJSEditor {
namespace Internal {
class QmlJSEditorWidget; class QmlJSEditorWidget;
namespace Internal {
class QmlJSOutlineTreeView; class QmlJSOutlineTreeView;
class QmlJSOutlineFilterModel : public QSortFilterProxyModel class QmlJSOutlineFilterModel : public QSortFilterProxyModel

View File

@@ -32,10 +32,11 @@
#include <texteditor/codeassist/iassistprovider.h> #include <texteditor/codeassist/iassistprovider.h>
namespace QmlJSEditor { namespace QmlJSEditor {
namespace Internal {
class QmlJSEditorWidget; class QmlJSEditorWidget;
namespace Internal {
class QmlJSQuickFixAssistInterface : public TextEditor::AssistInterface class QmlJSQuickFixAssistInterface : public TextEditor::AssistInterface
{ {
public: public:

View File

@@ -54,8 +54,6 @@ using namespace QmlJS::AST;
namespace QmlJSEditor { namespace QmlJSEditor {
using namespace Internal;
namespace { namespace {
static bool isIdScope(const ObjectValue *scope, const QList<const QmlComponentChain *> &chain) static bool isIdScope(const ObjectValue *scope, const QList<const QmlComponentChain *> &chain)

View File

@@ -25,6 +25,7 @@
#pragma once #pragma once
#include <qmljseditor/qmljseditor_global.h>
#include <texteditor/semantichighlighter.h> #include <texteditor/semantichighlighter.h>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QTextLayout> #include <QTextLayout>
@@ -42,9 +43,7 @@ namespace QmlJSEditor {
class QmlJSEditorDocument; class QmlJSEditorDocument;
namespace Internal { class QMLJSEDITOR_EXPORT SemanticHighlighter : public QObject
class SemanticHighlighter : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -92,5 +91,4 @@ private:
QVector<QTextLayout::FormatRange> m_diagnosticRanges; QVector<QTextLayout::FormatRange> m_diagnosticRanges;
}; };
} // namespace Internal
} // namespace QmlJSEditor } // namespace QmlJSEditor