diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-10-24 10:50:33 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-11-16 15:11:15 +0000 |
commit | 4432ba4949647917d0fc3fb2ef73f9737a7c2431 (patch) | |
tree | e36f48e90f7019ad0ecfb7046638cebf3410930e /src/app | |
parent | a0c61e70eeefbf9d6c632a94d29bcc2a7e97b7d7 (diff) |
STL compatibility: use empty() instead of isEmpty()
This is a simple find and replace with manual sanity check.
Change-Id: Iab6d46dcc3be246d1650aae2b1730f933b717be8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/config-ui/commandlineparser.cpp | 8 | ||||
-rw-r--r-- | src/app/config/configcommandexecutor.cpp | 2 | ||||
-rw-r--r-- | src/app/config/configcommandlineparser.cpp | 10 | ||||
-rw-r--r-- | src/app/qbs-create-project/createproject.cpp | 6 | ||||
-rw-r--r-- | src/app/qbs-setup-android/android-setup.cpp | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-android/commandlineparser.cpp | 10 | ||||
-rw-r--r-- | src/app/qbs-setup-qt/commandlineparser.cpp | 10 | ||||
-rw-r--r-- | src/app/qbs-setup-qt/main.cpp | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-qt/setupqt.cpp | 8 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/commandlineparser.cpp | 10 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/probe.cpp | 2 | ||||
-rw-r--r-- | src/app/qbs/commandlinefrontend.cpp | 30 | ||||
-rw-r--r-- | src/app/qbs/main.cpp | 2 | ||||
-rw-r--r-- | src/app/qbs/parser/commandlineoption.cpp | 8 | ||||
-rw-r--r-- | src/app/qbs/parser/commandlineparser.cpp | 4 | ||||
-rw-r--r-- | src/app/qbs/parser/parsercommand.cpp | 2 |
16 files changed, 60 insertions, 60 deletions
diff --git a/src/app/config-ui/commandlineparser.cpp b/src/app/config-ui/commandlineparser.cpp index 5c5606442..b05d84343 100644 --- a/src/app/config-ui/commandlineparser.cpp +++ b/src/app/config-ui/commandlineparser.cpp @@ -52,12 +52,12 @@ static QString settingsDirOption() { return QLatin1String("--settings-dir"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; - Q_ASSERT(!m_commandLine.isEmpty()); + Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_settingsDir.clear(); - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) return; const QString &arg = m_commandLine.front(); if (arg == helpOptionShort() || arg == helpOptionLong()) { @@ -68,7 +68,7 @@ void CommandLineParser::parse(const QStringList &commandLine) assignOptionArgument(settingsDirOption(), m_settingsDir); } - if (!m_commandLine.isEmpty()) + if (!m_commandLine.empty()) complainAboutExtraArguments(); } @@ -92,7 +92,7 @@ QString CommandLineParser::usageString() const void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) diff --git a/src/app/config/configcommandexecutor.cpp b/src/app/config/configcommandexecutor.cpp index a8ae28f66..c95b43f18 100644 --- a/src/app/config/configcommandexecutor.cpp +++ b/src/app/config/configcommandexecutor.cpp @@ -93,7 +93,7 @@ void ConfigCommandExecutor::setValue(const QString &key, const QString &rawInput void ConfigCommandExecutor::printSettings(const ConfigCommand &command) { - if (command.varNames.isEmpty()) { + if (command.varNames.empty()) { foreach (const QString &key, m_settings->allKeys()) printOneSetting(key); } else { diff --git a/src/app/config/configcommandlineparser.cpp b/src/app/config/configcommandlineparser.cpp index dd6262543..46a354939 100644 --- a/src/app/config/configcommandlineparser.cpp +++ b/src/app/config/configcommandlineparser.cpp @@ -53,7 +53,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) m_settingsDir.clear(); m_commandLine = commandLine; - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throw ErrorInfo(Tr::tr("No parameters supplied.")); if (m_commandLine.size() == 1 && (m_commandLine.front() == QLatin1String("--help") || m_commandLine.front() == QLatin1String("-h"))) { @@ -61,7 +61,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) return; } - while (!m_commandLine.isEmpty() && m_commandLine.front().startsWith(QLatin1String("--"))) { + while (!m_commandLine.empty() && m_commandLine.front().startsWith(QLatin1String("--"))) { const QString arg = m_commandLine.takeFirst().mid(2); if (arg == QLatin1String("list")) setCommand(ConfigCommand::CfgList); @@ -79,7 +79,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) switch (command().command) { case ConfigCommand::CfgNone: - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throw ErrorInfo(Tr::tr("No parameters supplied.")); if (m_commandLine.size() > 2) throw ErrorInfo(Tr::tr("Too many arguments.")); @@ -92,7 +92,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) } break; case ConfigCommand::CfgUnset: - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throw ErrorInfo(Tr::tr("Need name of variable to unset.")); m_command.varNames = m_commandLine; break; @@ -137,7 +137,7 @@ void ConfigCommandLineParser::printUsage() const void ConfigCommandLineParser::assignOptionArgument(const QString &option, QString &argument) { - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throw ErrorInfo(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) diff --git a/src/app/qbs-create-project/createproject.cpp b/src/app/qbs-create-project/createproject.cpp index 8f07b95b3..850eacb2e 100644 --- a/src/app/qbs-create-project/createproject.cpp +++ b/src/app/qbs-create-project/createproject.cpp @@ -85,7 +85,7 @@ void ProjectCreator::setupProject(Project *project) subProject->dirName = dit.fileName(); subProject->dirPath = dit.filePath(); setupProject(subProject.get()); - if (!subProject->fileNames.isEmpty() || !subProject->subProjects.empty()) + if (!subProject->fileNames.empty() || !subProject->subProjects.empty()) project->subProjects.push_back(std::move(subProject)); } } @@ -105,7 +105,7 @@ void ProjectCreator::serializeProject(const ProjectCreator::Project &project) QTextStream fileContents(&projectFile); fileContents.setCodec("UTF-8"); fileContents << "import qbs\n\n"; - if (!project.fileNames.isEmpty() || m_projectStructure == ProjectStructure::Flat) { + if (!project.fileNames.empty() || m_projectStructure == ProjectStructure::Flat) { fileContents << "Product {\n"; const ProductFlags productFlags = getFlags(project); if (productFlags.testFlag(IsApp)) { @@ -164,7 +164,7 @@ bool ProjectCreator::isSourceFile(const QString &fileName) { const auto isMatch = [fileName](const QRegExp &rex) { return rex.exactMatch(fileName); }; return !std::any_of(m_blackList.cbegin(), m_blackList.cend(), isMatch) - && (m_whiteList.isEmpty() + && (m_whiteList.empty() || std::any_of(m_whiteList.cbegin(), m_whiteList.cend(), isMatch)); } diff --git a/src/app/qbs-setup-android/android-setup.cpp b/src/app/qbs-setup-android/android-setup.cpp index e5ad9e845..7a749f374 100644 --- a/src/app/qbs-setup-android/android-setup.cpp +++ b/src/app/qbs-setup-android/android-setup.cpp @@ -198,7 +198,7 @@ static void setupNdk(qbs::Settings *settings, const QString &profileName, const mainProfile.setValue(qls("qbs.toolchain"), QStringList() << qls("gcc")); const QStringList archs = expectedArchs(); const QtInfoPerArch infoPerArch = getQtAndroidInfo(qtSdkDirPath); - mainProfile.setValue(qls("qbs.architectures"), infoPerArch.isEmpty() + mainProfile.setValue(qls("qbs.architectures"), infoPerArch.empty() ? archs : QStringList(infoPerArch.keys())); QStringList searchPaths; QString platform; @@ -227,7 +227,7 @@ static void setupNdk(qbs::Settings *settings, const QString &profileName, const searchPaths << p.p.value(qls("preferences.qbsSearchPaths")).toStringList(); platform = maximumPlatform(platform, qtAndroidInfo.platform); } - if (!searchPaths.isEmpty()) + if (!searchPaths.empty()) mainProfile.setValue(qls("preferences.qbsSearchPaths"), searchPaths); if (!platform.isEmpty()) mainProfile.setValue(qls("Android.ndk.platform"), platform); diff --git a/src/app/qbs-setup-android/commandlineparser.cpp b/src/app/qbs-setup-android/commandlineparser.cpp index 174016480..1bdf2188b 100644 --- a/src/app/qbs-setup-android/commandlineparser.cpp +++ b/src/app/qbs-setup-android/commandlineparser.cpp @@ -60,7 +60,7 @@ static QString qtSdkDirOption() { return QLatin1String("--qt-dir"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; - Q_ASSERT(!m_commandLine.isEmpty()); + Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_sdkDir.clear(); @@ -68,10 +68,10 @@ void CommandLineParser::parse(const QStringList &commandLine) m_profileName.clear(); m_settingsDir.clear(); - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("No command-line arguments provided.")); - while (!m_commandLine.isEmpty()) { + while (!m_commandLine.empty()) { const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; @@ -89,7 +89,7 @@ void CommandLineParser::parse(const QStringList &commandLine) } if (m_helpRequested) { - if (!m_commandLine.isEmpty()) + if (!m_commandLine.empty()) complainAboutExtraArguments(); return; } @@ -129,7 +129,7 @@ QString CommandLineParser::usageString() const void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) diff --git a/src/app/qbs-setup-qt/commandlineparser.cpp b/src/app/qbs-setup-qt/commandlineparser.cpp index 0f842e7b2..2559e0c0b 100644 --- a/src/app/qbs-setup-qt/commandlineparser.cpp +++ b/src/app/qbs-setup-qt/commandlineparser.cpp @@ -53,7 +53,7 @@ static QString settingsDirOption() { return QLatin1String("--settings-dir"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; - Q_ASSERT(!m_commandLine.isEmpty()); + Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_autoDetectionMode = false; @@ -61,10 +61,10 @@ void CommandLineParser::parse(const QStringList &commandLine) m_profileName.clear(); m_settingsDir.clear(); - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("No command-line arguments provided.")); - while (!m_commandLine.isEmpty()) { + while (!m_commandLine.empty()) { const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; @@ -78,7 +78,7 @@ void CommandLineParser::parse(const QStringList &commandLine) } if (m_helpRequested || m_autoDetectionMode) { - if (!m_commandLine.isEmpty()) + if (!m_commandLine.empty()) complainAboutExtraArguments(); return; } @@ -120,7 +120,7 @@ QString CommandLineParser::usageString() const void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) diff --git a/src/app/qbs-setup-qt/main.cpp b/src/app/qbs-setup-qt/main.cpp index f74b7f4c7..92405ab07 100644 --- a/src/app/qbs-setup-qt/main.cpp +++ b/src/app/qbs-setup-qt/main.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) if (clParser.autoDetectionMode()) { // search all Qt's in path and dump their settings QList<QtEnvironment> qtEnvironments = SetupQt::fetchEnvironments(); - if (qtEnvironments.isEmpty()) { + if (qtEnvironments.empty()) { std::cout << qPrintable(Tr::tr("No Qt installations detected. " "No profiles created.")) << std::endl; @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) if (SetupQt::checkIfMoreThanOneQtWithTheSameVersion(qtEnvironment.qtVersion, qtEnvironments)) { QStringList prefixPathParts = qtEnvironment.installPrefixPath .split(QLatin1Char('/'), QString::SkipEmptyParts); - if (!prefixPathParts.isEmpty()) + if (!prefixPathParts.empty()) profileName += QLatin1String("-") + prefixPathParts.last(); } SetupQt::saveToQbsSettings(profileName, qtEnvironment, &settings); diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp index 5a938bc5e..1687f311c 100644 --- a/src/app/qbs-setup-qt/setupqt.cpp +++ b/src/app/qbs-setup-qt/setupqt.cpp @@ -367,7 +367,7 @@ template <typename T> bool areProfilePropertiesIncompatible(const T &set1, const { // Two objects are only considered incompatible if they are both non empty and compare inequal // This logic is used for comparing target OS, toolchain lists, and architectures - return !set1.isEmpty() && !set2.isEmpty() && set1 != set2; + return set1.size() > 0 && set2.size() > 0 && set1 != set2; } static QStringList qbsTargetOsFromQtMkspec(const QString &mkspec) @@ -457,7 +457,7 @@ static Match compatibility(const QtEnvironment &env, const Profile &toolchainPro if (areProfilePropertiesIncompatible(toolchainNames, mkspecToolchainNames)) { auto intersection = toolchainNames; intersection.intersect(mkspecToolchainNames); - if (!intersection.isEmpty()) + if (!intersection.empty()) match = MatchPartial; else return MatchNone; @@ -567,12 +567,12 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen QString bestMatch; if (fullMatches.size() == 1) bestMatch = fullMatches.front(); - else if (fullMatches.isEmpty() && partialMatches.size() == 1) + else if (fullMatches.empty() && partialMatches.size() == 1) bestMatch = partialMatches.front(); if (bestMatch.isEmpty()) { QString message = Tr::tr("You need to set up toolchain information before you can " "use this Qt version for building. "); - if (fullMatches.isEmpty() && partialMatches.isEmpty()) { + if (fullMatches.empty() && partialMatches.empty()) { message += Tr::tr("However, no toolchain profile was found. Either create one " "using qbs-setup-toolchains and set it as this profile's " "base profile or add the toolchain settings manually " diff --git a/src/app/qbs-setup-toolchains/commandlineparser.cpp b/src/app/qbs-setup-toolchains/commandlineparser.cpp index b7466d6b9..00e605f3f 100644 --- a/src/app/qbs-setup-toolchains/commandlineparser.cpp +++ b/src/app/qbs-setup-toolchains/commandlineparser.cpp @@ -54,7 +54,7 @@ static QString settingsDirOption() { return QLatin1String("--settings-dir"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; - Q_ASSERT(!m_commandLine.isEmpty()); + Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_autoDetectionMode = false; @@ -63,10 +63,10 @@ void CommandLineParser::parse(const QStringList &commandLine) m_profileName.clear(); m_settingsDir.clear(); - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("No command-line arguments provided.")); - while (!m_commandLine.isEmpty()) { + while (!m_commandLine.empty()) { const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; @@ -82,7 +82,7 @@ void CommandLineParser::parse(const QStringList &commandLine) } if (m_helpRequested || m_autoDetectionMode) { - if (!m_commandLine.isEmpty()) + if (!m_commandLine.empty()) complainAboutExtraArguments(); return; } @@ -127,7 +127,7 @@ QString CommandLineParser::usageString() const void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { - if (m_commandLine.isEmpty()) + if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp index 1dd1ad56c..2738572e7 100644 --- a/src/app/qbs-setup-toolchains/probe.cpp +++ b/src/app/qbs-setup-toolchains/probe.cpp @@ -287,7 +287,7 @@ void probe(Settings *settings) mingwProbe(settings, profiles); - if (profiles.isEmpty()) { + if (profiles.empty()) { qStderr << Tr::tr("Could not detect any toolchains. No profile created.") << endl; } else if (profiles.size() == 1 && settings->defaultProfile().isEmpty()) { const QString profileName = profiles.front().name(); diff --git a/src/app/qbs/commandlinefrontend.cpp b/src/app/qbs/commandlinefrontend.cpp index 00862e071..87e86f37a 100644 --- a/src/app/qbs/commandlinefrontend.cpp +++ b/src/app/qbs/commandlinefrontend.cpp @@ -93,7 +93,7 @@ void CommandLineFrontend::checkCancelStatus() case CancelStatusRequested: m_cancelStatus = CancelStatusCanceling; m_cancelTimer->stop(); - if (m_resolveJobs.isEmpty() && m_buildJobs.isEmpty()) + if (m_resolveJobs.empty() && m_buildJobs.empty()) std::exit(EXIT_FAILURE); foreach (AbstractJob * const job, m_resolveJobs) job->cancel(); @@ -200,7 +200,7 @@ void CommandLineFrontend::start() m_cancelTimer->start(2000); } catch (const ErrorInfo &error) { qbsError() << error.toString(); - if (m_buildJobs.isEmpty() && m_resolveJobs.isEmpty()) { + if (m_buildJobs.empty() && m_resolveJobs.empty()) { qApp->exit(EXIT_FAILURE); } else { cancel(); @@ -223,7 +223,7 @@ void CommandLineFrontend::handleJobFinished(bool success, AbstractJob *job) qbsError() << job->error().toString(); m_resolveJobs.removeOne(job); m_buildJobs.removeOne(job); - if (m_resolveJobs.isEmpty() && m_buildJobs.isEmpty()) { + if (m_resolveJobs.empty() && m_buildJobs.empty()) { qApp->exit(EXIT_FAILURE); return; } @@ -233,7 +233,7 @@ void CommandLineFrontend::handleJobFinished(bool success, AbstractJob *job) m_projects << setupJob->project(); if (m_observer && resolvingMultipleProjects()) m_observer->incrementProgressValue(); - if (m_resolveJobs.isEmpty()) + if (m_resolveJobs.empty()) handleProjectsResolved(); } else if (qobject_cast<InstallJob *>(job)) { if (m_parser.command() == RunCommandType) @@ -242,7 +242,7 @@ void CommandLineFrontend::handleJobFinished(bool success, AbstractJob *job) qApp->quit(); } else { // Build or clean. m_buildJobs.removeOne(job); - if (m_buildJobs.isEmpty()) { + if (m_buildJobs.empty()) { switch (m_parser.command()) { case RunCommandType: case InstallCommandType: @@ -308,15 +308,15 @@ void CommandLineFrontend::handleTaskProgress(int value, AbstractJob *job) void CommandLineFrontend::handleProcessResultReport(const qbs::ProcessResult &result) { - bool hasOutput = !result.stdOut().isEmpty() || !result.stdErr().isEmpty(); + bool hasOutput = !result.stdOut().empty() || !result.stdErr().empty(); if (!hasOutput && result.success()) return; LogWriter w = result.success() ? qbsInfo() : qbsError(); w << shellQuote(QDir::toNativeSeparators(result.executableFilePath()), result.arguments()) << (hasOutput ? QString::fromLatin1("\n") : QString()) - << (result.stdOut().isEmpty() ? QString() : result.stdOut().join(QLatin1Char('\n'))); - if (!result.stdErr().isEmpty()) + << (result.stdOut().empty() ? QString() : result.stdOut().join(QLatin1Char('\n'))); + if (!result.stdErr().empty()) w << result.stdErr().join(QLatin1Char('\n')) << MessageTag(QStringLiteral("stdErr")); } @@ -327,19 +327,19 @@ bool CommandLineFrontend::resolvingMultipleProjects() const bool CommandLineFrontend::isResolving() const { - return !m_resolveJobs.isEmpty(); + return !m_resolveJobs.empty(); } bool CommandLineFrontend::isBuilding() const { - return !m_buildJobs.isEmpty(); + return !m_buildJobs.empty(); } CommandLineFrontend::ProductMap CommandLineFrontend::productsToUse() const { ProductMap products; QStringList productNames; - const bool useAll = m_parser.products().isEmpty(); + const bool useAll = m_parser.products().empty(); foreach (const Project &project, m_projects) { QList<ProductData> &productList = products[project]; const ProjectData projectData = project.projectData(); @@ -409,7 +409,7 @@ void CommandLineFrontend::handleProjectsResolved() void CommandLineFrontend::makeClean() { - if (m_parser.products().isEmpty()) { + if (m_parser.products().empty()) { foreach (const Project &project, m_projects) { m_buildJobs << project.cleanAllProducts(m_parser.cleanOptions(project.profile()), this); } @@ -478,7 +478,7 @@ QString CommandLineFrontend::buildDirectory(const QString &profileName) const void CommandLineFrontend::build() { - if (m_parser.products().isEmpty()) { + if (m_parser.products().empty()) { const Project::ProductSelection productSelection = m_parser.withNonDefaultProducts() ? Project::ProductSelectionWithNonDefault : Project::ProductSelectionDefaultOnly; foreach (const Project &project, m_projects) @@ -632,7 +632,7 @@ ProductData CommandLineFrontend::getTheOneRunnableProduct() if (runnableProducts.size() == 1) return runnableProducts.front(); - if (runnableProducts.isEmpty()) { + if (runnableProducts.empty()) { throw ErrorInfo(Tr::tr("Cannot execute command '%1': Project has no runnable product.") .arg(m_parser.commandName())); } @@ -656,7 +656,7 @@ void CommandLineFrontend::install() Q_ASSERT(m_projects.size() == 1); const Project project = m_projects.front(); InstallJob *installJob; - if (m_parser.products().isEmpty()) { + if (m_parser.products().empty()) { const Project::ProductSelection productSelection = m_parser.withNonDefaultProducts() ? Project::ProductSelectionWithNonDefault : Project::ProductSelectionDefaultOnly; installJob = project.installAllProducts(m_parser.installOptions(project.profile()), diff --git a/src/app/qbs/main.cpp b/src/app/qbs/main.cpp index 408823f8e..ca7c48a85 100644 --- a/src/app/qbs/main.cpp +++ b/src/app/qbs/main.cpp @@ -52,7 +52,7 @@ using namespace qbs; static bool tryToRunTool(const QStringList &arguments, int &exitCode) { - if (arguments.isEmpty()) + if (arguments.empty()) return false; QStringList toolArgs = arguments; const QString toolName = toolArgs.takeFirst(); diff --git a/src/app/qbs/parser/commandlineoption.cpp b/src/app/qbs/parser/commandlineoption.cpp index 0c73f7fb9..ffb2d606d 100644 --- a/src/app/qbs/parser/commandlineoption.cpp +++ b/src/app/qbs/parser/commandlineoption.cpp @@ -63,7 +63,7 @@ CommandLineOption::CommandLineOption() QString CommandLineOption::getArgument(const QString &representation, QStringList &input) { - if (input.isEmpty()) { + if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': Missing argument.\nUsage: %2") .arg(representation, description(command()))); } @@ -331,7 +331,7 @@ QString ShowProgressOption::longRepresentation() const void StringListOption::doParse(const QString &representation, QStringList &input) { m_arguments = getArgument(representation, input).split(QLatin1Char(',')); - if (m_arguments.isEmpty()) { + if (m_arguments.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': Argument list must not be empty.\n" "Usage: %2").arg(representation, description(command()))); } @@ -486,7 +486,7 @@ QString InstallRootOption::longRepresentation() const void InstallRootOption::doParse(const QString &representation, QStringList &input) { - if (input.isEmpty()) { + if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: Argument expected.\n" "Usage: %2").arg(representation, description(command()))); } @@ -566,7 +566,7 @@ QString SettingsDirOption::longRepresentation() const void SettingsDirOption::doParse(const QString &representation, QStringList &input) { - if (input.isEmpty()) { + if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: Argument expected.\n" "Usage: %2").arg(representation, description(command()))); } diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp index 1ff7a665a..427cf313a 100644 --- a/src/app/qbs/parser/commandlineparser.cpp +++ b/src/app/qbs/parser/commandlineparser.cpp @@ -318,7 +318,7 @@ CommandLineParser::CommandLineParserPrivate::CommandLineParserPrivate() void CommandLineParser::CommandLineParserPrivate::doParse() { - if (commandLine.isEmpty()) { // No command given, use default. + if (commandLine.empty()) { // No command given, use default. command = commandPool.getCommand(BuildCommandType); } else { command = commandFromString(commandLine.front()); @@ -409,7 +409,7 @@ QString CommandLineParser::CommandLineParserPrivate::generalHelp() const QStringList toolNames = QbsTool::allToolNames(); toolNames.sort(); - if (!toolNames.isEmpty()) { + if (!toolNames.empty()) { help.append(QLatin1Char('\n')).append(Tr::tr("Auxiliary commands:\n")); foreach (const QString &toolName, toolNames) { help.append(QLatin1String(" ")).append(toolName); diff --git a/src/app/qbs/parser/parsercommand.cpp b/src/app/qbs/parser/parsercommand.cpp index 564ecfcf2..aa9cf0f6d 100644 --- a/src/app/qbs/parser/parsercommand.cpp +++ b/src/app/qbs/parser/parsercommand.cpp @@ -560,7 +560,7 @@ QList<CommandLineOption::Type> HelpCommand::supportedOptions() const void HelpCommand::parseNext(QStringList &input) { - if (input.isEmpty()) + if (input.empty()) return; if (input.size() > 1) throwError(Tr::tr("Cannot describe more than one command.")); |