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

« back to all changes in this revision

Viewing changes to libs/models/imagethumbnailmodel.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:
68
68
        {
69
69
            return preloadThumbSize.size();
70
70
        }
 
71
 
71
72
        return thumbSize.size();
72
73
    }
73
74
};
74
75
 
75
 
ImageThumbnailModel::ImageThumbnailModel(QObject *parent)
 
76
ImageThumbnailModel::ImageThumbnailModel(QObject* parent)
76
77
    : ImageModel(parent), d(new ImageThumbnailModelPriv)
77
78
{
78
79
    setKeepsFilePathCache(true);
84
85
    delete d;
85
86
}
86
87
 
87
 
void ImageThumbnailModel::setThumbnailLoadThread(ThumbnailLoadThread *thread)
 
88
void ImageThumbnailModel::setThumbnailLoadThread(ThumbnailLoadThread* thread)
88
89
{
89
90
    d->thread = thread;
90
91
 
91
 
    connect(d->thread, SIGNAL(signalThumbnailLoaded(const LoadingDescription &, const QPixmap&)),
92
 
            this, SLOT(slotThumbnailLoaded(const LoadingDescription &, const QPixmap&)));
 
92
    connect(d->thread, SIGNAL(signalThumbnailLoaded(const LoadingDescription&, const QPixmap&)),
 
93
            this, SLOT(slotThumbnailLoaded(const LoadingDescription&, const QPixmap&)));
93
94
}
94
95
 
95
 
ThumbnailLoadThread *ImageThumbnailModel::thumbnailLoadThread() const
 
96
ThumbnailLoadThread* ImageThumbnailModel::thumbnailLoadThread() const
96
97
{
97
98
    return d->thread;
98
99
}
129
130
            d->preloadThread->setExifRotate(d->exifRotate);
130
131
            d->preloadThread->setPriority(QThread::LowPriority);
131
132
        }
 
133
 
132
134
        connect(this, SIGNAL(allRefreshingFinished()),
133
135
                this, SLOT(preloadAllThumbnails()));
134
136
    }
144
146
void ImageThumbnailModel::setExifRotate(bool rotate)
145
147
{
146
148
    d->exifRotate = rotate;
 
149
 
147
150
    if (d->thread)
148
151
    {
149
152
        d->thread->setExifRotate(rotate);
150
153
    }
 
154
 
151
155
    if (d->preloadThread)
152
156
    {
153
157
        d->preloadThread->setExifRotate(rotate);
226
230
        QPixmap thumbnail;
227
231
        ImageInfo info = imageInfoRef(index);
228
232
        QString path = info.filePath();
 
233
 
229
234
        if (d->thread->find(path, thumbnail, d->thumbSize.size()))
230
235
        {
231
236
            return thumbnail;
235
240
            return QVariant(QVariant::Pixmap);
236
241
        }
237
242
    }
 
243
 
238
244
    return ImageModel::data(index, role);
239
245
}
240
246
 
243
249
    if (role == ThumbnailRole && d->thread)
244
250
    {
245
251
        if (value.isNull())
 
252
        {
246
253
            d->thumbSize = d->lastGlobalThumbSize;
 
254
        }
247
255
        else
 
256
        {
248
257
            d->thumbSize = value.toInt();
 
258
        }
249
259
    }
 
260
 
250
261
    return ImageModel::setData(index, value, role);
251
262
}
252
263
 
256
267
    {
257
268
        return;
258
269
    }
 
270
 
259
271
    QModelIndex changed = indexForPath(loadingDescription.filePath);
 
272
 
260
273
    if (changed.isValid())
261
274
    {
262
275
        emit thumbnailAvailable(changed, loadingDescription.previewParameters.size);
 
276
 
263
277
        if (d->emitDataChanged)
264
278
        {
265
279
            emit dataChanged(changed, changed);