aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Gladhorn <gladhorn@kde.org>2014-01-12 02:48:55 (GMT)
committerFrederik Gladhorn <gladhorn@kde.org>2014-01-19 16:34:18 (GMT)
commit7f0c00fd2ca1813cb62ac405bd10cd833e782186 (patch)
tree28aebb6e110436d1c28a8996fa600cfb69e3cc0d
parent9cdde23d4a1969f062b545641fe3c4cf3a6d18bb (diff)
Remove duplicate signals and use new syntax
Extra arguments in signals do not hurt. To reduce risk of breaking things also use the new signals and slot syntax.
-rw-r--r--autotests/src/katedocument_test.cpp2
-rw-r--r--autotests/src/vimode_test.cpp16
-rw-r--r--src/document/katedocument.cpp5
-rw-r--r--src/include/ktexteditor/document.h21
-rw-r--r--src/spellcheck/ontheflycheck.cpp8
-rw-r--r--src/utils/katetemplatehandler.cpp24
-rw-r--r--src/vimode/katevinormalmode.cpp8
7 files changed, 29 insertions, 55 deletions
diff --git a/autotests/src/katedocument_test.cpp b/autotests/src/katedocument_test.cpp
index cc9fd1f..bd18f11 100644
--- a/autotests/src/katedocument_test.cpp
+++ b/autotests/src/katedocument_test.cpp
@@ -312,7 +312,7 @@ void KateDocumentTest::testRemoveMultipleLines()
"line4\n");
SignalHandler handler;
- connect(&doc, SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range,QString)), &handler, SLOT(slotMultipleLinesRemoved(KTextEditor::Document*,KTextEditor::Range,QString)));
+ connect(&doc, &KTextEditor::Document::textRemoved, &handler, &SignalHandler::slotMultipleLinesRemoved);
doc.removeText(Range(1, 0, 3, 0));
}
diff --git a/autotests/src/vimode_test.cpp b/autotests/src/vimode_test.cpp
index 5ca6051..c83ed25 100644
--- a/autotests/src/vimode_test.cpp
+++ b/autotests/src/vimode_test.cpp
@@ -115,10 +115,10 @@ FakeCodeCompletionTestModel::FakeCodeCompletionTestModel(KTextEditor::View *pare
setRowCount(3);
cc()->setAutomaticInvocationEnabled(false);
cc()->unregisterCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
- connect(parent->document(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
- connect(parent->document(), SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textRemoved(KTextEditor::Document*,KTextEditor::Range)));
+ connect(parent->document(), &KTextEditor::Document::textInserted,
+ this, &FakeCodeCompletionTestModel::textInserted);
+ connect(parent->document(), &KTextEditor::Document::textRemoved,
+ this, &FakeCodeCompletionTestModel::textRemoved);
}
void FakeCodeCompletionTestModel::setCompletions(const QStringList &completions)
{
@@ -303,10 +303,10 @@ void ViModeTest::init()
vi_input_mode_manager = kate_view->getViInputModeManager();
kate_document->config()->setShowSpaces(true); // Flush out some issues in the KateRenderer when rendering spaces.
- connect(kate_document, SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
- connect(kate_document, SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textRemoved(KTextEditor::Document*,KTextEditor::Range)));
+ connect(kate_document, &KTextEditor::Document::textInserted,
+ this, &ViModeTest::textInserted);
+ connect(kate_document, &KTextEditor::Document::textRemoved,
+ this, &ViModeTest::textRemoved);
}
Qt::KeyboardModifier ViModeTest::parseCodedModifier(const QString &string, int startPos, int *destEndOfCodedModifier)
diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp
index 3d9a56e..ab825b4 100644
--- a/src/document/katedocument.cpp
+++ b/src/document/katedocument.cpp
@@ -1102,7 +1102,6 @@ bool KTextEditor::DocumentPrivate::editRemoveText(int line, int col, int len)
// remove text from line
m_buffer->removeText(KTextEditor::Range(KTextEditor::Cursor(line, col), KTextEditor::Cursor(line, col + len)));
- emit KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, line, col + len));
emit KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, line, col + len), oldText);
editEnd();
@@ -1273,7 +1272,6 @@ bool KTextEditor::DocumentPrivate::editUnWrapLine(int line, bool removeLine, int
emit marksChanged(this);
}
- emit KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, line + 1, 0));
emit KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, line + 1, 0), QLatin1String("\n"));
editEnd();
@@ -1437,7 +1435,6 @@ bool KTextEditor::DocumentPrivate::editRemoveLines(int from, int to)
}
}
- emit KTextEditor::Document::textRemoved(this, rangeRemoved);
emit KTextEditor::Document::textRemoved(this, rangeRemoved, oldText.join(QLatin1String("\n")) + QLatin1Char('\n'));
editEnd();
@@ -2040,7 +2037,6 @@ bool KTextEditor::DocumentPrivate::openFile()
}
// do we have success ?
- emit KTextEditor::Document::textRemoved(this, documentRange());
emit KTextEditor::Document::textRemoved(this, documentRange(), m_buffer->text());
// update file type, we do this here PRE-LOAD, therefore pass file name for reading from
@@ -2474,7 +2470,6 @@ bool KTextEditor::DocumentPrivate::closeUrl()
emit modifiedOnDisk(this, m_modOnHd, m_modOnHdReason);
}
- emit KTextEditor::Document::textRemoved(this, documentRange());
emit KTextEditor::Document::textRemoved(this, documentRange(), m_buffer->text());
{
diff --git a/src/include/ktexteditor/document.h b/src/include/ktexteditor/document.h
index 12f9c1a..0df4600 100644
--- a/src/include/ktexteditor/document.h
+++ b/src/include/ktexteditor/document.h
@@ -650,15 +650,6 @@ Q_SIGNALS:
* text was removed.
* \param document document which emitted this signal
* \param range range that the removed text previously occupied
- * \see removeText(), removeLine(), clear()
- */
- void textRemoved(KTextEditor::Document *document, const KTextEditor::Range &range);
-
- /**
- * The \p document emits this signal whenever \p range was removed, i.e.
- * text was removed.
- * \param document document which emitted this signal
- * \param range range that the removed text previously occupied
* \param oldText the text that has been removed
* \see removeText(), removeLine(), clear()
*/
@@ -671,18 +662,6 @@ Q_SIGNALS:
* \note \p oldRange.start() is guaranteed to equal \p newRange.start().
* \param document document which emitted this signal
* \param oldRange range that the text previously occupied
- * \param newRange range that the changed text now occupies
- * \see insertText(), insertLine(), removeText(), removeLine(), clear()
- */
- void textChanged(KTextEditor::Document *document, const KTextEditor::Range &oldRange, const KTextEditor::Range &newRange);
-
- /**
- * The \p document emits this signal whenever the text in range
- * \p oldRange was removed and replaced with the text now in \e newRange,
- * e.g. the user selects text and pastes new text to replace the selection.
- * \note \p oldRange.start() is guaranteed to equal \p newRange.start().
- * \param document document which emitted this signal
- * \param oldRange range that the text previously occupied
* \param oldText old text that has been replaced
* \param newRange range that the changed text now occupies
* \see insertText(), insertLine(), removeText(), removeLine(), clear()
diff --git a/src/spellcheck/ontheflycheck.cpp b/src/spellcheck/ontheflycheck.cpp
index 28c57cf..4bd54e0 100644
--- a/src/spellcheck/ontheflycheck.cpp
+++ b/src/spellcheck/ontheflycheck.cpp
@@ -51,10 +51,10 @@ KateOnTheFlyChecker::KateOnTheFlyChecker(KTextEditor::DocumentPrivate *document)
m_viewRefreshTimer->setSingleShot(true);
connect(m_viewRefreshTimer, SIGNAL(timeout()), this, SLOT(viewRefreshTimeout()));
- connect(document, SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
- connect(document, SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textRemoved(KTextEditor::Document*,KTextEditor::Range)));
+ connect(document, &KTextEditor::Document::textInserted,
+ this, &KateOnTheFlyChecker::textInserted);
+ connect(document, &KTextEditor::Document::textRemoved,
+ this, &KateOnTheFlyChecker::textRemoved);
connect(document, SIGNAL(viewCreated(KTextEditor::Document*,KTextEditor::View*)),
this, SLOT(addView(KTextEditor::Document*,KTextEditor::View*)));
connect(document, SIGNAL(highlightingModeChanged(KTextEditor::Document*)),
diff --git a/src/utils/katetemplatehandler.cpp b/src/utils/katetemplatehandler.cpp
index 6e7fec2..83d0aaf 100644
--- a/src/utils/katetemplatehandler.cpp
+++ b/src/utils/katetemplatehandler.cpp
@@ -97,11 +97,11 @@ KateTemplateHandler::KateTemplateHandler(KTextEditor::ViewPrivate *view,
ifDebug(qCDebug(LOG_PART) << initial_Values;)
- connect(doc(), SIGNAL(aboutToReload(KTextEditor::Document*)),
- this, SLOT(cleanupAndExit()));
+ connect(doc(), &KTextEditor::Document::aboutToReload,
+ this, &KateTemplateHandler::cleanupAndExit);
- connect(doc(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(slotTemplateInserted(KTextEditor::Document*,KTextEditor::Range)));
+ connect(doc(), &KTextEditor::Document::textInserted,
+ this, &KateTemplateHandler::slotTemplateInserted);
///TODO: maybe use Kate::CutCopyPasteEdit or similar?
@@ -150,12 +150,12 @@ KateTemplateHandler::KateTemplateHandler(KTextEditor::ViewPrivate *view,
setupEventHandler(view);
}
- connect(doc(), SIGNAL(viewCreated(KTextEditor::Document*,KTextEditor::View*)),
- this, SLOT(slotViewCreated(KTextEditor::Document*,KTextEditor::View*)));
- connect(doc(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(slotTextChanged(KTextEditor::Document*,KTextEditor::Range)));
- connect(doc(), SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(slotTextChanged(KTextEditor::Document*,KTextEditor::Range)));
+ connect(doc(), &KTextEditor::Document::viewCreated,
+ this, &KateTemplateHandler::slotViewCreated);
+ connect(doc(), &KTextEditor::Document::textInserted,
+ this, &KateTemplateHandler::slotTextChanged);
+ connect(doc(), &KTextEditor::Document::textRemoved,
+ this, &KateTemplateHandler::slotTextChanged);
setEditWithUndo(undoManager->isActive());
@@ -196,8 +196,8 @@ void KateTemplateHandler::cleanupAndExit()
this, SLOT(slotViewCreated(KTextEditor::Document*,KTextEditor::View*)));
disconnect(doc(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
this, SLOT(slotTextChanged(KTextEditor::Document*,KTextEditor::Range)));
- disconnect(doc(), SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(slotTextChanged(KTextEditor::Document*,KTextEditor::Range)));
+ disconnect(doc(), &KTextEditor::Document::textRemoved,
+ this, &KateTemplateHandler::slotTextChanged);
if (!m_templateRanges.isEmpty()) {
foreach (MovingRange *range, m_templateRanges) {
diff --git a/src/vimode/katevinormalmode.cpp b/src/vimode/katevinormalmode.cpp
index d3ab941..f58c714 100644
--- a/src/vimode/katevinormalmode.cpp
+++ b/src/vimode/katevinormalmode.cpp
@@ -484,10 +484,10 @@ void KateViNormalMode::reset()
void KateViNormalMode::beginMonitoringDocumentChanges()
{
- connect(doc(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
- connect(doc(), SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
- this, SLOT(textRemoved(KTextEditor::Document*,KTextEditor::Range)));
+ connect(doc(), &KTextEditor::Document::textInserted,
+ this, &KateViNormalMode::textInserted);
+ connect(doc(), &KTextEditor::Document::textRemoved,
+ this, &KateViNormalMode::textRemoved);
}
void KateViNormalMode::executeCommand(const KateViCommand *cmd)