9#include "achievement.h"
13Achievement::Type Achievement::stringToAchievementType(
const QString &achievementTypeString)
16 return Achievement::FlowingAchievement;
17 }
else if (achievementTypeString ==
QLatin1String(
"stepped")) {
18 return Achievement::SteppedAchievement;
19 }
else if (achievementTypeString ==
QLatin1String(
"namedsteps")) {
20 return Achievement::NamedstepsAchievement;
22 return Achievement::SetAchievement;
26 return Achievement::FlowingAchievement;
29QString Achievement::achievementTypeToString(
const Achievement::Type type)
32 case Achievement::FlowingAchievement:
33 return QStringLiteral(
"flowing");
34 case Achievement::SteppedAchievement:
35 return QStringLiteral(
"stepped");
36 case Achievement::NamedstepsAchievement:
37 return QStringLiteral(
"namedsteps");
38 case Achievement::SetAchievement:
39 return QStringLiteral(
"set");
46Achievement::Visibility Achievement::stringToAchievementVisibility(
const QString &achievementVisibilityString)
48 if (achievementVisibilityString ==
QLatin1String(
"visible")) {
49 return Achievement::VisibleAchievement;
50 }
else if (achievementVisibilityString ==
QLatin1String(
"dependents")) {
51 return Achievement::DependentsAchievement;
52 }
else if (achievementVisibilityString ==
QLatin1String(
"secret")) {
53 return Achievement::SecretAchievement;
57 return Achievement::VisibleAchievement;
60QString Achievement::achievementVisibilityToString(
const Achievement::Visibility visibility)
63 case Achievement::VisibleAchievement:
64 return QStringLiteral(
"visible");
65 case Achievement::DependentsAchievement:
66 return QStringLiteral(
"dependents");
67 case Achievement::SecretAchievement:
68 return QStringLiteral(
"secret");
86 Achievement::Visibility m_visibility;
87 Achievement::Type m_type;
99Achievement::Achievement()
115Achievement::~Achievement()
119void Achievement::setId(
const QString &
id)
129void Achievement::setContentId(
const QString &contentId)
131 d->m_contentId = contentId;
134QString Achievement::contentId()
const
136 return d->m_contentId;
139void Achievement::setName(
const QString &name)
144QString Achievement::name()
const
149void Achievement::setDescription(
const QString &description)
151 d->m_description = description;
154QString Achievement::description()
const
156 return d->m_description;
159void Achievement::setExplanation(
const QString &explanation)
161 d->m_explanation = explanation;
164QString Achievement::explanation()
const
166 return d->m_explanation;
169void Achievement::setPoints(
const int points)
171 d->m_points = points;
174int Achievement::points()
const
179void Achievement::setImage(
const QUrl &image)
184QUrl Achievement::image()
const
189void Achievement::setDependencies(
const QStringList &dependencies)
191 d->m_dependencies = dependencies;
194void Achievement::addDependency(
const QString &dependency)
196 d->m_dependencies.append(dependency);
199void Achievement::removeDependency(
const QString &dependency)
201 d->m_dependencies.removeOne(dependency);
206 return d->m_dependencies;
209void Achievement::setVisibility(Achievement::Visibility visibility)
211 d->m_visibility = visibility;
214Achievement::Visibility Achievement::visibility()
const
216 return d->m_visibility;
219void Achievement::setType(Achievement::Type type)
224Achievement::Type Achievement::type()
const
229void Achievement::setOptions(
const QStringList &options)
231 d->m_options = options;
234void Achievement::addOption(
const QString &option)
236 d->m_options.append(option);
239void Achievement::removeOption(
const QString &option)
241 d->m_options.removeOne(option);
249void Achievement::setSteps(
const int steps)
254int Achievement::steps()
const
259void Achievement::setProgress(
const QVariant &progress)
261 d->m_progress = progress;
264QVariant Achievement::progress()
const
266 return d->m_progress;
269bool Achievement::isValid()
const
271 return !(d->m_id.isEmpty());
Represents an achievement.
Type type(const QSqlDatabase &db)
QString name(StandardAction id)