summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/batchprocessimages/filteroptionsdialog.cpp
blob: 1925ffeb09147726cd987989734854e652142ef0 (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
/* ============================================================
 *
 * This file is a part of kipi-plugins project
 * http://www.kipi-plugins.org
 *
 * Date        : 2004-10-01
 * Description : a kipi plugin to batch process images
 *
 * 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.
 *
 * ============================================================ */

// Include files for TQt

#include <tqvbox.h>
#include <tqlayout.h>
#include <tqwidget.h>
#include <tqwhatsthis.h>
#include <tqlabel.h>
#include <tqpushbutton.h>
#include <tqgroupbox.h>
#include <tqcombobox.h>
#include <tqcolor.h>

// Include files for KDE

#include <tdelocale.h>
#include <knuminput.h>
#include <kcolorbutton.h>

// Local includes

#include "filteroptionsdialog.h"
#include "filteroptionsdialog.moc"

namespace KIPIBatchProcessImagesPlugin
{

FilterOptionsDialog::FilterOptionsDialog(TQWidget *parent, int FilterType)
                        : KDialogBase( parent, "FilterOptionsDialog", true,
                          i18n("Filter Options"), Ok|Cancel, Ok, false)
{
    TQWidget* box = new TQWidget( this );
    setMainWidget(box);
    TQVBoxLayout *dvlay = new TQVBoxLayout( box, 10, spacingHint() );
    TQString whatsThis;

    if (FilterType == 0) // Add noise
       {
       TQLabel *m_label_noiseType = new TQLabel (i18n("Noise algorithm:"), box);
       dvlay->addWidget( m_label_noiseType );
       m_noiseType = new TQComboBox( false, box );
       m_noiseType->insertItem(i18n("Uniform"));
       m_noiseType->insertItem(i18n("Gaussian"));
       m_noiseType->insertItem(i18n("Multiplicative"));
       m_noiseType->insertItem(i18n("Impulse"));
       m_noiseType->insertItem(i18n("Laplacian"));
       m_noiseType->insertItem(i18n("Poisson"));
       TQWhatsThis::add( m_noiseType, i18n("<p>Select here the algorithm method which will used "
                                          "to add random noise to the images.") );
       m_label_noiseType->setBuddy( m_noiseType );
       dvlay->addWidget( m_noiseType );
       }

    if (FilterType == 2) // Blur
       {
       TQLabel *m_label_blurRadius = new TQLabel (i18n("Radius:"), box);
       dvlay->addWidget( m_label_blurRadius );
       m_blurRadius = new KIntNumInput(3, box);
       m_blurRadius->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_blurRadius, i18n("<p>Select here the blur radius of the Gaussian, in pixels, "
                                           "not counting the center pixel. For reasonable results, the "
                                           "radius should be larger than deviation. If you use a radius of 0 "
                                           "the blur operations selects a suitable radius.") );
       m_label_blurRadius->setBuddy( m_blurRadius );
       dvlay->addWidget( m_blurRadius );

       TQLabel *m_label_blurDeviation = new TQLabel (i18n("Deviation:"), box);
       dvlay->addWidget( m_label_blurDeviation );
       m_blurDeviation = new KIntNumInput(1, box);
       m_blurDeviation->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_blurDeviation, i18n("<p>Select here the standard deviation of the blur Gaussian, "
                                              "in pixels.") );
       m_label_blurDeviation->setBuddy( m_blurDeviation );
       dvlay->addWidget( m_blurDeviation );
       }

    if (FilterType == 5) // Median
       {
       TQLabel *m_label_medianRadius = new TQLabel (i18n("Radius:"), box);
       dvlay->addWidget( m_label_medianRadius );
       m_medianRadius = new KIntNumInput(3, box);
       m_medianRadius->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_medianRadius, i18n("<p>Select here the median radius of the pixel neighborhood. "
                                             "The algorithm applies a digital filter that improves the quality "
                                             "of noisy images. Each pixel is replaced by the median in a "
                                             "set of neighboring pixels as defined by the radius.") );
       m_label_medianRadius->setBuddy( m_medianRadius );
       dvlay->addWidget( m_medianRadius );
       }


    if (FilterType == 6) // Noise reduction
       {
       TQLabel *m_label_noiseRadius = new TQLabel (i18n("Radius:"), box);
       dvlay->addWidget( m_label_noiseRadius );
       m_noiseRadius = new KIntNumInput(3, box);
       m_noiseRadius->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_noiseRadius, i18n("<p>Select here the noise reduction radius value, in pixels. "
                                            "The algorithm smooths the contours of an image while still "
                                            "preserving edge information. The algorithm works by replacing "
                                            "each pixel with its neighbor closest in value. A neighbor is "
                                            "defined by the radius. If you use a radius of 0 the algorithm "
                                            "selects a suitable radius.") );
       m_label_noiseRadius->setBuddy( m_noiseRadius );
       dvlay->addWidget( m_noiseRadius );
       }

    if (FilterType == 7) // Sharpen
       {
       TQLabel *m_label_sharpenRadius = new TQLabel (i18n("Radius:"), box);
       dvlay->addWidget( m_label_sharpenRadius );
       m_sharpenRadius = new KIntNumInput(3, box);
       m_sharpenRadius->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_sharpenRadius, i18n("<p>Select here the radius of the sharpen Gaussian, in "
                                              "pixels, not counting the center pixel. For reasonable "
                                              "results, the radius should be larger than deviation. "
                                              "if you use a radius of 0 the sharpen operation selects a "
                                              "suitable radius.") );
       m_label_sharpenRadius->setBuddy( m_sharpenRadius );
       dvlay->addWidget( m_sharpenRadius );

       TQLabel *m_label_sharpenDeviation = new TQLabel (i18n("Deviation:"), box);
       dvlay->addWidget( m_label_sharpenDeviation );
       m_sharpenDeviation = new KIntNumInput(1, box);
       m_sharpenDeviation->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_sharpenDeviation, i18n("<p>Select here the sharpen deviation value of the "
                                                 "Laplacian in pixels.") );
       m_label_sharpenDeviation->setBuddy( m_sharpenDeviation );
       dvlay->addWidget( m_sharpenDeviation );
       }

    if (FilterType == 8) // Unsharp
       {
       TQLabel *m_label_unsharpenRadius = new TQLabel (i18n("Radius:"), box);
       dvlay->addWidget( m_label_unsharpenRadius );
       m_unsharpenRadius = new KIntNumInput(3, box);
       m_unsharpenRadius->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_unsharpenRadius, i18n("<p>Select here the radius of the unsharpen Gaussian, "
                                                "in pixels, not counting the center pixel. The algorithm "
                                                "convolve the image with a Gaussian operator of the given "
                                                "radius and standard deviation. For reasonable results, "
                                                "radius should be larger than sigma. If you use a radius of 0 "
                                                "the algorithm selects a suitable radius.") );
       m_label_unsharpenRadius->setBuddy( m_unsharpenRadius );
       dvlay->addWidget( m_unsharpenRadius );

       TQLabel *m_label_unsharpenDeviation = new TQLabel (i18n("Deviation:"), box);
       dvlay->addWidget( m_label_unsharpenDeviation );
       m_unsharpenDeviation = new KIntNumInput(1, box);
       m_unsharpenDeviation->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_unsharpenDeviation, i18n("<p>Select here the unsharpen deviation value of the "
                                                   "Gaussian, in pixels.") );
       m_label_unsharpenDeviation->setBuddy( m_unsharpenDeviation );
       dvlay->addWidget( m_unsharpenDeviation );

       TQLabel *m_label_unsharpenPercent = new TQLabel (i18n("Percent:"), box);
       dvlay->addWidget( m_label_unsharpenPercent );
       m_unsharpenPercent = new KIntNumInput(3, box);
       m_unsharpenPercent->setRange(1, 100, 1, true );
       TQWhatsThis::add( m_unsharpenPercent, i18n("<p>Select here the percentage difference between original "
                                                 "and blurred image which should be added to original.") );
       m_label_unsharpenPercent->setBuddy( m_unsharpenPercent );
       dvlay->addWidget( m_unsharpenPercent );

       TQLabel *m_label_unsharpenThreshold = new TQLabel (i18n("Threshold:"), box);
       dvlay->addWidget( m_label_unsharpenThreshold );
       m_unsharpenThreshold = new KIntNumInput(1, box);
       m_unsharpenThreshold->setRange(0, 20, 1, true );
       TQWhatsThis::add( m_unsharpenThreshold, i18n("<p>Select here the unsharpen threshold value, in "
                                                   "pixels, needed to apply the diffence amount."));
       m_label_unsharpenThreshold->setBuddy( m_unsharpenThreshold );
       dvlay->addWidget( m_unsharpenThreshold );
       }
}

FilterOptionsDialog::~FilterOptionsDialog()
{
}

}  // NameSpace KIPIBatchProcessImagesPlugin