1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #ifndef ATTICA_ACHIEVEMENT_H |
10 | #define ATTICA_ACHIEVEMENT_H |
11 | |
12 | #include "attica_export.h" |
13 | |
14 | #include <QSharedDataPointer> |
15 | #include <QStringList> |
16 | #include <QUrl> |
17 | #include <QVariant> |
18 | |
19 | namespace Attica |
20 | { |
21 | |
22 | /*! |
23 | * \class Attica::Achievement |
24 | * \inheaderfile Attica/Achievement |
25 | * \inmodule Attica |
26 | * |
27 | * \brief Represents an achievement. |
28 | */ |
29 | class ATTICA_EXPORT Achievement |
30 | { |
31 | public: |
32 | /*! |
33 | * |
34 | */ |
35 | typedef QList<Achievement> List; |
36 | class Parser; |
37 | |
38 | /*! |
39 | * \value FlowingAchievement |
40 | * \value SteppedAchievement |
41 | * \value NamedstepsAchievement |
42 | * \value SetAchievement |
43 | */ |
44 | enum Type { |
45 | FlowingAchievement, |
46 | SteppedAchievement, |
47 | NamedstepsAchievement, |
48 | SetAchievement, |
49 | }; |
50 | |
51 | /*! |
52 | * |
53 | */ |
54 | static Achievement::Type stringToAchievementType(const QString &achievementTypeString); |
55 | |
56 | /*! |
57 | * |
58 | */ |
59 | static QString achievementTypeToString(const Achievement::Type type); |
60 | |
61 | /*! |
62 | * \value VisibleAchievement |
63 | * \value DependentsAchievement |
64 | * \value SecretAchievement |
65 | */ |
66 | enum Visibility { |
67 | VisibleAchievement, |
68 | DependentsAchievement, |
69 | SecretAchievement, |
70 | }; |
71 | |
72 | /*! |
73 | * |
74 | */ |
75 | static Achievement::Visibility stringToAchievementVisibility(const QString &achievementVisibilityString); |
76 | |
77 | /*! |
78 | * |
79 | */ |
80 | static QString achievementVisibilityToString(const Achievement::Visibility visibility); |
81 | |
82 | /*! |
83 | * |
84 | */ |
85 | Achievement(); |
86 | Achievement(const Achievement &other); |
87 | Achievement &operator=(const Achievement &other); |
88 | ~Achievement(); |
89 | |
90 | /*! |
91 | * |
92 | */ |
93 | void setId(const QString &id); |
94 | |
95 | /*! |
96 | * |
97 | */ |
98 | QString id() const; |
99 | |
100 | /*! |
101 | * |
102 | */ |
103 | void setContentId(const QString &contentId); |
104 | |
105 | /*! |
106 | * |
107 | */ |
108 | QString contentId() const; |
109 | |
110 | /*! |
111 | * |
112 | */ |
113 | void setName(const QString &name); |
114 | |
115 | /*! |
116 | * |
117 | */ |
118 | QString name() const; |
119 | |
120 | /*! |
121 | * |
122 | */ |
123 | void setDescription(const QString &description); |
124 | |
125 | /*! |
126 | * |
127 | */ |
128 | QString description() const; |
129 | |
130 | /*! |
131 | * |
132 | */ |
133 | void setExplanation(const QString &explanation); |
134 | |
135 | /*! |
136 | * |
137 | */ |
138 | QString explanation() const; |
139 | |
140 | /*! |
141 | * |
142 | */ |
143 | void setPoints(const int points); |
144 | |
145 | /*! |
146 | * |
147 | */ |
148 | int points() const; |
149 | |
150 | /*! |
151 | * |
152 | */ |
153 | void setImage(const QUrl &image); |
154 | |
155 | /*! |
156 | * |
157 | */ |
158 | QUrl image() const; |
159 | |
160 | /*! |
161 | * |
162 | */ |
163 | void setDependencies(const QStringList &dependencies); |
164 | |
165 | /*! |
166 | * |
167 | */ |
168 | void addDependency(const QString &dependency); |
169 | |
170 | /*! |
171 | * |
172 | */ |
173 | void removeDependency(const QString &dependency); |
174 | |
175 | /*! |
176 | * |
177 | */ |
178 | QStringList dependencies() const; |
179 | |
180 | /*! |
181 | * |
182 | */ |
183 | void setVisibility(Achievement::Visibility visibility); |
184 | |
185 | /*! |
186 | * |
187 | */ |
188 | Achievement::Visibility visibility() const; |
189 | |
190 | /*! |
191 | * |
192 | */ |
193 | void setType(Achievement::Type type); |
194 | |
195 | /*! |
196 | * |
197 | */ |
198 | Achievement::Type type() const; |
199 | |
200 | /*! |
201 | * |
202 | */ |
203 | void setOptions(const QStringList &options); |
204 | |
205 | /*! |
206 | * |
207 | */ |
208 | void addOption(const QString &option); |
209 | |
210 | /*! |
211 | * |
212 | */ |
213 | void removeOption(const QString &option); |
214 | |
215 | /*! |
216 | * |
217 | */ |
218 | QStringList options() const; |
219 | |
220 | /*! |
221 | * |
222 | */ |
223 | void setSteps(const int steps); |
224 | |
225 | /*! |
226 | * |
227 | */ |
228 | int steps() const; |
229 | |
230 | /*! |
231 | * |
232 | */ |
233 | void setProgress(const QVariant &progress); |
234 | |
235 | /*! |
236 | * |
237 | */ |
238 | QVariant progress() const; |
239 | |
240 | /*! |
241 | * |
242 | */ |
243 | bool isValid() const; |
244 | |
245 | private: |
246 | class Private; |
247 | QSharedDataPointer<Private> d; |
248 | }; |
249 | |
250 | } |
251 | |
252 | #endif |
253 | |