Android: Simplify pre-/post-run adb command input

AdbCommandWidget is cumbersome to use and has issues regarding updating
the enabled state of the buttons and the dragging and dropping of items.

Cut the maintenance and replace AdbCommandWidget with a StringAspect,
where one line means one entry, just like several other places in Qt
Creator do.

Some residue remains though: in order to keep project settings
compatibility, we need to convert from QStringList (settings) to QString
(StringAspect) and back.

Change-Id: I3ebfff882358ba2e8c0ac6d5b309e89a84f0554c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2021-03-25 19:10:35 +01:00
parent fdd69e27b3
commit bc7d0561c3
9 changed files with 26 additions and 435 deletions

View File

@@ -297,14 +297,18 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
}
if (auto aspect = runControl->aspect(Constants::ANDROID_PRESTARTSHELLCMDLIST)) {
for (const QString &shellCmd : static_cast<BaseStringListAspect *>(aspect)->value())
const QStringList commands =
static_cast<StringAspect *>(aspect)->value().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands)
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
}
for (const QString &shellCmd : runner->recordedData(Constants::ANDROID_PRESTARTSHELLCMDLIST).toStringList())
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
if (auto aspect = runControl->aspect(Constants::ANDROID_POSTFINISHSHELLCMDLIST)) {
for (const QString &shellCmd : static_cast<BaseStringListAspect *>(aspect)->value())
const QStringList commands =
static_cast<StringAspect *>(aspect)->value().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands)
m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd));
}
for (const QString &shellCmd : runner->recordedData(Constants::ANDROID_POSTFINISHSHELLCMDLIST).toStringList())