Unarchiver: Replace QVector with QList

Change-Id: Ib8a954f1b29ee475b645191424eb0e391dbb6baf
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-07-13 17:50:21 +02:00
parent 6bb8bbabd2
commit 9f3e0db3e4

View File

@@ -37,9 +37,9 @@ static FilePaths additionalInstallDirs(const QString &registryKey, const QString
#endif #endif
} }
static const QVector<Tool> &sTools() static const QList<Tool> &sTools()
{ {
static QVector<Tool> tools; static QList<Tool> tools;
if (tools.isEmpty()) { if (tools.isEmpty()) {
if (HostOsInfo::isWindowsHost()) { if (HostOsInfo::isWindowsHost()) {
tools << Tool{{"powershell", "-command Expand-Archive -Force '%{src}' '%{dest}'", CommandLine::Raw}, tools << Tool{{"powershell", "-command Expand-Archive -Force '%{src}' '%{dest}'", CommandLine::Raw},
@@ -76,7 +76,7 @@ static const QVector<Tool> &sTools()
return tools; return tools;
} }
static QVector<Tool> toolsForMimeType(const MimeType &mimeType) static QList<Tool> toolsForMimeType(const MimeType &mimeType)
{ {
return Utils::filtered(sTools(), [mimeType](const Tool &tool) { return Utils::filtered(sTools(), [mimeType](const Tool &tool) {
return Utils::anyOf(tool.supportedMimeTypes, return Utils::anyOf(tool.supportedMimeTypes,
@@ -84,7 +84,7 @@ static QVector<Tool> toolsForMimeType(const MimeType &mimeType)
}); });
} }
static QVector<Tool> toolsForFilePath(const FilePath &fp) static QList<Tool> toolsForFilePath(const FilePath &fp)
{ {
return toolsForMimeType(mimeTypeForFile(fp)); return toolsForMimeType(mimeTypeForFile(fp));
} }
@@ -100,7 +100,7 @@ static std::optional<Tool> resolveTool(const Tool &tool)
expected_str<Unarchiver::SourceAndCommand> Unarchiver::sourceAndCommand(const FilePath &sourceFile) expected_str<Unarchiver::SourceAndCommand> Unarchiver::sourceAndCommand(const FilePath &sourceFile)
{ {
const QVector<Tool> tools = toolsForFilePath(sourceFile); const QList<Tool> tools = toolsForFilePath(sourceFile);
if (tools.isEmpty()) if (tools.isEmpty())
return make_unexpected(Tr::tr("File format not supported.")); return make_unexpected(Tr::tr("File format not supported."));