1
/* ============================================================
2
* Author: Caulier Gilles <caulier dot gilles at free.fr>
6
* Copyright 2004 by Gilles Caulier
8
* This program is free software; you can redistribute it
9
* and/or modify it under the terms of the GNU General
10
* Public License as published by the Free Software Foundation;
11
* either version 2, or (at your option)
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* ============================================================ */
24
#include <qcombobox.h>
25
#include <qwhatsthis.h>
29
#include <kapplication.h>
32
#include <libkexif/kexifwidget.h>
34
#include "thumbnailjob.h"
35
#include "imagepropertiesexif.h"
37
ImagePropertiesEXIF::ImagePropertiesEXIF(QWidget* page)
39
QVBoxLayout* vlay = new QVBoxLayout(page, 5, 5);
40
QHBoxLayout* hlay = new QHBoxLayout(vlay);
42
m_labelThumb = new QLabel( page );
43
m_labelThumb->setFixedHeight( 48 );
44
hlay->addWidget(m_labelThumb);
47
QLabel* levelLabel = new QLabel(i18n("Select level of detail:"), page);
48
m_levelCombo = new QComboBox(page);
49
hlay->addWidget(levelLabel);
50
hlay->addWidget(m_levelCombo);
52
QWhatsThis::add( m_levelCombo, i18n("<p>Select here the Exif information level to display<p>"
53
"<b>Simple</b>: display general information about the photograph "
55
"<b>Full</b>: display all EXIF sections.") );
57
m_exifWidget = new KExifWidget(page);
58
vlay->addWidget(m_exifWidget);
60
m_levelCombo->insertItem(i18n("Simple"));
61
m_levelCombo->insertItem(i18n("Full"));
62
connect(m_levelCombo, SIGNAL(activated(int)),
63
SLOT(slotLevelChanged(int)));
65
// -- read config ---------------------------------------------------------
67
KConfig* config = kapp->config();
68
config->setGroup("Image Properties Dialog");
69
m_levelCombo->setCurrentItem(config->readNumEntry("EXIF Level", 0));
70
m_currItem = config->readEntry("Current EXIF Item", QString());
74
ImagePropertiesEXIF::~ImagePropertiesEXIF()
76
if (!m_thumbJob.isNull())
79
KConfig* config = kapp->config();
80
config->setGroup("Image Properties Dialog");
81
config->writeEntry("EXIF Level", m_levelCombo->currentItem());
82
config->writeEntry("Current EXIF Item", m_currItem);
85
void ImagePropertiesEXIF::setCurrentURL(const KURL& url)
88
if (!m_thumbJob.isNull())
91
m_thumbJob = new ThumbnailJob(url, 48);
93
connect(m_thumbJob, SIGNAL(signalThumbnailMetaInfo(const KURL&,
95
const KFileMetaInfo*)),
96
SLOT(slotGotThumbnail(const KURL&,
98
const KFileMetaInfo*)));
100
connect(m_thumbJob, SIGNAL(signalFailed(const KURL&)),
101
SLOT(slotFailedThumbnail(const KURL&)));
103
// ----------------------------------------------------------------
105
if (!m_exifWidget->getCurrentItemName().isNull())
106
m_currItem = m_exifWidget->getCurrentItemName();
108
m_exifWidget->loadFile(url.path());
110
m_exifWidget->setCurrentItem(m_currItem);
113
void ImagePropertiesEXIF::slotLevelChanged(int)
115
if (m_levelCombo->currentText() == i18n("Simple"))
116
m_exifWidget->setMode(KExifWidget::SIMPLE);
118
m_exifWidget->setMode(KExifWidget::FULL);
121
void ImagePropertiesEXIF::slotGotThumbnail(const KURL&, const QPixmap& pix,
122
const KFileMetaInfo*)
125
m_labelThumb->setPixmap(pix);
127
m_labelThumb->clear();
130
void ImagePropertiesEXIF::slotFailedThumbnail(const KURL&)
132
m_labelThumb->clear();
135
#include "imagepropertiesexif.moc"