diff --git a/analyzers/cppcheck/parameters.cpp b/analyzers/cppcheck/parameters.cpp --- a/analyzers/cppcheck/parameters.cpp +++ b/analyzers/cppcheck/parameters.cpp @@ -204,12 +204,12 @@ if (m_project && useProjectIncludes) { QList ignored; - foreach (QString element, applyPlaceholders(ignoredIncludes).split(';')) { + foreach (const QString& element, applyPlaceholders(ignoredIncludes).split(';')) { if (!element.trimmed().isEmpty()) ignored.append(KDevelop::Path(element)); } - foreach (auto dir, m_includeDirectories) { + foreach (const auto& dir, m_includeDirectories) { if (ignored.contains(dir)) continue; diff --git a/analyzers/cppcheck/plugin.cpp b/analyzers/cppcheck/plugin.cpp --- a/analyzers/cppcheck/plugin.cpp +++ b/analyzers/cppcheck/plugin.cpp @@ -300,18 +300,12 @@ KDevelop::ConfigPage* Plugin::perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) { - if (number) - return nullptr; - else - return new ProjectConfigPage(this, options.project, parent); + return number ? nullptr : new ProjectConfigPage(this, options.project, parent); } KDevelop::ConfigPage* Plugin::configPage(int number, QWidget* parent) { - if (number) - return nullptr; - else - return new GlobalConfigPage(this, parent); + return number ? nullptr : new GlobalConfigPage(this, parent); } } diff --git a/app/main.cpp b/app/main.cpp --- a/app/main.cpp +++ b/app/main.cpp @@ -120,10 +120,7 @@ : QApplication(argc, argv, GUIenabled) #endif { -#if KDEVELOP_SINGLE_APP Q_UNUSED(GUIenabled); -#endif - connect(this, &QGuiApplication::saveStateRequest, this, &KDevelopApplication::saveState); } @@ -166,7 +163,7 @@ } QString kdevelopSessionId = activeSession->id().toString(); - sm.setRestartCommand(QStringList() << QCoreApplication::applicationFilePath() << "-session" << x11SessionId << "-s" << kdevelopSessionId); + sm.setRestartCommand({QCoreApplication::applicationFilePath(), "-session", x11SessionId, "-s", kdevelopSessionId}); } } }; @@ -658,29 +655,27 @@ } QStringList projectNames = parser.values("project"); - if(!projectNames.isEmpty()) + foreach(const QString& projectName, projectNames) { - foreach(const QString& p, projectNames) - { - QFileInfo info( p ); - if( info.suffix() == "kdev4" ) { - // make sure the project is not already opened by the session controller - bool shouldOpen = true; - Path path(info.absoluteFilePath()); - foreach(KDevelop::IProject* p, core->projectController()->projects()) { - if (p->projectFile() == path) { - shouldOpen = false; - break; - } - } - if (shouldOpen) { - core->projectController()->openProject( path.toUrl() ); + QFileInfo info( projectName ); + if( info.suffix() == "kdev4" ) { + // make sure the project is not already opened by the session controller + bool shouldOpen = true; + Path path(info.absoluteFilePath()); + foreach(KDevelop::IProject* project, core->projectController()->projects()) { + if (project->projectFile() == path) { + shouldOpen = false; + break; } } + if (shouldOpen) { + core->projectController()->openProject( path.toUrl() ); + } } } - if ( parser.isSet("debug") ) { + const QString debugStr = QStringLiteral("debug"); + if ( parser.isSet(debugStr) ) { Q_ASSERT( !debugeeName.isEmpty() ); QString launchName = debugeeName; @@ -708,21 +703,21 @@ } if (launch && launch->type()->id() != "Native Application") launch = nullptr; - if (launch && launch->launcherForMode("debug") != parser.value("debug")) launch = nullptr; + if (launch && launch->launcherForMode(debugStr) != parser.value(debugStr)) launch = nullptr; if (!launch) { qCDebug(APP) << launchName << "not found, creating a new one"; QPair launcher; - launcher.first = "debug"; + launcher.first = debugStr; foreach (KDevelop::ILauncher *l, type->launchers()) { - if (l->id() == parser.value("debug")) { - if (l->supportedModes().contains("debug")) { + if (l->id() == parser.value(debugStr)) { + if (l->supportedModes().contains(debugStr)) { launcher.second = l->id(); } } } if (launcher.second.isEmpty()) { QTextStream qerr(stderr); - qerr << endl << i18n("Cannot find launcher %1", parser.value("debug")) << endl; + qerr << endl << i18n("Cannot find launcher %1", parser.value(debugStr)) << endl; return 1; } KDevelop::ILaunchConfiguration* ilaunch = core->runController()->createLaunchConfiguration(type, launcher, nullptr, launchName); @@ -733,7 +728,7 @@ launch->config().writeEntry("Break on Start", true); core->runControllerInternal()->setDefaultLaunch(launch); - core->runControllerInternal()->execute("debug", launch); + core->runControllerInternal()->execute(debugStr, launch); } else { openFiles(initialFiles); }