diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-02-22 10:17:19 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-04-13 07:13:50 +0000 |
commit | ac17e0e2ad47f16c80eb233725c4a603f6053acb (patch) | |
tree | 5d1cdeaaaf8ee7ebcad5a52ccc2010ce51e38f1a /src/plugins/qtsupport/exampleslistmodel.cpp | |
parent | e6e9405cc995138a4e439b2560bf4702c9c30c93 (diff) |
Convert Examples model to FilePath
Change-Id: I56219d2f9516662b32d45fd9b2108a0ad34113cc
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit 255afd45bf614f20b5c0ccee092dcf28c50a1827)
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/qtsupport/exampleslistmodel.cpp')
-rw-r--r-- | src/plugins/qtsupport/exampleslistmodel.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 700248e1f9..40196934d4 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -298,14 +298,15 @@ static bool isValidExampleOrDemo(ExampleItem *item) doesn't have any namespace */ QString reason; bool ok = true; - if (!item->hasSourceCode || !QFileInfo::exists(item->projectPath)) { + if (!item->hasSourceCode || !item->projectPath.exists()) { ok = false; - reason = QString::fromLatin1("projectPath \"%1\" empty or does not exist").arg(item->projectPath); + reason = QString::fromLatin1("projectPath \"%1\" empty or does not exist") + .arg(item->projectPath.toUserOutput()); } else if (item->imageUrl.startsWith(invalidPrefix) || !QUrl(item->imageUrl).isValid()) { ok = false; reason = QString::fromLatin1("imageUrl \"%1\" not valid").arg(item->imageUrl); } else if (!item->docUrl.isEmpty() - && (item->docUrl.startsWith(invalidPrefix) || !QUrl(item->docUrl).isValid())) { + && (item->docUrl.startsWith(invalidPrefix) || !QUrl(item->docUrl).isValid())) { ok = false; reason = QString::fromLatin1("docUrl \"%1\" non-empty but not valid").arg(item->docUrl); } @@ -331,13 +332,17 @@ void ExamplesViewController::updateExamples() QList<ExampleItem *> items; for (const QString &exampleSource : sources) { + const auto manifest = FilePath::fromUserInput(exampleSource); if (debugExamples()) { qWarning() << QString::fromLatin1("Reading file \"%1\"...") - .arg(QFileInfo(exampleSource).absoluteFilePath()); + .arg(manifest.absoluteFilePath().toUserOutput()); } const expected_str<QList<ExampleItem *>> result - = parseExamples(exampleSource, examplesInstallPath, demosInstallPath, m_isExamples); + = parseExamples(manifest, + FilePath::fromUserInput(examplesInstallPath), + FilePath::fromUserInput(demosInstallPath), + m_isExamples); if (!result) { if (debugExamples()) { qWarning() << "ERROR: Could not read examples from" << exampleSource << ":" |