| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef PAGENODE_H |
| 5 | #define PAGENODE_H |
| 6 | |
| 7 | #include "genustypes.h" |
| 8 | #include "node.h" |
| 9 | |
| 10 | #include <QtCore/qglobal.h> |
| 11 | #include <QtCore/qstring.h> |
| 12 | #include <QtCore/qstringlist.h> |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | |
| 16 | class Aggregate; |
| 17 | |
| 18 | class PageNode : public Node |
| 19 | { |
| 20 | public: |
| 21 | PageNode(Aggregate *parent, const QString &name) : Node(NodeType::Page, parent, name) {} |
| 22 | PageNode(NodeType type, Aggregate *parent, const QString &name) : Node(type, parent, name) {} |
| 23 | |
| 24 | [[nodiscard]] bool isPageNode() const override { return true; } |
| 25 | [[nodiscard]] bool isTextPageNode() const override |
| 26 | { |
| 27 | return !isAggregate(); |
| 28 | } // PageNode but not Aggregate |
| 29 | |
| 30 | [[nodiscard]] QString title() const override { return m_title; } |
| 31 | [[nodiscard]] QString subtitle() const override { return m_subtitle; } |
| 32 | [[nodiscard]] QString fullTitle() const override; |
| 33 | bool setTitle(const QString &title) override; |
| 34 | bool setSubtitle(const QString &subtitle) override |
| 35 | { |
| 36 | m_subtitle = subtitle; |
| 37 | return true; |
| 38 | } |
| 39 | [[nodiscard]] virtual QString imageFileName() const { return QString(); } |
| 40 | virtual void setImageFileName(const QString &) {} |
| 41 | |
| 42 | [[nodiscard]] bool noAutoList() const { return m_noAutoList; } |
| 43 | void setNoAutoList(bool b) { m_noAutoList = b; } |
| 44 | [[nodiscard]] const QStringList &groupNames() const { return m_groupNames; } |
| 45 | void appendGroupName(const QString &t) override { m_groupNames.append(t); } |
| 46 | |
| 47 | [[nodiscard]] const PageNode *navigationParent() const { return m_navParent; } |
| 48 | void setNavigationParent(const PageNode *parent) { m_navParent = parent; } |
| 49 | |
| 50 | void markAttribution() { is_attribution = true; } |
| 51 | [[nodiscard]] bool isAttribution() const { return is_attribution; } |
| 52 | |
| 53 | protected: |
| 54 | friend class Node; |
| 55 | |
| 56 | protected: |
| 57 | bool m_noAutoList { false }; |
| 58 | QString m_title {}; |
| 59 | QString m_subtitle {}; |
| 60 | QStringList m_groupNames {}; |
| 61 | |
| 62 | // Marks the PageNode as being or not being an attribution. |
| 63 | // A PageNode that is an attribution represents a page that serves |
| 64 | // to present the third party software that a project uses, |
| 65 | // together with its license, link to the website of the project |
| 66 | // and so on. |
| 67 | // PageNode that are attribution are expected to be generate only |
| 68 | // for the Qt project by the QAttributionScanner, as part of the |
| 69 | // built of Qt's documentation. |
| 70 | // |
| 71 | // PageNodes that are attribution are marked primarily so that |
| 72 | // QDoc is able to generate a specialized list of attributions for |
| 73 | // a specific module through the use of the "\generatedlist" |
| 74 | // command, and behave like any other PageNode otherwise. |
| 75 | bool is_attribution{ false }; |
| 76 | |
| 77 | private: |
| 78 | const PageNode *m_navParent { nullptr }; |
| 79 | }; |
| 80 | |
| 81 | QT_END_NAMESPACE |
| 82 | |
| 83 | #endif // PAGENODE_H |
| 84 | |