summaryrefslogtreecommitdiffstats
path: root/src/showfoto/setup/setuptooltip.cpp
blob: d3a086780928ff976a3a3197b7b50d8c10ad38b7 (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
/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 *
 * Date        : 2006-07-09
 * Description : tool tip contents 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 <tdelocale.h>
#include <kdialogbase.h>
#include <tdeapplication.h>
#include <tdeconfig.h>

// Local includes.

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

namespace ShowFoto
{

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;

        fileSettingBox    = 0;
        photoSettingBox   = 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;

    TQVGroupBox *fileSettingBox;
    TQVGroupBox *photoSettingBox;
};

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

    d->showToolTipsBox = new TQCheckBox(i18n("Show Thumbbar items toolti&ps"), parent);
    TQWhatsThis::add( d->showToolTipsBox, i18n("<p>Set this option to display image information when "
                                              "the mouse hovers over a thumbbar 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 length"), 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);
    layout->addStretch();

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

    connect(d->showToolTipsBox, TQ_SIGNAL(toggled(bool)),
            d->fileSettingBox, TQ_SLOT(setEnabled(bool)));

    connect(d->showToolTipsBox, TQ_SIGNAL(toggled(bool)),
            d->photoSettingBox, TQ_SLOT(setEnabled(bool)));

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

    readSettings();
    adjustSize();
}

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

void SetupToolTip::readSettings()
{
    TDEConfig* config = kapp->config();
    config->setGroup("ImageViewer Settings");

    d->showToolTipsBox->setChecked(config->readBoolEntry("Show ToolTips", true));

    d->showFileNameBox->setChecked(config->readBoolEntry("ToolTips Show File Name", true));
    d->showFileDateBox->setChecked(config->readBoolEntry("ToolTips Show File Date", false));
    d->showFileSizeBox->setChecked(config->readBoolEntry("ToolTips Show File Size", false));
    d->showImageTypeBox->setChecked(config->readBoolEntry("ToolTips Show Image Type", false));
    d->showImageDimBox->setChecked(config->readBoolEntry("ToolTips Show Image Dim", true));

    d->showPhotoMakeBox->setChecked(config->readBoolEntry("ToolTips Show Photo Make", true));
    d->showPhotoDateBox->setChecked(config->readBoolEntry("ToolTips Show Photo Date", true));
    d->showPhotoFocalBox->setChecked(config->readBoolEntry("ToolTips Show Photo Focal", true));
    d->showPhotoExpoBox->setChecked(config->readBoolEntry("ToolTips Show Photo Expo", true));
    d->showPhotoModeBox->setChecked(config->readBoolEntry("ToolTips Show Photo Mode", true));
    d->showPhotoFlashBox->setChecked(config->readBoolEntry("ToolTips Show Photo Flash", false));
    d->showPhotoWbBox->setChecked(config->readBoolEntry("ToolTips Show Photo WB", false));

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

void SetupToolTip::applySettings()
{
    TDEConfig* config = kapp->config();
    config->setGroup("ImageViewer Settings");

    config->writeEntry("Show ToolTips", d->showToolTipsBox->isChecked());

    config->writeEntry("ToolTips Show File Name", d->showFileNameBox->isChecked());
    config->writeEntry("ToolTips Show File Date", d->showFileDateBox->isChecked());
    config->writeEntry("ToolTips Show File Size", d->showFileSizeBox->isChecked());
    config->writeEntry("ToolTips Show Image Type", d->showImageTypeBox->isChecked());
    config->writeEntry("ToolTips Show Image Dim", d->showImageDimBox->isChecked());

    config->writeEntry("ToolTips Show Photo Make", d->showPhotoMakeBox->isChecked());
    config->writeEntry("ToolTips Show Photo Date", d->showPhotoDateBox->isChecked());
    config->writeEntry("ToolTips Show Photo Focal", d->showPhotoFocalBox->isChecked());
    config->writeEntry("ToolTips Show Photo Expo", d->showPhotoExpoBox->isChecked());
    config->writeEntry("ToolTips Show Photo Mode", d->showPhotoModeBox->isChecked());
    config->writeEntry("ToolTips Show Photo Flash", d->showPhotoFlashBox->isChecked());
    config->writeEntry("ToolTips Show Photo WB", d->showPhotoWbBox->isChecked());

    config->sync();
}

}  // namespace ShowFoto