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

« back to all changes in this revision

Viewing changes to libs/imageproperties/imagepropertiessidebardb.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:
80
80
    ImageDescEditTab*     desceditTab;
81
81
};
82
82
 
83
 
ImagePropertiesSideBarDB::ImagePropertiesSideBarDB(QWidget *parent, SidebarSplitter *splitter,
84
 
                                                   KMultiTabBarPosition side, bool mimimizedDefault)
85
 
                        : ImagePropertiesSideBar(parent, splitter, side, mimimizedDefault),
86
 
                          d(new ImagePropertiesSideBarDBPriv)
 
83
ImagePropertiesSideBarDB::ImagePropertiesSideBarDB(QWidget* parent, SidebarSplitter* splitter,
 
84
        KMultiTabBarPosition side, bool mimimizedDefault)
 
85
    : ImagePropertiesSideBar(parent, splitter, side, mimimizedDefault),
 
86
      d(new ImagePropertiesSideBarDBPriv)
87
87
{
88
88
    d->desceditTab = new ImageDescEditTab(parent);
89
89
 
106
106
    connect(d->desceditTab, SIGNAL(signalPrevItem()),
107
107
            this, SIGNAL(signalPrevItem()));
108
108
 
109
 
    DatabaseWatch *dbwatch = DatabaseAccess::databaseWatch();
 
109
    DatabaseWatch* dbwatch = DatabaseAccess::databaseWatch();
110
110
 
111
111
    connect(dbwatch, SIGNAL(imageChange(const ImageChangeset&)),
112
112
            this, SLOT(slotImageChangeDatabase(const ImageChangeset&)));
113
113
 
114
 
    ImageAttributesWatch *watch = ImageAttributesWatch::instance();
 
114
    ImageAttributesWatch* watch = ImageAttributesWatch::instance();
115
115
 
116
116
    connect(watch, SIGNAL(signalFileMetadataChanged(const KUrl&)),
117
117
            this, SLOT(slotFileMetadataChanged(const KUrl&)));
123
123
}
124
124
 
125
125
void ImagePropertiesSideBarDB::itemChanged(const ImageInfo& info,
126
 
                                           const QRect& rect, DImg *img)
 
126
        const QRect& rect, DImg* img)
127
127
{
128
128
    itemChanged(info.fileUrl(), info, rect, img);
129
129
}
130
130
 
131
 
void ImagePropertiesSideBarDB::itemChanged(const KUrl& url, const QRect& rect, DImg *img)
 
131
void ImagePropertiesSideBarDB::itemChanged(const KUrl& url, const QRect& rect, DImg* img)
132
132
{
133
133
    itemChanged(url, ImageInfo(), rect, img);
134
134
}
135
135
 
136
136
void ImagePropertiesSideBarDB::itemChanged(const KUrl& url, const ImageInfo& info,
137
 
                                           const QRect& rect, DImg *img)
 
137
        const QRect& rect, DImg* img)
138
138
{
139
139
    if ( !url.isValid() )
 
140
    {
140
141
        return;
 
142
    }
141
143
 
142
144
    m_currentURL = url;
143
145
 
144
146
    ImageInfoList list;
 
147
 
145
148
    if (!info.isNull())
 
149
    {
146
150
        list << info;
 
151
    }
147
152
 
148
153
    itemChanged(list, rect, img);
149
154
}
151
156
void ImagePropertiesSideBarDB::itemChanged(const ImageInfoList& infos)
152
157
{
153
158
    if (infos.isEmpty())
 
159
    {
154
160
        return;
 
161
    }
155
162
 
156
163
    m_currentURL = infos.first().fileUrl();
157
164
 
158
165
    itemChanged(infos, QRect(), 0);
159
166
}
160
167
 
161
 
void ImagePropertiesSideBarDB::itemChanged(ImageInfoList infos, const QRect& rect, DImg *img)
 
168
void ImagePropertiesSideBarDB::itemChanged(ImageInfoList infos, const QRect& rect, DImg* img)
162
169
{
163
170
    m_currentRect = rect;
164
171
    m_image       = img;
215
222
                m_metadataTab->setCurrentData(data, m_currentURL.fileName());
216
223
            }
217
224
            else
 
225
            {
218
226
                m_metadataTab->setCurrentURL(m_currentURL);
 
227
            }
219
228
 
220
229
            m_dirtyMetadataTab = true;
221
230
        }
252
261
                m_metadataTab->setCurrentData(data, m_currentURL.fileName());
253
262
            }
254
263
            else
 
264
            {
255
265
                m_metadataTab->setCurrentURL(m_currentURL);
 
266
            }
256
267
 
257
268
            m_dirtyMetadataTab = true;
258
269
        }
269
280
        else if (tab == m_gpsTab && !m_dirtyGpsTab)
270
281
        {
271
282
            ImagePosition pos = d->currentInfos.first().imagePosition();
 
283
 
272
284
            if (pos.isEmpty())
273
285
            {
274
286
                m_gpsTab->setCurrentURL();
315
327
        else if (tab == m_gpsTab && !m_dirtyGpsTab)
316
328
        {
317
329
            GPSInfoList list;
 
330
 
318
331
            for (ImageInfoList::const_iterator it = d->currentInfos.constBegin();
319
332
                 it != d->currentInfos.constEnd(); ++it)
320
333
            {
321
334
                ImagePosition pos = (*it).imagePosition();
 
335
 
322
336
                if (!pos.isEmpty())
323
337
                {
324
338
                    GPSInfo info;
330
344
                    list.append(info);
331
345
                }
332
346
            }
 
347
 
333
348
            if (list.isEmpty())
334
349
            {
335
350
                m_gpsTab->setCurrentURL();
338
353
            {
339
354
                m_gpsTab->setGPSInfoList(list);
340
355
            }
 
356
 
341
357
            m_dirtyGpsTab = true;
342
358
        }
343
359
    }
364
380
{
365
381
    if (!d->currentInfos.isEmpty())
366
382
    {
367
 
        QWidget *tab = getActiveTab();
368
 
        if (!tab) return;
 
383
        QWidget* tab = getActiveTab();
 
384
 
 
385
        if (!tab)
 
386
        {
 
387
            return;
 
388
        }
369
389
 
370
390
        if (tab == m_propertiesTab || tab == m_gpsTab)
371
391
        {
372
392
            ImageInfo& info = d->currentInfos.first();
 
393
 
373
394
            if (changeset.ids().contains(info.id()))
374
395
            {
375
396
                // trigger an update, if changes touch the tab's information
376
397
                DatabaseFields::Set set = changeset.changes();
 
398
 
377
399
                if ( (set & DatabaseFields::ImagesAll) ||
378
400
                     (set & DatabaseFields::ImageInformationAll) ||
379
401
                     (set & DatabaseFields::ImageMetadataAll) ||
380
402
                     (set & DatabaseFields::ImageCommentsAll) )
 
403
                {
381
404
                    m_dirtyPropertiesTab = false;
 
405
                }
382
406
                else if (set & DatabaseFields::ImagePositionsAll)
 
407
                {
383
408
                    m_dirtyGpsTab = false;
 
409
                }
384
410
 
385
411
                if ( tab == m_propertiesTab || tab == m_gpsTab)
386
412
                {
452
478
            m_propertiesTab->setFileModifiedDate(str);
453
479
 
454
480
            str = QString("%1 (%2)").arg(KIO::convertSize(commonInfo.fileSize))
455
 
                                    .arg(KGlobal::locale()->formatNumber(commonInfo.fileSize, 0));
 
481
                  .arg(KGlobal::locale()->formatNumber(commonInfo.fileSize, 0));
456
482
            m_propertiesTab->setFileSize(str);
457
483
 
458
484
            //  These infos are not stored in DB
462
488
            // -- Image Properties --------------------------------------------------
463
489
 
464
490
            if (commonInfo.width == 0 || commonInfo.height == 0)
 
491
            {
465
492
                str = i18n("Unknown");
 
493
            }
466
494
            else
467
495
            {
468
496
                QString mpixels;
469
497
                mpixels.setNum(commonInfo.width * commonInfo.height / 1000000.0, 'f', 2);
470
498
                str = i18nc("width x height (megapixels Mpx)", "%1x%2 (%3Mpx)",
471
 
                           commonInfo.width, commonInfo.height, mpixels);
 
499
                            commonInfo.width, commonInfo.height, mpixels);
472
500
            }
 
501
 
473
502
            m_propertiesTab->setImageDimensions(str);
474
503
            m_propertiesTab->setImageBitDepth(i18n("%1 bpp", commonInfo.colorDepth));
475
504
            m_propertiesTab->setImageColorMode(commonInfo.colorModel.isEmpty() ? unavailable : commonInfo.colorModel);
493
522
                m_propertiesTab->setPhotoDateTime(str);
494
523
            }
495
524
            else
 
525
            {
496
526
                m_propertiesTab->setPhotoDateTime(unavailable);
 
527
            }
497
528
 
498
529
            m_propertiesTab->setPhotoLens(photoInfo.lens.isEmpty() ? unavailable : photoInfo.lens);
499
530
            m_propertiesTab->setPhotoAperture(photoInfo.aperture.isEmpty() ? unavailable : photoInfo.aperture);
500
531
 
501
532
            if (photoInfo.focalLength35.isEmpty())
 
533
            {
502
534
                m_propertiesTab->setPhotoFocalLength(photoInfo.focalLength.isEmpty() ? unavailable : photoInfo.focalLength);
 
535
            }
503
536
            else
504
537
            {
505
538
                str = i18n("%1 (35mm: %2)", photoInfo.focalLength, photoInfo.focalLength35);
510
543
            m_propertiesTab->setPhotoSensitivity(photoInfo.sensitivity.isEmpty() ? unavailable : i18n("%1 ISO", photoInfo.sensitivity));
511
544
 
512
545
            if (photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty())
 
546
            {
513
547
                m_propertiesTab->setPhotoExposureMode(unavailable);
 
548
            }
514
549
            else if (!photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty())
 
550
            {
515
551
                m_propertiesTab->setPhotoExposureMode(photoInfo.exposureMode);
 
552
            }
516
553
            else if (photoInfo.exposureMode.isEmpty() && !photoInfo.exposureProgram.isEmpty())
 
554
            {
517
555
                m_propertiesTab->setPhotoExposureMode(photoInfo.exposureProgram);
 
556
            }
518
557
            else
519
558
            {
520
559
                str = QString("%1 / %2").arg(photoInfo.exposureMode).arg(photoInfo.exposureProgram);