Commit 1e59df6f authored by Nikolai Kosjar's avatar Nikolai Kosjar

TextEditor: Simplify testing of code assistant

Change-Id: I6f16dd775a7c5d8eaa4944d6050bf979be83a303
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 777b5c08
......@@ -249,6 +249,8 @@ BaseTextEditorWidget::BaseTextEditorWidget(QWidget *parent)
d->visibleFoldedBlockNumber = d->suggestedVisibleFoldedBlockNumber = -1;
connect(d->m_codeAssistant.data(), SIGNAL(finished()), this, SIGNAL(assistFinished()));
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(slotUpdateExtraAreaWidth()));
connect(this, SIGNAL(modificationChanged(bool)), this, SLOT(slotModificationChanged(bool)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(slotCursorPositionChanged()));
......@@ -1090,6 +1092,11 @@ void BaseTextEditorWidget::openLinkUnderCursorInNextSplit()
openLink(symbolLink, !alwaysOpenLinksInNextSplit());
}
void BaseTextEditorWidget::abortAssist()
{
d->m_codeAssistant->destroyContext();
}
void BaseTextEditorWidget::moveLineUpDown(bool up)
{
QTextCursor cursor = textCursor();
......
......@@ -332,8 +332,12 @@ public slots:
void openLinkUnderCursor();
void openLinkUnderCursorInNextSplit();
/// Abort code assistant if it is running.
void abortAssist();
signals:
void changed();
void assistFinished();
// ITextEditor
void contentsChanged();
......
......@@ -101,6 +101,9 @@ public:
virtual bool eventFilter(QObject *o, QEvent *e);
signals:
void finished();
private slots:
void finalizeRequest();
void proposalComputed();
......@@ -251,6 +254,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
m_requestRunner = new ProcessorRunner;
connect(m_requestRunner, SIGNAL(finished()), this, SLOT(proposalComputed()));
connect(m_requestRunner, SIGNAL(finished()), this, SLOT(finalizeRequest()));
connect(m_requestRunner, SIGNAL(finished()), this, SIGNAL(finished()));
assistInterface->prepareForAsyncUse();
m_requestRunner->setReason(reason);
m_requestRunner->setProcessor(processor);
......@@ -487,7 +491,9 @@ bool CodeAssistantPrivate::eventFilter(QObject *o, QEvent *e)
// CodeAssistant
// -------------
CodeAssistant::CodeAssistant() : d(new CodeAssistantPrivate(this))
{}
{
connect(d, SIGNAL(finished()), SIGNAL(finished()));
}
CodeAssistant::~CodeAssistant()
{
......
......@@ -34,14 +34,18 @@
#include <texteditor/texteditor_global.h>
#include <QObject>
namespace TextEditor {
class CodeAssistantPrivate;
class IAssistProvider;
class BaseTextEditor;
class CodeAssistant
class CodeAssistant : public QObject
{
Q_OBJECT
public:
CodeAssistant();
~CodeAssistant();
......@@ -55,6 +59,9 @@ public:
void invoke(AssistKind assistKind, IAssistProvider *provider = 0);
signals:
void finished();
private:
CodeAssistantPrivate *d;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment