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
@@ -285,96 +285,138 @@ public:
}
};
static int muted = 0;
static int micMuted = 0;
static void setVolume( int t = 0, int percent = -1 )
{
switch ( t ) {
case 0: {
Config cfg( "qpe" );
cfg.setGroup( "Volume" );
if ( percent < 0 )
percent = cfg.readNumEntry( "VolumePercent", 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( "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
are emitted when synching begins and ends respectively - upon these
signals, the application should save and reload any data
files that are involved in synching. Most of these signals will initially
be received and unfiltered through the appMessage() signal.
This class also provides a set of useful static functions. The
qpeDir() and documentDir() functions return the respective paths.
The grabKeyboard() and ungrabKeyboard() functions are used to
control whether the application takes control of the device's
physical buttons (e.g. application launch keys). The stylus' mode of
operation is set with setStylusOperation() and retrieved with
stylusOperation(). There are also setInputMethodHint() and
inputMethodHint() functions.
\ingroup qtopiaemb
*/
/*!
\fn void QPEApplication::clientMoused()
\internal
*/
/*!
@@ -1071,96 +1113,115 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
}
else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
if ( type() == GuiServer ) {
QDateTime when;
QCString channel, message;
int data;
stream >> when >> channel >> message >> data;
AlarmServer::deleteAlarm( when, channel, message, data );
}
}
else if ( msg == "clockChange(bool)" ) {
int tmp;
stream >> tmp;
emit clockChanged( tmp );
}
else if ( msg == "weekChange(bool)" ) {
int tmp;
stream >> tmp;
emit weekChanged( tmp );
}
else if ( msg == "setDateFormat(DateFormat)" ) {
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 );
}
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);
top->raise();
top->setActiveWindow();
}
QWidget *topm = activeModalWidget();
if ( topm && topm != top ) {
topm->show();
topm->raise();
topm->setActiveWindow();
// If we haven't already handled the fastAppShowing message
if (!top && d->preloaded) {
QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
e << d->appName;
}
r = FALSE;
}
return r;
}
void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
{
#ifdef Q_WS_QWS
if ( msg == "quit()" ) {
tryQuit();