diff options
author | Alessandro Portale <[email protected]> | 2024-05-16 11:23:10 +0200 |
---|---|---|
committer | Jarek Kobus <[email protected]> | 2024-05-16 09:33:59 +0000 |
commit | 46fb01f785fc2fc7111b7870400768047d89be09 (patch) | |
tree | 1182b1832c3a167dc6c1941470eaffe6d12be191 | |
parent | 7af6722c07643aad401cd6844a4ca436d5220941 (diff) |
Android: Make avdConfigEditManufacturerTag() more readable
Rename it to modifyManufacturerTag() and use newly introduced enum
to describe the type of modification.
Change-Id: I8e903891e87d7133ec37e9aecfd303b424a36d15
Reviewed-by: Alessandro Portale <[email protected]>
-rw-r--r-- | src/plugins/android/androidavdmanager.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/android/androidavdmanager.cpp b/src/plugins/android/androidavdmanager.cpp index fc9148d3fe5..664f2346200 100644 --- a/src/plugins/android/androidavdmanager.cpp +++ b/src/plugins/android/androidavdmanager.cpp @@ -44,7 +44,9 @@ bool AndroidAvdManager::avdManagerCommand(const QStringList &args, QString *outp return false; } -static void avdConfigEditManufacturerTag(const FilePath &avdPath, bool recoverMode = false) +enum TagModification { CommentOut, Uncomment }; + +static void modifyManufacturerTag(const FilePath &avdPath, TagModification modification) { if (!avdPath.exists()) return; @@ -59,7 +61,7 @@ static void avdConfigEditManufacturerTag(const FilePath &avdPath, bool recoverMo while (!textStream.atEnd()) { QString line = textStream.readLine(); if (line.contains("hw.device.manufacturer")) { - if (recoverMode) + if (modification == Uncomment) line.replace("#", ""); else line.prepend("#"); @@ -92,12 +94,12 @@ static AndroidDeviceInfoList listVirtualDevices() const auto parsedAvdList = parseAvdList(output); if (parsedAvdList.errorPaths.isEmpty()) { for (const FilePath &avdPath : std::as_const(allAvdErrorPaths)) - avdConfigEditManufacturerTag(avdPath, true); // re-add manufacturer tag + modifyManufacturerTag(avdPath, Uncomment); return parsedAvdList.avdList; } allAvdErrorPaths << parsedAvdList.errorPaths; for (const FilePath &avdPath : parsedAvdList.errorPaths) - avdConfigEditManufacturerTag(avdPath); // comment out manufacturer tag + modifyManufacturerTag(avdPath, CommentOut); } return {}; } |