-rw-r--r-- | library/qpeapplication.cpp | 155 |
1 files changed, 108 insertions, 47 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c41dd06..852671a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -97,3 +97,3 @@ public: | |||
97 | forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 ) | 97 | forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 ) |
98 | 98 | ||
99 | { | 99 | { |
@@ -129,3 +129,3 @@ public: | |||
129 | QList<QCopRec> qcopq; | 129 | QList<QCopRec> qcopq; |
130 | 130 | ||
131 | void enqueueQCop( const QCString &ch, const QCString &msg, | 131 | void enqueueQCop( const QCString &ch, const QCString &msg, |
@@ -180,3 +180,3 @@ public: | |||
180 | } | 180 | } |
181 | */ | 181 | */ |
182 | return FALSE; | 182 | return FALSE; |
@@ -332,2 +332,44 @@ static void setMic( int t = 0, int percent = -1 ) | |||
332 | 332 | ||
333 | static void setBass( int t = 0, int percent = -1 ) | ||
334 | { | ||
335 | switch ( t ) { | ||
336 | case 0: { | ||
337 | Config cfg( "qpe" ); | ||
338 | cfg.setGroup( "Volume" ); | ||
339 | if ( percent < 0 ) | ||
340 | percent = cfg.readNumEntry( "BassPercent", 50 ); | ||
341 | |||
342 | int fd = 0; | ||
343 | int bass = percent; | ||
344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | ||
345 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | ||
346 | ::close( fd ); | ||
347 | } | ||
348 | } | ||
349 | break; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | |||
354 | static void setTreble( int t = 0, int percent = -1 ) | ||
355 | { | ||
356 | switch ( t ) { | ||
357 | case 0: { | ||
358 | Config cfg( "qpe" ); | ||
359 | cfg.setGroup( "Volume" ); | ||
360 | if ( percent < 0 ) | ||
361 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | ||
362 | |||
363 | int fd = 0; | ||
364 | int treble = percent; | ||
365 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | ||
366 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | ||
367 | ::close( fd ); | ||
368 | } | ||
369 | } | ||
370 | break; | ||
371 | } | ||
372 | } | ||
373 | |||
374 | |||
333 | /*! | 375 | /*! |
@@ -336,3 +378,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
336 | that are available to all Qtopia applications. | 378 | that are available to all Qtopia applications. |
337 | 379 | ||
338 | Simply by using QPEApplication instead of QApplication, a standard Qt | 380 | Simply by using QPEApplication instead of QApplication, a standard Qt |
@@ -342,3 +384,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
342 | changes the currently displayed document in response to the environment. | 384 | changes the currently displayed document in response to the environment. |
343 | 385 | ||
344 | To create a \link docwidget.html document-oriented\endlink | 386 | To create a \link docwidget.html document-oriented\endlink |
@@ -349,3 +391,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
349 | QCop\endlink message. This can be changed using setKeepRunning(). | 391 | QCop\endlink message. This can be changed using setKeepRunning(). |
350 | 392 | ||
351 | A variety of signals are emitted when certain events occur, for | 393 | A variety of signals are emitted when certain events occur, for |
@@ -360,3 +402,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
360 | be received and unfiltered through the appMessage() signal. | 402 | be received and unfiltered through the appMessage() signal. |
361 | 403 | ||
362 | This class also provides a set of useful static functions. The | 404 | This class also provides a set of useful static functions. The |
@@ -369,3 +411,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
369 | inputMethodHint() functions. | 411 | inputMethodHint() functions. |
370 | 412 | ||
371 | \ingroup qtopiaemb | 413 | \ingroup qtopiaemb |
@@ -375,3 +417,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
375 | \fn void QPEApplication::clientMoused() | 417 | \fn void QPEApplication::clientMoused() |
376 | 418 | ||
377 | \internal | 419 | \internal |
@@ -387,3 +429,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
387 | \fn void QPEApplication::clockChanged( bool ampm ); | 429 | \fn void QPEApplication::clockChanged( bool ampm ); |
388 | 430 | ||
389 | This signal is emitted when the user changes the clock's style. If | 431 | This signal is emitted when the user changes the clock's style. If |
@@ -395,3 +437,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
395 | \fn void QPEApplication::volumeChanged( bool muted ) | 437 | \fn void QPEApplication::volumeChanged( bool muted ) |
396 | 438 | ||
397 | This signal is emitted whenever the mute state is changed. If \a | 439 | This signal is emitted whenever the mute state is changed. If \a |
@@ -402,3 +444,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
402 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 444 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
403 | 445 | ||
404 | This signal is emitted if the week start day is changed. If \a | 446 | This signal is emitted if the week start day is changed. If \a |
@@ -411,3 +453,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
411 | \fn void QPEApplication::dateFormatChanged() | 453 | \fn void QPEApplication::dateFormatChanged() |
412 | 454 | ||
413 | This signal is emitted whenever the date format is changed. | 455 | This signal is emitted whenever the date format is changed. |
@@ -417,3 +459,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
417 | \fn void QPEApplication::flush() | 459 | \fn void QPEApplication::flush() |
418 | 460 | ||
419 | ### | 461 | ### |
@@ -423,3 +465,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
423 | \fn void QPEApplication::reload() | 465 | \fn void QPEApplication::reload() |
424 | 466 | ||
425 | */ | 467 | */ |
@@ -428,3 +470,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
428 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 470 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
429 | 471 | ||
430 | This signal is emitted when a message is received on this | 472 | This signal is emitted when a message is received on this |
@@ -432,6 +474,6 @@ static void setMic( int t = 0, int percent = -1 ) | |||
432 | QCop\endlink channel. | 474 | QCop\endlink channel. |
433 | 475 | ||
434 | The slot to which you connect this signal uses \a msg and \a data | 476 | The slot to which you connect this signal uses \a msg and \a data |
435 | in the following way: | 477 | in the following way: |
436 | 478 | ||
437 | \code | 479 | \code |
@@ -449,3 +491,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
449 | \endcode | 491 | \endcode |
450 | 492 | ||
451 | \sa qcop.html | 493 | \sa qcop.html |
@@ -458,3 +500,3 @@ static void setMic( int t = 0, int percent = -1 ) | |||
458 | a QApplication, passing \a argc, \a argv, and \a t. | 500 | a QApplication, passing \a argc, \a argv, and \a t. |
459 | 501 | ||
460 | For applications, \a t should be the default, GuiClient. Only | 502 | For applications, \a t should be the default, GuiClient. Only |
@@ -611,4 +653,4 @@ static void createInputMethodDict() | |||
611 | widget \a w has any use for text input methods. | 653 | widget \a w has any use for text input methods. |
612 | 654 | ||
613 | 655 | ||
614 | \sa setInputMethodHint() InputMethodHint | 656 | \sa setInputMethodHint() InputMethodHint |
@@ -624,3 +666,3 @@ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | |||
624 | \enum QPEApplication::InputMethodHint | 666 | \enum QPEApplication::InputMethodHint |
625 | 667 | ||
626 | \value Normal the application sometimes needs text input (the default). | 668 | \value Normal the application sometimes needs text input (the default). |
@@ -633,3 +675,3 @@ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | |||
633 | as specified by \a mode. | 675 | as specified by \a mode. |
634 | 676 | ||
635 | \sa inputMethodHint() InputMethodHint | 677 | \sa inputMethodHint() InputMethodHint |
@@ -910,8 +952,8 @@ void QPEApplication::applyStyle() | |||
910 | config.setGroup( "Appearance" ); | 952 | config.setGroup( "Appearance" ); |
911 | 953 | ||
912 | // don't block ourselves ... | 954 | // don't block ourselves ... |
913 | Opie::force_appearance = 0; | 955 | Opie::force_appearance = 0; |
914 | 956 | ||
915 | static QString appname = Opie::binaryName ( ); | 957 | static QString appname = Opie::binaryName ( ); |
916 | 958 | ||
917 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 959 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
@@ -924,6 +966,6 @@ void QPEApplication::applyStyle() | |||
924 | } | 966 | } |
925 | 967 | ||
926 | // Widget style | 968 | // Widget style |
927 | QString style = config.readEntry( "Style", "Light" ); | 969 | QString style = config.readEntry( "Style", "Light" ); |
928 | 970 | ||
929 | // don't set a custom style | 971 | // don't set a custom style |
@@ -931,3 +973,3 @@ void QPEApplication::applyStyle() | |||
931 | style = "Light"; | 973 | style = "Light"; |
932 | 974 | ||
933 | internalSetStyle ( style ); | 975 | internalSetStyle ( style ); |
@@ -956,3 +998,3 @@ void QPEApplication::applyStyle() | |||
956 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 998 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
957 | 999 | ||
958 | // don't set a custom deco | 1000 | // don't set a custom deco |
@@ -960,5 +1002,5 @@ void QPEApplication::applyStyle() | |||
960 | dec = ""; | 1002 | dec = ""; |
961 | 1003 | ||
962 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1004 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
963 | 1005 | ||
964 | if ( dec != d->decorationName ) { | 1006 | if ( dec != d->decorationName ) { |
@@ -972,3 +1014,3 @@ void QPEApplication::applyStyle() | |||
972 | 1014 | ||
973 | // don't set a custom font | 1015 | // don't set a custom font |
974 | if ( nostyle & Opie::Force_Font ) { | 1016 | if ( nostyle & Opie::Force_Font ) { |
@@ -977,5 +1019,5 @@ void QPEApplication::applyStyle() | |||
977 | } | 1019 | } |
978 | 1020 | ||
979 | setFont ( QFont ( ff, fs ), true ); | 1021 | setFont ( QFont ( ff, fs ), true ); |
980 | 1022 | ||
981 | // revert to global blocking policy ... | 1023 | // revert to global blocking policy ... |
@@ -1118,2 +1160,21 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data | |||
1118 | } | 1160 | } |
1161 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1162 | int t, v; | ||
1163 | stream >> t >> v; | ||
1164 | setBass( t, v ); | ||
1165 | } | ||
1166 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1167 | setBass(); | ||
1168 | } | ||
1169 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1170 | int t, v; | ||
1171 | stream >> t >> v; | ||
1172 | setTreble( t, v ); | ||
1173 | } | ||
1174 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | ||
1175 | setTreble(); | ||
1176 | } | ||
1177 | |||
1178 | |||
1179 | |||
1119 | #endif | 1180 | #endif |
@@ -1231,3 +1292,3 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | |||
1231 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1292 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1232 | 1293 | ||
1233 | \sa showMainDocumentWidget() | 1294 | \sa showMainDocumentWidget() |
@@ -1242,8 +1303,8 @@ void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | |||
1242 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1303 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1243 | 1304 | ||
1244 | This calls designates the application as | 1305 | This calls designates the application as |
1245 | a \link docwidget.html document-oriented\endlink application. | 1306 | a \link docwidget.html document-oriented\endlink application. |
1246 | 1307 | ||
1247 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1308 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1248 | 1309 | ||
1249 | \sa showMainWidget() | 1310 | \sa showMainWidget() |
@@ -1266,3 +1327,3 @@ void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | |||
1266 | messages the application will start 'properly' and show itself. | 1327 | messages the application will start 'properly' and show itself. |
1267 | 1328 | ||
1268 | \sa keepRunning() | 1329 | \sa keepRunning() |
@@ -1280,3 +1341,3 @@ void QPEApplication::setKeepRunning() | |||
1280 | current list of qcop messages; otherwise returns FALSE. | 1341 | current list of qcop messages; otherwise returns FALSE. |
1281 | 1342 | ||
1282 | \sa setKeepRunning() | 1343 | \sa setKeepRunning() |
@@ -1421,3 +1482,3 @@ static void createDict() | |||
1421 | Returns the current StylusMode for widget \a w. | 1482 | Returns the current StylusMode for widget \a w. |
1422 | 1483 | ||
1423 | \sa setStylusOperation() StylusMode | 1484 | \sa setStylusOperation() StylusMode |
@@ -1433,3 +1494,3 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | |||
1433 | \enum QPEApplication::StylusMode | 1494 | \enum QPEApplication::StylusMode |
1434 | 1495 | ||
1435 | \value LeftOnly the stylus only generates LeftButton | 1496 | \value LeftOnly the stylus only generates LeftButton |
@@ -1438,3 +1499,3 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | |||
1438 | if the user uses the press-and-hold gesture. | 1499 | if the user uses the press-and-hold gesture. |
1439 | 1500 | ||
1440 | \sa setStylusOperation() stylusOperation() | 1501 | \sa setStylusOperation() stylusOperation() |
@@ -1445,3 +1506,3 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | |||
1445 | \a mode. | 1506 | \a mode. |
1446 | 1507 | ||
1447 | \sa stylusOperation() StylusMode | 1508 | \sa stylusOperation() StylusMode |
@@ -1590,3 +1651,3 @@ void QPEApplication::ungrabKeyboard() | |||
1590 | easier. | 1651 | easier. |
1591 | 1652 | ||
1592 | \sa ungrabKeyboard() | 1653 | \sa ungrabKeyboard() |