summaryrefslogtreecommitdiffstats
path: root/digikam/utilities/setup/setuptooltip.cpp
blob: 83a43d9a9fad949e72caf4e35d1ddf32d39d8759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 * 
 * Date        : 2006-07-09
 * Description : album item tool tip configuration setup tab
 *
 * Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

// TQt includes.

#include <tqlayout.h>
#include <tqvgroupbox.h>
#include <tqcheckbox.h>
#include <tqwhatsthis.h>

// KDE includes.

#include <klocale.h>
#include <kdialogbase.h>

// Local includes.

#include "albumsettings.h"
#include "setuptooltip.h"
#include "setuptooltip.moc"

namespace Digikam
{

class SetupToolTipPriv
{
public:

    SetupToolTipPriv()
    {
        showToolTipsBox   = 0;

        showFileNameBox   = 0;
        showFileDateBox   = 0;
        showFileSizeBox   = 0;
        showImageTypeBox  = 0;
        showImageDimBox   = 0;

        showPhotoMakeBox  = 0;
        showPhotoDateBox  = 0;
        showPhotoFocalBox = 0;
        showPhotoExpoBox  = 0;
        showPhotoModeBox  = 0;
        showPhotoFlashBox = 0;
        showPhotoWbBox    = 0;

        showAlbumNameBox  = 0;
        showCommentsBox   = 0;
        showTagsBox       = 0;
        showRatingBox     = 0;

        fileSettingBox    = 0;
        photoSettingBox   = 0;
        digikamSettingBox = 0;
    }

    TQCheckBox  *showToolTipsBox;

    TQCheckBox  *showFileNameBox;
    TQCheckBox  *showFileDateBox;
    TQCheckBox  *showFileSizeBox;
    TQCheckBox  *showImageTypeBox;
    TQCheckBox  *showImageDimBox;

    TQCheckBox  *showPhotoMakeBox;
    TQCheckBox  *showPhotoDateBox;
    TQCheckBox  *showPhotoFocalBox;
    TQCheckBox  *showPhotoExpoBox;
    TQCheckBox  *showPhotoModeBox;
    TQCheckBox  *showPhotoFlashBox;
    TQCheckBox  *showPhotoWbBox;

    TQCheckBox  *showAlbumNameBox;
    TQCheckBox  *showCommentsBox;
    TQCheckBox  *showTagsBox;
    TQCheckBox  *showRatingBox;

    TQVGroupBox *fileSettingBox;
    TQVGroupBox *photoSettingBox;
    TQVGroupBox *digikamSettingBox;
};

SetupToolTip::SetupToolTip(TQWidget* parent)
            : TQWidget(parent)
{
    d = new SetupToolTipPriv;
    TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() );

    d->showToolTipsBox = new TQCheckBox(i18n("Show album items toolti&ps"), parent);
    TQWhatsThis::add( d->showToolTipsBox, i18n("<p>Set this option to display image information when "
                                              "the mouse hovers over an album item."));

    layout->addWidget(d->showToolTipsBox);

    // --------------------------------------------------------

    d->fileSettingBox = new TQVGroupBox(i18n("File/Image Information"), parent);

    d->showFileNameBox = new TQCheckBox(i18n("Show file name"), d->fileSettingBox);
    TQWhatsThis::add( d->showFileNameBox, i18n("<p>Set this option to display the image file name."));

    d->showFileDateBox = new TQCheckBox(i18n("Show file date"), d->fileSettingBox);
    TQWhatsThis::add( d->showFileDateBox, i18n("<p>Set this option to display the image file date."));

    d->showFileSizeBox = new TQCheckBox(i18n("Show file size"), d->fileSettingBox);
    TQWhatsThis::add( d->showFileSizeBox, i18n("<p>Set this option to display the image file size."));

    d->showImageTypeBox = new TQCheckBox(i18n("Show image type"), d->fileSettingBox);
    TQWhatsThis::add( d->showImageTypeBox, i18n("<p>Set this option to display the image type."));

    d->showImageDimBox = new TQCheckBox(i18n("Show image dimensions"), d->fileSettingBox);
    TQWhatsThis::add( d->showImageDimBox, i18n("<p>Set this option to display the image dimensions in pixels."));

    layout->addWidget(d->fileSettingBox);

    // --------------------------------------------------------

    d->photoSettingBox = new TQVGroupBox(i18n("Photograph Information"), parent);

    d->showPhotoMakeBox = new TQCheckBox(i18n("Show camera make and model"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoMakeBox, i18n("<p>Set this option to display the make and model of the "
                                               "camera with which the image has been taken."));

    d->showPhotoDateBox = new TQCheckBox(i18n("Show camera date"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoDateBox, i18n("<p>Set this option to display the date when the image was taken."));

    d->showPhotoFocalBox = new TQCheckBox(i18n("Show camera aperture and focal"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoFocalBox, i18n("<p>Set this option to display the camera aperture and focal settings "
                     "used to take the image."));

    d->showPhotoExpoBox = new TQCheckBox(i18n("Show camera exposure and sensitivity"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoExpoBox, i18n("<p>Set this option to display the camera exposure and sensitivity "
                     "used to take the image."));

    d->showPhotoModeBox = new TQCheckBox(i18n("Show camera mode and program"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoModeBox, i18n("<p>Set this option to display the camera mode and program "
                     "used to take the image."));

    d->showPhotoFlashBox = new TQCheckBox(i18n("Show camera flash settings"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoFlashBox, i18n("<p>Set this option to display the camera flash settings "
                     "used to take the image."));

    d->showPhotoWbBox = new TQCheckBox(i18n("Show camera white balance settings"), d->photoSettingBox);
    TQWhatsThis::add( d->showPhotoWbBox, i18n("<p>Set this option to display the camera white balance settings "
                     "used to take the image."));

    layout->addWidget(d->photoSettingBox);

    // --------------------------------------------------------

    d->digikamSettingBox = new TQVGroupBox(i18n("digiKam Information"), parent);

    d->showAlbumNameBox = new TQCheckBox(i18n("Show album name"), d->digikamSettingBox);
    TQWhatsThis::add( d->showAlbumNameBox, i18n("<p>Set this option to display the album name."));

    d->showCommentsBox = new TQCheckBox(i18n("Show image caption"), d->digikamSettingBox);
    TQWhatsThis::add( d->showCommentsBox, i18n("<p>Set this option to display the image captions."));

    d->showTagsBox = new TQCheckBox(i18n("Show image tags"), d->digikamSettingBox);
    TQWhatsThis::add( d->showTagsBox, i18n("<p>Set this option to display the image tags."));

    d->showRatingBox = new TQCheckBox(i18n("Show image rating"), d->digikamSettingBox);
    TQWhatsThis::add( d->showRatingBox, i18n("<p>Set this option to display the image rating."));

    layout->addWidget(d->digikamSettingBox);
    layout->addStretch();

    // --------------------------------------------------------

    connect(d->showToolTipsBox, TQT_SIGNAL(toggled(bool)),
            d->fileSettingBox, TQT_SLOT(setEnabled(bool)));

    connect(d->showToolTipsBox, TQT_SIGNAL(toggled(bool)),
            d->photoSettingBox, TQT_SLOT(setEnabled(bool)));

    connect(d->showToolTipsBox, TQT_SIGNAL(toggled(bool)),
            d->digikamSettingBox, TQT_SLOT(setEnabled(bool)));

    // --------------------------------------------------------

    readSettings();
    adjustSize();
}

SetupToolTip::~SetupToolTip()
{
    delete d;
}

void SetupToolTip::applySettings()
{
    AlbumSettings* settings = AlbumSettings::instance();
    if (!settings) return;

    settings->setShowToolTips(d->showToolTipsBox->isChecked());

    settings->setToolTipsShowFileName(d->showFileNameBox->isChecked());
    settings->setToolTipsShowFileDate(d->showFileDateBox->isChecked());
    settings->setToolTipsShowFileSize(d->showFileSizeBox->isChecked());
    settings->setToolTipsShowImageType(d->showImageTypeBox->isChecked());
    settings->setToolTipsShowImageDim(d->showImageDimBox->isChecked());

    settings->setToolTipsShowPhotoMake(d->showPhotoMakeBox->isChecked());
    settings->setToolTipsShowPhotoDate(d->showPhotoDateBox->isChecked());
    settings->setToolTipsShowPhotoFocal(d->showPhotoFocalBox->isChecked());
    settings->setToolTipsShowPhotoExpo(d->showPhotoExpoBox->isChecked());
    settings->setToolTipsShowPhotoMode(d->showPhotoModeBox->isChecked());
    settings->setToolTipsShowPhotoFlash(d->showPhotoFlashBox->isChecked());
    settings->setToolTipsShowPhotoWB(d->showPhotoWbBox->isChecked());

    settings->setToolTipsShowAlbumName(d->showAlbumNameBox->isChecked());
    settings->setToolTipsShowComments(d->showCommentsBox->isChecked());
    settings->setToolTipsShowTags(d->showTagsBox->isChecked());
    settings->setToolTipsShowRating(d->showRatingBox->isChecked());

    settings->saveSettings();
}

void SetupToolTip::readSettings()
{
    AlbumSettings* settings = AlbumSettings::instance();

    if (!settings) return;

    d->showToolTipsBox->setChecked(settings->getShowToolTips());

    d->showFileNameBox->setChecked(settings->getToolTipsShowFileName());
    d->showFileDateBox->setChecked(settings->getToolTipsShowFileDate());
    d->showFileSizeBox->setChecked(settings->getToolTipsShowFileSize());
    d->showImageTypeBox->setChecked(settings->getToolTipsShowImageType());
    d->showImageDimBox->setChecked(settings->getToolTipsShowImageDim());

    d->showPhotoMakeBox->setChecked(settings->getToolTipsShowPhotoMake());
    d->showPhotoDateBox->setChecked(settings->getToolTipsShowPhotoDate());
    d->showPhotoFocalBox->setChecked(settings->getToolTipsShowPhotoFocal());
    d->showPhotoExpoBox->setChecked(settings->getToolTipsShowPhotoExpo());
    d->showPhotoModeBox->setChecked(settings->getToolTipsShowPhotoMode());
    d->showPhotoFlashBox->setChecked(settings->getToolTipsShowPhotoFlash());
    d->showPhotoWbBox->setChecked(settings->getToolTipsShowPhotoWB());

    d->showAlbumNameBox->setChecked(settings->getToolTipsShowAlbumName());
    d->showCommentsBox->setChecked(settings->getToolTipsShowComments());
    d->showTagsBox->setChecked(settings->getToolTipsShowTags());
    d->showRatingBox->setChecked(settings->getToolTipsShowRating());

    d->fileSettingBox->setEnabled(d->showToolTipsBox->isChecked());
    d->photoSettingBox->setEnabled(d->showToolTipsBox->isChecked());
    d->digikamSettingBox->setEnabled(d->showToolTipsBox->isChecked());
}

}  // namespace Digikam