1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : item tool tip configuration setup tab
9
* Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
#include "setuptooltip.moc"
30
#include <QVBoxLayout>
36
#include <ktabwidget.h>
41
#include "albumsettings.h"
42
#include "dfontselect.h"
47
class SetupToolTip::SetupToolTipPriv
69
showAlbumToolTipsBox(0),
72
showAlbumCollectionBox(0),
73
showAlbumCategoryBox(0),
74
showAlbumCaptionBox(0),
84
QCheckBox* showToolTipsBox;
86
QCheckBox* showFileNameBox;
87
QCheckBox* showFileDateBox;
88
QCheckBox* showFileSizeBox;
89
QCheckBox* showImageTypeBox;
90
QCheckBox* showImageDimBox;
92
QCheckBox* showPhotoMakeBox;
93
QCheckBox* showPhotoDateBox;
94
QCheckBox* showPhotoFocalBox;
95
QCheckBox* showPhotoExpoBox;
96
QCheckBox* showPhotoModeBox;
97
QCheckBox* showPhotoFlashBox;
98
QCheckBox* showPhotoWbBox;
100
QCheckBox* showAlbumNameBox;
101
QCheckBox* showCommentsBox;
102
QCheckBox* showTagsBox;
103
QCheckBox* showLabelsBox;
105
QCheckBox* showAlbumToolTipsBox;
106
QCheckBox* showAlbumTitleBox;
107
QCheckBox* showAlbumDateBox;
108
QCheckBox* showAlbumCollectionBox;
109
QCheckBox* showAlbumCategoryBox;
110
QCheckBox* showAlbumCaptionBox;
112
QGroupBox* fileSettingBox;
113
QGroupBox* photoSettingBox;
114
QGroupBox* digikamSettingBox;
115
QGroupBox* albumSettingBox;
119
DFontSelect* fontSelect;
122
SetupToolTip::SetupToolTip(QWidget* parent)
123
: QScrollArea(parent), d(new SetupToolTipPriv)
125
QWidget* panel = new QWidget(viewport());
127
setWidgetResizable(true);
129
QVBoxLayout* vlay = new QVBoxLayout(panel);
131
d->fontSelect = new DFontSelect(i18n("Tool-Tips Font:"), panel);
132
d->fontSelect->setToolTip(i18n("Select here the font used to display text in tool-tips."));
134
d->tab = new KTabWidget(panel);
136
// --------------------------------------------------------
138
KVBox* vbox = new KVBox(panel);
140
d->showToolTipsBox = new QCheckBox(i18n("Show icon-view and thumb-bar items' tool-tips"), vbox);
141
d->showToolTipsBox->setWhatsThis(i18n("Set this option to display image information when "
142
"the mouse hovers over an icon-view or thumb-bar item."));
144
d->fileSettingBox = new QGroupBox(i18n("File/Image Information"), vbox);
145
QVBoxLayout* vlay2 = new QVBoxLayout(d->fileSettingBox);
147
d->showFileNameBox = new QCheckBox(i18n("Show file name"), d->fileSettingBox);
148
d->showFileNameBox->setWhatsThis(i18n("Set this option to display the image file name."));
150
d->showFileDateBox = new QCheckBox(i18n("Show file date"), d->fileSettingBox);
151
d->showFileDateBox->setWhatsThis(i18n("Set this option to display the image file date."));
153
d->showFileSizeBox = new QCheckBox(i18n("Show file size"), d->fileSettingBox);
154
d->showFileSizeBox->setWhatsThis(i18n("Set this option to display the image file size."));
156
d->showImageTypeBox = new QCheckBox(i18n("Show image type"), d->fileSettingBox);
157
d->showImageTypeBox->setWhatsThis(i18n("Set this option to display the image type."));
159
d->showImageDimBox = new QCheckBox(i18n("Show image dimensions"), d->fileSettingBox);
160
d->showImageDimBox->setWhatsThis(i18n("Set this option to display the image dimensions in pixels."));
162
vlay2->addWidget(d->showFileNameBox);
163
vlay2->addWidget(d->showFileDateBox);
164
vlay2->addWidget(d->showFileSizeBox);
165
vlay2->addWidget(d->showImageTypeBox);
166
vlay2->addWidget(d->showImageDimBox);
167
vlay2->setMargin(KDialog::spacingHint());
168
vlay2->setSpacing(0);
170
// --------------------------------------------------------
172
d->photoSettingBox = new QGroupBox(i18n("Photograph Information"), vbox);
173
QVBoxLayout* vlay3 = new QVBoxLayout(d->photoSettingBox);
175
d->showPhotoMakeBox = new QCheckBox(i18n("Show camera make and model"), d->photoSettingBox);
176
d->showPhotoMakeBox->setWhatsThis(i18n("Set this option to display the make and model of the "
177
"camera with which the image has been taken."));
179
d->showPhotoDateBox = new QCheckBox(i18n("Show camera date"), d->photoSettingBox);
180
d->showPhotoDateBox->setWhatsThis(i18n("Set this option to display the date when the image was taken."));
182
d->showPhotoFocalBox = new QCheckBox(i18n("Show camera aperture and focal length"), d->photoSettingBox);
183
d->showPhotoFocalBox->setWhatsThis(i18n("Set this option to display the camera aperture and focal settings "
184
"used to take the image."));
186
d->showPhotoExpoBox = new QCheckBox(i18n("Show camera exposure and sensitivity"), d->photoSettingBox);
187
d->showPhotoExpoBox->setWhatsThis(i18n("Set this option to display the camera exposure and sensitivity "
188
"used to take the image."));
190
d->showPhotoModeBox = new QCheckBox(i18n("Show camera mode and program"), d->photoSettingBox);
191
d->showPhotoModeBox->setWhatsThis(i18n("Set this option to display the camera mode and program "
192
"used to take the image."));
194
d->showPhotoFlashBox = new QCheckBox(i18n("Show camera flash settings"), d->photoSettingBox);
195
d->showPhotoFlashBox->setWhatsThis(i18n("Set this option to display the camera flash settings "
196
"used to take the image."));
198
d->showPhotoWbBox = new QCheckBox(i18n("Show camera white balance settings"), d->photoSettingBox);
199
d->showPhotoWbBox->setWhatsThis(i18n("Set this option to display the camera white balance settings "
200
"used to take the image."));
202
vlay3->addWidget(d->showPhotoMakeBox);
203
vlay3->addWidget(d->showPhotoDateBox);
204
vlay3->addWidget(d->showPhotoFocalBox);
205
vlay3->addWidget(d->showPhotoExpoBox);
206
vlay3->addWidget(d->showPhotoModeBox);
207
vlay3->addWidget(d->showPhotoFlashBox);
208
vlay3->addWidget(d->showPhotoWbBox);
209
vlay3->setMargin(KDialog::spacingHint());
210
vlay3->setSpacing(0);
212
// --------------------------------------------------------
214
d->digikamSettingBox = new QGroupBox(i18n("digiKam Information"), vbox);
215
QVBoxLayout* vlay4 = new QVBoxLayout(d->digikamSettingBox);
217
d->showAlbumNameBox = new QCheckBox(i18n("Show album name"), d->digikamSettingBox);
218
d->showAlbumNameBox->setWhatsThis(i18n("Set this option to display the album name."));
220
d->showCommentsBox = new QCheckBox(i18n("Show image caption"), d->digikamSettingBox);
221
d->showCommentsBox->setWhatsThis(i18n("Set this option to display the image captions."));
223
d->showTagsBox = new QCheckBox(i18n("Show image tags"), d->digikamSettingBox);
224
d->showTagsBox->setWhatsThis(i18n("Set this option to display the image tags."));
226
d->showLabelsBox = new QCheckBox(i18n("Show image labels"), d->digikamSettingBox);
227
d->showLabelsBox->setWhatsThis(i18n("Set this option to display the image pick, color, rating labels."));
229
vlay4->addWidget(d->showAlbumNameBox);
230
vlay4->addWidget(d->showCommentsBox);
231
vlay4->addWidget(d->showTagsBox);
232
vlay4->addWidget(d->showLabelsBox);
233
vlay4->setMargin(KDialog::spacingHint());
234
vlay4->setSpacing(0);
236
QWidget* space = new QWidget(vbox);
237
vbox->setStretchFactor(space, 10);
238
vbox->setMargin(KDialog::spacingHint());
239
vbox->setSpacing(KDialog::spacingHint());
241
// --------------------------------------------------------
243
KVBox* vbox2 = new KVBox(panel);
244
d->showAlbumToolTipsBox = new QCheckBox(i18n("Show album items' tool-tips"), vbox2);
245
d->albumSettingBox = new QGroupBox(i18n("Album Information"), vbox2);
247
d->showAlbumToolTipsBox->setWhatsThis(i18n("Set this option to display album information when "
248
"the mouse hovers over a folder-view item."));
250
d->showAlbumTitleBox = new QCheckBox(i18n("Show album name"));
251
d->showAlbumTitleBox->setWhatsThis(i18n("Set this option to display the album name."));
253
d->showAlbumDateBox = new QCheckBox(i18n("Show album date"));
254
d->showAlbumDateBox->setWhatsThis(i18n("Set this option to display the album date."));
256
d->showAlbumCollectionBox = new QCheckBox(i18n("Show album collection"));
257
d->showAlbumCollectionBox->setWhatsThis(i18n("Set this option to display the album collection."));
259
d->showAlbumCategoryBox = new QCheckBox(i18n("Show album category"));
260
d->showAlbumCategoryBox->setWhatsThis(i18n("Set this option to display the album category."));
262
d->showAlbumCaptionBox = new QCheckBox(i18n("Show album caption"));
263
d->showAlbumCaptionBox->setWhatsThis(i18n("Set this option to display the album caption."));
265
QVBoxLayout* albumSettingBoxLayout = new QVBoxLayout;
266
albumSettingBoxLayout->addWidget(d->showAlbumTitleBox);
267
albumSettingBoxLayout->addWidget(d->showAlbumDateBox);
268
albumSettingBoxLayout->addWidget(d->showAlbumCollectionBox);
269
albumSettingBoxLayout->addWidget(d->showAlbumCategoryBox);
270
albumSettingBoxLayout->addWidget(d->showAlbumCaptionBox);
271
d->albumSettingBox->setLayout(albumSettingBoxLayout);
273
QWidget* space2 = new QWidget(vbox2);
274
vbox2->setStretchFactor(space2, 10);
275
vbox2->setMargin(KDialog::spacingHint());
276
vbox2->setSpacing(KDialog::spacingHint());
278
// --------------------------------------------------------
280
d->tab->insertTab(0, vbox, i18n("Icon Items"));
281
d->tab->insertTab(1, vbox2, i18n("Album Items"));
283
vlay->addWidget(d->fontSelect);
284
vlay->addWidget(d->tab);
286
vlay->setMargin(KDialog::spacingHint());
287
vlay->setSpacing(KDialog::spacingHint());
289
// --------------------------------------------------------
291
connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
292
d->fileSettingBox, SLOT(setEnabled(bool)));
294
connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
295
d->photoSettingBox, SLOT(setEnabled(bool)));
297
connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
298
d->digikamSettingBox, SLOT(setEnabled(bool)));
300
connect(d->showAlbumToolTipsBox, SIGNAL(toggled(bool)),
301
d->albumSettingBox, SLOT(setEnabled(bool)));
303
// --------------------------------------------------------
308
// --------------------------------------------------------
310
setAutoFillBackground(false);
311
viewport()->setAutoFillBackground(false);
312
panel->setAutoFillBackground(false);
315
SetupToolTip::~SetupToolTip()
320
void SetupToolTip::applySettings()
322
AlbumSettings* settings = AlbumSettings::instance();
329
settings->setToolTipsFont(d->fontSelect->font());
331
settings->setShowToolTips(d->showToolTipsBox->isChecked());
332
settings->setToolTipsShowFileName(d->showFileNameBox->isChecked());
333
settings->setToolTipsShowFileDate(d->showFileDateBox->isChecked());
334
settings->setToolTipsShowFileSize(d->showFileSizeBox->isChecked());
335
settings->setToolTipsShowImageType(d->showImageTypeBox->isChecked());
336
settings->setToolTipsShowImageDim(d->showImageDimBox->isChecked());
338
settings->setToolTipsShowPhotoMake(d->showPhotoMakeBox->isChecked());
339
settings->setToolTipsShowPhotoDate(d->showPhotoDateBox->isChecked());
340
settings->setToolTipsShowPhotoFocal(d->showPhotoFocalBox->isChecked());
341
settings->setToolTipsShowPhotoExpo(d->showPhotoExpoBox->isChecked());
342
settings->setToolTipsShowPhotoMode(d->showPhotoModeBox->isChecked());
343
settings->setToolTipsShowPhotoFlash(d->showPhotoFlashBox->isChecked());
344
settings->setToolTipsShowPhotoWB(d->showPhotoWbBox->isChecked());
346
settings->setToolTipsShowAlbumName(d->showAlbumNameBox->isChecked());
347
settings->setToolTipsShowComments(d->showCommentsBox->isChecked());
348
settings->setToolTipsShowTags(d->showTagsBox->isChecked());
349
settings->setToolTipsShowLabelRating(d->showLabelsBox->isChecked());
351
settings->setShowAlbumToolTips(d->showAlbumToolTipsBox->isChecked());
352
settings->setToolTipsShowAlbumTitle(d->showAlbumTitleBox->isChecked());
353
settings->setToolTipsShowAlbumDate(d->showAlbumDateBox->isChecked());
354
settings->setToolTipsShowAlbumCollection(d->showAlbumCollectionBox->isChecked());
355
settings->setToolTipsShowAlbumCategory(d->showAlbumCategoryBox->isChecked());
356
settings->setToolTipsShowAlbumCaption(d->showAlbumCaptionBox->isChecked());
358
settings->saveSettings();
361
void SetupToolTip::readSettings()
363
AlbumSettings* settings = AlbumSettings::instance();
370
d->fontSelect->setFont(settings->getToolTipsFont());
372
d->showToolTipsBox->setChecked(settings->getShowToolTips());
373
d->showFileNameBox->setChecked(settings->getToolTipsShowFileName());
374
d->showFileDateBox->setChecked(settings->getToolTipsShowFileDate());
375
d->showFileSizeBox->setChecked(settings->getToolTipsShowFileSize());
376
d->showImageTypeBox->setChecked(settings->getToolTipsShowImageType());
377
d->showImageDimBox->setChecked(settings->getToolTipsShowImageDim());
379
d->showPhotoMakeBox->setChecked(settings->getToolTipsShowPhotoMake());
380
d->showPhotoDateBox->setChecked(settings->getToolTipsShowPhotoDate());
381
d->showPhotoFocalBox->setChecked(settings->getToolTipsShowPhotoFocal());
382
d->showPhotoExpoBox->setChecked(settings->getToolTipsShowPhotoExpo());
383
d->showPhotoModeBox->setChecked(settings->getToolTipsShowPhotoMode());
384
d->showPhotoFlashBox->setChecked(settings->getToolTipsShowPhotoFlash());
385
d->showPhotoWbBox->setChecked(settings->getToolTipsShowPhotoWB());
387
d->showAlbumNameBox->setChecked(settings->getToolTipsShowAlbumName());
388
d->showCommentsBox->setChecked(settings->getToolTipsShowComments());
389
d->showTagsBox->setChecked(settings->getToolTipsShowTags());
390
d->showLabelsBox->setChecked(settings->getToolTipsShowLabelRating());
392
d->fileSettingBox->setEnabled(d->showToolTipsBox->isChecked());
393
d->photoSettingBox->setEnabled(d->showToolTipsBox->isChecked());
394
d->digikamSettingBox->setEnabled(d->showToolTipsBox->isChecked());
395
d->albumSettingBox->setEnabled(d->showAlbumToolTipsBox->isChecked());
397
d->showAlbumToolTipsBox->setChecked(settings->getShowAlbumToolTips());
398
d->showAlbumTitleBox->setChecked(settings->getToolTipsShowAlbumTitle());
399
d->showAlbumDateBox->setChecked(settings->getToolTipsShowAlbumDate());
400
d->showAlbumCollectionBox->setChecked(settings->getToolTipsShowAlbumCollection());
401
d->showAlbumCategoryBox->setChecked(settings->getToolTipsShowAlbumCategory());
402
d->showAlbumCaptionBox->setChecked(settings->getToolTipsShowAlbumCaption());
405
} // namespace Digikam