-rw-r--r-- | core/launcher/qprocess.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiecore/oconfig.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/odebug.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/okeyconfigmanager.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/okeyfilter.h | 8 | ||||
-rw-r--r-- | libopie2/opiecore/opluginloader.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiecore/oprocess.h | 8 | ||||
-rw-r--r-- | libopie2/opieui/oimageeffect.h | 6 | ||||
-rw-r--r-- | libopie2/opieui/opixmapeffect.h | 11 | ||||
-rw-r--r-- | libopie2/qt3/opieui/ocombobox.h | 4 | ||||
-rw-r--r-- | libopie2/qt3/opieui/olineedit.h | 6 |
12 files changed, 33 insertions, 37 deletions
diff --git a/core/launcher/qprocess.cpp b/core/launcher/qprocess.cpp index 3fe1238..aef7967 100644 --- a/core/launcher/qprocess.cpp +++ b/core/launcher/qprocess.cpp | |||
@@ -16,97 +16,97 @@ | |||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | 23 | ||
24 | #include "qprocess.h" | 24 | #include "qprocess.h" |
25 | 25 | ||
26 | #ifndef QT_NO_PROCESS | 26 | #ifndef QT_NO_PROCESS |
27 | 27 | ||
28 | #include "qapplication.h" | 28 | #include "qapplication.h" |
29 | 29 | ||
30 | 30 | ||
31 | //#define QT_QPROCESS_DEBUG | 31 | //#define QT_QPROCESS_DEBUG |
32 | 32 | ||
33 | 33 | ||
34 | /*! | 34 | /*! |
35 | \class QProcess qprocess.h | 35 | \class QProcess qprocess.h |
36 | 36 | ||
37 | \brief The QProcess class is used to start external programs and to | 37 | \brief The QProcess class is used to start external programs and to |
38 | communicate with them. | 38 | communicate with them. |
39 | 39 | ||
40 | This is a temporary class. This will be replaced by Qt 3's QProcess class. | 40 | This is a temporary class. This will be replaced by Qt 3's QProcess class. |
41 | 41 | ||
42 | \ingroup qtopiaemb | 42 | \ingroup qtopiaemb |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /*! | 45 | /*! |
46 | \enum QProcess::Communication | 46 | \enum QProcess::Communication |
47 | 47 | ||
48 | This enum type defines the communication channels connected to the | 48 | This enum type defines the communication channels connected to the |
49 | process. | 49 | process. |
50 | 50 | ||
51 | \value Stdin Data can be written to the process's standard input. | 51 | \value Stdin Data can be written to the process's standard input. |
52 | 52 | ||
53 | \value Stdout Data can be read from the process's standard output. | 53 | \value Stdout Data can be read from the process's standard output. |
54 | 54 | ||
55 | \value Stderr Data can be read from the process's standard error. | 55 | \value Stderr Data can be read from the process's standard error. |
56 | 56 | ||
57 | \value DupStderr Duplicates standard error to standard output for new | 57 | \value DupStderr Duplicates standard error to standard output for new |
58 | processes; i.e. everything that the process writes to standard error, is | 58 | processes; i.e. everything that the process writes to standard error, is |
59 | reported by QProcess on standard output instead. This is especially useful if | 59 | reported by QProcess on standard output instead. This is especially useful if |
60 | your application requires that the output on standard output and standard | 60 | your application requires that the output on standard output and standard |
61 | error is read in the same order as the process output it. Please note that | 61 | error is read in the same order as the process output it. Please note that |
62 | this is a binary flag, so if you want to activate this together with standard | 62 | this is a binary flag, so if you want to activate this together with standard |
63 | input, output and error redirection (the default), you have to specify | 63 | input, output and error redirection (the default), you have to specify |
64 | \c{Stdin|Stdout|Stderr|DupStderr} for the setCommunication() call. | 64 | \c {Stdin|Stdout|Stderr|DupStderr} for the setCommunication() call. |
65 | 65 | ||
66 | \sa setCommunication() communication() | 66 | \sa setCommunication() communication() |
67 | */ | 67 | */ |
68 | 68 | ||
69 | /*! | 69 | /*! |
70 | Constructs a QProcess object. The \a parent and \a name parameters are passed | 70 | Constructs a QProcess object. The \a parent and \a name parameters are passed |
71 | to the QObject constructor. | 71 | to the QObject constructor. |
72 | 72 | ||
73 | \sa setArguments() addArgument() start() | 73 | \sa setArguments() addArgument() start() |
74 | */ | 74 | */ |
75 | QProcess::QProcess( QObject *parent, const char *name ) | 75 | QProcess::QProcess( QObject *parent, const char *name ) |
76 | : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), | 76 | : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), |
77 | wroteToStdinConnected( FALSE ), | 77 | wroteToStdinConnected( FALSE ), |
78 | readStdoutCalled( FALSE ), readStderrCalled( FALSE ), | 78 | readStdoutCalled( FALSE ), readStderrCalled( FALSE ), |
79 | comms( Stdin|Stdout|Stderr ) | 79 | comms( Stdin|Stdout|Stderr ) |
80 | { | 80 | { |
81 | init(); | 81 | init(); |
82 | } | 82 | } |
83 | 83 | ||
84 | /*! | 84 | /*! |
85 | Constructs a QProcess with \a arg0 as the command to be executed. The | 85 | Constructs a QProcess with \a arg0 as the command to be executed. The |
86 | \a parent and \a name parameters are passed to the QObject constructor. | 86 | \a parent and \a name parameters are passed to the QObject constructor. |
87 | 87 | ||
88 | The process is not started. You must call start() or launch() | 88 | The process is not started. You must call start() or launch() |
89 | to start the process. | 89 | to start the process. |
90 | 90 | ||
91 | \sa setArguments() addArgument() start() | 91 | \sa setArguments() addArgument() start() |
92 | */ | 92 | */ |
93 | QProcess::QProcess( const QString& arg0, QObject *parent, const char *name ) | 93 | QProcess::QProcess( const QString& arg0, QObject *parent, const char *name ) |
94 | : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), | 94 | : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ), |
95 | wroteToStdinConnected( FALSE ), | 95 | wroteToStdinConnected( FALSE ), |
96 | readStdoutCalled( FALSE ), readStderrCalled( FALSE ), | 96 | readStdoutCalled( FALSE ), readStderrCalled( FALSE ), |
97 | comms( Stdin|Stdout|Stderr ) | 97 | comms( Stdin|Stdout|Stderr ) |
98 | { | 98 | { |
99 | init(); | 99 | init(); |
100 | addArgument( arg0 ); | 100 | addArgument( arg0 ); |
101 | } | 101 | } |
102 | 102 | ||
103 | /*! | 103 | /*! |
104 | Constructs a QProcess with \a args as the arguments of the process. The first | 104 | Constructs a QProcess with \a args as the arguments of the process. The first |
105 | element in the list is the command to be executed. The other elements in the | 105 | element in the list is the command to be executed. The other elements in the |
106 | list are the arguments to this command. The \a parent and \a name | 106 | list are the arguments to this command. The \a parent and \a name |
107 | parameters are passed to the QObject constructor. | 107 | parameters are passed to the QObject constructor. |
108 | 108 | ||
109 | The process is not started. You must call start() or launch() | 109 | The process is not started. You must call start() or launch() |
110 | to start the process. | 110 | to start the process. |
111 | 111 | ||
112 | \sa setArguments() addArgument() start() | 112 | \sa setArguments() addArgument() start() |
@@ -167,97 +167,97 @@ void QProcess::setArguments( const QStringList& args ) | |||
167 | void QProcess::addArgument( const QString& arg ) | 167 | void QProcess::addArgument( const QString& arg ) |
168 | { | 168 | { |
169 | _arguments.append( arg ); | 169 | _arguments.append( arg ); |
170 | } | 170 | } |
171 | 171 | ||
172 | #ifndef QT_NO_DIR | 172 | #ifndef QT_NO_DIR |
173 | /*! | 173 | /*! |
174 | Returns the working directory that was set with | 174 | Returns the working directory that was set with |
175 | setWorkingDirectory(), or the current directory if none has been | 175 | setWorkingDirectory(), or the current directory if none has been |
176 | set. | 176 | set. |
177 | 177 | ||
178 | \sa setWorkingDirectory() QDir::current() | 178 | \sa setWorkingDirectory() QDir::current() |
179 | */ | 179 | */ |
180 | QDir QProcess::workingDirectory() const | 180 | QDir QProcess::workingDirectory() const |
181 | { | 181 | { |
182 | return workingDir; | 182 | return workingDir; |
183 | } | 183 | } |
184 | 184 | ||
185 | /*! | 185 | /*! |
186 | Sets \a dir as the working directory for a process. This does not affect | 186 | Sets \a dir as the working directory for a process. This does not affect |
187 | running processes; only processes that are started afterwards are affected. | 187 | running processes; only processes that are started afterwards are affected. |
188 | 188 | ||
189 | Setting the working directory is especially useful for processes that try to | 189 | Setting the working directory is especially useful for processes that try to |
190 | access files with relative filenames. | 190 | access files with relative filenames. |
191 | 191 | ||
192 | \sa workingDirectory() start() | 192 | \sa workingDirectory() start() |
193 | */ | 193 | */ |
194 | void QProcess::setWorkingDirectory( const QDir& dir ) | 194 | void QProcess::setWorkingDirectory( const QDir& dir ) |
195 | { | 195 | { |
196 | workingDir = dir; | 196 | workingDir = dir; |
197 | } | 197 | } |
198 | #endif //QT_NO_DIR | 198 | #endif //QT_NO_DIR |
199 | 199 | ||
200 | /*! | 200 | /*! |
201 | Returns the communication required with the process. | 201 | Returns the communication required with the process. |
202 | 202 | ||
203 | \sa setCommunication() | 203 | \sa setCommunication() |
204 | */ | 204 | */ |
205 | int QProcess::communication() const | 205 | int QProcess::communication() const |
206 | { | 206 | { |
207 | return comms; | 207 | return comms; |
208 | } | 208 | } |
209 | 209 | ||
210 | /*! | 210 | /*! |
211 | Sets \a commFlags as the communication required with the process. | 211 | Sets \a commFlags as the communication required with the process. |
212 | 212 | ||
213 | \a commFlags is a bitwise OR between the flags defined in \c Communication. | 213 | \a commFlags is a bitwise OR between the flags defined in \c Communication. |
214 | 214 | ||
215 | The default is \c{Stdin|Stdout|Stderr}. | 215 | The default is \c {Stdin|Stdout|Stderr}. |
216 | 216 | ||
217 | \sa communication() | 217 | \sa communication() |
218 | */ | 218 | */ |
219 | void QProcess::setCommunication( int commFlags ) | 219 | void QProcess::setCommunication( int commFlags ) |
220 | { | 220 | { |
221 | comms = commFlags; | 221 | comms = commFlags; |
222 | } | 222 | } |
223 | 223 | ||
224 | /*! | 224 | /*! |
225 | Returns TRUE if the process has exited normally; otherwise returns | 225 | Returns TRUE if the process has exited normally; otherwise returns |
226 | FALSE. This implies that this function returns FALSE if the process | 226 | FALSE. This implies that this function returns FALSE if the process |
227 | is still running. | 227 | is still running. |
228 | 228 | ||
229 | \sa isRunning() exitStatus() processExited() | 229 | \sa isRunning() exitStatus() processExited() |
230 | */ | 230 | */ |
231 | bool QProcess::normalExit() const | 231 | bool QProcess::normalExit() const |
232 | { | 232 | { |
233 | // isRunning() has the side effect that it determines the exit status! | 233 | // isRunning() has the side effect that it determines the exit status! |
234 | if ( isRunning() ) | 234 | if ( isRunning() ) |
235 | return FALSE; | 235 | return FALSE; |
236 | else | 236 | else |
237 | return exitNormal; | 237 | return exitNormal; |
238 | } | 238 | } |
239 | 239 | ||
240 | /*! | 240 | /*! |
241 | Returns the exit status of the process or 0 if the process is still | 241 | Returns the exit status of the process or 0 if the process is still |
242 | running. This function returns immediately and does not wait until | 242 | running. This function returns immediately and does not wait until |
243 | the process is finished. | 243 | the process is finished. |
244 | 244 | ||
245 | If normalExit() is FALSE (e.g. if the program was killed or | 245 | If normalExit() is FALSE (e.g. if the program was killed or |
246 | crashed), this function returns 0, so you should check the return | 246 | crashed), this function returns 0, so you should check the return |
247 | value of normalExit() before relying on this value. | 247 | value of normalExit() before relying on this value. |
248 | 248 | ||
249 | \sa normalExit() processExited() | 249 | \sa normalExit() processExited() |
250 | */ | 250 | */ |
251 | int QProcess::exitStatus() const | 251 | int QProcess::exitStatus() const |
252 | { | 252 | { |
253 | // isRunning() has the side effect that it determines the exit status! | 253 | // isRunning() has the side effect that it determines the exit status! |
254 | if ( isRunning() ) | 254 | if ( isRunning() ) |
255 | return 0; | 255 | return 0; |
256 | else | 256 | else |
257 | return exitStat; | 257 | return exitStat; |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
261 | /*! | 261 | /*! |
262 | Reads the data that the process has written to standard output. When | 262 | Reads the data that the process has written to standard output. When |
263 | new data is written to standard output, the class emits the signal | 263 | new data is written to standard output, the class emits the signal |
@@ -326,97 +326,97 @@ bool QProcess::canReadLineStdout() const | |||
326 | */ | 326 | */ |
327 | bool QProcess::canReadLineStderr() const | 327 | bool QProcess::canReadLineStderr() const |
328 | { | 328 | { |
329 | QProcess *that = (QProcess*)this; | 329 | QProcess *that = (QProcess*)this; |
330 | return that->scanNewline( FALSE, 0 ); | 330 | return that->scanNewline( FALSE, 0 ); |
331 | } | 331 | } |
332 | 332 | ||
333 | /*! | 333 | /*! |
334 | Reads a line of text from standard output, excluding any trailing newline or | 334 | Reads a line of text from standard output, excluding any trailing newline or |
335 | carriage return characters, and returns it. Returns QString::null if | 335 | carriage return characters, and returns it. Returns QString::null if |
336 | canReadLineStdout() returns FALSE. | 336 | canReadLineStdout() returns FALSE. |
337 | 337 | ||
338 | \sa canReadLineStdout() readyReadStdout() readStdout() readLineStderr() | 338 | \sa canReadLineStdout() readyReadStdout() readStdout() readLineStderr() |
339 | */ | 339 | */ |
340 | QString QProcess::readLineStdout() | 340 | QString QProcess::readLineStdout() |
341 | { | 341 | { |
342 | QByteArray a; | 342 | QByteArray a; |
343 | QString s; | 343 | QString s; |
344 | if ( scanNewline( TRUE, &a ) ) { | 344 | if ( scanNewline( TRUE, &a ) ) { |
345 | if ( a.isEmpty() ) | 345 | if ( a.isEmpty() ) |
346 | s = ""; | 346 | s = ""; |
347 | else | 347 | else |
348 | s = QString( a ); | 348 | s = QString( a ); |
349 | } | 349 | } |
350 | return s; | 350 | return s; |
351 | } | 351 | } |
352 | 352 | ||
353 | /*! | 353 | /*! |
354 | Reads a line of text from standard error, excluding any trailing newline or | 354 | Reads a line of text from standard error, excluding any trailing newline or |
355 | carriage return characters and returns it. Returns QString::null if | 355 | carriage return characters and returns it. Returns QString::null if |
356 | canReadLineStderr() returns FALSE. | 356 | canReadLineStderr() returns FALSE. |
357 | 357 | ||
358 | \sa canReadLineStderr() readyReadStderr() readStderr() readLineStdout() | 358 | \sa canReadLineStderr() readyReadStderr() readStderr() readLineStdout() |
359 | */ | 359 | */ |
360 | QString QProcess::readLineStderr() | 360 | QString QProcess::readLineStderr() |
361 | { | 361 | { |
362 | QByteArray a; | 362 | QByteArray a; |
363 | QString s; | 363 | QString s; |
364 | if ( scanNewline( FALSE, &a ) ) { | 364 | if ( scanNewline( FALSE, &a ) ) { |
365 | if ( a.isEmpty() ) | 365 | if ( a.isEmpty() ) |
366 | s = ""; | 366 | s = ""; |
367 | else | 367 | else |
368 | s = QString( a ); | 368 | s = QString( a ); |
369 | } | 369 | } |
370 | return s; | 370 | return s; |
371 | } | 371 | } |
372 | 372 | ||
373 | /*! | 373 | /*! |
374 | This private function scans for any occurrence of \n or \r\n in the | 374 | This private function scans for any occurrence of \\n or \\r\\n in the |
375 | buffer \e buf. It stores the text in the byte array \a store if it is | 375 | buffer \e buf. It stores the text in the byte array \a store if it is |
376 | non-null. | 376 | non-null. |
377 | */ | 377 | */ |
378 | bool QProcess::scanNewline( bool stdOut, QByteArray *store ) | 378 | bool QProcess::scanNewline( bool stdOut, QByteArray *store ) |
379 | { | 379 | { |
380 | QByteArray *buf; | 380 | QByteArray *buf; |
381 | if ( stdOut ) | 381 | if ( stdOut ) |
382 | buf = bufStdout(); | 382 | buf = bufStdout(); |
383 | else | 383 | else |
384 | buf = bufStderr(); | 384 | buf = bufStderr(); |
385 | uint n = buf->size(); | 385 | uint n = buf->size(); |
386 | uint i; | 386 | uint i; |
387 | for ( i=0; i<n; i++ ) { | 387 | for ( i=0; i<n; i++ ) { |
388 | if ( buf->at(i) == '\n' ) { | 388 | if ( buf->at(i) == '\n' ) { |
389 | break; | 389 | break; |
390 | } | 390 | } |
391 | } | 391 | } |
392 | if ( i >= n ) | 392 | if ( i >= n ) |
393 | return FALSE; | 393 | return FALSE; |
394 | 394 | ||
395 | if ( store ) { | 395 | if ( store ) { |
396 | uint lineLength = i; | 396 | uint lineLength = i; |
397 | if ( lineLength>0 && buf->at(lineLength-1) == '\r' ) | 397 | if ( lineLength>0 && buf->at(lineLength-1) == '\r' ) |
398 | lineLength--; // (if there are two \r, let one stay) | 398 | lineLength--; // (if there are two \r, let one stay) |
399 | store->resize( lineLength ); | 399 | store->resize( lineLength ); |
400 | memcpy( store->data(), buf->data(), lineLength ); | 400 | memcpy( store->data(), buf->data(), lineLength ); |
401 | if ( stdOut ) | 401 | if ( stdOut ) |
402 | consumeBufStdout( i+1 ); | 402 | consumeBufStdout( i+1 ); |
403 | else | 403 | else |
404 | consumeBufStderr( i+1 ); | 404 | consumeBufStderr( i+1 ); |
405 | } | 405 | } |
406 | return TRUE; | 406 | return TRUE; |
407 | } | 407 | } |
408 | 408 | ||
409 | /*! | 409 | /*! |
410 | \fn void QProcess::launchFinished() | 410 | \fn void QProcess::launchFinished() |
411 | 411 | ||
412 | This signal is emitted when the process was started with launch(). | 412 | This signal is emitted when the process was started with launch(). |
413 | If the start was successful, this signal is emitted after all the | 413 | If the start was successful, this signal is emitted after all the |
414 | data has been written to standard input. If the start failed, then | 414 | data has been written to standard input. If the start failed, then |
415 | this signal is emitted immediately. | 415 | this signal is emitted immediately. |
416 | 416 | ||
417 | \sa launch() QObject::deleteLater() | 417 | \sa launch() QObject::deleteLater() |
418 | */ | 418 | */ |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | Runs the process and writes the data \a buf to the process's standard input. | 421 | Runs the process and writes the data \a buf to the process's standard input. |
422 | If all the data is written to standard input, standard input is | 422 | If all the data is written to standard input, standard input is |
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index b5ae4e5..8b64c41 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -289,102 +289,102 @@ bool ODevice::suspend() | |||
289 | 289 | ||
290 | if ( res ) { | 290 | if ( res ) { |
291 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 291 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
292 | ::usleep ( 200 * 1000 ); | 292 | ::usleep ( 200 * 1000 ); |
293 | ::gettimeofday ( &tvn, 0 ); | 293 | ::gettimeofday ( &tvn, 0 ); |
294 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 294 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
295 | } | 295 | } |
296 | 296 | ||
297 | return res; | 297 | return res; |
298 | } | 298 | } |
299 | 299 | ||
300 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 300 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
301 | 301 | ||
302 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 302 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
303 | 303 | ||
304 | /* VESA Blanking Levels */ | 304 | /* VESA Blanking Levels */ |
305 | #define VESA_NO_BLANKING 0 | 305 | #define VESA_NO_BLANKING 0 |
306 | #define VESA_VSYNC_SUSPEND 1 | 306 | #define VESA_VSYNC_SUSPEND 1 |
307 | #define VESA_HSYNC_SUSPEND 2 | 307 | #define VESA_HSYNC_SUSPEND 2 |
308 | #define VESA_POWERDOWN 3 | 308 | #define VESA_POWERDOWN 3 |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * This sets the display on or off | 311 | * This sets the display on or off |
312 | */ | 312 | */ |
313 | bool ODevice::setDisplayStatus ( bool on ) | 313 | bool ODevice::setDisplayStatus ( bool on ) |
314 | { | 314 | { |
315 | qDebug("ODevice::setDisplayStatus(%d)", on); | 315 | qDebug("ODevice::setDisplayStatus(%d)", on); |
316 | 316 | ||
317 | if ( d->m_model == Model_Unknown ) | 317 | if ( d->m_model == Model_Unknown ) |
318 | return false; | 318 | return false; |
319 | 319 | ||
320 | bool res = false; | 320 | bool res = false; |
321 | int fd; | 321 | int fd; |
322 | 322 | ||
323 | #ifdef QT_QWS_DEVFS | 323 | #ifdef QT_QWS_DEVFS |
324 | if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { | 324 | if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { |
325 | #else | 325 | #else |
326 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 326 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
327 | #endif | 327 | #endif |
328 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 328 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
329 | ::close ( fd ); | 329 | ::close ( fd ); |
330 | } | 330 | } |
331 | return res; | 331 | return res; |
332 | } | 332 | } |
333 | 333 | ||
334 | /** | 334 | /** |
335 | * This sets the display brightness | 335 | * This sets the display brightness |
336 | * | 336 | * |
337 | * @param p The brightness to be set on a scale from 0 to 255 | 337 | * @param b The brightness to be set on a scale from 0 to 255 |
338 | * @return success or failure | 338 | * @return success or failure |
339 | */ | 339 | */ |
340 | bool ODevice::setDisplayBrightness ( int p) | 340 | bool ODevice::setDisplayBrightness ( int b) |
341 | { | 341 | { |
342 | Q_UNUSED( p ) | 342 | Q_UNUSED( b ) |
343 | return false; | 343 | return false; |
344 | } | 344 | } |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * | 347 | * |
348 | * @return Returns the number of steppings on the brightness slider | 348 | * @return Returns the number of steppings on the brightness slider |
349 | * in the Light-'n-Power settings. Values smaller zero and bigger | 349 | * in the Light-'n-Power settings. Values smaller zero and bigger |
350 | * than 255 do not make sense. | 350 | * than 255 do not make sense. |
351 | * | 351 | * |
352 | * \sa QSlider::setLineStep | 352 | * \sa QSlider::setLineStep |
353 | * \sa QSlider::setPageStep | 353 | * \sa QSlider::setPageStep |
354 | */ | 354 | */ |
355 | int ODevice::displayBrightnessResolution() const | 355 | int ODevice::displayBrightnessResolution() const |
356 | { | 356 | { |
357 | return 16; | 357 | return 16; |
358 | } | 358 | } |
359 | 359 | ||
360 | /** | 360 | /** |
361 | * This sets the display contrast | 361 | * This sets the display contrast |
362 | * @param p The contrast to be set on a scale from 0 to 255 | 362 | * @param p The contrast to be set on a scale from 0 to 255 |
363 | * @return success or failure | 363 | * @return success or failure |
364 | */ | 364 | */ |
365 | bool ODevice::setDisplayContrast ( int p) | 365 | bool ODevice::setDisplayContrast ( int p) |
366 | { | 366 | { |
367 | Q_UNUSED( p ) | 367 | Q_UNUSED( p ) |
368 | return false; | 368 | return false; |
369 | } | 369 | } |
370 | 370 | ||
371 | /** | 371 | /** |
372 | * @return return the max value for the brightness settings slider | 372 | * @return return the max value for the brightness settings slider |
373 | * or 0 if the device doesn't support setting of a contrast | 373 | * or 0 if the device doesn't support setting of a contrast |
374 | */ | 374 | */ |
375 | int ODevice::displayContrastResolution() const | 375 | int ODevice::displayContrastResolution() const |
376 | { | 376 | { |
377 | return 0; | 377 | return 0; |
378 | } | 378 | } |
379 | 379 | ||
380 | /** | 380 | /** |
381 | * This returns the vendor as string | 381 | * This returns the vendor as string |
382 | * @return Vendor as QString | 382 | * @return Vendor as QString |
383 | */ | 383 | */ |
384 | QString ODevice::vendorString() const | 384 | QString ODevice::vendorString() const |
385 | { | 385 | { |
386 | return d->m_vendorstr; | 386 | return d->m_vendorstr; |
387 | } | 387 | } |
388 | 388 | ||
389 | /** | 389 | /** |
390 | * This returns the vendor as one of the values of OVendor | 390 | * This returns the vendor as one of the values of OVendor |
diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h index ab95dc3..05a1a25 100644 --- a/libopie2/opiecore/oconfig.h +++ b/libopie2/opiecore/oconfig.h | |||
@@ -82,82 +82,82 @@ private: | |||
82 | class Private; | 82 | class Private; |
83 | Private *d; | 83 | Private *d; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * @brief Helper class for easier use of OConfig groups. | 87 | * @brief Helper class for easier use of OConfig groups. |
88 | * | 88 | * |
89 | * Careful programmers always set the group of a | 89 | * Careful programmers always set the group of a |
90 | * @ref OConfig object to the group they want to read from | 90 | * @ref OConfig object to the group they want to read from |
91 | * and set it back to the old one of afterwards. This is usually | 91 | * and set it back to the old one of afterwards. This is usually |
92 | * written as: | 92 | * written as: |
93 | * <pre> | 93 | * <pre> |
94 | * | 94 | * |
95 | * QString oldgroup config()->group(); | 95 | * QString oldgroup config()->group(); |
96 | * config()->setGroup( "TheGroupThatIWant" ); | 96 | * config()->setGroup( "TheGroupThatIWant" ); |
97 | * ... | 97 | * ... |
98 | * config()->writeEntry( "Blah", "Blubb" ); | 98 | * config()->writeEntry( "Blah", "Blubb" ); |
99 | * | 99 | * |
100 | * config()->setGroup( oldgroup ); | 100 | * config()->setGroup( oldgroup ); |
101 | * </pre> | 101 | * </pre> |
102 | * | 102 | * |
103 | * In order to facilitate this task, you can use | 103 | * In order to facilitate this task, you can use |
104 | * OConfigGroupSaver. Simply construct such an object ON THE STACK | 104 | * OConfigGroupSaver. Simply construct such an object ON THE STACK |
105 | * when you want to switch to a new group. Then, when the object goes | 105 | * when you want to switch to a new group. Then, when the object goes |
106 | * out of scope, the group will automatically be restored. If you | 106 | * out of scope, the group will automatically be restored. If you |
107 | * want to use several different groups within a function or method, | 107 | * want to use several different groups within a function or method, |
108 | * you can still use OConfigGroupSaver: Simply enclose all work with | 108 | * you can still use OConfigGroupSaver: Simply enclose all work with |
109 | * one group (including the creation of the OConfigGroupSaver object) | 109 | * one group (including the creation of the OConfigGroupSaver object) |
110 | * in one block. | 110 | * in one block. |
111 | * | 111 | * |
112 | * \code | 112 | * \code |
113 | * OConfigGroupSaver saver(cfg,"TheGroupThatInWhat"); | 113 | * OConfigGroupSaver saver(cfg,"TheGroupThatInWhat"); |
114 | * \endcode | 114 | * \endcode |
115 | * | 115 | * |
116 | * Note that OConfigGroupSaver (cfg,"TheGroupThatInWhat"); would get imediately | 116 | * Note that OConfigGroupSaver (cfg,"TheGroupThatInWhat"); would get imediately |
117 | * destructed after created and that you would save in the old group which | 117 | * destructed after created and that you would save in the old group which |
118 | * is unwished. | 118 | * is unwished. |
119 | * | 119 | * |
120 | * @author Matthias Kalle Dalheimer <Kalle@kde.org> | 120 | * @author Matthias Kalle Dalheimer <Kalle@kde.org> |
121 | * @version $Id$ | 121 | * @version $Id$ |
122 | * @see OConfig | 122 | * @see OConfig |
123 | */ | 123 | */ |
124 | 124 | ||
125 | class OConfigGroupSaver | 125 | class OConfigGroupSaver |
126 | { | 126 | { |
127 | public: | 127 | public: |
128 | /** | 128 | /** |
129 | * Constructor. | 129 | * Constructor. |
130 | * Create the object giving a @config object and a @a group to become | 130 | * Create the object giving a OConfig object and a @a group to become |
131 | * the current group. | 131 | * the current group. |
132 | */ | 132 | */ |
133 | OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() ) | 133 | OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() ) |
134 | { _config->setGroup( group ); } | 134 | { _config->setGroup( group ); } |
135 | 135 | ||
136 | OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group()) | 136 | OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group()) |
137 | { _config->setGroup( group ); } | 137 | { _config->setGroup( group ); } |
138 | 138 | ||
139 | OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group()) | 139 | OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group()) |
140 | { _config->setGroup( group ); } | 140 | { _config->setGroup( group ); } |
141 | /** | 141 | /** |
142 | * Destructor. | 142 | * Destructor. |
143 | * Restores the last current group. | 143 | * Restores the last current group. |
144 | * @todo make it not inline for bc reasons. See KDE BC guide | 144 | * @todo make it not inline for bc reasons. See KDE BC guide |
145 | */ | 145 | */ |
146 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } | 146 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } |
147 | 147 | ||
148 | OConfig* config() { return _config; }; | 148 | OConfig* config() { return _config; }; |
149 | 149 | ||
150 | private: | 150 | private: |
151 | OConfig* _config; | 151 | OConfig* _config; |
152 | QString _oldgroup; | 152 | QString _oldgroup; |
153 | 153 | ||
154 | OConfigGroupSaver( const OConfigGroupSaver& ); | 154 | OConfigGroupSaver( const OConfigGroupSaver& ); |
155 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); | 155 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); |
156 | 156 | ||
157 | class Private; | 157 | class Private; |
158 | Private *d; | 158 | Private *d; |
159 | }; | 159 | }; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | #endif // OCONFIG_H | 163 | #endif // OCONFIG_H |
diff --git a/libopie2/opiecore/odebug.h b/libopie2/opiecore/odebug.h index 21a6c26..18dc09e 100644 --- a/libopie2/opiecore/odebug.h +++ b/libopie2/opiecore/odebug.h | |||
@@ -371,121 +371,121 @@ class ondbgstream { | |||
371 | /** | 371 | /** |
372 | * Does nothing. | 372 | * Does nothing. |
373 | * @return this stream | 373 | * @return this stream |
374 | */ | 374 | */ |
375 | ondbgstream& operator<<(double) { return *this; } | 375 | ondbgstream& operator<<(double) { return *this; } |
376 | /** | 376 | /** |
377 | * Does nothing. | 377 | * Does nothing. |
378 | * @return this stream | 378 | * @return this stream |
379 | */ | 379 | */ |
380 | ondbgstream& operator<<(long) { return *this; } | 380 | ondbgstream& operator<<(long) { return *this; } |
381 | /** | 381 | /** |
382 | * Does nothing. | 382 | * Does nothing. |
383 | * @return this stream | 383 | * @return this stream |
384 | */ | 384 | */ |
385 | ondbgstream& operator<<(unsigned long) { return *this; } | 385 | ondbgstream& operator<<(unsigned long) { return *this; } |
386 | /** | 386 | /** |
387 | * Does nothing. | 387 | * Does nothing. |
388 | * @return this stream | 388 | * @return this stream |
389 | */ | 389 | */ |
390 | ondbgstream& operator << (QWidget*) { return *this; } | 390 | ondbgstream& operator << (QWidget*) { return *this; } |
391 | /** | 391 | /** |
392 | * Does nothing. | 392 | * Does nothing. |
393 | * @return this stream | 393 | * @return this stream |
394 | */ | 394 | */ |
395 | ondbgstream &form(const char *, ...) { return *this; } | 395 | ondbgstream &form(const char *, ...) { return *this; } |
396 | 396 | ||
397 | ondbgstream& operator<<( const QDateTime& ) { return *this; } | 397 | ondbgstream& operator<<( const QDateTime& ) { return *this; } |
398 | ondbgstream& operator<<( const QDate& ) { return *this; } | 398 | ondbgstream& operator<<( const QDate& ) { return *this; } |
399 | ondbgstream& operator<<( const QTime& ) { return *this; } | 399 | ondbgstream& operator<<( const QTime& ) { return *this; } |
400 | ondbgstream& operator<<( const QPoint & ) { return *this; } | 400 | ondbgstream& operator<<( const QPoint & ) { return *this; } |
401 | ondbgstream& operator<<( const QSize & ) { return *this; } | 401 | ondbgstream& operator<<( const QSize & ) { return *this; } |
402 | ondbgstream& operator<<( const QRect & ) { return *this; } | 402 | ondbgstream& operator<<( const QRect & ) { return *this; } |
403 | ondbgstream& operator<<( const QRegion & ) { return *this; } | 403 | ondbgstream& operator<<( const QRegion & ) { return *this; } |
404 | ondbgstream& operator<<( const QStringList & ) { return *this; } | 404 | ondbgstream& operator<<( const QStringList & ) { return *this; } |
405 | ondbgstream& operator<<( const QColor & ) { return *this; } | 405 | ondbgstream& operator<<( const QColor & ) { return *this; } |
406 | ondbgstream& operator<<( const QBrush & ) { return *this; } | 406 | ondbgstream& operator<<( const QBrush & ) { return *this; } |
407 | 407 | ||
408 | private: | 408 | private: |
409 | class Private; | 409 | class Private; |
410 | Private *d; | 410 | Private *d; |
411 | }; | 411 | }; |
412 | 412 | ||
413 | /*====================================================================================== | 413 | /*====================================================================================== |
414 | * related functions | 414 | * related functions |
415 | *======================================================================================*/ | 415 | *======================================================================================*/ |
416 | 416 | ||
417 | /** | 417 | /** |
418 | * Does nothing. | 418 | * Does nothing. |
419 | * @param a stream | 419 | * @param s stream |
420 | * @return the given @p s | 420 | * @return the given @p s |
421 | */ | 421 | */ |
422 | inline ondbgstream& endl( ondbgstream & s) { return s; } | 422 | inline ondbgstream& endl( ondbgstream & s) { return s; } |
423 | /** | 423 | /** |
424 | * Does nothing. | 424 | * Does nothing. |
425 | * @param a stream | 425 | * @param s stream |
426 | * @return the given @p s | 426 | * @return the given @p s |
427 | */ | 427 | */ |
428 | inline ondbgstream& flush( ondbgstream & s) { return s; } | 428 | inline ondbgstream& flush( ondbgstream & s) { return s; } |
429 | inline ondbgstream& perror( ondbgstream & s) { return s; } | 429 | inline ondbgstream& perror( ondbgstream & s) { return s; } |
430 | 430 | ||
431 | /** | 431 | /** |
432 | * Returns a debug stream. You can use it to print debug | 432 | * Returns a debug stream. You can use it to print debug |
433 | * information. | 433 | * information. |
434 | * @param area an id to identify the output, 0 for default | 434 | * @param area an id to identify the output, 0 for default |
435 | */ | 435 | */ |
436 | odbgstream odDebug(int area = 0); | 436 | odbgstream odDebug(int area = 0); |
437 | odbgstream odDebug(bool cond, int area = 0); | 437 | odbgstream odDebug(bool cond, int area = 0); |
438 | /** | 438 | /** |
439 | * Returns a backtrace. | 439 | * Returns a backtrace. |
440 | * @param levels the number of levels (-1 for unlimited) of the backtrace | 440 | * @param levels the number of levels (-1 for unlimited) of the backtrace |
441 | * @return a backtrace | 441 | * @return a backtrace |
442 | */ | 442 | */ |
443 | QString odBacktrace(int levels = -1); | 443 | QString odBacktrace(int levels = -1); |
444 | /** | 444 | /** |
445 | * Returns a dummy debug stream. The stream does not print anything. | 445 | * Returns a dummy debug stream. The stream does not print anything. |
446 | * @param area an id to identify the output, 0 for default | 446 | * @param area an id to identify the output, 0 for default |
447 | * @see odDebug() | 447 | * @see odDebug() |
448 | */ | 448 | */ |
449 | inline ondbgstream ondDebug(int = 0) { return ondbgstream(); } | 449 | inline ondbgstream ondDebug(int area = 0) { return ondbgstream(); } |
450 | inline ondbgstream ondDebug(bool , int = 0) { return ondbgstream(); } | 450 | inline ondbgstream ondDebug(bool , int = 0) { return ondbgstream(); } |
451 | inline QString ondBacktrace() { return QString::null; } | 451 | inline QString ondBacktrace() { return QString::null; } |
452 | inline QString ondBacktrace(int) { return QString::null; } | 452 | inline QString ondBacktrace(int) { return QString::null; } |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * Returns a warning stream. You can use it to print warning | 455 | * Returns a warning stream. You can use it to print warning |
456 | * information. | 456 | * information. |
457 | * @param area an id to identify the output, 0 for default | 457 | * @param area an id to identify the output, 0 for default |
458 | */ | 458 | */ |
459 | odbgstream odWarning(int area = 0); | 459 | odbgstream odWarning(int area = 0); |
460 | odbgstream odWarning(bool cond, int area = 0); | 460 | odbgstream odWarning(bool cond, int area = 0); |
461 | /** | 461 | /** |
462 | * Returns an error stream. You can use it to print error | 462 | * Returns an error stream. You can use it to print error |
463 | * information. | 463 | * information. |
464 | * @param area an id to identify the output, 0 for default | 464 | * @param area an id to identify the output, 0 for default |
465 | */ | 465 | */ |
466 | odbgstream odError(int area = 0); | 466 | odbgstream odError(int area = 0); |
467 | odbgstream odError(bool cond, int area = 0); | 467 | odbgstream odError(bool cond, int area = 0); |
468 | /** | 468 | /** |
469 | * Returns a fatal error stream. You can use it to print fatal error | 469 | * Returns a fatal error stream. You can use it to print fatal error |
470 | * information. | 470 | * information. |
471 | * @param area an id to identify the output, 0 for default | 471 | * @param area an id to identify the output, 0 for default |
472 | */ | 472 | */ |
473 | odbgstream odFatal(int area = 0); | 473 | odbgstream odFatal(int area = 0); |
474 | odbgstream odFatal(bool cond, int area = 0); | 474 | odbgstream odFatal(bool cond, int area = 0); |
475 | 475 | ||
476 | /** | 476 | /** |
477 | * Deletes the odebugrc cache and therefore forces KDebug to reread the | 477 | * Deletes the odebugrc cache and therefore forces KDebug to reread the |
478 | * config file | 478 | * config file |
479 | */ | 479 | */ |
480 | void odClearDebugConfig(); | 480 | void odClearDebugConfig(); |
481 | 481 | ||
482 | #ifdef OPIE_NO_DEBUG | 482 | #ifdef OPIE_NO_DEBUG |
483 | #define odDebug ondDebug | 483 | #define odDebug ondDebug |
484 | #define odBacktrace ondBacktrace | 484 | #define odBacktrace ondBacktrace |
485 | #endif | 485 | #endif |
486 | 486 | ||
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | #endif | 490 | #endif |
491 | 491 | ||
diff --git a/libopie2/opiecore/okeyconfigmanager.cpp b/libopie2/opiecore/okeyconfigmanager.cpp index 891cda7..48546bd 100644 --- a/libopie2/opiecore/okeyconfigmanager.cpp +++ b/libopie2/opiecore/okeyconfigmanager.cpp | |||
@@ -52,97 +52,97 @@ OKeyPair::OKeyPair( int key, int mod ) | |||
52 | * The destructor | 52 | * The destructor |
53 | */ | 53 | */ |
54 | OKeyPair::~OKeyPair() {} | 54 | OKeyPair::~OKeyPair() {} |
55 | 55 | ||
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Is this OKeyPair empty/valid? | 58 | * Is this OKeyPair empty/valid? |
59 | */ | 59 | */ |
60 | bool OKeyPair::isEmpty()const { | 60 | bool OKeyPair::isEmpty()const { |
61 | return ( ( m_key == -1 )&& ( m_mod == -1 ) ); | 61 | return ( ( m_key == -1 )&& ( m_mod == -1 ) ); |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * get the keycode for this OKeyPair. The Key relates to Qt::Key. | 65 | * get the keycode for this OKeyPair. The Key relates to Qt::Key. |
66 | * | 66 | * |
67 | * @see Qt::Key | 67 | * @see Qt::Key |
68 | * @see setKey | 68 | * @see setKey |
69 | */ | 69 | */ |
70 | int OKeyPair::keycode()const { | 70 | int OKeyPair::keycode()const { |
71 | return m_key; | 71 | return m_key; |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * get the modifier key for this OKeyPair. The Modifier State relates | 75 | * get the modifier key for this OKeyPair. The Modifier State relates |
76 | * to the Qt::ButtonState | 76 | * to the Qt::ButtonState |
77 | * | 77 | * |
78 | * @see Qt::ButtonState | 78 | * @see Qt::ButtonState |
79 | * @see setModifier | 79 | * @see setModifier |
80 | */ | 80 | */ |
81 | int OKeyPair::modifier()const { | 81 | int OKeyPair::modifier()const { |
82 | return m_mod; | 82 | return m_mod; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Set the keycode | 87 | * Set the keycode |
88 | * @param key The Keycode to set | 88 | * @param key The Keycode to set |
89 | * | 89 | * |
90 | * @see keycode() | 90 | * @see keycode() |
91 | * @see Qt::Key | 91 | * @see Qt::Key |
92 | */ | 92 | */ |
93 | void OKeyPair::setKeycode( int key ) { | 93 | void OKeyPair::setKeycode( int key ) { |
94 | m_key = key; | 94 | m_key = key; |
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Set the modifier key | 98 | * Set the modifier key |
99 | * | 99 | * |
100 | * @param the Modifier key | 100 | * @param mod the Modifier key |
101 | * @see Qt::ButtonState | 101 | * @see Qt::ButtonState |
102 | * @see modifier() | 102 | * @see modifier() |
103 | */ | 103 | */ |
104 | void OKeyPair::setModifier( int mod ) { | 104 | void OKeyPair::setModifier( int mod ) { |
105 | m_mod = mod; | 105 | m_mod = mod; |
106 | } | 106 | } |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Return an OKeyPair for the Return Key without any modifier. | 109 | * Return an OKeyPair for the Return Key without any modifier. |
110 | */ | 110 | */ |
111 | OKeyPair OKeyPair::returnKey() { | 111 | OKeyPair OKeyPair::returnKey() { |
112 | return OKeyPair( Qt::Key_Return, 0 ); | 112 | return OKeyPair( Qt::Key_Return, 0 ); |
113 | } | 113 | } |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Return an OKeyPair for the Left Arrow Key | 116 | * Return an OKeyPair for the Left Arrow Key |
117 | * without any modifier Key | 117 | * without any modifier Key |
118 | */ | 118 | */ |
119 | OKeyPair OKeyPair::leftArrowKey() { | 119 | OKeyPair OKeyPair::leftArrowKey() { |
120 | return OKeyPair( Qt::Key_Left, 0 ); | 120 | return OKeyPair( Qt::Key_Left, 0 ); |
121 | } | 121 | } |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * Return an OKeyPair for the Right Arrow Key | 124 | * Return an OKeyPair for the Right Arrow Key |
125 | * without any modifier Key | 125 | * without any modifier Key |
126 | */ | 126 | */ |
127 | OKeyPair OKeyPair::rightArrowKey() { | 127 | OKeyPair OKeyPair::rightArrowKey() { |
128 | return OKeyPair( Qt::Key_Right, 0 ); | 128 | return OKeyPair( Qt::Key_Right, 0 ); |
129 | } | 129 | } |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Return an OKeyPair for the Up Arrow Key | 132 | * Return an OKeyPair for the Up Arrow Key |
133 | * without any modifier Key | 133 | * without any modifier Key |
134 | */ | 134 | */ |
135 | OKeyPair OKeyPair::upArrowKey() { | 135 | OKeyPair OKeyPair::upArrowKey() { |
136 | return OKeyPair( Qt::Key_Up, 0 ); | 136 | return OKeyPair( Qt::Key_Up, 0 ); |
137 | } | 137 | } |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Return an OKeyPair for the Down Arrow Key | 140 | * Return an OKeyPair for the Down Arrow Key |
141 | * without any modifier Key | 141 | * without any modifier Key |
142 | */ | 142 | */ |
143 | OKeyPair OKeyPair::downArrowKey() { | 143 | OKeyPair OKeyPair::downArrowKey() { |
144 | return OKeyPair( Qt::Key_Down, 0 ); | 144 | return OKeyPair( Qt::Key_Down, 0 ); |
145 | } | 145 | } |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * Return an Empty OKeyPair | 148 | * Return an Empty OKeyPair |
diff --git a/libopie2/opiecore/okeyfilter.h b/libopie2/opiecore/okeyfilter.h index d183641..1871247 100644 --- a/libopie2/opiecore/okeyfilter.h +++ b/libopie2/opiecore/okeyfilter.h | |||
@@ -20,81 +20,81 @@ _;:, .> :=|. This program is free software; you can | |||
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* QT */ | 29 | /* QT */ |
30 | #include <qwindowsystem_qws.h> | 30 | #include <qwindowsystem_qws.h> |
31 | #include <qvaluelist.h> | 31 | #include <qvaluelist.h> |
32 | 32 | ||
33 | namespace Opie { | 33 | namespace Opie { |
34 | namespace Core { | 34 | namespace Core { |
35 | class ODevice; | 35 | class ODevice; |
36 | 36 | ||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * A singleton which will manage all possible keyboard filters inside opie. | 39 | * A singleton which will manage all possible keyboard filters inside opie. |
40 | * It makes sure that key handlers of odevice are checked first than the | 40 | * It makes sure that key handlers of odevice are checked first than the |
41 | * keyfilters of software. | 41 | * keyfilters of software. |
42 | * @short a keyfilter proxy | 42 | * @short a keyfilter proxy |
43 | * @see QWSServer::KeyboardFilter | 43 | * @see QWSServer::KeyboardFilter |
44 | * @author Rajko Albrecht | 44 | * @author Rajko Albrecht |
45 | * @version 1.0 | 45 | * @version 1.0 |
46 | */ | 46 | */ |
47 | class OKeyFilter | 47 | class OKeyFilter |
48 | { | 48 | { |
49 | friend class Opie::Core::ODevice; | 49 | friend class Opie::Core::ODevice; |
50 | 50 | ||
51 | protected: | 51 | protected: |
52 | /** | 52 | /** |
53 | * Protected constructor - generate class via inst() | 53 | * Protected constructor - generate class via inst() |
54 | * @see inst() | 54 | * @see inst() |
55 | */ | 55 | */ |
56 | OKeyFilter(); | 56 | OKeyFilter(); |
57 | /** | 57 | /** |
58 | * Protected constructor - generate class via inst() | 58 | * Protected constructor - generate class via inst() |
59 | * @see inst() | 59 | * @see inst() |
60 | */ | 60 | */ |
61 | OKeyFilter(const OKeyFilter&){}; | 61 | OKeyFilter(const OKeyFilter&){}; |
62 | /** | 62 | /** |
63 | * Append filter to the primary list. | 63 | * Append filter to the primary list. |
64 | * This is only allowed for friend classes from odevice | 64 | * This is only allowed for friend classes from odevice |
65 | * @param aFilter a filter to append | 65 | * @param aFilter a filter to append |
66 | * @see addHandler | 66 | * @see addHandler |
67 | */ | 67 | */ |
68 | virtual void addPreHandler(QWSServer::KeyboardFilter*aFilter)=0; | 68 | virtual void addPreHandler(QWSServer::KeyboardFilter *aFilter)=0; |
69 | /** | 69 | /** |
70 | * Remove the specified filter from list and give back ownership. | 70 | * Remove the specified filter from list and give back ownership. |
71 | * This is only allowed for friend classes from odevice | 71 | * This is only allowed for friend classes from odevice |
72 | * @param aFilter a filter to remove | 72 | * @param aFilter a filter to remove |
73 | * @see remHandler | 73 | * @see remHandler |
74 | */ | 74 | */ |
75 | virtual void remPreHandler(QWSServer::KeyboardFilter*aFilter)=0; | 75 | virtual void remPreHandler(QWSServer::KeyboardFilter *aFilter)=0; |
76 | 76 | ||
77 | public: | 77 | public: |
78 | virtual ~OKeyFilter(); | 78 | virtual ~OKeyFilter(); |
79 | /** | 79 | /** |
80 | * Append filter to the secondary list. | 80 | * Append filter to the secondary list. |
81 | * @param aFilter a filter to append | 81 | * @param aFilter a filter to append |
82 | * @see addPreHandler | 82 | * @see addPreHandler |
83 | */ | 83 | */ |
84 | virtual void addHandler(QWSServer::KeyboardFilter*)=0; | 84 | virtual void addHandler(QWSServer::KeyboardFilter *aFilter)=0; |
85 | /** | 85 | /** |
86 | * Remove the specified filter from list and give back ownership. | 86 | * Remove the specified filter from list and give back ownership. |
87 | * @param aFilter a filter to remove | 87 | * @param aFilter a filter to remove |
88 | * @see remPreHandler | 88 | * @see remPreHandler |
89 | */ | 89 | */ |
90 | virtual void remHandler(QWSServer::KeyboardFilter*)=0; | 90 | virtual void remHandler(QWSServer::KeyboardFilter *aFilter)=0; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Returns a handler to an instance of OKeyFilter | 93 | * Returns a handler to an instance of OKeyFilter |
94 | * @return a pointer to a working OKeyFilter | 94 | * @return a pointer to a working OKeyFilter |
95 | */ | 95 | */ |
96 | static OKeyFilter*inst(); | 96 | static OKeyFilter*inst(); |
97 | }; | 97 | }; |
98 | 98 | ||
99 | } | 99 | } |
100 | } | 100 | } |
diff --git a/libopie2/opiecore/opluginloader.cpp b/libopie2/opiecore/opluginloader.cpp index ec19fa0..2a6e369 100644 --- a/libopie2/opiecore/opluginloader.cpp +++ b/libopie2/opiecore/opluginloader.cpp | |||
@@ -478,97 +478,97 @@ void OGenericPluginLoader::setSafeMode(const QString& str, bool b) { | |||
478 | */ | 478 | */ |
479 | void OGenericPluginLoader::setPluginDirs( const QStringList& lst ) { | 479 | void OGenericPluginLoader::setPluginDirs( const QStringList& lst ) { |
480 | m_plugDirs = lst; | 480 | m_plugDirs = lst; |
481 | } | 481 | } |
482 | 482 | ||
483 | /** | 483 | /** |
484 | * | 484 | * |
485 | * @internal | 485 | * @internal |
486 | * Set the Plugin Dir to str. Str will be the only element in the list of plugin dirs | 486 | * Set the Plugin Dir to str. Str will be the only element in the list of plugin dirs |
487 | */ | 487 | */ |
488 | void OGenericPluginLoader::setPluginDir( const QString& str) { | 488 | void OGenericPluginLoader::setPluginDir( const QString& str) { |
489 | m_plugDirs.clear(); | 489 | m_plugDirs.clear(); |
490 | m_plugDirs.append( str ); | 490 | m_plugDirs.append( str ); |
491 | } | 491 | } |
492 | 492 | ||
493 | 493 | ||
494 | /** | 494 | /** |
495 | * @internal | 495 | * @internal |
496 | */ | 496 | */ |
497 | bool OGenericPluginLoader::isSorted()const{ | 497 | bool OGenericPluginLoader::isSorted()const{ |
498 | return m_isSorted; | 498 | return m_isSorted; |
499 | } | 499 | } |
500 | 500 | ||
501 | /* | 501 | /* |
502 | * make libfoo.so.1.0.0 -> foo on UNIX | 502 | * make libfoo.so.1.0.0 -> foo on UNIX |
503 | * make libfoo.dylib -> foo on MAC OS X Unix | 503 | * make libfoo.dylib -> foo on MAC OS X Unix |
504 | * windows is obviously missing | 504 | * windows is obviously missing |
505 | */ | 505 | */ |
506 | /** | 506 | /** |
507 | * @internal | 507 | * @internal |
508 | */ | 508 | */ |
509 | QString OGenericPluginLoader::unlibify( const QString& str ) { | 509 | QString OGenericPluginLoader::unlibify( const QString& str ) { |
510 | QString st = str.mid( str.find( "lib" )+3 ); | 510 | QString st = str.mid( str.find( "lib" )+3 ); |
511 | #ifdef Q_OS_MACX | 511 | #ifdef Q_OS_MACX |
512 | return st.left( st.findRev( ".dylib" ) ); | 512 | return st.left( st.findRev( ".dylib" ) ); |
513 | #else | 513 | #else |
514 | return st.left( st.findRev( ".so" ) ); | 514 | return st.left( st.findRev( ".so" ) ); |
515 | #endif | 515 | #endif |
516 | } | 516 | } |
517 | 517 | ||
518 | /** | 518 | /** |
519 | * @internal | 519 | * @internal |
520 | * | 520 | * |
521 | * \brief method to return available plugins. Internal and for reeimplementations | 521 | * \brief method to return available plugins. Internal and for reeimplementations |
522 | * | 522 | * |
523 | *Return a List of Plugins for a dir and add positions and remove disabled. | 523 | *Return a List of Plugins for a dir and add positions and remove disabled. |
524 | * If a plugin is on the excluded list assign position -2 | 524 | * If a plugin is on the excluded list assign position -2 |
525 | * | 525 | * |
526 | * @param dir The dir to look in | 526 | * @param _dir The dir to look in |
527 | * @param sorted Should positions be read? | 527 | * @param sorted Should positions be read? |
528 | * @param disabled Remove excluded from the list | 528 | * @param disabled Remove excluded from the list |
529 | */ | 529 | */ |
530 | OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorted, bool disabled )const { | 530 | OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorted, bool disabled )const { |
531 | #ifdef Q_OS_MACX | 531 | #ifdef Q_OS_MACX |
532 | QDir dir( _dir, "lib*.dylib" ); | 532 | QDir dir( _dir, "lib*.dylib" ); |
533 | #else | 533 | #else |
534 | QDir dir( _dir, "lib*.so" ); | 534 | QDir dir( _dir, "lib*.so" ); |
535 | #endif | 535 | #endif |
536 | 536 | ||
537 | 537 | ||
538 | OPluginItem::List lst; | 538 | OPluginItem::List lst; |
539 | 539 | ||
540 | /* | 540 | /* |
541 | * get excluded list and then iterate over them | 541 | * get excluded list and then iterate over them |
542 | * Excluded list contains the name | 542 | * Excluded list contains the name |
543 | * Position is a list with 'name.pos.name.pos.name.pos' | 543 | * Position is a list with 'name.pos.name.pos.name.pos' |
544 | * | 544 | * |
545 | * For the look up we will create two QMap<QString,pos> | 545 | * For the look up we will create two QMap<QString,pos> |
546 | */ | 546 | */ |
547 | QMap<QString, int> positionMap; | 547 | QMap<QString, int> positionMap; |
548 | QMap<QString, int> excludedMap; | 548 | QMap<QString, int> excludedMap; |
549 | 549 | ||
550 | 550 | ||
551 | OConfig cfg( m_dir+"-odpplugins" ); | 551 | OConfig cfg( m_dir+"-odpplugins" ); |
552 | cfg.setGroup( _dir ); | 552 | cfg.setGroup( _dir ); |
553 | 553 | ||
554 | 554 | ||
555 | QStringList excludes = cfg.readListEntry( "Excluded", ',' ); | 555 | QStringList excludes = cfg.readListEntry( "Excluded", ',' ); |
556 | for ( QStringList::Iterator it = excludes.begin(); it != excludes.end(); ++it ) | 556 | for ( QStringList::Iterator it = excludes.begin(); it != excludes.end(); ++it ) |
557 | excludedMap.insert( *it, -2 ); | 557 | excludedMap.insert( *it, -2 ); |
558 | 558 | ||
559 | if ( sorted ) { | 559 | if ( sorted ) { |
560 | QStringList pos = cfg.readListEntry( "Positions", '.' ); | 560 | QStringList pos = cfg.readListEntry( "Positions", '.' ); |
561 | QStringList::Iterator it = pos.begin(); | 561 | QStringList::Iterator it = pos.begin(); |
562 | QString tmp; int i; | 562 | QString tmp; int i; |
563 | while ( it != pos.end() ) { | 563 | while ( it != pos.end() ) { |
564 | tmp = *it++; i = (*it++).toInt(); | 564 | tmp = *it++; i = (*it++).toInt(); |
565 | positionMap.insert( tmp, i ); | 565 | positionMap.insert( tmp, i ); |
566 | } | 566 | } |
567 | 567 | ||
568 | } | 568 | } |
569 | 569 | ||
570 | 570 | ||
571 | 571 | ||
572 | 572 | ||
573 | QStringList list = dir.entryList(); | 573 | QStringList list = dir.entryList(); |
574 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 574 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
@@ -636,173 +636,172 @@ void OGenericPluginLoader::installTranslators(const QString& type) { | |||
636 | * for each language and maybe later for each language dir... | 636 | * for each language and maybe later for each language dir... |
637 | * try to load a Translator | 637 | * try to load a Translator |
638 | */ | 638 | */ |
639 | for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 639 | for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
640 | QTranslator* trans = new QTranslator( qApp ); | 640 | QTranslator* trans = new QTranslator( qApp ); |
641 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + *it + "/lib" + type + ".qm" ; | 641 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + *it + "/lib" + type + ".qm" ; |
642 | 642 | ||
643 | /* | 643 | /* |
644 | * If loaded then install else clean up and don't leak | 644 | * If loaded then install else clean up and don't leak |
645 | */ | 645 | */ |
646 | if ( trans->load( tfn ) ) | 646 | if ( trans->load( tfn ) ) |
647 | qApp->installTranslator( trans ); | 647 | qApp->installTranslator( trans ); |
648 | else | 648 | else |
649 | delete trans; | 649 | delete trans; |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
653 | /** | 653 | /** |
654 | * \brief Simple c'tor. | 654 | * \brief Simple c'tor. |
655 | * | 655 | * |
656 | * Simple C'tor same as the one of the base class. Additional this | 656 | * Simple C'tor same as the one of the base class. Additional this |
657 | * class can cast for you if you nee it. | 657 | * class can cast for you if you nee it. |
658 | * | 658 | * |
659 | * | 659 | * |
660 | * @param name The name of your plugin class | 660 | * @param name The name of your plugin class |
661 | * @param sorted If plugins are sorted | 661 | * @param sorted If plugins are sorted |
662 | * | 662 | * |
663 | * @see OGenericPluginLoader | 663 | * @see OGenericPluginLoader |
664 | */ | 664 | */ |
665 | OPluginLoader::OPluginLoader( const QString& name, bool sorted ) | 665 | OPluginLoader::OPluginLoader( const QString& name, bool sorted ) |
666 | : OGenericPluginLoader( name, sorted ) | 666 | : OGenericPluginLoader( name, sorted ) |
667 | { | 667 | { |
668 | } | 668 | } |
669 | 669 | ||
670 | /** | 670 | /** |
671 | * d'tor | 671 | * d'tor |
672 | * @see OGenericPluginLoader::~OGenericPluginLoader | 672 | * @see OGenericPluginLoader::~OGenericPluginLoader |
673 | */ | 673 | */ |
674 | OPluginLoader::~OPluginLoader() { | 674 | OPluginLoader::~OPluginLoader() { |
675 | } | 675 | } |
676 | 676 | ||
677 | /** | 677 | /** |
678 | * \brief C'Tor using a OGenericPluginLoader | 678 | * \brief C'Tor using a OGenericPluginLoader |
679 | * The C'tor. Pass your OGenericPluginLoader to manage | 679 | * The C'tor. Pass your OGenericPluginLoader to manage |
680 | * OGenericPluginLoader::allAvailable plugins. | 680 | * OGenericPluginLoader::allAvailable plugins. |
681 | * | 681 | * |
682 | * | 682 | * |
683 | * @param loader A Pointer to your OGenericPluginLoader | 683 | * @param loader A Pointer to your OGenericPluginLoader |
684 | * @param name The name | ||
685 | */ | 684 | */ |
686 | OPluginManager::OPluginManager( OGenericPluginLoader* loader) | 685 | OPluginManager::OPluginManager( OGenericPluginLoader* loader) |
687 | : m_loader( loader ), m_isSorted( false ) | 686 | : m_loader( loader ), m_isSorted( false ) |
688 | { | 687 | { |
689 | } | 688 | } |
690 | 689 | ||
691 | /** | 690 | /** |
692 | * \brief Overloaded c'tor using a List of Plugins and a type name | 691 | * \brief Overloaded c'tor using a List of Plugins and a type name |
693 | * Overloaded Constructor to work with a 'Type' of plugins | 692 | * Overloaded Constructor to work with a 'Type' of plugins |
694 | * and a correspending list of those. In this case calling load | 693 | * and a correspending list of those. In this case calling load |
695 | * is a no operation. | 694 | * is a no operation. |
696 | * | 695 | * |
697 | * @param name The name of your plugin ('today','inputmethods','applets') | 696 | * @param name The name of your plugin ('today','inputmethods','applets') |
698 | * @param lst A List with plugins of your type to manage | 697 | * @param lst A List with plugins of your type to manage |
699 | * @param isSorted If the List should be treated sorted | 698 | * @param isSorted If the List should be treated sorted |
700 | */ | 699 | */ |
701 | OPluginManager::OPluginManager( const QString& name, const OPluginItem::List& lst, bool isSorted) | 700 | OPluginManager::OPluginManager( const QString& name, const OPluginItem::List& lst, bool isSorted) |
702 | : m_loader( 0l ), m_cfgName( name ), m_plugins( lst ), m_isSorted( isSorted ) | 701 | : m_loader( 0l ), m_cfgName( name ), m_plugins( lst ), m_isSorted( isSorted ) |
703 | { | 702 | { |
704 | } | 703 | } |
705 | 704 | ||
706 | /** | 705 | /** |
707 | * \brief A simple d'tor | 706 | * \brief A simple d'tor |
708 | */ | 707 | */ |
709 | OPluginManager::~OPluginManager() { | 708 | OPluginManager::~OPluginManager() { |
710 | } | 709 | } |
711 | 710 | ||
712 | /** | 711 | /** |
713 | * \brief Return the OPluginItem where loading is likely to have crashed on. | 712 | * \brief Return the OPluginItem where loading is likely to have crashed on. |
714 | 713 | ||
715 | * Return the Item that made the OGenericPluginLoader crash | 714 | * Return the Item that made the OGenericPluginLoader crash |
716 | * the returned OPluginItem could be empty if no crash occured | 715 | * the returned OPluginItem could be empty if no crash occured |
717 | * which should apply most of the time. It could also be empty if the crashed | 716 | * which should apply most of the time. It could also be empty if the crashed |
718 | * plugin is not in the current list of available/managed plugins | 717 | * plugin is not in the current list of available/managed plugins |
719 | * | 718 | * |
720 | * @see OPluginItem::isEmpty | 719 | * @see OPluginItem::isEmpty |
721 | * @return OPluginItem that crashed the loader | 720 | * @return OPluginItem that crashed the loader |
722 | */ | 721 | */ |
723 | OPluginItem OPluginManager::crashedPlugin()const { | 722 | OPluginItem OPluginManager::crashedPlugin()const { |
724 | return m_crashed; | 723 | return m_crashed; |
725 | } | 724 | } |
726 | 725 | ||
727 | /** | 726 | /** |
728 | * \brief Return a list of plugins that are managed by this OPluginManager | 727 | * \brief Return a list of plugins that are managed by this OPluginManager |
729 | * | 728 | * |
730 | * Return the list of managed plugins. This could either result | 729 | * Return the list of managed plugins. This could either result |
731 | * from passing a OGenericPluginLoader and calling load or by | 730 | * from passing a OGenericPluginLoader and calling load or by |
732 | * giving name and a list of plugins. | 731 | * giving name and a list of plugins. |
733 | */ | 732 | */ |
734 | OPluginItem::List OPluginManager::managedPlugins()const { | 733 | OPluginItem::List OPluginManager::managedPlugins()const { |
735 | return m_plugins; | 734 | return m_plugins; |
736 | } | 735 | } |
737 | 736 | ||
738 | /** | 737 | /** |
739 | * \brief Set the position of the items | 738 | * \brief Set the position of the items |
740 | * | 739 | * |
741 | * Replace the OPluginItem with the name and path and this way | 740 | * Replace the OPluginItem with the name and path and this way |
742 | * apply the new position. The search is linear and this way O(n/2) | 741 | * apply the new position. The search is linear and this way O(n/2) |
743 | * You still need to call save() to make your changes effective. After saving | 742 | * You still need to call save() to make your changes effective. After saving |
744 | * a call to OGenericPluginLoader::filtered() returns the newly configured order and items | 743 | * a call to OGenericPluginLoader::filtered() returns the newly configured order and items |
745 | * | 744 | * |
746 | * @param item The OPluginItem to be replaced internall | 745 | * @param item The OPluginItem to be replaced internall |
747 | * | 746 | * |
748 | */ | 747 | */ |
749 | void OPluginManager::setPosition( const OPluginItem& item) { | 748 | void OPluginManager::setPosition( const OPluginItem& item) { |
750 | replace( item ); | 749 | replace( item ); |
751 | } | 750 | } |
752 | 751 | ||
753 | /** | 752 | /** |
754 | * \brief Enable the item specified as argument | 753 | * \brief Enable the item specified as argument |
755 | * | 754 | * |
756 | * This will make sure that OPluginItem::setEnabled is called and then will replace | 755 | * This will make sure that OPluginItem::setEnabled is called and then will replace |
757 | * the item with one that matches name and path internally. | 756 | * the item with one that matches name and path internally. |
758 | * @see setPosition | 757 | * @see setPosition |
759 | * | 758 | * |
760 | * @param the Item to enable | 759 | * @param item the Item to enable |
761 | */ | 760 | */ |
762 | void OPluginManager::enable( const OPluginItem& item ) { | 761 | void OPluginManager::enable( const OPluginItem& item ) { |
763 | setEnabled( item, true ); | 762 | setEnabled( item, true ); |
764 | } | 763 | } |
765 | 764 | ||
766 | /** | 765 | /** |
767 | * \brief disable the Item. | 766 | * \brief disable the Item. |
768 | * | 767 | * |
769 | * Disable the OPluginItem. Same applies as in | 768 | * Disable the OPluginItem. Same applies as in |
770 | * @see setPosition and @see enable | 769 | * @see setPosition and @see enable |
771 | * | 770 | * |
772 | * @param item Item to disable | 771 | * @param item Item to disable |
773 | */ | 772 | */ |
774 | void OPluginManager::disable( const OPluginItem& item) { | 773 | void OPluginManager::disable( const OPluginItem& item) { |
775 | setEnabled( item, false ); | 774 | setEnabled( item, false ); |
776 | } | 775 | } |
777 | 776 | ||
778 | /** | 777 | /** |
779 | * \brief Enable or disable the OPluginItem. | 778 | * \brief Enable or disable the OPluginItem. |
780 | * Depending on the value of the parameter this will either disable | 779 | * Depending on the value of the parameter this will either disable |
781 | * or enable the pluginitem. | 780 | * or enable the pluginitem. |
782 | * Beside that same as in @see disable, @see enable, @see setPosition | 781 | * Beside that same as in @see disable, @see enable, @see setPosition |
783 | * applies. | 782 | * applies. |
784 | * | 783 | * |
785 | * @param _item The OPluginItem to enable or to disable. | 784 | * @param _item The OPluginItem to enable or to disable. |
786 | * @param b Enable or disable the plugin. | 785 | * @param b Enable or disable the plugin. |
787 | * | 786 | * |
788 | */ | 787 | */ |
789 | void OPluginManager::setEnabled( const OPluginItem& _item, bool b ) { | 788 | void OPluginManager::setEnabled( const OPluginItem& _item, bool b ) { |
790 | OPluginItem item = _item; | 789 | OPluginItem item = _item; |
791 | item.setEnabled( b ); | 790 | item.setEnabled( b ); |
792 | replace( item ); | 791 | replace( item ); |
793 | } | 792 | } |
794 | 793 | ||
795 | /** | 794 | /** |
796 | * \brief Load necessary information after constructing the object | 795 | * \brief Load necessary information after constructing the object |
797 | * If you speified a OGenericPluginLoader you need to call this method | 796 | * If you speified a OGenericPluginLoader you need to call this method |
798 | * so that this manager knows what to manage and have a right value for \sa crashedPlugin | 797 | * so that this manager knows what to manage and have a right value for \sa crashedPlugin |
799 | * For the name and the list of plugins this does only try to find out the crashed plugin | 798 | * For the name and the list of plugins this does only try to find out the crashed plugin |
800 | */ | 799 | */ |
801 | void OPluginManager::load() { | 800 | void OPluginManager::load() { |
802 | OConfig cfg( configName() ); | 801 | OConfig cfg( configName() ); |
803 | cfg.setGroup( "General" ); | 802 | cfg.setGroup( "General" ); |
804 | QString crashedPath = cfg.readEntry( "CrashedPlugin" ); | 803 | QString crashedPath = cfg.readEntry( "CrashedPlugin" ); |
805 | 804 | ||
806 | /* if we've a loader this applies if we were called from the first part */ | 805 | /* if we've a loader this applies if we were called from the first part */ |
807 | if ( m_loader ) | 806 | if ( m_loader ) |
808 | m_plugins = m_loader->allAvailable( m_loader->isSorted() ); | 807 | m_plugins = m_loader->allAvailable( m_loader->isSorted() ); |
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index be1436c..ac6be98 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h | |||
@@ -9,181 +9,181 @@ _;:, .> :=|. This program is free software; you can | |||
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OPROCESS_H | 31 | #ifndef OPROCESS_H |
32 | #define OPROCESS_H | 32 | #define OPROCESS_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qcstring.h> | 35 | #include <qcstring.h> |
36 | #include <qobject.h> | 36 | #include <qobject.h> |
37 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
38 | 38 | ||
39 | /* STD */ | 39 | /* STD */ |
40 | #include <sys/types.h> // for pid_t | 40 | #include <sys/types.h> // for pid_t |
41 | #include <sys/wait.h> | 41 | #include <sys/wait.h> |
42 | #include <signal.h> | 42 | #include <signal.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | 44 | ||
45 | class QSocketNotifier; | 45 | class QSocketNotifier; |
46 | 46 | ||
47 | namespace Opie { | 47 | namespace Opie { |
48 | namespace Core { | 48 | namespace Core { |
49 | namespace Internal { | 49 | namespace Internal { |
50 | class OProcessController; | 50 | class OProcessController; |
51 | class OProcessPrivate; | 51 | class OProcessPrivate; |
52 | } | 52 | } |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Child process invocation, monitoring and control. | 55 | * Child process invocation, monitoring and control. |
56 | * | 56 | * |
57 | * @sect General usage and features | 57 | * @par General usage and features |
58 | * | 58 | * |
59 | *This class allows a KDE and OPIE application to start child processes without having | 59 | *This class allows a KDE and OPIE application to start child processes without having |
60 | *to worry about UN*X signal handling issues and zombie process reaping. | 60 | *to worry about UN*X signal handling issues and zombie process reaping. |
61 | * | 61 | * |
62 | *@see KProcIO | 62 | *@see KProcIO |
63 | * | 63 | * |
64 | *Basically, this class distinguishes three different ways of running | 64 | *Basically, this class distinguishes three different ways of running |
65 | *child processes: | 65 | *child processes: |
66 | * | 66 | * |
67 | *@li OProcess::DontCare -- The child process is invoked and both the child | 67 | *@li OProcess::DontCare -- The child process is invoked and both the child |
68 | *process and the parent process continue concurrently. | 68 | *process and the parent process continue concurrently. |
69 | * | 69 | * |
70 | *Starting a DontCare child process means that the application is | 70 | *Starting a DontCare child process means that the application is |
71 | *not interested in any notification to determine whether the | 71 | *not interested in any notification to determine whether the |
72 | *child process has already exited or not. | 72 | *child process has already exited or not. |
73 | * | 73 | * |
74 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the | 74 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the |
75 | *child and the parent process run concurrently. | 75 | *child and the parent process run concurrently. |
76 | * | 76 | * |
77 | *When the child process exits, the OProcess instance | 77 | *When the child process exits, the OProcess instance |
78 | *corresponding to it emits the Qt signal @ref processExited(). | 78 | *corresponding to it emits the Qt signal @ref processExited(). |
79 | * | 79 | * |
80 | *Since this signal is @em not emitted from within a UN*X | 80 | *Since this signal is @em not emitted from within a UN*X |
81 | *signal handler, arbitrary function calls can be made. | 81 | *signal handler, arbitrary function calls can be made. |
82 | * | 82 | * |
83 | *Be aware: When the OProcess objects gets destructed, the child | 83 | *Be aware: When the OProcess objects gets destructed, the child |
84 | *process will be killed if it is still running! | 84 | *process will be killed if it is still running! |
85 | *This means in particular, that you cannot use a OProcess on the stack | 85 | *This means in particular, that you cannot use a OProcess on the stack |
86 | *with OProcess::NotifyOnExit. | 86 | *with OProcess::NotifyOnExit. |
87 | * | 87 | * |
88 | *@li OProcess::Block -- The child process starts and the parent process | 88 | *@li OProcess::Block -- The child process starts and the parent process |
89 | *is suspended until the child process exits. (@em Really not recommended | 89 | *is suspended until the child process exits. (@em Really not recommended |
90 | *for programs with a GUI.) | 90 | *for programs with a GUI.) |
91 | * | 91 | * |
92 | *OProcess also provides several functions for determining the exit status | 92 | *OProcess also provides several functions for determining the exit status |
93 | *and the pid of the child process it represents. | 93 | *and the pid of the child process it represents. |
94 | * | 94 | * |
95 | *Furthermore it is possible to supply command-line arguments to the process | 95 | *Furthermore it is possible to supply command-line arguments to the process |
96 | *in a clean fashion (no null -- terminated stringlists and such...) | 96 | *in a clean fashion (no null -- terminated stringlists and such...) |
97 | * | 97 | * |
98 | *A small usage example: | 98 | *A small usage example: |
99 | *<pre> | 99 | *<pre> |
100 | *OProcess *proc = new OProcess; | 100 | *OProcess *proc = new OProcess; |
101 | * | 101 | * |
102 | **proc << "my_executable"; | 102 | **proc << "my_executable"; |
103 | **proc << "These" << "are" << "the" << "command" << "line" << "args"; | 103 | **proc << "These" << "are" << "the" << "command" << "line" << "args"; |
104 | *QApplication::connect(proc, SIGNAL(processExited(Opie::Core::OProcess *)), | 104 | *QApplication::connect(proc, SIGNAL(processExited(Opie::Core::OProcess *)), |
105 | * pointer_to_my_object, SLOT(my_objects_slot(Opie::Core::OProcess *))); | 105 | * pointer_to_my_object, SLOT(my_objects_slot(Opie::Core::OProcess *))); |
106 | *proc->start(); | 106 | *proc->start(); |
107 | *</pre> | 107 | *</pre> |
108 | * | 108 | * |
109 | *This will start "my_executable" with the commandline arguments "These"... | 109 | *This will start "my_executable" with the commandline arguments "These"... |
110 | * | 110 | * |
111 | *When the child process exits, the respective Qt signal will be emitted. | 111 | *When the child process exits, the respective Qt signal will be emitted. |
112 | * | 112 | * |
113 | *@sect Communication with the child process | 113 | *@par Communication with the child process |
114 | * | 114 | * |
115 | *OProcess supports communication with the child process through | 115 | *OProcess supports communication with the child process through |
116 | *stdin/stdout/stderr. | 116 | *stdin/stdout/stderr. |
117 | * | 117 | * |
118 | *The following functions are provided for getting data from the child | 118 | *The following functions are provided for getting data from the child |
119 | *process or sending data to the child's stdin (For more information, | 119 | *process or sending data to the child's stdin (For more information, |
120 | *have a look at the documentation of each function): | 120 | *have a look at the documentation of each function): |
121 | * | 121 | * |
122 | *@li bool @ref writeStdin(char *buffer, int buflen); | 122 | *@li bool @ref writeStdin(char *buffer, int buflen); |
123 | *@li -- Transmit data to the child process's stdin. | 123 | *@li -- Transmit data to the child process's stdin. |
124 | * | 124 | * |
125 | *@li bool @ref closeStdin(); | 125 | *@li bool @ref closeStdin(); |
126 | *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). | 126 | *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). |
127 | *Returns false if you try to close stdin for a process that has been started | 127 | *Returns false if you try to close stdin for a process that has been started |
128 | *without a communication channel to stdin. | 128 | *without a communication channel to stdin. |
129 | * | 129 | * |
130 | *@li bool @ref closeStdout(); | 130 | *@li bool @ref closeStdout(); |
131 | *@li -- Closes the child process's stdout. | 131 | *@li -- Closes the child process's stdout. |
132 | *Returns false if you try to close stdout for a process that has been started | 132 | *Returns false if you try to close stdout for a process that has been started |
133 | *without a communication channel to stdout. | 133 | *without a communication channel to stdout. |
134 | * | 134 | * |
135 | *@li bool @ref closeStderr(); | 135 | *@li bool @ref closeStderr(); |
136 | *@li -- Closes the child process's stderr. | 136 | *@li -- Closes the child process's stderr. |
137 | *Returns false if you try to close stderr for a process that has been started | 137 | *Returns false if you try to close stderr for a process that has been started |
138 | *without a communication channel to stderr. | 138 | *without a communication channel to stderr. |
139 | * | 139 | * |
140 | * | 140 | * |
141 | *@sect QT signals: | 141 | *@par QT signals: |
142 | * | 142 | * |
143 | *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); | 143 | *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); |
144 | *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); | 144 | *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); |
145 | *@li -- Indicates that new data has arrived from either the | 145 | *@li -- Indicates that new data has arrived from either the |
146 | *child process's stdout or stderr. | 146 | *child process's stdout or stderr. |
147 | * | 147 | * |
148 | *@li void @ref wroteStdin(OProcess *proc); | 148 | *@li void @ref wroteStdin(OProcess *proc); |
149 | *@li -- Indicates that all data that has been sent to the child process | 149 | *@li -- Indicates that all data that has been sent to the child process |
150 | *by a prior call to @ref writeStdin() has actually been transmitted to the | 150 | *by a prior call to @ref writeStdin() has actually been transmitted to the |
151 | *client . | 151 | *client . |
152 | * | 152 | * |
153 | *@author Christian Czezakte e9025461@student.tuwien.ac.at | 153 | *@author Christian Czezakte e9025461@student.tuwien.ac.at |
154 | *@author Holger Freyther (Opie Port) | 154 | *@author Holger Freyther (Opie Port) |
155 | * | 155 | * |
156 | **/ | 156 | **/ |
157 | class OProcess : public QObject | 157 | class OProcess : public QObject |
158 | { | 158 | { |
159 | Q_OBJECT | 159 | Q_OBJECT |
160 | 160 | ||
161 | public: | 161 | public: |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Modes in which the communication channel can be opened. | 164 | * Modes in which the communication channel can be opened. |
165 | * | 165 | * |
166 | * If communication for more than one channel is required, | 166 | * If communication for more than one channel is required, |
167 | * the values have to be or'ed together, for example to get | 167 | * the values have to be or'ed together, for example to get |
168 | * communication with stdout as well as with stdin, you would | 168 | * communication with stdout as well as with stdin, you would |
169 | * specify @p Stdin @p | @p Stdout | 169 | * specify @p Stdin @p | @p Stdout |
170 | * | 170 | * |
171 | * If @p NoRead is specified in conjunction with @p Stdout, | 171 | * If @p NoRead is specified in conjunction with @p Stdout, |
172 | * no data is actually read from @p Stdout but only | 172 | * no data is actually read from @p Stdout but only |
173 | * the signal @ref childOutput(int fd) is emitted. | 173 | * the signal @ref childOutput(int fd) is emitted. |
174 | */ | 174 | */ |
175 | enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, | 175 | enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, |
176 | AllOutput = 6, All = 7, | 176 | AllOutput = 6, All = 7, |
177 | NoRead }; | 177 | NoRead }; |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Run-modes for a child process. | 180 | * Run-modes for a child process. |
181 | */ | 181 | */ |
182 | enum RunMode { | 182 | enum RunMode { |
183 | /** | 183 | /** |
184 | * The application does not receive notifications from the subprocess when | 184 | * The application does not receive notifications from the subprocess when |
185 | * it is finished or aborted. | 185 | * it is finished or aborted. |
186 | */ | 186 | */ |
187 | DontCare, | 187 | DontCare, |
188 | /** | 188 | /** |
189 | * The application is notified when the subprocess dies. | 189 | * The application is notified when the subprocess dies. |
@@ -446,129 +446,131 @@ public: | |||
446 | * @p quote A flag indicating whether to quote the arguments. | 446 | * @p quote A flag indicating whether to quote the arguments. |
447 | * | 447 | * |
448 | * When using a shell, the caller should make sure that all filenames etc. | 448 | * When using a shell, the caller should make sure that all filenames etc. |
449 | * are properly quoted when passed as argument. | 449 | * are properly quoted when passed as argument. |
450 | * @see quote() | 450 | * @see quote() |
451 | */ | 451 | */ |
452 | void setUseShell( bool useShell, const char *shell = 0 ); | 452 | void setUseShell( bool useShell, const char *shell = 0 ); |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * This function can be used to quote an argument string such that | 455 | * This function can be used to quote an argument string such that |
456 | * the shell processes it properly. This is e. g. necessary for | 456 | * the shell processes it properly. This is e. g. necessary for |
457 | * user-provided file names which may contain spaces or quotes. | 457 | * user-provided file names which may contain spaces or quotes. |
458 | * It also prevents expansion of wild cards and environment variables. | 458 | * It also prevents expansion of wild cards and environment variables. |
459 | */ | 459 | */ |
460 | static QString quote( const QString &arg ); | 460 | static QString quote( const QString &arg ); |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * Detaches OProcess from child process. All communication is closed. | 463 | * Detaches OProcess from child process. All communication is closed. |
464 | * No exit notification is emitted any more for the child process. | 464 | * No exit notification is emitted any more for the child process. |
465 | * Deleting the OProcess will no longer kill the child process. | 465 | * Deleting the OProcess will no longer kill the child process. |
466 | * Note that the current process remains the parent process of the | 466 | * Note that the current process remains the parent process of the |
467 | * child process. | 467 | * child process. |
468 | */ | 468 | */ |
469 | void detach(); | 469 | void detach(); |
470 | 470 | ||
471 | /** | 471 | /** |
472 | * @return the PID of @a process, or -1 if the process is not running | 472 | * @return the PID of @a process, or -1 if the process is not running |
473 | */ | 473 | */ |
474 | static int processPID( const QString& process ); | 474 | static int processPID( const QString& process ); |
475 | 475 | ||
476 | signals: | 476 | signals: |
477 | 477 | ||
478 | /** | 478 | /** |
479 | * Emitted after the process has terminated when | 479 | * Emitted after the process has terminated when |
480 | * the process was run in the @p NotifyOnExit (==default option to | 480 | * the process was run in the @p NotifyOnExit (==default option to |
481 | * @ref start()) or the @ref Block mode. | 481 | * @ref start()) or the @ref Block mode. |
482 | **/ | 482 | **/ |
483 | void processExited( Opie::Core::OProcess *proc ); | 483 | void processExited( Opie::Core::OProcess *proc ); |
484 | 484 | ||
485 | 485 | ||
486 | /** | 486 | /** |
487 | * Emitted, when output from the child process has | 487 | * Emitted, when output from the child process has |
488 | * been received on stdout. | 488 | * been received on stdout. |
489 | * | 489 | * |
490 | * To actually get | 490 | * To actually get |
491 | * these signals, the respective communication link (stdout/stderr) | 491 | * these signals, the respective communication link (stdout/stderr) |
492 | * has to be turned on in @ref start(). | 492 | * has to be turned on in @ref start(). |
493 | * | 493 | * |
494 | * @param proc The process | ||
494 | * @param buffer The data received. | 495 | * @param buffer The data received. |
495 | * @param buflen The number of bytes that are available. | 496 | * @param buflen The number of bytes that are available. |
496 | * | 497 | * |
497 | * You should copy the information contained in @p buffer to your private | 498 | * You should copy the information contained in @p buffer to your private |
498 | * data structures before returning from this slot. | 499 | * data structures before returning from this slot. |
499 | **/ | 500 | **/ |
500 | void receivedStdout( Opie::Core::OProcess *proc, char *buffer, int buflen ); | 501 | void receivedStdout( Opie::Core::OProcess *proc, char *buffer, int buflen ); |
501 | 502 | ||
502 | /** | 503 | /** |
503 | * Emitted when output from the child process has | 504 | * Emitted when output from the child process has |
504 | * been received on stdout. | 505 | * been received on stdout. |
505 | * | 506 | * |
506 | * To actually get these signals, the respective communications link | 507 | * To actually get these signals, the respective communications link |
507 | * (stdout/stderr) has to be turned on in @ref start() and the | 508 | * (stdout/stderr) has to be turned on in @ref start() and the |
508 | * @p NoRead flag should have been passed. | 509 | * @p NoRead flag should have been passed. |
509 | * | 510 | * |
510 | * You will need to explicitly call resume() after your call to start() | 511 | * You will need to explicitly call resume() after your call to start() |
511 | * to begin processing data from the child process's stdout. This is | 512 | * to begin processing data from the child process's stdout. This is |
512 | * to ensure that this signal is not emitted when no one is connected | 513 | * to ensure that this signal is not emitted when no one is connected |
513 | * to it, otherwise this signal will not be emitted. | 514 | * to it, otherwise this signal will not be emitted. |
514 | * | 515 | * |
515 | * The data still has to be read from file descriptor @p fd. | 516 | * The data still has to be read from file descriptor @p fd. |
516 | **/ | 517 | **/ |
517 | void receivedStdout( int fd, int &len ); | 518 | void receivedStdout( int fd, int &len ); |
518 | 519 | ||
519 | 520 | ||
520 | /** | 521 | /** |
521 | * Emitted, when output from the child process has | 522 | * Emitted, when output from the child process has |
522 | * been received on stderr. | 523 | * been received on stderr. |
523 | * To actually get | 524 | * To actually get |
524 | * these signals, the respective communication link (stdout/stderr) | 525 | * these signals, the respective communication link (stdout/stderr) |
525 | * has to be turned on in @ref start(). | 526 | * has to be turned on in @ref start(). |
526 | * | 527 | * |
528 | * @param proc The process | ||
527 | * @param buffer The data received. | 529 | * @param buffer The data received. |
528 | * @param buflen The number of bytes that are available. | 530 | * @param buflen The number of bytes that are available. |
529 | * | 531 | * |
530 | * You should copy the information contained in @p buffer to your private | 532 | * You should copy the information contained in @p buffer to your private |
531 | * data structures before returning from this slot. | 533 | * data structures before returning from this slot. |
532 | */ | 534 | */ |
533 | void receivedStderr( Opie::Core::OProcess *proc, char *buffer, int buflen ); | 535 | void receivedStderr( Opie::Core::OProcess *proc, char *buffer, int buflen ); |
534 | 536 | ||
535 | /** | 537 | /** |
536 | * Emitted after all the data that has been | 538 | * Emitted after all the data that has been |
537 | * specified by a prior call to @ref writeStdin() has actually been | 539 | * specified by a prior call to @ref writeStdin() has actually been |
538 | * written to the child process. | 540 | * written to the child process. |
539 | **/ | 541 | **/ |
540 | void wroteStdin( Opie::Core::OProcess *proc ); | 542 | void wroteStdin( Opie::Core::OProcess *proc ); |
541 | 543 | ||
542 | protected slots: | 544 | protected slots: |
543 | 545 | ||
544 | /** | 546 | /** |
545 | * This slot gets activated when data from the child's stdout arrives. | 547 | * This slot gets activated when data from the child's stdout arrives. |
546 | * It usually calls "childOutput" | 548 | * It usually calls "childOutput" |
547 | */ | 549 | */ |
548 | void slotChildOutput( int fdno ); | 550 | void slotChildOutput( int fdno ); |
549 | 551 | ||
550 | /** | 552 | /** |
551 | * This slot gets activated when data from the child's stderr arrives. | 553 | * This slot gets activated when data from the child's stderr arrives. |
552 | * It usually calls "childError" | 554 | * It usually calls "childError" |
553 | */ | 555 | */ |
554 | void slotChildError( int fdno ); | 556 | void slotChildError( int fdno ); |
555 | /* | 557 | /* |
556 | Slot functions for capturing stdout and stderr of the child | 558 | Slot functions for capturing stdout and stderr of the child |
557 | */ | 559 | */ |
558 | 560 | ||
559 | /** | 561 | /** |
560 | * Called when another bulk of data can be sent to the child's | 562 | * Called when another bulk of data can be sent to the child's |
561 | * stdin. If there is no more data to be sent to stdin currently | 563 | * stdin. If there is no more data to be sent to stdin currently |
562 | * available, this function must disable the QSocketNotifier "innot". | 564 | * available, this function must disable the QSocketNotifier "innot". |
563 | */ | 565 | */ |
564 | void slotSendData( int dummy ); | 566 | void slotSendData( int dummy ); |
565 | 567 | ||
566 | protected: | 568 | protected: |
567 | 569 | ||
568 | /** | 570 | /** |
569 | * Sets up the environment according to the data passed via | 571 | * Sets up the environment according to the data passed via |
570 | * setEnvironment(...) | 572 | * setEnvironment(...) |
571 | */ | 573 | */ |
572 | void setupEnvironment(); | 574 | void setupEnvironment(); |
573 | 575 | ||
574 | /** | 576 | /** |
diff --git a/libopie2/opieui/oimageeffect.h b/libopie2/opieui/oimageeffect.h index 4f86d5b..4422741 100644 --- a/libopie2/opieui/oimageeffect.h +++ b/libopie2/opieui/oimageeffect.h | |||
@@ -174,186 +174,186 @@ public: | |||
174 | */ | 174 | */ |
175 | static QImage& blend(QImage &image1, QImage &image2, | 175 | static QImage& blend(QImage &image1, QImage &image2, |
176 | QImage &blendImage, RGBComponent channel); | 176 | QImage &blendImage, RGBComponent channel); |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Blend an image into another one, using alpha in the expected way. | 179 | * Blend an image into another one, using alpha in the expected way. |
180 | * @author Rik Hemsley (rikkus) <rik@kde.org> | 180 | * @author Rik Hemsley (rikkus) <rik@kde.org> |
181 | */ | 181 | */ |
182 | static bool blend(const QImage & upper, const QImage & lower, QImage & output); | 182 | static bool blend(const QImage & upper, const QImage & lower, QImage & output); |
183 | // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); | 183 | // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Blend an image into another one, using alpha in the expected way and | 186 | * Blend an image into another one, using alpha in the expected way and |
187 | * over coordinates @p x and @p y with respect to the lower image. | 187 | * over coordinates @p x and @p y with respect to the lower image. |
188 | * The output is a QImage which is the @p upper image already blended | 188 | * The output is a QImage which is the @p upper image already blended |
189 | * with the @p lower one, so its size will be (in general) the same than | 189 | * with the @p lower one, so its size will be (in general) the same than |
190 | * @p upper instead of the same size than @p lower like the method above. | 190 | * @p upper instead of the same size than @p lower like the method above. |
191 | * In fact, the size of @p output is like upper's one only when it can be | 191 | * In fact, the size of @p output is like upper's one only when it can be |
192 | * painted on lower, if there has to be some clipping, output's size will | 192 | * painted on lower, if there has to be some clipping, output's size will |
193 | * be the clipped area and x and y will be set to the correct up-left corner | 193 | * be the clipped area and x and y will be set to the correct up-left corner |
194 | * where the clipped rectangle begins. | 194 | * where the clipped rectangle begins. |
195 | */ | 195 | */ |
196 | static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); | 196 | static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); |
197 | /** | 197 | /** |
198 | * Blend an image into another one, using alpha in the expected way and | 198 | * Blend an image into another one, using alpha in the expected way and |
199 | * over coordinates @p x and @p y with respect to the lower image. | 199 | * over coordinates @p x and @p y with respect to the lower image. |
200 | * The output is painted in the own @p lower image. This is an optimization | 200 | * The output is painted in the own @p lower image. This is an optimization |
201 | * of the blend method above provided by convenience. | 201 | * of the blend method above provided by convenience. |
202 | */ | 202 | */ |
203 | static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); | 203 | static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); |
204 | 204 | ||
205 | /** | 205 | /** |
206 | * Modifies the intensity of a pixmap's RGB channel component. | 206 | * Modifies the intensity of a pixmap's RGB channel component. |
207 | * | 207 | * |
208 | * @author Daniel M. Duley (mosfet) | 208 | * @author Daniel M. Duley (mosfet) |
209 | * @param image The QImage to process. | 209 | * @param image The QImage to process. |
210 | * @param percent Percent value. Use a negative value to dim. | 210 | * @param percent Percent value. Use a negative value to dim. |
211 | * @param channel Which channel(s) should be modified | 211 | * @param channel Which channel(s) should be modified |
212 | * @return The @p image, provided for convenience. | 212 | * @return The @p image, provided for convenience. |
213 | */ | 213 | */ |
214 | static QImage& channelIntensity(QImage &image, float percent, | 214 | static QImage& channelIntensity(QImage &image, float percent, |
215 | RGBComponent channel); | 215 | RGBComponent channel); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Fade an image to a certain background color. | 218 | * Fade an image to a certain background color. |
219 | * | 219 | * |
220 | * The number of colors will not be changed. | 220 | * The number of colors will not be changed. |
221 | * | 221 | * |
222 | * @param image The QImage to process. | 222 | * @param img The QImage to process. |
223 | * @param val The strength of the effect. 0 <= val <= 1. | 223 | * @param val The strength of the effect. 0 <= val <= 1. |
224 | * @param color The background color. | 224 | * @param color The background color. |
225 | * @return Returns the @ref image(), provided for convenience. | 225 | * @return Returns the @ref image(), provided for convenience. |
226 | */ | 226 | */ |
227 | static QImage& fade(QImage &img, float val, const QColor &color); | 227 | static QImage& fade(QImage &img, float val, const QColor &color); |
228 | 228 | ||
229 | 229 | ||
230 | /** | 230 | /** |
231 | * This recolors a pixmap. The most dark color will become color a, | 231 | * This recolors a pixmap. The most dark color will become color a, |
232 | * the most bright one color b, and in between. | 232 | * the most bright one color b, and in between. |
233 | * | 233 | * |
234 | * @param image A QImage to process. | 234 | * @param image A QImage to process. |
235 | * @param ca Color a | 235 | * @param ca Color a |
236 | * @param cb Color b | 236 | * @param cb Color b |
237 | */ | 237 | */ |
238 | static QImage& flatten(QImage &image, const QColor &ca, | 238 | static QImage& flatten(QImage &image, const QColor &ca, |
239 | const QColor &cb, int ncols=0); | 239 | const QColor &cb, int ncols=0); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Build a hash on any given @ref QImage | 242 | * Build a hash on any given @ref QImage |
243 | * | 243 | * |
244 | * @param image The QImage to process | 244 | * @param image The QImage to process |
245 | * @param lite The hash faces the indicated lighting (cardinal poles). | 245 | * @param lite The hash faces the indicated lighting (cardinal poles). |
246 | * @param spacing How many unmodified pixels inbetween hashes. | 246 | * @param spacing How many unmodified pixels inbetween hashes. |
247 | * @return Returns the @ref image(), provided for convenience. | 247 | * @return Returns the @ref image(), provided for convenience. |
248 | */ | 248 | */ |
249 | static QImage& hash(QImage &image, Lighting lite=NorthLite, | 249 | static QImage& hash(QImage &image, Lighting lite=NorthLite, |
250 | unsigned int spacing=0); | 250 | unsigned int spacing=0); |
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Either brighten or dim the image by a specified percent. | 253 | * Either brighten or dim the image by a specified percent. |
254 | * For example, .50 will modify the colors by 50%. | 254 | * For example, .50 will modify the colors by 50%. |
255 | * | 255 | * |
256 | * @author Daniel M. Duley (mosfet) | 256 | * @author Daniel M. Duley (mosfet) |
257 | * @param image The QImage to process. | 257 | * @param image The QImage to process. |
258 | * @param percent The percent value. Use a negative value to dim. | 258 | * @param percent The percent value. Use a negative value to dim. |
259 | * @return Returns The @ref image(), provided for convenience. | 259 | * @return Returns The @ref image(), provided for convenience. |
260 | */ | 260 | */ |
261 | static QImage& intensity(QImage &image, float percent); | 261 | static QImage& intensity(QImage &image, float percent); |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Modulate the image with a color channel of another image. | 264 | * Modulate the image with a color channel of another image. |
265 | * | 265 | * |
266 | * @param image The QImage to modulate and result. | 266 | * @param image The QImage to modulate and result. |
267 | * @param modImage The QImage to use for modulation. | 267 | * @param modImage The QImage to use for modulation. |
268 | * @param reverse Invert the meaning of image/modImage; result is image! | 268 | * @param reverse Invert the meaning of image/modImage; result is image! |
269 | * @param type The modulation Type to use. | 269 | * @param type The modulation Type to use. |
270 | * @param factor The modulation amplitude; with 0 no effect [-200;200]. | 270 | * @param factor The modulation amplitude; with 0 no effect [-200;200]. |
271 | * @param channel The RBG channel of image2 to use for modulation. | 271 | * @param channel The RBG channel of image2 to use for modulation. |
272 | * @return Returns the @ref image(), provided for convenience. | 272 | * @return Returns the @ref image(), provided for convenience. |
273 | */ | 273 | */ |
274 | static QImage& modulate(QImage &image, QImage &modImage, bool reverse, | 274 | static QImage& modulate(QImage &image, QImage &modImage, bool reverse, |
275 | ModulationType type, int factor, RGBComponent channel); | 275 | ModulationType type, int factor, RGBComponent channel); |
276 | 276 | ||
277 | /** | 277 | /** |
278 | * Convert an image to grayscale. | 278 | * Convert an image to grayscale. |
279 | * | 279 | * |
280 | * @author Daniel M. Duley (mosfet) | 280 | * @author Daniel M. Duley (mosfet) |
281 | * @param image The @ref QImage to process. | 281 | * @param image The @ref QImage to process. |
282 | * @param fast Set to @p true in order to use a faster but non-photographic | 282 | * @param fast Set to @p true in order to use a faster but non-photographic |
283 | * quality algorithm. Appropriate for things such as toolbar icons. | 283 | * quality algorithm. Appropriate for things such as toolbar icons. |
284 | * @return Returns the @ref image(), provided for convenience. | 284 | * @return Returns the @ref image(), provided for convenience. |
285 | */ | 285 | */ |
286 | static QImage& toGray(QImage &image, bool fast = false); | 286 | static QImage& toGray(QImage &image, bool fast = false); |
287 | 287 | ||
288 | /** | 288 | /** |
289 | * Desaturate an image evenly. | 289 | * Desaturate an image evenly. |
290 | * | 290 | * |
291 | * @param image The QImage to process. | 291 | * @param image The QImage to process. |
292 | * @param desat A value between 0 and 1 setting the degree of desaturation | 292 | * @param desat A value between 0 and 1 setting the degree of desaturation |
293 | * @return Returns the @ref image(), provided for convenience. | 293 | * @return Returns the @ref image(), provided for convenience. |
294 | */ | 294 | */ |
295 | static QImage& desaturate(QImage &image, float desat = 0.3); | 295 | static QImage& desaturate(QImage &image, float desat = 0.3); |
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Fast, but low quality contrast of an image. Also see contrastHSV. | 298 | * Fast, but low quality contrast of an image. Also see contrastHSV. |
299 | * | 299 | * |
300 | * @author Daniel M. Duley (mosfet) | 300 | * @author Daniel M. Duley (mosfet) |
301 | * @param image The QImage to process. | 301 | * @param image The QImage to process. |
302 | * @param c A contrast value between -255 to 255. | 302 | * @param c A contrast value between -255 to 255. |
303 | * @return The @ref image(), provided for convenience. | 303 | * @return The @ref image(), provided for convenience. |
304 | */ | 304 | */ |
305 | static QImage& contrast(QImage &image, int c); | 305 | static QImage& contrast(QImage &image, int c); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Dither an image using Floyd-Steinberg dithering for low-color | 308 | * Dither an image using Floyd-Steinberg dithering for low-color |
309 | * situations. | 309 | * situations. |
310 | * | 310 | * |
311 | * @param image The QImage to process. | 311 | * @param img The QImage to process. |
312 | * @param palette The color palette to use | 312 | * @param palette The color palette to use |
313 | * @param size The size of the palette | 313 | * @param size The size of the palette |
314 | * @return Returns the @ref image(), provided for convenience. | 314 | * @return Returns the @ref image(), provided for convenience. |
315 | */ | 315 | */ |
316 | static QImage& dither(QImage &img, const QColor *palette, int size); | 316 | static QImage& dither(QImage &img, const QColor *palette, int size); |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * Calculate the image for a selected image, for instance a selected icon | 319 | * Calculate the image for a selected image, for instance a selected icon |
320 | * on the desktop. | 320 | * on the desktop. |
321 | * @param img the QImage to select | 321 | * @param img the QImage to select |
322 | * @param col the selected color, usually from QColorGroup::highlight(). | 322 | * @param col the selected color, usually from QColorGroup::highlight(). |
323 | */ | 323 | */ |
324 | static QImage& selectedImage( QImage &img, const QColor &col ); | 324 | static QImage& selectedImage( QImage &img, const QColor &col ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * High quality, expensive HSV contrast. You can do a faster one by just | 327 | * High quality, expensive HSV contrast. You can do a faster one by just |
328 | * taking a intensity threshold (ie: 128) and incrementing RGB color | 328 | * taking a intensity threshold (ie: 128) and incrementing RGB color |
329 | * channels above it and decrementing those below it, but this gives much | 329 | * channels above it and decrementing those below it, but this gives much |
330 | * better results. | 330 | * better results. |
331 | * | 331 | * |
332 | * @author Daniel M. Duley (mosfet) | 332 | * @author Daniel M. Duley (mosfet) |
333 | * @param img The QImage to process. | 333 | * @param img The QImage to process. |
334 | * @param sharpen If true sharpness is increase, (spiffed). Otherwise | 334 | * @param sharpen If true sharpness is increase, (spiffed). Otherwise |
335 | * it is decreased, (dulled). | 335 | * it is decreased, (dulled). |
336 | */ | 336 | */ |
337 | static void contrastHSV(QImage &img, bool sharpen=true); | 337 | static void contrastHSV(QImage &img, bool sharpen=true); |
338 | 338 | ||
339 | /** | 339 | /** |
340 | * Normalizes the pixel values to span the full range of color values. | 340 | * Normalizes the pixel values to span the full range of color values. |
341 | * This is a contrast enhancement technique. | 341 | * This is a contrast enhancement technique. |
342 | * @author Daniel M. Duley (mosfet) | 342 | * @author Daniel M. Duley (mosfet) |
343 | */ | 343 | */ |
344 | static void normalize(QImage &img); | 344 | static void normalize(QImage &img); |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * Performs histogram equalization on the reference | 347 | * Performs histogram equalization on the reference |
348 | * image. | 348 | * image. |
349 | * @author Daniel M. Duley (mosfet) | 349 | * @author Daniel M. Duley (mosfet) |
350 | */ | 350 | */ |
351 | static void equalize(QImage &img); | 351 | static void equalize(QImage &img); |
352 | 352 | ||
353 | /** | 353 | /** |
354 | * Thresholds the reference image. You can also threshold images by using | 354 | * Thresholds the reference image. You can also threshold images by using |
355 | * ThresholdDither in the various QPixmap/QImage convert methods, but this | 355 | * ThresholdDither in the various QPixmap/QImage convert methods, but this |
356 | * lets you specify a threshold value. | 356 | * lets you specify a threshold value. |
357 | * | 357 | * |
358 | * @author Daniel M. Duley (mosfet) | 358 | * @author Daniel M. Duley (mosfet) |
359 | * @param img The QImage to process. | 359 | * @param img The QImage to process. |
@@ -485,80 +485,80 @@ public: | |||
485 | * @author Daniel M. Duley (mosfet) | 485 | * @author Daniel M. Duley (mosfet) |
486 | * @param src The QImage to process. | 486 | * @param src The QImage to process. |
487 | * @param factor The percent weight to give to the center pixel. | 487 | * @param factor The percent weight to give to the center pixel. |
488 | * @return The sharpened image. The original is not changed. | 488 | * @return The sharpened image. The original is not changed. |
489 | */ | 489 | */ |
490 | static QImage sharpen(QImage &src, double factor=30.0); | 490 | static QImage sharpen(QImage &src, double factor=30.0); |
491 | 491 | ||
492 | /** | 492 | /** |
493 | * Randomly displaces pixels. | 493 | * Randomly displaces pixels. |
494 | * | 494 | * |
495 | * @author Daniel M. Duley (mosfet) | 495 | * @author Daniel M. Duley (mosfet) |
496 | * @param src The QImage to process. | 496 | * @param src The QImage to process. |
497 | * @param amount The vicinity for choosing a random pixel to swap. | 497 | * @param amount The vicinity for choosing a random pixel to swap. |
498 | * @return The image with pixels displaced. The original is not changed. | 498 | * @return The image with pixels displaced. The original is not changed. |
499 | */ | 499 | */ |
500 | static QImage spread(QImage &src, unsigned int amount=3); | 500 | static QImage spread(QImage &src, unsigned int amount=3); |
501 | 501 | ||
502 | /** | 502 | /** |
503 | * Shades the image using a distance light source. | 503 | * Shades the image using a distance light source. |
504 | * | 504 | * |
505 | * @author Daniel M. Duley (mosfet) | 505 | * @author Daniel M. Duley (mosfet) |
506 | * @param src The QImage to process. | 506 | * @param src The QImage to process. |
507 | * @param color_shading If true do color shading, otherwise do grayscale. | 507 | * @param color_shading If true do color shading, otherwise do grayscale. |
508 | * @param azimuth Determines the light source and direction. | 508 | * @param azimuth Determines the light source and direction. |
509 | * @param elevation Determines the light source and direction. | 509 | * @param elevation Determines the light source and direction. |
510 | * @return The shaded image. The original is not changed. | 510 | * @return The shaded image. The original is not changed. |
511 | */ | 511 | */ |
512 | static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, | 512 | static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, |
513 | double elevation=30.0); | 513 | double elevation=30.0); |
514 | /** | 514 | /** |
515 | * Swirls the image by a specified amount | 515 | * Swirls the image by a specified amount |
516 | * | 516 | * |
517 | * @author Daniel M. Duley (mosfet) | 517 | * @author Daniel M. Duley (mosfet) |
518 | * @param src The QImage to process. | 518 | * @param src The QImage to process. |
519 | * @param degrees The tightness of the swirl. | 519 | * @param degrees The tightness of the swirl. |
520 | * @param background An RGBA value to use for the background. After the | 520 | * @param background An RGBA value to use for the background. After the |
521 | * effect some pixels may be "empty". This value is used for those pixels. | 521 | * effect some pixels may be "empty". This value is used for those pixels. |
522 | * @return The swirled image. The original is not changed. | 522 | * @return The swirled image. The original is not changed. |
523 | */ | 523 | */ |
524 | static QImage swirl(QImage &src, double degrees=50.0, unsigned int background = | 524 | static QImage swirl(QImage &src, double degrees=50.0, unsigned int background = |
525 | 0xFFFFFFFF); | 525 | 0xFFFFFFFF); |
526 | 526 | ||
527 | /** | 527 | /** |
528 | * Modifies the pixels along a sine wave. | 528 | * Modifies the pixels along a sine wave. |
529 | * | 529 | * |
530 | * @author Daniel M. Duley (mosfet) | 530 | * @author Daniel M. Duley (mosfet) |
531 | * @param src The QImage to process. | 531 | * @param src The QImage to process. |
532 | * @param amplitude The amplitude of the sine wave. | 532 | * @param amplitude The amplitude of the sine wave. |
533 | * @param wavelength The frequency of the sine wave. | 533 | * @param frequency The frequency of the sine wave. |
534 | * @return The new image. The original is not changed. | 534 | * @return The new image. The original is not changed. |
535 | */ | 535 | */ |
536 | static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0, | 536 | static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0, |
537 | unsigned int background = 0xFFFFFFFF); | 537 | unsigned int background = 0xFFFFFFFF); |
538 | 538 | ||
539 | private: | 539 | private: |
540 | 540 | ||
541 | /** | 541 | /** |
542 | * Helper function to fast calc some altered (lighten, shaded) colors | 542 | * Helper function to fast calc some altered (lighten, shaded) colors |
543 | * | 543 | * |
544 | */ | 544 | */ |
545 | static unsigned int lHash(unsigned int c); | 545 | static unsigned int lHash(unsigned int c); |
546 | static unsigned int uHash(unsigned int c); | 546 | static unsigned int uHash(unsigned int c); |
547 | 547 | ||
548 | /** | 548 | /** |
549 | * Helper function to find the nearest color to the RBG triplet | 549 | * Helper function to find the nearest color to the RBG triplet |
550 | */ | 550 | */ |
551 | static int nearestColor( int r, int g, int b, const QColor *pal, int size ); | 551 | static int nearestColor( int r, int g, int b, const QColor *pal, int size ); |
552 | 552 | ||
553 | static void hull(const int x_offset, const int y_offset, const int polarity, | 553 | static void hull(const int x_offset, const int y_offset, const int polarity, |
554 | const int width, const int height, | 554 | const int width, const int height, |
555 | unsigned int *f, unsigned int *g); | 555 | unsigned int *f, unsigned int *g); |
556 | static unsigned int generateNoise(unsigned int pixel, NoiseType type); | 556 | static unsigned int generateNoise(unsigned int pixel, NoiseType type); |
557 | static unsigned int interpolateColor(QImage *image, double x, double y, | 557 | static unsigned int interpolateColor(QImage *image, double x, double y, |
558 | unsigned int background); | 558 | unsigned int background); |
559 | }; | 559 | }; |
560 | 560 | ||
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | #endif | 564 | #endif |
diff --git a/libopie2/opieui/opixmapeffect.h b/libopie2/opieui/opixmapeffect.h index b780f9f..85a1e25 100644 --- a/libopie2/opieui/opixmapeffect.h +++ b/libopie2/opieui/opixmapeffect.h | |||
@@ -107,106 +107,101 @@ public: | |||
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Blends the provided pixmap into a background of the indicated color. | 109 | * Blends the provided pixmap into a background of the indicated color. |
110 | * | 110 | * |
111 | * @param pixmap The pixmap to process. | 111 | * @param pixmap The pixmap to process. |
112 | * @param initial_intensity this parameter takes values from -1 to 1: | 112 | * @param initial_intensity this parameter takes values from -1 to 1: |
113 | * @li If positive, it tells how much to fade the image in its | 113 | * @li If positive, it tells how much to fade the image in its |
114 | * less affected spot. | 114 | * less affected spot. |
115 | * @li If negative, it tells roughly indicates how much of the image | 115 | * @li If negative, it tells roughly indicates how much of the image |
116 | * remains unaffected | 116 | * remains unaffected |
117 | * @param bgnd Indicates the color of the background to blend in. | 117 | * @param bgnd Indicates the color of the background to blend in. |
118 | * @param eff Lets you choose what kind of blending you like. | 118 | * @param eff Lets you choose what kind of blending you like. |
119 | * @param anti_dir Blend in the opposite direction (makes no much sense | 119 | * @param anti_dir Blend in the opposite direction (makes no much sense |
120 | * with concentric blending effects). | 120 | * with concentric blending effects). |
121 | * @return Returns the @ref pixmap(), provided for convenience. | 121 | * @return Returns the @ref pixmap(), provided for convenience. |
122 | */ | 122 | */ |
123 | static OPixmap& blend(OPixmap& pixmap, float initial_intensity, | 123 | static OPixmap& blend(OPixmap& pixmap, float initial_intensity, |
124 | const QColor &bgnd, GradientType eff, | 124 | const QColor &bgnd, GradientType eff, |
125 | bool anti_dir=false, int ncols=3); | 125 | bool anti_dir=false, int ncols=3); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Builds a hash on any given pixmap. | 128 | * Builds a hash on any given pixmap. |
129 | * | 129 | * |
130 | * @param pixmap The pixmap to process. | 130 | * @param pixmap The pixmap to process. |
131 | * @param lite The hash faces the indicated lighting (cardinal poles) | 131 | * @param lite The hash faces the indicated lighting (cardinal poles) |
132 | * @param spacing How many unmodified pixels inbetween hashes. | 132 | * @param spacing How many unmodified pixels inbetween hashes. |
133 | * @return Returns The @ref pixmap(), provided for convenience. | 133 | * @return Returns The @ref pixmap(), provided for convenience. |
134 | */ | 134 | */ |
135 | static OPixmap& hash(OPixmap& pixmap, Lighting lite=NorthLite, | 135 | static OPixmap& hash(OPixmap& pixmap, Lighting lite=NorthLite, |
136 | unsigned int spacing=0, int ncols=3); | 136 | unsigned int spacing=0, int ncols=3); |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Creates a pattern from a pixmap. | 139 | * Creates a pattern from a pixmap. |
140 | * | 140 | * |
141 | * The given pixmap is "flattened" | 141 | * The given pixmap is "flattened" |
142 | * between color a to color b. | 142 | * between color a to color b. |
143 | * | 143 | * |
144 | * @param pixmap The pixmap to process. | 144 | * @param pixmap The pixmap to process. |
145 | * @param ca Color a. | 145 | * @param ca Color a. |
146 | * @param cb Color b. | 146 | * @param cb Color b. |
147 | * @param ncols The number of colors to use. The image will be | 147 | * @param ncols The number of colors to use. The image will be |
148 | * dithered to this depth. Pass zero to prevent dithering. | 148 | * dithered to this depth. Pass zero to prevent dithering. |
149 | * @return The @ref pixmap(), provided for convenience. | 149 | * @return The @ref pixmap(), provided for convenience. |
150 | */ | 150 | */ |
151 | static OPixmap pattern(const OPixmap& pixmap, QSize size, | 151 | static OPixmap pattern(const OPixmap& pixmap, QSize size, |
152 | const QColor &ca, const QColor &cb, int ncols=8); | 152 | const QColor &ca, const QColor &cb, int ncols=8); |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Recolors a pixmap. | 155 | * Fades a pixmap to a certain color. |
156 | * | ||
157 | * The most dark color will become color a, | ||
158 | * the most bright one color b, and in between. | ||
159 | * | 156 | * |
160 | * @param pixmap The pixmap to process. | 157 | * @param pixmap The pixmap to process. |
161 | * @param ca Color a. | 158 | * @param val The strength of the effect. 0 <= val <= 1. |
162 | * @param cb Color b. | 159 | * @param color The color to blend to. |
163 | * @param ncols The number of colors to use. Pass zero to prevent | ||
164 | * dithering. | ||
165 | * @return Returns the @ref pixmap(), provided for convenience. | 160 | * @return Returns the @ref pixmap(), provided for convenience. |
166 | */ | 161 | */ |
167 | static OPixmap& fade(OPixmap& pixmap, double val, const QColor &color); | 162 | static OPixmap& fade(OPixmap& pixmap, double val, const QColor &color); |
168 | 163 | ||
169 | /** | 164 | /** |
170 | * Converts a pixmap to grayscale. | 165 | * Converts a pixmap to grayscale. |
171 | * | 166 | * |
172 | * @param pixmap The pixmap to process. | 167 | * @param pixmap The pixmap to process. |
173 | * @param fast Set to @p true in order to use a faster but non-photographic | 168 | * @param fast Set to @p true in order to use a faster but non-photographic |
174 | * quality algorithm. Appropriate for things such as toolbar icons. | 169 | * quality algorithm. Appropriate for things such as toolbar icons. |
175 | * @return Returns the @ref pixmap(), provided for convenience. | 170 | * @return Returns the @ref pixmap(), provided for convenience. |
176 | */ | 171 | */ |
177 | static OPixmap& toGray(OPixmap& pixmap, bool fast=false); | 172 | static OPixmap& toGray(OPixmap& pixmap, bool fast=false); |
178 | 173 | ||
179 | /** | 174 | /** |
180 | * Desaturates a pixmap. | 175 | * Desaturates a pixmap. |
181 | * | 176 | * |
182 | * @param pixmap The pixmap to process. | 177 | * @param pixmap The pixmap to process. |
183 | * @param desat A value between 0 and 1 setting the degree of desaturation | 178 | * @param desat A value between 0 and 1 setting the degree of desaturation |
184 | * @return Returns The @ref pixmap(), provided for convenience. | 179 | * @return Returns The @ref pixmap(), provided for convenience. |
185 | */ | 180 | */ |
186 | static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3); | 181 | static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3); |
187 | 182 | ||
188 | /** | 183 | /** |
189 | * Modifies the contrast of a pixmap. | 184 | * Modifies the contrast of a pixmap. |
190 | * | 185 | * |
191 | * @param pixmap The pixmap to process. | 186 | * @param pixmap The pixmap to process. |
192 | * @param c A contrast value between -255 and 255. | 187 | * @param c A contrast value between -255 and 255. |
193 | * @return Returns the @ref pixmap(), provided for convenience. | 188 | * @return Returns the @ref pixmap(), provided for convenience. |
194 | */ | 189 | */ |
195 | static OPixmap& contrast(OPixmap& pixmap, int c); | 190 | static OPixmap& contrast(OPixmap& pixmap, int c); |
196 | 191 | ||
197 | /** | 192 | /** |
198 | * Dithers a pixmap using Floyd-Steinberg dithering for low-color | 193 | * Dithers a pixmap using Floyd-Steinberg dithering for low-color |
199 | * situations. | 194 | * situations. |
200 | * | 195 | * |
201 | * @param pixmap The pixmap to process. | 196 | * @param pixmap The pixmap to process. |
202 | * @param palette The color palette to use. | 197 | * @param palette The color palette to use. |
203 | * @param size The size of the palette. | 198 | * @param size The size of the palette. |
204 | * @return Returns the @ref pixmap(), provided for convenience. | 199 | * @return Returns the @ref pixmap(), provided for convenience. |
205 | */ | 200 | */ |
206 | static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); | 201 | static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); |
207 | 202 | ||
208 | /** | 203 | /** |
209 | * Calculate a 'selected' pixmap, for instance a selected icon | 204 | * Calculate a 'selected' pixmap, for instance a selected icon |
210 | * on the desktop. | 205 | * on the desktop. |
211 | * @param pixmap the pixmap to select | 206 | * @param pixmap the pixmap to select |
212 | * @param col the selected color, usually from QColorGroup::highlight(). | 207 | * @param col the selected color, usually from QColorGroup::highlight(). |
diff --git a/libopie2/qt3/opieui/ocombobox.h b/libopie2/qt3/opieui/ocombobox.h index 4e35b61..3f60f54 100644 --- a/libopie2/qt3/opieui/ocombobox.h +++ b/libopie2/qt3/opieui/ocombobox.h | |||
@@ -8,141 +8,141 @@ | |||
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef OCOMBOBOX_H | 33 | #ifndef OCOMBOBOX_H |
34 | #define OCOMBOBOX_H | 34 | #define OCOMBOBOX_H |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | 37 | ||
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | 39 | ||
40 | /* OPIE */ | 40 | /* OPIE */ |
41 | 41 | ||
42 | #include <opie2/olineedit.h> | 42 | #include <opie2/olineedit.h> |
43 | #include <opie2/ocompletion.h> | 43 | #include <opie2/ocompletion.h> |
44 | #include <opie2/ocompletionbase.h> | 44 | #include <opie2/ocompletionbase.h> |
45 | 45 | ||
46 | /* FORWARDS */ | 46 | /* FORWARDS */ |
47 | 47 | ||
48 | class QListBoxItem; | 48 | class QListBoxItem; |
49 | class QPopupMenu; | 49 | class QPopupMenu; |
50 | class OCompletionBox; | 50 | class OCompletionBox; |
51 | typedef QString OURL; | 51 | typedef QString OURL; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * A combined button, line-edit and a popup list widget. | 54 | * A combined button, line-edit and a popup list widget. |
55 | * | 55 | * |
56 | * @sect Detail | 56 | * @par Detail |
57 | * | 57 | * |
58 | * This widget inherits from @ref QComboBox and implements | 58 | * This widget inherits from @ref QComboBox and implements |
59 | * the following additional functionalities: a completion | 59 | * the following additional functionalities: a completion |
60 | * object that provides both automatic and manual text | 60 | * object that provides both automatic and manual text |
61 | * completion as well as text rotation features, configurable | 61 | * completion as well as text rotation features, configurable |
62 | * key-bindings to activate these features, and a popup-menu | 62 | * key-bindings to activate these features, and a popup-menu |
63 | * item that can be used to allow the user to set text completion | 63 | * item that can be used to allow the user to set text completion |
64 | * modes on the fly based on their preference. | 64 | * modes on the fly based on their preference. |
65 | * | 65 | * |
66 | * To support these new features OComboBox also emits a few | 66 | * To support these new features OComboBox also emits a few |
67 | * more additional signals as well. The main ones are the | 67 | * more additional signals as well. The main ones are the |
68 | * @ref completion( const QString& ) and @ref textRotation( KeyBindingType ) | 68 | * @ref completion( const QString& ) and @ref textRotation( KeyBindingType ) |
69 | * signals. The completion signal is intended to be connected to a slot | 69 | * signals. The completion signal is intended to be connected to a slot |
70 | * that will assist the user in filling out the remaining text while | 70 | * that will assist the user in filling out the remaining text while |
71 | * the rotation signals is intended to be used to traverse through all | 71 | * the rotation signals is intended to be used to traverse through all |
72 | * possible matches whenever text completion results in multiple matches. | 72 | * possible matches whenever text completion results in multiple matches. |
73 | * The @ref returnPressed() and @ref returnPressed( const QString& ) | 73 | * The @ref returnPressed() and @ref returnPressed( const QString& ) |
74 | * signal is emitted when the user presses the Enter/Return key. | 74 | * signal is emitted when the user presses the Enter/Return key. |
75 | * | 75 | * |
76 | * This widget by default creates a completion object when you invoke | 76 | * This widget by default creates a completion object when you invoke |
77 | * the @ref completionObject( bool ) member function for the first time | 77 | * the @ref completionObject( bool ) member function for the first time |
78 | * or use @ref setCompletionObject( OCompletion*, bool ) to assign your | 78 | * or use @ref setCompletionObject( OCompletion*, bool ) to assign your |
79 | * own completion object. Additionally, to make this widget more functional, | 79 | * own completion object. Additionally, to make this widget more functional, |
80 | * OComboBox will by default handle the text rotation and completion | 80 | * OComboBox will by default handle the text rotation and completion |
81 | * events internally whenever a completion object is created through either | 81 | * events internally whenever a completion object is created through either |
82 | * one of the methods mentioned above. If you do not need this functionality, | 82 | * one of the methods mentioned above. If you do not need this functionality, |
83 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or alternatively | 83 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or alternatively |
84 | * set the boolean parameter in the above methods to FALSE. | 84 | * set the boolean parameter in the above methods to FALSE. |
85 | * | 85 | * |
86 | * The default key-bindings for completion and rotation is determined | 86 | * The default key-bindings for completion and rotation is determined |
87 | * from the global settings in @ref OStdAccel. These values, however, | 87 | * from the global settings in @ref OStdAccel. These values, however, |
88 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). | 88 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). |
89 | * The values can easily be reverted back to the default setting, by simply | 89 | * The values can easily be reverted back to the default setting, by simply |
90 | * calling @ref useGlobalSettings(). An alternate method would be to default | 90 | * calling @ref useGlobalSettings(). An alternate method would be to default |
91 | * individual key-bindings by usning @ref setKeyBinding() with the default | 91 | * individual key-bindings by usning @ref setKeyBinding() with the default |
92 | * second argument. | 92 | * second argument. |
93 | * | 93 | * |
94 | * Note that if this widget is not editable ( i.e. select-only ), then only | 94 | * Note that if this widget is not editable ( i.e. select-only ), then only |
95 | * one completion mode, @p CompletionAuto, will work. All the other modes are | 95 | * one completion mode, @p CompletionAuto, will work. All the other modes are |
96 | * simply ignored. The @p CompletionAuto mode in this case allows you to | 96 | * simply ignored. The @p CompletionAuto mode in this case allows you to |
97 | * automatically select an item from the list by trying to match the pressed | 97 | * automatically select an item from the list by trying to match the pressed |
98 | * keycode with the first letter of the enteries in the combo box. | 98 | * keycode with the first letter of the enteries in the combo box. |
99 | * | 99 | * |
100 | * @sect Useage | 100 | * @par Usage |
101 | * | 101 | * |
102 | * To enable the basic completion feature: | 102 | * To enable the basic completion feature: |
103 | * | 103 | * |
104 | * <pre> | 104 | * <pre> |
105 | * OComboBox *combo = new OComboBox( true, this, "mywidget" ); | 105 | * OComboBox *combo = new OComboBox( true, this, "mywidget" ); |
106 | * OCompletion *comp = combo->completionObject(); | 106 | * OCompletion *comp = combo->completionObject(); |
107 | * // Connect to the return pressed signal - optional | 107 | * // Connect to the return pressed signal - optional |
108 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 108 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
109 | * </pre> | 109 | * </pre> |
110 | * | 110 | * |
111 | * To use your own completion object: | 111 | * To use your own completion object: |
112 | * | 112 | * |
113 | * <pre> | 113 | * <pre> |
114 | * OComboBox *combo = new OComboBox( this,"mywidget" ); | 114 | * OComboBox *combo = new OComboBox( this,"mywidget" ); |
115 | * OURLCompletion *comp = new OURLCompletion(); | 115 | * OURLCompletion *comp = new OURLCompletion(); |
116 | * combo->setCompletionObject( comp ); | 116 | * combo->setCompletionObject( comp ); |
117 | * // Connect to the return pressed signal - optional | 117 | * // Connect to the return pressed signal - optional |
118 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 118 | * connect(combo,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
119 | * </pre> | 119 | * </pre> |
120 | * | 120 | * |
121 | * Note that you have to either delete the allocated completion object | 121 | * Note that you have to either delete the allocated completion object |
122 | * when you don't need it anymore, or call | 122 | * when you don't need it anymore, or call |
123 | * setAutoDeleteCompletionObject( true ); | 123 | * setAutoDeleteCompletionObject( true ); |
124 | * | 124 | * |
125 | * Miscellaneous function calls: | 125 | * Miscellaneous function calls: |
126 | * | 126 | * |
127 | * <pre> | 127 | * <pre> |
128 | * // Tell the widget not to handle completion and rotation | 128 | * // Tell the widget not to handle completion and rotation |
129 | * combo->setHandleSignals( false ); | 129 | * combo->setHandleSignals( false ); |
130 | * // Set your own completion key for manual completions. | 130 | * // Set your own completion key for manual completions. |
131 | * combo->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); | 131 | * combo->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); |
132 | * // Hide the context (popup) menu | 132 | * // Hide the context (popup) menu |
133 | * combo->setContextMenuEnabled( false ); | 133 | * combo->setContextMenuEnabled( false ); |
134 | * // Temporarly disable signal emition | 134 | * // Temporarly disable signal emition |
135 | * combo->disableSignals(); | 135 | * combo->disableSignals(); |
136 | * // Default the all key-bindings to their system-wide settings. | 136 | * // Default the all key-bindings to their system-wide settings. |
137 | * combo->useGlobalKeyBindings(); | 137 | * combo->useGlobalKeyBindings(); |
138 | * </pre> | 138 | * </pre> |
139 | * | 139 | * |
140 | * @short An enhanced combo box. | 140 | * @short An enhanced combo box. |
141 | * @author Dawit Alemayehu <adawit@kde.org> | 141 | * @author Dawit Alemayehu <adawit@kde.org> |
142 | */ | 142 | */ |
143 | class OComboBox : public QComboBox, public OCompletionBase | 143 | class OComboBox : public QComboBox, public OCompletionBase |
144 | { | 144 | { |
145 | Q_OBJECT | 145 | Q_OBJECT |
146 | 146 | ||
147 | //Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) | 147 | //Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) |
148 | //Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) | 148 | //Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) |
diff --git a/libopie2/qt3/opieui/olineedit.h b/libopie2/qt3/opieui/olineedit.h index ecfca27..db3d7ef 100644 --- a/libopie2/qt3/opieui/olineedit.h +++ b/libopie2/qt3/opieui/olineedit.h | |||
@@ -5,172 +5,172 @@ | |||
5 | Copyright (C) 1997 Sven Radej (sven.radej@iname.com) | 5 | Copyright (C) 1997 Sven Radej (sven.radej@iname.com) |
6 | =. | 6 | =. |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef OLINEEDIT_H | 33 | #ifndef OLINEEDIT_H |
34 | #define OLINEEDIT_H | 34 | #define OLINEEDIT_H |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | 37 | ||
38 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
39 | 39 | ||
40 | /* OPIE */ | 40 | /* OPIE */ |
41 | 41 | ||
42 | #include <opie2/ocompletion.h> | 42 | #include <opie2/ocompletion.h> |
43 | #include <opie2/ocompletionbase.h> | 43 | #include <opie2/ocompletionbase.h> |
44 | 44 | ||
45 | class QPopupMenu; | 45 | class QPopupMenu; |
46 | 46 | ||
47 | class OCompletionBox; | 47 | class OCompletionBox; |
48 | typedef QString KURL; //class KURL; | 48 | typedef QString KURL; //class KURL; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * An enhanced QLineEdit widget for inputting text. | 51 | * An enhanced QLineEdit widget for inputting text. |
52 | * | 52 | * |
53 | * @sect Detail | 53 | * @par Detail |
54 | * | 54 | * |
55 | * This widget inherits from @ref QLineEdit and implements the following | 55 | * This widget inherits from @ref QLineEdit and implements the following |
56 | * additional functionalities: q completion object that provides both | 56 | * additional functionalities: q completion object that provides both |
57 | * automatic and manual text completion as well as multiple match iteration | 57 | * automatic and manual text completion as well as multiple match iteration |
58 | * features, configurable key-bindings to activate these features and a | 58 | * features, configurable key-bindings to activate these features and a |
59 | * popup-menu item that can be used to allow the user to set text completion | 59 | * popup-menu item that can be used to allow the user to set text completion |
60 | * modes on the fly based on their preference. | 60 | * modes on the fly based on their preference. |
61 | * | 61 | * |
62 | * To support these new features OLineEdit also emits a few more | 62 | * To support these new features OLineEdit also emits a few more |
63 | * additional signals. These are: @ref completion( const QString& ), | 63 | * additional signals. These are: @ref completion( const QString& ), |
64 | * textRotation( KeyBindingType ), and @ref returnPressed( const QString& ). | 64 | * textRotation( KeyBindingType ), and @ref returnPressed( const QString& ). |
65 | * The completion signal can be connected to a slot that will assist the | 65 | * The completion signal can be connected to a slot that will assist the |
66 | * user in filling out the remaining text. The text rotation signal is | 66 | * user in filling out the remaining text. The text rotation signal is |
67 | * intended to be used to iterate through the list of all possible matches | 67 | * intended to be used to iterate through the list of all possible matches |
68 | * whenever there is more than one match for the entered text. The | 68 | * whenever there is more than one match for the entered text. The |
69 | * @p returnPressed( const QString& ) signals are the same as QLineEdit's | 69 | * @p returnPressed( const QString& ) signals are the same as QLineEdit's |
70 | * except it provides the current text in the widget as its argument whenever | 70 | * except it provides the current text in the widget as its argument whenever |
71 | * appropriate. | 71 | * appropriate. |
72 | * | 72 | * |
73 | * This widget by default creates a completion object when you invoke | 73 | * This widget by default creates a completion object when you invoke |
74 | * the @ref completionObject( bool ) member function for the first time or | 74 | * the @ref completionObject( bool ) member function for the first time or |
75 | * use @ref setCompletionObject( OCompletion*, bool ) to assign your own | 75 | * use @ref setCompletionObject( OCompletion*, bool ) to assign your own |
76 | * completion object. Additionally, to make this widget more functional, | 76 | * completion object. Additionally, to make this widget more functional, |
77 | * OLineEdit will by default handle the text rotation and completion | 77 | * OLineEdit will by default handle the text rotation and completion |
78 | * events internally when a completion object is created through either one | 78 | * events internally when a completion object is created through either one |
79 | * of the methods mentioned above. If you do not need this functionality, | 79 | * of the methods mentioned above. If you do not need this functionality, |
80 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or set the | 80 | * simply use @ref OCompletionBase::setHandleSignals( bool ) or set the |
81 | * boolean parameter in the above functions to FALSE. | 81 | * boolean parameter in the above functions to FALSE. |
82 | * | 82 | * |
83 | * The default key-bindings for completion and rotation is determined | 83 | * The default key-bindings for completion and rotation is determined |
84 | * from the global settings in @ref OStdAccel. These values, however, | 84 | * from the global settings in @ref OStdAccel. These values, however, |
85 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). | 85 | * can be overriden locally by invoking @ref OCompletionBase::setKeyBinding(). |
86 | * The values can easily be reverted back to the default setting, by simply | 86 | * The values can easily be reverted back to the default setting, by simply |
87 | * calling @ref useGlobalSettings(). An alternate method would be to default | 87 | * calling @ref useGlobalSettings(). An alternate method would be to default |
88 | * individual key-bindings by usning @ref setKeyBinding() with the default | 88 | * individual key-bindings by usning @ref setKeyBinding() with the default |
89 | * second argument. | 89 | * second argument. |
90 | * | 90 | * |
91 | * NOTE that if the @p EchoMode for this widget is set to something other | 91 | * NOTE that if the @p EchoMode for this widget is set to something other |
92 | * than @p QLineEdit::Normal, the completion mode will always be defaulted | 92 | * than @p QLineEdit::Normal, the completion mode will always be defaulted |
93 | * to @ref PGlobalSettings::CompletionNone. This is done purposefully to guard | 93 | * to @ref PGlobalSettings::CompletionNone. This is done purposefully to guard |
94 | * against protected entries such as passwords being cached in @ref OCompletion's | 94 | * against protected entries such as passwords being cached in @ref OCompletion's |
95 | * list. Hence, if the @p EchoMode is not @ref QLineEdit::Normal, the completion | 95 | * list. Hence, if the @p EchoMode is not @ref QLineEdit::Normal, the completion |
96 | * mode is automatically disabled. | 96 | * mode is automatically disabled. |
97 | * | 97 | * |
98 | * @sect Useage | 98 | * @par Usage |
99 | * | 99 | * |
100 | * To enable the basic completion feature : | 100 | * To enable the basic completion feature : |
101 | * | 101 | * |
102 | * <pre> | 102 | * <pre> |
103 | * OLineEdit *edit = new OLineEdit( this, "mywidget" ); | 103 | * OLineEdit *edit = new OLineEdit( this, "mywidget" ); |
104 | * OCompletion *comp = edit->completionObject(); | 104 | * OCompletion *comp = edit->completionObject(); |
105 | * // Fill the completion object with a list of possible matches | 105 | * // Fill the completion object with a list of possible matches |
106 | * QStringList list; | 106 | * QStringList list; |
107 | * list << "mickeyl@handhelds.org" << "mickey@tm.informatik.uni-frankfurt.de>" << "mickey@Vanille.de"; | 107 | * list << "mickeyl@handhelds.org" << "mickey@tm.informatik.uni-frankfurt.de>" << "mickey@Vanille.de"; |
108 | * comp->setItems( list ); | 108 | * comp->setItems( list ); |
109 | * // Connect to the return pressed signal (optional) | 109 | * // Connect to the return pressed signal (optional) |
110 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 110 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
111 | * </pre> | 111 | * </pre> |
112 | * | 112 | * |
113 | * To use a customized completion objects or your | 113 | * To use a customized completion objects or your |
114 | * own completion object : | 114 | * own completion object : |
115 | * | 115 | * |
116 | * <pre> | 116 | * <pre> |
117 | * OLineEdit *edit = new OLineEdit( this,"mywidget" ); | 117 | * OLineEdit *edit = new OLineEdit( this,"mywidget" ); |
118 | * KURLCompletion *comp = new KURLCompletion(); | 118 | * KURLCompletion *comp = new KURLCompletion(); |
119 | * edit->setCompletionObject( comp ); | 119 | * edit->setCompletionObject( comp ); |
120 | * // Connect to the return pressed signal - optional | 120 | * // Connect to the return pressed signal - optional |
121 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); | 121 | * connect(edit,SIGNAL(returnPressed(const QString&)),comp,SLOT(addItem(const QString&)); |
122 | * </pre> | 122 | * </pre> |
123 | * | 123 | * |
124 | * Note that you have to either delete the allocated completion object | 124 | * Note that you have to either delete the allocated completion object |
125 | * when you don't need it anymore, or call | 125 | * when you don't need it anymore, or call |
126 | * setAutoDeleteCompletionObject( true ); | 126 | * setAutoDeleteCompletionObject( true ); |
127 | * | 127 | * |
128 | * @sect Miscellaneous function calls : | 128 | * @par Miscellaneous function calls : |
129 | * | 129 | * |
130 | * <pre> | 130 | * <pre> |
131 | * // Tell the widget not to handle completion and | 131 | * // Tell the widget not to handle completion and |
132 | * // iteration internally. | 132 | * // iteration internally. |
133 | * edit->setHandleSignals( false ); | 133 | * edit->setHandleSignals( false ); |
134 | * // Set your own completion key for manual completions. | 134 | * // Set your own completion key for manual completions. |
135 | * edit->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); | 135 | * edit->setKeyBinding( OCompletionBase::TextCompletion, Qt::End ); |
136 | * // Hide the context (popup) menu | 136 | * // Hide the context (popup) menu |
137 | * edit->setContextMenuEnabled( false ); | 137 | * edit->setContextMenuEnabled( false ); |
138 | * // Temporarly disable signal emitions | 138 | * // Temporarly disable signal emitions |
139 | * // (both completion & iteration signals) | 139 | * // (both completion & iteration signals) |
140 | * edit->disableSignals(); | 140 | * edit->disableSignals(); |
141 | * // Default the key-bindings to system settings. | 141 | * // Default the key-bindings to system settings. |
142 | * edit->useGlobalKeyBindings(); | 142 | * edit->useGlobalKeyBindings(); |
143 | * </pre> | 143 | * </pre> |
144 | * | 144 | * |
145 | * @short An enhanced single line input widget. | 145 | * @short An enhanced single line input widget. |
146 | * @author Dawit Alemayehu <adawit@kde.org> | 146 | * @author Dawit Alemayehu <adawit@kde.org> |
147 | * @author Opie adaption by Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | 147 | * @author Opie adaption by Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> |
148 | */ | 148 | */ |
149 | 149 | ||
150 | class OLineEdit : public QLineEdit, public OCompletionBase | 150 | class OLineEdit : public QLineEdit, public OCompletionBase |
151 | { | 151 | { |
152 | friend class OComboBox; | 152 | friend class OComboBox; |
153 | 153 | ||
154 | Q_OBJECT | 154 | Q_OBJECT |
155 | Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) | 155 | Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled ) |
156 | Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) | 156 | Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled ) |
157 | 157 | ||
158 | public: | 158 | public: |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Constructs a OLineEdit object with a default text, a parent, | 161 | * Constructs a OLineEdit object with a default text, a parent, |
162 | * and a name. | 162 | * and a name. |
163 | * | 163 | * |
164 | * @param string Text to be shown in the edit widget. | 164 | * @param string Text to be shown in the edit widget. |
165 | * @param parent The parent object of this widget. | 165 | * @param parent The parent object of this widget. |
166 | * @param name the name of this widget | 166 | * @param name the name of this widget |
167 | */ | 167 | */ |
168 | OLineEdit( const QString &string, QWidget *parent, const char *name = 0 ); | 168 | OLineEdit( const QString &string, QWidget *parent, const char *name = 0 ); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * Constructs a OLineEdit object with a parent and a name. | 171 | * Constructs a OLineEdit object with a parent and a name. |
172 | * | 172 | * |
173 | * @param string Text to be shown in the edit widget. | 173 | * @param string Text to be shown in the edit widget. |
174 | * @param parent The parent object of this widget. | 174 | * @param parent The parent object of this widget. |
175 | * @param name The name of this widget. | 175 | * @param name The name of this widget. |
176 | */ | 176 | */ |