author | tille <tille> | 2003-05-25 12:33:50 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-25 12:33:50 (UTC) |
commit | 675680dcb43767447d5b678eb6b7b3aee453cb1d (patch) (unidiff) | |
tree | 4f8af79474d0bb3876725018b21008c8b3d5242b | |
parent | f6d835c4846f48d33f0ba9e86707c4ec23544182 (diff) | |
download | opie-675680dcb43767447d5b678eb6b7b3aee453cb1d.zip opie-675680dcb43767447d5b678eb6b7b3aee453cb1d.tar.gz opie-675680dcb43767447d5b678eb6b7b3aee453cb1d.tar.bz2 |
knuminput gone too
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 55 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.h | 26 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/knuminput.cpp | 1103 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/knuminput.h | 947 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/knumvalidator.cpp | 376 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/knumvalidator.h | 211 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/ppp.pro | 6 |
7 files changed, 52 insertions, 2672 deletions
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index a02ee35..98e035b 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -26,11 +26,18 @@ | |||
26 | 26 | ||
27 | #include <termios.h> | 27 | #include <termios.h> |
28 | #include <string.h> | 28 | #include <string.h> |
29 | #include <qwhatsthis.h> | ||
30 | 29 | ||
31 | #include "knuminput.h" | 30 | #include <qcheckbox.h> |
32 | #include <qslider.h> | 31 | #include <qcombobox.h> |
32 | #include <qlabel.h> | ||
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qpushbutton.h> | ||
35 | #include <qslider.h> | ||
36 | #include <qspinbox.h> | ||
37 | #include <qwhatsthis.h> | ||
38 | |||
39 | // #include <qgroupbox.h> | ||
40 | |||
34 | #include "general.h" | 41 | #include "general.h" |
35 | //#include "version.h" | 42 | //#include "version.h" |
36 | //#include "miniterm.h" | 43 | //#include "miniterm.h" |
@@ -50,6 +57,7 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
50 | 57 | ||
51 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); | 58 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); |
52 | 59 | ||
60 | QLabel *label1; | ||
53 | label1 = new QLabel(i18n("Modem de&vice:"), this); | 61 | label1 = new QLabel(i18n("Modem de&vice:"), this); |
54 | tl->addWidget(label1, 0, 0); | 62 | tl->addWidget(label1, 0, 0); |
55 | 63 | ||
@@ -74,11 +82,11 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
74 | QWhatsThis::add(modemdevice,tmp); | 82 | QWhatsThis::add(modemdevice,tmp); |
75 | 83 | ||
76 | 84 | ||
77 | label2 = new QLabel(i18n("&Flow control:"), this); | 85 | label1 = new QLabel(i18n("&Flow control:"), this); |
78 | tl->addWidget(label2, 1, 0); | 86 | tl->addWidget(label1, 1, 0); |
79 | 87 | ||
80 | flowcontrol = new QComboBox(false, this); | 88 | flowcontrol = new QComboBox(false, this); |
81 | label2->setBuddy(flowcontrol); | 89 | label1->setBuddy(flowcontrol); |
82 | flowcontrol->insertItem(i18n("Hardware [CRTSCTS]")); | 90 | flowcontrol->insertItem(i18n("Hardware [CRTSCTS]")); |
83 | flowcontrol->insertItem(i18n("Software [XON/XOFF]")); | 91 | flowcontrol->insertItem(i18n("Software [XON/XOFF]")); |
84 | flowcontrol->insertItem(i18n("None")); | 92 | flowcontrol->insertItem(i18n("None")); |
@@ -92,10 +100,10 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
92 | "\n" | 100 | "\n" |
93 | "<b>Default</b>: CRTSCTS"); | 101 | "<b>Default</b>: CRTSCTS"); |
94 | 102 | ||
95 | QWhatsThis::add(label2,tmp); | 103 | QWhatsThis::add(label1,tmp); |
96 | QWhatsThis::add(flowcontrol,tmp); | 104 | QWhatsThis::add(flowcontrol,tmp); |
97 | 105 | ||
98 | labelenter = new QLabel(i18n("&Line termination:"), this); | 106 | QLabel *labelenter = new QLabel(i18n("&Line termination:"), this); |
99 | tl->addWidget(labelenter, 2, 0); | 107 | tl->addWidget(labelenter, 2, 0); |
100 | 108 | ||
101 | enter = new QComboBox(false, this); | 109 | enter = new QComboBox(false, this); |
@@ -116,7 +124,7 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
116 | QWhatsThis::add(labelenter,tmp); | 124 | QWhatsThis::add(labelenter,tmp); |
117 | QWhatsThis::add(enter, tmp); | 125 | QWhatsThis::add(enter, tmp); |
118 | 126 | ||
119 | baud_label = new QLabel(i18n("Co&nnection speed:"), this); | 127 | QLabel *baud_label = new QLabel(i18n("Co&nnection speed:"), this); |
120 | tl->addWidget(baud_label, 3, 0); | 128 | tl->addWidget(baud_label, 3, 0); |
121 | baud_c = new QComboBox(this); | 129 | baud_c = new QComboBox(this); |
122 | baud_label->setBuddy(baud_c); | 130 | baud_label->setBuddy(baud_c); |
@@ -190,14 +198,18 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
190 | "<b>Default</b>: On")); | 198 | "<b>Default</b>: On")); |
191 | 199 | ||
192 | // Modem Timeout Line Edit Box | 200 | // Modem Timeout Line Edit Box |
193 | 201 | QHBoxLayout *timeoutLayout = new QHBoxLayout( this ); | |
194 | modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this); | 202 | QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); |
195 | modemtimeout->setLabel(i18n("Modem &timeout:")); | 203 | modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); |
196 | modemtimeout->setRange(1, 120, 1); | 204 | // modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this); |
205 | // modemtimeout->setLabel(i18n("Modem &timeout:")); | ||
206 | // modemtimeout->setRange(1, 120, 1); | ||
197 | modemtimeout->setSuffix(i18n(" sec")); | 207 | modemtimeout->setSuffix(i18n(" sec")); |
198 | connect(modemtimeout, SIGNAL(valueChanged(int)), | 208 | connect(modemtimeout, SIGNAL(valueChanged(int)), |
199 | SLOT(modemtimeoutchanged(int))); | 209 | SLOT(modemtimeoutchanged(int))); |
200 | tl->addMultiCellWidget(modemtimeout, 6, 6, 0, 1); | 210 | timeoutLayout->addWidget(timeoutlabel); |
211 | timeoutLayout->addWidget(modemtimeout); | ||
212 | tl->addMultiCellLayout(timeoutLayout, 6, 6, 0, 1); | ||
201 | 213 | ||
202 | QWhatsThis::add(modemtimeout, | 214 | QWhatsThis::add(modemtimeout, |
203 | i18n("This specifies how long <i>kppp</i> waits for a\n" | 215 | i18n("This specifies how long <i>kppp</i> waits for a\n" |
@@ -278,12 +290,17 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) | |||
278 | "\n" | 290 | "\n" |
279 | "<b>Default:</b>: On")); | 291 | "<b>Default:</b>: On")); |
280 | 292 | ||
281 | busywait = new KIntNumInput(PPPData::data()->busyWait(), this); | 293 | QHBoxLayout *waitLayout = new QHBoxLayout( this ); |
282 | busywait->setLabel(i18n("B&usy wait:")); | 294 | QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); |
283 | busywait->setRange(0, 300, 5, true); | 295 | busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); |
284 | busywait->setSuffix(i18n(" sec")); | 296 | // busywait = new KIntNumInput(PPPData::data()->busyWait(), this); |
297 | // busywait->setLabel(i18n("B&usy wait:")); | ||
298 | // busywait->setRange(0, 300, 5, true); | ||
299 | busywait->setSuffix(i18n(" sec")); | ||
285 | connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); | 300 | connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); |
286 | l1->addWidget(busywait); | 301 | waitLayout->addWidget(waitLabel); |
302 | waitLayout->addWidget(busywait); | ||
303 | l1->addLayout( waitLayout ); | ||
287 | 304 | ||
288 | QWhatsThis::add(busywait, | 305 | QWhatsThis::add(busywait, |
289 | i18n("Specifies the number of seconds to wait before\n" | 306 | i18n("Specifies the number of seconds to wait before\n" |
diff --git a/noncore/settings/networksettings/ppp/general.h b/noncore/settings/networksettings/ppp/general.h index 66a9eec..4869f6c 100644 --- a/noncore/settings/networksettings/ppp/general.h +++ b/noncore/settings/networksettings/ppp/general.h | |||
@@ -27,15 +27,13 @@ | |||
27 | #define _GENERAL_H_ | 27 | #define _GENERAL_H_ |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qcombobox.h> | ||
31 | #include <qlabel.h> | ||
32 | #include <qcheckbox.h> | ||
33 | #include <qgroupbox.h> | ||
34 | #include <qpushbutton.h> | ||
35 | //#include <kcolorbutton.h> | ||
36 | 30 | ||
37 | class QSlider; | 31 | class QSlider; |
38 | class KIntNumInput; | 32 | class QSpinBox; |
33 | class QCombobox; | ||
34 | class QLabel; | ||
35 | class QCheckBox; | ||
36 | class QComboBox; | ||
39 | 37 | ||
40 | 38 | ||
41 | 39 | ||
@@ -54,17 +52,17 @@ private slots: | |||
54 | 52 | ||
55 | private: | 53 | private: |
56 | QComboBox *enter; | 54 | QComboBox *enter; |
57 | QLabel *label1; | 55 | /* QLabel *label1; */ |
58 | QLabel *label2; | 56 | /* QLabel *label2; */ |
59 | QLabel *labeltmp; | 57 | /* QLabel *labeltmp; */ |
60 | QLabel *labelenter; | 58 | /* QLabel *labelenter; */ |
61 | QComboBox *modemdevice; | 59 | QComboBox *modemdevice; |
62 | QComboBox *flowcontrol; | 60 | QComboBox *flowcontrol; |
63 | 61 | ||
64 | QComboBox *baud_c; | 62 | QComboBox *baud_c; |
65 | QLabel *baud_label; | 63 | QLabel *baud_label; |
66 | 64 | ||
67 | KIntNumInput *modemtimeout; | 65 | QSpinBox *modemtimeout; |
68 | QCheckBox *modemlockfile; | 66 | QCheckBox *modemlockfile; |
69 | }; | 67 | }; |
70 | 68 | ||
@@ -88,9 +86,9 @@ private: | |||
88 | QPushButton *modemcmds; | 86 | QPushButton *modemcmds; |
89 | QPushButton *modeminfo_button; | 87 | QPushButton *modeminfo_button; |
90 | // QPushButton *terminal_button; | 88 | // QPushButton *terminal_button; |
91 | QFrame *fline; | 89 | // QFrame *fline; |
92 | QCheckBox *waitfordt; | 90 | QCheckBox *waitfordt; |
93 | KIntNumInput *busywait; | 91 | QSpinBox *busywait; |
94 | QCheckBox *chkbox1; | 92 | QCheckBox *chkbox1; |
95 | QSlider *volume; | 93 | QSlider *volume; |
96 | }; | 94 | }; |
diff --git a/noncore/settings/networksettings/ppp/knuminput.cpp b/noncore/settings/networksettings/ppp/knuminput.cpp deleted file mode 100644 index afaa581..0000000 --- a/noncore/settings/networksettings/ppp/knuminput.cpp +++ b/dev/null | |||
@@ -1,1103 +0,0 @@ | |||
1 | // -*- c-basic-offset: 4 -*- | ||
2 | /* | ||
3 | * knuminput.cpp | ||
4 | * | ||
5 | * Initial implementation: | ||
6 | * Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca> | ||
7 | * Rewritten and maintained by: | ||
8 | * Copyright (c) 2000 Dirk A. Mueller <mueller@kde.org> | ||
9 | * KDoubleSpinBox: | ||
10 | * Copyright (c) 2002 Marc Mutz <mutz@kde.org> | ||
11 | * | ||
12 | * Requires the Qt widget libraries, available at no cost at | ||
13 | * http://www.troll.no/ | ||
14 | * | ||
15 | * This library is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU Library General Public | ||
17 | * License as published by the Free Software Foundation; either | ||
18 | * version 2 of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This library is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
23 | * Library General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU Library General Public License | ||
26 | * along with this library; see the file COPYING.LIB. If not, write to | ||
27 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
28 | * Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
31 | //#include <config.h> | ||
32 | #ifdef HAVE_LIMITS_H | ||
33 | #include <limits.h> | ||
34 | #endif | ||
35 | #include <assert.h> | ||
36 | #include <math.h> | ||
37 | #include <algorithm> | ||
38 | |||
39 | #include <qlabel.h> | ||
40 | #include <qlineedit.h> | ||
41 | #include <qsize.h> | ||
42 | #include <qslider.h> | ||
43 | #include <qspinbox.h> | ||
44 | #include <qstyle.h> | ||
45 | |||
46 | //#include <kglobal.h> | ||
47 | |||
48 | template<class T> | ||
49 | inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; } | ||
50 | |||
51 | template<class T> | ||
52 | inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; } | ||
53 | |||
54 | //#include <klocale.h> | ||
55 | #define i18n QObject::tr | ||
56 | //#include <kdebug.h> | ||
57 | |||
58 | #include "knumvalidator.h" | ||
59 | #include "knuminput.h" | ||
60 | |||
61 | static inline int calcDiffByTen( int x, int y ) { | ||
62 | // calculate ( x - y ) / 10 without overflowing ints: | ||
63 | return ( x / 10 ) - ( y / 10 ) + ( x % 10 - y % 10 ) / 10; | ||
64 | }; | ||
65 | |||
66 | // ---------------------------------------------------------------------------- | ||
67 | |||
68 | KNumInput::KNumInput(QWidget* parent, const char* name) | ||
69 | : QWidget(parent, name) | ||
70 | { | ||
71 | init(); | ||
72 | } | ||
73 | |||
74 | KNumInput::KNumInput(KNumInput* below, QWidget* parent, const char* name) | ||
75 | : QWidget(parent, name) | ||
76 | { | ||
77 | init(); | ||
78 | |||
79 | if(below) { | ||
80 | m_next = below->m_next; | ||
81 | m_prev = below; | ||
82 | below->m_next = this; | ||
83 | if(m_next) | ||
84 | m_next->m_prev = this; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | void KNumInput::init() | ||
89 | { | ||
90 | m_prev = m_next = 0; | ||
91 | m_colw1 = m_colw2 = 0; | ||
92 | |||
93 | m_label = 0; | ||
94 | m_slider = 0; | ||
95 | m_alignment = 0; | ||
96 | } | ||
97 | |||
98 | KNumInput::~KNumInput() | ||
99 | { | ||
100 | if(m_prev) | ||
101 | m_prev->m_next = m_next; | ||
102 | |||
103 | if(m_next) | ||
104 | m_next->m_prev = m_prev; | ||
105 | } | ||
106 | |||
107 | void KNumInput::setLabel(const QString & label, int a) | ||
108 | { | ||
109 | if(label.isEmpty()) { | ||
110 | delete m_label; | ||
111 | m_label = 0; | ||
112 | m_alignment = 0; | ||
113 | } | ||
114 | else { | ||
115 | if (m_label) m_label->setText(label); | ||
116 | else m_label = new QLabel(label, this, "KNumInput::QLabel"); | ||
117 | m_label->setAlignment((a & (~(AlignTop|AlignBottom|AlignVCenter))) | ||
118 | | AlignVCenter); | ||
119 | // if no vertical alignment set, use Top alignment | ||
120 | if(!(a & (AlignTop|AlignBottom|AlignVCenter))) | ||
121 | a |= AlignTop; | ||
122 | m_alignment = a; | ||
123 | } | ||
124 | |||
125 | layout(true); | ||
126 | } | ||
127 | |||
128 | QString KNumInput::label() const | ||
129 | { | ||
130 | if (m_label) return m_label->text(); | ||
131 | return QString::null; | ||
132 | } | ||
133 | |||
134 | void KNumInput::layout(bool deep) | ||
135 | { | ||
136 | int w1 = m_colw1; | ||
137 | int w2 = m_colw2; | ||
138 | |||
139 | // label sizeHint | ||
140 | m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0)); | ||
141 | |||
142 | if(m_label && (m_alignment & AlignVCenter)) | ||
143 | m_colw1 = m_sizeLabel.width() + 4; | ||
144 | else | ||
145 | m_colw1 = 0; | ||
146 | |||
147 | // slider sizeHint | ||
148 | m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0)); | ||
149 | |||
150 | doLayout(); | ||
151 | |||
152 | if(!deep) { | ||
153 | m_colw1 = w1; | ||
154 | m_colw2 = w2; | ||
155 | return; | ||
156 | } | ||
157 | |||
158 | KNumInput* p = this; | ||
159 | while(p) { | ||
160 | p->doLayout(); | ||
161 | w1 = QMAX(w1, p->m_colw1); | ||
162 | w2 = QMAX(w2, p->m_colw2); | ||
163 | p = p->m_prev; | ||
164 | } | ||
165 | |||
166 | p = m_next; | ||
167 | while(p) { | ||
168 | p->doLayout(); | ||
169 | w1 = QMAX(w1, p->m_colw1); | ||
170 | w2 = QMAX(w2, p->m_colw2); | ||
171 | p = p->m_next; | ||
172 | } | ||
173 | |||
174 | p = this; | ||
175 | while(p) { | ||
176 | p->m_colw1 = w1; | ||
177 | p->m_colw2 = w2; | ||
178 | p = p->m_prev; | ||
179 | } | ||
180 | |||
181 | p = m_next; | ||
182 | while(p) { | ||
183 | p->m_colw1 = w1; | ||
184 | p->m_colw2 = w2; | ||
185 | p = p->m_next; | ||
186 | } | ||
187 | |||
188 | // kdDebug() << "w1 " << w1 << " w2 " << w2 << endl; | ||
189 | } | ||
190 | |||
191 | QSizePolicy KNumInput::sizePolicy() const | ||
192 | { | ||
193 | return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ); | ||
194 | } | ||
195 | |||
196 | QSize KNumInput::sizeHint() const | ||
197 | { | ||
198 | return minimumSizeHint(); | ||
199 | } | ||
200 | |||
201 | void KNumInput::setSteps(int minor, int major) | ||
202 | { | ||
203 | if(m_slider) | ||
204 | m_slider->setSteps( minor, major ); | ||
205 | } | ||
206 | |||
207 | |||
208 | // ---------------------------------------------------------------------------- | ||
209 | |||
210 | KIntSpinBox::KIntSpinBox(QWidget *parent, const char *name) | ||
211 | : QSpinBox(0, 99, 1, parent, name) | ||
212 | { | ||
213 | editor()->setAlignment(AlignRight); | ||
214 | val_base = 10; | ||
215 | setValue(0); | ||
216 | } | ||
217 | |||
218 | KIntSpinBox::~KIntSpinBox() | ||
219 | { | ||
220 | } | ||
221 | |||
222 | KIntSpinBox::KIntSpinBox(int lower, int upper, int step, int value, int base, | ||
223 | QWidget* parent, const char* name) | ||
224 | : QSpinBox(lower, upper, step, parent, name) | ||
225 | { | ||
226 | editor()->setAlignment(AlignRight); | ||
227 | val_base = base; | ||
228 | setValue(value); | ||
229 | } | ||
230 | |||
231 | void KIntSpinBox::setBase(int base) | ||
232 | { | ||
233 | val_base = base; | ||
234 | } | ||
235 | |||
236 | |||
237 | int KIntSpinBox::base() const | ||
238 | { | ||
239 | return val_base; | ||
240 | } | ||
241 | |||
242 | QString KIntSpinBox::mapValueToText(int v) | ||
243 | { | ||
244 | return QString::number(v, val_base); | ||
245 | } | ||
246 | |||
247 | int KIntSpinBox::mapTextToValue(bool* ok) | ||
248 | { | ||
249 | return cleanText().toInt(ok, val_base); | ||
250 | } | ||
251 | |||
252 | void KIntSpinBox::setEditFocus(bool mark) | ||
253 | { | ||
254 | editor()->setFocus(); | ||
255 | if(mark) | ||
256 | editor()->selectAll(); | ||
257 | } | ||
258 | |||
259 | |||
260 | // ---------------------------------------------------------------------------- | ||
261 | |||
262 | class KIntNumInput::KIntNumInputPrivate { | ||
263 | public: | ||
264 | int referencePoint; | ||
265 | short blockRelative; | ||
266 | KIntNumInputPrivate( int r ) | ||
267 | : referencePoint( r ), | ||
268 | blockRelative( 0 ) {} | ||
269 | }; | ||
270 | |||
271 | |||
272 | KIntNumInput::KIntNumInput(KNumInput* below, int val, QWidget* parent, | ||
273 | int _base, const char* name) | ||
274 | : KNumInput(below, parent, name) | ||
275 | { | ||
276 | init(val, _base); | ||
277 | } | ||
278 | |||
279 | KIntNumInput::KIntNumInput(QWidget *parent, const char *name) | ||
280 | : KNumInput(parent, name) | ||
281 | { | ||
282 | init(0, 10); | ||
283 | } | ||
284 | |||
285 | KIntNumInput::KIntNumInput(int val, QWidget *parent, int _base, const char *name) | ||
286 | : KNumInput(parent, name) | ||
287 | { | ||
288 | init(val, _base); | ||
289 | |||
290 | } | ||
291 | |||
292 | void KIntNumInput::init(int val, int _base) | ||
293 | { | ||
294 | d = new KIntNumInputPrivate( val ); | ||
295 | m_spin = new KIntSpinBox(INT_MIN, INT_MAX, 1, val, _base, this, "KIntNumInput::KIntSpinBox"); | ||
296 | m_spin->setValidator(new KIntValidator(this, _base, "KNumInput::KIntValidtr")); | ||
297 | connect(m_spin, SIGNAL(valueChanged(int)), SLOT(spinValueChanged(int))); | ||
298 | connect(this, SIGNAL(valueChanged(int)), | ||
299 | SLOT(slotEmitRelativeValueChanged(int))); | ||
300 | |||
301 | setFocusProxy(m_spin); | ||
302 | layout(true); | ||
303 | } | ||
304 | |||
305 | void KIntNumInput::setReferencePoint( int ref ) { | ||
306 | // clip to valid range: | ||
307 | ref = kMin( maxValue(), kMax( minValue(), ref ) ); | ||
308 | d->referencePoint = ref; | ||
309 | } | ||
310 | |||
311 | int KIntNumInput::referencePoint() const { | ||
312 | return d->referencePoint; | ||
313 | } | ||
314 | |||
315 | void KIntNumInput::spinValueChanged(int val) | ||
316 | { | ||
317 | if(m_slider) | ||
318 | m_slider->setValue(val); | ||
319 | |||
320 | emit valueChanged(val); | ||
321 | } | ||
322 | |||
323 | void KIntNumInput::slotEmitRelativeValueChanged( int value ) { | ||
324 | if ( d->blockRelative || !d->referencePoint ) return; | ||
325 | emit relativeValueChanged( double( value ) / double( d->referencePoint ) ); | ||
326 | } | ||
327 | |||
328 | void KIntNumInput::setRange(int lower, int upper, int step, bool slider) | ||
329 | { | ||
330 | upper = kMax(upper, lower); | ||
331 | lower = kMin(upper, lower); | ||
332 | m_spin->setMinValue(lower); | ||
333 | m_spin->setMaxValue(upper); | ||
334 | m_spin->setLineStep(step); | ||
335 | |||
336 | step = m_spin->lineStep(); // maybe QRangeControl didn't like out lineStep? | ||
337 | |||
338 | if(slider) { | ||
339 | if (m_slider) | ||
340 | m_slider->setRange(lower, upper); | ||
341 | else { | ||
342 | m_slider = new QSlider(lower, upper, step, m_spin->value(), | ||
343 | QSlider::Horizontal, this); | ||
344 | m_slider->setTickmarks(QSlider::Below); | ||
345 | connect(m_slider, SIGNAL(valueChanged(int)), | ||
346 | m_spin, SLOT(setValue(int))); | ||
347 | } | ||
348 | |||
349 | // calculate (upper-lower)/10 without overflowing int's: | ||
350 | int major = calcDiffByTen( upper, lower ); | ||
351 | if ( major==0 ) major = step; // #### workaround Qt bug in 2.1-beta4 | ||
352 | |||
353 | m_slider->setSteps(step, major); | ||
354 | m_slider->setTickInterval(major); | ||
355 | } | ||
356 | else { | ||
357 | delete m_slider; | ||
358 | m_slider = 0; | ||
359 | } | ||
360 | |||
361 | // check that reference point is still inside valid range: | ||
362 | setReferencePoint( referencePoint() ); | ||
363 | |||
364 | layout(true); | ||
365 | } | ||
366 | |||
367 | void KIntNumInput::setMinValue(int min) | ||
368 | { | ||
369 | setRange(min, m_spin->maxValue(), m_spin->lineStep(), m_slider); | ||
370 | } | ||
371 | |||
372 | int KIntNumInput::minValue() const | ||
373 | { | ||
374 | return m_spin->minValue(); | ||
375 | } | ||
376 | |||
377 | void KIntNumInput::setMaxValue(int max) | ||
378 | { | ||
379 | setRange(m_spin->minValue(), max, m_spin->lineStep(), m_slider); | ||
380 | } | ||
381 | |||
382 | int KIntNumInput::maxValue() const | ||
383 | { | ||
384 | return m_spin->maxValue(); | ||
385 | } | ||
386 | |||
387 | void KIntNumInput::setSuffix(const QString &suffix) | ||
388 | { | ||
389 | m_spin->setSuffix(suffix); | ||
390 | |||
391 | layout(true); | ||
392 | } | ||
393 | |||
394 | QString KIntNumInput::suffix() const | ||
395 | { | ||
396 | return m_spin->suffix(); | ||
397 | } | ||
398 | |||
399 | void KIntNumInput::setPrefix(const QString &prefix) | ||
400 | { | ||
401 | m_spin->setPrefix(prefix); | ||
402 | |||
403 | layout(true); | ||
404 | } | ||
405 | |||
406 | QString KIntNumInput::prefix() const | ||
407 | { | ||
408 | return m_spin->prefix(); | ||
409 | } | ||
410 | |||
411 | void KIntNumInput::setEditFocus(bool mark) | ||
412 | { | ||
413 | m_spin->setEditFocus(mark); | ||
414 | } | ||
415 | |||
416 | QSize KIntNumInput::minimumSizeHint() const | ||
417 | { | ||
418 | constPolish(); | ||
419 | |||
420 | int w; | ||
421 | int h; | ||
422 | |||
423 | h = 2 + QMAX(m_sizeSpin.height(), m_sizeSlider.height()); | ||
424 | |||
425 | // if in extra row, then count it here | ||
426 | if(m_label && (m_alignment & (AlignBottom|AlignTop))) | ||
427 | h += 4 + m_sizeLabel.height(); | ||
428 | else | ||
429 | // label is in the same row as the other widgets | ||
430 | h = QMAX(h, m_sizeLabel.height() + 2); | ||
431 | |||
432 | w = m_slider ? m_slider->sizeHint().width() + 8 : 0; | ||
433 | w += m_colw1 + m_colw2; | ||
434 | |||
435 | if(m_alignment & (AlignTop|AlignBottom)) | ||
436 | w = QMAX(w, m_sizeLabel.width() + 4); | ||
437 | |||
438 | return QSize(w, h); | ||
439 | } | ||
440 | |||
441 | void KIntNumInput::doLayout() | ||
442 | { | ||
443 | m_sizeSpin = m_spin->sizeHint(); | ||
444 | m_colw2 = m_sizeSpin.width(); | ||
445 | |||
446 | if (m_label) | ||
447 | m_label->setBuddy(m_spin); | ||
448 | } | ||
449 | |||
450 | void KIntNumInput::resizeEvent(QResizeEvent* e) | ||
451 | { | ||
452 | int w = m_colw1; | ||
453 | int h = 0; | ||
454 | |||
455 | if(m_label && (m_alignment & AlignTop)) { | ||
456 | m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); | ||
457 | h += m_sizeLabel.height() + 4; | ||
458 | } | ||
459 | |||
460 | if(m_label && (m_alignment & AlignVCenter)) | ||
461 | m_label->setGeometry(0, 0, w, m_sizeSpin.height()); | ||
462 | |||
463 | m_spin->setGeometry(w, h, m_slider ? m_colw2 : QMAX(m_colw2, e->size().width() - w), m_sizeSpin.height()); | ||
464 | w += m_colw2 + 8; | ||
465 | |||
466 | if(m_slider) | ||
467 | m_slider->setGeometry(w, h, e->size().width() - w, m_sizeSpin.height()); | ||
468 | |||
469 | h += m_sizeSpin.height() + 2; | ||
470 | |||
471 | if(m_label && (m_alignment & AlignBottom)) | ||
472 | m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); | ||
473 | } | ||
474 | |||
475 | KIntNumInput::~KIntNumInput() | ||
476 | { | ||
477 | delete d; | ||
478 | } | ||
479 | |||
480 | void KIntNumInput::setValue(int val) | ||
481 | { | ||
482 | m_spin->setValue(val); | ||
483 | // slider value is changed by spinValueChanged | ||
484 | } | ||
485 | |||
486 | void KIntNumInput::setRelativeValue( double r ) { | ||
487 | if ( !d->referencePoint ) return; | ||
488 | ++d->blockRelative; | ||
489 | setValue( int( d->referencePoint * r + 0.5 ) ); | ||
490 | --d->blockRelative; | ||
491 | } | ||
492 | |||
493 | double KIntNumInput::relativeValue() const { | ||
494 | if ( !d->referencePoint ) return 0; | ||
495 | return double( value() ) / double ( d->referencePoint ); | ||
496 | } | ||
497 | |||
498 | int KIntNumInput::value() const | ||
499 | { | ||
500 | return m_spin->value(); | ||
501 | } | ||
502 | |||
503 | void KIntNumInput::setSpecialValueText(const QString& text) | ||
504 | { | ||
505 | m_spin->setSpecialValueText(text); | ||
506 | layout(true); | ||
507 | }; | ||
508 | |||
509 | QString KIntNumInput::specialValueText() const | ||
510 | { | ||
511 | return m_spin->specialValueText(); | ||
512 | } | ||
513 | |||
514 | void KIntNumInput::setLabel(const QString & label, int a) | ||
515 | { | ||
516 | KNumInput::setLabel(label, a); | ||
517 | |||
518 | if(m_label) | ||
519 | m_label->setBuddy(m_spin); | ||
520 | } | ||
521 | |||
522 | // ---------------------------------------------------------------------------- | ||
523 | |||
524 | class KDoubleNumInput::KDoubleNumInputPrivate { | ||
525 | public: | ||
526 | KDoubleNumInputPrivate( double r ) | ||
527 | : spin( 0 ), | ||
528 | referencePoint( r ), | ||
529 | blockRelative ( 0 ) {} | ||
530 | KDoubleSpinBox * spin; | ||
531 | double referencePoint; | ||
532 | short blockRelative; | ||
533 | }; | ||
534 | |||
535 | KDoubleNumInput::KDoubleNumInput(QWidget *parent, const char *name) | ||
536 | : KNumInput(parent, name) | ||
537 | { | ||
538 | init(0.0, 0.0, 9999.0, 0.01, 2); | ||
539 | } | ||
540 | |||
541 | KDoubleNumInput::KDoubleNumInput(double lower, double upper, double value, | ||
542 | double step, int precision, QWidget* parent, | ||
543 | const char *name) | ||
544 | : KNumInput(parent, name) | ||
545 | { | ||
546 | init(value, lower, upper, step, precision); | ||
547 | } | ||
548 | |||
549 | KDoubleNumInput::KDoubleNumInput(KNumInput *below, | ||
550 | double lower, double upper, double value, | ||
551 | double step, int precision, QWidget* parent, | ||
552 | const char *name) | ||
553 | : KNumInput(below, parent, name) | ||
554 | { | ||
555 | init(value, lower, upper, step, precision); | ||
556 | } | ||
557 | |||
558 | KDoubleNumInput::KDoubleNumInput(double value, QWidget *parent, const char *name) | ||
559 | : KNumInput(parent, name) | ||
560 | { | ||
561 | init(value, kMin(0.0, value), kMax(0.0, value), 0.01, 2 ); | ||
562 | } | ||
563 | |||
564 | KDoubleNumInput::KDoubleNumInput(KNumInput* below, double value, QWidget* parent, | ||
565 | const char* name) | ||
566 | : KNumInput(below, parent, name) | ||
567 | { | ||
568 | init( value, kMin(0.0, value), kMax(0.0, value), 0.01, 2 ); | ||
569 | } | ||
570 | |||
571 | KDoubleNumInput::~KDoubleNumInput() | ||
572 | { | ||
573 | delete d; | ||
574 | } | ||
575 | |||
576 | // ### remove when BIC changes are allowed again: | ||
577 | |||
578 | bool KDoubleNumInput::eventFilter( QObject * o, QEvent * e ) { | ||
579 | return KNumInput::eventFilter( o, e ); | ||
580 | } | ||
581 | |||
582 | void KDoubleNumInput::resetEditBox() { | ||
583 | |||
584 | } | ||
585 | |||
586 | // ### end stuff to remove when BIC changes are allowed again | ||
587 | |||
588 | |||
589 | |||
590 | void KDoubleNumInput::init(double value, double lower, double upper, | ||
591 | double step, int precision ) | ||
592 | { | ||
593 | // ### init no longer used members: | ||
594 | edit = 0; | ||
595 | m_range = true; | ||
596 | m_value = 0.0; | ||
597 | m_precision = 2; | ||
598 | // ### end | ||
599 | |||
600 | d = new KDoubleNumInputPrivate( value ); | ||
601 | |||
602 | d->spin = new KDoubleSpinBox( lower, upper, step, value, precision, | ||
603 | this, "KDoubleNumInput::d->spin" ); | ||
604 | setFocusProxy(d->spin); | ||
605 | connect( d->spin, SIGNAL(valueChanged(double)), | ||
606 | this, SIGNAL(valueChanged(double)) ); | ||
607 | connect( this, SIGNAL(valueChanged(double)), | ||
608 | this, SLOT(slotEmitRelativeValueChanged(double)) ); | ||
609 | |||
610 | updateLegacyMembers(); | ||
611 | |||
612 | layout(true); | ||
613 | } | ||
614 | |||
615 | void KDoubleNumInput::updateLegacyMembers() { | ||
616 | // ### update legacy members that are either not private or for | ||
617 | // which an inlined getter exists: | ||
618 | m_lower = minValue(); | ||
619 | m_upper = maxValue(); | ||
620 | m_step = d->spin->lineStep(); | ||
621 | m_specialvalue = specialValueText(); | ||
622 | } | ||
623 | |||
624 | |||
625 | double KDoubleNumInput::mapSliderToSpin( int val ) const | ||
626 | { | ||
627 | // map [slidemin,slidemax] to [spinmin,spinmax] | ||
628 | double spinmin = d->spin->minValue(); | ||
629 | double spinmax = d->spin->maxValue(); | ||
630 | double slidemin = m_slider->minValue(); // cast int to double to avoid | ||
631 | double slidemax = m_slider->maxValue(); // overflow in rel denominator | ||
632 | double rel = ( double(val) - slidemin ) / ( slidemax - slidemin ); | ||
633 | return spinmin + rel * ( spinmax - spinmin ); | ||
634 | } | ||
635 | |||
636 | void KDoubleNumInput::sliderMoved(int val) | ||
637 | { | ||
638 | d->spin->setValue( mapSliderToSpin( val ) ); | ||
639 | } | ||
640 | |||
641 | void KDoubleNumInput::slotEmitRelativeValueChanged( double value ) | ||
642 | { | ||
643 | if ( !d->referencePoint ) return; | ||
644 | emit relativeValueChanged( value / d->referencePoint ); | ||
645 | } | ||
646 | |||
647 | QSize KDoubleNumInput::minimumSizeHint() const | ||
648 | { | ||
649 | constPolish(); | ||
650 | |||
651 | int w; | ||
652 | int h; | ||
653 | |||
654 | h = 2 + QMAX(m_sizeEdit.height(), m_sizeSlider.height()); | ||
655 | |||
656 | // if in extra row, then count it here | ||
657 | if(m_label && (m_alignment & (AlignBottom|AlignTop))) | ||
658 | h += 4 + m_sizeLabel.height(); | ||
659 | else | ||
660 | // label is in the same row as the other widgets | ||
661 | h = QMAX(h, m_sizeLabel.height() + 2); | ||
662 | |||
663 | w = m_slider ? m_slider->sizeHint().width() + 8 : 0; | ||
664 | w += m_colw1 + m_colw2; | ||
665 | |||
666 | if(m_alignment & (AlignTop|AlignBottom)) | ||
667 | w = QMAX(w, m_sizeLabel.width() + 4); | ||
668 | |||
669 | return QSize(w, h); | ||
670 | } | ||
671 | |||
672 | void KDoubleNumInput::resizeEvent(QResizeEvent* e) | ||
673 | { | ||
674 | int w = m_colw1; | ||
675 | int h = 0; | ||
676 | |||
677 | if(m_label && (m_alignment & AlignTop)) { | ||
678 | m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); | ||
679 | h += m_sizeLabel.height() + 4; | ||
680 | } | ||
681 | |||
682 | if(m_label && (m_alignment & AlignVCenter)) | ||
683 | m_label->setGeometry(0, 0, w, m_sizeEdit.height()); | ||
684 | |||
685 | d->spin->setGeometry(w, h, m_slider ? m_colw2 | ||
686 | : e->size().width() - w, m_sizeEdit.height()); | ||
687 | w += m_colw2 + 8; | ||
688 | |||
689 | if(m_slider) | ||
690 | m_slider->setGeometry(w, h, e->size().width() - w, m_sizeEdit.height()); | ||
691 | |||
692 | h += m_sizeEdit.height() + 2; | ||
693 | |||
694 | if(m_label && (m_alignment & AlignBottom)) | ||
695 | m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); | ||
696 | } | ||
697 | |||
698 | void KDoubleNumInput::doLayout() | ||
699 | { | ||
700 | m_sizeEdit = d->spin->sizeHint(); | ||
701 | m_colw2 = m_sizeEdit.width(); | ||
702 | } | ||
703 | |||
704 | void KDoubleNumInput::setValue(double val) | ||
705 | { | ||
706 | d->spin->setValue( val ); | ||
707 | } | ||
708 | |||
709 | void KDoubleNumInput::setRelativeValue( double r ) | ||
710 | { | ||
711 | if ( !d->referencePoint ) return; | ||
712 | ++d->blockRelative; | ||
713 | setValue( r * d->referencePoint ); | ||
714 | --d->blockRelative; | ||
715 | } | ||
716 | |||
717 | void KDoubleNumInput::setReferencePoint( double ref ) | ||
718 | { | ||
719 | // clip to valid range: | ||
720 | ref = kMin( maxValue(), kMax( minValue(), ref ) ); | ||
721 | d->referencePoint = ref; | ||
722 | } | ||
723 | |||
724 | void KDoubleNumInput::setRange(double lower, double upper, double step, | ||
725 | bool slider) | ||
726 | { | ||
727 | if( m_slider ) { | ||
728 | // don't update the slider to avoid an endless recursion | ||
729 | QSpinBox * spin = d->spin; | ||
730 | disconnect(spin, SIGNAL(valueChanged(int)), | ||
731 | m_slider, SLOT(setValue(int)) ); | ||
732 | } | ||
733 | d->spin->setRange( lower, upper, step, d->spin->precision() ); | ||
734 | |||
735 | if(slider) { | ||
736 | // upcast to base type to get the min/maxValue in int form: | ||
737 | QSpinBox * spin = d->spin; | ||
738 | int slmax = spin->maxValue(); | ||
739 | int slmin = spin->minValue(); | ||
740 | int slvalue = spin->value(); | ||
741 | int slstep = spin->lineStep(); | ||
742 | if (m_slider) { | ||
743 | m_slider->setRange(slmin, slmax); | ||
744 | m_slider->setLineStep(slstep); | ||
745 | m_slider->setValue(slvalue); | ||
746 | } else { | ||
747 | m_slider = new QSlider(slmin, slmax, slstep, slvalue, | ||
748 | QSlider::Horizontal, this); | ||
749 | m_slider->setTickmarks(QSlider::Below); | ||
750 | // feedback line: when one moves, the other moves, too: | ||
751 | connect(m_slider, SIGNAL(valueChanged(int)), | ||
752 | SLOT(sliderMoved(int)) ); | ||
753 | } | ||
754 | connect(spin, SIGNAL(valueChanged(int)), | ||
755 | m_slider, SLOT(setValue(int)) ); | ||
756 | // calculate ( slmax - slmin ) / 10 without overflowing ints: | ||
757 | int major = calcDiffByTen( slmax, slmin ); | ||
758 | if ( !major ) major = slstep; // ### needed? | ||
759 | m_slider->setTickInterval(major); | ||
760 | } else { | ||
761 | delete m_slider; | ||
762 | m_slider = 0; | ||
763 | } | ||
764 | |||
765 | setReferencePoint( referencePoint() ); | ||
766 | |||
767 | layout(true); | ||
768 | updateLegacyMembers(); | ||
769 | } | ||
770 | |||
771 | void KDoubleNumInput::setMinValue(double min) | ||
772 | { | ||
773 | setRange(min, maxValue(), d->spin->lineStep(), m_slider); | ||
774 | } | ||
775 | |||
776 | double KDoubleNumInput::minValue() const | ||
777 | { | ||
778 | return d->spin->minValue(); | ||
779 | } | ||
780 | |||
781 | void KDoubleNumInput::setMaxValue(double max) | ||
782 | { | ||
783 | setRange(minValue(), max, d->spin->lineStep(), m_slider); | ||
784 | } | ||
785 | |||
786 | double KDoubleNumInput::maxValue() const | ||
787 | { | ||
788 | return d->spin->maxValue(); | ||
789 | } | ||
790 | |||
791 | double KDoubleNumInput::value() const | ||
792 | { | ||
793 | return d->spin->value(); | ||
794 | } | ||
795 | |||
796 | double KDoubleNumInput::relativeValue() const | ||
797 | { | ||
798 | if ( !d->referencePoint ) return 0; | ||
799 | return value() / d->referencePoint; | ||
800 | } | ||
801 | |||
802 | double KDoubleNumInput::referencePoint() const | ||
803 | { | ||
804 | return d->referencePoint; | ||
805 | } | ||
806 | |||
807 | QString KDoubleNumInput::suffix() const | ||
808 | { | ||
809 | return d->spin->suffix(); | ||
810 | } | ||
811 | |||
812 | QString KDoubleNumInput::prefix() const | ||
813 | { | ||
814 | return d->spin->prefix(); | ||
815 | } | ||
816 | |||
817 | void KDoubleNumInput::setSuffix(const QString &suffix) | ||
818 | { | ||
819 | d->spin->setSuffix( suffix ); | ||
820 | |||
821 | layout(true); | ||
822 | } | ||
823 | |||
824 | void KDoubleNumInput::setPrefix(const QString &prefix) | ||
825 | { | ||
826 | d->spin->setPrefix( prefix ); | ||
827 | |||
828 | layout(true); | ||
829 | } | ||
830 | |||
831 | void KDoubleNumInput::setPrecision(int precision) | ||
832 | { | ||
833 | d->spin->setPrecision( precision ); | ||
834 | |||
835 | layout(true); | ||
836 | } | ||
837 | |||
838 | int KDoubleNumInput::precision() const | ||
839 | { | ||
840 | return d->spin->precision(); | ||
841 | } | ||
842 | |||
843 | void KDoubleNumInput::setSpecialValueText(const QString& text) | ||
844 | { | ||
845 | d->spin->setSpecialValueText( text ); | ||
846 | |||
847 | layout(true); | ||
848 | updateLegacyMembers(); | ||
849 | }; | ||
850 | |||
851 | void KDoubleNumInput::setLabel(const QString & label, int a) | ||
852 | { | ||
853 | KNumInput::setLabel(label, a); | ||
854 | |||
855 | if(m_label) | ||
856 | m_label->setBuddy(d->spin); | ||
857 | |||
858 | } | ||
859 | |||
860 | // ---------------------------------------------------------------------------- | ||
861 | |||
862 | |||
863 | // We use a kind of fixed-point arithmetic to represent the range of | ||
864 | // doubles [mLower,mUpper] in steps of 10^(-mPrecision). Thus, the | ||
865 | // following relations hold: | ||
866 | // | ||
867 | // 1. factor = 10^mPrecision | ||
868 | // 2. basicStep = 1/factor = 10^(-mPrecision); | ||
869 | // 3. lowerInt = lower * factor; | ||
870 | // 4. upperInt = upper * factor; | ||
871 | // 5. lower = lowerInt * basicStep; | ||
872 | // 6. upper = upperInt * basicStep; | ||
873 | class KDoubleSpinBox::Private { | ||
874 | public: | ||
875 | Private( int precision=1 ) | ||
876 | : mPrecision( precision ), | ||
877 | mValidator( 0 ) | ||
878 | { | ||
879 | } | ||
880 | |||
881 | int factor() const { | ||
882 | int f = 1; | ||
883 | for ( int i = 0 ; i < mPrecision ; ++i ) f *= 10; | ||
884 | return f; | ||
885 | } | ||
886 | |||
887 | double basicStep() const { | ||
888 | return 1.0/double(factor()); | ||
889 | } | ||
890 | |||
891 | int mapToInt( double value, bool * ok ) const { | ||
892 | assert( ok ); | ||
893 | const double f = factor(); | ||
894 | if ( value > double(INT_MAX) / f ) { | ||
895 | // kdWarning() << "KDoubleSpinBox: can't represent value " << value | ||
896 | // << "in terms of fixed-point numbers with precision " | ||
897 | // << mPrecision << endl; | ||
898 | *ok = false; | ||
899 | return INT_MAX; | ||
900 | } else if ( value < double(INT_MIN) / f ) { | ||
901 | // kdWarning() << "KDoubleSpinBox: can't represent value " << value | ||
902 | // << "in terms of fixed-point numbers with precision " | ||
903 | // << mPrecision << endl; | ||
904 | *ok = false; | ||
905 | return INT_MIN; | ||
906 | } else { | ||
907 | *ok = true; | ||
908 | return int( value * f + ( value < 0 ? -0.5 : 0.5 ) ); | ||
909 | } | ||
910 | } | ||
911 | |||
912 | double mapToDouble( int value ) const { | ||
913 | return double(value) * basicStep(); | ||
914 | } | ||
915 | |||
916 | int mPrecision; | ||
917 | KDoubleValidator * mValidator; | ||
918 | }; | ||
919 | |||
920 | KDoubleSpinBox::KDoubleSpinBox( QWidget * parent, const char * name ) | ||
921 | : QSpinBox( parent, name ) | ||
922 | { | ||
923 | editor()->setAlignment( Qt::AlignRight ); | ||
924 | d = new Private(); | ||
925 | updateValidator(); | ||
926 | } | ||
927 | |||
928 | KDoubleSpinBox::KDoubleSpinBox( double lower, double upper, double step, | ||
929 | double value, int precision, | ||
930 | QWidget * parent, const char * name ) | ||
931 | : QSpinBox( parent, name ) | ||
932 | { | ||
933 | editor()->setAlignment( Qt::AlignRight ); | ||
934 | d = new Private(); | ||
935 | setRange( lower, upper, step, precision ); | ||
936 | setValue( value ); | ||
937 | connect( this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)) ); | ||
938 | } | ||
939 | |||
940 | KDoubleSpinBox::~KDoubleSpinBox() { | ||
941 | delete d; d = 0; | ||
942 | } | ||
943 | |||
944 | bool KDoubleSpinBox::acceptLocalizedNumbers() const { | ||
945 | if ( !d->mValidator ) return true; // we'll set one that does; | ||
946 | // can't do it now, since we're const | ||
947 | return d->mValidator->acceptLocalizedNumbers(); | ||
948 | } | ||
949 | |||
950 | void KDoubleSpinBox::setAcceptLocalizedNumbers( bool accept ) { | ||
951 | if ( !d->mValidator ) updateValidator(); | ||
952 | d->mValidator->setAcceptLocalizedNumbers( accept ); | ||
953 | } | ||
954 | |||
955 | void KDoubleSpinBox::setRange( double lower, double upper, double step, | ||
956 | int precision ) { | ||
957 | lower = kMin(upper, lower); | ||
958 | upper = kMax(upper, lower); | ||
959 | setPrecision( precision, true ); // disable bounds checking, since | ||
960 | setMinValue( lower ); // it's done in set{Min,Max}Value | ||
961 | setMaxValue( upper ); // anyway and we want lower, upper | ||
962 | setLineStep( step ); // and step to have the right precision | ||
963 | } | ||
964 | |||
965 | int KDoubleSpinBox::precision() const { | ||
966 | return d->mPrecision; | ||
967 | } | ||
968 | |||
969 | void KDoubleSpinBox::setPrecision( int precision ) { | ||
970 | setPrecision( precision, false ); | ||
971 | } | ||
972 | |||
973 | void KDoubleSpinBox::setPrecision( int precision, bool force ) { | ||
974 | if ( precision < 1 ) return; | ||
975 | if ( !force ) { | ||
976 | int maxPrec = maxPrecision(); | ||
977 | if ( precision > maxPrec ) | ||
978 | precision = maxPrec; | ||
979 | } | ||
980 | d->mPrecision = precision; | ||
981 | updateValidator(); | ||
982 | } | ||
983 | |||
984 | int KDoubleSpinBox::maxPrecision() const { | ||
985 | // INT_MAX must be > maxAbsValue * 10^precision | ||
986 | // ==> 10^precision < INT_MAX / maxAbsValue | ||
987 | // ==> precision < log10 ( INT_MAX / maxAbsValue ) | ||
988 | // ==> maxPrecision = floor( log10 ( INT_MAX / maxAbsValue ) ); | ||
989 | double maxAbsValue = kMax( fabs(minValue()), fabs(maxValue()) ); | ||
990 | if ( maxAbsValue == 0 ) return 6; // return arbitrary value to avoid dbz... | ||
991 | |||
992 | return int( floor( log10( double(INT_MAX) / maxAbsValue ) ) ); | ||
993 | } | ||
994 | |||
995 | double KDoubleSpinBox::value() const { | ||
996 | return d->mapToDouble( base::value() ); | ||
997 | } | ||
998 | |||
999 | void KDoubleSpinBox::setValue( double value ) { | ||
1000 | if ( value == this->value() ) return; | ||
1001 | if ( value < minValue() ) | ||
1002 | base::setValue( base::minValue() ); | ||
1003 | else if ( value > maxValue() ) | ||
1004 | base::setValue( base::maxValue() ); | ||
1005 | else { | ||
1006 | bool ok = false; | ||
1007 | base::setValue( d->mapToInt( value, &ok ) ); | ||
1008 | assert( ok ); | ||
1009 | } | ||
1010 | } | ||
1011 | |||
1012 | double KDoubleSpinBox::minValue() const { | ||
1013 | return d->mapToDouble( base::minValue() ); | ||
1014 | } | ||
1015 | |||
1016 | void KDoubleSpinBox::setMinValue( double value ) { | ||
1017 | bool ok = false; | ||
1018 | int min = d->mapToInt( value, &ok ); | ||
1019 | if ( !ok ) return; | ||
1020 | base::setMinValue( min ); | ||
1021 | updateValidator(); | ||
1022 | } | ||
1023 | |||
1024 | |||
1025 | double KDoubleSpinBox::maxValue() const { | ||
1026 | return d->mapToDouble( base::maxValue() ); | ||
1027 | } | ||
1028 | |||
1029 | void KDoubleSpinBox::setMaxValue( double value ) { | ||
1030 | bool ok = false; | ||
1031 | int max = d->mapToInt( value, &ok ); | ||
1032 | if ( !ok ) return; | ||
1033 | base::setMaxValue( max ); | ||
1034 | updateValidator(); | ||
1035 | } | ||
1036 | |||
1037 | double KDoubleSpinBox::lineStep() const { | ||
1038 | return d->mapToDouble( base::lineStep() ); | ||
1039 | } | ||
1040 | |||
1041 | void KDoubleSpinBox::setLineStep( double step ) { | ||
1042 | bool ok = false; | ||
1043 | if ( step > maxValue() - minValue() ) | ||
1044 | base::setLineStep( 1 ); | ||
1045 | else | ||
1046 | base::setLineStep( kMax( d->mapToInt( step, &ok ), 1 ) ); | ||
1047 | } | ||
1048 | |||
1049 | QString KDoubleSpinBox::mapValueToText( int value ) { | ||
1050 | // if ( acceptLocalizedNumbers() ) | ||
1051 | // return KGlobal::locale() | ||
1052 | // ->formatNumber( d->mapToDouble( value ), d->mPrecision ); | ||
1053 | // else | ||
1054 | return QString().setNum( d->mapToDouble( value ), 'f', d->mPrecision ); | ||
1055 | } | ||
1056 | |||
1057 | int KDoubleSpinBox::mapTextToValue( bool * ok ) { | ||
1058 | double value; | ||
1059 | // if ( acceptLocalizedNumbers() ) | ||
1060 | // value = KGlobal::locale()->readNumber( cleanText(), ok ); | ||
1061 | // else | ||
1062 | value = cleanText().toDouble( ok ); | ||
1063 | if ( !*ok ) return 0; | ||
1064 | if ( value > maxValue() ) | ||
1065 | value = maxValue(); | ||
1066 | else if ( value < minValue() ) | ||
1067 | value = minValue(); | ||
1068 | return d->mapToInt( value, ok ); | ||
1069 | } | ||
1070 | |||
1071 | void KDoubleSpinBox::setValidator( const QValidator * ) { | ||
1072 | // silently discard the new validator. We don't want another one ;-) | ||
1073 | } | ||
1074 | |||
1075 | void KDoubleSpinBox::slotValueChanged( int value ) { | ||
1076 | emit valueChanged( d->mapToDouble( value ) ); | ||
1077 | } | ||
1078 | |||
1079 | void KDoubleSpinBox::updateValidator() { | ||
1080 | if ( !d->mValidator ) { | ||
1081 | d->mValidator = new KDoubleValidator( minValue(), maxValue(), precision(), | ||
1082 | this, "d->mValidator" ); | ||
1083 | base::setValidator( d->mValidator ); | ||
1084 | } else | ||
1085 | d->mValidator->setRange( minValue(), maxValue(), precision() ); | ||
1086 | } | ||
1087 | |||
1088 | void KNumInput::virtual_hook( int, void* ) | ||
1089 | { /*BASE::virtual_hook( id, data );*/ } | ||
1090 | |||
1091 | void KIntNumInput::virtual_hook( int id, void* data ) | ||
1092 | { KNumInput::virtual_hook( id, data ); } | ||
1093 | |||
1094 | void KDoubleNumInput::virtual_hook( int id, void* data ) | ||
1095 | { KNumInput::virtual_hook( id, data ); } | ||
1096 | |||
1097 | void KIntSpinBox::virtual_hook( int, void* ) | ||
1098 | { /*BASE::virtual_hook( id, data );*/ } | ||
1099 | |||
1100 | void KDoubleSpinBox::virtual_hook( int, void* ) | ||
1101 | { /*BASE::virtual_hook( id, data );*/ } | ||
1102 | |||
1103 | //#include "knuminput.moc" | ||
diff --git a/noncore/settings/networksettings/ppp/knuminput.h b/noncore/settings/networksettings/ppp/knuminput.h deleted file mode 100644 index 67f3b44..0000000 --- a/noncore/settings/networksettings/ppp/knuminput.h +++ b/dev/null | |||
@@ -1,947 +0,0 @@ | |||
1 | /* | ||
2 | * knuminput.h | ||
3 | * | ||
4 | * Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca> | ||
5 | * Copyright (c) 2000 Dirk A. Mueller <mueller@kde.org> | ||
6 | * Copyright (c) 2002 Marc Mutz <mutz@kde.org> | ||
7 | * | ||
8 | * Requires the Qt widget libraries, available at no cost at | ||
9 | * http://www.troll.no/ | ||
10 | * | ||
11 | * This library is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU Library General Public | ||
13 | * License as published by the Free Software Foundation; either | ||
14 | * version 2 of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This library is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * Library General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Library General Public License | ||
22 | * along with this library; see the file COPYING.LIB. If not, write to | ||
23 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
24 | * Boston, MA 02111-1307, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef K_NUMINPUT_H | ||
28 | #define K_NUMINPUT_H | ||
29 | |||
30 | #include <qwidget.h> | ||
31 | #include <qspinbox.h> | ||
32 | |||
33 | class QLabel; | ||
34 | class QSlider; | ||
35 | class QLineEdit; | ||
36 | class QLayout; | ||
37 | class QValidator; | ||
38 | |||
39 | class KIntSpinBox; | ||
40 | |||
41 | /* ------------------------------------------------------------------------ */ | ||
42 | |||
43 | /** | ||
44 | * You need to inherit from this class if you want to implement K*NumInput | ||
45 | * for a different variable type | ||
46 | * | ||
47 | */ | ||
48 | class KNumInput : public QWidget | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | Q_PROPERTY( QString label READ label WRITE setLabel ) | ||
52 | public: | ||
53 | /** | ||
54 | * Default constructor | ||
55 | * | ||
56 | */ | ||
57 | KNumInput(QWidget* parent=0, const char* name=0); | ||
58 | |||
59 | /** | ||
60 | * @param below A pointer to another KNumInput. | ||
61 | * | ||
62 | */ | ||
63 | KNumInput(KNumInput* below, QWidget* parent=0, const char* name=0); | ||
64 | ~KNumInput(); | ||
65 | |||
66 | /** | ||
67 | * Sets the text and alignment of the main description label. | ||
68 | * | ||
69 | * @param label The text of the label. | ||
70 | * Use QString::null to remove an existing one. | ||
71 | * | ||
72 | * @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and | ||
73 | * @p AlignTop, @p AlignVCenter, @p AlignBottom. | ||
74 | * default is @p AlignLeft | @p AlignTop. | ||
75 | * | ||
76 | * The vertical alignment flags have special meaning with this | ||
77 | * widget: | ||
78 | * | ||
79 | * @li @p AlignTop The label is placed above the edit/slider | ||
80 | * @li @p AlignVCenter The label is placed left beside the edit | ||
81 | * @li @p AlignBottom The label is placed below the edit/slider | ||
82 | * | ||
83 | */ | ||
84 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | ||
85 | |||
86 | /** | ||
87 | * @return the text of the label. | ||
88 | */ | ||
89 | QString label() const; | ||
90 | |||
91 | /** | ||
92 | * @return if the num input has a slider. | ||
93 | * @since 3.1 | ||
94 | */ | ||
95 | bool showSlider() const { return m_slider; } | ||
96 | |||
97 | /** | ||
98 | * Sets the spacing of tickmarks for the slider. | ||
99 | * | ||
100 | * @param minor Minor tickmark separation. | ||
101 | * @param major Major tickmark separation. | ||
102 | */ | ||
103 | void setSteps(int minor, int major); | ||
104 | |||
105 | /** | ||
106 | * Specifies that this widget may stretch horizontally, but is | ||
107 | * fixed vertically (like @ref QSpinBox itself). | ||
108 | */ | ||
109 | QSizePolicy sizePolicy() const; | ||
110 | |||
111 | /** | ||
112 | * Returns a size which fits the contents of the control. | ||
113 | * | ||
114 | * @return the preferred size necessary to show the control | ||
115 | */ | ||
116 | virtual QSize sizeHint() const; | ||
117 | |||
118 | protected: | ||
119 | /** | ||
120 | * Call this function whenever you change something in the geometry | ||
121 | * of your KNumInput child. | ||
122 | * | ||
123 | */ | ||
124 | void layout(bool deep); | ||
125 | |||
126 | /** | ||
127 | * You need to overwrite this method and implement your layout | ||
128 | * calculations there. | ||
129 | * | ||
130 | * See KIntNumInput::doLayout and KDoubleNumInput::doLayout implementation | ||
131 | * for details. | ||
132 | * | ||
133 | */ | ||
134 | virtual void doLayout() = 0; | ||
135 | |||
136 | KNumInput* m_prev, *m_next; | ||
137 | int m_colw1, m_colw2; | ||
138 | |||
139 | QLabel* m_label; | ||
140 | QSlider* m_slider; | ||
141 | QSize m_sizeSlider, m_sizeLabel; | ||
142 | |||
143 | int m_alignment; | ||
144 | |||
145 | private: | ||
146 | void init(); | ||
147 | |||
148 | protected: | ||
149 | virtual void virtual_hook( int id, void* data ); | ||
150 | private: | ||
151 | class KNumInputPrivate; | ||
152 | KNumInputPrivate *d; | ||
153 | }; | ||
154 | |||
155 | /* ------------------------------------------------------------------------ */ | ||
156 | |||
157 | /** | ||
158 | * KIntNumInput combines a @ref QSpinBox and optionally a @ref QSlider | ||
159 | * with a label to make an easy to use control for setting some integer | ||
160 | * parameter. This is especially nice for configuration dialogs, | ||
161 | * which can have many such combinated controls. | ||
162 | * | ||
163 | * The slider is created only when the user specifies a range | ||
164 | * for the control using the setRange function with the slider | ||
165 | * parameter set to "true". | ||
166 | * | ||
167 | * A special feature of KIntNumInput, designed specifically for | ||
168 | * the situation when there are several KIntNumInputs in a column, | ||
169 | * is that you can specify what portion of the control is taken by the | ||
170 | * QSpinBox (the remaining portion is used by the slider). This makes | ||
171 | * it very simple to have all the sliders in a column be the same size. | ||
172 | * | ||
173 | * It uses @ref KIntValidator validator class. KIntNumInput enforces the | ||
174 | * value to be in the given range, and can display it in any base | ||
175 | * between 2 and 36. | ||
176 | * | ||
177 | * @short An input widget for integer numbers, consisting of a spinbox and a slider. | ||
178 | * @version $Id$ | ||
179 | */ | ||
180 | |||
181 | class KIntNumInput : public KNumInput | ||
182 | { | ||
183 | Q_OBJECT | ||
184 | Q_PROPERTY( int value READ value WRITE setValue ) | ||
185 | Q_PROPERTY( int minValue READ minValue WRITE setMinValue ) | ||
186 | Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) | ||
187 | Q_PROPERTY( int referencePoint READ referencePoint WRITE setReferencePoint ) | ||
188 | Q_PROPERTY( QString suffix READ suffix WRITE setSuffix ) | ||
189 | Q_PROPERTY( QString prefix READ prefix WRITE setPrefix ) | ||
190 | Q_PROPERTY( QString specialValueText READ specialValueText WRITE setSpecialValueText ) | ||
191 | |||
192 | public: | ||
193 | /** | ||
194 | * Constructs an input control for integer values | ||
195 | * with base 10 and initial value 0. | ||
196 | */ | ||
197 | KIntNumInput(QWidget *parent=0, const char *name=0); | ||
198 | /** | ||
199 | * Constructor | ||
200 | * It constructs a QSpinBox that allows the input of integer numbers | ||
201 | * in the range of -INT_MAX to +INT_MAX. To set a descriptive label, | ||
202 | * use setLabel(). To enforce the value being in a range and optionally to | ||
203 | * attach a slider to it, use setRange(). | ||
204 | * | ||
205 | * @param value initial value for the control | ||
206 | * @param base numeric base used for display | ||
207 | * @param parent parent QWidget | ||
208 | * @param name internal name for this widget | ||
209 | */ | ||
210 | KIntNumInput(int value, QWidget* parent=0, int base = 10, const char *name=0); | ||
211 | |||
212 | /** | ||
213 | * Constructor | ||
214 | * | ||
215 | * the difference to the one above is the "below" parameter. It tells | ||
216 | * this instance that it is visually put below some other KNumInput widget. | ||
217 | * Note that these two KNumInput's need not to have the same parent widget | ||
218 | * or be in the same layout group. | ||
219 | * The effect is that it'll adjust it's layout in correspondence | ||
220 | * with the layout of the other KNumInput's (you can build an arbitary long | ||
221 | * chain). | ||
222 | * | ||
223 | * @param below append KIntNumInput to the KNumInput chain | ||
224 | * @param value initial value for the control | ||
225 | * @param base numeric base used for display | ||
226 | * @param parent parent QWidget | ||
227 | * @param name internal name for this widget | ||
228 | */ | ||
229 | KIntNumInput(KNumInput* below, int value, QWidget* parent=0, int base = 10, const char *name=0); | ||
230 | |||
231 | /** | ||
232 | * Destructor | ||
233 | * | ||
234 | * | ||
235 | */ | ||
236 | virtual ~KIntNumInput(); | ||
237 | |||
238 | /** | ||
239 | * @return the current value. | ||
240 | */ | ||
241 | int value() const; | ||
242 | |||
243 | /** | ||
244 | * @return the curent value in units of the @ref referencePoint. | ||
245 | * @since 3.1 | ||
246 | */ | ||
247 | double relativeValue() const; | ||
248 | |||
249 | /** | ||
250 | * @return the current reference point | ||
251 | * @since 3.1 | ||
252 | */ | ||
253 | int referencePoint() const; | ||
254 | |||
255 | /** | ||
256 | * @return the suffix displayed behind the value. | ||
257 | * @see #setSuffix() | ||
258 | */ | ||
259 | QString suffix() const; | ||
260 | /** | ||
261 | * @return the prefix displayed in front of the value. | ||
262 | * @see #setPrefix() | ||
263 | */ | ||
264 | QString prefix() const; | ||
265 | /** | ||
266 | * @return the string displayed for a special value. | ||
267 | * @see #setSpecialValueText() | ||
268 | */ | ||
269 | QString specialValueText() const; | ||
270 | |||
271 | /** | ||
272 | * @param min minimum value | ||
273 | * @param max maximum value | ||
274 | * @param step step size for the QSlider | ||
275 | */ | ||
276 | void setRange(int min, int max, int step=1, bool slider=true); | ||
277 | /** | ||
278 | * Sets the minimum value. | ||
279 | */ | ||
280 | void setMinValue(int min); | ||
281 | /** | ||
282 | * @return the minimum value. | ||
283 | */ | ||
284 | int minValue() const; | ||
285 | /** | ||
286 | * Sets the maximum value. | ||
287 | */ | ||
288 | void setMaxValue(int max); | ||
289 | /** | ||
290 | * @return the maximum value. | ||
291 | */ | ||
292 | int maxValue() const; | ||
293 | |||
294 | /** | ||
295 | * Sets the special value text. If set, the SpinBox will display | ||
296 | * this text instead of the numeric value whenever the current | ||
297 | * value is equal to minVal(). Typically this is used for indicating | ||
298 | * that the choice has a special (default) meaning. | ||
299 | */ | ||
300 | void setSpecialValueText(const QString& text); | ||
301 | |||
302 | /** | ||
303 | * @reimplemented | ||
304 | */ | ||
305 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | ||
306 | |||
307 | /** | ||
308 | * This method returns the minimum size necessary to display the | ||
309 | * control. The minimum size is enough to show all the labels | ||
310 | * in the current font (font change may invalidate the return value). | ||
311 | * | ||
312 | * @return the minimum size necessary to show the control | ||
313 | */ | ||
314 | virtual QSize minimumSizeHint() const; | ||
315 | |||
316 | public slots: | ||
317 | /** | ||
318 | * Sets the value of the control. | ||
319 | */ | ||
320 | void setValue(int); | ||
321 | |||
322 | /** | ||
323 | * Sets the value in units of the @ref referencePoint | ||
324 | * @since 3.1 | ||
325 | */ | ||
326 | void setRelativeValue(double); | ||
327 | |||
328 | /** | ||
329 | * Sets the reference point for @ref relativeValue. | ||
330 | * @since 3.1 | ||
331 | */ | ||
332 | void setReferencePoint(int); | ||
333 | |||
334 | /** | ||
335 | * Sets the suffix to @p suffix. | ||
336 | * Use QString::null to disable this feature. | ||
337 | * Formatting has to be provided (e.g. a space separator between the | ||
338 | * prepended @p value and the suffix's text has to be provided | ||
339 | * as the first character in the suffix). | ||
340 | * | ||
341 | * @see QSpinBox::setSuffix(), #setPrefix() | ||
342 | */ | ||
343 | void setSuffix(const QString &suffix); | ||
344 | |||
345 | /** | ||
346 | * Sets the prefix to @p prefix. | ||
347 | * Use QString::null to disable this feature. | ||
348 | * Formatting has to be provided (see above). | ||
349 | * | ||
350 | * @see QSpinBox::setPrefix(), #setSuffix() | ||
351 | */ | ||
352 | void setPrefix(const QString &prefix); | ||
353 | |||
354 | /** | ||
355 | * sets focus to the edit widget and marks all text in if mark == true | ||
356 | * | ||
357 | */ | ||
358 | void setEditFocus( bool mark = true ); | ||
359 | |||
360 | signals: | ||
361 | /** | ||
362 | * Emitted every time the value changes (by calling @ref setValue() or | ||
363 | * by user interaction). | ||
364 | */ | ||
365 | void valueChanged(int); | ||
366 | |||
367 | /** | ||
368 | * Emitted whenever @ref #valueChanged is. Contains the change | ||
369 | * relative to the @ref referencePoint. | ||
370 | * @since 3.1 | ||
371 | */ | ||
372 | void relativeValueChanged(double); | ||
373 | |||
374 | private slots: | ||
375 | void spinValueChanged(int); | ||
376 | void slotEmitRelativeValueChanged(int); | ||
377 | |||
378 | protected: | ||
379 | /** | ||
380 | * @reimplemented | ||
381 | */ | ||
382 | virtual void doLayout(); | ||
383 | /** | ||
384 | * @reimplemented | ||
385 | */ | ||
386 | void resizeEvent ( QResizeEvent * ); | ||
387 | |||
388 | KIntSpinBox* m_spin; | ||
389 | QSize m_sizeSpin; | ||
390 | |||
391 | private: | ||
392 | void init(int value, int _base); | ||
393 | |||
394 | protected: | ||
395 | virtual void virtual_hook( int id, void* data ); | ||
396 | private: | ||
397 | class KIntNumInputPrivate; | ||
398 | KIntNumInputPrivate *d; | ||
399 | }; | ||
400 | |||
401 | |||
402 | /* ------------------------------------------------------------------------ */ | ||
403 | |||
404 | class KDoubleLine; | ||
405 | |||
406 | /** | ||
407 | * KDoubleNumInput combines a @ref QSpinBox and optionally a @ref QSlider | ||
408 | * with a label to make an easy to use control for setting some float | ||
409 | * parameter. This is especially nice for configuration dialogs, | ||
410 | * which can have many such combinated controls. | ||
411 | * | ||
412 | * The slider is created only when the user specifies a range | ||
413 | * for the control using the setRange function with the slider | ||
414 | * parameter set to "true". | ||
415 | * | ||
416 | * A special feature of KDoubleNumInput, designed specifically for | ||
417 | * the situation when there are several instances in a column, | ||
418 | * is that you can specify what portion of the control is taken by the | ||
419 | * QSpinBox (the remaining portion is used by the slider). This makes | ||
420 | * it very simple to have all the sliders in a column be the same size. | ||
421 | * | ||
422 | * It uses the @ref KDoubleValidator validator class. KDoubleNumInput | ||
423 | * enforces the value to be in the given range, but see the class | ||
424 | * documentation of @ref KDoubleSpinBox for the tricky | ||
425 | * interrelationship of precision and values. All of what is said | ||
426 | * there applies here, too. | ||
427 | * | ||
428 | * @see KIntNumInput, KDoubleSpinBox | ||
429 | * @short An input control for real numbers, consisting of a spinbox and a slider. | ||
430 | */ | ||
431 | |||
432 | class KDoubleNumInput : public KNumInput | ||
433 | { | ||
434 | Q_OBJECT | ||
435 | Q_PROPERTY( double value READ value WRITE setValue ) | ||
436 | Q_PROPERTY( double minValue READ minValue WRITE setMinValue ) | ||
437 | Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue ) | ||
438 | Q_PROPERTY( QString suffix READ suffix WRITE setSuffix ) | ||
439 | Q_PROPERTY( QString prefix READ prefix WRITE setPrefix ) | ||
440 | Q_PROPERTY( QString specialValueText READ specialValueText WRITE setSpecialValueText ) | ||
441 | |||
442 | public: | ||
443 | /** | ||
444 | * Constructs an input control for double values | ||
445 | * with initial value 0.00. | ||
446 | */ | ||
447 | KDoubleNumInput(QWidget *parent=0, const char *name=0); | ||
448 | |||
449 | /** | ||
450 | * @deprecated (value is rounded to a multiple of 1/100) | ||
451 | * Constructor | ||
452 | * | ||
453 | * @param value initial value for the control | ||
454 | * @param parent parent QWidget | ||
455 | * @param name internal name for this widget | ||
456 | */ | ||
457 | KDoubleNumInput(double value, QWidget *parent=0, const char *name=0); | ||
458 | |||
459 | /** | ||
460 | * Constructor | ||
461 | * | ||
462 | * @param lower lower boundary value | ||
463 | * @param upper upper boundary value | ||
464 | * @param value initial value for the control | ||
465 | * @param step step size to use for up/down arrow clicks | ||
466 | * @param precision number of digits after the decimal point | ||
467 | * @param parent parent QWidget | ||
468 | * @param name internal name for this widget | ||
469 | * @since 3.1 | ||
470 | */ | ||
471 | KDoubleNumInput(double lower, double upper, double value, double step=0.01, | ||
472 | int precision=2, QWidget *parent=0, const char *name=0); | ||
473 | |||
474 | /** | ||
475 | * destructor | ||
476 | */ | ||
477 | virtual ~KDoubleNumInput(); | ||
478 | |||
479 | /** | ||
480 | * @deprecated (rounds @p value to a mulitple of 1/100) | ||
481 | * Constructor | ||
482 | * | ||
483 | * puts it below other KNumInput | ||
484 | * | ||
485 | * @param below | ||
486 | * @param value initial value for the control | ||
487 | * @param parent parent QWidget | ||
488 | * @param name internal name for this widget | ||
489 | **/ | ||
490 | KDoubleNumInput(KNumInput* below, double value, QWidget* parent=0, const char* name=0); | ||
491 | |||
492 | /** | ||
493 | * Constructor | ||
494 | * | ||
495 | * puts it below other KNumInput | ||
496 | * | ||
497 | * @param lower lower boundary value | ||
498 | * @param upper upper boundary value | ||
499 | * @param value initial value for the control | ||
500 | * @param step step size to use for up/down arrow clicks | ||
501 | * @param precision number of digits after the decimal point | ||
502 | * @param parent parent QWidget | ||
503 | * @param name internal name for this widget | ||
504 | * @since 3.1 | ||
505 | */ | ||
506 | KDoubleNumInput(KNumInput* below, | ||
507 | double lower, double upper, double value, double step=0.02, | ||
508 | int precision=2, QWidget *parent=0, const char *name=0); | ||
509 | |||
510 | /** | ||
511 | * @return the current value. | ||
512 | */ | ||
513 | double value() const; | ||
514 | |||
515 | /** | ||
516 | * @return the suffix. | ||
517 | * @see #setSuffix() | ||
518 | */ | ||
519 | QString suffix() const; | ||
520 | |||
521 | /** | ||
522 | * @return the prefix. | ||
523 | * @see #setPrefix() | ||
524 | */ | ||
525 | QString prefix() const; | ||
526 | |||
527 | /** | ||
528 | * @return the precision. | ||
529 | * @see #setPrecision() | ||
530 | */ | ||
531 | int precision() const; | ||
532 | |||
533 | /** | ||
534 | * @return the string displayed for a special value. | ||
535 | * @see #setSpecialValueText() | ||
536 | */ | ||
537 | QString specialValueText() const { return m_specialvalue; } | ||
538 | |||
539 | /** | ||
540 | * @param min minimum value | ||
541 | * @param max maximum value | ||
542 | * @param step step size for the QSlider | ||
543 | */ | ||
544 | void setRange(double min, double max, double step=1, bool slider=true); | ||
545 | /** | ||
546 | * Sets the minimum value. | ||
547 | */ | ||
548 | void setMinValue(double min); | ||
549 | /** | ||
550 | * @return the minimum value. | ||
551 | */ | ||
552 | double minValue() const; | ||
553 | /** | ||
554 | * Sets the maximum value. | ||
555 | */ | ||
556 | void setMaxValue(double max); | ||
557 | /** | ||
558 | * @return the maximum value. | ||
559 | */ | ||
560 | double maxValue() const; | ||
561 | |||
562 | /** | ||
563 | * Specifies the number of digits to use. | ||
564 | */ | ||
565 | void setPrecision(int precision); | ||
566 | |||
567 | /** | ||
568 | * @return the reference point for @ref #relativeValue calculation | ||
569 | * @since 3.1 | ||
570 | */ | ||
571 | double referencePoint() const; | ||
572 | |||
573 | /** | ||
574 | * @return the current value in units of @ref #referencePoint. | ||
575 | * @since 3.1 | ||
576 | */ | ||
577 | double relativeValue() const; | ||
578 | |||
579 | /** | ||
580 | * Sets the special value text. If set, the spin box will display | ||
581 | * this text instead of the numeric value whenever the current | ||
582 | * value is equal to @ref #minVal(). Typically this is used for indicating | ||
583 | * that the choice has a special (default) meaning. | ||
584 | */ | ||
585 | void setSpecialValueText(const QString& text); | ||
586 | |||
587 | /** | ||
588 | * @reimplemented | ||
589 | */ | ||
590 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | ||
591 | /** | ||
592 | * @reimplemented | ||
593 | */ | ||
594 | virtual QSize minimumSizeHint() const; | ||
595 | /** | ||
596 | * @reimplemented | ||
597 | */ | ||
598 | virtual bool eventFilter(QObject*, QEvent*); | ||
599 | |||
600 | public slots: | ||
601 | /** | ||
602 | * Sets the value of the control. | ||
603 | */ | ||
604 | void setValue(double); | ||
605 | |||
606 | /** | ||
607 | * Sets the value in units of @ref #referencePoint. | ||
608 | * @since 3.1 | ||
609 | */ | ||
610 | void setRelativeValue(double); | ||
611 | |||
612 | /** | ||
613 | * Sets the reference Point to @p ref. It @p ref == 0, emitting of | ||
614 | * @ref #relativeValueChanged is blocked and @ref #relativeValue | ||
615 | * just returns 0. | ||
616 | * @since 3.1 | ||
617 | */ | ||
618 | void setReferencePoint(double ref); | ||
619 | |||
620 | /** | ||
621 | * Sets the suffix to be displayed to @p suffix. Use QString::null to disable | ||
622 | * this feature. Note that the suffix is attached to the value without any | ||
623 | * spacing. So if you prefer to display a space separator, set suffix | ||
624 | * to something like " cm". | ||
625 | * @see #setSuffix() | ||
626 | */ | ||
627 | void setSuffix(const QString &suffix); | ||
628 | |||
629 | /** | ||
630 | * Sets the prefix to be displayed to @p prefix. Use QString::null to disable | ||
631 | * this feature. Note that the prefix is attached to the value without any | ||
632 | * spacing. | ||
633 | * @see #setPrefix() | ||
634 | */ | ||
635 | void setPrefix(const QString &prefix); | ||
636 | |||
637 | signals: | ||
638 | /** | ||
639 | * Emitted every time the value changes (by calling @ref setValue() or | ||
640 | * by user interaction). | ||
641 | */ | ||
642 | void valueChanged(double); | ||
643 | /** | ||
644 | * This is an overloaded member function, provided for | ||
645 | * convenience. It essentially behaves like the above function. | ||
646 | * | ||
647 | * Contains the value in units of @ref #referencePoint. | ||
648 | * @since 3.1 | ||
649 | */ | ||
650 | void relativeValueChanged(double); | ||
651 | |||
652 | private slots: | ||
653 | void sliderMoved(int); | ||
654 | void slotEmitRelativeValueChanged(double); | ||
655 | |||
656 | protected: | ||
657 | |||
658 | /** | ||
659 | * @reimplemented | ||
660 | */ | ||
661 | virtual void doLayout(); | ||
662 | /** | ||
663 | * @reimplemented | ||
664 | */ | ||
665 | void resizeEvent ( QResizeEvent * ); | ||
666 | virtual void resetEditBox(); | ||
667 | |||
668 | // ### no longer used, remove when BIC allowed | ||
669 | KDoubleLine* edit; | ||
670 | |||
671 | bool m_range; | ||
672 | double m_lower, m_upper, m_step; | ||
673 | // ### end no longer used | ||
674 | |||
675 | QSize m_sizeEdit; | ||
676 | |||
677 | friend class KDoubleLine; | ||
678 | private: | ||
679 | void init(double value, double lower, double upper, | ||
680 | double step, int precision); | ||
681 | double mapSliderToSpin(int) const; | ||
682 | void updateLegacyMembers(); | ||
683 | // ### no longer used, remove when BIC allowed: | ||
684 | QString m_specialvalue, m_prefix, m_suffix; | ||
685 | double m_value; | ||
686 | short m_precision; | ||
687 | // ### end remove when BIC allowed | ||
688 | |||
689 | protected: | ||
690 | virtual void virtual_hook( int id, void* data ); | ||
691 | private: | ||
692 | class KDoubleNumInputPrivate; | ||
693 | KDoubleNumInputPrivate *d; | ||
694 | }; | ||
695 | |||
696 | |||
697 | /* ------------------------------------------------------------------------ */ | ||
698 | |||
699 | /** | ||
700 | * A @ref QSpinBox with support for arbitrary base numbers | ||
701 | * (e.g. hexadecimal). | ||
702 | * | ||
703 | * The class provides an easy interface to use other | ||
704 | * numeric systems then the decimal. | ||
705 | * | ||
706 | * @short A @ref QSpinBox with support for arbitrary base numbers. | ||
707 | */ | ||
708 | class KIntSpinBox : public QSpinBox | ||
709 | { | ||
710 | Q_OBJECT | ||
711 | Q_PROPERTY( int base READ base WRITE setBase ) | ||
712 | |||
713 | public: | ||
714 | |||
715 | /** | ||
716 | * Constructor. | ||
717 | * | ||
718 | * Constructs a widget with an integer inputline with a little scrollbar | ||
719 | * and a slider, with minimal value 0, maximal value 99, step 1, base 10 | ||
720 | * and initial value 0. | ||
721 | */ | ||
722 | KIntSpinBox( QWidget *parent=0, const char *name=0); | ||
723 | |||
724 | /** | ||
725 | * Constructor. | ||
726 | * | ||
727 | * Constructs a widget with an integer inputline with a little scrollbar | ||
728 | * and a slider. | ||
729 | * | ||
730 | * @param lower The lowest valid value. | ||
731 | * @param upper The greatest valid value. | ||
732 | * @param step The step size of the scrollbar. | ||
733 | * @param value The actual value. | ||
734 | * @param base The base of the used number system. | ||
735 | * @param parent The parent of the widget. | ||
736 | * @param name The Name of the widget. | ||
737 | */ | ||
738 | KIntSpinBox(int lower, int upper, int step, int value, int base = 10, | ||
739 | QWidget* parent = 0, const char* name = 0); | ||
740 | |||
741 | /** | ||
742 | * Destructor. | ||
743 | */ | ||
744 | virtual ~KIntSpinBox(); | ||
745 | |||
746 | /** | ||
747 | * Sets the base in which the numbers in the spin box are represented. | ||
748 | */ | ||
749 | void setBase(int base); | ||
750 | /** | ||
751 | * @return the base in which numbers in the spin box are represented. | ||
752 | */ | ||
753 | int base() const; | ||
754 | /** | ||
755 | * sets focus and optionally marks all text | ||
756 | * | ||
757 | */ | ||
758 | void setEditFocus(bool mark); | ||
759 | |||
760 | protected: | ||
761 | |||
762 | /** | ||
763 | * Overloaded the method in QSpinBox | ||
764 | * to make use of the base given in the constructor. | ||
765 | */ | ||
766 | virtual QString mapValueToText(int); | ||
767 | |||
768 | /** | ||
769 | * Overloaded the method in QSpinBox | ||
770 | * to make use of the base given in the constructor. | ||
771 | */ | ||
772 | virtual int mapTextToValue(bool*); | ||
773 | |||
774 | private: | ||
775 | int val_base; | ||
776 | protected: | ||
777 | virtual void virtual_hook( int id, void* data ); | ||
778 | private: | ||
779 | class KIntSpinBoxPrivate; | ||
780 | KIntSpinBoxPrivate *d; | ||
781 | }; | ||
782 | |||
783 | |||
784 | /* --------------------------------------------------------------------------- */ | ||
785 | |||
786 | /** | ||
787 | This class provides a spin box for fractional numbers. | ||
788 | |||
789 | @sect Parameters | ||
790 | |||
791 | There are a number of interdependent parameters whose relation to | ||
792 | each other you need to understand in order to make successful use | ||
793 | of the spin box. | ||
794 | |||
795 | @li precision: The number of decimals after the decimal point. | ||
796 | @li maxValue/minValue: upper and lower bound of the valid range | ||
797 | @li lineStep: the size of the step that is taken when the user hits | ||
798 | the up or down buttons | ||
799 | |||
800 | Since we work with fixed-point numbers internally, the maximum | ||
801 | precision is a function of the valid range and vice versa. More | ||
802 | precisely, the following relations hold: | ||
803 | <pre> | ||
804 | max( abs(minValue()), abs(maxValue() ) <= INT_MAX/10^precision | ||
805 | maxPrecision = floor( log10( INT_MAX/max(abs(minValue()),abs(maxValue())) ) ) | ||
806 | </pre> | ||
807 | |||
808 | Since the value, bounds and step are rounded to the current | ||
809 | precision, you may experience that the order of setting above | ||
810 | parameters matters. E.g. the following are @em not equivalent (try | ||
811 | it!): | ||
812 | |||
813 | <pre> | ||
814 | // sets precision, | ||
815 | // then min/max value (rounded to precison and clipped to obtainable range if needed) | ||
816 | // then value and lineStep | ||
817 | KDoubleSpinBox * spin = new KDoubleSpinBox( 0, 9.999, 0.001, 4.321, 3, this ); | ||
818 | |||
819 | // sets minValue to 0; maxValue to 10.00(!); value to 4.32(!) and only then | ||
820 | // increases the precision - too late, since e.g. value has already been rounded... | ||
821 | KDpubleSpinBox * spin = new KDoubleSpinBox( this ); | ||
822 | spin->setMinValue( 0 ); | ||
823 | spin->setMaxValue( 9.999 ); | ||
824 | spin->setValue( 4.321 ); | ||
825 | spin->setPrecision( 3 ); | ||
826 | </pre> | ||
827 | |||
828 | @short A spin box for fractional numbers. | ||
829 | @author Marc Mutz <mutz@kde.org> | ||
830 | @version $Id$ | ||
831 | @since 3.1 | ||
832 | **/ | ||
833 | |||
834 | class KDoubleSpinBox : public QSpinBox { | ||
835 | Q_OBJECT | ||
836 | Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers ) | ||
837 | Q_OVERRIDE( double maxValue READ maxValue WRITE setMaxValue ) | ||
838 | Q_OVERRIDE( double minValue READ minValue WRITE setMinValue ) | ||
839 | Q_OVERRIDE( double lineStep READ lineStep WRITE setLineStep ) | ||
840 | Q_OVERRIDE( double value READ value WRITE setValue ) | ||
841 | Q_PROPERTY( int precision READ precision WRITE setPrecision ) | ||
842 | |||
843 | public: | ||
844 | /** Constructs a @ref KDoubleSpinBox with parent @p parent and | ||
845 | default values for range and value (whatever @ref QRangeControl | ||
846 | uses) and precision (2). */ | ||
847 | KDoubleSpinBox( QWidget * parent=0, const char * name=0 ); | ||
848 | /** Constructs a @ref KDoubleSpinBox with parent @p parent, range | ||
849 | [@p lower,@p upper], @ref lineStep @p step, @ref precision @p | ||
850 | precision and initial value @p value. */ | ||
851 | KDoubleSpinBox( double lower, double upper, double step, double value, | ||
852 | int precision=2, QWidget * parent=0, const char * name=0 ); | ||
853 | |||
854 | virtual ~KDoubleSpinBox(); | ||
855 | |||
856 | /** @return whether the spinbox uses localized numbers */ | ||
857 | bool acceptLocalizedNumbers() const; | ||
858 | /** Sets whether to use and accept localized numbers as returned by | ||
859 | @ref KLocale::formatNumber() */ | ||
860 | virtual void setAcceptLocalizedNumbers( bool accept ); | ||
861 | |||
862 | /** Sets a new range for the spin box values. Note that @p lower, @p | ||
863 | upper and @p step are rounded to @p precision decimal points | ||
864 | first. */ | ||
865 | void setRange( double lower, double upper, double step=0.01, int precision=2 ); | ||
866 | |||
867 | /** @return the current number of decimal points displayed. */ | ||
868 | int precision() const; | ||
869 | /** Equivalent to @ref setPrecsion( @p precison, @p false ); Needed | ||
870 | since Qt's moc doesn't ignore trailing parameters with default | ||
871 | args when searching for a property setter method. */ | ||
872 | void setPrecision( int precision ); | ||
873 | /** Sets the number of decimal points to use. Note that there is a | ||
874 | tradeoff between the precision used and the available range of | ||
875 | values. See the class docs for more. | ||
876 | @param precision the new number of decimal points to use | ||
877 | |||
878 | @param force disables checking of bound violations that can | ||
879 | arise if you increase the precision so much that the | ||
880 | minimum and maximum values can't be represented | ||
881 | anymore. Disabling is useful if you don't want to keep | ||
882 | the current min and max values anyway. This is what | ||
883 | e.g. @ref setRange() does. | ||
884 | **/ | ||
885 | virtual void setPrecision( int precision, bool force ); | ||
886 | |||
887 | /** @return the current value */ | ||
888 | double value() const; | ||
889 | /** @return the current lower bound */ | ||
890 | double minValue() const; | ||
891 | /** Sets the lower bound of the range to @p value, subject to the | ||
892 | contraints that @p value is first rounded to the current | ||
893 | precision and then clipped to the maximum representable | ||
894 | interval. | ||
895 | @see maxValue, minValue, setMaxValue, setRange | ||
896 | */ | ||
897 | void setMinValue( double value ); | ||
898 | /** @return the current upper bound */ | ||
899 | double maxValue() const; | ||
900 | /** Sets the upper bound of the range to @p value, subject to the | ||
901 | contraints that @p value is first rounded to the current | ||
902 | precision and then clipped to the maximum representable | ||
903 | interval. | ||
904 | @see minValue, maxValue, setMinValue, setRange | ||
905 | */ | ||
906 | void setMaxValue( double value ); | ||
907 | |||
908 | /** @return the current step size */ | ||
909 | double lineStep() const; | ||
910 | /** Sets the step size for clicking the up/down buttons to @p step, | ||
911 | subject to the constraints that @p step is first rounded to the | ||
912 | current precision and then clipped to the meaningful interval | ||
913 | [1, @p maxValue - @p minValue]. */ | ||
914 | void setLineStep( double step ); | ||
915 | |||
916 | /** Overridden to ignore any setValidator() calls. */ | ||
917 | void setValidator( const QValidator * ); | ||
918 | |||
919 | signals: | ||
920 | /** Emitted whenever @ref QSpinBox::valueChanged( int ) is emitted. */ | ||
921 | void valueChanged( double value ); | ||
922 | |||
923 | public slots: | ||
924 | /** Sets the current value to @p value, cubject to the constraints | ||
925 | that @p value is frist rounded to the current precision and then | ||
926 | clipped to the interval [@p minvalue(),@p maxValue()]. */ | ||
927 | virtual void setValue( double value ); | ||
928 | |||
929 | protected: | ||
930 | virtual QString mapValueToText(int); | ||
931 | virtual int mapTextToValue(bool*); | ||
932 | |||
933 | protected slots: | ||
934 | void slotValueChanged( int value ); | ||
935 | |||
936 | protected: | ||
937 | virtual void virtual_hook( int id, void* data ); | ||
938 | private: | ||
939 | typedef QSpinBox base; | ||
940 | void updateValidator(); | ||
941 | int maxPrecision() const; | ||
942 | |||
943 | class Private; | ||
944 | Private * d; | ||
945 | }; | ||
946 | |||
947 | #endif // K_NUMINPUT_H | ||
diff --git a/noncore/settings/networksettings/ppp/knumvalidator.cpp b/noncore/settings/networksettings/ppp/knumvalidator.cpp deleted file mode 100644 index 44f7a60..0000000 --- a/noncore/settings/networksettings/ppp/knumvalidator.cpp +++ b/dev/null | |||
@@ -1,376 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** | ||
3 | ** $Id$ | ||
4 | ** | ||
5 | ** KIntValidator, KFloatValidator: | ||
6 | ** Copyright (C) 1999 Glen Parker <glenebob@nwlink.com> | ||
7 | ** KDoubleValidator: | ||
8 | ** Copyright (c) 2002 Marc Mutz <mutz@kde.org> | ||
9 | ** | ||
10 | ** This library is free software; you can redistribute it and/or | ||
11 | ** modify it under the terms of the GNU Library General Public | ||
12 | ** License as published by the Free Software Foundation; either | ||
13 | ** version 2 of the License, or (at your option) any later version. | ||
14 | ** | ||
15 | ** This library is distributed in the hope that it will be useful, | ||
16 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 | ** Library General Public License for more details. | ||
19 | ** | ||
20 | ** You should have received a copy of the GNU Library General Public | ||
21 | ** License along with this library; if not, write to the Free | ||
22 | ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | ** | ||
24 | *****************************************************************************/ | ||
25 | |||
26 | #include <qwidget.h> | ||
27 | #include <qstring.h> | ||
28 | |||
29 | #include "knumvalidator.h" | ||
30 | //#include <klocale.h> | ||
31 | #define i18n QObject::tr | ||
32 | //#include <kglobal.h> | ||
33 | //#include <kdebug.h> | ||
34 | |||
35 | /////////////////////////////////////////////////////////////// | ||
36 | // Implementation of KIntValidator | ||
37 | // | ||
38 | |||
39 | KIntValidator::KIntValidator ( QWidget * parent, int base, const char * name ) | ||
40 | : QValidator(parent, name) | ||
41 | { | ||
42 | _base = base; | ||
43 | if (_base < 2) _base = 2; | ||
44 | if (_base > 36) _base = 36; | ||
45 | |||
46 | _min = _max = 0; | ||
47 | } | ||
48 | |||
49 | KIntValidator::KIntValidator ( int bottom, int top, QWidget * parent, int base, const char * name ) | ||
50 | : QValidator(parent, name) | ||
51 | { | ||
52 | _base = base; | ||
53 | if (_base > 36) _base = 36; | ||
54 | |||
55 | _min = bottom; | ||
56 | _max = top; | ||
57 | } | ||
58 | |||
59 | KIntValidator::~KIntValidator () | ||
60 | {} | ||
61 | |||
62 | QValidator::State KIntValidator::validate ( QString &str, int & ) const | ||
63 | { | ||
64 | bool ok; | ||
65 | int val = 0; | ||
66 | QString newStr; | ||
67 | |||
68 | newStr = str.stripWhiteSpace(); | ||
69 | if (_base > 10) | ||
70 | newStr = newStr.upper(); | ||
71 | |||
72 | if (newStr == QString::fromLatin1("-")) // a special case | ||
73 | if ((_min || _max) && _min >= 0) | ||
74 | ok = false; | ||
75 | else | ||
76 | return QValidator::Acceptable; | ||
77 | else if (newStr.length()) | ||
78 | val = newStr.toInt(&ok, _base); | ||
79 | else { | ||
80 | val = 0; | ||
81 | ok = true; | ||
82 | } | ||
83 | |||
84 | if (! ok) | ||
85 | return QValidator::Invalid; | ||
86 | |||
87 | if ((! _min && ! _max) || (val >= _min && val <= _max)) | ||
88 | return QValidator::Acceptable; | ||
89 | |||
90 | if (_max && _min >= 0 && val < 0) | ||
91 | return QValidator::Invalid; | ||
92 | |||
93 | return QValidator::Valid; | ||
94 | } | ||
95 | |||
96 | void KIntValidator::fixup ( QString &str ) const | ||
97 | { | ||
98 | int dummy; | ||
99 | int val; | ||
100 | QValidator::State state; | ||
101 | |||
102 | state = validate(str, dummy); | ||
103 | |||
104 | if (state == QValidator::Invalid || state == QValidator::Acceptable) | ||
105 | return; | ||
106 | |||
107 | if (! _min && ! _max) | ||
108 | return; | ||
109 | |||
110 | val = str.toInt(0, _base); | ||
111 | |||
112 | if (val < _min) val = _min; | ||
113 | if (val > _max) val = _max; | ||
114 | |||
115 | str.setNum(val, _base); | ||
116 | } | ||
117 | |||
118 | void KIntValidator::setRange ( int bottom, int top ) | ||
119 | { | ||
120 | _min = bottom; | ||
121 | _max = top; | ||
122 | |||
123 | if (_max < _min) | ||
124 | _max = _min; | ||
125 | } | ||
126 | |||
127 | void KIntValidator::setBase ( int base ) | ||
128 | { | ||
129 | _base = base; | ||
130 | if (_base < 2) _base = 2; | ||
131 | } | ||
132 | |||
133 | int KIntValidator::bottom () const | ||
134 | { | ||
135 | return _min; | ||
136 | } | ||
137 | |||
138 | int KIntValidator::top () const | ||
139 | { | ||
140 | return _max; | ||
141 | } | ||
142 | |||
143 | int KIntValidator::base () const | ||
144 | { | ||
145 | return _base; | ||
146 | } | ||
147 | |||
148 | |||
149 | /////////////////////////////////////////////////////////////// | ||
150 | // Implementation of KFloatValidator | ||
151 | // | ||
152 | |||
153 | class KFloatValidatorPrivate | ||
154 | { | ||
155 | public: | ||
156 | KFloatValidatorPrivate() | ||
157 | { | ||
158 | } | ||
159 | ~KFloatValidatorPrivate() | ||
160 | { | ||
161 | } | ||
162 | bool acceptLocalizedNumbers; | ||
163 | }; | ||
164 | |||
165 | |||
166 | KFloatValidator::KFloatValidator ( QWidget * parent, const char * name ) | ||
167 | : QValidator(parent, name) | ||
168 | { | ||
169 | d = new KFloatValidatorPrivate; | ||
170 | d->acceptLocalizedNumbers=false; | ||
171 | _min = _max = 0; | ||
172 | } | ||
173 | |||
174 | KFloatValidator::KFloatValidator ( double bottom, double top, QWidget * parent, const char * name ) | ||
175 | : QValidator(parent, name) | ||
176 | { | ||
177 | d = new KFloatValidatorPrivate; | ||
178 | d->acceptLocalizedNumbers=false; | ||
179 | _min = bottom; | ||
180 | _max = top; | ||
181 | } | ||
182 | |||
183 | KFloatValidator::KFloatValidator ( double bottom, double top, bool localeAware, QWidget * parent, const char * name ) | ||
184 | : QValidator(parent, name) | ||
185 | { | ||
186 | d = new KFloatValidatorPrivate; | ||
187 | d->acceptLocalizedNumbers = localeAware; | ||
188 | _min = bottom; | ||
189 | _max = top; | ||
190 | } | ||
191 | |||
192 | KFloatValidator::~KFloatValidator () | ||
193 | { | ||
194 | delete d; | ||
195 | } | ||
196 | |||
197 | void KFloatValidator::setAcceptLocalizedNumbers(bool _b) | ||
198 | { | ||
199 | d->acceptLocalizedNumbers=_b; | ||
200 | } | ||
201 | |||
202 | bool KFloatValidator::acceptLocalizedNumbers() const | ||
203 | { | ||
204 | return d->acceptLocalizedNumbers; | ||
205 | } | ||
206 | |||
207 | //#include <kdebug.h> | ||
208 | QValidator::State KFloatValidator::validate ( QString &str, int & ) const | ||
209 | { | ||
210 | bool ok; | ||
211 | double val = 0; | ||
212 | QString newStr; | ||
213 | newStr = str.stripWhiteSpace(); | ||
214 | |||
215 | if (newStr == QString::fromLatin1("-")) // a special case | ||
216 | if ((_min || _max) && _min >= 0) | ||
217 | ok = false; | ||
218 | else | ||
219 | return QValidator::Acceptable; | ||
220 | else if (newStr == QString::fromLatin1(".") ) // FIXME :|| (d->acceptLocalizedNumbers && newStr==KGlobal::locale()->decimalSymbol())) // another special case | ||
221 | return QValidator::Acceptable; | ||
222 | else if (newStr.length()) | ||
223 | { | ||
224 | val = newStr.toDouble(&ok); | ||
225 | // if(!ok && d->acceptLocalizedNumbers) | ||
226 | // val= KGlobal::locale()->readNumber(newStr,&ok); | ||
227 | } | ||
228 | else { | ||
229 | val = 0; | ||
230 | ok = true; | ||
231 | } | ||
232 | |||
233 | if (! ok) | ||
234 | return QValidator::Invalid; | ||
235 | |||
236 | if (( !_min && !_max) || (val >= _min && val <= _max)) | ||
237 | return QValidator::Acceptable; | ||
238 | |||
239 | if (_max && _min >= 0 && val < 0) | ||
240 | return QValidator::Invalid; | ||
241 | |||
242 | if ( (_min || _max) && (val < _min || val > _max)) | ||
243 | return QValidator::Invalid; | ||
244 | |||
245 | return QValidator::Valid; | ||
246 | } | ||
247 | |||
248 | void KFloatValidator::fixup ( QString &str ) const | ||
249 | { | ||
250 | int dummy; | ||
251 | double val; | ||
252 | QValidator::State state; | ||
253 | |||
254 | state = validate(str, dummy); | ||
255 | |||
256 | if (state == QValidator::Invalid || state == QValidator::Acceptable) | ||
257 | return; | ||
258 | |||
259 | if (! _min && ! _max) | ||
260 | return; | ||
261 | |||
262 | val = str.toDouble(); | ||
263 | |||
264 | if (val < _min) val = _min; | ||
265 | if (val > _max) val = _max; | ||
266 | |||
267 | str.setNum(val); | ||
268 | } | ||
269 | |||
270 | void KFloatValidator::setRange ( double bottom, double top ) | ||
271 | { | ||
272 | _min = bottom; | ||
273 | _max = top; | ||
274 | |||
275 | if (_max < _min) | ||
276 | _max = _min; | ||
277 | } | ||
278 | |||
279 | double KFloatValidator::bottom () const | ||
280 | { | ||
281 | return _min; | ||
282 | } | ||
283 | |||
284 | double KFloatValidator::top () const | ||
285 | { | ||
286 | return _max; | ||
287 | } | ||
288 | |||
289 | |||
290 | |||
291 | |||
292 | /////////////////////////////////////////////////////////////// | ||
293 | // Implementation of KDoubleValidator | ||
294 | // | ||
295 | |||
296 | class KDoubleValidator::Private { | ||
297 | public: | ||
298 | Private( bool accept=false ) : acceptLocalizedNumbers( accept ) {} | ||
299 | |||
300 | bool acceptLocalizedNumbers; | ||
301 | }; | ||
302 | |||
303 | //KDoubleValidator::KDoubleValidator( QObject * parent, const char * name ) | ||
304 | KDoubleValidator::KDoubleValidator( QWidget * parent, const char * name ) | ||
305 | : QDoubleValidator( parent, name ), d( 0 ) | ||
306 | { | ||
307 | d = new Private(); | ||
308 | } | ||
309 | |||
310 | KDoubleValidator::KDoubleValidator( double bottom, double top, int decimals, | ||
311 | // QObject * parent, const char * name ) | ||
312 | QWidget * parent, const char * name ) | ||
313 | : QDoubleValidator( bottom, top, decimals, parent, name ), d( 0 ) | ||
314 | { | ||
315 | d = new Private(); | ||
316 | } | ||
317 | |||
318 | KDoubleValidator::~KDoubleValidator() | ||
319 | { | ||
320 | delete d; | ||
321 | } | ||
322 | |||
323 | bool KDoubleValidator::acceptLocalizedNumbers() const { | ||
324 | return d->acceptLocalizedNumbers; | ||
325 | } | ||
326 | |||
327 | void KDoubleValidator::setAcceptLocalizedNumbers( bool accept ) { | ||
328 | d->acceptLocalizedNumbers = accept; | ||
329 | } | ||
330 | |||
331 | QValidator::State KDoubleValidator::validate( QString & input, int & p ) const { | ||
332 | QString s = input; | ||
333 | if ( acceptLocalizedNumbers() ) { | ||
334 | // KLocale * l = KGlobal::locale(); | ||
335 | // ok, we have to re-format the number to have: | ||
336 | // 1. decimalSymbol == '.' | ||
337 | // 2. negativeSign == '-' | ||
338 | // 3. positiveSign == <empty> | ||
339 | // 4. thousandsSeparator() == <empty> (we don't check that there | ||
340 | // are exactly three decimals between each separator): | ||
341 | QString d = ".",//l->decimalSymbol(), | ||
342 | n = "-",//l->negativeSign(), | ||
343 | p = "", //l->positiveSign(), | ||
344 | t = "";//l->thousandsSeparator(); | ||
345 | // first, delete p's and t's: | ||
346 | if ( !p.isEmpty() ) | ||
347 | for ( int idx = s.find( p ) ; idx >= 0 ; idx = s.find( p, idx ) ) | ||
348 | s.remove( idx, p.length() ); | ||
349 | |||
350 | |||
351 | if ( !t.isEmpty() ) | ||
352 | for ( int idx = s.find( t ) ; idx >= 0 ; idx = s.find( t, idx ) ) | ||
353 | s.remove( idx, t.length() ); | ||
354 | |||
355 | // then, replace the d's and n's | ||
356 | if ( ( !n.isEmpty() && n.find('.') != -1 ) || | ||
357 | ( !d.isEmpty() && d.find('-') != -1 ) ) { | ||
358 | // make sure we don't replace something twice: | ||
359 | // kdWarning() << "KDoubleValidator: decimal symbol contains '-' or " | ||
360 | // "negative sign contains '.' -> improve algorithm" << endl; | ||
361 | return Invalid; | ||
362 | } | ||
363 | |||
364 | if ( !d.isEmpty() && d != "." ) | ||
365 | for ( int idx = s.find( d ) ; idx >= 0 ; idx = s.find( d, idx + 1 ) ) | ||
366 | s.replace( idx, d.length(), "."); | ||
367 | |||
368 | if ( !n.isEmpty() && n != "-" ) | ||
369 | for ( int idx = s.find( n ) ; idx >= 0 ; idx = s.find( n, idx + 1 ) ) | ||
370 | s.replace( idx, n.length(), "-" ); | ||
371 | } | ||
372 | |||
373 | return base::validate( s, p ); | ||
374 | } | ||
375 | |||
376 | //#include "knumvalidator.moc" | ||
diff --git a/noncore/settings/networksettings/ppp/knumvalidator.h b/noncore/settings/networksettings/ppp/knumvalidator.h deleted file mode 100644 index c95293a..0000000 --- a/noncore/settings/networksettings/ppp/knumvalidator.h +++ b/dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** | ||
3 | ** $Id$ | ||
4 | ** | ||
5 | ** Copyright (C) 1999 Glen Parker <glenebob@nwlink.com> | ||
6 | ** Copyright (C) 2002 Marc Mutz <mutz@kde.org> | ||
7 | ** | ||
8 | ** This library is free software; you can redistribute it and/or | ||
9 | ** modify it under the terms of the GNU Library General Public | ||
10 | ** License as published by the Free Software Foundation; either | ||
11 | ** version 2 of the License, or (at your option) any later version. | ||
12 | ** | ||
13 | ** This library is distributed in the hope that it will be useful, | ||
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | ** Library General Public License for more details. | ||
17 | ** | ||
18 | ** You should have received a copy of the GNU Library General Public | ||
19 | ** License along with this library; if not, write to the Free | ||
20 | ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | ** | ||
22 | *****************************************************************************/ | ||
23 | |||
24 | #ifndef __KNUMVALIDATOR_H | ||
25 | #define __KNUMVALIDATOR_H | ||
26 | |||
27 | #include <qvalidator.h> | ||
28 | |||
29 | class QWidget; | ||
30 | class QString; | ||
31 | |||
32 | /** | ||
33 | * @ref QValidator for integers. | ||
34 | |||
35 | This can be used by @ref QLineEdit or subclass to provide validated | ||
36 | text entry. Can be provided with a base value (default is 10), to allow | ||
37 | the proper entry of hexadecimal, octal, or any other base numeric data. | ||
38 | |||
39 | @author Glen Parker <glenebob@nwlink.com> | ||
40 | @version 0.0.1 | ||
41 | */ | ||
42 | class KIntValidator : public QValidator { | ||
43 | |||
44 | public: | ||
45 | /** | ||
46 | Constuctor. Also sets the base value. | ||
47 | */ | ||
48 | KIntValidator ( QWidget * parent, int base = 10, const char * name = 0 ); | ||
49 | /** | ||
50 | * Constructor. Also sets the minimum, maximum, and numeric base values. | ||
51 | */ | ||
52 | KIntValidator ( int bottom, int top, QWidget * parent, int base = 10, const char * name = 0 ); | ||
53 | /** | ||
54 | * Destructs the validator. | ||
55 | */ | ||
56 | virtual ~KIntValidator (); | ||
57 | /** | ||
58 | * Validates the text, and return the result. Does not modify the parameters. | ||
59 | */ | ||
60 | virtual State validate ( QString &, int & ) const; | ||
61 | /** | ||
62 | * Fixes the text if possible, providing a valid string. The parameter may be modified. | ||
63 | */ | ||
64 | virtual void fixup ( QString & ) const; | ||
65 | /** | ||
66 | * Sets the minimum and maximum values allowed. | ||
67 | */ | ||
68 | virtual void setRange ( int bottom, int top ); | ||
69 | /** | ||
70 | * Sets the numeric base value. | ||
71 | */ | ||
72 | virtual void setBase ( int base ); | ||
73 | /** | ||
74 | * Returns the current minimum value allowed. | ||
75 | */ | ||
76 | virtual int bottom () const; | ||
77 | /** | ||
78 | * Returns the current maximum value allowed. | ||
79 | */ | ||
80 | virtual int top () const; | ||
81 | /** | ||
82 | * Returns the current numeric base. | ||
83 | */ | ||
84 | virtual int base () const; | ||
85 | |||
86 | private: | ||
87 | int _base; | ||
88 | int _min; | ||
89 | int _max; | ||
90 | |||
91 | }; | ||
92 | |||
93 | class KFloatValidatorPrivate; | ||
94 | |||
95 | /** | ||
96 | @obsolete Use @ref KDoubleValidator | ||
97 | |||
98 | @ref QValidator for floating point entry. | ||
99 | Extends the QValidator class to properly validate double numeric data. | ||
100 | This can be used by @ref QLineEdit or subclass to provide validated | ||
101 | text entry. | ||
102 | |||
103 | @author Glen Parker <glenebob@nwlink.com> | ||
104 | @version 0.0.1 | ||
105 | */ | ||
106 | class KFloatValidator : public QValidator { | ||
107 | |||
108 | public: | ||
109 | /** | ||
110 | * Constructor. | ||
111 | */ | ||
112 | KFloatValidator ( QWidget * parent, const char * name = 0 ); | ||
113 | /** | ||
114 | * Constructor. Also sets the minimum and maximum values. | ||
115 | */ | ||
116 | KFloatValidator ( double bottom, double top, QWidget * parent, const char * name = 0 ); | ||
117 | /** | ||
118 | * Constructor. Sets the validator to be locale aware if @p localeAware is true. | ||
119 | */ | ||
120 | KFloatValidator ( double bottom, double top, bool localeAware, QWidget * parent, const char * name = 0 ); | ||
121 | /** | ||
122 | * Destructs the validator. | ||
123 | */ | ||
124 | virtual ~KFloatValidator (); | ||
125 | /** | ||
126 | * Validates the text, and return the result. Does not modify the parameters. | ||
127 | */ | ||
128 | virtual State validate ( QString &, int & ) const; | ||
129 | /** | ||
130 | * Fixes the text if possible, providing a valid string. The parameter may be modified. | ||
131 | */ | ||
132 | virtual void fixup ( QString & ) const; | ||
133 | /** | ||
134 | * Sets the minimum and maximum value allowed. | ||
135 | */ | ||
136 | virtual void setRange ( double bottom, double top ); | ||
137 | /** | ||
138 | * Returns the current minimum value allowed. | ||
139 | */ | ||
140 | virtual double bottom () const; | ||
141 | /** | ||
142 | * Returns the current maximum value allowed. | ||
143 | */ | ||
144 | virtual double top () const; | ||
145 | /** | ||
146 | * Sets the validator to be locale aware if @p is true. In this case, the | ||
147 | * character KLocale::decimalSymbol() from the global locale is recognized | ||
148 | * as decimal separator. | ||
149 | */ | ||
150 | void setAcceptLocalizedNumbers(bool b); | ||
151 | /** | ||
152 | * Returns true if the validator is locale aware. | ||
153 | * @see setAcceptLocalizedNumbers(). | ||
154 | */ | ||
155 | bool acceptLocalizedNumbers() const; | ||
156 | |||
157 | private: | ||
158 | double _min; | ||
159 | double _max; | ||
160 | |||
161 | KFloatValidatorPrivate *d; | ||
162 | }; | ||
163 | |||
164 | /** | ||
165 | KDoubleValidator extends @ref QDoubleValidator to be | ||
166 | locale-aware. That means that - subject to not being disabled - | ||
167 | @ref KLocale::decimalPoint(), @ref KLocale::thousandsSeparator() | ||
168 | and @ref KLocale::positiveSign() and @ref KLocale::negativeSign() | ||
169 | are respected. | ||
170 | |||
171 | @short A locale-aware @ref QDoubleValidator | ||
172 | @author Marc Mutz <mutz@kde.org> | ||
173 | @version $Id$ | ||
174 | @see KIntValidator | ||
175 | @since 3.1 | ||
176 | **/ | ||
177 | |||
178 | class KDoubleValidator : public QDoubleValidator { | ||
179 | Q_OBJECT | ||
180 | Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers ) | ||
181 | public: | ||
182 | /** Constuct a locale-aware KDoubleValidator with default range | ||
183 | (whatever @ref QDoubleValidator uses for that) and parent @p | ||
184 | parent */ | ||
185 | // KDoubleValidator( QObject * parent, const char * name=0 ); | ||
186 | KDoubleValidator( QWidget * parent, const char * name=0 ); | ||
187 | /** Constuct a locale-aware KDoubleValidator for range [@p bottom,@p | ||
188 | top] and a precision of @p decimals decimals after the decimal | ||
189 | point. */ | ||
190 | KDoubleValidator( double bottom, double top, int decimals, | ||
191 | QWidget * parent, const char * name=0 ); | ||
192 | // QObject * parent, const char * name=0 ); | ||
193 | /** Destructs the validator. | ||
194 | */ | ||
195 | virtual ~KDoubleValidator(); | ||
196 | |||
197 | /** Overloaded for internal reasons. The API is not affected. */ | ||
198 | virtual QValidator::State validate( QString & input, int & pos ) const; | ||
199 | |||
200 | /** @return whether localized numbers are accepted (default: true) */ | ||
201 | bool acceptLocalizedNumbers() const; | ||
202 | /** Sets whether to accept localized numbers (default: true) */ | ||
203 | void setAcceptLocalizedNumbers( bool accept ); | ||
204 | |||
205 | private: | ||
206 | typedef QDoubleValidator base; | ||
207 | class Private; | ||
208 | Private * d; | ||
209 | }; | ||
210 | |||
211 | #endif | ||
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro index a2e0118..e3c58d6 100644 --- a/noncore/settings/networksettings/ppp/ppp.pro +++ b/noncore/settings/networksettings/ppp/ppp.pro | |||
@@ -4,8 +4,10 @@ TEMPLATE = lib | |||
4 | #CONFIG += qt warn_on release | 4 | #CONFIG += qt warn_on release |
5 | CONFIG += qt warn_on debug | 5 | CONFIG += qt warn_on debug |
6 | DESTDIR = $(OPIEDIR)/plugins/networksettings | 6 | DESTDIR = $(OPIEDIR)/plugins/networksettings |
7 | HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h | 7 | HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h |
8 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp | 8 | # knuminput.h knumvalidator.h |
9 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp | ||
10 | #knuminput.cpp knumvalidator.cpp | ||
9 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ | 11 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ |
10 | DEPENDPATH+= $(OPIEDIR)/include | 12 | DEPENDPATH+= $(OPIEDIR)/include |
11 | LIBS += -lqpe -L../interfaces/ -linterfaces | 13 | LIBS += -lqpe -L../interfaces/ -linterfaces |