summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-12-13 19:37:59 (UTC)
committer harlekin <harlekin>2002-12-13 19:37:59 (UTC)
commite348262d418e3a133d13d039ed23da4625726f9d (patch) (unidiff)
tree36cdf26700d424b06b6c37b86e5f1e07bc233b88
parent11ccc2e5341677cd54037a1f9cfb04831feed0f9 (diff)
downloadopie-e348262d418e3a133d13d039ed23da4625726f9d.zip
opie-e348262d418e3a133d13d039ed23da4625726f9d.tar.gz
opie-e348262d418e3a133d13d039ed23da4625726f9d.tar.bz2
added Bass and Treble handling - next stop should be odevice
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c41dd06..852671a 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -321,24 +321,66 @@ static void setMic( int t = 0, int percent = -1 )
321 int fd = 0; 321 int fd = 0;
322 int mic = micMuted ? 0 : percent; 322 int mic = micMuted ? 0 : percent;
323 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 323 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
324 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); 324 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic );
325 ::close( fd ); 325 ::close( fd );
326 } 326 }
327 } 327 }
328 break; 328 break;
329 } 329 }
330} 330}
331 331
332 332
333static 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
354static 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/*!
334 \class QPEApplication qpeapplication.h 376 \class QPEApplication qpeapplication.h
335 \brief The QPEApplication class implements various system services 377 \brief The QPEApplication class implements various system services
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
339 application becomes a Qtopia application. It automatically follows 381 application becomes a Qtopia application. It automatically follows
340 style changes, quits and raises, and in the 382 style changes, quits and raises, and in the
341 case of \link docwidget.html document-oriented\endlink applications, 383 case of \link docwidget.html document-oriented\endlink applications,
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
@@ -1107,24 +1149,43 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
1107 } 1149 }
1108 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1150 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1109 int t, v; 1151 int t, v;
1110 stream >> t >> v; 1152 stream >> t >> v;
1111 setMic( t, v ); 1153 setMic( t, v );
1112 emit micChanged( micMuted ); 1154 emit micChanged( micMuted );
1113 } 1155 }
1114 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1156 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1115 stream >> micMuted; 1157 stream >> micMuted;
1116 setMic(); 1158 setMic();
1117 emit micChanged( micMuted ); 1159 emit micChanged( micMuted );
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
1120} 1181}
1121 1182
1122/*! 1183/*!
1123 \internal 1184 \internal
1124*/ 1185*/
1125bool QPEApplication::raiseAppropriateWindow() 1186bool QPEApplication::raiseAppropriateWindow()
1126{ 1187{
1127 bool r = FALSE; 1188 bool r = FALSE;
1128 // ########## raise()ing main window should raise and set active 1189 // ########## raise()ing main window should raise and set active
1129 // ########## it and then all childen. This belongs in Qt/Embedded 1190 // ########## it and then all childen. This belongs in Qt/Embedded
1130 QWidget *top = d->qpe_main_widget; 1191 QWidget *top = d->qpe_main_widget;