~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/semanticinfo/abstractsemanticinfobackend.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// vim: set tabstop=4 shiftwidth=4 noexpandtab:
 
1
// vim: set tabstop=4 shiftwidth=4 expandtab:
2
2
/*
3
3
Gwenview: an image viewer
4
4
Copyright 2008 Aurélien Gâteau <agateau@kde.org>
33
33
 
34
34
class KUrl;
35
35
 
36
 
namespace Gwenview {
37
 
 
 
36
namespace Gwenview
 
37
{
38
38
 
39
39
typedef QString SemanticInfoTag;
40
40
 
41
 
 
42
41
/**
43
42
 * This class represents the set of tags associated to an url.
44
43
 *
45
44
 * It provides convenience methods to convert to and from QVariant, which are
46
45
 * useful to communicate with SemanticInfoDirModel.
47
46
 */
48
 
class GWENVIEWLIB_EXPORT TagSet : public QSet<SemanticInfoTag> {
 
47
class GWENVIEWLIB_EXPORT TagSet : public QSet<SemanticInfoTag>
 
48
{
49
49
public:
50
 
        TagSet();
51
 
        TagSet(const QSet<SemanticInfoTag>&);
 
50
    TagSet();
 
51
    TagSet(const QSet<SemanticInfoTag>&);
52
52
 
53
 
        QVariant toVariant() const;
54
 
        static TagSet fromVariant(const QVariant&);
 
53
    QVariant toVariant() const;
 
54
    static TagSet fromVariant(const QVariant&);
55
55
};
56
56
 
57
 
 
58
57
/**
59
58
 * A POD struct used by AbstractSemanticInfoBackEnd to store the metadata
60
59
 * associated to an url.
61
60
 */
62
61
struct SemanticInfo {
63
 
        int mRating;
64
 
        QString mDescription;
65
 
        TagSet mTags;
 
62
    int mRating;
 
63
    QString mDescription;
 
64
    TagSet mTags;
66
65
};
67
66
 
68
 
 
69
67
/**
70
68
 * An abstract class, used by SemanticInfoDirModel to store and retrieve metadata.
71
69
 */
72
 
class AbstractSemanticInfoBackEnd : public QObject {
73
 
        Q_OBJECT
 
70
class AbstractSemanticInfoBackEnd : public QObject
 
71
{
 
72
    Q_OBJECT
74
73
public:
75
 
        AbstractSemanticInfoBackEnd(QObject* parent);
76
 
 
77
 
        virtual TagSet allTags() const = 0;
78
 
 
79
 
        virtual void refreshAllTags() = 0;
80
 
 
81
 
        virtual void storeSemanticInfo(const KUrl&, const SemanticInfo&) = 0;
82
 
 
83
 
        virtual void retrieveSemanticInfo(const KUrl&) = 0;
84
 
 
85
 
        virtual QString labelForTag(const SemanticInfoTag&) const = 0;
86
 
 
87
 
        /**
88
 
         * Return a tag for a label. Will emit tagAdded() if the tag had to be
89
 
         * created.
90
 
         */
91
 
        virtual SemanticInfoTag tagForLabel(const QString&) = 0;
 
74
    AbstractSemanticInfoBackEnd(QObject* parent);
 
75
 
 
76
    virtual TagSet allTags() const = 0;
 
77
 
 
78
    virtual void refreshAllTags() = 0;
 
79
 
 
80
    virtual void storeSemanticInfo(const KUrl&, const SemanticInfo&) = 0;
 
81
 
 
82
    virtual void retrieveSemanticInfo(const KUrl&) = 0;
 
83
 
 
84
    virtual QString labelForTag(const SemanticInfoTag&) const = 0;
 
85
 
 
86
    /**
 
87
     * Return a tag for a label. Will emit tagAdded() if the tag had to be
 
88
     * created.
 
89
     */
 
90
    virtual SemanticInfoTag tagForLabel(const QString&) = 0;
92
91
 
93
92
Q_SIGNALS:
94
 
        void semanticInfoRetrieved(const KUrl&, const SemanticInfo&);
 
93
    void semanticInfoRetrieved(const KUrl&, const SemanticInfo&);
95
94
 
96
 
        /**
97
 
         * Emitted whenever a new tag is added to allTags()
98
 
         */
99
 
        void tagAdded(const SemanticInfoTag&, const QString& label);
 
95
    /**
 
96
     * Emitted whenever a new tag is added to allTags()
 
97
     */
 
98
    void tagAdded(const SemanticInfoTag&, const QString& label);
100
99
};
101
100
 
102
 
 
103
101
} // namespace
104
102
 
105
103
#endif /* ABSTRACTSEMANTICINFOBACKEND_H */