diff --git a/autotests/src/katedocument_test.cpp b/autotests/src/katedocument_test.cpp --- a/autotests/src/katedocument_test.cpp +++ b/autotests/src/katedocument_test.cpp @@ -136,7 +136,7 @@ "foo\n" "foo\n" "bar\n")); - doc.replaceText(Range(1, 0, 3, 0), QStringList() << "new" << "text" << "", false); + doc.replaceText(Range(1, 0, 3, 0), { "new", "text", "" }, false); QCOMPARE(doc.text(), QLatin1String("asdf\n" "new\n" "text\n" diff --git a/autotests/src/kateencodingtest.cpp b/autotests/src/kateencodingtest.cpp --- a/autotests/src/kateencodingtest.cpp +++ b/autotests/src/kateencodingtest.cpp @@ -23,7 +23,6 @@ #include "katetextbuffer.h" #include -#include int main(int argc, char *argv[]) { diff --git a/autotests/src/kateview_test.cpp b/autotests/src/kateview_test.cpp --- a/autotests/src/kateview_test.cpp +++ b/autotests/src/kateview_test.cpp @@ -261,11 +261,7 @@ void KateViewTest::testKillline() { KTextEditor::DocumentPrivate doc; - doc.insertLines(0, QStringList() - << "foo" - << "bar" - << "baz" - ); + doc.insertLines(0, { "foo", "bar", "baz" }); KTextEditor::ViewPrivate *view = new KTextEditor::ViewPrivate(&doc, nullptr); @@ -277,12 +273,7 @@ doc.clear(); QVERIFY(doc.isEmpty()); - doc.insertLines(0, QStringList() - << "foo" - << "bar" - << "baz" - << "xxx" - ); + doc.insertLines(0, { "foo", "bar", "baz", "xxx" }); view->setCursorPositionInternal(KTextEditor::Cursor(1, 2)); view->shiftDown(); diff --git a/autotests/src/vimode/completion.cpp b/autotests/src/vimode/completion.cpp --- a/autotests/src/vimode/completion.cpp +++ b/autotests/src/vimode/completion.cpp @@ -109,7 +109,7 @@ ensureKateViewVisible(); // KTextEditor::ViewPrivate needs to be visible for the completion widget. FakeCodeCompletionTestModel *fakeCodeCompletionModel = new FakeCodeCompletionTestModel(kate_view); kate_view->registerCompletionModel(fakeCodeCompletionModel); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); DoTest("", "i\\ctrl-p\\enter", "completionC"); DoTest("", "i\\ctrl-p\\ctrl-p\\enter", "completionB"); DoTest("", "i\\ctrl-p\\ctrl-p\\ctrl-p\\enter", "completionA"); @@ -134,7 +134,7 @@ QCOMPARE(m_docChanges[1].newText(), QString("completionA")); FinishTest("completionA"); // A "word" is currently alphanumeric, plus underscore. - fakeCodeCompletionModel->setCompletions(QStringList() << "w_123completion"); + fakeCodeCompletionModel->setCompletions({ "w_123completion" }); BeginTest("(w_123"); TestPressKey("ea"); clearTrackedDocumentChanges(); @@ -181,7 +181,7 @@ // is added as "function()", and the cursor placed after the closing ")". // The addition of "function()" is done in two steps: first "function", then "()". BeginTest("object->"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall()"); + fakeCodeCompletionModel->setCompletions({ "functionCall()" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("$a\\ctrl- \\enter"); @@ -199,7 +199,7 @@ // The addition of "function()" is done in two steps: first "function", then "()". qDebug() << "Fleep"; BeginTest("object->"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...)"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...)" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("$a\\ctrl- \\enter"); @@ -219,7 +219,7 @@ // in contrast to the case where there is no opening bracket after the cursor. // No brackets are added. No removals occur if there is no word before the cursor. BeginTest("object->("); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall()"); + fakeCodeCompletionModel->setCompletions({ "functionCall()" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f(i\\ctrl- \\enter"); @@ -232,7 +232,7 @@ // There can't be any non-whitespace between cursor position and opening bracket, though! BeginTest("object->|( ("); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall()"); + fakeCodeCompletionModel->setCompletions({ "functionCall()" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f>a\\ctrl- \\enter"); @@ -247,7 +247,7 @@ // Whitespace before the bracket is fine, though. BeginTest("object-> (<-Cursor here!"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall()"); + fakeCodeCompletionModel->setCompletions({ "functionCall()" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f>a\\ctrl- \\enter"); @@ -260,7 +260,7 @@ // Be careful with positioning the cursor if we delete leading text! BeginTest("object-> (<-Cursor here!"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall()"); + fakeCodeCompletionModel->setCompletions({ "functionCall()" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f>afunct"); @@ -278,7 +278,7 @@ // If we're removing tail on complete, it's whether there is a suitable opening // bracket *after* the word (not the cursor) that's important. BeginTest("object->function (<-Cursor here!"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall()"); + fakeCodeCompletionModel->setCompletions({ "functionCall()" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("12li"); // Start inserting before the "t" in "function" @@ -298,7 +298,7 @@ // Repeat of bracket-merging stuff, this time for functions that take at least one argument. BeginTest("object->("); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...)"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...)" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f(i\\ctrl- \\enter"); @@ -312,7 +312,7 @@ // There can't be any non-whitespace between cursor position and opening bracket, though! BeginTest("object->|( ("); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...)"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...)" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f>a\\ctrl- \\enter"); @@ -328,7 +328,7 @@ // Whitespace before the bracket is fine, though. BeginTest("object-> (<-Cursor here!"); qDebug() << "NooooO"; - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...)"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...)" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f>a\\ctrl- \\enter"); @@ -341,7 +341,7 @@ // Be careful with positioning the cursor if we delete leading text! BeginTest("object-> (<-Cursor here!"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...)"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...)" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("f>afunct"); @@ -359,7 +359,7 @@ // If we're removing tail on complete, it's whether there is a suitable opening // bracket *after* the word (not the cursor) that's important. BeginTest("object->function (<-Cursor here!"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...)"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...)" }); fakeCodeCompletionModel->setRemoveTailOnComplete(true); clearTrackedDocumentChanges(); TestPressKey("12li"); // Start inserting before the "t" in "function" @@ -379,7 +379,7 @@ // Deal with function completions which add a ";". BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall();"); + fakeCodeCompletionModel->setCompletions({ "functionCall();" }); clearTrackedDocumentChanges(); TestPressKey("ifun"); clearTrackedDocumentChanges(); @@ -396,12 +396,12 @@ FinishTest("functionCall();"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall();"); + fakeCodeCompletionModel->setCompletions({ "functionCall();" }); TestPressKey("ifun\\ctrl- \\enterX"); FinishTest("functionCall();X"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...);"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...);" }); clearTrackedDocumentChanges(); TestPressKey("ifun"); clearTrackedDocumentChanges(); @@ -418,17 +418,17 @@ FinishTest("functionCall();"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...);"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...);" }); TestPressKey("ifun\\ctrl- \\enterX"); FinishTest("functionCall(X);"); // Completions ending with ";" do not participate in bracket merging. BeginTest("(<-old bracket"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall();"); + fakeCodeCompletionModel->setCompletions({ "functionCall();" }); TestPressKey("ifun\\ctrl- \\enterX"); FinishTest("functionCall();X(<-old bracket"); BeginTest("(<-old bracket"); - fakeCodeCompletionModel->setCompletions(QStringList() << "functionCall(...);"); + fakeCodeCompletionModel->setCompletions({ "functionCall(...);" }); TestPressKey("ifun\\ctrl- \\enterX"); FinishTest("functionCall(X);(<-old bracket"); @@ -558,7 +558,7 @@ kate_view->registerCompletionModel(fakeCodeCompletionModel); clearAllMacros(); BeginTest("funct\nnoa\ncomtail\ncomtail"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "functionwithargs(...)" << "noargfunction()"); + fakeCodeCompletionModel->setCompletions({ "completionA", "functionwithargs(...)", "noargfunction()" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); // Record 'a'. TestPressKey("i\\right\\right\\right\\right\\right\\ctrl- \\enterfirstArg"); // Function with args. @@ -579,10 +579,10 @@ // Clear our log of completions for each change. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA"); + fakeCodeCompletionModel->setCompletions({ "completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("ciw\\ctrl- \\enter\\ctrl-c"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionB"); + fakeCodeCompletionModel->setCompletions({ "completionB" }); TestPressKey("ciw\\ctrl- \\enter\\ctrl-c"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("."); diff --git a/autotests/src/vimode/keys.cpp b/autotests/src/vimode/keys.cpp --- a/autotests/src/vimode/keys.cpp +++ b/autotests/src/vimode/keys.cpp @@ -947,7 +947,7 @@ // Don't invoke completion via ctrl-space when replaying a macro. clearAllMacros(); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); BeginTest(""); TestPressKey("qqico\\ctrl- \\ctrl-cq"); @@ -957,7 +957,7 @@ // Don't invoke completion via ctrl-p when replaying a macro. clearAllMacros(); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); BeginTest(""); TestPressKey("qqico\\ctrl-p\\ctrl-cq"); @@ -967,7 +967,7 @@ // Don't invoke completion via ctrl-n when replaying a macro. clearAllMacros(); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); BeginTest(""); TestPressKey("qqico\\ctrl-n\\ctrl-cq"); @@ -985,7 +985,7 @@ BeginTest(""); TestPressKey("qqicompl\\enterX\\ctrl-cqdddd"); QVERIFY(!fakeCodeCompletionModel->wasInvoked()); // Error in test setup! - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->forceInvocationIfDocTextIs("compl"); fakeCodeCompletionModel->clearWasInvoked(); TestPressKey("@q"); @@ -1000,7 +1000,7 @@ BeginTest(""); TestPressKey("qqicompl\\returnX\\ctrl-cqdddd"); QVERIFY(!fakeCodeCompletionModel->wasInvoked()); // Error in test setup! - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->forceInvocationIfDocTextIs("compl"); fakeCodeCompletionModel->clearWasInvoked(); TestPressKey("@q"); @@ -1011,7 +1011,7 @@ // If we do a plain-text completion in a macro, this should be repeated when we replay it. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqicompl\\ctrl- \\enter\\ctrl-cq"); kate_document->clear(); @@ -1022,7 +1022,7 @@ // Should replace only the current word when we repeat the completion. clearAllMacros(); BeginTest("compl"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqfla\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1033,7 +1033,7 @@ // Tail-clearing completions should be undoable with one undo. clearAllMacros(); BeginTest("compl"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqfla\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1044,7 +1044,7 @@ // Should be able to store multiple completions. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqicom\\ctrl-p\\enter com\\ctrl-p\\ctrl-p\\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1054,36 +1054,36 @@ // Clear the completions for a macro when we start recording. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionOrig"); + fakeCodeCompletionModel->setCompletions({ "completionOrig" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqicom\\ctrl- \\enter\\ctrl-cq"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionSecond"); + fakeCodeCompletionModel->setCompletions({ "completionSecond" }); TestPressKey("ddqqicom\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("dd@q"); FinishTest("completionSecond"); // Completions are per macro. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA"); + fakeCodeCompletionModel->setCompletions({ "completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qaicom\\ctrl- \\enter\\ctrl-cq"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionB"); + fakeCodeCompletionModel->setCompletions({ "completionB" }); TestPressKey("ddqbicom\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("dd@aA\\enter\\ctrl-c@b"); FinishTest("completionA\ncompletionB"); // Make sure completions work with recursive macros. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA1" << "completionA2"); + fakeCodeCompletionModel->setCompletions({ "completionA1", "completionA2" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); // Record 'a', which calls the (non-yet-existent) macro 'b'. TestPressKey("qaicom\\ctrl- \\enter\\ctrl-cA\\enter\\ctrl-c@bA\\enter\\ctrl-cicom\\ctrl- \\ctrl-p\\enter\\ctrl-cq"); // Clear document and record 'b'. - fakeCodeCompletionModel->setCompletions(QStringList() << "completionB"); + fakeCodeCompletionModel->setCompletions({ "completionB" }); TestPressKey("ggdGqbicom\\ctrl- \\enter\\ctrl-cq"); TestPressKey("dd@a"); FinishTest("completionA1\ncompletionB\ncompletionA2"); @@ -1098,7 +1098,7 @@ fakeCodeCompletionModel->setRemoveTailOnComplete(false); clearAllMacros(); BeginTest("compTail"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "completionB" << "completionC"); + fakeCodeCompletionModel->setCompletions({ "completionA", "completionB", "completionC" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqfTi\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1109,7 +1109,7 @@ // A "word" consists of letters & numbers, plus "_". clearAllMacros(); BeginTest("(123_compTail"); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqfTi\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1121,7 +1121,7 @@ KateViewConfig::global()->setWordCompletionRemoveTail(true); clearAllMacros(); BeginTest("(123_compTail)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(true); TestPressKey("qqfTi\\ctrl- \\enter\\ctrl-cq"); @@ -1133,7 +1133,7 @@ // Again, a "word" consists of letters & numbers & underscores. clearAllMacros(); BeginTest("(123_compTail_456)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(true); TestPressKey("qqfTi\\ctrl- \\enter\\ctrl-cq"); @@ -1146,7 +1146,7 @@ // completion occurred, not when we replay it. clearAllMacros(); BeginTest("(123_compTail_456)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(true); KateViewConfig::global()->setWordCompletionRemoveTail(true); @@ -1158,7 +1158,7 @@ FinishTest("(123_completionA)"); clearAllMacros(); BeginTest("(123_compTail_456)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(false); KateViewConfig::global()->setWordCompletionRemoveTail(false); @@ -1172,7 +1172,7 @@ // Can have remove-tail *and* non-remove-tail completions in one macro. clearAllMacros(); BeginTest("(123_compTail_456)\n(123_compTail_456)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(true); KateViewConfig::global()->setWordCompletionRemoveTail(true); @@ -1187,7 +1187,7 @@ // Can repeat plain-text completions when there is no word to the left of the cursor. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqi\\ctrl- \\enter\\ctrl-cq"); kate_document->clear(); @@ -1197,7 +1197,7 @@ // Shouldn't swallow the letter under the cursor if we're not swallowing tails. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(false); KateViewConfig::global()->setWordCompletionRemoveTail(false); @@ -1210,7 +1210,7 @@ // ... but do if we are swallowing tails. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "123_completionA"); + fakeCodeCompletionModel->setCompletions({ "123_completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); fakeCodeCompletionModel->setRemoveTailOnComplete(true); KateViewConfig::global()->setWordCompletionRemoveTail(true); @@ -1226,16 +1226,16 @@ KateViewConfig::global()->setWordCompletionRemoveTail(true); // A completed, no argument function "function()" is repeated correctly. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function()"); + fakeCodeCompletionModel->setCompletions({ "function()" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("dd@q"); FinishTest("function()"); // Cursor is placed after the closing bracket when completion a no-arg function. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function()"); + fakeCodeCompletionModel->setCompletions({ "function()" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enter.something();\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1245,7 +1245,7 @@ // A function taking some arguments, repeated where there is no opening bracket to // merge with, is repeated as "function()"). BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enter\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1255,7 +1255,7 @@ // A function taking some arguments, repeated where there is no opening bracket to // merge with, places the cursor after the opening bracket. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1266,7 +1266,7 @@ // with but repeated where there is no such bracket, is repeated as "function()" and the // cursor placed appropriately. BeginTest("(<-Mergeable opening bracket)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1277,7 +1277,7 @@ // with but repeated where there is such a bracket, is repeated as "function" and the // cursor moved to after the merged opening bracket. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1289,7 +1289,7 @@ // with and repeated where there is also such a bracket, is repeated as "function" and the // cursor moved to after the merged opening bracket. BeginTest("(<-mergeablebracket)"); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1300,7 +1300,7 @@ // The mergeable bracket can be separated by whitespace; the cursor is still placed after the // opening bracket. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1310,7 +1310,7 @@ // Whitespace only, though! BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1322,7 +1322,7 @@ // Note that this wouldn't be the case if we weren't swallowing tails when completion functions, // but this is not currently supported. BeginTest("function"); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqfta\\ctrl- \\enterfirstArg\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1333,23 +1333,23 @@ // Regression test for weird issue with replaying completions when the character to the left of the cursor // is not a word char. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA"); + fakeCodeCompletionModel->setCompletions({ "completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqciw\\ctrl- \\enter\\ctrl-cq"); TestPressKey("ddi.xyz\\enter123\\enter456\\ctrl-cggl"); // Position cursor just after the "." TestPressKey("@q"); FinishTest(".completionA\n123\n456"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA"); + fakeCodeCompletionModel->setCompletions({ "completionA" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqciw\\ctrl- \\enter\\ctrl-cq"); TestPressKey("ddi.xyz.abc\\enter123\\enter456\\ctrl-cggl"); // Position cursor just after the "." TestPressKey("@q"); FinishTest(".completionA.abc\n123\n456"); // Functions taking no arguments are never bracket-merged. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function()"); + fakeCodeCompletionModel->setCompletions({ "function()" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifunc\\ctrl- \\enter.something();\\ctrl-cq"); fakeCodeCompletionModel->setFailTestOnInvocation(true); @@ -1360,16 +1360,16 @@ // Not-removing-tail when completing functions is not currently supported, // so ignore the "do-not-remove-tail" settings when we try this. BeginTest("funct"); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...)"); + fakeCodeCompletionModel->setCompletions({ "function(...)" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); KateViewConfig::global()->setWordCompletionRemoveTail(false); TestPressKey("qqfta\\ctrl- \\enterfirstArg\\ctrl-cq"); kate_document->setText("functxyz"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("gg@q"); FinishTest("function(firstArg)"); BeginTest("funct"); - fakeCodeCompletionModel->setCompletions(QStringList() << "function()"); + fakeCodeCompletionModel->setCompletions({ "function()" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); KateViewConfig::global()->setWordCompletionRemoveTail(false); TestPressKey("qqfta\\ctrl- \\enter\\ctrl-cq"); @@ -1381,31 +1381,31 @@ // Deal with cases where completion ends with ";". BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function();"); + fakeCodeCompletionModel->setCompletions({ "function();" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enter\\ctrl-cq"); kate_document->clear(); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("gg@q"); FinishTest("function();"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function();"); + fakeCodeCompletionModel->setCompletions({ "function();" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enterX\\ctrl-cq"); kate_document->clear(); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("gg@q"); FinishTest("function();X"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...);"); + fakeCodeCompletionModel->setCompletions({ "function(...);" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enter\\ctrl-cq"); kate_document->clear(); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("gg@q"); FinishTest("function();"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...);"); + fakeCodeCompletionModel->setCompletions({ "function(...);" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enterX\\ctrl-cq"); kate_document->clear(); @@ -1415,24 +1415,24 @@ // Tests for completions ending in ";" where bracket merging should happen on replay. // NB: bracket merging when recording is impossible with completions that end in ";". BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...);"); + fakeCodeCompletionModel->setCompletions({ "function(...);" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enter\\ctrl-cq"); kate_document->setText("(<-mergeable bracket"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("gg@q"); FinishTest("function(<-mergeable bracket"); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function(...);"); + fakeCodeCompletionModel->setCompletions({ "function(...);" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enterX\\ctrl-cq"); kate_document->setText("(<-mergeable bracket"); fakeCodeCompletionModel->setFailTestOnInvocation(true); TestPressKey("gg@q"); FinishTest("function(X<-mergeable bracket"); // Don't merge no arg functions. BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "function();"); + fakeCodeCompletionModel->setCompletions({ "function();" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqifun\\ctrl- \\enterX\\ctrl-cq"); kate_document->setText("(<-mergeable bracket"); @@ -1446,7 +1446,7 @@ // Test loading and saving of macro completions. clearAllMacros(); BeginTest("funct\nnoa\ncomtail\ncomtail\ncom"); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionA" << "functionwithargs(...)" << "noargfunction()"); + fakeCodeCompletionModel->setCompletions({ "completionA", "functionwithargs(...)", "noargfunction()" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); // Record 'a'. TestPressKey("qafta\\ctrl- \\enterfirstArg\\ctrl-c"); // Function with args. @@ -1460,13 +1460,13 @@ fakeCodeCompletionModel->setRemoveTailOnComplete(true); KateViewConfig::global()->setWordCompletionRemoveTail(true); // Record 'b'. - fakeCodeCompletionModel->setCompletions(QStringList() << "completionB" << "semicolonfunctionnoargs();" << "semicolonfunctionwithargs(...);"); + fakeCodeCompletionModel->setCompletions({ "completionB", "semicolonfunctionnoargs();", "semicolonfunctionwithargs(...);" }); TestPressKey("\\enterqbea\\ctrl- \\enter\\ctrl-cosemicolonfunctionw\\ctrl- \\enterX\\ctrl-cosemicolonfunctionn\\ctrl- \\enterX\\ctrl-cq"); // Save. vi_global->writeConfig(&viTestKConfig); viTestKConfig.sync(); // Overwrite 'a' and 'b' and their completions. - fakeCodeCompletionModel->setCompletions(QStringList() << "blah1"); + fakeCodeCompletionModel->setCompletions({ "blah1" }); kate_document->setText(""); TestPressKey("ggqaiblah\\ctrl- \\enter\\ctrl-cq"); TestPressKey("ddqbiblah\\ctrl- \\enter\\ctrl-cq"); @@ -1501,7 +1501,7 @@ // Ensure that the last change completions log is kept up to date even while we're replaying the macro. clearAllMacros(); BeginTest(""); - fakeCodeCompletionModel->setCompletions(QStringList() << "completionMacro" << "completionRepeatLastChange"); + fakeCodeCompletionModel->setCompletions({ "completionMacro", "completionRepeatLastChange" }); fakeCodeCompletionModel->setFailTestOnInvocation(false); TestPressKey("qqicompletionM\\ctrl- \\enter\\ctrl-c"); TestPressKey("a completionRep\\ctrl- \\enter\\ctrl-c"); diff --git a/src/dialogs/katedialogs.h b/src/dialogs/katedialogs.h --- a/src/dialogs/katedialogs.h +++ b/src/dialogs/katedialogs.h @@ -37,7 +37,6 @@ #include #include -#include #include #include #include diff --git a/src/dialogs/katedialogs.cpp b/src/dialogs/katedialogs.cpp --- a/src/dialogs/katedialogs.cpp +++ b/src/dialogs/katedialogs.cpp @@ -1062,7 +1062,7 @@ list = new QTreeWidget(this); list->setColumnCount(4); - list->setHeaderLabels(QStringList() << QString() << i18n("Name") << i18n("Installed") << i18n("Latest")); + list->setHeaderLabels({ QString(), i18n("Name"), i18n("Installed"), i18n("Latest") }); list->setSelectionMode(QAbstractItemView::MultiSelection); list->setAllColumnsShowFocus(true); list->setRootIsDecorated(false); diff --git a/src/document/editorconfig.cpp b/src/document/editorconfig.cpp --- a/src/document/editorconfig.cpp +++ b/src/document/editorconfig.cpp @@ -27,13 +27,13 @@ static bool checkBoolValue(QString val, bool *result) { val = val.trimmed().toLower(); - static const QStringList trueValues = QStringList() << QStringLiteral("1") << QStringLiteral("on") << QStringLiteral("true"); + static const QStringList trueValues { QStringLiteral("1"), QStringLiteral("on"), QStringLiteral("true") }; if (trueValues.contains(val)) { *result = true; return true; } - static const QStringList falseValues = QStringList() << QStringLiteral("0") << QStringLiteral("off") << QStringLiteral("false"); + static const QStringList falseValues { QStringLiteral("0"), QStringLiteral("off"), QStringLiteral("false") }; if (falseValues.contains(val)) { *result = false; return true; diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp --- a/src/document/katedocument.cpp +++ b/src/document/katedocument.cpp @@ -4514,19 +4514,29 @@ return; } - QStringList vvl; // view variable names - vvl << QStringLiteral("dynamic-word-wrap") << QStringLiteral("dynamic-word-wrap-indicators") - << QStringLiteral("line-numbers") << QStringLiteral("icon-border") << QStringLiteral("folding-markers") - << QStringLiteral("folding-preview") - << QStringLiteral("bookmark-sorting") << QStringLiteral("auto-center-lines") - << QStringLiteral("icon-bar-color") - << QStringLiteral("scrollbar-minimap") - << QStringLiteral("scrollbar-preview") + // view variable names + static const QStringList vvl { + QStringLiteral("dynamic-word-wrap") + , QStringLiteral("dynamic-word-wrap-indicators") + , QStringLiteral("line-numbers") + , QStringLiteral("icon-border") + , QStringLiteral("folding-markers") + , QStringLiteral("folding-preview") + , QStringLiteral("bookmark-sorting") + , QStringLiteral("auto-center-lines") + , QStringLiteral("icon-bar-color") + , QStringLiteral("scrollbar-minimap") + , QStringLiteral("scrollbar-preview") // renderer - << QStringLiteral("background-color") << QStringLiteral("selection-color") - << QStringLiteral("current-line-color") << QStringLiteral("bracket-highlight-color") - << QStringLiteral("word-wrap-marker-color") - << QStringLiteral("font") << QStringLiteral("font-size") << QStringLiteral("scheme"); + , QStringLiteral("background-color") + , QStringLiteral("selection-color") + , QStringLiteral("current-line-color") + , QStringLiteral("bracket-highlight-color") + , QStringLiteral("word-wrap-marker-color") + , QStringLiteral("font") + , QStringLiteral("font-size") + , QStringLiteral("scheme") + }; int spaceIndent = -1; // for backward compatibility; see below bool replaceTabsSet = false; int startPos(0); @@ -4600,8 +4610,7 @@ // STRING SETTINGS else if (var == QLatin1String("eol") || var == QLatin1String("end-of-line")) { - QStringList l; - l << QStringLiteral("unix") << QStringLiteral("dos") << QStringLiteral("mac"); + const QStringList l{ QStringLiteral("unix"), QStringLiteral("dos"), QStringLiteral("mac") }; if ((n = l.indexOf(val.toLower())) != -1) { /** * set eol + avoid that it is overwritten by auto-detection again! @@ -4721,13 +4730,13 @@ bool KTextEditor::DocumentPrivate::checkBoolValue(QString val, bool *result) { val = val.trimmed().toLower(); - static const QStringList trueValues = QStringList() << QStringLiteral("1") << QStringLiteral("on") << QStringLiteral("true"); + static const QStringList trueValues{ QStringLiteral("1"), QStringLiteral("on"), QStringLiteral("true") }; if (trueValues.contains(val)) { *result = true; return true; } - static const QStringList falseValues = QStringList() << QStringLiteral("0") << QStringLiteral("off") << QStringLiteral("false"); + static const QStringList falseValues{ QStringLiteral("0"), QStringLiteral("off"), QStringLiteral("false") }; if (falseValues.contains(val)) { *result = false; return true; diff --git a/src/mode/katemodeconfigpage.h b/src/mode/katemodeconfigpage.h --- a/src/mode/katemodeconfigpage.h +++ b/src/mode/katemodeconfigpage.h @@ -21,7 +21,6 @@ #ifndef KATE_MODECONFIGPAGE_H__ #define KATE_MODECONFIGPAGE_H__ -#include #include #include diff --git a/src/script/katescriptmanager.cpp b/src/script/katescriptmanager.cpp --- a/src/script/katescriptmanager.cpp +++ b/src/script/katescriptmanager.cpp @@ -45,7 +45,7 @@ KateScriptManager *KateScriptManager::m_instance = nullptr; KateScriptManager::KateScriptManager() - : KTextEditor::Command(QStringList() << QStringLiteral("reload-scripts")) + : KTextEditor::Command({ QStringLiteral("reload-scripts") }) { // use cached info collect(); @@ -116,7 +116,7 @@ /** * now, we search all kinds of known scripts */ - foreach (const QString &type, QStringList() << QLatin1String("indentation") << QLatin1String("commands")) { + for (const QString type : { QLatin1String("indentation"), QLatin1String("commands") }) { // basedir for filesystem lookup const QString basedir = QLatin1String("/katepart5/script/") + type; @@ -136,7 +136,7 @@ QStringList list; foreach (const QString &dir, dirs) { - const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.js")); + const QStringList fileNames = QDir(dir).entryList({ QStringLiteral("*.js") }); foreach (const QString &file, fileNames) { list.append(dir + QLatin1Char('/') + file); } diff --git a/src/syntax/katehighlightingcmds.h b/src/syntax/katehighlightingcmds.h --- a/src/syntax/katehighlightingcmds.h +++ b/src/syntax/katehighlightingcmds.h @@ -29,7 +29,7 @@ class Highlighting : public KTextEditor::Command { Highlighting() - : KTextEditor::Command(QStringList() << QStringLiteral("reload-highlighting") << QStringLiteral("edit-highlighting")) + : KTextEditor::Command({ QStringLiteral("reload-highlighting"), QStringLiteral("edit-highlighting") }) { } diff --git a/src/utils/katecmds.h b/src/utils/katecmds.h --- a/src/utils/katecmds.h +++ b/src/utils/katecmds.h @@ -45,19 +45,38 @@ class CoreCommands : public KTextEditor::Command { CoreCommands() - : KTextEditor::Command(QStringList() << QStringLiteral("indent") << QStringLiteral("unindent") << QStringLiteral("cleanindent") << QStringLiteral("fold") << QStringLiteral("tfold") << QStringLiteral("unfold") - << QStringLiteral("comment") << QStringLiteral("uncomment") << QStringLiteral("goto") << QStringLiteral("kill-line") - << QStringLiteral("set-tab-width") << QStringLiteral("set-replace-tabs") << QStringLiteral("set-show-tabs") - << QStringLiteral("set-indent-width") - << QStringLiteral("set-indent-mode") << QStringLiteral("set-auto-indent") - << QStringLiteral("set-line-numbers") << QStringLiteral("set-folding-markers") << QStringLiteral("set-icon-border") - << QStringLiteral("set-indent-pasted-text") << QStringLiteral("set-word-wrap") << QStringLiteral("set-word-wrap-column") - << QStringLiteral("set-replace-tabs-save") << QStringLiteral("set-remove-trailing-spaces") - << QStringLiteral("set-highlight") << QStringLiteral("set-mode") << QStringLiteral("set-show-indent") - << QStringLiteral("print")) + : KTextEditor::Command({ + QStringLiteral("indent") + , QStringLiteral("unindent") + , QStringLiteral("cleanindent") + , QStringLiteral("fold") + , QStringLiteral("tfold") + , QStringLiteral("unfold") + , QStringLiteral("comment") + , QStringLiteral("uncomment") + , QStringLiteral("goto") + , QStringLiteral("kill-line") + , QStringLiteral("set-tab-width") + , QStringLiteral("set-replace-tabs") + , QStringLiteral("set-show-tabs") + , QStringLiteral("set-indent-width") + , QStringLiteral("set-indent-mode") + , QStringLiteral("set-auto-indent") + , QStringLiteral("set-line-numbers") + , QStringLiteral("set-folding-markers") + , QStringLiteral("set-icon-border") + , QStringLiteral("set-indent-pasted-text") + , QStringLiteral("set-word-wrap") + , QStringLiteral("set-word-wrap-column") + , QStringLiteral("set-replace-tabs-save") + , QStringLiteral("set-remove-trailing-spaces") + , QStringLiteral("set-highlight") + , QStringLiteral("set-mode") + , QStringLiteral("set-show-indent") + , QStringLiteral("print") }) { } - + static CoreCommands *m_instance; public: @@ -114,7 +133,7 @@ class Character : public KTextEditor::Command { Character() - : KTextEditor::Command(QStringList() << QStringLiteral("char")) + : KTextEditor::Command({ QStringLiteral("char") }) { } @@ -154,7 +173,7 @@ class Date : public KTextEditor::Command { Date() - : KTextEditor::Command(QStringList() << QStringLiteral("date")) + : KTextEditor::Command({ QStringLiteral("date") }) { } diff --git a/src/utils/katesedcmd.h b/src/utils/katesedcmd.h --- a/src/utils/katesedcmd.h +++ b/src/utils/katesedcmd.h @@ -50,7 +50,7 @@ static SedReplace *m_instance; protected: - SedReplace() : KTextEditor::Command(QStringList() << QStringLiteral("s") << QStringLiteral("%s") << QStringLiteral("$s")) + SedReplace() : KTextEditor::Command({ QStringLiteral("s"), QStringLiteral("%s"), QStringLiteral("$s") }) { } diff --git a/src/variableeditor/variablelineedit.cpp b/src/variableeditor/variablelineedit.cpp --- a/src/variableeditor/variablelineedit.cpp +++ b/src/variableeditor/variablelineedit.cpp @@ -186,7 +186,7 @@ listview->addItem(item); // Add 'end-of-line' (eol) to list - item = new VariableStringListItem(QStringLiteral("end-of-line"), QStringList() << QStringLiteral("unix") << QStringLiteral("mac") << QStringLiteral("dos"), docConfig->eolString()); + item = new VariableStringListItem(QStringLiteral("end-of-line"), { QStringLiteral("unix"), QStringLiteral("mac"), QStringLiteral("dos") }, docConfig->eolString()); item->setHelpText(i18nc("short translation please", "Sets the end of line mode.")); listview->addItem(item); diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp --- a/src/view/kateview.cpp +++ b/src/view/kateview.cpp @@ -699,10 +699,7 @@ a->setWhatsThis(i18n("Choose when the Dynamic Word Wrap Indicators should be displayed")); connect(m_setDynWrapIndicators, SIGNAL(triggered(int)), this, SLOT(setDynWrapIndicators(int))); - QStringList list2; - list2.append(i18n("&Off")); - list2.append(i18n("Follow &Line Numbers")); - list2.append(i18n("&Always On")); + const QStringList list2{ i18n("&Off"), i18n("Follow &Line Numbers"), i18n("&Always On") }; m_setDynWrapIndicators->setItems(list2); m_setDynWrapIndicators->setEnabled(m_toggleDynWrap->isChecked()); // only synced on real change, later @@ -783,10 +780,11 @@ a = m_setEndOfLine = new KSelectAction(i18n("&End of Line"), this); ac->addAction(QStringLiteral("set_eol"), a); a->setWhatsThis(i18n("Choose which line endings should be used, when you save the document")); - QStringList list; - list.append(i18nc("@item:inmenu End of Line", "&UNIX")); - list.append(i18nc("@item:inmenu End of Line", "&Windows/DOS")); - list.append(i18nc("@item:inmenu End of Line", "&Macintosh")); + const QStringList list { + i18nc("@item:inmenu End of Line", "&UNIX") + , i18nc("@item:inmenu End of Line", "&Windows/DOS") + , i18nc("@item:inmenu End of Line", "&Macintosh") + }; m_setEndOfLine->setItems(list); m_setEndOfLine->setCurrentItem(m_doc->config()->eol()); connect(m_setEndOfLine, SIGNAL(triggered(int)), this, SLOT(setEol(int))); @@ -1384,24 +1382,24 @@ m_pasteMenu->setEnabled(m_doc->isReadWrite() && !KTextEditor::EditorPrivate::self()->clipboardHistory().isEmpty()); m_setEndOfLine->setEnabled(m_doc->isReadWrite()); - QStringList l; - - l << QStringLiteral("edit_replace") - << QStringLiteral("tools_spelling") - << QStringLiteral("tools_indent") - << QStringLiteral("tools_unindent") - << QStringLiteral("tools_cleanIndent") - << QStringLiteral("tools_align") - << QStringLiteral("tools_comment") - << QStringLiteral("tools_uncomment") - << QStringLiteral("tools_toggle_comment") - << QStringLiteral("tools_uppercase") - << QStringLiteral("tools_lowercase") - << QStringLiteral("tools_capitalize") - << QStringLiteral("tools_join_lines") - << QStringLiteral("tools_apply_wordwrap") - << QStringLiteral("tools_spelling_from_cursor") - << QStringLiteral("tools_spelling_selection"); + static const QStringList l { + QStringLiteral("edit_replace") + , QStringLiteral("tools_spelling") + , QStringLiteral("tools_indent") + , QStringLiteral("tools_unindent") + , QStringLiteral("tools_cleanIndent") + , QStringLiteral("tools_align") + , QStringLiteral("tools_comment") + , QStringLiteral("tools_uncomment") + , QStringLiteral("tools_toggle_comment") + , QStringLiteral("tools_uppercase") + , QStringLiteral("tools_lowercase") + , QStringLiteral("tools_capitalize") + , QStringLiteral("tools_join_lines") + , QStringLiteral("tools_apply_wordwrap") + , QStringLiteral("tools_spelling_from_cursor") + , QStringLiteral("tools_spelling_selection") + }; foreach (const QString &action, l) { QAction *a = actionCollection()->action(action); @@ -1948,10 +1946,12 @@ #if 0 // FIXME: FOLDING - QStringList l; - - l << "folding_toplevel" << "folding_expandtoplevel" - << "folding_collapselocal" << "folding_expandlocal"; + const QStringList l { + QStringLiteral("folding_toplevel") + , QStringLiteral("folding_expandtoplevel") + , QStringLiteral("folding_collapselocal") + , QStringLiteral("folding_expandlocal") + }; QAction *a = 0; for (int z = 0; z < l.size(); z++) diff --git a/src/vimode/appcommands.cpp b/src/vimode/appcommands.cpp --- a/src/vimode/appcommands.cpp +++ b/src/vimode/appcommands.cpp @@ -36,11 +36,11 @@ AppCommands *AppCommands::m_instance = nullptr; AppCommands::AppCommands() - : KTextEditor::Command(QStringList() << QStringLiteral("q") << QStringLiteral("qa") << QStringLiteral("qall") << QStringLiteral("q!") << QStringLiteral("qa!") << QStringLiteral("qall!") - << QStringLiteral("w") << QStringLiteral("wq") << QStringLiteral("wa") << QStringLiteral("wqa") << QStringLiteral("x") << QStringLiteral("xa") << QStringLiteral("new") - << QStringLiteral("vnew") << QStringLiteral("e") << QStringLiteral("edit") << QStringLiteral("enew") << QStringLiteral("sp") << QStringLiteral("split") << QStringLiteral("vs") - << QStringLiteral("vsplit") << QStringLiteral("only") << QStringLiteral("tabe") << QStringLiteral("tabedit") << QStringLiteral("tabnew") << QStringLiteral("bd") - << QStringLiteral("bdelete") << QStringLiteral("tabc") << QStringLiteral("tabclose") << QStringLiteral("clo") << QStringLiteral("close")) + : KTextEditor::Command({ QStringLiteral("q"), QStringLiteral("qa"), QStringLiteral("qall"), QStringLiteral("q!"), QStringLiteral("qa!"), QStringLiteral("qall!") + , QStringLiteral("w"), QStringLiteral("wq"), QStringLiteral("wa"), QStringLiteral("wqa"), QStringLiteral("x"), QStringLiteral("xa"), QStringLiteral("new") + , QStringLiteral("vnew"), QStringLiteral("e"), QStringLiteral("edit"), QStringLiteral("enew"), QStringLiteral("sp"), QStringLiteral("split"), QStringLiteral("vs") + , QStringLiteral("vsplit"), QStringLiteral("only"), QStringLiteral("tabe"), QStringLiteral("tabedit"), QStringLiteral("tabnew"), QStringLiteral("bd") + , QStringLiteral("bdelete"), QStringLiteral("tabc"), QStringLiteral("tabclose"), QStringLiteral("clo"), QStringLiteral("close") }) { re_write.setPattern(QStringLiteral("w(a)?")); re_close.setPattern(QStringLiteral("bd(elete)?|tabc(lose)?")); @@ -330,12 +330,12 @@ BufferCommands *BufferCommands::m_instance = nullptr; BufferCommands::BufferCommands() - : KTextEditor::Command(QStringList() << QStringLiteral("ls") - << QStringLiteral("b") << QStringLiteral("buffer") - << QStringLiteral("bn") << QStringLiteral("bnext") << QStringLiteral("bp") << QStringLiteral("bprevious") - << QStringLiteral("tabn") << QStringLiteral("tabnext") << QStringLiteral("tabp") << QStringLiteral("tabprevious") - << QStringLiteral("bf") << QStringLiteral("bfirst") << QStringLiteral("bl") << QStringLiteral("blast") - << QStringLiteral("tabf") << QStringLiteral("tabfirst") << QStringLiteral("tabl") << QStringLiteral("tablast")) + : KTextEditor::Command({ QStringLiteral("ls") + , QStringLiteral("b"), QStringLiteral("buffer") + , QStringLiteral("bn"), QStringLiteral("bnext"), QStringLiteral("bp"), QStringLiteral("bprevious") + , QStringLiteral("tabn"), QStringLiteral("tabnext"), QStringLiteral("tabp"), QStringLiteral("tabprevious") + , QStringLiteral("bf"), QStringLiteral("bfirst"), QStringLiteral("bl"), QStringLiteral("blast") + , QStringLiteral("tabf"), QStringLiteral("tabfirst"), QStringLiteral("tabl"), QStringLiteral("tablast")}) { }