-rw-r--r-- | library/opie-base.control | 2 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 181 | ||||
-rw-r--r-- | library/qpeapplication.h | 6 |
3 files changed, 112 insertions, 77 deletions
diff --git a/library/opie-base.control b/library/opie-base.control index f883268..e610b8b 100644 --- a/library/opie-base.control +++ b/library/opie-base.control @@ -5,3 +5,3 @@ Maintainer: Warwick Allison <warwick@trolltech.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION +Version: $QPE_VERSION-$SUB_VERSION.1 Depends: qt-embedded (>=$QTE_VERSION), opie-qcop, opie-taskbar, opie-pics, opie-sounds, apmd diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 4dbfbd8..a55f5f9 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -165,2 +165,3 @@ public: static int muted=0; +static int micMuted=0; @@ -168,18 +169,37 @@ static void setVolume(int t=0, int percent=-1) { - switch (t) { - case 0: { - Config cfg("Sound"); - cfg.setGroup("System"); - if ( percent < 0 ) - percent = cfg.readNumEntry("Volume",50); - int fd = 0; - if ((fd = open("/dev/mixer", O_RDWR))>=0) { - int vol = muted ? 0 : percent; - // set both channels to same volume - vol |= vol << 8; - ioctl(fd, MIXER_WRITE(0), &vol); - ::close(fd); - } - } break; - } + switch (t) { + case 0: { + Config cfg("Sound"); + cfg.setGroup("System"); + if ( percent < 0 ) + percent = cfg.readNumEntry("Volume",50); + int fd = 0; + if ((fd = open("/dev/mixer", O_RDWR))>=0) { + int vol = muted ? 0 : percent; + // set both channels to same volume + vol |= vol << 8; + ioctl(fd, MIXER_WRITE(0), &vol); + ::close(fd); + } + } break; + } +} + +static void setMic(int t=0, int percent=-1) +{ + switch (t) { + case 0: { + Config cfg("Sound"); + cfg.setGroup("System"); + if ( percent < 0 ) + percent = cfg.readNumEntry("Mic",50); + + int fd = 0; + int mic = micMuted ? 0 : percent; + if ((fd = open("/dev/mixer", O_RDWR))>=0) { + ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &mic); + ::close(fd); + } + } break; + } } @@ -871,5 +891,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) if ( msg == "applyStyle()" ) { - applyStyle(); + applyStyle(); } else if ( msg == "setScreenSaverInterval(int)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { int time; @@ -877,5 +897,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) setScreenSaverInterval(time); - } + } } else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { int t1,t2,t3; @@ -883,5 +903,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) setScreenSaverIntervals(t1,t2,t3); - } + } } else if ( msg == "setBacklight(int)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { int bright; @@ -889,5 +909,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) setBacklight(bright); - } + } } else if ( msg == "setDefaultRotation(int)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { int r; @@ -895,26 +915,26 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) setDefaultRotation(r); - } + } } else if ( msg == "shutdown()" ) { - if ( type() == GuiServer ) + if ( type() == GuiServer ) shutdown(); } else if ( msg == "quit()" ) { - if ( type() != GuiServer ) + if ( type() != GuiServer ) tryQuit(); } else if ( msg == "forceQuit()" ) { - if ( type() != GuiServer ) + if ( type() != GuiServer ) quit(); } else if ( msg == "restart()" ) { - if ( type() == GuiServer ) + if ( type() == GuiServer ) restart(); } else if ( msg == "grabKeyboard(QString)" ) { - QString who; - stream >> who; - if ( who.isEmpty() ) + QString who; + stream >> who; + if ( who.isEmpty() ) d->kbgrabber = 0; - else if ( who != d->appName ) + else if ( who != d->appName ) d->kbgrabber = 1; - else + else d->kbgrabber = 2; } else if ( msg == "language(QString)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { QString l; @@ -923,20 +943,20 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) if ( cl != l ) { - if ( l.isNull() ) + if ( l.isNull() ) unsetenv( "LANG" ); - else + else setenv( "LANG", l.latin1(), 1 ); - restart(); + restart(); } - } + } } else if ( msg == "timeChange(QString)" ) { - QString t; - stream >> t; - if ( t.isNull() ) + QString t; + stream >> t; + if ( t.isNull() ) unsetenv( "TZ" ); - else + else setenv( "TZ", t.latin1(), 1 ); - // emit the signal so everyone else knows... - emit timeChanged(); + // emit the signal so everyone else knows... + emit timeChanged(); } else if ( msg == "execute(QString)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { QString t; @@ -944,5 +964,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) Global::execute( t ); - } + } } else if ( msg == "execute(QString,QString)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { QString t,d; @@ -950,5 +970,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) Global::execute( t, d ); - } + } } else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { QDateTime when; @@ -958,5 +978,5 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) AlarmServer::addAlarm( when, channel, message, data ); - } + } } else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { - if ( type() == GuiServer ) { + if ( type() == GuiServer ) { QDateTime when; @@ -966,33 +986,42 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data) AlarmServer::deleteAlarm( when, channel, message, data ); - } + } } else if ( msg == "clockChange(bool)" ) { - int tmp; - stream >> tmp; - emit clockChanged( tmp ); + int tmp; + stream >> tmp; + emit clockChanged( tmp ); } else if ( msg == "weekChange(bool)" ) { - int tmp; - stream >> tmp; - emit weekChanged( tmp ); + int tmp; + stream >> tmp; + emit weekChanged( tmp ); } else if ( msg == "setDateFormat(DateFormat)" ) { - DateFormat tmp; - stream >> tmp; - emit dateFormatChanged( tmp ); + DateFormat tmp; + stream >> tmp; + emit dateFormatChanged( tmp ); } else if ( msg == "setVolume(int,int)" ) { - int t,v; - stream >> t >> v; - setVolume(t,v); - emit volumeChanged( muted ); + int t,v; + stream >> t >> v; + setVolume(t,v); + emit volumeChanged( muted ); } else if ( msg == "volumeChange(bool)" ) { - stream >> muted; - setVolume(); - emit volumeChanged( muted ); + stream >> muted; + setVolume(); + emit volumeChanged( muted ); + } else if ( msg == "setMic(int,int)") { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> + int t,v; + stream >> t >> v; + setMic(t,v); + emit micChanged( micMuted ); + } else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> + stream >> micMuted; + setMic(); + emit micChanged( micMuted ); } else if ( msg == "setScreenSaverMode(int)" ) { - if ( type() == GuiServer ) { - int old = disable_suspend; - stream >> disable_suspend; - //qDebug("setScreenSaverMode(%d)", disable_suspend ); - if ( disable_suspend > old ) - setScreenSaverInterval( -1 ); + if ( type() == GuiServer ) { + int old = disable_suspend; + stream >> disable_suspend; + //qDebug("setScreenSaverMode(%d)", disable_suspend ); + if ( disable_suspend > old ) + setScreenSaverInterval( -1 ); + } } - } #endif diff --git a/library/qpeapplication.h b/library/qpeapplication.h index fd5e57d..23606db 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h @@ -87,2 +87,3 @@ signals: void volumeChanged( bool muted ); + void micChanged( bool muted ); void appMessage( const QCString& msg, const QByteArray& data); @@ -119,2 +120,7 @@ private: QPEApplicationData *d; + + bool reserved_sh; + + + }; |