summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-09-04 00:04:18 +0200
committerhjk <hjk121@nokiamail.com>2014-09-09 21:01:22 +0200
commit0edefc4c2bb2e8b88d6e86c2fe768b597e16ede1 (patch)
tree76f4c36eed6389537c49e549dfe9567e2e7737e8
parent0c3eeab464a488edfedb1e98b433102f2293669a (diff)
downloadqt-creator-0edefc4c2bb2e8b88d6e86c2fe768b597e16ede1.tar.gz
TextEditor: Merge some "assist" related classes
Simplifies the code base by removing one level of unused and unneeded abstraction. - Merge {I,Default}AssistInterface to AssistInterface - Merge {IAssist,Basic}ProposalItem to AssistProposalItem - Merge {IGenericProposal,BasicProposalItemList}Model to GenericProposalModel Change-Id: I54ee7b095427383d67a00fc1d87c3808c21d812d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
-rw-r--r--src/plugins/clangcodemodel/clangcompletion.cpp18
-rw-r--r--src/plugins/clangcodemodel/clangcompletion.h12
-rw-r--r--src/plugins/clangcodemodel/test/completiontesthelper.cpp3
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp12
-rw-r--r--src/plugins/cppeditor/cppeditor.h2
-rw-r--r--src/plugins/cppeditor/cppquickfixassistant.cpp4
-rw-r--r--src/plugins/cppeditor/cppquickfixassistant.h4
-rw-r--r--src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp26
-rw-r--r--src/plugins/cppeditor/cppvirtualfunctionproposalitem.h5
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp6
-rw-r--r--src/plugins/cpptools/cppcompletionassist.cpp36
-rw-r--r--src/plugins/cpptools/cppcompletionassist.h26
-rw-r--r--src/plugins/cpptools/cppcompletionassistprovider.h4
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp20
-rw-r--r--src/plugins/glsleditor/glslcompletionassist.cpp12
-rw-r--r--src/plugins/glsleditor/glslcompletionassist.h10
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp4
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.cpp32
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.h20
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp10
-rw-r--r--src/plugins/qmljseditor/qmljseditor.h2
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.cpp4
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.h4
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp8
-rw-r--r--src/plugins/texteditor/basetexteditor.h4
-rw-r--r--src/plugins/texteditor/circularclipboardassist.cpp31
-rw-r--r--src/plugins/texteditor/codeassist/assistinterface.cpp (renamed from src/plugins/texteditor/codeassist/iassistinterface.cpp)82
-rw-r--r--src/plugins/texteditor/codeassist/assistinterface.h (renamed from src/plugins/texteditor/codeassist/iassistinterface.h)40
-rw-r--r--src/plugins/texteditor/codeassist/assistproposalitem.cpp (renamed from src/plugins/texteditor/codeassist/basicproposalitem.cpp)70
-rw-r--r--src/plugins/texteditor/codeassist/assistproposalitem.h (renamed from src/plugins/texteditor/codeassist/basicproposalitem.h)28
-rw-r--r--src/plugins/texteditor/codeassist/codeassistant.cpp14
-rw-r--r--src/plugins/texteditor/codeassist/defaultassistinterface.cpp82
-rw-r--r--src/plugins/texteditor/codeassist/defaultassistinterface.h68
-rw-r--r--src/plugins/texteditor/codeassist/genericproposal.cpp8
-rw-r--r--src/plugins/texteditor/codeassist/genericproposal.h6
-rw-r--r--src/plugins/texteditor/codeassist/genericproposalmodel.cpp (renamed from src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp)63
-rw-r--r--src/plugins/texteditor/codeassist/genericproposalmodel.h (renamed from src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h)54
-rw-r--r--src/plugins/texteditor/codeassist/genericproposalwidget.cpp32
-rw-r--r--src/plugins/texteditor/codeassist/genericproposalwidget.h4
-rw-r--r--src/plugins/texteditor/codeassist/iassistprocessor.cpp4
-rw-r--r--src/plugins/texteditor/codeassist/iassistprocessor.h6
-rw-r--r--src/plugins/texteditor/codeassist/iassistproposalitem.cpp66
-rw-r--r--src/plugins/texteditor/codeassist/iassistproposalitem.h55
-rw-r--r--src/plugins/texteditor/codeassist/iassistproposalmodel.cpp2
-rw-r--r--src/plugins/texteditor/codeassist/iassistproposalmodel.h2
-rw-r--r--src/plugins/texteditor/codeassist/iassistproposalwidget.cpp4
-rw-r--r--src/plugins/texteditor/codeassist/iassistproposalwidget.h4
-rw-r--r--src/plugins/texteditor/codeassist/igenericproposalmodel.cpp38
-rw-r--r--src/plugins/texteditor/codeassist/igenericproposalmodel.h65
-rw-r--r--src/plugins/texteditor/codeassist/keywordscompletionassist.cpp14
-rw-r--r--src/plugins/texteditor/codeassist/keywordscompletionassist.h10
-rw-r--r--src/plugins/texteditor/codeassist/quickfixassistprocessor.cpp20
-rw-r--r--src/plugins/texteditor/codeassist/quickfixassistprocessor.h2
-rw-r--r--src/plugins/texteditor/codeassist/runner.cpp4
-rw-r--r--src/plugins/texteditor/codeassist/runner.h6
-rw-r--r--src/plugins/texteditor/quickfix.h4
-rw-r--r--src/plugins/texteditor/snippets/snippetassistcollector.cpp14
-rw-r--r--src/plugins/texteditor/snippets/snippetassistcollector.h4
-rw-r--r--src/plugins/texteditor/texteditor.pro18
-rw-r--r--src/plugins/texteditor/texteditor.qbs18
60 files changed, 464 insertions, 766 deletions
diff --git a/src/plugins/clangcodemodel/clangcompletion.cpp b/src/plugins/clangcodemodel/clangcompletion.cpp
index 1d55acc3b9..a0a2ba528c 100644
--- a/src/plugins/clangcodemodel/clangcompletion.cpp
+++ b/src/plugins/clangcodemodel/clangcompletion.cpp
@@ -48,8 +48,8 @@
#include <texteditor/basetexteditor.h>
#include <texteditor/convenience.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
-#include <texteditor/codeassist/basicproposalitem.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
+#include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/functionhintproposal.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
@@ -202,7 +202,7 @@ IAssistProcessor *ClangCompletionAssistProvider::createProcessor() const
return new ClangCompletionAssistProcessor;
}
-IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
+AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position, AssistReason reason) const
{
@@ -235,11 +235,11 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
// ------------------------
// ClangAssistProposalModel
// ------------------------
-class ClangAssistProposalModel : public TextEditor::BasicProposalItemListModel
+class ClangAssistProposalModel : public TextEditor::GenericProposalModel
{
public:
ClangAssistProposalModel()
- : TextEditor::BasicProposalItemListModel()
+ : TextEditor::GenericProposalModel()
, m_sortable(false)
, m_completionOperator(T_EOF_SYMBOL)
, m_replaceDotForArrow(false)
@@ -257,7 +257,7 @@ public:
class ClangAssistProposal : public TextEditor::GenericProposal
{
public:
- ClangAssistProposal(int cursorPos, TextEditor::IGenericProposalModel *model)
+ ClangAssistProposal(int cursorPos, TextEditor::GenericProposalModel *model)
: TextEditor::GenericProposal(cursorPos, model)
, m_replaceDotForArrow(static_cast<ClangAssistProposalModel *>(model)->m_replaceDotForArrow)
{}
@@ -345,7 +345,7 @@ int ClangFunctionHintModel::activeArgument(const QString &prefix) const
return argnr;
}
-class ClangAssistProposalItem : public TextEditor::BasicProposalItem
+class ClangAssistProposalItem : public TextEditor::AssistProposalItem
{
public:
ClangAssistProposalItem() {}
@@ -550,7 +550,7 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(ClangCompleter::P
const QStringList &options,
const QList<CppTools::ProjectPart::HeaderPath> &headerPaths,
const PchInfo::Ptr &pchInfo)
- : DefaultAssistInterface(document, position, fileName, reason)
+ : AssistInterface(document, position, fileName, reason)
, m_clangWrapper(clangWrapper)
, m_options(options)
, m_headerPaths(headerPaths)
@@ -602,7 +602,7 @@ ClangCompletionAssistProcessor::~ClangCompletionAssistProcessor()
{
}
-IAssistProposal *ClangCompletionAssistProcessor::perform(const IAssistInterface *interface)
+IAssistProposal *ClangCompletionAssistProcessor::perform(const AssistInterface *interface)
{
m_interface.reset(static_cast<const ClangCompletionAssistInterface *>(interface));
diff --git a/src/plugins/clangcodemodel/clangcompletion.h b/src/plugins/clangcodemodel/clangcompletion.h
index 7a6946bd57..0f9ada9efd 100644
--- a/src/plugins/clangcodemodel/clangcompletion.h
+++ b/src/plugins/clangcodemodel/clangcompletion.h
@@ -37,9 +37,9 @@
#include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cppmodelmanagerinterface.h>
-#include <texteditor/codeassist/basicproposalitem.h>
+#include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/completionassistprovider.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <QStringList>
@@ -56,7 +56,7 @@ public:
ClangCompletionAssistProvider();
virtual TextEditor::IAssistProcessor *createProcessor() const;
- virtual TextEditor::IAssistInterface *createAssistInterface(
+ virtual TextEditor::AssistInterface *createAssistInterface(
const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position,
TextEditor::AssistReason reason) const;
@@ -67,7 +67,7 @@ private:
} // namespace Internal
-class CLANG_EXPORT ClangCompletionAssistInterface: public TextEditor::DefaultAssistInterface
+class CLANG_EXPORT ClangCompletionAssistInterface: public TextEditor::AssistInterface
{
public:
ClangCompletionAssistInterface(ClangCodeModel::ClangCompleter::Ptr clangWrapper,
@@ -109,7 +109,7 @@ public:
ClangCompletionAssistProcessor();
virtual ~ClangCompletionAssistProcessor();
- virtual TextEditor::IAssistProposal *perform(const TextEditor::IAssistInterface *interface);
+ virtual TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface);
private:
int startCompletionHelper();
@@ -133,7 +133,7 @@ private:
private:
int m_startPosition;
QScopedPointer<const ClangCompletionAssistInterface> m_interface;
- QList<TextEditor::BasicProposalItem *> m_completions;
+ QList<TextEditor::AssistProposalItem *> m_completions;
CPlusPlus::Icons m_icons;
QStringList m_preprocessorCompletions;
QScopedPointer<Internal::ClangAssistProposalModel> m_model;
diff --git a/src/plugins/clangcodemodel/test/completiontesthelper.cpp b/src/plugins/clangcodemodel/test/completiontesthelper.cpp
index e11bbb1222..9f087b75d6 100644
--- a/src/plugins/clangcodemodel/test/completiontesthelper.cpp
+++ b/src/plugins/clangcodemodel/test/completiontesthelper.cpp
@@ -39,8 +39,7 @@
#include <texteditor/basetextdocument.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/codeassist/iassistproposal.h>
-#include <texteditor/codeassist/iassistproposalmodel.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <utils/fileutils.h>
#include <utils/changeset.h>
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 004a8ccfe0..5a675e6d5d 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -62,8 +62,8 @@
#include <texteditor/basetextdocument.h>
#include <texteditor/basetextdocumentlayout.h>
-#include <texteditor/codeassist/basicproposalitem.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/assistproposalitem.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/fontsettings.h>
#include <texteditor/refactoroverlay.h>
@@ -498,15 +498,15 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (isSemanticInfoValid()) {
- IAssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
+ AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
if (interface) {
QScopedPointer<IAssistProcessor> processor(
CppEditorPlugin::instance()->quickFixProvider()->createProcessor());
QScopedPointer<IAssistProposal> proposal(processor->perform(interface));
if (!proposal.isNull()) {
- auto model = static_cast<BasicProposalItemListModel *>(proposal->model());
+ auto model = static_cast<GenericProposalModel *>(proposal->model());
for (int index = 0; index < model->size(); ++index) {
- auto item = static_cast<BasicProposalItem *>(model->proposalItem(index));
+ auto item = static_cast<AssistProposalItem *>(model->proposalItem(index));
QuickFixOperation::Ptr op = item->data().value<QuickFixOperation::Ptr>();
d->m_quickFixes.append(op);
QAction *action = quickFixMenu->addAction(op->description());
@@ -610,7 +610,7 @@ void CppEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo,
updateFunctionDeclDefLink();
}
-IAssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistReason reason) const
+AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistReason reason) const
{
if (kind == Completion) {
if (CppCompletionAssistProvider *cap = cppEditorDocument()->completionAssistProvider()) {
diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h
index b0beb56288..a408c122d5 100644
--- a/src/plugins/cppeditor/cppeditor.h
+++ b/src/plugins/cppeditor/cppeditor.h
@@ -79,7 +79,7 @@ public:
QSharedPointer<FunctionDeclDefLink> declDefLink() const;
void applyDeclDefLinkChanges(bool jumpToMatch);
- TextEditor::IAssistInterface *createAssistInterface(
+ TextEditor::AssistInterface *createAssistInterface(
TextEditor::AssistKind kind,
TextEditor::AssistReason reason) const QTC_OVERRIDE;
diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp
index 91d1ddde86..9331023dc1 100644
--- a/src/plugins/cppeditor/cppquickfixassistant.cpp
+++ b/src/plugins/cppeditor/cppquickfixassistant.cpp
@@ -87,8 +87,8 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
// --------------------------
CppQuickFixAssistInterface::CppQuickFixAssistInterface(CppEditorWidget *editor,
TextEditor::AssistReason reason)
- : DefaultAssistInterface(editor->document(), editor->position(),
- editor->textDocument()->filePath(), reason)
+ : AssistInterface(editor->document(), editor->position(),
+ editor->textDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
diff --git a/src/plugins/cppeditor/cppquickfixassistant.h b/src/plugins/cppeditor/cppquickfixassistant.h
index 843438b43a..3f61f41f49 100644
--- a/src/plugins/cppeditor/cppquickfixassistant.h
+++ b/src/plugins/cppeditor/cppquickfixassistant.h
@@ -31,7 +31,7 @@
#define CPPQUICKFIXASSISTANT_H
#include <cpptools/cppsemanticinfo.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/quickfixassistprovider.h>
#include <texteditor/codeassist/quickfixassistprocessor.h>
@@ -49,7 +49,7 @@ namespace Internal {
class CppEditorWidget;
-class CppQuickFixAssistInterface : public TextEditor::DefaultAssistInterface
+class CppQuickFixAssistInterface : public TextEditor::AssistInterface
{
public:
CppQuickFixAssistInterface(CppEditorWidget *editor, TextEditor::AssistReason reason);
diff --git a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
index 34e8cfcff0..7ba140dc6e 100644
--- a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
+++ b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
@@ -44,10 +44,10 @@
#include <cpptools/symbolfinder.h>
#include <cpptools/typehierarchybuilder.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/genericproposalwidget.h>
-#include <texteditor/codeassist/iassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistproposal.h>
#include <texteditor/texteditorconstants.h>
@@ -91,7 +91,7 @@ protected:
void showProposal(const QString &prefix) QTC_OVERRIDE
{
- IGenericProposalModel *proposalModel = model();
+ GenericProposalModel *proposalModel = model();
if (proposalModel && proposalModel->size() == 1) {
emit proposalItemActivated(proposalModel->proposalItem(0));
deleteLater();
@@ -107,7 +107,7 @@ private:
class VirtualFunctionProposal : public GenericProposal
{
public:
- VirtualFunctionProposal(int cursorPos, IGenericProposalModel *model, bool openInSplit)
+ VirtualFunctionProposal(int cursorPos, GenericProposalModel *model, bool openInSplit)
: GenericProposal(cursorPos, model)
, m_openInSplit(openInSplit)
{}
@@ -128,24 +128,24 @@ public:
: m_params(params)
{}
- IAssistProposal *immediateProposal(const TextEditor::IAssistInterface *) QTC_OVERRIDE
+ IAssistProposal *immediateProposal(const TextEditor::AssistInterface *) QTC_OVERRIDE
{
QTC_ASSERT(m_params.function, return 0);
- BasicProposalItem *hintItem = new VirtualFunctionProposalItem(CppEditorWidget::Link());
+ AssistProposalItem *hintItem = new VirtualFunctionProposalItem(CppEditorWidget::Link());
hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor",
"...searching overrides"));
hintItem->setOrder(-1000);
- QList<BasicProposalItem *> items;
+ QList<AssistProposalItem *> items;
items << itemFromFunction(m_params.function);
items << hintItem;
return new VirtualFunctionProposal(m_params.cursorPosition,
- new BasicProposalItemListModel(items),
+ new GenericProposalModel(items),
m_params.openInNextSplit);
}
- IAssistProposal *perform(const IAssistInterface *) QTC_OVERRIDE
+ IAssistProposal *perform(const AssistInterface *) QTC_OVERRIDE
{
QTC_ASSERT(m_params.function, return 0);
QTC_ASSERT(m_params.staticClass, return 0);
@@ -161,13 +161,13 @@ public:
if (overrides.isEmpty())
return 0;
- QList<BasicProposalItem *> items;
+ QList<AssistProposalItem *> items;
foreach (Function *func, overrides)
items << itemFromFunction(func);
items.first()->setOrder(1000); // Ensure top position for function of static type
return new VirtualFunctionProposal(m_params.cursorPosition,
- new BasicProposalItemListModel(items),
+ new GenericProposalModel(items),
m_params.openInNextSplit);
}
@@ -179,14 +179,14 @@ private:
return func;
}
- BasicProposalItem *itemFromFunction(Function *func) const
+ AssistProposalItem *itemFromFunction(Function *func) const
{
const CppEditorWidget::Link link = CppEditorWidget::linkToSymbol(maybeDefinitionFor(func));
QString text = m_overview.prettyName(LookupContext::fullyQualifiedName(func));
if (func->isPureVirtual())
text += QLatin1String(" = 0");
- BasicProposalItem *item = new VirtualFunctionProposalItem(link, m_params.openInNextSplit);
+ AssistProposalItem *item = new VirtualFunctionProposalItem(link, m_params.openInNextSplit);
item->setText(text);
item->setIcon(m_icons.iconForSymbol(func));
diff --git a/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h b/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h
index 6252cec584..a2c48b6314 100644
--- a/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h
+++ b/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h
@@ -31,12 +31,13 @@
#define CPPVIRTUALFUNCTIONPROPOSALITEM_H
#include <texteditor/basetexteditor.h>
-#include <texteditor/codeassist/basicproposalitem.h>
+#include <texteditor/codeassist/assistproposalitem.h>
namespace CppEditor {
namespace Internal {
-class VirtualFunctionProposalItem: public TextEditor::BasicProposalItem {
+class VirtualFunctionProposalItem: public TextEditor::AssistProposalItem
+{
public:
VirtualFunctionProposalItem(const TextEditor::BaseTextEditorWidget::Link &link,
bool openInSplit = true);
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index b3191ba031..5da21718a1 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -34,7 +34,7 @@
#include "cppvirtualfunctionassistprovider.h"
#include "cppvirtualfunctionproposalitem.h"
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistproposal.h>
@@ -124,7 +124,7 @@ public:
VirtualFunctionAssistProvider::configure(params);
IAssistProcessor *processor = createProcessor();
- IAssistInterface *assistInterface
+ AssistInterface *assistInterface
= m_editorWidget->createAssistInterface(FollowSymbol, ExplicitlyInvoked);
IAssistProposal *immediateProposal = processor->immediateProposal(assistInterface);
IAssistProposal *finalProposal = processor->perform(assistInterface);
@@ -140,7 +140,7 @@ public:
static OverrideItemList itemList(IAssistProposalModel *imodel)
{
OverrideItemList result;
- BasicProposalItemListModel *model = dynamic_cast<BasicProposalItemListModel *>(imodel);
+ GenericProposalModel *model = dynamic_cast<GenericProposalModel *>(imodel);
if (!model)
return result;
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index d366375036..c45f159d66 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -39,7 +39,7 @@
#include <coreplugin/icore.h>
#include <cppeditor/cppeditorconstants.h>
-#include <texteditor/codeassist/basicproposalitem.h>
+#include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
#include <texteditor/codeassist/functionhintproposal.h>
@@ -84,7 +84,7 @@ struct CompleteFunctionDeclaration
// ---------------------
// CppAssistProposalItem
// ---------------------
-class CppAssistProposalItem : public BasicProposalItem
+class CppAssistProposalItem : public AssistProposalItem
{
public:
CppAssistProposalItem() :
@@ -119,9 +119,9 @@ bool CppAssistProposalModel::isSortable(const QString &prefix) const
return !prefix.isEmpty();
}
-IAssistProposalItem *CppAssistProposalModel::proposalItem(int index) const
+AssistProposalItem *CppAssistProposalModel::proposalItem(int index) const
{
- auto item = static_cast<BasicProposalItem *>(BasicProposalItemListModel::proposalItem(index));
+ auto item = static_cast<AssistProposalItem *>(GenericProposalModel::proposalItem(index));
if (!item->data().canConvert<QString>()) {
CppAssistProposalItem *cppItem = static_cast<CppAssistProposalItem *>(item);
cppItem->keepCompletionOperator(m_completionOperator);
@@ -416,7 +416,7 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const
return new CppCompletionAssistProcessor;
}
-IAssistInterface *InternalCompletionAssistProvider::createAssistInterface(
+AssistInterface *InternalCompletionAssistProvider::createAssistInterface(
const QString &filePath, QTextDocument *document,
bool isObjCEnabled, int position, AssistReason reason) const
{
@@ -434,7 +434,7 @@ IAssistInterface *InternalCompletionAssistProvider::createAssistInterface(
class CppAssistProposal : public GenericProposal
{
public:
- CppAssistProposal(int cursorPos, IGenericProposalModel *model)
+ CppAssistProposal(int cursorPos, GenericProposalModel *model)
: GenericProposal(cursorPos, model)
, m_replaceDotForArrow(static_cast<CppAssistProposalModel *>(model)->m_replaceDotForArrow)
{}
@@ -460,7 +460,7 @@ namespace {
class ConvertToCompletionItem: protected NameVisitor
{
// The completion item.
- BasicProposalItem *_item;
+ AssistProposalItem *_item;
// The current symbol.
Symbol *_symbol;
@@ -477,14 +477,14 @@ public:
overview.showArgumentNames = true;
}
- BasicProposalItem *operator()(Symbol *symbol)
+ AssistProposalItem *operator()(Symbol *symbol)
{
//using declaration can be qualified
if (!symbol || !symbol->name() || (symbol->name()->isQualifiedNameId()
&& !symbol->asUsingDeclaration()))
return 0;
- BasicProposalItem *previousItem = switchCompletionItem(0);
+ AssistProposalItem *previousItem = switchCompletionItem(0);
Symbol *previousSymbol = switchSymbol(symbol);
accept(symbol->unqualifiedName());
if (_item)
@@ -501,16 +501,16 @@ protected:
return previousSymbol;
}
- BasicProposalItem *switchCompletionItem(BasicProposalItem *item)
+ AssistProposalItem *switchCompletionItem(AssistProposalItem *item)
{
- BasicProposalItem *previousItem = _item;
+ AssistProposalItem *previousItem = _item;
_item = item;
return previousItem;
}
- BasicProposalItem *newCompletionItem(const Name *name)
+ AssistProposalItem *newCompletionItem(const Name *name)
{
- BasicProposalItem *item = new CppAssistProposalItem;
+ AssistProposalItem *item = new CppAssistProposalItem;
item->setText(overview.prettyName(name));
return item;
}
@@ -631,7 +631,7 @@ CppCompletionAssistProcessor::CppCompletionAssistProcessor()
CppCompletionAssistProcessor::~CppCompletionAssistProcessor()
{}
-IAssistProposal * CppCompletionAssistProcessor::perform(const IAssistInterface *interface)
+IAssistProposal * CppCompletionAssistProcessor::perform(const AssistInterface *interface)
{
m_interface.reset(static_cast<const CppCompletionAssistInterface *>(interface));
@@ -719,7 +719,7 @@ IAssistProposal *CppCompletionAssistProcessor::createContentProposal()
{
// Duplicates are kept only if they are snippets.
QSet<QString> processed;
- QList<BasicProposalItem *>::iterator it = m_completions.begin();
+ QList<AssistProposalItem *>::iterator it = m_completions.begin();
while (it != m_completions.end()) {
CppAssistProposalItem *item = static_cast<CppAssistProposalItem *>(*it);
if (!processed.contains(item->text()) || item->data().canConvert<QString>()) {
@@ -1047,7 +1047,7 @@ void CppCompletionAssistProcessor::addCompletionItem(const QString &text,
int order,
const QVariant &data)
{
- BasicProposalItem *item = new CppAssistProposalItem;
+ AssistProposalItem *item = new CppAssistProposalItem;
item->setText(text);
item->setIcon(icon);
item->setOrder(order);
@@ -1059,7 +1059,7 @@ void CppCompletionAssistProcessor::addCompletionItem(CPlusPlus::Symbol *symbol,
int order)
{
ConvertToCompletionItem toCompletionItem;
- BasicProposalItem *item = toCompletionItem(symbol);
+ AssistProposalItem *item = toCompletionItem(symbol);
if (item) {
item->setIcon(m_icons.iconForSymbol(symbol));
item->setOrder(order);
@@ -1680,7 +1680,7 @@ bool CppCompletionAssistProcessor::completeQtMethod(const QList<CPlusPlus::Looku
signature = QString::fromUtf8(normalized, normalized.size());
if (!signatures.contains(signature)) {
- BasicProposalItem *ci = toCompletionItem(fun);
+ AssistProposalItem *ci = toCompletionItem(fun);
if (!ci)
break;
signatures.insert(signature);
diff --git a/src/plugins/cpptools/cppcompletionassist.h b/src/plugins/cpptools/cppcompletionassist.h
index 44d5bc8d77..1eff1bd59f 100644
--- a/src/plugins/cpptools/cppcompletionassist.h
+++ b/src/plugins/cpptools/cppcompletionassist.h
@@ -39,8 +39,8 @@
#include <cplusplus/TypeOfExpression.h>
#include <texteditor/basetexteditor.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/snippets/snippetassistcollector.h>
@@ -49,10 +49,6 @@
#include <QStringList>
#include <QVariant>
-QT_BEGIN_NAMESPACE
-class QTextCursor;
-QT_END_NAMESPACE
-
namespace CPlusPlus {
class LookupItem;
class ClassOrNamespace;
@@ -65,11 +61,11 @@ namespace Internal {
class CppCompletionAssistInterface;
-class CppAssistProposalModel : public TextEditor::BasicProposalItemListModel
+class CppAssistProposalModel : public TextEditor::GenericProposalModel
{
public:
CppAssistProposalModel()
- : TextEditor::BasicProposalItemListModel()
+ : TextEditor::GenericProposalModel()
, m_completionOperator(CPlusPlus::T_EOF_SYMBOL)
, m_replaceDotForArrow(false)
, m_typeOfExpression(new CPlusPlus::TypeOfExpression)
@@ -78,7 +74,7 @@ public:
}
bool isSortable(const QString &prefix) const QTC_OVERRIDE;
- TextEditor::IAssistProposalItem *proposalItem(int index) const QTC_OVERRIDE;
+ TextEditor::AssistProposalItem *proposalItem(int index) const QTC_OVERRIDE;
unsigned m_completionOperator;
bool m_replaceDotForArrow;
@@ -92,7 +88,7 @@ class InternalCompletionAssistProvider : public CppCompletionAssistProvider
public:
TextEditor::IAssistProcessor *createProcessor() const QTC_OVERRIDE;
- TextEditor::IAssistInterface *createAssistInterface(
+ TextEditor::AssistInterface *createAssistInterface(
const QString &filePath,
QTextDocument *document,
bool isObjCEnabled,
@@ -106,7 +102,7 @@ public:
CppCompletionAssistProcessor();
~CppCompletionAssistProcessor();
- TextEditor::IAssistProposal *perform(const TextEditor::IAssistInterface *interface) QTC_OVERRIDE;
+ TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) QTC_OVERRIDE;
private:
TextEditor::IAssistProposal *createContentProposal();
@@ -159,7 +155,7 @@ private:
int m_startPosition;
CPlusPlus::LanguageFeatures m_languageFeatures;
QScopedPointer<const CppCompletionAssistInterface> m_interface;
- QList<TextEditor::BasicProposalItem *> m_completions;
+ QList<TextEditor::AssistProposalItem *> m_completions;
TextEditor::SnippetAssistCollector m_snippetCollector;
CPlusPlus::Icons m_icons;
QStringList preprocessorCompletions;
@@ -167,7 +163,7 @@ private:
TextEditor::IAssistProposal *m_hintProposal;
};
-class CppCompletionAssistInterface : public TextEditor::DefaultAssistInterface
+class CppCompletionAssistInterface : public TextEditor::AssistInterface
{
public:
CppCompletionAssistInterface(const QString &filePath,
@@ -176,7 +172,7 @@ public:
int position,
TextEditor::AssistReason reason,
const WorkingCopy &workingCopy)
- : TextEditor::DefaultAssistInterface(textDocument, position, filePath, reason)
+ : TextEditor::AssistInterface(textDocument, position, filePath, reason)
, m_isObjCEnabled(isObjCEnabled)
, m_gotCppSpecifics(false)
, m_workingCopy(workingCopy)
@@ -188,7 +184,7 @@ public:
TextEditor::AssistReason reason,
const CPlusPlus::Snapshot &snapshot,
const ProjectPart::HeaderPaths &headerPaths)
- : TextEditor::DefaultAssistInterface(textDocument, position, filePath, reason)
+ : TextEditor::AssistInterface(textDocument, position, filePath, reason)
, m_isObjCEnabled(false)
, m_gotCppSpecifics(true)
, m_snapshot(snapshot)
diff --git a/src/plugins/cpptools/cppcompletionassistprovider.h b/src/plugins/cpptools/cppcompletionassistprovider.h
index 7fc8e3d39b..329055a4f9 100644
--- a/src/plugins/cpptools/cppcompletionassistprovider.h
+++ b/src/plugins/cpptools/cppcompletionassistprovider.h
@@ -43,7 +43,7 @@ QT_END_NAMESPACE
namespace TextEditor {
class BaseTextEditor;
-class IAssistInterface;
+class AssistInterface;
}
namespace CppTools {
@@ -58,7 +58,7 @@ public:
bool isActivationCharSequence(const QString &sequence) const QTC_OVERRIDE;
bool isContinuationChar(const QChar &c) const QTC_OVERRIDE;
- virtual TextEditor::IAssistInterface *createAssistInterface(
+ virtual TextEditor::AssistInterface *createAssistInterface(
const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position,
TextEditor::AssistReason reason) const = 0;
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 524144a410..bf875baf9c 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -65,11 +65,11 @@
#include <texteditor/icodestylepreferences.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/indenter.h>
-#include <texteditor/codeassist/basicproposalitem.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/assistproposalitem.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/iassistprocessor.h>
-#include <texteditor/codeassist/iassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/genericproposal.h>
#include <utils/fancylineedit.h>
@@ -881,7 +881,7 @@ private:
QString m_needle;
};
-class FakeVimAssistProposalItem : public BasicProposalItem
+class FakeVimAssistProposalItem : public AssistProposalItem
{
public:
FakeVimAssistProposalItem(const FakeVimCompletionAssistProvider *provider)
@@ -911,11 +911,11 @@ private:
};
-class FakeVimAssistProposalModel : public BasicProposalItemListModel
+class FakeVimAssistProposalModel : public GenericProposalModel
{
public:
- FakeVimAssistProposalModel(const QList<BasicProposalItem *> &items)
- : BasicProposalItemListModel(items)
+ FakeVimAssistProposalModel(const QList<AssistProposalItem *> &items)
+ : GenericProposalModel(items)
{}
bool supportsPrefixExpansion() const QTC_OVERRIDE
@@ -931,7 +931,7 @@ public:
: m_provider(static_cast<const FakeVimCompletionAssistProvider *>(provider))
{}
- IAssistProposal *perform(const IAssistInterface *interface) QTC_OVERRIDE
+ IAssistProposal *perform(const AssistInterface *interface) QTC_OVERRIDE
{
const QString &needle = m_provider->needle();
@@ -941,7 +941,7 @@ public:
tc.setPosition(interface->position());
tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
- QList<BasicProposalItem *> items;
+ QList<AssistProposalItem *> items;
QSet<QString> seen;
QTextDocument::FindFlags flags = QTextDocument::FindCaseSensitively;
while (1) {
@@ -956,7 +956,7 @@ public:
&& !seen.contains(found)
&& sel.anchor() != basePosition) {
seen.insert(found);
- BasicProposalItem *item = new FakeVimAssistProposalItem(m_provider);
+ AssistProposalItem *item = new FakeVimAssistProposalItem(m_provider);
item->setText(found);
items.append(item);
}
diff --git a/src/plugins/glsleditor/glslcompletionassist.cpp b/src/plugins/glsleditor/glslcompletionassist.cpp
index 2a6a6ed50b..fd4820e4ba 100644
--- a/src/plugins/glsleditor/glslcompletionassist.cpp
+++ b/src/plugins/glsleditor/glslcompletionassist.cpp
@@ -40,8 +40,8 @@
#include <coreplugin/idocument.h>
#include <texteditor/completionsettings.h>
-#include <texteditor/codeassist/basicproposalitem.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/assistproposalitem.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/functionhintproposal.h>
#include <cplusplus/ExpressionUnderCursor.h>
@@ -242,7 +242,7 @@ GlslCompletionAssistProcessor::GlslCompletionAssistProcessor()
GlslCompletionAssistProcessor::~GlslCompletionAssistProcessor()
{}
-IAssistProposal *GlslCompletionAssistProcessor::perform(const IAssistInterface *interface)
+IAssistProposal *GlslCompletionAssistProcessor::perform(const AssistInterface *interface)
{
m_interface.reset(static_cast<const GlslCompletionAssistInterface *>(interface));
@@ -432,7 +432,7 @@ IAssistProposal *GlslCompletionAssistProcessor::perform(const IAssistInterface *
IAssistProposal *GlslCompletionAssistProcessor::createContentProposal() const
{
- IGenericProposalModel *model = new BasicProposalItemListModel(m_completions);
+ GenericProposalModel *model = new GenericProposalModel(m_completions);
IAssistProposal *proposal = new GenericProposal(m_startPosition, model);
return proposal;
}
@@ -479,7 +479,7 @@ void GlslCompletionAssistProcessor::addCompletion(const QString &text,
const QIcon &icon,
int order)
{
- BasicProposalItem *item = new BasicProposalItem;
+ AssistProposalItem *item = new AssistProposalItem;
item->setText(text);
item->setIcon(icon);
item->setOrder(order);
@@ -495,7 +495,7 @@ GlslCompletionAssistInterface::GlslCompletionAssistInterface(QTextDocument *text
AssistReason reason,
const QString &mimeType,
const Document::Ptr &glslDoc)
- : DefaultAssistInterface(textDocument, position, fileName, reason)
+ : AssistInterface(textDocument, position, fileName, reason)
, m_mimeType(mimeType)
, m_glslDoc(glslDoc)
{
diff --git a/src/plugins/glsleditor/glslcompletionassist.h b/src/plugins/glsleditor/glslcompletionassist.h
index 39e23bf275..abac3989db 100644
--- a/src/plugins/glsleditor/glslcompletionassist.h
+++ b/src/plugins/glsleditor/glslcompletionassist.h
@@ -34,7 +34,7 @@
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/iassistprocessor.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
#include <utils/qtcoverride.h>
@@ -50,7 +50,7 @@ class TranslationUnitAST;
class Scope;
} // namespace GLSL
-namespace TextEditor { class BasicProposalItem; }
+namespace TextEditor { class AssistProposalItem; }
namespace GlslEditor {
namespace Internal {
@@ -104,7 +104,7 @@ public:
GlslCompletionAssistProcessor();
~GlslCompletionAssistProcessor();
- TextEditor::IAssistProposal *perform(const TextEditor::IAssistInterface *interface) QTC_OVERRIDE;
+ TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) QTC_OVERRIDE;
private:
TextEditor::IAssistProposal *createContentProposal() const;
@@ -114,7 +114,7 @@ private:
int m_startPosition;
QScopedPointer<const GlslCompletionAssistInterface> m_interface;
- QList<TextEditor::BasicProposalItem *> m_completions;
+ QList<TextEditor::AssistProposalItem *> m_completions;
QIcon m_keywordIcon;
QIcon m_varIcon;
@@ -127,7 +127,7 @@ private:
QIcon m_otherIcon;
};
-class GlslCompletionAssistInterface : public TextEditor::DefaultAssistInterface
+class GlslCompletionAssistInterface : public TextEditor::AssistInterface
{
public:
GlslCompletionAssistInterface(QTextDocument *textDocument,
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index 98bb60e231..a7afa7a535 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -121,7 +121,7 @@ public:
QSet<QString> identifiers() const;
- IAssistInterface *createAssistInterface(AssistKind assistKind, AssistReason reason) const;
+ AssistInterface *createAssistInterface(AssistKind assistKind, AssistReason reason) const;
private:
void updateDocumentNow();
@@ -311,7 +311,7 @@ int languageVariant(const QString &type)
return variant;
}
-IAssistInterface *GlslEditorWidget::createAssistInterface(
+AssistInterface *GlslEditorWidget::createAssistInterface(
AssistKind kind, AssistReason reason) const
{
if (kind == Completion)
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index 40564155e9..a025e942f0 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -34,7 +34,7 @@
#include <coreplugin/idocument.h>
-#include <texteditor/codeassist/iassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/functionhintproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
@@ -83,7 +83,7 @@ enum CompletionOrder {
TypeOrder = -30
};
-static void addCompletion(QList<BasicProposalItem *> *completions,
+static void addCompletion(QList<AssistProposalItem *> *completions,
const QString &text,
const QIcon &icon,
int order,
@@ -92,7 +92,7 @@ static void addCompletion(QList<BasicProposalItem *> *completions,
if (text.isEmpty())
return;
- BasicProposalItem *item = new QmlJSAssistProposalItem;
+ AssistProposalItem *item = new QmlJSAssistProposalItem;
item->setText(text);
item->setIcon(icon);
item->setOrder(order);
@@ -100,7 +100,7 @@ static void addCompletion(QList<BasicProposalItem *> *completions,
completions->append(item);
}
-static void addCompletions(QList<BasicProposalItem *> *completions,
+static void addCompletions(QList<AssistProposalItem *> *completions,
const QStringList &newCompletions,
const QIcon &icon,
int order)
@@ -125,10 +125,10 @@ public:
class CompletionAdder : public PropertyProcessor
{
protected:
- QList<BasicProposalItem *> *completions;
+ QList<AssistProposalItem *> *completions;
public:
- CompletionAdder(QList<BasicProposalItem *> *completions,
+ CompletionAdder(QList<AssistProposalItem *> *completions,
const QIcon &icon, int order)
: completions(completions)
, icon(icon)
@@ -155,7 +155,7 @@ public:
class LhsCompletionAdder : public CompletionAdder
{
public:
- LhsCompletionAdder(QList<BasicProposalItem *> *completions,
+ LhsCompletionAdder(QList<AssistProposalItem *> *completions,
const QIcon &icon,
int order,
bool afterOn)
@@ -511,7 +511,7 @@ QmlJSCompletionAssistProcessor::~QmlJSCompletionAssistProcessor()
IAssistProposal *QmlJSCompletionAssistProcessor::createContentProposal() const
{
- IGenericProposalModel *model = new QmlJSAssistProposalModel(m_completions);
+ GenericProposalModel *model = new QmlJSAssistProposalModel(m_completions);
IAssistProposal *proposal = new GenericProposal(m_startPosition, model);
return proposal;
}
@@ -526,7 +526,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::createHintProposal(
return proposal;
}
-IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface *assistInterface)
+IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface *assistInterface)
{
m_interface.reset(static_cast<const QmlJSCompletionAssistInterface *>(assistInterface));
@@ -756,7 +756,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface
processProperties.setEnumerateSlots(false);
// id: is special
- BasicProposalItem *idProposalItem = new QmlJSAssistProposalItem;
+ AssistProposalItem *idProposalItem = new QmlJSAssistProposalItem;
idProposalItem->setText(QLatin1String("id: "));
idProposalItem->setIcon(m_interface->symbolIcon());
idProposalItem->setOrder(PropertyOrder);
@@ -932,7 +932,7 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas
dirIterator.next();
const QString fileName = dirIterator.fileName();
- BasicProposalItem *item = new QmlJSAssistProposalItem;
+ AssistProposalItem *item = new QmlJSAssistProposalItem;
item->setText(fileName);
item->setIcon(m_interface->fileNameIcon());
m_completions.append(item);
@@ -970,7 +970,7 @@ QmlJSCompletionAssistInterface::QmlJSCompletionAssistInterface(QTextDocument *te
const QString &fileName,
AssistReason reason,
const SemanticInfo &info)
- : DefaultAssistInterface(textDocument, position, fileName, reason)
+ : AssistInterface(textDocument, position, fileName, reason)
, m_semanticInfo(info)
, m_darkBlueIcon(iconForColor(Qt::darkBlue))
, m_darkYellowIcon(iconForColor(Qt::darkYellow))
@@ -989,7 +989,7 @@ class QmlJSLessThan
public:
QmlJSLessThan(const QString &searchString) : m_searchString(searchString)
{ }
- bool operator() (const BasicProposalItem *a, const BasicProposalItem *b)
+ bool operator() (const AssistProposalItem *a, const AssistProposalItem *b)
{
if (a->order() != b->order())
return a->order() > b->order();
@@ -1020,12 +1020,12 @@ private:
// -------------------------
void QmlJSAssistProposalModel::filter(const QString &prefix)
{
- BasicProposalItemListModel::filter(prefix);
+ GenericProposalModel::filter(prefix);
if (prefix.startsWith(QLatin1String("__")))
return;
- QList<BasicProposalItem *> newCurrentItems;
+ QList<AssistProposalItem *> newCurrentItems;
newCurrentItems.reserve(m_currentItems.size());
- foreach (BasicProposalItem *item, m_currentItems)
+ foreach (AssistProposalItem *item, m_currentItems)
if (!item->text().startsWith(QLatin1String("__")))
newCurrentItems << item;
m_currentItems = newCurrentItems;
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.h b/src/plugins/qmljseditor/qmljscompletionassist.h
index 23713148db..6145801e62 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.h
+++ b/src/plugins/qmljseditor/qmljscompletionassist.h
@@ -32,12 +32,12 @@
#include "qmljseditor.h"
-#include <texteditor/codeassist/basicproposalitem.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/assistproposalitem.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/snippets/snippetassistcollector.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <utils/qtcoverride.h>
@@ -53,7 +53,7 @@ namespace Internal {
class QmlJSCompletionAssistInterface;
-class QmlJSAssistProposalItem : public TextEditor::BasicProposalItem
+class QmlJSAssistProposalItem : public TextEditor::AssistProposalItem
{
public:
bool prematurelyApplies(const QChar &c) const QTC_OVERRIDE;
@@ -62,11 +62,11 @@ public:
};
-class QmlJSAssistProposalModel : public TextEditor::BasicProposalItemListModel
+class QmlJSAssistProposalModel : public TextEditor::GenericProposalModel
{
public:
- QmlJSAssistProposalModel(const QList<TextEditor::BasicProposalItem *> &items)
- : TextEditor::BasicProposalItemListModel(items)
+ QmlJSAssistProposalModel(const QList<TextEditor::AssistProposalItem *> &items)
+ : TextEditor::GenericProposalModel(items)
{}
void filter(const QString &prefix) QTC_OVERRIDE;
@@ -95,7 +95,7 @@ public:
QmlJSCompletionAssistProcessor();
~QmlJSCompletionAssistProcessor();
- TextEditor::IAssistProposal *perform(const TextEditor::IAssistInterface *interface) QTC_OVERRIDE;
+ TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) QTC_OVERRIDE;
private:
TextEditor::IAssistProposal *createContentProposal() const;
@@ -112,12 +112,12 @@ private:
int m_startPosition;
QScopedPointer<const QmlJSCompletionAssistInterface> m_interface;
- QList<TextEditor::BasicProposalItem *> m_completions;
+ QList<TextEditor::AssistProposalItem *> m_completions;
TextEditor::SnippetAssistCollector m_snippetCollector;
};
-class QmlJSCompletionAssistInterface : public TextEditor::DefaultAssistInterface
+class QmlJSCompletionAssistInterface : public TextEditor::AssistInterface
{
public:
QmlJSCompletionAssistInterface(QTextDocument *textDocument,
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index d788a1e2a5..4b41dd8b8d 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -67,7 +67,7 @@
#include <texteditor/syntaxhighlighter.h>
#include <texteditor/refactoroverlay.h>
#include <texteditor/codeassist/genericproposal.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/texteditoractionhandler.h>
#include <utils/changeset.h>
@@ -679,15 +679,15 @@ void QmlJSEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (!m_qmlJsEditorDocument->isSemanticInfoOutdated()) {
- IAssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
+ AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
if (interface) {
QScopedPointer<IAssistProcessor> processor(
QmlJSEditorPlugin::instance()->quickFixAssistProvider()->createProcessor());
QScopedPointer<IAssistProposal> proposal(processor->perform(interface));
if (!proposal.isNull()) {
- BasicProposalItemListModel *model = static_cast<BasicProposalItemListModel *>(proposal->model());
+ GenericProposalModel *model = static_cast<GenericProposalModel *>(proposal->model());
for (int index = 0; index < model->size(); ++index) {
- BasicProposalItem *item = static_cast<BasicProposalItem *>(model->proposalItem(index));
+ AssistProposalItem *item = static_cast<AssistProposalItem *>(model->proposalItem(index));
QuickFixOperation::Ptr op = item->data().value<QuickFixOperation::Ptr>();
m_quickFixes.append(op);
QAction *action = refactoringMenu->addAction(op->description());
@@ -831,7 +831,7 @@ bool QmlJSEditorWidget::hideContextPane()
return b;
}
-IAssistInterface *QmlJSEditorWidget::createAssistInterface(
+AssistInterface *QmlJSEditorWidget::createAssistInterface(
TextEditor::AssistKind assistKind,
TextEditor::AssistReason reason) const
{
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index d5caedc2ea..77da8fbc30 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -72,7 +72,7 @@ public:
QModelIndex outlineModelIndex();
- TextEditor::IAssistInterface *createAssistInterface(TextEditor::AssistKind assistKind,
+ TextEditor::AssistInterface *createAssistInterface(TextEditor::AssistKind assistKind,
TextEditor::AssistReason reason) const;
public slots:
void findUsages();
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
index 7615ccde38..bf92ac17f0 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
@@ -48,8 +48,8 @@ using namespace Internal;
// -----------------------
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor,
TextEditor::AssistReason reason)
- : DefaultAssistInterface(editor->document(), editor->position(),
- editor->textDocument()->filePath(), reason)
+ : AssistInterface(editor->document(), editor->position(),
+ editor->textDocument()->filePath(), reason)
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
{}
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.h b/src/plugins/qmljseditor/qmljsquickfixassist.h
index 672dd31474..60965b5168 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.h
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.h
@@ -34,7 +34,7 @@
#include <qmljstools/qmljsrefactoringchanges.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/quickfixassistprovider.h>
#include <texteditor/codeassist/quickfixassistprocessor.h>
@@ -43,7 +43,7 @@
namespace QmlJSEditor {
namespace Internal {
-class QmlJSQuickFixAssistInterface : public TextEditor::DefaultAssistInterface
+class QmlJSQuickFixAssistInterface : public TextEditor::AssistInterface
{
public:
QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor, TextEditor::AssistReason reason);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index c79c9f8f51..621cd81876 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -51,7 +51,7 @@
#include "basetexteditor.h"
#include <texteditor/codeassist/codeassistant.h>
-#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/generichighlighter/context.h>
#include <texteditor/generichighlighter/highlightdefinition.h>
#include <texteditor/generichighlighter/highlighter.h>
@@ -7014,11 +7014,11 @@ void BaseTextEditorWidget::invokeAssist(AssistKind kind, IAssistProvider *provid
setOverwriteMode(previousMode);
}
-IAssistInterface *BaseTextEditorWidget::createAssistInterface(AssistKind kind,
- AssistReason reason) const
+AssistInterface *BaseTextEditorWidget::createAssistInterface(AssistKind kind,
+ AssistReason reason) const
{
Q_UNUSED(kind);
- return new DefaultAssistInterface(document(), position(), d->m_document->filePath(), reason);
+ return new AssistInterface(document(), position(), d->m_document->filePath(), reason);
}
QString BaseTextEditorWidget::foldReplacementText(const QTextBlock &) const
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 76a3684921..91b7c140ec 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -65,7 +65,7 @@ class TabSettings;
class RefactorOverlay;
struct RefactorMarker;
class IAssistMonitorInterface;
-class IAssistInterface;
+class AssistInterface;
class IAssistProvider;
class ICodeStylePreferences;
class CompletionAssistProvider;
@@ -315,7 +315,7 @@ public:
void invokeAssist(AssistKind assistKind, IAssistProvider *provider = 0);
- virtual IAssistInterface *createAssistInterface(AssistKind assistKind,
+ virtual TextEditor::AssistInterface *createAssistInterface(AssistKind assistKind,
AssistReason assistReason) const;
static QMimeData *duplicateMimeData(const QMimeData *source);
diff --git a/src/plugins/texteditor/circularclipboardassist.cpp b/src/plugins/texteditor/circularclipboardassist.cpp
index e5601a5c67..5262bfbb78 100644
--- a/src/plugins/texteditor/circularclipboardassist.cpp
+++ b/src/plugins/texteditor/circularclipboardassist.cpp
@@ -28,11 +28,11 @@
****************************************************************************/
#include "circularclipboardassist.h"
-#include "codeassist/iassistinterface.h"
+#include "codeassist/assistinterface.h"
#include "codeassist/iassistprocessor.h"
#include "codeassist/iassistproposal.h"
-#include "codeassist/basicproposalitem.h"
-#include "codeassist/basicproposalitemlistmodel.h"
+#include "codeassist/assistproposalitem.h"
+#include "codeassist/genericproposalmodel.h"
#include "codeassist/genericproposal.h"
#include "basetexteditor.h"
#include "circularclipboard.h"
@@ -44,17 +44,16 @@
#include <QApplication>
#include <QClipboard>
-using namespace TextEditor;
-using namespace TextEditor::Internal;
-
namespace TextEditor {
namespace Internal {
-class ClipboardProposalItem: public BasicProposalItem {
+class ClipboardProposalItem: public AssistProposalItem
+{
public:
enum { maxLen = 80 };
- ClipboardProposalItem(QSharedPointer<const QMimeData> mimeData): m_mimeData(mimeData)
+ ClipboardProposalItem(QSharedPointer<const QMimeData> mimeData)
+ : m_mimeData(mimeData)
{
QString text = mimeData->text().simplified();
if (text.length() > maxLen) {
@@ -88,32 +87,29 @@ private:
class ClipboardAssistProcessor: public IAssistProcessor
{
public:
- IAssistProposal *perform(const IAssistInterface *interface) QTC_OVERRIDE
+ IAssistProposal *perform(const AssistInterface *interface) QTC_OVERRIDE
{
if (!interface)
return 0;
- QScopedPointer<const IAssistInterface> assistInterface(interface);
+ QScopedPointer<const AssistInterface> assistInterface(interface);
QIcon icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Core::Constants::ICON_PASTE))).pixmap(16);
CircularClipboard * clipboard = CircularClipboard::instance();
- QList<BasicProposalItem *> items;
+ QList<AssistProposalItem *> items;
for (int i = 0; i < clipboard->size(); ++i) {
QSharedPointer<const QMimeData> data = clipboard->next();
- BasicProposalItem *item = new ClipboardProposalItem(data);
+ AssistProposalItem *item = new ClipboardProposalItem(data);
item->setIcon(icon);
item->setOrder(clipboard->size() - 1 - i);
items.append(item);
}
- return new GenericProposal(interface->position(), new BasicProposalItemListModel(items));
+ return new GenericProposal(interface->position(), new GenericProposalModel(items));
}
};
-} // namespace Internal
-} // namespace TextEditor
-
bool ClipboardAssistProvider::isAsynchronous() const
{
return false;
@@ -128,3 +124,6 @@ IAssistProcessor *ClipboardAssistProvider::createProcessor() const
{
return new ClipboardAssistProcessor;
}
+
+} // namespace Internal
+} // namespace TextEditor
diff --git a/src/plugins/texteditor/codeassist/iassistinterface.cpp b/src/plugins/texteditor/codeassist/assistinterface.cpp
index e92a31d217..9f0d756a3d 100644
--- a/src/plugins/texteditor/codeassist/iassistinterface.cpp
+++ b/src/plugins/texteditor/codeassist/assistinterface.cpp
@@ -27,13 +27,13 @@
**
****************************************************************************/
-#include "iassistinterface.h"
+#include "assistinterface.h"
using namespace TextEditor;
/*!
- \class TextEditor::IAssistInterface
- \brief The IAssistInterface class acts as an interface for providing access
+ \class TextEditor::AssistInterface
+ \brief The AssistInterface class acts as an interface for providing access
to the document from which a proposal is computed.
\ingroup CodeAssist
@@ -50,43 +50,37 @@ using namespace TextEditor;
\sa IAssistProposal, IAssistProvider, IAssistProcessor
*/
-IAssistInterface::IAssistInterface()
-{}
-
-IAssistInterface::~IAssistInterface()
-{}
-
/*!
- \fn int TextEditor::IAssistInterface::position() const
+ \fn int TextEditor::AssistInterface::position() const
Returns the cursor position.
*/
/*!
- \fn QChar TextEditor::IAssistInterface::characterAt(int position) const
+ \fn QChar TextEditor::AssistInterface::characterAt(int position) const
Returns the character at \a position.
*/
/*!
- \fn QString TextEditor::IAssistInterface::textAt(int position, int length) const
+ \fn QString TextEditor::AssistInterface::textAt(int position, int length) const
Returns the text at \a position with the given \a length.
*/
/*!
- \fn QString TextEditor::IAssistInterface::fileName() const
+ \fn QString TextEditor::AssistInterface::fileName() const
Returns the file associated.
*/
/*!
- \fn QTextDocument *TextEditor::IAssistInterface::textDocument() const
+ \fn QTextDocument *TextEditor::AssistInterface::textDocument() const
Returns the document.
*/
/*!
- \fn void TextEditor::IAssistInterface::detach(QThread *destination)
+ \fn void TextEditor::AssistInterface::detach(QThread *destination)
Detaches the interface. If it is necessary to take any special care in order to allow
this interface to be run in a separate thread \a destination this needs to be done
@@ -94,7 +88,63 @@ IAssistInterface::~IAssistInterface()
*/
/*!
- \fn AssistReason TextEditor::IAssistInterface::reason() const
+ \fn AssistReason TextEditor::AssistInterface::reason() const
The reason which triggered the assist.
*/
+
+#include "assistinterface.h"
+
+#include <texteditor/convenience.h>
+
+#include <QTextDocument>
+#include <QTextCursor>
+
+namespace TextEditor {
+
+AssistInterface::AssistInterface(QTextDocument *textDocument,
+ int position,
+ const QString &fileName,
+ AssistReason reason)
+ : m_textDocument(textDocument)
+ , m_isAsync(false)
+ , m_position(position)
+ , m_fileName(fileName)
+ , m_reason(reason)
+{}
+
+AssistInterface::~AssistInterface()
+{
+ if (m_isAsync)
+ delete m_textDocument;
+}
+
+QChar AssistInterface::characterAt(int position) const
+{
+ return m_textDocument->characterAt(position);
+}
+
+QString AssistInterface::textAt(int pos, int length) const
+{
+ return Convenience::textAt(QTextCursor(m_textDocument), pos, length);
+}
+
+void AssistInterface::prepareForAsyncUse()
+{
+ m_text = m_textDocument->toPlainText();
+ m_textDocument = 0;
+ m_isAsync = true;
+}
+
+void AssistInterface::recreateTextDocument()
+{
+ m_textDocument = new QTextDocument(m_text);
+ m_text.clear();
+}
+
+AssistReason AssistInterface::reason() const
+{
+ return m_reason;
+}
+
+} // namespace TextEditor
diff --git a/src/plugins/texteditor/codeassist/iassistinterface.h b/src/plugins/texteditor/codeassist/assistinterface.h
index 7debebe4bf..cdc200925e 100644
--- a/src/plugins/texteditor/codeassist/iassistinterface.h
+++ b/src/plugins/texteditor/codeassist/assistinterface.h
@@ -34,33 +34,43 @@
#include <texteditor/texteditor_global.h>
+#include <utils/qtcoverride.h>
+
#include <QString>
QT_BEGIN_NAMESPACE
class QTextDocument;
-class QThread;
QT_END_NAMESPACE
-namespace Core { class IDocument; }
-
namespace TextEditor {
-class TEXTEDITOR_EXPORT IAssistInterface
+class TEXTEDITOR_EXPORT AssistInterface
{
public:
- IAssistInterface();
- virtual ~IAssistInterface();
+ AssistInterface(QTextDocument *textDocument,
+ int position,
+ const QString &fileName,
+ AssistReason reason);
+ virtual ~AssistInterface();
+
+ virtual int position() const { return m_position; }
+ virtual QChar characterAt(int position) const;
+ virtual QString textAt(int position, int length) const;
+ virtual QString fileName() const { return m_fileName; }
+ virtual QTextDocument *textDocument() const { return m_textDocument; }
+ virtual void prepareForAsyncUse();
+ virtual void recreateTextDocument();
+ virtual AssistReason reason() const;
- virtual int position() const = 0;
- virtual QChar characterAt(int position) const = 0;
- virtual QString textAt(int position, int length) const = 0;
- virtual QString fileName() const = 0;
- virtual QTextDocument *textDocument() const = 0;
- virtual void prepareForAsyncUse() = 0;
- virtual void recreateTextDocument() = 0;
- virtual AssistReason reason() const = 0;
+private:
+ QTextDocument *m_textDocument;
+ bool m_isAsync;
+ int m_position;
+ QString m_fileName;
+ AssistReason m_reason;
+ QString m_text;
};
-} // TextEditor
+} // namespace TextEditor
#endif // IASSISTINTERFACE_H
diff --git a/src/plugins/texteditor/codeassist/basicproposalitem.cpp b/src/plugins/texteditor/codeassist/assistproposalitem.cpp
index e101e98e79..5477d73a58 100644
--- a/src/plugins/texteditor/codeassist/basicproposalitem.cpp
+++ b/src/plugins/texteditor/codeassist/assistproposalitem.cpp
@@ -27,84 +27,112 @@
**
****************************************************************************/
-#include "basicproposalitem.h"
+#include "assistproposalitem.h"
#include <texteditor/basetexteditor.h>
#include <texteditor/quickfix.h>
#include <QTextCursor>
-using namespace TextEditor;
+namespace TextEditor {
-BasicProposalItem::BasicProposalItem()
+/*!
+ \class TextEditor::AssistProposalItem
+ \brief The AssistProposalItem class acts as an interface for representing an assist
+ proposal item.
+ \ingroup CodeAssist
+
+ This is class is part of the CodeAssist API.
+*/
+
+/*!
+ \fn bool TextEditor::AssistProposalItem::implicitlyApplies() const
+
+ Returns whether this item should implicitly apply in the case it is the only proposal
+ item available.
+*/
+
+/*!
+ \fn bool TextEditor::AssistProposalItem::prematurelyApplies(const QChar &c) const
+
+ Returns whether the character \a c causes this item to be applied.
+*/
+
+/*!
+ \fn void TextEditor::AssistProposalItem::apply(BaseTextEditor *editor, int basePosition) const
+
+ This is the place to implement the actual application of the item.
+*/
+
+AssistProposalItem::AssistProposalItem()
: m_order(0)
{}
-BasicProposalItem::~BasicProposalItem()
+AssistProposalItem::~AssistProposalItem()
{}
-void BasicProposalItem::setIcon(const QIcon &icon)
+void AssistProposalItem::setIcon(const QIcon &icon)
{
m_icon = icon;
}
-const QIcon &BasicProposalItem::icon() const
+const QIcon &AssistProposalItem::icon() const
{
return m_icon;
}
-void BasicProposalItem::setText(const QString &text)
+void AssistProposalItem::setText(const QString &text)
{
m_text = text;
}
-QString BasicProposalItem::text() const
+QString AssistProposalItem::text() const
{
return m_text;
}
-void BasicProposalItem::setDetail(const QString &detail)
+void AssistProposalItem::setDetail(const QString &detail)
{
m_detail = detail;
}
-const QString &BasicProposalItem::detail() const
+const QString &AssistProposalItem::detail() const
{
return m_detail;
}
-void BasicProposalItem::setData(const QVariant &var)
+void AssistProposalItem::setData(const QVariant &var)
{
m_data = var;
}
-const QVariant &BasicProposalItem::data() const
+const QVariant &AssistProposalItem::data() const
{
return m_data;
}
-int BasicProposalItem::order() const
+int AssistProposalItem::order() const
{
return m_order;
}
-void BasicProposalItem::setOrder(int order)
+void AssistProposalItem::setOrder(int order)
{
m_order = order;
}
-bool BasicProposalItem::implicitlyApplies() const
+bool AssistProposalItem::implicitlyApplies() const
{
return !data().canConvert<QString>() && !data().canConvert<QuickFixOperation::Ptr>();
}
-bool BasicProposalItem::prematurelyApplies(const QChar &c) const
+bool AssistProposalItem::prematurelyApplies(const QChar &c) const
{
Q_UNUSED(c);
return false;
}
-void BasicProposalItem::apply(BaseTextEditorWidget *editorWidget, int basePosition) const
+void AssistProposalItem::apply(BaseTextEditorWidget *editorWidget, int basePosition) const
{
if (data().canConvert<QString>())
applySnippet(editorWidget, basePosition);
@@ -114,21 +142,21 @@ void BasicProposalItem::apply(BaseTextEditorWidget *editorWidget, int basePositi
applyContextualContent(editorWidget, basePosition);
}
-void BasicProposalItem::applyContextualContent(BaseTextEditorWidget *editorWidget, int basePosition) const
+void AssistProposalItem::applyContextualContent(BaseTextEditorWidget *editorWidget, int basePosition) const
{
const int currentPosition = editorWidget->position();
editorWidget->setCursorPosition(basePosition);
editorWidget->replace(currentPosition - basePosition, text());
}
-void BasicProposalItem::applySnippet(BaseTextEditorWidget *editorWidget, int basePosition) const
+void AssistProposalItem::applySnippet(BaseTextEditorWidget *editorWidget, int basePosition) const
{
QTextCursor tc = editorWidget->textCursor();
tc.setPosition(basePosition, QTextCursor::KeepAnchor);
editorWidget->insertCodeSnippet(tc, data().toString());
}
-void BasicProposalItem::applyQuickFix(BaseTextEditorWidget *editorWidget, int basePosition) const
+void AssistProposalItem::applyQuickFix(BaseTextEditorWidget *editorWidget, int basePosition) const
{
Q_UNUSED(editorWidget)
Q_UNUSED(basePosition)
@@ -136,3 +164,5 @@ void BasicProposalItem::applyQuickFix(BaseTextEditorWidget *editorWidget, int ba
QuickFixOperation::Ptr op = data().value<QuickFixOperation::Ptr>();
op->perform();
}
+
+} // namespace TextEditor
diff --git a/src/plugins/texteditor/codeassist/basicproposalitem.h b/src/plugins/texteditor/codeassist/assistproposalitem.h
index de025f1050..2de055157b 100644
--- a/src/plugins/texteditor/codeassist/basicproposalitem.h
+++ b/src/plugins/texteditor/codeassist/assistproposalitem.h
@@ -27,31 +27,36 @@
**
****************************************************************************/
-#ifndef BASICPROPOSALITEM_H
-#define BASICPROPOSALITEM_H
-
-#include "iassistproposalitem.h"
+#ifndef IASSISTPROPOSALITEM_H
+#define IASSISTPROPOSALITEM_H
#include <texteditor/texteditor_global.h>
#include <utils/qtcoverride.h>
-#include <QVariant>
#include <QIcon>
+#include <QString>
+#include <QVariant>
namespace TextEditor {
-class TEXTEDITOR_EXPORT BasicProposalItem : public IAssistProposalItem
+class BaseTextEditorWidget;
+
+class TEXTEDITOR_EXPORT AssistProposalItem
{
public:
- BasicProposalItem();
- ~BasicProposalItem();
+ AssistProposalItem();
+ virtual ~AssistProposalItem();
+
+ virtual QString text() const;
+ virtual bool implicitlyApplies() const;
+ virtual bool prematurelyApplies(const QChar &c) const;
+ virtual void apply(BaseTextEditorWidget *editorWidget, int basePosition) const;
void setIcon(const QIcon &icon);
const QIcon &icon() const;
void setText(const QString &text);
- QString text() const QTC_OVERRIDE;
void setDetail(const QString &detail);
const QString &detail() const;
@@ -62,9 +67,6 @@ public:
int order() const;
void setOrder(int order);
- bool implicitlyApplies() const QTC_OVERRIDE;
- bool prematurelyApplies(const QChar &c) const QTC_OVERRIDE;
- void apply(BaseTextEditorWidget *editorWidget, int basePosition) const QTC_OVERRIDE;
virtual void applyContextualContent(BaseTextEditorWidget *editorWidget, int basePosition) const;
virtual void applySnippet(BaseTextEditorWidget *editorWidget, int basePosition) const;
virtual void applyQuickFix(BaseTextEditorWidget *editorWidget, int basePosition) const;
@@ -77,6 +79,6 @@ private:
int m_order;
};
-} // TextEditor
+} // namespace TextEditor
#endif // BASICPROPOSALITEM_H
diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp
index 61a2a2ad5c..f2bed24fec 100644
--- a/src/plugins/texteditor/codeassist/codeassistant.cpp
+++ b/src/plugins/texteditor/codeassist/codeassistant.cpp
@@ -33,8 +33,8 @@
#include "iassistprocessor.h"
#include "iassistproposal.h"
#include "iassistproposalwidget.h"
-#include "iassistinterface.h"
-#include "iassistproposalitem.h"
+#include "assistinterface.h"
+#include "assistproposalitem.h"
#include "runner.h"
#include <texteditor/basetexteditor.h>
@@ -109,7 +109,7 @@ signals:
private slots:
void finalizeRequest();
void proposalComputed();
- void processProposalItem(IAssistProposalItem *proposalItem);
+ void processProposalItem(AssistProposalItem *proposalItem);
void handlePrefixExpansion(const QString &newPrefix);
void finalizeProposal();
void automaticProposalTimeout();
@@ -263,7 +263,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
m_assistKind = kind;
IAssistProcessor *processor = provider->createProcessor();
- IAssistInterface *assistInterface = m_editorWidget->createAssistInterface(kind, reason);
+ AssistInterface *assistInterface = m_editorWidget->createAssistInterface(kind, reason);
if (!assistInterface)
return;
@@ -340,8 +340,8 @@ void CodeAssistantPrivate::displayProposal(IAssistProposal *newProposal, AssistR
connect(m_proposalWidget, SIGNAL(destroyed()), this, SLOT(finalizeProposal()));
connect(m_proposalWidget, SIGNAL(prefixExpanded(QString)),
this, SLOT(handlePrefixExpansion(QString)));
- connect(m_proposalWidget, SIGNAL(proposalItemActivated(IAssistProposalItem*)),
- this, SLOT(processProposalItem(IAssistProposalItem*)));
+ connect(m_proposalWidget, SIGNAL(proposalItemActivated(AssistProposalItem*)),
+ this, SLOT(processProposalItem(AssistProposalItem*)));
connect(m_proposalWidget, SIGNAL(explicitlyAborted()),
this, SLOT(explicitlyAborted()));
m_proposalWidget->setAssistant(m_q);
@@ -359,7 +359,7 @@ void CodeAssistantPrivate::displayProposal(IAssistProposal *newProposal, AssistR
m_editorWidget->position() - basePosition));
}
-void CodeAssistantPrivate::processProposalItem(IAssistProposalItem *proposalItem)
+void CodeAssistantPrivate::processProposalItem(AssistProposalItem *proposalItem)
{
QTC_ASSERT(m_proposal, return);
proposalItem->apply(m_editorWidget, m_proposal->basePosition());
diff --git a/src/plugins/texteditor/codeassist/defaultassistinterface.cpp b/src/plugins/texteditor/codeassist/defaultassistinterface.cpp
deleted file mode 100644
index 847f995821..0000000000
--- a/src/plugins/texteditor/codeassist/defaultassistinterface.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "defaultassistinterface.h"
-
-#include <texteditor/convenience.h>
-
-#include <QTextDocument>
-#include <QTextCursor>
-
-using namespace TextEditor;
-
-DefaultAssistInterface::DefaultAssistInterface(QTextDocument *textDocument,
- int position,
- const QString &fileName,
- AssistReason reason)
- : m_textDocument(textDocument)
- , m_isAsync(false)
- , m_position(position)
- , m_fileName(fileName)
- , m_reason(reason)
-{}
-
-DefaultAssistInterface::~DefaultAssistInterface()
-{
- if (m_isAsync)
- delete m_textDocument;
-}
-
-QChar DefaultAssistInterface::characterAt(int position) const
-{
- return m_textDocument->characterAt(position);
-}
-
-QString DefaultAssistInterface::textAt(int pos, int length) const
-{
- return Convenience::textAt(QTextCursor(m_textDocument), pos, length);
-}
-
-void DefaultAssistInterface::prepareForAsyncUse()
-{
- m_text = m_textDocument->toPlainText();
- m_textDocument = 0;
- m_isAsync = true;
-}
-
-void DefaultAssistInterface::recreateTextDocument()
-{
- m_textDocument = new QTextDocument(m_text);
- m_text.clear();
-}
-
-AssistReason DefaultAssistInterface::reason() const
-{
- return m_reason;
-}
diff --git a/src/plugins/texteditor/codeassist/defaultassistinterface.h b/src/plugins/texteditor/codeassist/defaultassistinterface.h
deleted file mode 100644
index 693730ce0d..0000000000
--- a/src/plugins/texteditor/codeassist/defaultassistinterface.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef DEFAULTASSISTINTERFACE_H
-#define DEFAULTASSISTINTERFACE_H
-
-#include "iassistinterface.h"
-
-#include <utils/qtcoverride.h>
-
-namespace TextEditor {
-
-class TEXTEDITOR_EXPORT DefaultAssistInterface : public IAssistInterface
-{
-public:
- DefaultAssistInterface(QTextDocument *textDocument,
- int position,
- const QString &fileName,
- AssistReason reason);
- ~DefaultAssistInterface();
-
- int position() const QTC_OVERRIDE { return m_position; }
- QChar characterAt(int position) const QTC_OVERRIDE;
- QString textAt(int position, int length) const QTC_OVERRIDE;
- QString fileName() const QTC_OVERRIDE { return m_fileName; }
- QTextDocument *textDocument() const QTC_OVERRIDE { return m_textDocument; }
- void prepareForAsyncUse() QTC_OVERRIDE;
- void recreateTextDocument() QTC_OVERRIDE;
- AssistReason reason() const QTC_OVERRIDE;
-
-private:
- QTextDocument *m_textDocument;
- bool m_isAsync;
- int m_position;
- QString m_fileName;
- AssistReason m_reason;
- QString m_text;
-};
-
-} // TextEditor
-
-#endif // DEFAULTASSISTINTERFACE_H
diff --git a/src/plugins/texteditor/codeassist/genericproposal.cpp b/src/plugins/texteditor/codeassist/genericproposal.cpp
index 630aca5fff..430ef624a0 100644
--- a/src/plugins/texteditor/codeassist/genericproposal.cpp
+++ b/src/plugins/texteditor/codeassist/genericproposal.cpp
@@ -28,12 +28,12 @@
****************************************************************************/
#include "genericproposal.h"
-#include "igenericproposalmodel.h"
+#include "genericproposalmodel.h"
#include "genericproposalwidget.h"
-using namespace TextEditor;
+namespace TextEditor {
-GenericProposal::GenericProposal(int cursorPos, IGenericProposalModel *model)
+GenericProposal::GenericProposal(int cursorPos, GenericProposalModel *model)
: m_basePosition(cursorPos)
, m_model(model)
{}
@@ -73,3 +73,5 @@ void GenericProposal::moveBasePosition(int length)
{
m_basePosition += length;
}
+
+} // namespace TextEditor
diff --git a/src/plugins/texteditor/codeassist/genericproposal.h b/src/plugins/texteditor/codeassist/genericproposal.h
index 267ba3487a..9d33c3d5ec 100644
--- a/src/plugins/texteditor/codeassist/genericproposal.h
+++ b/src/plugins/texteditor/codeassist/genericproposal.h
@@ -36,12 +36,12 @@
namespace TextEditor {
-class IGenericProposalModel;
+class GenericProposalModel;
class TEXTEDITOR_EXPORT GenericProposal : public IAssistProposal
{
public:
- GenericProposal(int cursorPos, IGenericProposalModel *model);
+ GenericProposal(int cursorPos, GenericProposalModel *model);
~GenericProposal();
bool isFragile() const QTC_OVERRIDE;
@@ -56,7 +56,7 @@ protected:
private:
int m_basePosition;
- IGenericProposalModel *m_model;
+ GenericProposalModel *m_model;
};
} // TextEditor
diff --git a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp b/src/plugins/texteditor/codeassist/genericproposalmodel.cpp
index fa029f8df2..58e884e0f9 100644
--- a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp
+++ b/src/plugins/texteditor/codeassist/genericproposalmodel.cpp
@@ -27,8 +27,9 @@
**
****************************************************************************/
-#include "basicproposalitemlistmodel.h"
-#include "basicproposalitem.h"
+#include "genericproposalmodel.h"
+
+#include "assistproposalitem.h"
#include <texteditor/texteditorsettings.h>
#include <texteditor/completionsettings.h>
@@ -41,7 +42,7 @@
using namespace TextEditor;
-uint qHash(const BasicProposalItem &item)
+uint qHash(const AssistProposalItem &item)
{
return qHash(item.text());
}
@@ -57,7 +58,7 @@ struct ContentLessThan
: m_prefix(prefix)
{}
- bool operator()(const BasicProposalItem *a, const BasicProposalItem *b)
+ bool operator()(const AssistProposalItem *a, const AssistProposalItem *b)
{
// The order is case-insensitive in principle, but case-sensitive when this
// would otherwise mean equality
@@ -132,65 +133,65 @@ private:
} // Anonymous
-BasicProposalItemListModel::BasicProposalItemListModel()
+GenericProposalModel::GenericProposalModel()
{}
-BasicProposalItemListModel::BasicProposalItemListModel(const QList<BasicProposalItem *> &items)
+GenericProposalModel::GenericProposalModel(const QList<AssistProposalItem *> &items)
: m_currentItems(items)
, m_originalItems(items)
{
mapPersistentIds();
}
-BasicProposalItemListModel::~BasicProposalItemListModel()
+GenericProposalModel::~GenericProposalModel()
{
qDeleteAll(m_originalItems);
}
-void BasicProposalItemListModel::loadContent(const QList<BasicProposalItem *> &items)
+void GenericProposalModel::loadContent(const QList<AssistProposalItem *> &items)
{
m_originalItems = items;
m_currentItems = items;
mapPersistentIds();
}
-void BasicProposalItemListModel::mapPersistentIds()
+void GenericProposalModel::mapPersistentIds()
{
for (int i = 0; i < m_originalItems.size(); ++i)
m_idByText.insert(m_originalItems.at(i)->text(), i);
}
-void BasicProposalItemListModel::reset()
+void GenericProposalModel::reset()
{
m_currentItems = m_originalItems;
}
-int BasicProposalItemListModel::size() const
+int GenericProposalModel::size() const
{
return m_currentItems.size();
}
-QString BasicProposalItemListModel::text(int index) const
+QString GenericProposalModel::text(int index) const
{
return m_currentItems.at(index)->text();
}
-QIcon BasicProposalItemListModel::icon(int index) const
+QIcon GenericProposalModel::icon(int index) const
{
return m_currentItems.at(index)->icon();
}
-QString BasicProposalItemListModel::detail(int index) const
+QString GenericProposalModel::detail(int index) const
{
return m_currentItems.at(index)->detail();
}
-void BasicProposalItemListModel::removeDuplicates()
+void GenericProposalModel::removeDuplicates()
{
QHash<QString, QVariant> unique;
- QList<BasicProposalItem *>::iterator it = m_originalItems.begin();
+ QList<AssistProposalItem *>::iterator it = m_originalItems.begin();
while (it != m_originalItems.end()) {
- const BasicProposalItem *item = *it;
+ const AssistProposalItem *item = *it;
if (unique.contains(item->text())
&& unique.value(item->text(), QVariant()) == item->data()) {
it = m_originalItems.erase(it);
@@ -201,7 +202,7 @@ void BasicProposalItemListModel::removeDuplicates()
}
}
-void BasicProposalItemListModel::filter(const QString &prefix)
+void GenericProposalModel::filter(const QString &prefix)
{
if (prefix.isEmpty())
return;
@@ -260,16 +261,14 @@ void BasicProposalItemListModel::filter(const QString &prefix)
QRegExp regExp(keyRegExp);
m_currentItems.clear();
- for (QList<BasicProposalItem *>::const_iterator it = m_originalItems.begin();
- it != m_originalItems.end();
- ++it) {
- BasicProposalItem *item = *it;
+ for (auto it = m_originalItems.begin(); it != m_originalItems.end(); ++it) {
+ AssistProposalItem *item = *it;
if (regExp.indexIn(item->text()) == 0)
m_currentItems.append(item);
}
}
-bool BasicProposalItemListModel::isSortable(const QString &prefix) const
+bool GenericProposalModel::isSortable(const QString &prefix) const
{
Q_UNUSED(prefix);
@@ -278,27 +277,27 @@ bool BasicProposalItemListModel::isSortable(const QString &prefix) const
return false;
}
-void BasicProposalItemListModel::sort(const QString &prefix)
+void GenericProposalModel::sort(const QString &prefix)
{
std::stable_sort(m_currentItems.begin(), m_currentItems.end(), ContentLessThan(prefix));
}
-int BasicProposalItemListModel::persistentId(int index) const
+int GenericProposalModel::persistentId(int index) const
{
return m_idByText.value(m_currentItems.at(index)->text());
}
-bool BasicProposalItemListModel::supportsPrefixExpansion() const
+bool GenericProposalModel::supportsPrefixExpansion() const
{
return true;
}
-bool BasicProposalItemListModel::keepPerfectMatch(AssistReason reason) const
+bool GenericProposalModel::keepPerfectMatch(AssistReason reason) const
{
return reason != IdleEditor;
}
-QString BasicProposalItemListModel::proposalPrefix() const
+QString GenericProposalModel::proposalPrefix() const
{
if (m_currentItems.size() >= kMaxPrefixFilter || m_currentItems.isEmpty())
return QString();
@@ -323,14 +322,14 @@ QString BasicProposalItemListModel::proposalPrefix() const
return commonPrefix;
}
-IAssistProposalItem *BasicProposalItemListModel::proposalItem(int index) const
+AssistProposalItem *GenericProposalModel::proposalItem(int index) const
{
return m_currentItems.at(index);
}
-QPair<QList<BasicProposalItem *>::iterator,
- QList<BasicProposalItem *>::iterator>
-BasicProposalItemListModel::currentItems()
+QPair<QList<AssistProposalItem *>::iterator,
+ QList<AssistProposalItem *>::iterator>
+GenericProposalModel::currentItems()
{
return qMakePair(m_currentItems.begin(), m_currentItems.end());
}
diff --git a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h b/src/plugins/texteditor/codeassist/genericproposalmodel.h
index b3ba21a151..564c0c55b4 100644
--- a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h
+++ b/src/plugins/texteditor/codeassist/genericproposalmodel.h
@@ -27,61 +27,63 @@
**
****************************************************************************/
-#ifndef BASICPROPOSALITEMLISTMODEL_H
-#define BASICPROPOSALITEMLISTMODEL_H
+#ifndef IGENERICPROPOSALMODEL_H
+#define IGENERICPROPOSALMODEL_H
-#include "igenericproposalmodel.h"
+#include "iassistproposalmodel.h"
+#include "assistenums.h"
#include <texteditor/texteditor_global.h>
#include <utils/qtcoverride.h>
-#include <QList>
#include <QHash>
+#include <QIcon>
+#include <QList>
#include <QPair>
namespace TextEditor {
-class BasicProposalItem;
+class AssistProposalItem;
-class TEXTEDITOR_EXPORT BasicProposalItemListModel : public IGenericProposalModel
+class TEXTEDITOR_EXPORT GenericProposalModel : public IAssistProposalModel
{
public:
- BasicProposalItemListModel();
- BasicProposalItemListModel(const QList<BasicProposalItem *> &items);
- ~BasicProposalItemListModel();
+ GenericProposalModel();
+ GenericProposalModel(const QList<AssistProposalItem *> &items);
+ ~GenericProposalModel();
void reset() QTC_OVERRIDE;
int size() const QTC_OVERRIDE;
QString text(int index) const QTC_OVERRIDE;
- QIcon icon(int index) const QTC_OVERRIDE;
- QString detail(int index) const QTC_OVERRIDE;
- int persistentId(int index) const QTC_OVERRIDE;
- void removeDuplicates() QTC_OVERRIDE;
- void filter(const QString &prefix) QTC_OVERRIDE;
- bool isSortable(const QString &prefix) const QTC_OVERRIDE;
- void sort(const QString &prefix) QTC_OVERRIDE;
- bool supportsPrefixExpansion() const QTC_OVERRIDE;
- QString proposalPrefix() const QTC_OVERRIDE;
- bool keepPerfectMatch(AssistReason reason) const QTC_OVERRIDE;
- IAssistProposalItem *proposalItem(int index) const QTC_OVERRIDE;
- void loadContent(const QList<BasicProposalItem *> &items);
+ virtual QIcon icon(int index) const;
+ virtual QString detail(int index) const;
+ virtual int persistentId(int index) const;
+ virtual void removeDuplicates();
+ virtual void filter(const QString &prefix);
+ virtual bool isSortable(const QString &prefix) const;
+ virtual void sort(const QString &prefix);
+ virtual bool supportsPrefixExpansion() const;
+ virtual QString proposalPrefix() const;
+ virtual bool keepPerfectMatch(AssistReason reason) const;
+ virtual AssistProposalItem *proposalItem(int index) const;
+
+ void loadContent(const QList<AssistProposalItem *> &items);
void setSortingAllowed(bool isAllowed);
bool isSortingAllowed() const;
protected:
- typedef QList<BasicProposalItem *>::iterator ItemIterator;
+ typedef QList<AssistProposalItem *>::iterator ItemIterator;
QPair<ItemIterator, ItemIterator> currentItems();
- QList<BasicProposalItem *> m_currentItems;
+ QList<AssistProposalItem *> m_currentItems;
private:
void mapPersistentIds();
QHash<QString, int> m_idByText;
- QList<BasicProposalItem *> m_originalItems;
+ QList<AssistProposalItem *> m_originalItems;
};
-
} // TextEditor
-#endif // BASICPROPOSALITEMLISTMODEL_H
+#endif // IGENERICPROPOSALMODEL_H
diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
index 677e3928c7..a174344321 100644
--- a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
+++ b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
@@ -28,8 +28,8 @@
****************************************************************************/
#include "genericproposalwidget.h"
-#include "igenericproposalmodel.h"
-#include "iassistproposalitem.h"
+#include "genericproposalmodel.h"
+#include "assistproposalitem.h"
#include "codeassistant.h"
#include <texteditor/texteditorsettings.h>
@@ -58,9 +58,7 @@ using namespace Utils;
namespace TextEditor {
-namespace {
-
-QString cleanText(const QString &original)
+static QString cleanText(const QString &original)
{
QString clean = original;
int ignore = 0;
@@ -76,7 +74,7 @@ QString cleanText(const QString &original)
return clean;
}
-bool isPerfectMatch(const QString &prefix, const IGenericProposalModel *model)
+static bool isPerfectMatch(const QString &prefix, const GenericProposalModel *model)
{
if (prefix.isEmpty())
return false;
@@ -101,8 +99,6 @@ bool isPerfectMatch(const QString &prefix, const IGenericProposalModel *model)
return false;
}
-}
-
// ------------
// ModelAdapter
// ------------
@@ -111,16 +107,16 @@ class ModelAdapter : public QAbstractListModel
Q_OBJECT
public:
- ModelAdapter(IGenericProposalModel *completionModel, QWidget *parent);
+ ModelAdapter(GenericProposalModel *completionModel, QWidget *parent);
virtual int rowCount(const QModelIndex &) const;
virtual QVariant data(const QModelIndex &index, int role) const;
private:
- IGenericProposalModel *m_completionModel;
+ GenericProposalModel *m_completionModel;
};
-ModelAdapter::ModelAdapter(IGenericProposalModel *completionModel, QWidget *parent)
+ModelAdapter::ModelAdapter(GenericProposalModel *completionModel, QWidget *parent)
: QAbstractListModel(parent)
, m_completionModel(completionModel)
{}
@@ -256,7 +252,7 @@ public:
const QWidget *m_underlyingWidget;
GenericProposalListView *m_completionListView;
- IGenericProposalModel *m_model;
+ GenericProposalModel *m_model;
QRect m_displayRect;
bool m_isSynchronized;
bool m_explicitlySelected;
@@ -394,7 +390,7 @@ void GenericProposalWidget::setUnderlyingWidget(const QWidget *underlyingWidget)
void GenericProposalWidget::setModel(IAssistProposalModel *model)
{
delete d->m_model;
- d->m_model = static_cast<IGenericProposalModel *>(model);
+ d->m_model = static_cast<GenericProposalModel *>(model);
d->m_completionListView->setModel(new ModelAdapter(d->m_model, d->m_completionListView));
connect(d->m_completionListView->selectionModel(),
@@ -493,7 +489,7 @@ bool GenericProposalWidget::updateAndCheck(const QString &prefix)
&& d->m_justInvoked
&& d->m_isSynchronized) {
if (d->m_model->size() == 1) {
- IAssistProposalItem *item = d->m_model->proposalItem(0);
+ AssistProposalItem *item = d->m_model->proposalItem(0);
if (item->implicitlyApplies()) {
d->m_completionListView->reset();
abort();
@@ -638,7 +634,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
&& d->m_completionListView->currentIndex().isValid()
&& qApp->focusWidget() == o) {
const QChar &typedChar = ke->text().at(0);
- IAssistProposalItem *item =
+ AssistProposalItem *item =
d->m_model->proposalItem(d->m_completionListView->currentIndex().row());
if (item->prematurelyApplies(typedChar)
&& (d->m_reason == ExplicitlyInvoked || item->text().endsWith(typedChar))) {
@@ -667,11 +663,11 @@ bool GenericProposalWidget::activateCurrentProposalItem()
return false;
}
-IGenericProposalModel *GenericProposalWidget::model()
+GenericProposalModel *GenericProposalWidget::model()
{
return d->m_model;
}
-#include "genericproposalwidget.moc"
+} // namespace TextEditor
-} // TextEditor
+#include "genericproposalwidget.moc"
diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.h b/src/plugins/texteditor/codeassist/genericproposalwidget.h
index b206a69b2a..caf0133d55 100644
--- a/src/plugins/texteditor/codeassist/genericproposalwidget.h
+++ b/src/plugins/texteditor/codeassist/genericproposalwidget.h
@@ -39,7 +39,7 @@
namespace TextEditor {
class GenericProposalWidgetPrivate;
-class IGenericProposalModel;
+class GenericProposalModel;
class TEXTEDITOR_EXPORT GenericProposalWidget : public IAssistProposalWidget
{
@@ -75,7 +75,7 @@ private slots:
protected:
bool eventFilter(QObject *o, QEvent *e);
bool activateCurrentProposalItem();
- IGenericProposalModel *model();
+ GenericProposalModel *model();
private:
GenericProposalWidgetPrivate *d;
diff --git a/src/plugins/texteditor/codeassist/iassistprocessor.cpp b/src/plugins/texteditor/codeassist/iassistprocessor.cpp
index c7fe156a1a..987b0100f8 100644
--- a/src/plugins/texteditor/codeassist/iassistprocessor.cpp
+++ b/src/plugins/texteditor/codeassist/iassistprocessor.cpp
@@ -47,7 +47,7 @@ IAssistProcessor::~IAssistProcessor()
{}
/*!
- \fn IAssistProposal *TextEditor::IAssistProcessor::perform(const IAssistInterface *interface)
+ \fn IAssistProposal *TextEditor::IAssistProcessor::perform(const AssistInterface *interface)
Computes a proposal and returns it. Access to the document is made through the \a interface.
If this is an asynchronous processor the \a interface will be detached.
@@ -56,5 +56,5 @@ IAssistProcessor::~IAssistProcessor()
sharing data across asynchronous processors since there might be more than one instance of
them computing a proposal at a particular time.
- \sa IAssistInterface::detach()
+ \sa AssistInterface::detach()
*/
diff --git a/src/plugins/texteditor/codeassist/iassistprocessor.h b/src/plugins/texteditor/codeassist/iassistprocessor.h
index 1149b7ec5c..ff5049a329 100644
--- a/src/plugins/texteditor/codeassist/iassistprocessor.h
+++ b/src/plugins/texteditor/codeassist/iassistprocessor.h
@@ -37,7 +37,7 @@
namespace TextEditor {
class IAssistProvider;
-class IAssistInterface;
+class AssistInterface;
class IAssistProposal;
class TEXTEDITOR_EXPORT IAssistProcessor
@@ -46,8 +46,8 @@ public:
IAssistProcessor();
virtual ~IAssistProcessor();
- virtual IAssistProposal *immediateProposal(const IAssistInterface *) { return 0; }
- virtual IAssistProposal *perform(const IAssistInterface *interface) = 0;
+ virtual IAssistProposal *immediateProposal(const AssistInterface *) { return 0; }
+ virtual IAssistProposal *perform(const AssistInterface *interface) = 0;
};
} // TextEditor
diff --git a/src/plugins/texteditor/codeassist/iassistproposalitem.cpp b/src/plugins/texteditor/codeassist/iassistproposalitem.cpp
deleted file mode 100644
index 0095bb4cb6..0000000000
--- a/src/plugins/texteditor/codeassist/iassistproposalitem.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "iassistproposalitem.h"
-
-using namespace TextEditor;
-
-/*!
- \class TextEditor::IAssistProposalItem
- \brief The IAssistProposalItem class acts as an interface for representing an assist
- proposal item.
- \ingroup CodeAssist
-
- This is class is part of the CodeAssist API.
-*/
-
-IAssistProposalItem::IAssistProposalItem()
-{}
-
-IAssistProposalItem::~IAssistProposalItem()
-{}
-
-/*!
- \fn bool TextEditor::IAssistProposalItem::implicitlyApplies() const
-
- Returns whether this item should implicitly apply in the case it is the only proposal
- item available.
-*/
-
-/*!
- \fn bool TextEditor::IAssistProposalItem::prematurelyApplies(const QChar &c) const
-
- Returns whether the character \a c causes this item to be applied.
-*/
-
-/*!
- \fn void TextEditor::IAssistProposalItem::apply(BaseTextEditor *editor, int basePosition) const
-
- This is the place to implement the actual application of the item.
-*/
diff --git a/src/plugins/texteditor/codeassist/iassistproposalitem.h b/src/plugins/texteditor/codeassist/iassistproposalitem.h
deleted file mode 100644
index 288197c209..0000000000
--- a/src/plugins/texteditor/codeassist/iassistproposalitem.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef IASSISTPROPOSALITEM_H
-#define IASSISTPROPOSALITEM_H
-
-#include <texteditor/texteditor_global.h>
-
-#include <QString>
-
-namespace TextEditor {
-
-class BaseTextEditorWidget;
-
-class TEXTEDITOR_EXPORT IAssistProposalItem
-{
-public:
- IAssistProposalItem();
- virtual ~IAssistProposalItem();
-
- virtual QString text() const = 0;
- virtual bool implicitlyApplies() const = 0;
- virtual bool prematurelyApplies(const QChar &c) const = 0;
- virtual void apply(BaseTextEditorWidget *editorWidget, int basePosition) const = 0;
-};
-
-} // TextEditor
-
-#endif // IASSISTPROPOSALITEM_H
diff --git a/src/plugins/texteditor/codeassist/iassistproposalmodel.cpp b/src/plugins/texteditor/codeassist/iassistproposalmodel.cpp
index 90df390e47..350f4e323b 100644
--- a/src/plugins/texteditor/codeassist/iassistproposalmodel.cpp
+++ b/src/plugins/texteditor/codeassist/iassistproposalmodel.cpp
@@ -36,7 +36,7 @@ using namespace TextEditor;
\brief The IAssistProposalModel class acts as an interface for representing proposals.
\ingroup CodeAssist
- Known implenters of this interface are IFunctionHintProposalModel and IGenericProposalModel.
+ Known implenters of this interface are IFunctionHintProposalModel and GenericProposalModel.
The former is recommeded to be used when assisting function calls constructs (overloads
and parameters) while the latter is quite generic so that it could be used to propose
snippets, refactoring operations (quickfixes), and contextual content (the member of class
diff --git a/src/plugins/texteditor/codeassist/iassistproposalmodel.h b/src/plugins/texteditor/codeassist/iassistproposalmodel.h
index d0dcf14c21..1b6b5b244d 100644
--- a/src/plugins/texteditor/codeassist/iassistproposalmodel.h
+++ b/src/plugins/texteditor/codeassist/iassistproposalmodel.h
@@ -36,7 +36,7 @@
namespace TextEditor {
-class IAssistProposalItem;
+class AssistProposalItem;
class TEXTEDITOR_EXPORT IAssistProposalModel
{
diff --git a/src/plugins/texteditor/codeassist/iassistproposalwidget.cpp b/src/plugins/texteditor/codeassist/iassistproposalwidget.cpp
index 417c6d3936..5b78d2a60e 100644
--- a/src/plugins/texteditor/codeassist/iassistproposalwidget.cpp
+++ b/src/plugins/texteditor/codeassist/iassistproposalwidget.cpp
@@ -133,11 +133,11 @@ IAssistProposalWidget::~IAssistProposalWidget()
This can happen if all available proposal items share the same prefix and if the proposal's
model supports prefix expansion.
- \sa IGenericProposalModel::supportsPrefixExpansion()
+ \sa GenericProposalModel::supportsPrefixExpansion()
*/
/*!
- \fn void TextEditor::IAssistProposalWidget::proposalItemActivated(IAssistProposalItem *proposalItem)
+ \fn void TextEditor::IAssistProposalWidget::proposalItemActivated(AssistProposalItem *proposalItem)
This signal is emitted whenever \a proposalItem is chosen to be applied.
*/
diff --git a/src/plugins/texteditor/codeassist/iassistproposalwidget.h b/src/plugins/texteditor/codeassist/iassistproposalwidget.h
index 93a5961b30..ff71b78047 100644
--- a/src/plugins/texteditor/codeassist/iassistproposalwidget.h
+++ b/src/plugins/texteditor/codeassist/iassistproposalwidget.h
@@ -40,7 +40,7 @@ namespace TextEditor {
class CodeAssistant;
class IAssistProposalModel;
-class IAssistProposalItem;
+class AssistProposalItem;
class TEXTEDITOR_EXPORT IAssistProposalWidget : public QFrame
{
@@ -64,7 +64,7 @@ public:
signals:
void prefixExpanded(const QString &newPrefix);
- void proposalItemActivated(IAssistProposalItem *proposalItem);
+ void proposalItemActivated(AssistProposalItem *proposalItem);
void explicitlyAborted();
};
diff --git a/src/plugins/texteditor/codeassist/igenericproposalmodel.cpp b/src/plugins/texteditor/codeassist/igenericproposalmodel.cpp
deleted file mode 100644
index a55dc3837e..0000000000
--- a/src/plugins/texteditor/codeassist/igenericproposalmodel.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "igenericproposalmodel.h"
-
-using namespace TextEditor;
-
-IGenericProposalModel::IGenericProposalModel()
-{}
-
-IGenericProposalModel::~IGenericProposalModel()
-{}
diff --git a/src/plugins/texteditor/codeassist/igenericproposalmodel.h b/src/plugins/texteditor/codeassist/igenericproposalmodel.h
deleted file mode 100644
index b4462da56a..0000000000
--- a/src/plugins/texteditor/codeassist/igenericproposalmodel.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef IGENERICPROPOSALMODEL_H
-#define IGENERICPROPOSALMODEL_H
-
-#include "iassistproposalmodel.h"
-#include "assistenums.h"
-
-#include <texteditor/texteditor_global.h>
-
-QT_FORWARD_DECLARE_CLASS(QIcon)
-
-namespace TextEditor {
-
-class IAssistProposalItem;
-
-class TEXTEDITOR_EXPORT IGenericProposalModel : public IAssistProposalModel
-{
-public:
- IGenericProposalModel();
- ~IGenericProposalModel();
-
- virtual QIcon icon(int index) const = 0;
- virtual QString detail(int index) const = 0;
- virtual int persistentId(int index) const = 0;
- virtual void removeDuplicates() = 0;
- virtual void filter(const QString &prefix) = 0;
- virtual bool isSortable(const QString &prefix) const = 0;
- virtual void sort(const QString &prefix) = 0;
- virtual bool supportsPrefixExpansion() const = 0;
- virtual QString proposalPrefix() const = 0;
- virtual bool keepPerfectMatch(AssistReason reason) const = 0;
- virtual IAssistProposalItem *proposalItem(int index) const = 0;
-};
-
-} // TextEditor
-
-#endif // IGENERICPROPOSALMODEL_H
diff --git a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp
index 5acde7c856..a209a94ab4 100644
--- a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp
+++ b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp
@@ -29,10 +29,10 @@
#include "keywordscompletionassist.h"
-#include <texteditor/codeassist/iassistinterface.h>
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/functionhintproposal.h>
-#include <texteditor/codeassist/basicproposalitemlistmodel.h>
+#include <texteditor/codeassist/genericproposalmodel.h>
#include <texteditor/completionsettings.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/basetexteditor.h>
@@ -176,7 +176,7 @@ KeywordsCompletionAssistProcessor::KeywordsCompletionAssistProcessor(Keywords ke
KeywordsCompletionAssistProcessor::~KeywordsCompletionAssistProcessor()
{}
-IAssistProposal *KeywordsCompletionAssistProcessor::perform(const IAssistInterface *interface)
+IAssistProposal *KeywordsCompletionAssistProcessor::perform(const AssistInterface *interface)
{
m_interface.reset(interface);
@@ -198,10 +198,10 @@ IAssistProposal *KeywordsCompletionAssistProcessor::perform(const IAssistInterfa
IAssistProposal *proposal = new FunctionHintProposal(m_startPosition, model);
return proposal;
} else {
- QList<TextEditor::BasicProposalItem *> items;
+ QList<TextEditor::AssistProposalItem *> items;
addWordsToProposalList(&items, m_keywords.variables(), m_variableIcon);
addWordsToProposalList(&items, m_keywords.functions(), m_functionIcon);
- return new GenericProposal(m_startPosition, new BasicProposalItemListModel(items));
+ return new GenericProposal(m_startPosition, new GenericProposalModel(items));
}
}
@@ -257,13 +257,13 @@ bool KeywordsCompletionAssistProcessor::isInComment() const
return false;
}
-void KeywordsCompletionAssistProcessor::addWordsToProposalList(QList<BasicProposalItem *> *items, const QStringList &words, const QIcon &icon)
+void KeywordsCompletionAssistProcessor::addWordsToProposalList(QList<AssistProposalItem *> *items, const QStringList &words, const QIcon &icon)
{
if (!items)
return;
for (int i = 0; i < words.count(); ++i) {
- BasicProposalItem *item = new KeywordsAssistProposalItem(m_keywords);
+ AssistProposalItem *item = new KeywordsAssistProposalItem(m_keywords);
item->setText(words.at(i));
item->setIcon(icon);
items->append(item);
diff --git a/src/plugins/texteditor/codeassist/keywordscompletionassist.h b/src/plugins/texteditor/codeassist/keywordscompletionassist.h
index 3aa874891d..7a68c16fc8 100644
--- a/src/plugins/texteditor/codeassist/keywordscompletionassist.h
+++ b/src/plugins/texteditor/codeassist/keywordscompletionassist.h
@@ -31,7 +31,7 @@
#define KEYWORDSCOMPLETIONASSIST_H
#include "iassistprocessor.h"
-#include "basicproposalitem.h"
+#include "assistproposalitem.h"
#include "ifunctionhintproposalmodel.h"
#include <utils/qtcoverride.h>
@@ -56,7 +56,7 @@ private:
QMap<QString, QStringList> m_functionArgs;
};
-class TEXTEDITOR_EXPORT KeywordsAssistProposalItem : public BasicProposalItem
+class TEXTEDITOR_EXPORT KeywordsAssistProposalItem : public AssistProposalItem
{
public:
KeywordsAssistProposalItem(Keywords keywords);
@@ -89,18 +89,18 @@ public:
KeywordsCompletionAssistProcessor(Keywords keywords);
~KeywordsCompletionAssistProcessor();
- IAssistProposal *perform(const IAssistInterface *interface) QTC_OVERRIDE;
+ IAssistProposal *perform(const AssistInterface *interface) QTC_OVERRIDE;
QChar startOfCommentChar() const;
private:
bool acceptsIdleEditor();
int findStartOfName(int pos = -1);
bool isInComment() const;
- void addWordsToProposalList(QList<BasicProposalItem *> *items, const QStringList &words, const QIcon &icon);
+ void addWordsToProposalList(QList<AssistProposalItem *> *items, const QStringList &words, const QIcon &icon);
int m_startPosition;
QString m_word;
- QScopedPointer<const IAssistInterface> m_interface;
+ QScopedPointer<const AssistInterface> m_interface;
const QIcon m_variableIcon;
const QIcon m_functionIcon;
Keywords m_keywords;
diff --git a/src/plugins/texteditor/codeassist/quickfixassistprocessor.cpp b/src/plugins/texteditor/codeassist/quickfixassistprocessor.cpp
index 9472afc6c0..b820374844 100644
--- a/src/plugins/texteditor/codeassist/quickfixassistprocessor.cpp
+++ b/src/plugins/texteditor/codeassist/quickfixassistprocessor.cpp
@@ -29,9 +29,9 @@
#include "quickfixassistprocessor.h"
#include "quickfixassistprovider.h"
-#include "iassistinterface.h"
-#include "basicproposalitemlistmodel.h"
-#include "basicproposalitem.h"
+#include "assistinterface.h"
+#include "genericproposalmodel.h"
+#include "assistproposalitem.h"
#include "genericproposal.h"
// @TODO: Move...
@@ -39,7 +39,7 @@
#include <QDebug>
-using namespace TextEditor;
+namespace TextEditor {
QuickFixAssistProcessor::QuickFixAssistProcessor()
{}
@@ -47,12 +47,12 @@ QuickFixAssistProcessor::QuickFixAssistProcessor()
QuickFixAssistProcessor::~QuickFixAssistProcessor()
{}
-IAssistProposal *QuickFixAssistProcessor::perform(const IAssistInterface *interface)
+IAssistProposal *QuickFixAssistProcessor::perform(const AssistInterface *interface)
{
if (!interface)
return 0;
- QSharedPointer<const IAssistInterface> assistInterface(interface);
+ QSharedPointer<const AssistInterface> assistInterface(interface);
QuickFixOperations quickFixes;
@@ -62,18 +62,20 @@ IAssistProposal *QuickFixAssistProcessor::perform(const IAssistInterface *interf
factory->matchingOperations(assistInterface, quickFixes);
if (!quickFixes.isEmpty()) {
- QList<BasicProposalItem *> items;
+ QList<AssistProposalItem *> items;
foreach (const QuickFixOperation::Ptr &op, quickFixes) {
QVariant v;
v.setValue(op);
- BasicProposalItem *item = new BasicProposalItem;
+ AssistProposalItem *item = new AssistProposalItem;
item->setText(op->description());
item->setData(v);
item->setOrder(op->priority());
items.append(item);
}
- return new GenericProposal(interface->position(), new BasicProposalItemListModel(items));
+ return new GenericProposal(interface->position(), new GenericProposalModel(items));
}
return 0;
}
+
+} // namespace TextEdit
diff --git a/src/plugins/texteditor/codeassist/quickfixassistprocessor.h b/src/plugins/texteditor/codeassist/quickfixassistprocessor.h
index 86936b3c31..04994d6885 100644
--- a/src/plugins/texteditor/codeassist/quickfixassistprocessor.h
+++ b/src/plugins/texteditor/codeassist/quickfixassistprocessor.h
@@ -44,7 +44,7 @@ public:
virtual const IAssistProvider *provider() const = 0;
- IAssistProposal *perform(const IAssistInterface *interface) QTC_OVERRIDE;
+ IAssistProposal *perform(const AssistInterface *interface) QTC_OVERRIDE;
};
} // TextEditor
diff --git a/src/plugins/texteditor/codeassist/runner.cpp b/src/plugins/texteditor/codeassist/runner.cpp
index de693f8bf4..d82308de12 100644
--- a/src/plugins/texteditor/codeassist/runner.cpp
+++ b/src/plugins/texteditor/codeassist/runner.cpp
@@ -30,7 +30,7 @@
#include "runner.h"
#include "iassistprocessor.h"
#include "iassistproposal.h"
-#include "iassistinterface.h"
+#include "assistinterface.h"
#include "iassistproposalmodel.h"
using namespace TextEditor;
@@ -84,7 +84,7 @@ void ProcessorRunner::setDiscardProposal(bool discard)
m_discardProposal = discard;
}
-void ProcessorRunner::setAssistInterface(IAssistInterface *interface)
+void ProcessorRunner::setAssistInterface(AssistInterface *interface)
{
m_interface = interface;
}
diff --git a/src/plugins/texteditor/codeassist/runner.h b/src/plugins/texteditor/codeassist/runner.h
index 9c434d3797..4c4cd6c051 100644
--- a/src/plugins/texteditor/codeassist/runner.h
+++ b/src/plugins/texteditor/codeassist/runner.h
@@ -38,7 +38,7 @@ namespace TextEditor {
class IAssistProcessor;
class IAssistProposal;
-class IAssistInterface;
+class AssistInterface;
namespace Internal {
@@ -51,7 +51,7 @@ public:
virtual ~ProcessorRunner();
void setProcessor(IAssistProcessor *processor); // Takes ownership of the processor.
- void setAssistInterface(IAssistInterface *interface);
+ void setAssistInterface(AssistInterface *interface);
void setDiscardProposal(bool discard);
// @TODO: Not really necessary...
@@ -64,7 +64,7 @@ public:
private:
IAssistProcessor *m_processor;
- IAssistInterface *m_interface;
+ AssistInterface *m_interface;
bool m_discardProposal;
IAssistProposal *m_proposal;
AssistReason m_reason;
diff --git a/src/plugins/texteditor/quickfix.h b/src/plugins/texteditor/quickfix.h
index 14db01ee53..a975219950 100644
--- a/src/plugins/texteditor/quickfix.h
+++ b/src/plugins/texteditor/quickfix.h
@@ -38,7 +38,7 @@
namespace TextEditor {
-class IAssistInterface;
+class AssistInterface;
/*!
Class to perform a single quick-fix.
@@ -91,7 +91,7 @@ private:
};
typedef QList<QuickFixOperation::Ptr> QuickFixOperations;
-typedef QSharedPointer<const IAssistInterface> QuickFixInterface;
+typedef QSharedPointer<const AssistInterface> QuickFixInterface;
/*!
The QuickFixFactory is responsible for generating QuickFixOperation s which are
diff --git a/src/plugins/texteditor/snippets/snippetassistcollector.cpp b/src/plugins/texteditor/snippets/snippetassistcollector.cpp
index c8d02c297b..256907f15c 100644
--- a/src/plugins/texteditor/snippets/snippetassistcollector.cpp
+++ b/src/plugins/texteditor/snippets/snippetassistcollector.cpp
@@ -31,14 +31,12 @@
#include "snippetscollection.h"
#include <texteditor/texteditorconstants.h>
-#include <texteditor/codeassist/basicproposalitem.h>
+#include <texteditor/codeassist/assistproposalitem.h>
using namespace TextEditor;
using namespace Internal;
-namespace {
-
-void appendSnippets(QList<BasicProposalItem *> *items,
+static void appendSnippets(QList<AssistProposalItem *> *items,
const QString &groupId,
const QIcon &icon,
int order)
@@ -47,7 +45,7 @@ void appendSnippets(QList<BasicProposalItem *> *items,
const int size = collection->totalActiveSnippets(groupId);
for (int i = 0; i < size; ++i) {
const Snippet &snippet = collection->snippet(i, groupId);
- BasicProposalItem *item = new BasicProposalItem;
+ AssistProposalItem *item = new AssistProposalItem;
item->setText(snippet.trigger() + QLatin1Char(' ') + snippet.complement());
item->setData(snippet.content());
item->setDetail(snippet.generateTip());
@@ -57,8 +55,6 @@ void appendSnippets(QList<BasicProposalItem *> *items,
}
}
-} // anonymous
-
SnippetAssistCollector::SnippetAssistCollector(const QString &groupId, const QIcon &icon, int order)
: m_groupId(groupId)
@@ -69,9 +65,9 @@ SnippetAssistCollector::SnippetAssistCollector(const QString &groupId, const QIc
SnippetAssistCollector::~SnippetAssistCollector()
{}
-QList<BasicProposalItem *> SnippetAssistCollector::collect() const
+QList<AssistProposalItem *> SnippetAssistCollector::collect() const
{
- QList<BasicProposalItem *> snippets;
+ QList<AssistProposalItem *> snippets;
appendSnippets(&snippets, m_groupId, m_icon, m_order);
appendSnippets(&snippets, QLatin1String(Constants::TEXT_SNIPPET_GROUP_ID), m_icon, m_order);
return snippets;
diff --git a/src/plugins/texteditor/snippets/snippetassistcollector.h b/src/plugins/texteditor/snippets/snippetassistcollector.h
index 4622cb3830..58dcf48222 100644
--- a/src/plugins/texteditor/snippets/snippetassistcollector.h
+++ b/src/plugins/texteditor/snippets/snippetassistcollector.h
@@ -38,7 +38,7 @@
namespace TextEditor {
-class BasicProposalItem;
+class AssistProposalItem;
class TEXTEDITOR_EXPORT SnippetAssistCollector
{
@@ -46,7 +46,7 @@ public:
SnippetAssistCollector(const QString &groupId, const QIcon &icon, int order = 0);
~SnippetAssistCollector();
- QList<BasicProposalItem *> collect() const;
+ QList<AssistProposalItem *> collect() const;
private:
QString m_groupId;
diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro
index 40fc8d6308..618b2f7947 100644
--- a/src/plugins/texteditor/texteditor.pro
+++ b/src/plugins/texteditor/texteditor.pro
@@ -76,19 +76,16 @@ SOURCES += texteditorplugin.cpp \
codeassist/iassistproposalwidget.cpp \
codeassist/codeassistant.cpp \
snippets/snippetassistcollector.cpp \
- codeassist/iassistinterface.cpp \
- codeassist/defaultassistinterface.cpp \
- codeassist/iassistproposalitem.cpp \
+ codeassist/assistinterface.cpp \
+ codeassist/assistproposalitem.cpp \
convenience.cpp \
codeassist/runner.cpp \
codeassist/completionassistprovider.cpp \
- codeassist/igenericproposalmodel.cpp \
+ codeassist/genericproposalmodel.cpp \
codeassist/quickfixassistprovider.cpp \
codeassist/quickfixassistprocessor.cpp \
codeassist/genericproposal.cpp \
codeassist/genericproposalwidget.cpp \
- codeassist/basicproposalitem.cpp \
- codeassist/basicproposalitemlistmodel.cpp \
codeassist/iassistproposalmodel.cpp \
tabsettingswidget.cpp \
simplecodestylepreferences.cpp \
@@ -188,20 +185,17 @@ HEADERS += texteditorplugin.h \
codeassist/iassistproposal.h \
codeassist/codeassistant.h \
snippets/snippetassistcollector.h \
- codeassist/iassistinterface.h \
- codeassist/defaultassistinterface.h \
- codeassist/iassistproposalitem.h \
+ codeassist/assistinterface.h \
+ codeassist/assistproposalitem.h \
convenience.h \
codeassist/assistenums.h \
codeassist/runner.h \
codeassist/completionassistprovider.h \
- codeassist/igenericproposalmodel.h \
+ codeassist/genericproposalmodel.h \
codeassist/quickfixassistprovider.h \
codeassist/quickfixassistprocessor.h \
codeassist/genericproposal.h \
codeassist/genericproposalwidget.h \
- codeassist/basicproposalitem.h \
- codeassist/basicproposalitemlistmodel.h \
codeassist/iassistproposalmodel.h \
tabsettingswidget.h \
simplecodestylepreferences.h \
diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs
index a1455800c9..02a6b1b57c 100644
--- a/src/plugins/texteditor/texteditor.qbs
+++ b/src/plugins/texteditor/texteditor.qbs
@@ -147,32 +147,28 @@ QtcPlugin {
prefix: "codeassist/"
files: [
"assistenums.h",
- "basicproposalitem.cpp",
- "basicproposalitem.h",
- "basicproposalitemlistmodel.cpp",
- "basicproposalitemlistmodel.h",
+ "assistinterface.cpp",
+ "assistinterface.h",
+ "assistproposalitem.cpp",
+ "assistproposalitem.h",
"codeassistant.cpp",
"codeassistant.h",
"completionassistprovider.cpp",
"completionassistprovider.h",
- "defaultassistinterface.cpp",
- "defaultassistinterface.h",
"functionhintproposal.cpp",
"functionhintproposal.h",
"functionhintproposalwidget.cpp",
"functionhintproposalwidget.h",
"genericproposal.cpp",
"genericproposal.h",
+ "genericproposalmodel.cpp",
+ "genericproposalmodel.h",
"genericproposalwidget.cpp",
"genericproposalwidget.h",
- "iassistinterface.cpp",
- "iassistinterface.h",
"iassistprocessor.cpp",
"iassistprocessor.h",
"iassistproposal.cpp",
"iassistproposal.h",
- "iassistproposalitem.cpp",
- "iassistproposalitem.h",
"iassistproposalmodel.cpp",
"iassistproposalmodel.h",
"iassistproposalwidget.cpp",
@@ -181,8 +177,6 @@ QtcPlugin {
"iassistprovider.h",
"ifunctionhintproposalmodel.cpp",
"ifunctionhintproposalmodel.h",
- "igenericproposalmodel.cpp",
- "igenericproposalmodel.h",
"keywordscompletionassist.cpp",
"keywordscompletionassist.h",
"quickfixassistprocessor.cpp",