summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-12-13 19:37:59 (UTC)
committer harlekin <harlekin>2002-12-13 19:37:59 (UTC)
commite348262d418e3a133d13d039ed23da4625726f9d (patch) (side-by-side diff)
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
@@ -309,48 +309,90 @@ static void setVolume( int t = 0, int percent = -1 )
}
}
static void setMic( int t = 0, int percent = -1 )
{
switch ( t ) {
case 0: {
Config cfg( "qpe" );
cfg.setGroup( "Volume" );
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;
}
}
+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;
+ }
+}
+
+
/*!
\class QPEApplication qpeapplication.h
\brief The QPEApplication class implements various system services
that are available to all Qtopia applications.
Simply by using QPEApplication instead of QApplication, a standard Qt
application becomes a Qtopia application. It automatically follows
style changes, quits and raises, and in the
case of \link docwidget.html document-oriented\endlink applications,
changes the currently displayed document in response to the environment.
To create a \link docwidget.html document-oriented\endlink
application use showMainDocumentWidget(); to create a
non-document-oriented application use showMainWidget(). The
keepRunning() function indicates whether the application will
continue running after it's processed the last \link qcop.html
QCop\endlink message. This can be changed using setKeepRunning().
A variety of signals are emitted when certain events occur, for
example, timeChanged(), clockChanged(), weekChanged(),
dateFormatChanged() and volumeChanged(). If the application receives
a \link qcop.html QCop\endlink message on the application's
QPE/Application/\e{appname} channel, the appMessage() signal is
emitted. There are also flush() and reload() signals, which
@@ -1095,48 +1137,67 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit dateFormatChanged( tmp );
}
else if ( msg == "setVolume(int,int)" ) {
int t, v;
stream >> t >> v;
setVolume( t, v );
emit volumeChanged( muted );
}
else if ( msg == "volumeChange(bool)" ) {
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 == "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
}
/*!
\internal
*/
bool QPEApplication::raiseAppropriateWindow()
{
bool r = FALSE;
// ########## raise()ing main window should raise and set active
// ########## it and then all childen. This belongs in Qt/Embedded
QWidget *top = d->qpe_main_widget;
if ( !top )
top = mainWidget();
if ( top && d->keep_running ) {
if ( top->isVisible() )
r = TRUE;
else if (d->preloaded) {
// We are preloaded and not visible.. pretend we just started..
QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
e << d->appName;
}
d->show_mx(top, d->nomaximize);