diff options
author | Jarek Kobus <[email protected]> | 2024-04-15 23:47:37 +0200 |
---|---|---|
committer | Jarek Kobus <[email protected]> | 2024-04-17 13:35:41 +0000 |
commit | bd282f1ada6f345aefd295098fe469a095f36a76 (patch) | |
tree | 775977fcd19194b0832f43b4ddebd510eab404da /src/plugins/android/androidsdkmanager.cpp | |
parent | b8e1b33455645adb0256ff783da58b8960192224 (diff) |
Android: Get rid of onLicenseStdOut()
Make code more readable.
Change-Id: Icc01a90d7f1469bb58fba325bca728e002c79512
Reviewed-by: <[email protected]>
Reviewed-by: Alessandro Portale <[email protected]>
Diffstat (limited to 'src/plugins/android/androidsdkmanager.cpp')
-rw-r--r-- | src/plugins/android/androidsdkmanager.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index e51c324839a..11c9e205f28 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -4,7 +4,6 @@ #include "androidconfigurations.h" #include "androidsdkmanager.h" #include "androidtr.h" -#include "avdmanageroutputparser.h" #include "sdkmanageroutputparser.h" #include <utils/algorithm.h> @@ -46,18 +45,6 @@ static const QRegularExpression &assertionRegExp() return theRegExp; } -static std::optional<QString> onLicenseStdOut(const QString &output, QString *licenseTextCache) -{ - licenseTextCache->append(output); - const QRegularExpressionMatch assertionMatch = assertionRegExp().match(*licenseTextCache); - if (assertionMatch.hasMatch()) { - const QString ret = *licenseTextCache; - licenseTextCache->clear(); - return ret; - } - return {}; -} - int parseProgress(const QString &out, bool &foundAssertion) { int progress = -1; @@ -540,12 +527,16 @@ void AndroidSdkManagerPrivate::getPendingLicense(SdkCmdPromise &fi) QString licenseTextCache; while (!licenseCommand.waitForFinished(200ms)) { const QString stdOut = codec->toUnicode(licenseCommand.readAllRawStandardOutput()); - std::optional<QString> assertion; + bool assertion = false; if (!stdOut.isEmpty()) { - assertion = onLicenseStdOut(stdOut, &licenseTextCache); - if (assertion && reviewingLicenses) { - result.stdOutput = *assertion; - fi.addResult(result); + licenseTextCache.append(stdOut); + assertion = assertionRegExp().match(licenseTextCache).hasMatch(); + if (assertion) { + if (reviewingLicenses) { + result.stdOutput = licenseTextCache; + fi.addResult(result); + } + licenseTextCache.clear(); } } |