File indexing completed on 2024-07-14 14:25:34

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef ATTICA_ACHIEVEMENT_H
0010 #define ATTICA_ACHIEVEMENT_H
0011 
0012 #include "attica_export.h"
0013 
0014 #include <QSharedDataPointer>
0015 #include <QStringList>
0016 #include <QUrl>
0017 #include <QVariant>
0018 
0019 namespace Attica
0020 {
0021 
0022 /**
0023  * @class Achievement achievement.h <Attica/Achievement>
0024  *
0025  * Represents an achievement.
0026  */
0027 class ATTICA_EXPORT Achievement
0028 {
0029 public:
0030     typedef QList<Achievement> List;
0031     class Parser;
0032 
0033     enum Type {
0034         FlowingAchievement,
0035         SteppedAchievement,
0036         NamedstepsAchievement,
0037         SetAchievement,
0038     };
0039     static Achievement::Type stringToAchievementType(const QString &achievementTypeString);
0040     static QString achievementTypeToString(const Achievement::Type type);
0041 
0042     enum Visibility {
0043         VisibleAchievement,
0044         DependentsAchievement,
0045         SecretAchievement,
0046     };
0047     static Achievement::Visibility stringToAchievementVisibility(const QString &achievementVisibilityString);
0048     static QString achievementVisibilityToString(const Achievement::Visibility visibility);
0049 
0050     Achievement();
0051     Achievement(const Achievement &other);
0052     Achievement &operator=(const Achievement &other);
0053     ~Achievement();
0054 
0055     void setId(const QString &id);
0056     QString id() const;
0057 
0058     void setContentId(const QString &contentId);
0059     QString contentId() const;
0060 
0061     void setName(const QString &name);
0062     QString name() const;
0063 
0064     void setDescription(const QString &description);
0065     QString description() const;
0066 
0067     void setExplanation(const QString &explanation);
0068     QString explanation() const;
0069 
0070     void setPoints(const int points);
0071     int points() const;
0072 
0073     void setImage(const QUrl &image);
0074     QUrl image() const;
0075 
0076     void setDependencies(const QStringList &dependencies);
0077     void addDependency(const QString &dependency);
0078     void removeDependency(const QString &dependency);
0079     QStringList dependencies() const;
0080 
0081     void setVisibility(Achievement::Visibility visibility);
0082     Achievement::Visibility visibility() const;
0083 
0084     void setType(Achievement::Type type);
0085     Achievement::Type type() const;
0086 
0087     void setOptions(const QStringList &options);
0088     void addOption(const QString &option);
0089     void removeOption(const QString &option);
0090     QStringList options() const;
0091 
0092     void setSteps(const int steps);
0093     int steps() const;
0094 
0095     void setProgress(const QVariant &progress);
0096     QVariant progress() const;
0097 
0098     bool isValid() const;
0099 
0100 private:
0101     class Private;
0102     QSharedDataPointer<Private> d;
0103 };
0104 
0105 }
0106 
0107 #endif