Purpose

rbreviewslistmodel.h
1/*
2 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef REVIEWSLISTMODEL_H
8#define REVIEWSLISTMODEL_H
9
10#include <QAbstractListModel>
11#include <QList>
12#include <QUrl>
13
14class KJob;
15
16class ReviewsListModel : public QAbstractListModel
17{
19 Q_PROPERTY(QUrl server READ server WRITE setServer)
20 Q_PROPERTY(QString username READ username WRITE setUsername)
21 Q_PROPERTY(QString status READ status WRITE setStatus)
22 Q_PROPERTY(QString repository READ repository WRITE setRepository)
23public:
24 ReviewsListModel(QObject *parent = nullptr);
25
26 void refresh();
27
28 QVariant data(const QModelIndex &idx, int role) const override;
29 int rowCount(const QModelIndex &parent) const override;
30
31 QUrl server() const
32 {
33 return m_server;
34 }
35 QString username() const
36 {
37 return m_username;
38 }
39 QString status() const
40 {
41 return m_status;
42 }
43 QString repository() const
44 {
45 return m_repository;
46 }
47
48 void setServer(const QUrl &server)
49 {
50 if (m_server != server) {
51 m_server = server;
52 refresh();
53 }
54 }
55
56 void setUsername(const QString &username)
57 {
58 if (m_username != username) {
59 m_username = username;
60 refresh();
61 }
62 }
63
64 void setStatus(const QString &status)
65 {
66 if (m_status != status) {
67 m_status = status;
68 refresh();
69 }
70 }
71
72 void setRepository(const QString &repository)
73 {
74 if (m_repository != repository) {
75 m_repository = repository;
76 refresh();
77 }
78 }
79
80 void receivedReviews(KJob *job);
81 Q_SCRIPTABLE QVariant get(int row, const QByteArray &role);
82
83private:
84 struct Value {
85 QVariant summary;
86 QVariant id;
87 };
88 QList<Value> m_values;
89
90 QUrl m_server;
91 QString m_username;
92 QString m_status;
93 QString m_repository;
94};
95
96#endif
Q_SCRIPTABLE CaptureState status()
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.