~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to utilities/advancedrename/parser/options/database/keys/commonkeys.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
{
51
51
 
52
52
CommonKeys::CommonKeys()
53
 
          : DbKeysCollection(i18n("Common File Information"))
 
53
    : DbKeysCollection(i18n("Common File Information"))
54
54
{
55
55
    addId(KEY_DEFAULTCOMMENT, i18n("Default comment of the image"));
56
56
    addId(KEY_DEFAULTAUTHOR,  i18n("Default author of the image"));
81
81
    else if (key == KEY_DEFAULTAUTHOR)
82
82
    {
83
83
        QStringList authors = copyright.author();
 
84
 
84
85
        if (!authors.isEmpty())
85
86
        {
86
87
            result = authors.at(0);
89
90
    else if (key == KEY_AUTHORS)
90
91
    {
91
92
        QStringList authors = copyright.author();
 
93
 
92
94
        if (!authors.isEmpty())
93
95
        {
94
96
            foreach (const QString& author, authors)
96
98
                result += author + ",";
97
99
            }
98
100
        }
 
101
 
99
102
        if (result.endsWith(","))
100
103
        {
101
104
            result.chop(1);
104
107
    else if (key == KEY_DIMENSION)
105
108
    {
106
109
        QSize dimension = info.dimensions();
 
110
 
107
111
        if (dimension.isEmpty() || dimension.isNull() || !dimension.isValid())
108
112
        {
109
113
            dimension.setWidth(0);
110
114
            dimension.setHeight(0);
111
115
        }
 
116
 
112
117
        result = QString("%1x%2").arg(dimension.width()).arg(dimension.height());
113
118
    }
114
119
    else if (key == KEY_HEIGHT)
115
120
    {
116
121
        int height = container.height;
 
122
 
117
123
        if (height < 0)
118
124
        {
119
125
            height = 0;
120
126
        }
 
127
 
121
128
        result = QString::number(height);
122
129
    }
123
130
    else if (key == KEY_WIDTH)
124
131
    {
125
132
        int width = container.width;
 
133
 
126
134
        if (width < 0)
127
135
        {
128
136
            width = 0;
129
137
        }
 
138
 
130
139
        result = QString::number(width);
131
140
    }
132
141
    else if (key == KEY_FILESIZE)
141
150
    {
142
151
        switch (info.category())
143
152
        {
144
 
            case DatabaseItem::UndefinedCategory: result = QString("Undefined"); break;
145
 
            case DatabaseItem::Image:             result = QString("Image");     break;
146
 
            case DatabaseItem::Video:             result = QString("Video");     break;
147
 
            case DatabaseItem::Audio:             result = QString("Audio");     break;
 
153
            case DatabaseItem::UndefinedCategory:
 
154
                result = QString("Undefined");
 
155
                break;
 
156
            case DatabaseItem::Image:
 
157
                result = QString("Image");
 
158
                break;
 
159
            case DatabaseItem::Video:
 
160
                result = QString("Video");
 
161
                break;
 
162
            case DatabaseItem::Audio:
 
163
                result = QString("Audio");
 
164
                break;
148
165
            case DatabaseItem::Other:
149
 
            default:                              result = QString("Other");     break;
 
166
            default:
 
167
                result = QString("Other");
 
168
                break;
150
169
        }
151
170
    }
152
171
    else if (key == KEY_RATING)