Changeset View
Changeset View
Standalone View
Standalone View
src/bugzillaintegration/libbugzilla/models/bug.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright 2019 Harald Sitter <sitter@kde.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Lesser General Public | ||||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef BUG_H | ||||
22 | #define BUG_H | ||||
23 | | ||||
24 | #include <QObject> | ||||
25 | #include <QPointer> | ||||
26 | | ||||
27 | #include <QVariant> | ||||
28 | | ||||
29 | #include "comment.h" | ||||
30 | | ||||
31 | namespace Bugzilla { | ||||
32 | | ||||
33 | // Models a bugzilla bug. | ||||
34 | class Bug : public QObject | ||||
35 | { | ||||
36 | public: | ||||
37 | enum class Status { | ||||
38 | Unknown, // First value is default if QMetaEnum can't map the key. | ||||
39 | UNCONFIRMED, | ||||
40 | CONFIRMED, | ||||
41 | ASSIGNED, | ||||
42 | REOPENED, | ||||
43 | RESOLVED, | ||||
44 | NEEDSINFO, | ||||
45 | VERIFIED, | ||||
46 | CLOSED | ||||
47 | }; | ||||
48 | Q_ENUM(Status) | ||||
49 | | ||||
50 | enum class Resolution { | ||||
51 | Unknown, // First value is default if QMetaEnum can't map the key. | ||||
52 | NONE, // Fake value, expresses unresoled. On the REST side this is an empty string. | ||||
53 | FIXED, | ||||
54 | INVALID, | ||||
55 | WONTFIX, | ||||
56 | LATER, | ||||
57 | REMIND, | ||||
58 | DUPLICATE, | ||||
59 | WORKSFORME, | ||||
60 | MOVED, | ||||
61 | UPSTREAM, | ||||
62 | DOWNSTREAM, | ||||
63 | WAITINGFORINFO, | ||||
64 | BACKTRACE, | ||||
65 | UNMAINTAINED | ||||
66 | }; | ||||
67 | Q_ENUM(Resolution) | ||||
68 | | ||||
69 | private: | ||||
70 | Q_OBJECT | ||||
71 | Q_PROPERTY(qint64 id READ id WRITE setId CONSTANT) | ||||
72 | Q_PROPERTY(QString product READ product WRITE setProduct CONSTANT) | ||||
73 | Q_PROPERTY(QString component READ component WRITE setComponent CONSTANT) | ||||
74 | Q_PROPERTY(QString summary READ summary WRITE setSummary CONSTANT) | ||||
75 | Q_PROPERTY(QString version READ version WRITE setVersion CONSTANT) | ||||
76 | Q_PROPERTY(bool is_open READ is_open WRITE setIs_open CONSTANT) | ||||
77 | // maybe should be camel mapped, who knows | ||||
78 | Q_PROPERTY(QString op_sys READ op_sys WRITE setOp_sys CONSTANT) | ||||
79 | Q_PROPERTY(QString priority READ priority WRITE setPriority CONSTANT) | ||||
80 | Q_PROPERTY(QString severity READ severity WRITE setSeverity CONSTANT) | ||||
81 | Q_PROPERTY(Status status READ status WRITE setStatus CONSTANT) | ||||
82 | Q_PROPERTY(Resolution resolution READ resolution WRITE setResolution CONSTANT) | ||||
83 | Q_PROPERTY(qint64 dupe_of READ dupe_of WRITE setDupe_of CONSTANT) | ||||
84 | | ||||
85 | // Custom fields (versionfixedin etc) are only available via customField(). | ||||
86 | | ||||
87 | public: | ||||
88 | typedef QPointer<Bug> Ptr; | ||||
89 | | ||||
90 | explicit Bug(const QVariantHash &object, QObject *parent = nullptr); | ||||
91 | | ||||
92 | qint64 id() const; | ||||
93 | void setId(qint64 id); | ||||
94 | | ||||
95 | QVariant customField(const char *key); | ||||
96 | | ||||
97 | Status status() const; | ||||
98 | void setStatus(Status status); | ||||
99 | | ||||
100 | Resolution resolution() const; | ||||
101 | void setResolution(Resolution resolution); | ||||
102 | | ||||
103 | QString summary() const; | ||||
104 | void setSummary(const QString &summary); | ||||
105 | | ||||
106 | QString version() const; | ||||
107 | void setVersion(const QString &version); | ||||
108 | | ||||
109 | QString product() const; | ||||
110 | void setProduct(const QString &product); | ||||
111 | | ||||
112 | QString component() const; | ||||
113 | void setComponent(const QString &component); | ||||
114 | | ||||
115 | QString op_sys() const; | ||||
116 | void setOp_sys(const QString &op_sys); | ||||
117 | | ||||
118 | QString priority() const; | ||||
119 | void setPriority(const QString &priority); | ||||
120 | | ||||
121 | QString severity() const; | ||||
122 | void setSeverity(const QString &severity); | ||||
123 | | ||||
124 | bool is_open() const; | ||||
125 | void setIs_open(bool is_open); | ||||
126 | | ||||
127 | qint64 dupe_of() const; | ||||
128 | void setDupe_of(qint64 dupe_of); | ||||
129 | | ||||
130 | Q_SIGNALS: | ||||
131 | void commentsChanged(); | ||||
132 | | ||||
133 | private: | ||||
134 | qint64 m_id = -1; | ||||
135 | QString m_product; | ||||
136 | QString m_component; | ||||
137 | QString m_summary; | ||||
138 | QString m_version; | ||||
139 | bool m_is_open = false; | ||||
140 | QString m_op_sys; | ||||
141 | QString m_priority; | ||||
142 | QString m_severity; | ||||
143 | Status m_status = Status::Unknown; | ||||
144 | Resolution m_resolution = Resolution::Unknown; | ||||
145 | qint64 m_dupe_of = -1; | ||||
146 | }; | ||||
147 | | ||||
148 | } // namespace Bugzilla | ||||
149 | | ||||
150 | #endif // BUG_H |