summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/batchprocessimages/borderoptionsdialog.cpp
blob: 70dcfbdbd42ebf3d3e36d9b60db03c983d62cf66 (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
/* ============================================================
 *
 * 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 <tqstring.h>
#include <tqcombobox.h>
#include <tqcolor.h>

// Include files for KDE

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

// Local includes

#include "borderoptionsdialog.h"
#include "borderoptionsdialog.moc"

namespace KIPIBatchProcessImagesPlugin
{

BorderOptionsDialog::BorderOptionsDialog(TQWidget *tqparent, int BorderType)
                        : KDialogBase( tqparent, "BorderOptionsDialog", true,
                          i18n("Border Options"), Ok|Cancel, Ok, false)
{
    TQWidget* box = new TQWidget( this );
    setMainWidget(box);
    TQVBoxLayout *dvlay = new TQVBoxLayout( box, 10, spacingHint() );
    TQString whatsThis;

    if (BorderType == 0) // Solid
       {
       TQLabel *m_label_solidBorderWidth = new TQLabel (i18n("Border width:"), box);
       dvlay->addWidget( m_label_solidBorderWidth );
       m_solidBorderWidth = new KIntNumInput(25, box);
       m_solidBorderWidth->setRange(1, 1000, 1, true );
       TQWhatsThis::add( m_solidBorderWidth, i18n("<p>Select here the border width in pixels.") );
       m_label_solidBorderWidth->setBuddy( m_solidBorderWidth );
       dvlay->addWidget( m_solidBorderWidth );

       TQLabel *m_label_solidColor = new TQLabel(i18n("Border color:"), box);
       dvlay->addWidget( m_label_solidColor );
       TQColor solidBorderColor = TQColor( 0, 0, 0 );                         // Black per default.
       m_button_solidBorderColor = new KColorButton( solidBorderColor, box );
       TQWhatsThis::add( m_button_solidBorderColor, i18n( "<p>You can select here the border color." ));
       dvlay->addWidget( m_button_solidBorderColor );
       }

    if (BorderType == 1) // Niepce
       {
       TQLabel *m_label_lineNiepceBorderWidth = new TQLabel (i18n("Line border width:"), box);
       dvlay->addWidget( m_label_lineNiepceBorderWidth );
       m_lineNiepceBorderWidth = new KIntNumInput(10, box);
       m_lineNiepceBorderWidth->setRange(1, 500, 1, true );
       TQWhatsThis::add( m_lineNiepceBorderWidth, i18n("<p>Select here the line border width in pixels.") );
       m_label_lineNiepceBorderWidth->setBuddy( m_lineNiepceBorderWidth );
       dvlay->addWidget( m_lineNiepceBorderWidth );

       TQLabel *m_label_lineNiepceColor = new TQLabel(i18n("Line border color:"), box);
       dvlay->addWidget( m_label_lineNiepceColor );
       TQColor lineNiepceBorderColor = TQColor( 0, 0, 0 );                         // Black per default.
       m_button_lineNiepceBorderColor = new KColorButton( lineNiepceBorderColor, box );
       TQWhatsThis::add( m_button_lineNiepceBorderColor, i18n( "<p>You can select here the line border color." ));
       dvlay->addWidget( m_button_lineNiepceBorderColor );

       TQLabel *m_label_NiepceBorderWidth = new TQLabel (i18n("Border width:"), box);
       dvlay->addWidget( m_label_NiepceBorderWidth );
       m_NiepceBorderWidth = new KIntNumInput(100, box);
       m_NiepceBorderWidth->setRange(1, 500, 1, true );
       TQWhatsThis::add( m_NiepceBorderWidth, i18n("<p>Select here the border width in pixels.") );
       m_label_NiepceBorderWidth->setBuddy( m_NiepceBorderWidth );
       dvlay->addWidget( m_NiepceBorderWidth );

       TQLabel *m_label_NiepceColor = new TQLabel(i18n("Border color:"), box);
       dvlay->addWidget( m_label_NiepceColor );
       TQColor NiepceBorderColor = TQColor( 255, 255, 255 );                         // White per default.
       m_button_NiepceBorderColor = new KColorButton( NiepceBorderColor, box );
       TQWhatsThis::add( m_button_NiepceBorderColor, i18n( "<p>You can select here the border color." ));
       dvlay->addWidget( m_button_NiepceBorderColor );
       }

    if (BorderType == 2) // Raise
       {
       TQLabel *m_label_raiseBorderWidth = new TQLabel (i18n("Border width:"), box);
       dvlay->addWidget( m_label_raiseBorderWidth );
       m_raiseBorderWidth = new KIntNumInput(50, box);
       m_raiseBorderWidth->setRange(1, 500, 1, true );
       TQWhatsThis::add( m_raiseBorderWidth, i18n("<p>Select here the border width in pixels.") );
       m_label_raiseBorderWidth->setBuddy( m_raiseBorderWidth );
       dvlay->addWidget( m_raiseBorderWidth );
       }

    if (BorderType == 3) // Frame
       {
       TQLabel *m_label_frameBorderWidth = new TQLabel (i18n("Border width:"), box);
       dvlay->addWidget( m_label_frameBorderWidth );
       m_frameBorderWidth = new KIntNumInput(25, box);
       m_frameBorderWidth->setRange(0, 500, 1, true );
       TQWhatsThis::add( m_frameBorderWidth, i18n("<p>Select here the border width in pixels.") );
       m_label_frameBorderWidth->setBuddy( m_frameBorderWidth );
       dvlay->addWidget( m_frameBorderWidth );

       TQLabel *m_label_frameBevelBorderWidth = new TQLabel (i18n("Bevel width:"), box);
       dvlay->addWidget( m_label_frameBevelBorderWidth );
       m_frameBevelBorderWidth = new KIntNumInput(10, box);
       m_frameBevelBorderWidth->setRange(0, 250, 1, true );
       TQWhatsThis::add( m_frameBevelBorderWidth, i18n("<p>Select here the bevel width in pixels. "
                                                      "This value must be <= Border width / 2") );
       m_label_frameBevelBorderWidth->setBuddy( m_frameBevelBorderWidth );
       dvlay->addWidget( m_frameBevelBorderWidth );

       TQLabel *m_label_frameColor = new TQLabel(i18n("Border color:"), box);
       dvlay->addWidget( m_label_frameColor );
       TQColor frameBorderColor = TQColor( 0, 0, 0 );                         // Black per default.
       m_button_frameBorderColor = new KColorButton( frameBorderColor, box );
       TQWhatsThis::add( m_button_frameBorderColor, i18n( "<p>You can select here the border color." ));
       dvlay->addWidget( m_button_frameBorderColor );

       connect(m_frameBorderWidth, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotFrameBorderWidthChanged(int)));
       }
}

BorderOptionsDialog::~BorderOptionsDialog()
{
}

void BorderOptionsDialog::slotFrameBorderWidthChanged (int value)
{
   m_frameBevelBorderWidth->setMaxValue((int)(value / 2));
}

}  // NameSpace KIPIBatchProcessImagesPlugin