KNewStuff

qtquick/author.h
1/*
2 SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
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 <entry.h>
13
14// TODO This is not a class for exposing data QtQuick, but for implementing it's fetching in the first place.
15// Also it sepnds on the QML parser status, this is kindof ugly...
16namespace KNewStuffQuick
17{
18class AuthorPrivate;
19/**
20 * @short Encapsulates a KNSCore::Author for use in Qt Quick
21 *
22 * This class takes care of initialisation of a KNSCore::Author when assigned an engine, provider ID and username.
23 * If the data is not yet cached, it will be requested from the provider, and updated for display
24 * @since 5.63
25 */
26class Author : public QObject, public QQmlParserStatus
27{
30 /**
31 * The NewStuffQuickEngine to interact with servers through
32 */
33 Q_PROPERTY(QObject *engine READ engine WRITE setEngine NOTIFY engineChanged)
34 /**
35 * The ID of the provider which the user is registered on
36 */
37 Q_PROPERTY(QString providerId READ providerId WRITE setProviderId NOTIFY providerIdChanged)
38 /**
39 * The user ID for the user this object represents
40 */
41 Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
42
43 Q_PROPERTY(QString name READ name NOTIFY dataChanged)
44 Q_PROPERTY(QString description READ description NOTIFY dataChanged)
45 Q_PROPERTY(QString homepage READ homepage NOTIFY dataChanged)
46 Q_PROPERTY(QString profilepage READ profilepage NOTIFY dataChanged)
47 Q_PROPERTY(QUrl avatarUrl READ avatarUrl NOTIFY dataChanged)
48public:
49 explicit Author(QObject *parent = nullptr);
51 void classBegin() override;
52 void componentComplete() override;
53
55 void setEngine(QObject *newEngine);
56 Q_SIGNAL void engineChanged();
57
59 void setProviderId(const QString &providerId);
60 Q_SIGNAL void providerIdChanged();
61
63 void setUsername(const QString &username);
64 Q_SIGNAL void usernameChanged();
65
66 QString name() const;
67 QString description() const;
68 QString homepage() const;
69 QString profilepage() const;
70 QUrl avatarUrl() const;
71 Q_SIGNAL void dataChanged();
72
73private:
74 const std::unique_ptr<AuthorPrivate> d;
75};
76}
77
78#endif // KNSQUICK_AUTHOR_H
Encapsulates a KNSCore::Author for use in Qt Quick.
QString username
The user ID for the user this object represents.
QString providerId
The ID of the provider which the user is registered on.
QObject * engine
The NewStuffQuickEngine to interact with servers through.
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALQ_SIGNAL
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.