2023-02-21 14:11:40 +01:00
|
|
|
// 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
|
|
|
|
|
|
2023-03-09 11:30:31 +01:00
|
|
|
#include "qtsupport_global.h"
|
|
|
|
|
|
2023-02-21 14:11:40 +01:00
|
|
|
#include <coreplugin/welcomepagehelper.h>
|
|
|
|
|
#include <utils/expected.h>
|
2023-02-22 10:17:19 +01:00
|
|
|
#include <utils/filepath.h>
|
2023-02-21 14:11:40 +01:00
|
|
|
|
|
|
|
|
namespace QtSupport::Internal {
|
|
|
|
|
|
|
|
|
|
enum InstructionalType { Example = 0, Demo, Tutorial };
|
|
|
|
|
|
2023-03-09 11:30:31 +01:00
|
|
|
class QTSUPPORT_EXPORT ExampleItem : public Core::ListItem
|
2023-02-21 14:11:40 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2023-02-22 10:17:19 +01:00
|
|
|
Utils::FilePath projectPath;
|
2023-02-21 14:11:40 +01:00
|
|
|
QString docUrl;
|
2023-02-22 10:17:19 +01:00
|
|
|
Utils::FilePaths filesToOpen;
|
|
|
|
|
Utils::FilePath mainFile; /* file to be visible after opening filesToOpen */
|
|
|
|
|
Utils::FilePaths dependencies;
|
2023-02-21 14:11:40 +01:00
|
|
|
InstructionalType type;
|
|
|
|
|
bool hasSourceCode = false;
|
|
|
|
|
bool isVideo = false;
|
|
|
|
|
bool isHighlighted = false;
|
|
|
|
|
QString videoUrl;
|
|
|
|
|
QString videoLength;
|
|
|
|
|
QStringList platforms;
|
2023-03-09 14:00:08 +01:00
|
|
|
QHash<QString, QStringList> metaData;
|
2023-02-21 14:11:40 +01:00
|
|
|
};
|
|
|
|
|
|
2023-03-09 11:30:31 +01:00
|
|
|
QTSUPPORT_EXPORT Utils::expected_str<QList<ExampleItem *>> parseExamples(
|
|
|
|
|
const Utils::FilePath &manifest,
|
|
|
|
|
const Utils::FilePath &examplesInstallPath,
|
|
|
|
|
const Utils::FilePath &demosInstallPath,
|
|
|
|
|
bool examples);
|
|
|
|
|
|
|
|
|
|
QTSUPPORT_EXPORT Utils::expected_str<QList<ExampleItem *>> parseExamples(
|
|
|
|
|
const QByteArray &manifestData,
|
|
|
|
|
const Utils::FilePath &manifestPath,
|
|
|
|
|
const Utils::FilePath &examplesInstallPath,
|
|
|
|
|
const Utils::FilePath &demosInstallPath,
|
|
|
|
|
bool examples);
|
2023-02-21 14:11:40 +01:00
|
|
|
|
2023-05-25 15:49:57 +02:00
|
|
|
QTSUPPORT_TEST_EXPORT QList<std::pair<Core::Section, QList<ExampleItem *>>> getCategories(
|
2023-05-24 12:38:31 +02:00
|
|
|
const QList<ExampleItem *> &items, bool sortIntoCategories);
|
|
|
|
|
|
2023-02-21 14:11:40 +01:00
|
|
|
} // namespace QtSupport::Internal
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(QtSupport::Internal::ExampleItem *)
|