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

« back to all changes in this revision

Viewing changes to utilities/batch/fingerprintsgenerator.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:
59
59
{
60
60
public:
61
61
 
62
 
    FingerPrintsGeneratorPriv()
 
62
    FingerPrintsGeneratorPriv() :
 
63
        cancel(false),
 
64
        rebuildAll(true),
 
65
        previewLoadThread(0)
63
66
    {
64
 
        cancel            = false;
65
 
        rebuildAll        = true;
66
 
        previewLoadThread = 0;
67
67
        duration.start();
68
68
    }
69
69
 
74
74
 
75
75
    QStringList        allPicturesPath;
76
76
 
77
 
    PreviewLoadThread *previewLoadThread;
 
77
    PreviewLoadThread* previewLoadThread;
78
78
 
79
79
    HaarIface          haarIface;
80
80
};
81
81
 
82
82
FingerPrintsGenerator::FingerPrintsGenerator(QWidget* /*parent*/, bool rebuildAll)
83
 
                     : DProgressDlg(0), d(new FingerPrintsGeneratorPriv)
 
83
    : DProgressDlg(0), d(new FingerPrintsGeneratorPriv)
84
84
{
85
85
    d->rebuildAll        = rebuildAll;
86
86
    d->previewLoadThread = new PreviewLoadThread();
135
135
 
136
136
void FingerPrintsGenerator::processOne()
137
137
{
138
 
    if (d->cancel) return;
 
138
    if (d->cancel)
 
139
    {
 
140
        return;
 
141
    }
 
142
 
139
143
    QString path = d->allPicturesPath.first();
140
144
    LoadingDescription description(path, HaarIface::preferredSize(),
141
145
                                   AlbumSettings::instance()->getExifRotate(),
142
146
                                   LoadingDescription::ConvertToSRGB);
143
 
    description.rawDecodingSettings.sixteenBitsImage = false;
 
147
    description.rawDecodingSettings.rawPrm.sixteenBitsImage = false;
144
148
    d->previewLoadThread->load(description);
145
149
}
146
150
 
161
165
void FingerPrintsGenerator::slotGotImagePreview(const LoadingDescription& desc, const DImg& img)
162
166
{
163
167
    if (d->allPicturesPath.isEmpty())
 
168
    {
164
169
        return;
 
170
    }
165
171
 
166
172
    if (d->allPicturesPath.first() != desc.filePath)
 
173
    {
167
174
        return;
 
175
    }
168
176
 
169
177
    if (!img.isNull())
170
178
    {
171
179
        // compute Haar fingerprint
172
180
        d->haarIface.indexImage(desc.filePath, img);
173
181
    }
 
182
 
174
183
    QPixmap pix = DImg(img).smoothScale(128, 128, Qt::KeepAspectRatio).convertToPixmap();
175
184
    addedAction(pix, desc.filePath);
176
185
    advance(1);
 
186
 
177
187
    if (!d->allPicturesPath.isEmpty())
 
188
    {
178
189
        d->allPicturesPath.removeFirst();
 
190
    }
 
191
 
179
192
    if (d->allPicturesPath.isEmpty())
 
193
    {
180
194
        complete();
 
195
    }
181
196
    else
 
197
    {
182
198
        processOne();
 
199
    }
183
200
}
184
201
 
185
202
void FingerPrintsGenerator::slotCancel()
188
205
    done(Cancel);
189
206
}
190
207
 
191
 
void FingerPrintsGenerator::closeEvent(QCloseEvent *e)
 
208
void FingerPrintsGenerator::closeEvent(QCloseEvent* e)
192
209
{
193
210
    abort();
194
211
    e->accept();