author | harlekin <harlekin> | 2002-12-13 19:37:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-12-13 19:37:59 (UTC) |
commit | e348262d418e3a133d13d039ed23da4625726f9d (patch) (side-by-side diff) | |
tree | 36cdf26700d424b06b6c37b86e5f1e07bc233b88 | |
parent | 11ccc2e5341677cd54037a1f9cfb04831feed0f9 (diff) | |
download | opie-e348262d418e3a133d13d039ed23da4625726f9d.zip opie-e348262d418e3a133d13d039ed23da4625726f9d.tar.gz opie-e348262d418e3a133d13d039ed23da4625726f9d.tar.bz2 |
added Bass and Treble handling - next stop should be odevice
-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: forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 ) - + { @@ -129,3 +129,3 @@ public: QList<QCopRec> qcopq; - + void enqueueQCop( const QCString &ch, const QCString &msg, @@ -180,3 +180,3 @@ public: } - */ + */ return FALSE; @@ -332,2 +332,44 @@ static void setMic( int t = 0, int percent = -1 ) +static void setBass( int t = 0, int percent = -1 ) +{ + switch ( t ) { + case 0: { + Config cfg( "qpe" ); + cfg.setGroup( "Volume" ); + if ( percent < 0 ) + percent = cfg.readNumEntry( "BassPercent", 50 ); + + int fd = 0; + int bass = percent; + if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { + ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); + ::close( fd ); + } + } + break; + } +} + + +static void setTreble( int t = 0, int percent = -1 ) +{ + switch ( t ) { + case 0: { + Config cfg( "qpe" ); + cfg.setGroup( "Volume" ); + if ( percent < 0 ) + percent = cfg.readNumEntry( "TreblePercent", 50 ); + + int fd = 0; + int treble = percent; + if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { + ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); + ::close( fd ); + } + } + break; + } +} + + /*! @@ -336,3 +378,3 @@ static void setMic( int t = 0, int percent = -1 ) that are available to all Qtopia applications. - + Simply by using QPEApplication instead of QApplication, a standard Qt @@ -342,3 +384,3 @@ static void setMic( int t = 0, int percent = -1 ) changes the currently displayed document in response to the environment. - + To create a \link docwidget.html document-oriented\endlink @@ -349,3 +391,3 @@ static void setMic( int t = 0, int percent = -1 ) QCop\endlink message. This can be changed using setKeepRunning(). - + A variety of signals are emitted when certain events occur, for @@ -360,3 +402,3 @@ static void setMic( int t = 0, int percent = -1 ) be received and unfiltered through the appMessage() signal. - + This class also provides a set of useful static functions. The @@ -369,3 +411,3 @@ static void setMic( int t = 0, int percent = -1 ) inputMethodHint() functions. - + \ingroup qtopiaemb @@ -375,3 +417,3 @@ static void setMic( int t = 0, int percent = -1 ) \fn void QPEApplication::clientMoused() - + \internal @@ -387,3 +429,3 @@ static void setMic( int t = 0, int percent = -1 ) \fn void QPEApplication::clockChanged( bool ampm ); - + 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 ) \fn void QPEApplication::volumeChanged( bool muted ) - + 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 ) \fn void QPEApplication::weekChanged( bool startOnMonday ) - + 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 ) \fn void QPEApplication::dateFormatChanged() - + This signal is emitted whenever the date format is changed. @@ -417,3 +459,3 @@ static void setMic( int t = 0, int percent = -1 ) \fn void QPEApplication::flush() - + ### @@ -423,3 +465,3 @@ static void setMic( int t = 0, int percent = -1 ) \fn void QPEApplication::reload() - + */ @@ -428,3 +470,3 @@ static void setMic( int t = 0, int percent = -1 ) \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) - + This signal is emitted when a message is received on this @@ -432,6 +474,6 @@ static void setMic( int t = 0, int percent = -1 ) QCop\endlink channel. - + The slot to which you connect this signal uses \a msg and \a data in the following way: - + \code @@ -449,3 +491,3 @@ static void setMic( int t = 0, int percent = -1 ) \endcode - + \sa qcop.html @@ -458,3 +500,3 @@ static void setMic( int t = 0, int percent = -1 ) a QApplication, passing \a argc, \a argv, and \a t. - + For applications, \a t should be the default, GuiClient. Only @@ -611,4 +653,4 @@ static void createInputMethodDict() widget \a w has any use for text input methods. - - + + \sa setInputMethodHint() InputMethodHint @@ -624,3 +666,3 @@ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) \enum QPEApplication::InputMethodHint - + \value Normal the application sometimes needs text input (the default). @@ -633,3 +675,3 @@ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) as specified by \a mode. - + \sa inputMethodHint() InputMethodHint @@ -910,8 +952,8 @@ void QPEApplication::applyStyle() config.setGroup( "Appearance" ); - + // don't block ourselves ... Opie::force_appearance = 0; - + static QString appname = Opie::binaryName ( ); - + QStringList ex = config. readListEntry ( "NoStyle", ';' ); @@ -924,6 +966,6 @@ void QPEApplication::applyStyle() } - + // Widget style QString style = config.readEntry( "Style", "Light" ); - + // don't set a custom style @@ -931,3 +973,3 @@ void QPEApplication::applyStyle() style = "Light"; - + internalSetStyle ( style ); @@ -956,3 +998,3 @@ void QPEApplication::applyStyle() QString dec = config.readEntry( "Decoration", "Qtopia" ); - + // don't set a custom deco @@ -960,5 +1002,5 @@ void QPEApplication::applyStyle() dec = ""; - + //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); - + if ( dec != d->decorationName ) { @@ -972,3 +1014,3 @@ void QPEApplication::applyStyle() - // don't set a custom font + // don't set a custom font if ( nostyle & Opie::Force_Font ) { @@ -977,5 +1019,5 @@ void QPEApplication::applyStyle() } - + setFont ( QFont ( ff, fs ), true ); - + // revert to global blocking policy ... @@ -1118,2 +1160,21 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data } + else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + int t, v; + stream >> t >> v; + setBass( t, v ); + } + else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + setBass(); + } + else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + int t, v; + stream >> t >> v; + setTreble( t, v ); + } + else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + setTreble(); + } + + + #endif @@ -1231,3 +1292,3 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) consider passing TRUE for \a nomaximize rather than the default FALSE. - + \sa showMainDocumentWidget() @@ -1242,8 +1303,8 @@ void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) consider passing TRUE for \a nomaximize rather than the default FALSE. - + This calls designates the application as a \link docwidget.html document-oriented\endlink application. - + The \a mw widget \e must have this slot: setDocument(const QString&). - + \sa showMainWidget() @@ -1266,3 +1327,3 @@ void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) messages the application will start 'properly' and show itself. - + \sa keepRunning() @@ -1280,3 +1341,3 @@ void QPEApplication::setKeepRunning() current list of qcop messages; otherwise returns FALSE. - + \sa setKeepRunning() @@ -1421,3 +1482,3 @@ static void createDict() Returns the current StylusMode for widget \a w. - + \sa setStylusOperation() StylusMode @@ -1433,3 +1494,3 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) \enum QPEApplication::StylusMode - + \value LeftOnly the stylus only generates LeftButton @@ -1438,3 +1499,3 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) if the user uses the press-and-hold gesture. - + \sa setStylusOperation() stylusOperation() @@ -1445,3 +1506,3 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) \a mode. - + \sa stylusOperation() StylusMode @@ -1590,3 +1651,3 @@ void QPEApplication::ungrabKeyboard() easier. - + \sa ungrabKeyboard() |