summaryrefslogtreecommitdiff
authorjeremy <jeremy>2002-02-10 13:22:54 (UTC)
committer jeremy <jeremy>2002-02-10 13:22:54 (UTC)
commit261b98eff083215db69843da28a05cfd1f7b3795 (patch) (side-by-side diff)
tree3e9ed039218f0a132c9413987e03a5b6dc5cb24e
parentd0d626304ffb0de247e22760bc342e72406e301a (diff)
downloadopie-261b98eff083215db69843da28a05cfd1f7b3795.zip
opie-261b98eff083215db69843da28a05cfd1f7b3795.tar.gz
opie-261b98eff083215db69843da28a05cfd1f7b3795.tar.bz2
Added support for setMic and micChange QCop messages. These additions
are exactly like setVolume and volumeChange excopt of course, they change the mic input level instead of the volume out level.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/opie-base.control2
-rw-r--r--library/qpeapplication.cpp29
-rw-r--r--library/qpeapplication.h6
3 files changed, 36 insertions, 1 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
@@ -1,10 +1,10 @@
Files: etc/qimpen etc/colors etc/init.d/qpe etc/rc2.d/S98qpe bin/qpe-reorgfiles $QTDIR/lib/libqpe.so.$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT $QTDIR/lib/libqpe.so.$VERSION_MAJ.$VERSION_MIN $QTDIR/lib/libqpe.so.$VERSION_MAJ apps/__7separator.desktop apps/__9quit.desktop apps/*/.directory etc/mime.types apps/Settings/quit.desktop pics/UnknownDocument-14.png pics/UnknownDocument.png
Priority: required
Section: opie/system
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
Description: Base Qtopia environment
A complete GUI environment for handhelds.
You will probably want to install one of the opie-i18n-* packages.
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 4dbfbd8..a55f5f9 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -142,69 +142,89 @@ public:
setExtensionType("html","text/html;charset=UTF-8");
}
const QMimeSource* data(const QString& abs_name) const
{
const QMimeSource* r = QMimeSourceFactory::data(abs_name);
if ( !r ) {
int sl = abs_name.length();
do {
sl = abs_name.findRev('/',sl-1);
QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name;
int dot = name.findRev('.');
if ( dot >= 0 )
name = name.left(dot);
QImage img = Resource::loadImage(name);
if ( !img.isNull() )
r = new QImageDrag(img);
} while (!r && sl>0);
}
return r;
}
};
static int muted=0;
+static int micMuted=0;
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;
}
}
+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;
+ }
+}
+
int qpe_sysBrightnessSteps()
{
#if defined(QT_QWS_IPAQ)
return 255;
#elif defined(QT_QWS_EBX)
return 4;
#else
return 255; // ?
#endif
}
static int& hack(int& i)
{
#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
// These should be created, but aren't in Qt 2.3.0
(void)new QUtf8Codec;
(void)new QUtf16Codec;
#endif
return i;
}
static bool forced_off = FALSE;
static int curbl=-1;
@@ -965,48 +985,57 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &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 == "setScreenSaverMode(int)" ) {
if ( type() == GuiServer ) {
int old = disable_suspend;
stream >> disable_suspend;
//qDebug("setScreenSaverMode(%d)", disable_suspend );
if ( disable_suspend > old )
setScreenSaverInterval( -1 );
}
}
#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() )
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index fd5e57d..23606db 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -64,61 +64,67 @@ public:
enum screenSaverHint {
Disable = 0,
DisableLightOff = 1,
DisableSuspend = 2,
Enable = 100
};
static void setInputMethodHint( QWidget *, InputMethodHint );
static InputMethodHint inputMethodHint( QWidget * );
void showMainWidget( QWidget*, bool nomax=FALSE );
void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
static void setKeepRunning();
bool keepRunning() const;
int exec();
signals:
void clientMoused();
void timeChanged();
void clockChanged( bool pm );
void volumeChanged( bool muted );
+ void micChanged( bool muted );
void appMessage( const QCString& msg, const QByteArray& data);
void weekChanged( bool startOnMonday );
void dateFormatChanged( DateFormat );
void flush();
void reload();
private slots:
void systemMessage( const QCString &msg, const QByteArray &data );
void pidMessage( const QCString &msg, const QByteArray &data );
void removeSenderFromStylusDict();
void hideOrQuit();
protected:
bool qwsEventFilter( QWSEvent * );
void internalSetStyle( const QString &style );
void prepareForTermination(bool willrestart);
virtual void restart();
virtual void shutdown();
bool eventFilter( QObject *, QEvent * );
void timerEvent( QTimerEvent * );
bool keyboardGrabbed() const;
bool raiseAppropriateWindow();
virtual void tryQuit();
private:
void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
QCopChannel *sysChannel;
QCopChannel *pidChannel;
#endif
QPEApplicationData *d;
+
+ bool reserved_sh;
+
+
+
};
#endif