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#include "quickengine.h"
15
16// TODO This is not a class for exposing data QtQuick, but for implementing it's fetching in the first place.
17// Also it sepnds on the QML parser status, this is kindof ugly...
18namespace KNewStuffQuick
19{
20class AuthorPrivate;
21/**
22 * @short Encapsulates a KNSCore::Author for use in Qt Quick
23 *
24 * This class takes care of initialisation of a KNSCore::Author when assigned an engine, provider ID and username.
25 * If the data is not yet cached, it will be requested from the provider, and updated for display
26 * @since 5.63
27 */
28class Author : public QObject, public QQmlParserStatus
29{
32 /**
33 * The NewStuffQuickEngine to interact with servers through
34 */
35 Q_PROPERTY(Engine *engine READ engine WRITE setEngine NOTIFY engineChanged)
36 /**
37 * The ID of the provider which the user is registered on
38 */
39 Q_PROPERTY(QString providerId READ providerId WRITE setProviderId NOTIFY providerIdChanged)
40 /**
41 * The user ID for the user this object represents
42 */
43 Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
44
45 Q_PROPERTY(QString name READ name NOTIFY dataChanged)
46 Q_PROPERTY(QString description READ description NOTIFY dataChanged)
47 Q_PROPERTY(QString homepage READ homepage NOTIFY dataChanged)
48 Q_PROPERTY(QString profilepage READ profilepage NOTIFY dataChanged)
49 Q_PROPERTY(QUrl avatarUrl READ avatarUrl NOTIFY dataChanged)
50public:
51 explicit Author(QObject *parent = nullptr);
52 ~Author() override;
53 void classBegin() override;
54 void componentComplete() override;
55
56 Engine *engine() const;
57 void setEngine(Engine *newEngine);
58 Q_SIGNAL void engineChanged();
59
60 QString providerId() const;
61 void setProviderId(const QString &providerId);
62 Q_SIGNAL void providerIdChanged();
63
64 QString username() const;
65 void setUsername(const QString &username);
66 Q_SIGNAL void usernameChanged();
67
68 QString name() const;
69 QString description() const;
70 QString homepage() const;
71 QString profilepage() const;
72 QUrl avatarUrl() const;
73 Q_SIGNAL void dataChanged();
74
75private:
76 const std::unique_ptr<AuthorPrivate> d;
77};
78}
79
80#endif // KNSQUICK_AUTHOR_H
KNSCore::EngineBase for interfacing with QML.
Definition quickengine.h:29
Encapsulates a KNSCore::Author for use in Qt Quick.
Engine * engine
The NewStuffQuickEngine to interact with servers through.
QString username
The user ID for the user this object represents.
QString providerId
The ID of the provider which the user is registered on.
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 Fri Jul 26 2024 11:56:35 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.