diff options
author | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2021-05-28 18:22:44 +0300 |
---|---|---|
committer | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2021-06-01 08:11:56 +0000 |
commit | 1372dfdf7fc5e0ee04c064568bcd6e45da019db5 (patch) | |
tree | c5a5773549e95b4777ec200b1a9ab8bb937d3cf3 /src/plugins | |
parent | 41240ed70679ccd565c60fafd0b99aed5cb132e6 (diff) | |
download | qt-creator-1372dfdf7fc5e0ee04c064568bcd6e45da019db5.tar.gz |
Android: Fix multiple clang clazy warnings
Change-Id: I2ea6cebd16c09a8a4502f4719d99a9d85e5e7d02
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/android/androidavdmanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/android/androidbuildapkstep.cpp | 3 | ||||
-rw-r--r-- | src/plugins/android/androidconfigurations.cpp | 23 | ||||
-rw-r--r-- | src/plugins/android/androidmanager.cpp | 10 | ||||
-rw-r--r-- | src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp | 94 | ||||
-rw-r--r-- | src/plugins/android/androidmanifesteditoriconwidget.cpp | 4 | ||||
-rw-r--r-- | src/plugins/android/androidpackageinstallationstep.cpp | 12 | ||||
-rw-r--r-- | src/plugins/android/androidrunnerworker.cpp | 47 | ||||
-rw-r--r-- | src/plugins/android/androidsdkmanager.cpp | 52 | ||||
-rw-r--r-- | src/plugins/android/androidsdkpackage.cpp | 42 | ||||
-rw-r--r-- | src/plugins/android/androidsdkpackage.h | 27 | ||||
-rw-r--r-- | src/plugins/android/androidservicewidget.cpp | 20 | ||||
-rw-r--r-- | src/plugins/android/androidsettingswidget.cpp | 11 | ||||
-rw-r--r-- | src/plugins/android/androidtoolchain.cpp | 39 | ||||
-rw-r--r-- | src/plugins/android/avddialog.cpp | 3 | ||||
-rw-r--r-- | src/plugins/android/avdmanageroutputparser.cpp | 3 | ||||
-rw-r--r-- | src/plugins/android/splashscreencontainerwidget.cpp | 36 |
17 files changed, 236 insertions, 192 deletions
diff --git a/src/plugins/android/androidavdmanager.cpp b/src/plugins/android/androidavdmanager.cpp index 9d6d8116f2..0f0bcfd704 100644 --- a/src/plugins/android/androidavdmanager.cpp +++ b/src/plugins/android/androidavdmanager.cpp @@ -378,7 +378,5 @@ bool AndroidAvdManager::waitForBooted(const QString &serialNumber, return false; } -static QStringList avdErrorPaths; - } // namespace Internal } // namespace Android diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 8dcc9d62e3..d40d6ca554 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -93,7 +93,6 @@ namespace Internal { static Q_LOGGING_CATEGORY(buildapkstepLog, "qtc.android.build.androidbuildapkstep", QtWarningMsg) -const QVersionNumber gradleScriptRevokedSdkVersion(25, 3, 0); const char KeystoreLocationKey[] = "KeystoreLocation"; const char BuildTargetSdkKey[] = "BuildTargetSdk"; const char VerboseOutputKey[] = "VerboseOutput"; @@ -518,7 +517,7 @@ bool AndroidBuildApkStep::init() return false; const QVersionNumber sdkToolsVersion = AndroidConfigurations::currentConfig().sdkToolsVersion(); - if (sdkToolsVersion >= gradleScriptRevokedSdkVersion + if (sdkToolsVersion >= QVersionNumber(25, 3, 0) || AndroidConfigurations::currentConfig().isCmdlineSdkToolsInstalled()) { if (!version->sourcePath().pathAppended("src/3rdparty/gradle").exists()) { const QString error diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 65d8031463..237a3b0734 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -342,15 +342,16 @@ void AndroidConfig::parseDependenciesJson() }; if (jsonObject.contains(SpecificQtVersionsKey) && jsonObject[SpecificQtVersionsKey].isArray()) { - QJsonArray versionsArray = jsonObject[SpecificQtVersionsKey].toArray(); - for (const QJsonValueRef &item : versionsArray) { + const QJsonArray versionsArray = jsonObject[SpecificQtVersionsKey].toArray(); + for (const QJsonValue &item : versionsArray) { QJsonObject itemObj = item.toObject(); SdkForQtVersions specificVersion; - specificVersion.ndkPath = itemObj[NdkPathKey].toString(); - for (const QJsonValueRef &pkg : itemObj[SdkEssentialPkgsKey].toArray()) + const auto pkgs = itemObj[SdkEssentialPkgsKey].toArray(); + for (const QJsonValue &pkg : pkgs) specificVersion.essentialPackages.append(pkg.toString()); - for (const QJsonValueRef &pkg : itemObj[VersionsKey].toArray()) + const auto versions = itemObj[VersionsKey].toArray(); + for (const QJsonValue &pkg : versions) specificVersion.versions.append(fillQtVersionsRange(pkg.toString())); if (itemObj[VersionsKey].toArray().first().toString() == DefaultVersionKey) @@ -816,7 +817,8 @@ QVersionNumber AndroidConfig::buildToolsVersion() const //TODO: return version according to qt version QVersionNumber maxVersion; QDir buildToolsDir(m_sdkLocation.pathAppended("build-tools").toString()); - for (const QFileInfo &file: buildToolsDir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot)) + const auto files = buildToolsDir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot); + for (const QFileInfo &file: files) maxVersion = qMax(maxVersion, QVersionNumber::fromString(file.fileName())); return maxVersion; } @@ -904,7 +906,8 @@ QStringList AndroidConfig::allEssentials() const bool AndroidConfig::allEssentialsInstalled(AndroidSdkManager *sdkManager) { QStringList essentialPkgs(allEssentials()); - for (const AndroidSdkPackage *pkg : sdkManager->installedSdkPackages()) { + const auto installedPkgs = sdkManager->installedSdkPackages(); + for (const AndroidSdkPackage *pkg : installedPkgs) { if (essentialPkgs.contains(pkg->sdkStylePath())) essentialPkgs.removeOne(pkg->sdkStylePath()); if (essentialPkgs.isEmpty()) @@ -1175,7 +1178,7 @@ void AndroidConfigurations::removeOldToolChains() void AndroidConfigurations::removeUnusedDebuggers() { - QList<FilePath> uniqueNdks; + QVector<FilePath> uniqueNdks; const QList<QtSupport::BaseQtVersion *> qtVersions = QtSupport::QtVersionManager::versions([](const QtSupport::BaseQtVersion *v) { return v->type() == Constants::ANDROIDQT; @@ -1187,7 +1190,9 @@ void AndroidConfigurations::removeUnusedDebuggers() uniqueNdks.append(ndkLocation); } - uniqueNdks.append(Utils::transform(currentConfig().getCustomNdkList(), FilePath::fromString)); + + uniqueNdks.append(Utils::transform(currentConfig().getCustomNdkList(), + FilePath::fromString).toVector()); const QList<Debugger::DebuggerItem> allDebuggers = Debugger::DebuggerItemManager::debuggers(); for (const Debugger::DebuggerItem &debugger : allDebuggers) { diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index cf50cee401..739cb6b1cb 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -80,11 +80,8 @@ const QLatin1String AndroidManifestName("AndroidManifest.xml"); const QLatin1String AndroidDeviceSn("AndroidDeviceSerialNumber"); const QLatin1String AndroidDeviceAbis("AndroidDeviceAbis"); const QLatin1String ApiLevelKey("AndroidVersion.ApiLevel"); -const QString packageNameRegEx("(?<token>package: )(.*?)(name=)'(?<target>.*?)'"); -const QString activityRegEx("(?<token>launchable-activity: )(.*?)(name=)'(?<target>.*?)'"); -const QString apkVersionRegEx("(?<token>package: )(.*?)(versionCode=)'(?<target>.*?)'"); -const QString versionCodeRegEx("(?<token>versionCode=)(?<version>\\d*)"); -const QString qtcSignature("This file is generated by QtCreator to be read by androiddeployqt and should not be modified by hand."); +const char qtcSignature[] = "This file is generated by QtCreator to be read by androiddeployqt " + "and should not be modified by hand."; static Q_LOGGING_CATEGORY(androidManagerLog, "qtc.android.androidManager", QtWarningMsg) @@ -378,7 +375,8 @@ QString AndroidManager::apkDevicePreferredAbi(const Target *target) target); } QStringList apkAbis; - for (const auto &abi : QDir{libsPath.toString()}.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) + const auto libsPaths = QDir{libsPath.toString()}.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + for (const auto &abi : libsPaths) if (!QDir{libsPath.pathAppended(abi).toString()}.entryList(QStringList("*.so"), QDir::Files | QDir::NoDotAndDotDot).isEmpty()) apkAbis << abi; return preferredAbi(apkAbis, target); diff --git a/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp b/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp index 5be4c69f59..774412f299 100644 --- a/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp +++ b/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp @@ -35,13 +35,13 @@ namespace Android { namespace Internal { namespace { -const QString extraExtraExtraHighDpiIconPath = QLatin1String("/res/drawable-xxxhdpi/"); -const QString extraExtraHighDpiIconPath = QLatin1String("/res/drawable-xxhdpi/"); -const QString extraHighDpiIconPath = QLatin1String("/res/drawable-xhdpi/"); -const QString highDpiIconPath = QLatin1String("/res/drawable-hdpi/"); -const QString mediumDpiIconPath = QLatin1String("/res/drawable-mdpi/"); -const QString lowDpiIconPath = QLatin1String("/res/drawable-ldpi/"); -const QString imageSuffix = QLatin1String(".png"); +const char extraExtraExtraHighDpiIconPath[] = "/res/drawable-xxxhdpi/"; +const char extraExtraHighDpiIconPath[] = "/res/drawable-xxhdpi/"; +const char extraHighDpiIconPath[] = "/res/drawable-xhdpi/"; +const char highDpiIconPath[] = "/res/drawable-hdpi/"; +const char mediumDpiIconPath[] = "/res/drawable-mdpi/"; +const char lowDpiIconPath[] = "/res/drawable-ldpi/"; +const char imageSuffix[] = ".png"; const QSize lowDpiIconSize{32, 32}; const QSize mediumDpiIconSize{48, 48}; const QSize highDpiIconSize{72, 72}; @@ -73,67 +73,73 @@ AndroidManifestEditorIconContainerWidget::AndroidManifestEditorIconContainerWidg QString iconFileName = m_iconFileName + imageSuffix; auto lIconButton = new AndroidManifestEditorIconWidget(this, - lowDpiIconSize, - lowDpiIconSize, - tr("LDPI icon"), tr("Select an icon suitable for low-density (ldpi) screens (~120dpi)."), - textEditorWidget, - lowDpiIconPath, - iconFileName); + lowDpiIconSize, + lowDpiIconSize, + tr("LDPI icon"), + tr("Select an icon suitable for low-density (ldpi) screens (~120dpi)."), + textEditorWidget, + lowDpiIconPath, + iconFileName); iconLayout->addWidget(lIconButton); m_iconButtons.push_back(lIconButton); iconLayout->addStretch(1); auto mIconButton = new AndroidManifestEditorIconWidget(this, - mediumDpiIconSize, - mediumDpiIconSize, - tr("MDPI icon"), tr("Select an icon for medium-density (mdpi) screens (~160dpi)."), - textEditorWidget, - mediumDpiIconPath, - iconFileName); + mediumDpiIconSize, + mediumDpiIconSize, + tr("MDPI icon"), + tr("Select an icon for medium-density (mdpi) screens (~160dpi)."), + textEditorWidget, + mediumDpiIconPath, + iconFileName); iconLayout->addWidget(mIconButton); m_iconButtons.push_back(mIconButton); iconLayout->addStretch(1); auto hIconButton = new AndroidManifestEditorIconWidget(this, - highDpiIconSize, - highDpiIconSize, - tr("HDPI icon"), tr("Select an icon for high-density (hdpi) screens (~240dpi)."), - textEditorWidget, - highDpiIconPath, - iconFileName); + highDpiIconSize, + highDpiIconSize, + tr("HDPI icon"), + tr("Select an icon for high-density (hdpi) screens (~240dpi)."), + textEditorWidget, + highDpiIconPath, + iconFileName); iconLayout->addWidget(hIconButton); m_iconButtons.push_back(hIconButton); iconLayout->addStretch(1); auto xhIconButton = new AndroidManifestEditorIconWidget(this, - extraHighDpiIconSize, - extraHighDpiIconSize, - tr("XHDPI icon"), tr("Select an icon for extra-high-density (xhdpi) screens (~320dpi)."), - textEditorWidget, - extraHighDpiIconPath, - iconFileName); + extraHighDpiIconSize, + extraHighDpiIconSize, + tr("XHDPI icon"), + tr("Select an icon for extra-high-density (xhdpi) screens (~320dpi)."), + textEditorWidget, + extraHighDpiIconPath, + iconFileName); iconLayout->addWidget(xhIconButton); m_iconButtons.push_back(xhIconButton); iconLayout->addStretch(1); auto xxhIconButton = new AndroidManifestEditorIconWidget(this, - extraExtraHighDpiIconSize, - extraExtraHighDpiIconSize, - tr("XXHDPI icon"), tr("Select an icon for extra-extra-high-density (xxhdpi) screens (~480dpi)."), - textEditorWidget, - extraExtraHighDpiIconPath, - iconFileName); + extraExtraHighDpiIconSize, + extraExtraHighDpiIconSize, + tr("XXHDPI icon"), + tr("Select an icon for extra-extra-high-density (xxhdpi) screens (~480dpi)."), + textEditorWidget, + extraExtraHighDpiIconPath, + iconFileName); iconLayout->addWidget(xxhIconButton); m_iconButtons.push_back(xxhIconButton); iconLayout->addStretch(1); auto xxxhIconButton = new AndroidManifestEditorIconWidget(this, - extraExtraExtraHighDpiIconSize, - extraExtraExtraHighDpiIconSize, - tr("XXXHDPI icon"), tr("Select an icon for extra-extra-extra-high-density (xxxhdpi) screens (~640dpi)."), - textEditorWidget, - extraExtraExtraHighDpiIconPath, - iconFileName); + extraExtraExtraHighDpiIconSize, + extraExtraExtraHighDpiIconSize, + tr("XXXHDPI icon"), + tr("Select an icon for extra-extra-extra-high-density (xxxhdpi) screens (~640dpi)."), + textEditorWidget, + extraExtraExtraHighDpiIconPath, + iconFileName); iconLayout->addWidget(xxxhIconButton); m_iconButtons.push_back(xxxhIconButton); iconLayout->addStretch(3); @@ -141,7 +147,7 @@ AndroidManifestEditorIconContainerWidget::AndroidManifestEditorIconContainerWidg auto handleIconModification = [this] { bool iconsMaybeChanged = hasIcons(); if (m_hasIcons != iconsMaybeChanged) - iconsModified(); + emit iconsModified(); m_hasIcons = iconsMaybeChanged; }; for (auto &&iconButton : m_iconButtons) { diff --git a/src/plugins/android/androidmanifesteditoriconwidget.cpp b/src/plugins/android/androidmanifesteditoriconwidget.cpp index 9cc9ffda66..ab07b1276a 100644 --- a/src/plugins/android/androidmanifesteditoriconwidget.cpp +++ b/src/plugins/android/androidmanifesteditoriconwidget.cpp @@ -127,7 +127,7 @@ void AndroidManifestEditorIconWidget::setIcon(const QIcon &icon) void AndroidManifestEditorIconWidget::clearIcon() { removeIcon(); - iconRemoved(); + emit iconRemoved(); } void AndroidManifestEditorIconWidget::loadIcon() @@ -170,7 +170,7 @@ void AndroidManifestEditorIconWidget::selectIcon() if (file.isEmpty()) return; setIconFromPath(file); - iconSelected(file, this); + emit iconSelected(file, this); } void AndroidManifestEditorIconWidget::removeIcon() diff --git a/src/plugins/android/androidpackageinstallationstep.cpp b/src/plugins/android/androidpackageinstallationstep.cpp index bd4fdc104f..bb196834dd 100644 --- a/src/plugins/android/androidpackageinstallationstep.cpp +++ b/src/plugins/android/androidpackageinstallationstep.cpp @@ -160,10 +160,14 @@ void AndroidPackageInstallationStep::doRun() dir.mkpath(assetsDebugDir); QFile file(assetsDebugDir + "debugger.command"); - if (file.open(QIODevice::WriteOnly)) - qCDebug(packageInstallationStepLog, "Successful added %s to the package.", qPrintable(file.fileName())); - else - qCDebug(packageInstallationStepLog, "Cound't add %s to the package. The QML debugger might not work properly.", qPrintable(file.fileName())); + if (file.open(QIODevice::WriteOnly)) { + qCDebug(packageInstallationStepLog, "Successful added %s to the package.", + qPrintable(file.fileName())); + } else { + qCDebug(packageInstallationStepLog, + "Cound't add %s to the package. The QML debugger might not work properly.", + qPrintable(file.fileName())); + } } } } diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index 14cebeb425..66b4ec77b5 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -75,26 +75,9 @@ using namespace Utils; namespace Android { namespace Internal { -static const QString pidScript = "pidof -s '%1'"; -static const QString pidScriptPreNougat = QStringLiteral("for p in /proc/[0-9]*; " - "do cat <$p/cmdline && echo :${p##*/}; done"); static const QString pidPollingScript = QStringLiteral("while [ -d /proc/%1 ]; do sleep 1; done"); -static const QRegularExpression regExpLogcat{"^[0-9\\-]*" // date - "\\s+" - "[0-9\\-:.]*"// time - "\\s*" - "(\\d*)" // pid 1. capture - "\\s+" - "\\d*" // unknown - "\\s+" - "(\\w)" // message type 2. capture - "\\s+" - "(.*): " // source 3. capture - "(.*)" // message 4. capture - "[\\n\\r]*$"}; static int APP_START_TIMEOUT = 45000; - static bool isTimedOut(const chrono::high_resolution_clock::time_point &start, int msecs = APP_START_TIMEOUT) { @@ -128,6 +111,9 @@ static void findProcessPID(QFutureInterface<qint64> &fi, QStringList selector, if (packageName.isEmpty()) return; + static const QString pidScript = "pidof -s '%1'"; + static const QString pidScriptPreNougat = QStringLiteral("for p in /proc/[0-9]*; " + "do cat <$p/cmdline && echo :${p##*/}; done"); QStringList args = {selector}; FilePath adbPath = AndroidConfigurations::currentConfig().adbToolPath(); args.append("shell"); @@ -305,7 +291,8 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa for (const QString &shellCmd : commands) m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); } - for (const QString &shellCmd : runner->recordedData(Constants::ANDROID_PRESTARTSHELLCMDLIST).toStringList()) + const auto data = runner->recordedData(Constants::ANDROID_PRESTARTSHELLCMDLIST).toStringList(); + for (const QString &shellCmd : data) m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); if (auto aspect = runControl->aspect(Constants::ANDROID_POSTFINISHSHELLCMDLIST)) { @@ -314,7 +301,8 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa for (const QString &shellCmd : commands) m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd)); } - for (const QString &shellCmd : runner->recordedData(Constants::ANDROID_POSTFINISHSHELLCMDLIST).toStringList()) + const auto data2 = runner->recordedData(Constants::ANDROID_POSTFINISHSHELLCMDLIST).toStringList(); + for (const QString &shellCmd : data) m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd)); m_debugServerPath = debugServer(m_useLldb, target).toString(); @@ -472,6 +460,21 @@ void AndroidRunnerWorker::logcatProcess(const QByteArray &text, QByteArray &buff break; } } + + static const QRegularExpression regExpLogcat{"^[0-9\\-]*" // date + "\\s+" + "[0-9\\-:.]*"// time + "\\s*" + "(\\d*)" // pid 1. capture + "\\s+" + "\\d*" // unknown + "\\s+" + "(\\w)" // message type 2. capture + "\\s+" + "(.*): " // source 3. capture + "(.*)" // message 4. capture + "[\\n\\r]*$"}; + const QRegularExpressionMatch match = regExpLogcat.match(line); if (match.hasMatch()) { // Android M @@ -767,7 +770,8 @@ void AndroidRunnerWorker::handleJdbSettled() for (int i= 0; i < 5 && m_jdbProcess->state() == QProcess::Running; ++i) { m_jdbProcess->waitForReadyRead(500); QByteArray lines = m_jdbProcess->readAll(); - for (const auto &line: lines.split('\n')) { + const auto linesList = lines.split('\n'); + for (const auto &line : linesList) { auto msg = line.trimmed(); if (msg.startsWith(">")) return true; @@ -802,7 +806,8 @@ void AndroidRunnerWorker::removeForwardPort(const QString &port) SdkToolResult result = AndroidManager::runAdbCommand({"forward", "--list"}); QString string = result.stdOut(); - for (const QString &line : string.split('\n')) { + const auto lines = string.split('\n'); + for (const QString &line : lines) { if (line.contains(port)) { found = true; break; diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index ae0dd0dd5c..bb32daab18 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -61,9 +61,10 @@ const char commonArgsKey[] = "Common Arguments:"; const int sdkManagerCmdTimeoutS = 60; const int sdkManagerOperationTimeoutS = 600; -const QRegularExpression assertionReg("(\\(\\s*y\\s*[\\/\\\\]\\s*n\\s*\\)\\s*)(?<mark>[\\:\\?])", - QRegularExpression::CaseInsensitiveOption | - QRegularExpression::MultilineOption); +Q_GLOBAL_STATIC_WITH_ARGS(QRegularExpression, assertionReg, + ("(\\(\\s*y\\s*[\\/\\\\]\\s*n\\s*\\)\\s*)(?<mark>[\\:\\?])", + QRegularExpression::CaseInsensitiveOption + | QRegularExpression::MultilineOption)) using namespace Utils; using SdkCmdFutureInterface = QFutureInterface<AndroidSdkManager::OperationOutput>; @@ -118,7 +119,7 @@ int parseProgress(const QString &out, bool &foundAssertion) progress = -1; } if (!foundAssertion) - foundAssertion = assertionReg.match(line).hasMatch(); + foundAssertion = assertionReg->match(line).hasMatch(); } return progress; } @@ -320,20 +321,21 @@ private: QHash<AndroidSdkPackage *, int> m_systemImages; }; -const std::map<SdkManagerOutputParser::MarkerTag, const char *> markerTags { - {SdkManagerOutputParser::MarkerTag::InstalledPackagesMarker, "Installed packages:"}, - {SdkManagerOutputParser::MarkerTag::AvailablePackagesMarkers, "Available Packages:"}, - {SdkManagerOutputParser::MarkerTag::AvailableUpdatesMarker, "Available Updates:"}, - {SdkManagerOutputParser::MarkerTag::PlatformMarker, "platforms"}, - {SdkManagerOutputParser::MarkerTag::SystemImageMarker, "system-images"}, - {SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"}, - {SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"}, - {SdkManagerOutputParser::MarkerTag::CmdlineSdkToolsMarker, "cmdline-tools"}, - {SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"}, - {SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"}, - {SdkManagerOutputParser::MarkerTag::NdkMarker, "ndk"}, - {SdkManagerOutputParser::MarkerTag::ExtrasMarker, "extras"} -}; +using MarkerTagsType = std::map<SdkManagerOutputParser::MarkerTag, const char *>; +Q_GLOBAL_STATIC_WITH_ARGS(MarkerTagsType, markerTags, ({ + {SdkManagerOutputParser::MarkerTag::InstalledPackagesMarker, "Installed packages:"}, + {SdkManagerOutputParser::MarkerTag::AvailablePackagesMarkers, "Available Packages:"}, + {SdkManagerOutputParser::MarkerTag::AvailableUpdatesMarker, "Available Updates:"}, + {SdkManagerOutputParser::MarkerTag::PlatformMarker, "platforms"}, + {SdkManagerOutputParser::MarkerTag::SystemImageMarker, "system-images"}, + {SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"}, + {SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"}, + {SdkManagerOutputParser::MarkerTag::CmdlineSdkToolsMarker, "cmdline-tools"}, + {SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"}, + {SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"}, + {SdkManagerOutputParser::MarkerTag::NdkMarker, "ndk"}, + {SdkManagerOutputParser::MarkerTag::ExtrasMarker, "extras"} +})); AndroidSdkManager::AndroidSdkManager(const AndroidConfig &config): m_d(new AndroidSdkManagerPrivate(*this, config)) @@ -496,7 +498,8 @@ void SdkManagerOutputParser::parsePackageListing(const QString &output) }; QRegularExpression delimiters("[\\n\\r]"); - for (const QString &outputLine : output.split(delimiters)) { + const auto lines = output.split(delimiters); + for (const QString &outputLine : lines) { // NOTE: we don't want to parse Dependencies part as it does not add value if (outputLine.startsWith(" ")) @@ -646,7 +649,7 @@ void SdkManagerOutputParser::parsePackageData(MarkerTag packageMarker, const QSt break; default: - qCDebug(sdkManagerLog) << "Unhandled package: " << markerTags.at(packageMarker); + qCDebug(sdkManagerLog) << "Unhandled package: " << markerTags->at(packageMarker); break; } @@ -660,7 +663,7 @@ void SdkManagerOutputParser::parsePackageData(MarkerTag packageMarker, const QSt package->setState(AndroidSdkPackage::Available); break; default: - qCDebug(sdkManagerLog) << "Invalid section marker: " << markerTags.at(m_currentSection); + qCDebug(sdkManagerLog) << "Invalid section marker: " << markerTags->at(m_currentSection); break; } } @@ -864,7 +867,7 @@ SdkManagerOutputParser::MarkerTag SdkManagerOutputParser::parseMarkers(const QSt if (line.isEmpty()) return EmptyMarker; - for (auto pair: markerTags) { + for (auto pair : *markerTags) { if (line.startsWith(QLatin1String(pair.second))) return pair.first; } @@ -1115,7 +1118,7 @@ bool AndroidSdkManagerPrivate::onLicenseStdOut(const QString &output, bool notif SdkCmdFutureInterface &fi) { m_licenseTextCache.append(output); - QRegularExpressionMatch assertionMatch = assertionReg.match(m_licenseTextCache); + QRegularExpressionMatch assertionMatch = assertionReg->match(m_licenseTextCache); if (assertionMatch.hasMatch()) { if (notify) { result.stdOutput = m_licenseTextCache; @@ -1143,7 +1146,8 @@ void AndroidSdkManagerPrivate::parseCommonArguments(QFutureInterface<QString> &f QString output; sdkManagerCommand(m_config, QStringList("--help"), &output); bool foundTag = false; - for (const QString& line : output.split('\n')) { + const auto lines = output.split('\n'); + for (const QString& line : lines) { if (fi.isCanceled()) break; if (foundTag) diff --git a/src/plugins/android/androidsdkpackage.cpp b/src/plugins/android/androidsdkpackage.cpp index 5b218c448c..bbac30f19d 100644 --- a/src/plugins/android/androidsdkpackage.cpp +++ b/src/plugins/android/androidsdkpackage.cpp @@ -28,7 +28,7 @@ namespace Android { -AndroidSdkPackage::AndroidSdkPackage(QVersionNumber version, QString sdkStylePathStr, +AndroidSdkPackage::AndroidSdkPackage(const QVersionNumber &version, const QString &sdkStylePathStr, QObject *parent) : QObject(parent), m_revision(version), @@ -101,8 +101,8 @@ void AndroidSdkPackage::updatePackageDetails() } -SystemImage::SystemImage(QVersionNumber version, QString sdkStylePathStr, QString abi, - SdkPlatform *platform): +SystemImage::SystemImage(const QVersionNumber &version, const QString &sdkStylePathStr, + const QString &abi, SdkPlatform *platform): AndroidSdkPackage(version, sdkStylePathStr, platform), m_platform(platform), m_abiName(abi) @@ -144,7 +144,8 @@ void SystemImage::setApiLevel(const int apiLevel) m_apiLevel = apiLevel; } -SdkPlatform::SdkPlatform(QVersionNumber version, QString sdkStylePathStr, int api, QObject *parent) : +SdkPlatform::SdkPlatform(const QVersionNumber &version, const QString &sdkStylePathStr, + int api, QObject *parent) : AndroidSdkPackage(version, sdkStylePathStr, parent), m_apiLevel(api) { @@ -216,8 +217,9 @@ SystemImageList SdkPlatform::systemImages(PackageState state) const }); } -BuildTools::BuildTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent): - AndroidSdkPackage(revision, sdkStylePathStr, parent) +BuildTools::BuildTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } @@ -231,8 +233,8 @@ AndroidSdkPackage::PackageType BuildTools::type() const return AndroidSdkPackage::BuildToolsPackage; } -SdkTools::SdkTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent): - AndroidSdkPackage(revision, sdkStylePathStr, parent) +SdkTools::SdkTools(const QVersionNumber &revision, const QString &sdkStylePathStr, QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } @@ -247,8 +249,9 @@ AndroidSdkPackage::PackageType SdkTools::type() const return AndroidSdkPackage::SdkToolsPackage; } -PlatformTools::PlatformTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent): - AndroidSdkPackage(revision, sdkStylePathStr, parent) +PlatformTools::PlatformTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } @@ -263,8 +266,9 @@ AndroidSdkPackage::PackageType PlatformTools::type() const return AndroidSdkPackage::PlatformToolsPackage; } -EmulatorTools::EmulatorTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent): - AndroidSdkPackage(revision, sdkStylePathStr, parent) +EmulatorTools::EmulatorTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } @@ -279,8 +283,9 @@ AndroidSdkPackage::PackageType EmulatorTools::type() const return AndroidSdkPackage::EmulatorToolsPackage; } -ExtraTools::ExtraTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent) : - AndroidSdkPackage(revision, sdkStylePathStr, parent) +ExtraTools::ExtraTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } @@ -294,8 +299,8 @@ AndroidSdkPackage::PackageType ExtraTools::type() const return AndroidSdkPackage::ExtraToolsPackage; } -Ndk::Ndk(QVersionNumber revision, QString sdkStylePathStr, QObject *parent) : - AndroidSdkPackage(revision, sdkStylePathStr, parent) +Ndk::Ndk(const QVersionNumber &revision, const QString &sdkStylePathStr, QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } @@ -309,8 +314,9 @@ AndroidSdkPackage::PackageType Ndk::type() const return AndroidSdkPackage::NDKPackage; } -GenericSdkPackage::GenericSdkPackage(QVersionNumber revision, QString sdkStylePathStr, QObject *parent) : - AndroidSdkPackage(revision, sdkStylePathStr, parent) +GenericSdkPackage::GenericSdkPackage(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent) + : AndroidSdkPackage(revision, sdkStylePathStr, parent) { } diff --git a/src/plugins/android/androidsdkpackage.h b/src/plugins/android/androidsdkpackage.h index b177ceb93f..cd3857dfb0 100644 --- a/src/plugins/android/androidsdkpackage.h +++ b/src/plugins/android/androidsdkpackage.h @@ -68,7 +68,8 @@ public: AnyValidState = Installed | Available }; - AndroidSdkPackage(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + AndroidSdkPackage(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); ~AndroidSdkPackage() override = default; virtual bool isValid() const = 0; @@ -107,7 +108,7 @@ class SystemImage : public AndroidSdkPackage { Q_OBJECT public: - SystemImage(QVersionNumber revision, QString sdkStylePathStr, QString abi, + SystemImage(const QVersionNumber &revision, const QString &sdkStylePathStr, const QString &abi, SdkPlatform *platform = nullptr); // AndroidSdkPackage Overrides @@ -132,7 +133,7 @@ class SdkPlatform : public AndroidSdkPackage { Q_OBJECT public: - SdkPlatform(QVersionNumber revision, QString sdkStylePathStr, int api, + SdkPlatform(const QVersionNumber &revision, const QString &sdkStylePathStr, int api, QObject *parent = nullptr); ~SdkPlatform() override; @@ -158,7 +159,8 @@ using SdkPlatformList = QList<SdkPlatform*>; class BuildTools : public AndroidSdkPackage { public: - BuildTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + BuildTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); // AndroidSdkPackage Overrides public: @@ -169,7 +171,8 @@ public: class PlatformTools : public AndroidSdkPackage { public: - PlatformTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + PlatformTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); // AndroidSdkPackage Overrides public: @@ -180,7 +183,8 @@ public: class EmulatorTools : public AndroidSdkPackage { public: - EmulatorTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + EmulatorTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); // AndroidSdkPackage Overrides public: @@ -191,7 +195,8 @@ public: class SdkTools : public AndroidSdkPackage { public: - SdkTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + SdkTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); // AndroidSdkPackage Overrides public: @@ -202,7 +207,7 @@ public: class Ndk : public AndroidSdkPackage { public: - Ndk(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + Ndk(const QVersionNumber &revision, const QString &sdkStylePathStr, QObject *parent = nullptr); // AndroidSdkPackage Overrides bool isValid() const override; @@ -213,7 +218,8 @@ using NdkList = QList<Ndk *>; class ExtraTools : public AndroidSdkPackage { public: - ExtraTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + ExtraTools(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); // AndroidSdkPackage Overrides public: @@ -224,7 +230,8 @@ public: class GenericSdkPackage : public AndroidSdkPackage { public: - GenericSdkPackage(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + GenericSdkPackage(const QVersionNumber &revision, const QString &sdkStylePathStr, + QObject *parent = nullptr); // AndroidSdkPackage Overrides public: diff --git a/src/plugins/android/androidservicewidget.cpp b/src/plugins/android/androidservicewidget.cpp index dd4e1f297a..f7e1f0c499 100644 --- a/src/plugins/android/androidservicewidget.cpp +++ b/src/plugins/android/androidservicewidget.cpp @@ -148,7 +148,7 @@ void AndroidServiceWidget::AndroidServiceModel::addService() service.setNewService(true); m_services.push_back(service); endInsertRows(); - invalidDataChanged(); + emit invalidDataChanged(); } void AndroidServiceWidget::AndroidServiceModel::removeService(int row) @@ -298,11 +298,11 @@ bool AndroidServiceWidget::AndroidServiceModel::setData(const QModelIndex &index m_services[index.row()].setRunInExternalProcess((value == Qt::Checked) ? true : false); else if (index.column() == 3) m_services[index.row()].setRunInExternalLibrary((value == Qt::Checked) ? true : false); - dataChanged(createIndex(index.row(), 0), createIndex(index.row(), 5)); + emit dataChanged(createIndex(index.row(), 0), createIndex(index.row(), 5)); if (m_services[index.row()].isValid()) - validDataChanged(); + emit validDataChanged(); else - invalidDataChanged(); + emit invalidDataChanged(); } else if (role == Qt::EditRole) { if (index.column() == 0) { QString className = value.toString(); @@ -317,11 +317,11 @@ bool AndroidServiceWidget::AndroidServiceModel::setData(const QModelIndex &index } else if (index.column() == 5) { m_services[index.row()].setServiceArguments(value.toString()); } - dataChanged(index, index); + emit dataChanged(index, index); if (m_services[index.row()].isValid()) - validDataChanged(); + emit validDataChanged(); else - invalidDataChanged(); + emit invalidDataChanged(); } return true; } @@ -357,9 +357,9 @@ AndroidServiceWidget::AndroidServiceWidget(QWidget *parent) : QWidget(parent), m_removeButton->setEnabled(true); }); connect(m_model.data(), &AndroidServiceWidget::AndroidServiceModel::validDataChanged, - [this] {servicesModified();}); + [this] { emit servicesModified(); }); connect(m_model.data(), &AndroidServiceWidget::AndroidServiceModel::invalidDataChanged, - [this] {servicesInvalid();}); + [this] { emit servicesInvalid(); }); } AndroidServiceWidget::~AndroidServiceWidget() @@ -394,7 +394,7 @@ void AndroidServiceWidget::removeService() for (const auto &x : selections) { m_model->removeService(x.row()); m_removeButton->setEnabled(false); - servicesModified(); + emit servicesModified(); break; } } diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 4e57b1868b..1e566eb3c0 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -298,8 +298,8 @@ void AndroidSettingsWidget::showEvent(QShowEvent *event) validateJdk(); // Reloading SDK packages (force) is still synchronous. Use zero timer // to let settings dialog open first. - QTimer::singleShot(0, std::bind(&AndroidSdkManager::reloadPackages, - &m_sdkManager, false)); + QTimer::singleShot(0, &m_sdkManager, std::bind(&AndroidSdkManager::reloadPackages, + &m_sdkManager, false)); validateOpenSsl(); m_isInitialReloadDone = true; } @@ -308,12 +308,14 @@ void AndroidSettingsWidget::showEvent(QShowEvent *event) void AndroidSettingsWidget::updateNdkList() { m_ui.ndkListWidget->clear(); - for (const Ndk *ndk : m_sdkManager.installedNdkPackages()) { + const auto installedPkgs = m_sdkManager.installedNdkPackages(); + for (const Ndk *ndk : installedPkgs) { m_ui.ndkListWidget->addItem(new QListWidgetItem(Icons::LOCKED.icon(), ndk->installedLocation().toString())); } - for (const QString &ndk : m_androidConfig.getCustomNdkList()) { + const auto customNdks = m_androidConfig.getCustomNdkList(); + for (const QString &ndk : customNdks) { if (m_androidConfig.isValidNdk(ndk)) { m_ui.ndkListWidget->addItem(new QListWidgetItem(Icons::UNLOCKED.icon(), ndk)); } else { @@ -730,6 +732,7 @@ void AndroidSettingsWidget::downloadOpenSslRepo(const bool silent) connect(gitCloner, QOverload<int, QtcProcess::ExitStatus>::of(&QtcProcess::finished), + m_ui.openSslPathChooser, [=](int exitCode, QProcess::ExitStatus exitStatus) { openSslProgressDialog->close(); validateOpenSsl(); diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index d26c9f0d2a..a06ddfa920 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -47,18 +47,21 @@ namespace Internal { using namespace ProjectExplorer; using namespace Utils; -static const QHash<QString, Abi> ClangTargets = { - {"arm-linux-androideabi", - Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 32)}, - {"i686-linux-android", - Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 32)}, - {"x86_64-linux-android", - Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 64)}, - {"aarch64-linux-android", - Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 64)}}; - -static const QList<Utils::Id> LanguageIds = {ProjectExplorer::Constants::CXX_LANGUAGE_ID, - ProjectExplorer::Constants::C_LANGUAGE_ID}; +using ClangTargetsType = QHash<QString, Abi>; +Q_GLOBAL_STATIC_WITH_ARGS(ClangTargetsType, ClangTargets, ({ + {"arm-linux-androideabi", + Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 32)}, + {"i686-linux-android", + Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 32)}, + {"x86_64-linux-android", + Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 64)}, + {"aarch64-linux-android", + Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::AndroidLinuxFlavor, Abi::ElfFormat, 64)}} +)); + +Q_GLOBAL_STATIC_WITH_ARGS(QList<Utils::Id>, LanguageIds, ( + {ProjectExplorer::Constants::CXX_LANGUAGE_ID, + ProjectExplorer::Constants::C_LANGUAGE_ID})) static ToolChain *findToolChain(Utils::FilePath &compilerPath, Utils::Id lang, const QString &target, const ToolChainList &alreadyKnown) @@ -66,7 +69,7 @@ static ToolChain *findToolChain(Utils::FilePath &compilerPath, Utils::Id lang, c ToolChain * tc = Utils::findOrDefault(alreadyKnown, [target, compilerPath, lang](ToolChain *tc) { return tc->typeId() == Constants::ANDROID_TOOLCHAIN_TYPEID && tc->language() == lang - && tc->targetAbi() == ClangTargets[target] + && tc->targetAbi() == ClangTargets->value(target) && tc->compilerCommand() == compilerPath; }); return tc; @@ -148,7 +151,7 @@ FilePath AndroidToolChain::makeCommand(const Environment &env) const GccToolChain::DetectedAbisResult AndroidToolChain::detectSupportedAbis() const { - for (auto itr = ClangTargets.constBegin();itr != ClangTargets.constEnd(); ++itr) { + for (auto itr = ClangTargets->constBegin(); itr != ClangTargets->constEnd(); ++itr) { if (itr.value() == targetAbi()) return GccToolChain::DetectedAbisResult({targetAbi()}, itr.key()); } @@ -216,7 +219,7 @@ ToolChainList AndroidToolChainFactory::autodetectToolChainsFromNdks( continue; } - for (const Utils::Id &lang : LanguageIds) { + for (const Utils::Id &lang : *LanguageIds) { FilePath compilerCommand = clangPath; if (lang == ProjectExplorer::Constants::CXX_LANGUAGE_ID) compilerCommand = clangPlusPlusPath(clangPath); @@ -227,8 +230,8 @@ ToolChainList AndroidToolChainFactory::autodetectToolChainsFromNdks( continue; } - auto targetItr = ClangTargets.constBegin(); - while (targetItr != ClangTargets.constEnd()) { + auto targetItr = ClangTargets->constBegin(); + while (targetItr != ClangTargets->constEnd()) { const Abi &abi = targetItr.value(); const QString target = targetItr.key(); ToolChain *tc = findToolChain(compilerCommand, lang, target, alreadyKnown); @@ -249,7 +252,7 @@ ToolChainList AndroidToolChainFactory::autodetectToolChainsFromNdks( atc->setNdkLocation(ndkLocation); atc->setOriginalTargetTriple(target); atc->setLanguage(lang); - atc->setTargetAbi(ClangTargets[target]); + atc->setTargetAbi(ClangTargets->value(target)); atc->setPlatformCodeGenFlags({"-target", target}); atc->setPlatformLinkerFlags({"-target", target}); atc->setDisplayName(displayName); diff --git a/src/plugins/android/avddialog.cpp b/src/plugins/android/avddialog.cpp index 9353f148bb..dd3224701d 100644 --- a/src/plugins/android/avddialog.cpp +++ b/src/plugins/android/avddialog.cpp @@ -142,7 +142,8 @@ void AvdDialog::parseDeviceDefinitionsList() QStringList avdDeviceInfo; - for (const QString &line : output.split('\n')) { + const auto lines = output.split('\n'); + for (const QString &line : lines) { if (line.startsWith("---------") || line.isEmpty()) { DeviceDefinitionStruct deviceDefinition; for (const QString &line : avdDeviceInfo) { diff --git a/src/plugins/android/avdmanageroutputparser.cpp b/src/plugins/android/avdmanageroutputparser.cpp index 69edfbe896..e8e5933b8a 100644 --- a/src/plugins/android/avdmanageroutputparser.cpp +++ b/src/plugins/android/avdmanageroutputparser.cpp @@ -144,7 +144,8 @@ AndroidDeviceInfoList parseAvdList(const QString &output, QStringList *avdErrorP return AvdResult(); }; - for (const QString &line : output.split('\n')) { + const auto lines = output.split('\n'); + for (const QString &line : lines) { if (line.startsWith("---------") || line.isEmpty()) { const AvdResult result = parseAvdInfo(avdInfo); if (auto info = Utils::get_if<AndroidDeviceInfo>(&result)) diff --git a/src/plugins/android/splashscreencontainerwidget.cpp b/src/plugins/android/splashscreencontainerwidget.cpp index 99bd7be3a0..79e04f5b44 100644 --- a/src/plugins/android/splashscreencontainerwidget.cpp +++ b/src/plugins/android/splashscreencontainerwidget.cpp @@ -46,19 +46,19 @@ namespace Android { namespace Internal { namespace { -const QString extraExtraExtraHighDpiImagePath = QLatin1String("/res/drawable-xxxhdpi/"); -const QString extraExtraHighDpiImagePath = QLatin1String("/res/drawable-xxhdpi/"); -const QString extraHighDpiImagePath = QLatin1String("/res/drawable-xhdpi/"); -const QString highDpiImagePath = QLatin1String("/res/drawable-hdpi/"); -const QString mediumDpiImagePath = QLatin1String("/res/drawable-mdpi/"); -const QString lowDpiImagePath = QLatin1String("/res/drawable-ldpi/"); -const QString splashscreenName = QLatin1String("splashscreen"); -const QString splashscreenPortraitName = QLatin1String("splashscreen_port"); -const QString splashscreenLandscapeName = QLatin1String("splashscreen_land"); -const QString splashscreenFileName = QLatin1String("logo"); -const QString splashscreenPortraitFileName = QLatin1String("logo_port"); -const QString splashscreenLandscapeFileName = QLatin1String("logo_land"); -const QString imageSuffix = QLatin1String(".png"); +const char extraExtraExtraHighDpiImagePath[] = "/res/drawable-xxxhdpi/"; +const char extraExtraHighDpiImagePath[] = "/res/drawable-xxhdpi/"; +const char extraHighDpiImagePath[] = "/res/drawable-xhdpi/"; +const char highDpiImagePath[] = "/res/drawable-hdpi/"; +const char mediumDpiImagePath[] = "/res/drawable-mdpi/"; +const char lowDpiImagePath[] = "/res/drawable-ldpi/"; +const char splashscreenName[] = "splashscreen"; +const char splashscreenPortraitName[] = "splashscreen_port"; +const char splashscreenLandscapeName[] = "splashscreen_land"; +const char splashscreenFileName[] = "logo"; +const char splashscreenPortraitFileName[] = "logo_port"; +const char splashscreenLandscapeFileName[] = "logo_land"; +const char imageSuffix[] = ".png"; const QString fileDialogImageFiles = QString(QWidget::tr("Images (*.png *.jpg)")); const QSize lowDpiImageSize{200, 320}; const QSize mediumDpiImageSize{320, 480}; @@ -295,12 +295,16 @@ SplashScreenContainerWidget::SplashScreenContainerWidget( noSplashscreenWidget->setLayout(noSplashscreenLayout); addWidget(noSplashscreenWidget); + const auto splashFileName = QString(splashscreenFileName).append(imageSuffix); + const auto portraitSplashFileName = QString(splashscreenPortraitFileName).append(imageSuffix); + const auto landscapeSplashFileName = QString(splashscreenLandscapeFileName).append(imageSuffix); + for (auto &&imageWidget : m_imageWidgets) - imageWidget->setImageFileName(splashscreenFileName + imageSuffix); + imageWidget->setImageFileName(splashFileName); for (auto &&imageWidget : m_portraitImageWidgets) - imageWidget->setImageFileName(splashscreenPortraitFileName + imageSuffix); + imageWidget->setImageFileName(portraitSplashFileName); for (auto &&imageWidget : m_landscapeImageWidgets) - imageWidget->setImageFileName(splashscreenLandscapeFileName + imageSuffix); + imageWidget->setImageFileName(landscapeSplashFileName); for (auto &&imageWidget : m_imageWidgets) { connect(imageWidget, &SplashScreenWidget::imageChanged, [this]() { |