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 Achievement achievement.h <Attica/Achievement> |
24 | * |
25 | * Represents an achievement. |
26 | */ |
27 | class ATTICA_EXPORT Achievement |
28 | { |
29 | public: |
30 | typedef QList<Achievement> List; |
31 | class Parser; |
32 | |
33 | enum Type { |
34 | FlowingAchievement, |
35 | SteppedAchievement, |
36 | NamedstepsAchievement, |
37 | SetAchievement, |
38 | }; |
39 | static Achievement::Type stringToAchievementType(const QString &achievementTypeString); |
40 | static QString achievementTypeToString(const Achievement::Type type); |
41 | |
42 | enum Visibility { |
43 | VisibleAchievement, |
44 | DependentsAchievement, |
45 | SecretAchievement, |
46 | }; |
47 | static Achievement::Visibility stringToAchievementVisibility(const QString &achievementVisibilityString); |
48 | static QString achievementVisibilityToString(const Achievement::Visibility visibility); |
49 | |
50 | Achievement(); |
51 | Achievement(const Achievement &other); |
52 | Achievement &operator=(const Achievement &other); |
53 | ~Achievement(); |
54 | |
55 | void setId(const QString &id); |
56 | QString id() const; |
57 | |
58 | void setContentId(const QString &contentId); |
59 | QString contentId() const; |
60 | |
61 | void setName(const QString &name); |
62 | QString name() const; |
63 | |
64 | void setDescription(const QString &description); |
65 | QString description() const; |
66 | |
67 | void setExplanation(const QString &explanation); |
68 | QString explanation() const; |
69 | |
70 | void setPoints(const int points); |
71 | int points() const; |
72 | |
73 | void setImage(const QUrl &image); |
74 | QUrl image() const; |
75 | |
76 | void setDependencies(const QStringList &dependencies); |
77 | void addDependency(const QString &dependency); |
78 | void removeDependency(const QString &dependency); |
79 | QStringList dependencies() const; |
80 | |
81 | void setVisibility(Achievement::Visibility visibility); |
82 | Achievement::Visibility visibility() const; |
83 | |
84 | void setType(Achievement::Type type); |
85 | Achievement::Type type() const; |
86 | |
87 | void setOptions(const QStringList &options); |
88 | void addOption(const QString &option); |
89 | void removeOption(const QString &option); |
90 | QStringList options() const; |
91 | |
92 | void setSteps(const int steps); |
93 | int steps() const; |
94 | |
95 | void setProgress(const QVariant &progress); |
96 | QVariant progress() const; |
97 | |
98 | bool isValid() const; |
99 | |
100 | private: |
101 | class Private; |
102 | QSharedDataPointer<Private> d; |
103 | }; |
104 | |
105 | } |
106 | |
107 | #endif |
108 | |