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

« back to all changes in this revision

Viewing changes to core/utilities/setup/setuptooltip.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2006-07-09
 
7
 * Description : item tool tip configuration setup tab
 
8
 *
 
9
 * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 *
 
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)
 
15
 * any later version.
 
16
 *
 
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.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
#include "setuptooltip.moc"
 
25
 
 
26
// Qt includes
 
27
 
 
28
#include <QCheckBox>
 
29
#include <QGroupBox>
 
30
#include <QVBoxLayout>
 
31
 
 
32
// KDE includes
 
33
 
 
34
#include <kdialog.h>
 
35
#include <klocale.h>
 
36
#include <ktabwidget.h>
 
37
#include <kvbox.h>
 
38
 
 
39
// Local includes
 
40
 
 
41
#include "albumsettings.h"
 
42
#include "dfontselect.h"
 
43
 
 
44
namespace Digikam
 
45
{
 
46
 
 
47
class SetupToolTip::SetupToolTipPriv
 
48
{
 
49
public:
 
50
 
 
51
    SetupToolTipPriv() :
 
52
        showToolTipsBox(0),
 
53
        showFileNameBox(0),
 
54
        showFileDateBox(0),
 
55
        showFileSizeBox(0),
 
56
        showImageTypeBox(0),
 
57
        showImageDimBox(0),
 
58
        showPhotoMakeBox(0),
 
59
        showPhotoDateBox(0),
 
60
        showPhotoFocalBox(0),
 
61
        showPhotoExpoBox(0),
 
62
        showPhotoModeBox(0),
 
63
        showPhotoFlashBox(0),
 
64
        showPhotoWbBox(0),
 
65
        showAlbumNameBox(0),
 
66
        showCommentsBox(0),
 
67
        showTagsBox(0),
 
68
        showLabelsBox(0),
 
69
        showAlbumToolTipsBox(0),
 
70
        showAlbumTitleBox(0),
 
71
        showAlbumDateBox(0),
 
72
        showAlbumCollectionBox(0),
 
73
        showAlbumCategoryBox(0),
 
74
        showAlbumCaptionBox(0),
 
75
        fileSettingBox(0),
 
76
        photoSettingBox(0),
 
77
        digikamSettingBox(0),
 
78
        albumSettingBox(0),
 
79
        tab(0),
 
80
        fontSelect(0)
 
81
    {
 
82
    }
 
83
 
 
84
    QCheckBox*   showToolTipsBox;
 
85
 
 
86
    QCheckBox*   showFileNameBox;
 
87
    QCheckBox*   showFileDateBox;
 
88
    QCheckBox*   showFileSizeBox;
 
89
    QCheckBox*   showImageTypeBox;
 
90
    QCheckBox*   showImageDimBox;
 
91
 
 
92
    QCheckBox*   showPhotoMakeBox;
 
93
    QCheckBox*   showPhotoDateBox;
 
94
    QCheckBox*   showPhotoFocalBox;
 
95
    QCheckBox*   showPhotoExpoBox;
 
96
    QCheckBox*   showPhotoModeBox;
 
97
    QCheckBox*   showPhotoFlashBox;
 
98
    QCheckBox*   showPhotoWbBox;
 
99
 
 
100
    QCheckBox*   showAlbumNameBox;
 
101
    QCheckBox*   showCommentsBox;
 
102
    QCheckBox*   showTagsBox;
 
103
    QCheckBox*   showLabelsBox;
 
104
 
 
105
    QCheckBox*   showAlbumToolTipsBox;
 
106
    QCheckBox*   showAlbumTitleBox;
 
107
    QCheckBox*   showAlbumDateBox;
 
108
    QCheckBox*   showAlbumCollectionBox;
 
109
    QCheckBox*   showAlbumCategoryBox;
 
110
    QCheckBox*   showAlbumCaptionBox;
 
111
 
 
112
    QGroupBox*   fileSettingBox;
 
113
    QGroupBox*   photoSettingBox;
 
114
    QGroupBox*   digikamSettingBox;
 
115
    QGroupBox*   albumSettingBox;
 
116
 
 
117
    KTabWidget*  tab;
 
118
 
 
119
    DFontSelect* fontSelect;
 
120
};
 
121
 
 
122
SetupToolTip::SetupToolTip(QWidget* parent)
 
123
    : QScrollArea(parent), d(new SetupToolTipPriv)
 
124
{
 
125
    QWidget* panel = new QWidget(viewport());
 
126
    setWidget(panel);
 
127
    setWidgetResizable(true);
 
128
 
 
129
    QVBoxLayout* vlay     = new QVBoxLayout(panel);
 
130
 
 
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."));
 
133
 
 
134
    d->tab                = new KTabWidget(panel);
 
135
 
 
136
    // --------------------------------------------------------
 
137
 
 
138
    KVBox* vbox           = new KVBox(panel);
 
139
 
 
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."));
 
143
 
 
144
    d->fileSettingBox     = new QGroupBox(i18n("File/Image Information"), vbox);
 
145
    QVBoxLayout* vlay2    = new QVBoxLayout(d->fileSettingBox);
 
146
 
 
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."));
 
149
 
 
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."));
 
152
 
 
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."));
 
155
 
 
156
    d->showImageTypeBox   = new QCheckBox(i18n("Show image type"), d->fileSettingBox);
 
157
    d->showImageTypeBox->setWhatsThis(i18n("Set this option to display the image type."));
 
158
 
 
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."));
 
161
 
 
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);
 
169
 
 
170
    // --------------------------------------------------------
 
171
 
 
172
    d->photoSettingBox    = new QGroupBox(i18n("Photograph Information"), vbox);
 
173
    QVBoxLayout* vlay3    = new QVBoxLayout(d->photoSettingBox);
 
174
 
 
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."));
 
178
 
 
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."));
 
181
 
 
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."));
 
185
 
 
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."));
 
189
 
 
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."));
 
193
 
 
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."));
 
197
 
 
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."));
 
201
 
 
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);
 
211
 
 
212
    // --------------------------------------------------------
 
213
 
 
214
    d->digikamSettingBox = new QGroupBox(i18n("digiKam Information"), vbox);
 
215
    QVBoxLayout* vlay4   = new QVBoxLayout(d->digikamSettingBox);
 
216
 
 
217
    d->showAlbumNameBox  = new QCheckBox(i18n("Show album name"), d->digikamSettingBox);
 
218
    d->showAlbumNameBox->setWhatsThis(i18n("Set this option to display the album name."));
 
219
 
 
220
    d->showCommentsBox   = new QCheckBox(i18n("Show image caption"), d->digikamSettingBox);
 
221
    d->showCommentsBox->setWhatsThis(i18n("Set this option to display the image captions."));
 
222
 
 
223
    d->showTagsBox       = new QCheckBox(i18n("Show image tags"), d->digikamSettingBox);
 
224
    d->showTagsBox->setWhatsThis(i18n("Set this option to display the image tags."));
 
225
 
 
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."));
 
228
 
 
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);
 
235
 
 
236
    QWidget* space = new QWidget(vbox);
 
237
    vbox->setStretchFactor(space, 10);
 
238
    vbox->setMargin(KDialog::spacingHint());
 
239
    vbox->setSpacing(KDialog::spacingHint());
 
240
 
 
241
    // --------------------------------------------------------
 
242
 
 
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);
 
246
 
 
247
    d->showAlbumToolTipsBox->setWhatsThis(i18n("Set this option to display album information when "
 
248
                                               "the mouse hovers over a folder-view item."));
 
249
 
 
250
    d->showAlbumTitleBox      = new QCheckBox(i18n("Show album name"));
 
251
    d->showAlbumTitleBox->setWhatsThis(i18n("Set this option to display the album name."));
 
252
 
 
253
    d->showAlbumDateBox       = new QCheckBox(i18n("Show album date"));
 
254
    d->showAlbumDateBox->setWhatsThis(i18n("Set this option to display the album date."));
 
255
 
 
256
    d->showAlbumCollectionBox = new QCheckBox(i18n("Show album collection"));
 
257
    d->showAlbumCollectionBox->setWhatsThis(i18n("Set this option to display the album collection."));
 
258
 
 
259
    d->showAlbumCategoryBox   = new QCheckBox(i18n("Show album category"));
 
260
    d->showAlbumCategoryBox->setWhatsThis(i18n("Set this option to display the album category."));
 
261
 
 
262
    d->showAlbumCaptionBox    = new QCheckBox(i18n("Show album caption"));
 
263
    d->showAlbumCaptionBox->setWhatsThis(i18n("Set this option to display the album caption."));
 
264
 
 
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);
 
272
 
 
273
    QWidget* space2 = new QWidget(vbox2);
 
274
    vbox2->setStretchFactor(space2, 10);
 
275
    vbox2->setMargin(KDialog::spacingHint());
 
276
    vbox2->setSpacing(KDialog::spacingHint());
 
277
 
 
278
    // --------------------------------------------------------
 
279
 
 
280
    d->tab->insertTab(0, vbox,  i18n("Icon Items"));
 
281
    d->tab->insertTab(1, vbox2, i18n("Album Items"));
 
282
 
 
283
    vlay->addWidget(d->fontSelect);
 
284
    vlay->addWidget(d->tab);
 
285
    vlay->addStretch();
 
286
    vlay->setMargin(KDialog::spacingHint());
 
287
    vlay->setSpacing(KDialog::spacingHint());
 
288
 
 
289
    // --------------------------------------------------------
 
290
 
 
291
    connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
 
292
            d->fileSettingBox, SLOT(setEnabled(bool)));
 
293
 
 
294
    connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
 
295
            d->photoSettingBox, SLOT(setEnabled(bool)));
 
296
 
 
297
    connect(d->showToolTipsBox, SIGNAL(toggled(bool)),
 
298
            d->digikamSettingBox, SLOT(setEnabled(bool)));
 
299
 
 
300
    connect(d->showAlbumToolTipsBox, SIGNAL(toggled(bool)),
 
301
            d->albumSettingBox, SLOT(setEnabled(bool)));
 
302
 
 
303
    // --------------------------------------------------------
 
304
 
 
305
    readSettings();
 
306
    adjustSize();
 
307
 
 
308
    // --------------------------------------------------------
 
309
 
 
310
    setAutoFillBackground(false);
 
311
    viewport()->setAutoFillBackground(false);
 
312
    panel->setAutoFillBackground(false);
 
313
}
 
314
 
 
315
SetupToolTip::~SetupToolTip()
 
316
{
 
317
    delete d;
 
318
}
 
319
 
 
320
void SetupToolTip::applySettings()
 
321
{
 
322
    AlbumSettings* settings = AlbumSettings::instance();
 
323
 
 
324
    if (!settings)
 
325
    {
 
326
        return;
 
327
    }
 
328
 
 
329
    settings->setToolTipsFont(d->fontSelect->font());
 
330
 
 
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());
 
337
 
 
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());
 
345
 
 
346
    settings->setToolTipsShowAlbumName(d->showAlbumNameBox->isChecked());
 
347
    settings->setToolTipsShowComments(d->showCommentsBox->isChecked());
 
348
    settings->setToolTipsShowTags(d->showTagsBox->isChecked());
 
349
    settings->setToolTipsShowLabelRating(d->showLabelsBox->isChecked());
 
350
 
 
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());
 
357
 
 
358
    settings->saveSettings();
 
359
}
 
360
 
 
361
void SetupToolTip::readSettings()
 
362
{
 
363
    AlbumSettings* settings = AlbumSettings::instance();
 
364
 
 
365
    if (!settings)
 
366
    {
 
367
        return;
 
368
    }
 
369
 
 
370
    d->fontSelect->setFont(settings->getToolTipsFont());
 
371
 
 
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());
 
378
 
 
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());
 
386
 
 
387
    d->showAlbumNameBox->setChecked(settings->getToolTipsShowAlbumName());
 
388
    d->showCommentsBox->setChecked(settings->getToolTipsShowComments());
 
389
    d->showTagsBox->setChecked(settings->getToolTipsShowTags());
 
390
    d->showLabelsBox->setChecked(settings->getToolTipsShowLabelRating());
 
391
 
 
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());
 
396
 
 
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());
 
403
}
 
404
 
 
405
}  // namespace Digikam