Move examples manifest parser in separate function

and file. To make it auto-testable.

Change-Id: I19d263bf080a0089eb9a4ec0f379c52446771c0a
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit 7e75097447)
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2023-02-21 14:11:40 +01:00
parent 41e78b9e57
commit 584874f15f
7 changed files with 330 additions and 238 deletions

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <coreplugin/welcomepagehelper.h>
#include <utils/expected.h>
namespace QtSupport::Internal {
enum InstructionalType { Example = 0, Demo, Tutorial };
class ExampleItem : public Core::ListItem
{
public:
QString projectPath;
QString docUrl;
QStringList filesToOpen;
QString mainFile; /* file to be visible after opening filesToOpen */
QStringList dependencies;
InstructionalType type;
int difficulty = 0;
bool hasSourceCode = false;
bool isVideo = false;
bool isHighlighted = false;
QString videoUrl;
QString videoLength;
QStringList platforms;
};
Utils::expected_str<QList<ExampleItem *>> parseExamples(const QString &manifest,
const QString &examplesInstallPath,
const QString &demosInstallPath,
bool examples);
} // namespace QtSupport::Internal
Q_DECLARE_METATYPE(QtSupport::Internal::ExampleItem *)