KNewStuff

qtquick/author.h
1 /*
2  SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef KNSQUICK_AUTHOR_H
8 #define KNSQUICK_AUTHOR_H
9 
10 #include <QObject>
11 #include <QQmlParserStatus>
12 #include <entryinternal.h>
13 
14 namespace KNewStuffQuick
15 {
16 /**
17  * @short Encapsulates a KNSCore::Author for use in Qt Quick
18  *
19  * This class takes care of initialisation of a KNSCore::Author when assigned an engine, provider ID and username.
20  * If the data is not yet cached, it will be requested from the provider, and updated for display
21  * @since 5.63
22  */
23 class Author : public QObject, public QQmlParserStatus
24 {
25  Q_OBJECT
27  /**
28  * The NewStuffQuickEngine to interact with servers through
29  */
30  Q_PROPERTY(QObject *engine READ engine WRITE setEngine NOTIFY engineChanged)
31  /**
32  * The ID of the provider which the user is registered on
33  */
34  Q_PROPERTY(QString providerId READ providerId WRITE setProviderId NOTIFY providerIdChanged)
35  /**
36  * The user ID for the user this object represents
37  */
38  Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
39 
40  Q_PROPERTY(QString name READ name NOTIFY dataChanged)
41  Q_PROPERTY(QString description READ description NOTIFY dataChanged)
42  Q_PROPERTY(QString homepage READ homepage NOTIFY dataChanged)
43  Q_PROPERTY(QString profilepage READ profilepage NOTIFY dataChanged)
44  Q_PROPERTY(QUrl avatarUrl READ avatarUrl NOTIFY dataChanged)
45 public:
46  explicit Author(QObject *parent = nullptr);
47  ~Author() override;
48  void classBegin() override;
49  void componentComplete() override;
50 
51  QObject *engine() const;
52  void setEngine(QObject *newEngine);
53  Q_SIGNAL void engineChanged();
54 
55  QString providerId() const;
56  void setProviderId(const QString &providerId);
57  Q_SIGNAL void providerIdChanged();
58 
59  QString username() const;
60  void setUsername(const QString &username);
61  Q_SIGNAL void usernameChanged();
62 
63  QString name() const;
64  QString description() const;
65  QString homepage() const;
66  QString profilepage() const;
67  QUrl avatarUrl() const;
68  Q_SIGNAL void dataChanged();
69 
70 private:
71  class Private;
72  Private *d;
73 };
74 }
75 
76 #endif // KNSQUICK_AUTHOR_H
Encapsulates a KNSCore::Author for use in Qt Quick.
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALQ_SIGNAL
Q_INTERFACES(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 22:38:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.