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
273
274
275
276
277
278
279
280
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2003-05-03
* Description : mime types setup tab
*
* Copyright (C) 2004-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 <tqhbox.h>
#include <tqhgroupbox.h>
#include <tqgroupbox.h>
#include <tqlabel.h>
#include <tqlineedit.h>
#include <tqwhatsthis.h>
#include <tqtoolbutton.h>
#include <tqtooltip.h>
// KDE includes.
#include <tdelocale.h>
#include <kdialog.h>
#include <klineeditdlg.h>
#include <kiconloader.h>
// Local includes.
#include "albumsettings.h"
#include "setupmime.h"
#include "setupmime.moc"
namespace Digikam
{
class SetupMimePriv
{
public:
SetupMimePriv()
{
imageFileFilterEdit = 0;
movieFileFilterEdit = 0;
audioFileFilterEdit = 0;
rawFileFilterEdit = 0;
revertImageFileFilterBtn = 0;
revertMovieFileFilterBtn = 0;
revertAudioFileFilterBtn = 0;
revertRawFileFilterBtn = 0;
}
TQToolButton *revertImageFileFilterBtn;
TQToolButton *revertMovieFileFilterBtn;
TQToolButton *revertAudioFileFilterBtn;
TQToolButton *revertRawFileFilterBtn;
TQLineEdit *imageFileFilterEdit;
TQLineEdit *movieFileFilterEdit;
TQLineEdit *audioFileFilterEdit;
TQLineEdit *rawFileFilterEdit;
};
SetupMime::SetupMime(TQWidget* parent )
: TQWidget(parent)
{
d = new SetupMimePriv;
TQVBoxLayout *layout = new TQVBoxLayout(parent, 0, KDialog::spacingHint());
// --------------------------------------------------------
TQGroupBox *imageFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("Image Files"), parent);
TQGridLayout* grid1 = new TQGridLayout(imageFileFilterBox->layout(), 1, 1, KDialog::spacingHint());
TQLabel *logoLabel1 = new TQLabel(imageFileFilterBox);
logoLabel1->setPixmap(DesktopIcon("image-x-generic"));
TQLabel *imageFileFilterLabel = new TQLabel(imageFileFilterBox);
imageFileFilterLabel->setText(i18n("Show only &image files with extensions:"));
TQHBox *hbox1 = new TQHBox(imageFileFilterBox);
d->imageFileFilterEdit = new TQLineEdit(hbox1);
TQWhatsThis::add( d->imageFileFilterEdit, i18n("<p>Here you can set the extensions of image files "
"to be displayed in Albums (such as JPEG or TIFF); "
"clicking on these files will "
"open them in the digiKam Image Editor."));
imageFileFilterLabel->setBuddy(d->imageFileFilterEdit);
hbox1->setStretchFactor(d->imageFileFilterEdit, 10);
d->revertImageFileFilterBtn = new TQToolButton(hbox1);
d->revertImageFileFilterBtn->setIconSet(SmallIcon("reload_page"));
TQToolTip::add(d->revertImageFileFilterBtn, i18n("Revert to default settings"));
grid1->addMultiCellWidget(logoLabel1, 0, 1, 0, 0);
grid1->addMultiCellWidget(imageFileFilterLabel, 0, 0, 1, 1);
grid1->addMultiCellWidget(hbox1, 1, 1, 1, 1);
grid1->setColStretch(1, 10);
layout->addWidget(imageFileFilterBox);
// --------------------------------------------------------
TQGroupBox *movieFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("Movie Files"), parent);
TQGridLayout* grid2 = new TQGridLayout(movieFileFilterBox->layout(), 1, 1, KDialog::spacingHint());
TQLabel *logoLabel2 = new TQLabel(movieFileFilterBox);
logoLabel2->setPixmap(DesktopIcon("video-x-generic"));
TQLabel *movieFileFilterLabel = new TQLabel(movieFileFilterBox);
movieFileFilterLabel->setText(i18n("Show only &movie files with extensions:"));
TQHBox *hbox2 = new TQHBox(movieFileFilterBox);
d->movieFileFilterEdit = new TQLineEdit(hbox2);
TQWhatsThis::add( d->movieFileFilterEdit, i18n("<p>Here you can set the extensions of movie files "
"to be displayed in Albums (such as MPEG or AVI); "
"clicking on these files will "
"open them with the default TDE movie player."));
movieFileFilterLabel->setBuddy(d->movieFileFilterEdit);
hbox2->setStretchFactor(d->movieFileFilterEdit, 10);
d->revertMovieFileFilterBtn = new TQToolButton(hbox2);
d->revertMovieFileFilterBtn->setIconSet(SmallIcon("reload_page"));
TQToolTip::add(d->revertMovieFileFilterBtn, i18n("Revert to default settings"));
grid2->addMultiCellWidget(logoLabel2, 0, 1, 0, 0);
grid2->addMultiCellWidget(movieFileFilterLabel, 0, 0, 1, 1);
grid2->addMultiCellWidget(hbox2, 1, 1, 1, 1);
grid2->setColStretch(1, 10);
layout->addWidget(movieFileFilterBox);
// --------------------------------------------------------
TQGroupBox *audioFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("Audio Files"), parent);
TQGridLayout* grid3 = new TQGridLayout(audioFileFilterBox->layout(), 1, 1, KDialog::spacingHint());
TQLabel *logoLabel3 = new TQLabel(audioFileFilterBox);
logoLabel3->setPixmap(DesktopIcon("audio-x-generic"));
TQLabel *audioFileFilterLabel = new TQLabel(audioFileFilterBox);
audioFileFilterLabel->setText(i18n("Show only &audio files with extensions:"));
TQHBox *hbox3 = new TQHBox(audioFileFilterBox);
d->audioFileFilterEdit = new TQLineEdit(hbox3);
TQWhatsThis::add( d->audioFileFilterEdit, i18n("<p>Here you can set the extensions of audio files "
"to be displayed in Albums (such as MP3 or OGG); "
"clicking on these files will "
"open them with the default TDE audio player."));
audioFileFilterLabel->setBuddy(d->audioFileFilterEdit);
hbox3->setStretchFactor(d->audioFileFilterEdit, 10);
d->revertAudioFileFilterBtn = new TQToolButton(hbox3);
d->revertAudioFileFilterBtn->setIconSet(SmallIcon("reload_page"));
TQToolTip::add(d->revertAudioFileFilterBtn, i18n("Revert to default settings"));
grid3->addMultiCellWidget(logoLabel3, 0, 1, 0, 0);
grid3->addMultiCellWidget(audioFileFilterLabel, 0, 0, 1, 1);
grid3->addMultiCellWidget(hbox3, 1, 1, 1, 1);
grid3->setColStretch(1, 10);
layout->addWidget(audioFileFilterBox);
// --------------------------------------------------------
TQGroupBox *rawFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("RAW Files"), parent);
TQGridLayout* grid4 = new TQGridLayout(rawFileFilterBox->layout(), 1, 1, KDialog::spacingHint());
TQLabel *logoLabel4 = new TQLabel(rawFileFilterBox);
logoLabel4->setPixmap(DesktopIcon("kdcraw"));
TQLabel *rawFileFilterLabel = new TQLabel(rawFileFilterBox);
rawFileFilterLabel->setText(i18n("Show only &RAW files with extensions:"));
TQHBox *hbox4 = new TQHBox(rawFileFilterBox);
d->rawFileFilterEdit = new TQLineEdit(hbox4);
TQWhatsThis::add( d->rawFileFilterEdit, i18n("<p>Here you can set the extensions of RAW image files "
"to be displayed in Albums (such as CRW, for Canon cameras, "
"or NEF, for Nikon cameras)."));
rawFileFilterLabel->setBuddy(d->rawFileFilterEdit);
hbox4->setStretchFactor(d->rawFileFilterEdit, 10);
d->revertRawFileFilterBtn = new TQToolButton(hbox4);
d->revertRawFileFilterBtn->setIconSet(SmallIcon("reload_page"));
TQToolTip::add(d->revertRawFileFilterBtn, i18n("Revert to default settings"));
grid4->addMultiCellWidget(logoLabel4, 0, 1, 0, 0);
grid4->addMultiCellWidget(rawFileFilterLabel, 0, 0, 1, 1);
grid4->addMultiCellWidget(hbox4, 1, 1, 1, 1);
grid4->setColStretch(1, 10);
layout->addWidget(rawFileFilterBox);
layout->addStretch();
// --------------------------------------------------------
connect(d->revertImageFileFilterBtn, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotRevertImageFileFilter()));
connect(d->revertMovieFileFilterBtn, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotRevertMovieFileFilter()));
connect(d->revertAudioFileFilterBtn, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotRevertAudioFileFilter()));
connect(d->revertRawFileFilterBtn, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotRevertRawFileFilter()));
// --------------------------------------------------------
readSettings();
}
SetupMime::~SetupMime()
{
delete d;
}
void SetupMime::applySettings()
{
AlbumSettings* settings = AlbumSettings::instance();
if (!settings) return;
settings->setImageFileFilter(d->imageFileFilterEdit->text());
settings->setMovieFileFilter(d->movieFileFilterEdit->text());
settings->setAudioFileFilter(d->audioFileFilterEdit->text());
settings->setRawFileFilter(d->rawFileFilterEdit->text());
settings->saveSettings();
}
void SetupMime::readSettings()
{
AlbumSettings* settings = AlbumSettings::instance();
if (!settings) return;
d->imageFileFilterEdit->setText(settings->getImageFileFilter());
d->movieFileFilterEdit->setText(settings->getMovieFileFilter());
d->audioFileFilterEdit->setText(settings->getAudioFileFilter());
d->rawFileFilterEdit->setText(settings->getRawFileFilter());
}
void SetupMime::slotRevertImageFileFilter()
{
d->imageFileFilterEdit->setText(AlbumSettings::instance()->getDefaultImageFileFilter());
}
void SetupMime::slotRevertMovieFileFilter()
{
d->movieFileFilterEdit->setText(AlbumSettings::instance()->getDefaultMovieFileFilter());
}
void SetupMime::slotRevertAudioFileFilter()
{
d->audioFileFilterEdit->setText(AlbumSettings::instance()->getDefaultAudioFileFilter());
}
void SetupMime::slotRevertRawFileFilter()
{
d->rawFileFilterEdit->setText(AlbumSettings::instance()->getDefaultRawFileFilter());
}
} // namespace Digikam
|