author | llornkcor <llornkcor> | 2002-05-23 02:01:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-23 02:01:23 (UTC) |
commit | 7cec3bc3d3b8945e80c9171b9173d3d2dbdd2eaf (patch) (unidiff) | |
tree | 6c196a83ee8688a692e843279dae918960418163 | |
parent | ae177d167999f204a968ea21ae4a4a804d939e6d (diff) | |
download | opie-7cec3bc3d3b8945e80c9171b9173d3d2dbdd2eaf.zip opie-7cec3bc3d3b8945e80c9171b9173d3d2dbdd2eaf.tar.gz opie-7cec3bc3d3b8945e80c9171b9173d3d2dbdd2eaf.tar.bz2 |
make sound conform to sharps sense of conf
-rw-r--r-- | core/launcher/desktop.cpp | 28 | ||||
-rw-r--r-- | core/launcher/desktop.h | 4 |
2 files changed, 18 insertions, 14 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 649862b..6771a66 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -28,35 +28,32 @@ | |||
28 | #include "taskbar.h" | 28 | #include "taskbar.h" |
29 | #include "transferserver.h" | 29 | #include "transferserver.h" |
30 | #include "irserver.h" | 30 | #include "irserver.h" |
31 | #include "packageslave.h" | 31 | #include "packageslave.h" |
32 | 32 | ||
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/password.h> | 35 | #include <qpe/password.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/timeconversion.h> | 38 | #include <qpe/timeconversion.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | #ifdef QT_QWS_CUSTOM | 41 | #ifdef QT_QWS_CUSTOM |
42 | #include "qpe/custom.h" | 42 | #include "qpe/custom.h" |
43 | #endif | 43 | #endif |
44 | #if defined(QT_QWS_IPAQ) | ||
45 | #include "qpe/custom-ipaq.h" | ||
46 | #endif | ||
47 | 44 | ||
48 | #include <qgfx_qws.h> | 45 | #include <qgfx_qws.h> |
49 | #include <qmainwindow.h> | 46 | #include <qmainwindow.h> |
50 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
51 | #include <qtimer.h> | 48 | #include <qtimer.h> |
52 | #include <qwindowsystem_qws.h> | 49 | #include <qwindowsystem_qws.h> |
53 | 50 | ||
54 | #include <qvaluelist.h> | 51 | #include <qvaluelist.h> |
55 | 52 | ||
56 | #include <stdlib.h> | 53 | #include <stdlib.h> |
57 | #include <unistd.h> | 54 | #include <unistd.h> |
58 | 55 | ||
59 | class QCopKeyRegister | 56 | class QCopKeyRegister |
60 | { | 57 | { |
61 | public: | 58 | public: |
62 | QCopKeyRegister() : keyCode(0) { } | 59 | QCopKeyRegister() : keyCode(0) { } |
@@ -155,66 +152,67 @@ DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | |||
155 | } | 152 | } |
156 | 153 | ||
157 | 154 | ||
158 | DesktopApplication::~DesktopApplication() | 155 | DesktopApplication::~DesktopApplication() |
159 | { | 156 | { |
160 | delete ps; | 157 | delete ps; |
161 | delete pa; | 158 | delete pa; |
162 | } | 159 | } |
163 | 160 | ||
164 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | 161 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) |
165 | { | 162 | { |
166 | QDataStream stream( data, IO_ReadOnly ); | 163 | QDataStream stream( data, IO_ReadOnly ); |
167 | if (msg == "keyRegister(int key, QString channel, QString message)") | 164 | if (msg == "keyRegister(int key, QString channel, QString message)") |
168 | { | 165 | { |
169 | int k; | 166 | int k; |
170 | QString c, m; | 167 | QString c, m; |
171 | |||
172 | stream >> k; | 168 | stream >> k; |
173 | stream >> c; | 169 | stream >> c; |
174 | stream >> m; | 170 | stream >> m; |
175 | 171 | ||
176 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); | 172 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); |
177 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 173 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
178 | } | 174 | } |
179 | else if (msg == "suspend()"){ | 175 | else if (msg == "suspend()"){ |
180 | emit power(); | 176 | emit power(); |
181 | } | 177 | } |
182 | 178 | ||
183 | } | 179 | } |
184 | 180 | ||
185 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 181 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
186 | 182 | ||
187 | #ifdef Q_WS_QWS | 183 | #ifdef Q_WS_QWS |
188 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 184 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
189 | { | 185 | { |
190 | qpedesktop->checkMemory(); | 186 | qpedesktop->checkMemory(); |
191 | 187 | ||
192 | if ( e->type == QWSEvent::Key ) { | 188 | if ( e->type == QWSEvent::Key ) { |
193 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 189 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
194 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 190 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
195 | return TRUE; | 191 | return TRUE; |
196 | bool press = ke->simpleData.is_press; | 192 | bool press = ke->simpleData.is_press; |
197 | bool autoRepeat = ke ->simpleData.is_auto_repeat; | 193 | bool autoRepeat= ke->simpleData.is_auto_repeat; |
198 | if (!keyRegisterList.isEmpty()) | 194 | if (!keyRegisterList.isEmpty()) |
199 | { | 195 | { |
200 | KeyRegisterList::Iterator it; | 196 | KeyRegisterList::Iterator it; |
201 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | 197 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) |
202 | { | 198 | { |
203 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) | 199 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { |
204 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | 200 | if(press) qDebug("press"); else qDebug("release"); |
201 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | ||
202 | } | ||
205 | } | 203 | } |
206 | } | 204 | } |
207 | 205 | ||
208 | if ( !keyboardGrabbed() ) { | 206 | if ( !keyboardGrabbed() ) { |
209 | if ( ke->simpleData.keycode == Key_F9 ) { | 207 | if ( ke->simpleData.keycode == Key_F9 ) { |
210 | if ( press ) emit datebook(); | 208 | if ( press ) emit datebook(); |
211 | return TRUE; | 209 | return TRUE; |
212 | } | 210 | } |
213 | if ( ke->simpleData.keycode == Key_F10 ) { | 211 | if ( ke->simpleData.keycode == Key_F10 ) { |
214 | if ( !press && cardSendTimer ) { | 212 | if ( !press && cardSendTimer ) { |
215 | emit contacts(); | 213 | emit contacts(); |
216 | delete cardSendTimer; | 214 | delete cardSendTimer; |
217 | } else if ( press ) { | 215 | } else if ( press ) { |
218 | cardSendTimer = new QTimer(); | 216 | cardSendTimer = new QTimer(); |
219 | cardSendTimer->start( 2000, TRUE ); | 217 | cardSendTimer->start( 2000, TRUE ); |
220 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 218 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
@@ -728,57 +726,63 @@ void Desktop::startTransferServer() | |||
728 | void Desktop::timerEvent( QTimerEvent *e ) | 726 | void Desktop::timerEvent( QTimerEvent *e ) |
729 | { | 727 | { |
730 | killTimer( e->timerId() ); | 728 | killTimer( e->timerId() ); |
731 | startTransferServer(); | 729 | startTransferServer(); |
732 | } | 730 | } |
733 | 731 | ||
734 | void Desktop::terminateServers() | 732 | void Desktop::terminateServers() |
735 | { | 733 | { |
736 | delete transferServer; | 734 | delete transferServer; |
737 | delete qcopBridge; | 735 | delete qcopBridge; |
738 | transferServer = 0; | 736 | transferServer = 0; |
739 | qcopBridge = 0; | 737 | qcopBridge = 0; |
740 | } | 738 | } |
741 | 739 | ||
742 | void Desktop::rereadVolumes() | 740 | void Desktop::rereadVolumes() |
743 | { | 741 | { |
744 | Config cfg("Sound"); | 742 | Config cfg("qpe"); |
745 | cfg.setGroup("System"); | 743 | cfg.setGroup("Volume"); |
746 | touchclick = cfg.readBoolEntry("Touch"); | 744 | touchclick = cfg.readBoolEntry("TouchSound"); |
747 | keyclick = cfg.readBoolEntry("Key"); | 745 | keyclick = cfg.readBoolEntry("KeySound"); |
746 | alarmsound = cfg.readBoolEntry("AlarmSound"); | ||
747 | // Config cfg("Sound"); | ||
748 | // cfg.setGroup("System"); | ||
749 | // touchclick = cfg.readBoolEntry("Touch"); | ||
750 | // keyclick = cfg.readBoolEntry("Key"); | ||
748 | } | 751 | } |
749 | 752 | ||
750 | void Desktop::keyClick() | 753 | void Desktop::keyClick() |
751 | { | 754 | { |
752 | #ifdef CUSTOM_SOUND_KEYCLICK | 755 | #ifdef CUSTOM_SOUND_KEYCLICK |
753 | if ( keyclick ) | 756 | if ( keyclick ) |
754 | CUSTOM_SOUND_KEYCLICK; | 757 | CUSTOM_SOUND_KEYCLICK; |
755 | #endif | 758 | #endif |
756 | } | 759 | } |
757 | 760 | ||
758 | void Desktop::screenClick() | 761 | void Desktop::screenClick() |
759 | { | 762 | { |
760 | #ifdef CUSTOM_SOUND_TOUCH | 763 | #ifdef CUSTOM_SOUND_TOUCH |
761 | if ( touchclick ) | 764 | if ( touchclick ) |
762 | CUSTOM_SOUND_TOUCH; | 765 | CUSTOM_SOUND_TOUCH; |
763 | #endif | 766 | #endif |
764 | } | 767 | } |
765 | 768 | ||
766 | void Desktop::soundAlarm() | 769 | void Desktop::soundAlarm() |
767 | { | 770 | { |
768 | #ifdef CUSTOM_SOUND_ALARM | 771 | #ifdef CUSTOM_SOUND_ALARM |
772 | if (alarmsound) | ||
769 | CUSTOM_SOUND_ALARM; | 773 | CUSTOM_SOUND_ALARM; |
770 | #endif | 774 | #endif |
771 | } | 775 | } |
772 | 776 | ||
773 | bool Desktop::eventFilter( QObject *w, QEvent *ev ) | 777 | bool Desktop::eventFilter( QObject *w, QEvent *ev ) |
774 | { | 778 | { |
775 | if ( ev->type() == QEvent::KeyPress ) { | 779 | if ( ev->type() == QEvent::KeyPress ) { |
776 | QKeyEvent *ke = (QKeyEvent *)ev; | 780 | QKeyEvent *ke = (QKeyEvent *)ev; |
777 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 781 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
778 | QWidget *active = qApp->activeWindow(); | 782 | QWidget *active = qApp->activeWindow(); |
779 | if ( active && active->isPopup() ) { | 783 | if ( active && active->isPopup() ) { |
780 | active->close(); | 784 | active->close(); |
781 | } | 785 | } |
782 | raiseMenu(); | 786 | raiseMenu(); |
783 | return TRUE; | 787 | return TRUE; |
784 | } | 788 | } |
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index e094dc0..9bc4be9 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -62,33 +62,33 @@ protected: | |||
62 | bool qwsEventFilter( QWSEvent * ); | 62 | bool qwsEventFilter( QWSEvent * ); |
63 | #endif | 63 | #endif |
64 | void shutdown(); | 64 | void shutdown(); |
65 | void restart(); | 65 | void restart(); |
66 | 66 | ||
67 | public slots: | 67 | public slots: |
68 | void receive( const QCString &msg, const QByteArray &data ); | 68 | void receive( const QCString &msg, const QByteArray &data ); |
69 | 69 | ||
70 | protected slots: | 70 | protected slots: |
71 | void shutdown(ShutdownImpl::Type); | 71 | void shutdown(ShutdownImpl::Type); |
72 | void psTimeout(); | 72 | void psTimeout(); |
73 | void sendCard(); | 73 | void sendCard(); |
74 | private: | 74 | private: |
75 | DesktopPowerAlerter *pa; | 75 | DesktopPowerAlerter *pa; |
76 | PowerStatus *ps; | 76 | PowerStatus *ps; |
77 | QTimer *cardSendTimer; | 77 | QTimer *cardSendTimer; |
78 | QCopChannel *channel; | 78 | QCopChannel *channel; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | 81 | ||
82 | class Desktop : public QWidget { | 82 | class Desktop : public QWidget { |
83 | Q_OBJECT | 83 | Q_OBJECT |
84 | public: | 84 | public: |
85 | Desktop(); | 85 | Desktop(); |
86 | ~Desktop(); | 86 | ~Desktop(); |
87 | 87 | ||
88 | static bool screenLocked(); | 88 | static bool screenLocked(); |
89 | 89 | ||
90 | void show(); | 90 | void show(); |
91 | void checkMemory(); | 91 | void checkMemory(); |
92 | 92 | ||
93 | void keyClick(); | 93 | void keyClick(); |
94 | void screenClick(); | 94 | void screenClick(); |
@@ -115,22 +115,22 @@ protected: | |||
115 | void timerEvent( QTimerEvent *e ); | 115 | void timerEvent( QTimerEvent *e ); |
116 | bool eventFilter( QObject *, QEvent * ); | 116 | bool eventFilter( QObject *, QEvent * ); |
117 | 117 | ||
118 | QWidget *bg; | 118 | QWidget *bg; |
119 | Launcher *launcher; | 119 | Launcher *launcher; |
120 | TaskBar *tb; | 120 | TaskBar *tb; |
121 | 121 | ||
122 | private: | 122 | private: |
123 | void startTransferServer(); | 123 | void startTransferServer(); |
124 | bool recoverMemory(); | 124 | bool recoverMemory(); |
125 | 125 | ||
126 | QCopBridge *qcopBridge; | 126 | QCopBridge *qcopBridge; |
127 | TransferServer *transferServer; | 127 | TransferServer *transferServer; |
128 | PackageSlave *packageSlave; | 128 | PackageSlave *packageSlave; |
129 | 129 | ||
130 | QDateTime suspendTime; | 130 | QDateTime suspendTime; |
131 | bool keyclick,touchclick; | 131 | bool keyclick,touchclick,alarmsound; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | 134 | ||
135 | #endif // __DESKTOP_H__ | 135 | #endif // __DESKTOP_H__ |
136 | 136 | ||