summaryrefslogtreecommitdiff
path: root/library
authorjeremy <jeremy>2002-02-10 13:22:54 (UTC)
committer jeremy <jeremy>2002-02-10 13:22:54 (UTC)
commit261b98eff083215db69843da28a05cfd1f7b3795 (patch) (unidiff)
tree3e9ed039218f0a132c9413987e03a5b6dc5cb24e /library
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 (limited to 'library') (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 @@
1Files: 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 1Files: 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
2Priority: required 2Priority: required
3Section: opie/system 3Section: opie/system
4Maintainer: Warwick Allison <warwick@trolltech.com> 4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION.1
7Depends: qt-embedded (>=$QTE_VERSION), opie-qcop, opie-taskbar, opie-pics, opie-sounds, apmd 7Depends: qt-embedded (>=$QTE_VERSION), opie-qcop, opie-taskbar, opie-pics, opie-sounds, apmd
8Description: Base Qtopia environment 8Description: Base Qtopia environment
9 A complete GUI environment for handhelds. 9 A complete GUI environment for handhelds.
10 You will probably want to install one of the opie-i18n-* packages. 10 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
@@ -154,45 +154,65 @@ public:
154 if ( dot >= 0 ) 154 if ( dot >= 0 )
155 name = name.left(dot); 155 name = name.left(dot);
156 QImage img = Resource::loadImage(name); 156 QImage img = Resource::loadImage(name);
157 if ( !img.isNull() ) 157 if ( !img.isNull() )
158 r = new QImageDrag(img); 158 r = new QImageDrag(img);
159 } while (!r && sl>0); 159 } while (!r && sl>0);
160 } 160 }
161 return r; 161 return r;
162 } 162 }
163}; 163};
164 164
165static int muted=0; 165static int muted=0;
166static int micMuted=0;
166 167
167static void setVolume(int t=0, int percent=-1) 168static void setVolume(int t=0, int percent=-1)
168{ 169{
169 switch (t) { 170 switch (t) {
170 case 0: { 171 case 0: {
171 Config cfg("Sound"); 172 Config cfg("Sound");
172 cfg.setGroup("System"); 173 cfg.setGroup("System");
173 if ( percent < 0 ) 174 if ( percent < 0 )
174 percent = cfg.readNumEntry("Volume",50); 175 percent = cfg.readNumEntry("Volume",50);
175 int fd = 0; 176 int fd = 0;
176 if ((fd = open("/dev/mixer", O_RDWR))>=0) { 177 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
177 int vol = muted ? 0 : percent; 178 int vol = muted ? 0 : percent;
178 // set both channels to same volume 179 // set both channels to same volume
179 vol |= vol << 8; 180 vol |= vol << 8;
180 ioctl(fd, MIXER_WRITE(0), &vol); 181 ioctl(fd, MIXER_WRITE(0), &vol);
181 ::close(fd); 182 ::close(fd);
182 } 183 }
183 } break; 184 } break;
184 } 185 }
185} 186}
186 187
188static void setMic(int t=0, int percent=-1)
189{
190 switch (t) {
191 case 0: {
192 Config cfg("Sound");
193 cfg.setGroup("System");
194 if ( percent < 0 )
195 percent = cfg.readNumEntry("Mic",50);
196
197 int fd = 0;
198 int mic = micMuted ? 0 : percent;
199 if ((fd = open("/dev/mixer", O_RDWR))>=0) {
200 ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &mic);
201 ::close(fd);
202 }
203 } break;
204 }
205}
206
187int qpe_sysBrightnessSteps() 207int qpe_sysBrightnessSteps()
188{ 208{
189#if defined(QT_QWS_IPAQ) 209#if defined(QT_QWS_IPAQ)
190 return 255; 210 return 255;
191#elif defined(QT_QWS_EBX) 211#elif defined(QT_QWS_EBX)
192 return 4; 212 return 4;
193#else 213#else
194 return 255; // ? 214 return 255; // ?
195#endif 215#endif
196} 216}
197 217
198 218
@@ -977,24 +997,33 @@ void QPEApplication::systemMessage( const QCString &msg, const QByteArray &data)
977 DateFormat tmp; 997 DateFormat tmp;
978 stream >> tmp; 998 stream >> tmp;
979 emit dateFormatChanged( tmp ); 999 emit dateFormatChanged( tmp );
980 } else if ( msg == "setVolume(int,int)" ) { 1000 } else if ( msg == "setVolume(int,int)" ) {
981 int t,v; 1001 int t,v;
982 stream >> t >> v; 1002 stream >> t >> v;
983 setVolume(t,v); 1003 setVolume(t,v);
984 emit volumeChanged( muted ); 1004 emit volumeChanged( muted );
985 } else if ( msg == "volumeChange(bool)" ) { 1005 } else if ( msg == "volumeChange(bool)" ) {
986 stream >> muted; 1006 stream >> muted;
987 setVolume(); 1007 setVolume();
988 emit volumeChanged( muted ); 1008 emit volumeChanged( muted );
1009 } else if ( msg == "setMic(int,int)") { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1010 int t,v;
1011 stream >> t >> v;
1012 setMic(t,v);
1013 emit micChanged( micMuted );
1014 } else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1015 stream >> micMuted;
1016 setMic();
1017 emit micChanged( micMuted );
989 } else if ( msg == "setScreenSaverMode(int)" ) { 1018 } else if ( msg == "setScreenSaverMode(int)" ) {
990 if ( type() == GuiServer ) { 1019 if ( type() == GuiServer ) {
991 int old = disable_suspend; 1020 int old = disable_suspend;
992 stream >> disable_suspend; 1021 stream >> disable_suspend;
993 //qDebug("setScreenSaverMode(%d)", disable_suspend ); 1022 //qDebug("setScreenSaverMode(%d)", disable_suspend );
994 if ( disable_suspend > old ) 1023 if ( disable_suspend > old )
995 setScreenSaverInterval( -1 ); 1024 setScreenSaverInterval( -1 );
996 } 1025 }
997 } 1026 }
998#endif 1027#endif
999} 1028}
1000 1029
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index fd5e57d..23606db 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -76,24 +76,25 @@ public:
76 void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); 76 void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
77 77
78 static void setKeepRunning(); 78 static void setKeepRunning();
79 bool keepRunning() const; 79 bool keepRunning() const;
80 80
81 int exec(); 81 int exec();
82 82
83signals: 83signals:
84 void clientMoused(); 84 void clientMoused();
85 void timeChanged(); 85 void timeChanged();
86 void clockChanged( bool pm ); 86 void clockChanged( bool pm );
87 void volumeChanged( bool muted ); 87 void volumeChanged( bool muted );
88 void micChanged( bool muted );
88 void appMessage( const QCString& msg, const QByteArray& data); 89 void appMessage( const QCString& msg, const QByteArray& data);
89 void weekChanged( bool startOnMonday ); 90 void weekChanged( bool startOnMonday );
90 void dateFormatChanged( DateFormat ); 91 void dateFormatChanged( DateFormat );
91 void flush(); 92 void flush();
92 void reload(); 93 void reload();
93 94
94private slots: 95private slots:
95 void systemMessage( const QCString &msg, const QByteArray &data ); 96 void systemMessage( const QCString &msg, const QByteArray &data );
96 void pidMessage( const QCString &msg, const QByteArray &data ); 97 void pidMessage( const QCString &msg, const QByteArray &data );
97 void removeSenderFromStylusDict(); 98 void removeSenderFromStylusDict();
98 void hideOrQuit(); 99 void hideOrQuit();
99 100
@@ -108,17 +109,22 @@ protected:
108 bool keyboardGrabbed() const; 109 bool keyboardGrabbed() const;
109 bool raiseAppropriateWindow(); 110 bool raiseAppropriateWindow();
110 virtual void tryQuit(); 111 virtual void tryQuit();
111 112
112private: 113private:
113 void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); 114 void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
114 115
115#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 116#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
116 QCopChannel *sysChannel; 117 QCopChannel *sysChannel;
117 QCopChannel *pidChannel; 118 QCopChannel *pidChannel;
118#endif 119#endif
119 QPEApplicationData *d; 120 QPEApplicationData *d;
121
122 bool reserved_sh;
123
124
125
120}; 126};
121 127
122 128
123#endif 129#endif
124 130