~ubuntu-branches/ubuntu/raring/gwenview/raring-proposed

« back to all changes in this revision

Viewing changes to lib/imagemetainfomodel.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac, Philip Muškovac, Scott Kitterman
  • Date: 2011-12-24 18:54:55 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20111224185455-zxffs6i6m5cwwuze
Tags: 4:4.7.95-0ubuntu1
[ Philip Muškovac ]
* New upstream release candiate

[ Scott Kitterman ]
* Fix Ubuntu Vcs- header in debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
// Qt
25
25
 
26
26
// KDE
27
 
#include <kdebug.h>
28
 
#include <kfileitem.h>
29
 
#include <kglobal.h>
30
 
#include <klocale.h>
 
27
#include <KDebug>
 
28
#include <KFileItem>
 
29
#include <KGlobal>
 
30
#include <KLocale>
31
31
 
32
32
// Exiv2
33
33
#include <exiv2/exif.hpp>
62
62
            : mKey(key), mLabel(label.trimmed()), mValue(value.trimmed())
63
63
        {}
64
64
 
65
 
        QString key() const {
 
65
        QString key() const
 
66
        {
66
67
            return mKey;
67
68
        }
68
 
        QString label() const {
 
69
        QString label() const
 
70
        {
69
71
            return mLabel;
70
72
        }
71
73
 
72
 
        QString value() const {
 
74
        QString value() const
 
75
        {
73
76
            return mValue;
74
77
        }
75
78
        void setValue(const QString& value)
92
95
    };
93
96
 
94
97
    MetaInfoGroup(const QString& label)
95
 
        : mLabel(label) {}
 
98
        : mLabel(label)
 
99
        {}
96
100
 
97
 
    ~MetaInfoGroup() {
 
101
    ~MetaInfoGroup()
 
102
    {
98
103
        qDeleteAll(mList);
99
104
    }
100
105
 
125
130
        }
126
131
    }
127
132
 
128
 
    QString getKeyAt(int row) const {
 
133
    QString getKeyAt(int row) const
 
134
    {
129
135
        Q_ASSERT(row < mList.size());
130
136
        return mList[row]->key();
131
137
    }
132
138
 
133
 
    QString getLabelForKeyAt(int row) const {
 
139
    QString getLabelForKeyAt(int row) const
 
140
    {
134
141
        Q_ASSERT(row < mList.size());
135
142
        return mList[row]->label();
136
143
    }
137
144
 
138
 
    QString getValueForKeyAt(int row) const {
 
145
    QString getValueForKeyAt(int row) const
 
146
    {
139
147
        Q_ASSERT(row < mList.size());
140
148
        return mList[row]->value();
141
149
    }
146
154
        mList[row]->setValue(value);
147
155
    }
148
156
 
149
 
    int getRowForKey(const QString& key) const {
 
157
    int getRowForKey(const QString& key) const
 
158
    {
150
159
        return mRowForKey.value(key, InvalidRow);
151
160
    }
152
161
 
153
 
    int size() const {
 
162
    int size() const
 
163
    {
154
164
        return mList.size();
155
165
    }
156
166
 
157
 
    QString label() const {
 
167
    QString label() const
 
168
    {
158
169
        return mLabel;
159
170
    }
160
171
 
163
174
    }
164
175
 
165
176
private:
166
 
    Entry* getEntryForKey(const QString& key) const {
 
177
    Entry* getEntryForKey(const QString& key) const
 
178
    {
167
179
        int row = getRowForKey(key);
168
180
        if (row == InvalidRow) {
169
181
            return 0;
176
188
    QString mLabel;
177
189
};
178
190
 
179
 
struct ImageMetaInfoModelPrivate {
 
191
struct ImageMetaInfoModelPrivate
 
192
{
180
193
    QVector<MetaInfoGroup*> mMetaInfoGroupVector;
181
194
    ImageMetaInfoModel* q;
182
195
 
203
216
        emit q->dataChanged(entryIndex, entryIndex);
204
217
    }
205
218
 
206
 
    QVariant displayData(const QModelIndex& index) const {
 
219
    QVariant displayData(const QModelIndex& index) const
 
220
    {
207
221
        if (index.internalId() == NoGroup) {
208
222
            if (index.column() != 0) {
209
223
                return QVariant();