diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-10-24 08:40:54 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-11-14 18:24:18 +0000 |
commit | b5613da1391789fe661063ab9d30850aa96efd59 (patch) | |
tree | d38dba0aefb774dd32268ec94bea5ddc0c9cea0d /src/app | |
parent | f40667f6fb026fa1747a1e330d6e397bf79435c7 (diff) |
STL compatibility: use front() instead of first()
This is a simple find and replace with manual sanity check.
Change-Id: I82f0eb38b6a5a3b75a4ed38d97bdb6ce164d09b3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/config-ui/commandlineparser.cpp | 2 | ||||
-rw-r--r-- | src/app/config-ui/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/app/config/configcommandexecutor.cpp | 2 | ||||
-rw-r--r-- | src/app/config/configcommandlineparser.cpp | 12 | ||||
-rw-r--r-- | src/app/qbs-setup-android/commandlineparser.cpp | 2 | ||||
-rw-r--r-- | src/app/qbs-setup-qt/commandlineparser.cpp | 2 | ||||
-rw-r--r-- | src/app/qbs-setup-qt/setupqt.cpp | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/commandlineparser.cpp | 2 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/probe.cpp | 2 | ||||
-rw-r--r-- | src/app/qbs/commandlinefrontend.cpp | 32 | ||||
-rw-r--r-- | src/app/qbs/parser/commandlineparser.cpp | 10 | ||||
-rw-r--r-- | src/app/qbs/parser/parsercommand.cpp | 6 |
12 files changed, 39 insertions, 39 deletions
diff --git a/src/app/config-ui/commandlineparser.cpp b/src/app/config-ui/commandlineparser.cpp index 718b64b0a..5c5606442 100644 --- a/src/app/config-ui/commandlineparser.cpp +++ b/src/app/config-ui/commandlineparser.cpp @@ -59,7 +59,7 @@ void CommandLineParser::parse(const QStringList &commandLine) if (m_commandLine.isEmpty()) return; - const QString &arg = m_commandLine.first(); + const QString &arg = m_commandLine.front(); if (arg == helpOptionShort() || arg == helpOptionLong()) { m_commandLine.removeFirst(); m_helpRequested = true; diff --git a/src/app/config-ui/mainwindow.cpp b/src/app/config-ui/mainwindow.cpp index c5f629278..4de5c85d8 100644 --- a/src/app/config-ui/mainwindow.cpp +++ b/src/app/config-ui/mainwindow.cpp @@ -184,7 +184,7 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) if (keyEvent->matches(QKeySequence::Delete)) { const QModelIndexList indexes = ui->treeView->selectionModel()->selectedRows(); if (indexes.count() == 1) { - const QModelIndex index = indexes.first(); + const QModelIndex index = indexes.front(); if (index.isValid()) { m_model->removeKey(index); return true; diff --git a/src/app/config/configcommandexecutor.cpp b/src/app/config/configcommandexecutor.cpp index 9341663dd..a8ae28f66 100644 --- a/src/app/config/configcommandexecutor.cpp +++ b/src/app/config/configcommandexecutor.cpp @@ -63,7 +63,7 @@ void ConfigCommandExecutor::execute(const ConfigCommand &command) printSettings(command); break; case ConfigCommand::CfgSet: - setValue(command.varNames.first(), command.varValue); + setValue(command.varNames.front(), command.varValue); break; case ConfigCommand::CfgUnset: foreach (const QString &varName, command.varNames) diff --git a/src/app/config/configcommandlineparser.cpp b/src/app/config/configcommandlineparser.cpp index 595a23ef4..45fb79231 100644 --- a/src/app/config/configcommandlineparser.cpp +++ b/src/app/config/configcommandlineparser.cpp @@ -55,13 +55,13 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) m_commandLine = commandLine; if (m_commandLine.isEmpty()) throw ErrorInfo(Tr::tr("No parameters supplied.")); - if (m_commandLine.count() == 1 && (m_commandLine.first() == QLatin1String("--help") - || m_commandLine.first() == QLatin1String("-h"))) { + if (m_commandLine.count() == 1 && (m_commandLine.front() == QLatin1String("--help") + || m_commandLine.front() == QLatin1String("-h"))) { m_helpRequested = true; return; } - while (!m_commandLine.isEmpty() && m_commandLine.first().startsWith(QLatin1String("--"))) { + while (!m_commandLine.isEmpty() && m_commandLine.front().startsWith(QLatin1String("--"))) { const QString arg = m_commandLine.takeFirst().mid(2); if (arg == QLatin1String("list")) setCommand(ConfigCommand::CfgList); @@ -83,7 +83,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) throw ErrorInfo(Tr::tr("No parameters supplied.")); if (m_commandLine.count() > 2) throw ErrorInfo(Tr::tr("Too many arguments.")); - m_command.varNames << m_commandLine.first(); + m_command.varNames << m_commandLine.front(); if (m_commandLine.count() == 1) { setCommand(ConfigCommand::CfgList); } else { @@ -99,12 +99,12 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine) case ConfigCommand::CfgExport: if (m_commandLine.count() != 1) throw ErrorInfo(Tr::tr("Need name of file to which to export.")); - m_command.fileName = m_commandLine.first(); + m_command.fileName = m_commandLine.front(); break; case ConfigCommand::CfgImport: if (m_commandLine.count() != 1) throw ErrorInfo(Tr::tr("Need name of file from which to import.")); - m_command.fileName = m_commandLine.first(); + m_command.fileName = m_commandLine.front(); break; case ConfigCommand::CfgList: m_command.varNames = m_commandLine; diff --git a/src/app/qbs-setup-android/commandlineparser.cpp b/src/app/qbs-setup-android/commandlineparser.cpp index f5a5c3aa3..d2465f395 100644 --- a/src/app/qbs-setup-android/commandlineparser.cpp +++ b/src/app/qbs-setup-android/commandlineparser.cpp @@ -72,7 +72,7 @@ void CommandLineParser::parse(const QStringList &commandLine) throwError(Tr::tr("No command-line arguments provided.")); while (!m_commandLine.isEmpty()) { - const QString arg = m_commandLine.first(); + const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; m_commandLine.removeFirst(); diff --git a/src/app/qbs-setup-qt/commandlineparser.cpp b/src/app/qbs-setup-qt/commandlineparser.cpp index 9a6a003f7..c51af58a0 100644 --- a/src/app/qbs-setup-qt/commandlineparser.cpp +++ b/src/app/qbs-setup-qt/commandlineparser.cpp @@ -65,7 +65,7 @@ void CommandLineParser::parse(const QStringList &commandLine) throwError(Tr::tr("No command-line arguments provided.")); while (!m_commandLine.isEmpty()) { - const QString arg = m_commandLine.first(); + const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; m_commandLine.removeFirst(); diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp index d6eb282eb..23a5b2736 100644 --- a/src/app/qbs-setup-qt/setupqt.cpp +++ b/src/app/qbs-setup-qt/setupqt.cpp @@ -566,9 +566,9 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen QString bestMatch; if (fullMatches.count() == 1) - bestMatch = fullMatches.first(); + bestMatch = fullMatches.front(); else if (fullMatches.isEmpty() && partialMatches.count() == 1) - bestMatch = partialMatches.first(); + 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. "); diff --git a/src/app/qbs-setup-toolchains/commandlineparser.cpp b/src/app/qbs-setup-toolchains/commandlineparser.cpp index b1cbc9129..f67a24ab3 100644 --- a/src/app/qbs-setup-toolchains/commandlineparser.cpp +++ b/src/app/qbs-setup-toolchains/commandlineparser.cpp @@ -67,7 +67,7 @@ void CommandLineParser::parse(const QStringList &commandLine) throwError(Tr::tr("No command-line arguments provided.")); while (!m_commandLine.isEmpty()) { - const QString arg = m_commandLine.first(); + const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; m_commandLine.removeFirst(); diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp index 2bb99abfd..c2bc06c7d 100644 --- a/src/app/qbs-setup-toolchains/probe.cpp +++ b/src/app/qbs-setup-toolchains/probe.cpp @@ -290,7 +290,7 @@ void probe(Settings *settings) if (profiles.isEmpty()) { qStderr << Tr::tr("Could not detect any toolchains. No profile created.") << endl; } else if (profiles.count() == 1 && settings->defaultProfile().isEmpty()) { - const QString profileName = profiles.first().name(); + const QString profileName = profiles.front().name(); qStdout << Tr::tr("Making profile '%1' the default.").arg(profileName) << endl; settings->setValue(QLatin1String("defaultProfile"), profileName); } diff --git a/src/app/qbs/commandlinefrontend.cpp b/src/app/qbs/commandlinefrontend.cpp index 2a6dae2b6..2c4290c46 100644 --- a/src/app/qbs/commandlinefrontend.cpp +++ b/src/app/qbs/commandlinefrontend.cpp @@ -374,7 +374,7 @@ void CommandLineFrontend::handleProjectsResolved() qApp->exit(runShell()); break; case StatusCommandType: - qApp->exit(printStatus(m_projects.first().projectData())); + qApp->exit(printStatus(m_projects.front().projectData())); break; case GenerateCommandType: checkGeneratorName(); @@ -431,20 +431,20 @@ int CommandLineFrontend::runShell() case 0: // No specific product, use project-global environment. break; case 1: - productToRun = productsToUse().values().first().first(); + productToRun = productsToUse().values().front().front(); break; default: throw ErrorInfo(Tr::tr("The command '%1' cannot take more than one product.")); } - RunEnvironment runEnvironment = m_projects.first().getRunEnvironment(productToRun, - m_parser.installOptions(m_projects.first().profile()), + RunEnvironment runEnvironment = m_projects.front().getRunEnvironment(productToRun, + m_parser.installOptions(m_projects.front().profile()), QProcessEnvironment::systemEnvironment(), m_settings); return runEnvironment.doRunShell(); } BuildOptions CommandLineFrontend::buildOptions(const Project &project) const { - BuildOptions options = m_parser.buildOptions(m_projects.first().profile()); + BuildOptions options = m_parser.buildOptions(m_projects.front().profile()); if (options.maxJobCount() <= 0) { const QString profileName = project.profile(); QBS_CHECK(!profileName.isEmpty()); @@ -541,8 +541,8 @@ int CommandLineFrontend::runTarget() throw ErrorInfo(Tr::tr("Cannot run: Product '%1' is not an application.") .arg(productToRun.name())); } - RunEnvironment runEnvironment = m_projects.first().getRunEnvironment(productToRun, - m_parser.installOptions(m_projects.first().profile()), + RunEnvironment runEnvironment = m_projects.front().getRunEnvironment(productToRun, + m_parser.installOptions(m_projects.front().profile()), QProcessEnvironment::systemEnvironment(), m_settings); return runEnvironment.doRunTarget(executableFilePath, m_parser.runArgs()); } @@ -560,8 +560,8 @@ void CommandLineFrontend::dumpNodesTree() { QFile stdOut; stdOut.open(stdout, QIODevice::WriteOnly); - const ErrorInfo error = m_projects.first().dumpNodesTree(stdOut, productsToUse() - .value(m_projects.first())); + const ErrorInfo error = m_projects.front().dumpNodesTree(stdOut, productsToUse() + .value(m_projects.front())); if (error.hasError()) throw error; } @@ -615,8 +615,8 @@ ProductData CommandLineFrontend::getTheOneRunnableProduct() QBS_CHECK(m_projects.count() == 1); // Has been checked earlier. if (m_parser.products().count() == 1) { - foreach (const ProductData &p, m_projects.first().projectData().allProducts()) { - if (p.name() == m_parser.products().first()) + foreach (const ProductData &p, m_projects.front().projectData().allProducts()) { + if (p.name() == m_parser.products().front()) return p; } QBS_CHECK(false); @@ -624,13 +624,13 @@ ProductData CommandLineFrontend::getTheOneRunnableProduct() QBS_CHECK(m_parser.products().count() == 0); QList<ProductData> runnableProducts; - foreach (const ProductData &p, m_projects.first().projectData().allProducts()) { + foreach (const ProductData &p, m_projects.front().projectData().allProducts()) { if (p.isRunnable()) runnableProducts << p; } if (runnableProducts.count() == 1) - return runnableProducts.first(); + return runnableProducts.front(); if (runnableProducts.isEmpty()) { throw ErrorInfo(Tr::tr("Cannot execute command '%1': Project has no runnable product.") @@ -642,7 +642,7 @@ ProductData CommandLineFrontend::getTheOneRunnableProduct() error.append(Tr::tr("Use the '--products' option with one of the following products:")); foreach (const ProductData &p, runnableProducts) { QString productRepr = QLatin1String("\t") + p.name(); - if (p.profile() != m_projects.first().profile()) { + if (p.profile() != m_projects.front().profile()) { productRepr.append(QLatin1String(" [")).append(p.profile()) .append(QLatin1Char(']')); } @@ -654,7 +654,7 @@ ProductData CommandLineFrontend::getTheOneRunnableProduct() void CommandLineFrontend::install() { Q_ASSERT(m_projects.count() == 1); - const Project project = m_projects.first(); + const Project project = m_projects.front(); InstallJob *installJob; if (m_parser.products().isEmpty()) { const Project::ProductSelection productSelection = m_parser.withNonDefaultProducts() @@ -662,7 +662,7 @@ void CommandLineFrontend::install() installJob = project.installAllProducts(m_parser.installOptions(project.profile()), productSelection); } else { - const Project project = m_projects.first(); + const Project project = m_projects.front(); const ProductMap products = productsToUse(); installJob = project.installSomeProducts(products.value(project), m_parser.installOptions(project.profile())); diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp index 434ddf126..c223ea735 100644 --- a/src/app/qbs/parser/commandlineparser.cpp +++ b/src/app/qbs/parser/commandlineparser.cpp @@ -321,16 +321,16 @@ void CommandLineParser::CommandLineParserPrivate::doParse() if (commandLine.isEmpty()) { // No command given, use default. command = commandPool.getCommand(BuildCommandType); } else { - command = commandFromString(commandLine.first()); + command = commandFromString(commandLine.front()); if (command) { commandLine.removeFirst(); } else { // No command given. - if (commandLine.first() == QLatin1String("-h") - || commandLine.first() == QLatin1String("--help")) { + if (commandLine.front() == QLatin1String("-h") + || commandLine.front() == QLatin1String("--help")) { command = commandPool.getCommand(HelpCommandType); commandLine.takeFirst(); - } else if (commandLine.first() == QLatin1String("-V") - || commandLine.first() == QLatin1String("--version")) { + } else if (commandLine.front() == QLatin1String("-V") + || commandLine.front() == QLatin1String("--version")) { command = commandPool.getCommand(VersionCommandType); commandLine.takeFirst(); } else { diff --git a/src/app/qbs/parser/parsercommand.cpp b/src/app/qbs/parser/parsercommand.cpp index dd07f2cce..7bf147cea 100644 --- a/src/app/qbs/parser/parsercommand.cpp +++ b/src/app/qbs/parser/parsercommand.cpp @@ -101,7 +101,7 @@ QList<CommandLineOption::Type> Command::actualSupportedOptions() const void Command::parseOption(QStringList &input) { - const QString optionString = input.first(); + const QString optionString = input.front(); QBS_CHECK(optionString.startsWith(QLatin1Char('-'))); input.removeFirst(); if (optionString.count() == 1) @@ -148,7 +148,7 @@ void Command::parseOption(QStringList &input) void Command::parseNext(QStringList &input) { QBS_CHECK(!input.empty()); - if (input.first().startsWith(QLatin1Char('-'))) + if (input.front().startsWith(QLatin1Char('-'))) parseOption(input); else parsePropertyAssignment(input.takeFirst()); @@ -392,7 +392,7 @@ QList<CommandLineOption::Type> RunCommand::supportedOptions() const void RunCommand::parseNext(QStringList &input) { QBS_CHECK(!input.empty()); - if (input.first() != QLatin1String("--")) { + if (input.front() != QLatin1String("--")) { Command::parseNext(input); return; } |