-rw-r--r-- | libopie/odevice.cpp | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 2873407..01932c9 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1,663 +1,704 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #include <linux/soundcard.h> | 26 | #include <linux/soundcard.h> |
27 | #include <math.h> | 27 | #include <math.h> |
28 | 28 | ||
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpe/sound.h> | 33 | #include <qpe/sound.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/qcopenvelope_qws.h> | 36 | #include <qpe/qcopenvelope_qws.h> |
37 | 37 | ||
38 | #include "odevice.h" | 38 | #include "odevice.h" |
39 | 39 | ||
40 | #include <qwindowsystem_qws.h> | 40 | #include <qwindowsystem_qws.h> |
41 | 41 | ||
42 | #ifndef ARRAY_SIZE | 42 | #ifndef ARRAY_SIZE |
43 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 43 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | // _IO and friends are only defined in kernel headers ... | 46 | // _IO and friends are only defined in kernel headers ... |
47 | 47 | ||
48 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 48 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
49 | 49 | ||
50 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 50 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
51 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 51 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
52 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 52 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
53 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 53 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
54 | 54 | ||
55 | using namespace Opie; | 55 | using namespace Opie; |
56 | 56 | ||
57 | class ODeviceData { | 57 | class ODeviceData { |
58 | public: | 58 | public: |
59 | QString m_vendorstr; | 59 | QString m_vendorstr; |
60 | OVendor m_vendor; | 60 | OVendor m_vendor; |
61 | 61 | ||
62 | QString m_modelstr; | 62 | QString m_modelstr; |
63 | OModel m_model; | 63 | OModel m_model; |
64 | 64 | ||
65 | QString m_systemstr; | 65 | QString m_systemstr; |
66 | OSystem m_system; | 66 | OSystem m_system; |
67 | 67 | ||
68 | QString m_sysverstr; | 68 | QString m_sysverstr; |
69 | 69 | ||
70 | Transformation m_rotation; | 70 | Transformation m_rotation; |
71 | ODirection m_direction; | 71 | ODirection m_direction; |
72 | 72 | ||
73 | QValueList <ODeviceButton> *m_buttons; | 73 | QValueList <ODeviceButton> *m_buttons; |
74 | uint m_holdtime; | 74 | uint m_holdtime; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | 77 | ||
78 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { | 78 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { |
79 | protected: | 79 | protected: |
80 | virtual void init ( ); | 80 | virtual void init ( ); |
81 | virtual void initButtons ( ); | 81 | virtual void initButtons ( ); |
82 | 82 | ||
83 | public: | 83 | public: |
84 | virtual bool setSoftSuspend ( bool soft ); | 84 | virtual bool setSoftSuspend ( bool soft ); |
85 | 85 | ||
86 | virtual bool setDisplayBrightness ( int b ); | 86 | virtual bool setDisplayBrightness ( int b ); |
87 | virtual int displayBrightnessResolution ( ) const; | 87 | virtual int displayBrightnessResolution ( ) const; |
88 | 88 | ||
89 | virtual void alarmSound ( ); | 89 | virtual void alarmSound ( ); |
90 | 90 | ||
91 | virtual QValueList <OLed> ledList ( ) const; | 91 | virtual QValueList <OLed> ledList ( ) const; |
92 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 92 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
93 | virtual OLedState ledState ( OLed led ) const; | 93 | virtual OLedState ledState ( OLed led ) const; |
94 | virtual bool setLedState ( OLed led, OLedState st ); | 94 | virtual bool setLedState ( OLed led, OLedState st ); |
95 | 95 | ||
96 | virtual bool hasLightSensor ( ) const; | 96 | virtual bool hasLightSensor ( ) const; |
97 | virtual int readLightSensor ( ); | 97 | virtual int readLightSensor ( ); |
98 | virtual int lightSensorResolution ( ) const; | 98 | virtual int lightSensorResolution ( ) const; |
99 | 99 | ||
100 | protected: | 100 | protected: |
101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
102 | virtual void timerEvent ( QTimerEvent *te ); | 102 | virtual void timerEvent ( QTimerEvent *te ); |
103 | 103 | ||
104 | int m_power_timer; | 104 | int m_power_timer; |
105 | 105 | ||
106 | OLedState m_leds [2]; | 106 | OLedState m_leds [2]; |
107 | }; | 107 | }; |
108 | 108 | ||
109 | class Zaurus : public ODevice { | 109 | class Zaurus : public ODevice { |
110 | protected: | 110 | protected: |
111 | virtual void init ( ); | 111 | virtual void init ( ); |
112 | virtual void initButtons ( ); | 112 | virtual void initButtons ( ); |
113 | 113 | ||
114 | public: | 114 | public: |
115 | virtual bool setSoftSuspend ( bool soft ); | 115 | virtual bool setSoftSuspend ( bool soft ); |
116 | 116 | ||
117 | virtual bool setDisplayBrightness ( int b ); | 117 | virtual bool setDisplayBrightness ( int b ); |
118 | virtual int displayBrightnessResolution ( ) const; | 118 | virtual int displayBrightnessResolution ( ) const; |
119 | 119 | ||
120 | virtual void alarmSound ( ); | 120 | virtual void alarmSound ( ); |
121 | virtual void keySound ( ); | 121 | virtual void keySound ( ); |
122 | virtual void touchSound ( ); | 122 | virtual void touchSound ( ); |
123 | 123 | ||
124 | virtual QValueList <OLed> ledList ( ) const; | 124 | virtual QValueList <OLed> ledList ( ) const; |
125 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 125 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
126 | virtual OLedState ledState ( OLed led ) const; | 126 | virtual OLedState ledState ( OLed led ) const; |
127 | virtual bool setLedState ( OLed led, OLedState st ); | 127 | virtual bool setLedState ( OLed led, OLedState st ); |
128 | 128 | ||
129 | protected: | 129 | protected: |
130 | virtual void buzzer ( int snd ); | 130 | virtual void buzzer ( int snd ); |
131 | 131 | ||
132 | OLedState m_leds [1]; | 132 | OLedState m_leds [1]; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { | 135 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { |
136 | protected: | 136 | protected: |
137 | virtual void init ( ); | 137 | virtual void init ( ); |
138 | virtual void initButtons ( ); | 138 | virtual void initButtons ( ); |
139 | 139 | ||
140 | public: | 140 | public: |
141 | virtual bool setSoftSuspend ( bool soft ); | 141 | virtual bool setSoftSuspend ( bool soft ); |
142 | virtual bool suspend(); | 142 | virtual bool suspend(); |
143 | 143 | ||
144 | virtual bool setDisplayStatus( bool on ); | 144 | virtual bool setDisplayStatus( bool on ); |
145 | virtual bool setDisplayBrightness ( int b ); | 145 | virtual bool setDisplayBrightness ( int b ); |
146 | virtual int displayBrightnessResolution ( ) const; | 146 | virtual int displayBrightnessResolution ( ) const; |
147 | 147 | ||
148 | virtual void alarmSound ( ); | 148 | virtual void alarmSound ( ); |
149 | 149 | ||
150 | virtual QValueList <OLed> ledList ( ) const; | 150 | virtual QValueList <OLed> ledList ( ) const; |
151 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 151 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
152 | virtual OLedState ledState ( OLed led ) const; | 152 | virtual OLedState ledState ( OLed led ) const; |
153 | virtual bool setLedState ( OLed led, OLedState st ); | 153 | virtual bool setLedState ( OLed led, OLedState st ); |
154 | 154 | ||
155 | protected: | 155 | protected: |
156 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 156 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
157 | virtual void timerEvent ( QTimerEvent *te ); | 157 | virtual void timerEvent ( QTimerEvent *te ); |
158 | 158 | ||
159 | int m_power_timer; | 159 | int m_power_timer; |
160 | 160 | ||
161 | OLedState m_leds [1]; //FIXME check if really only one | 161 | OLedState m_leds [1]; //FIXME check if really only one |
162 | }; | 162 | }; |
163 | 163 | ||
164 | struct i_button { | 164 | struct i_button { |
165 | uint model; | 165 | uint model; |
166 | Qt::Key code; | 166 | Qt::Key code; |
167 | char *utext; | 167 | char *utext; |
168 | char *pix; | 168 | char *pix; |
169 | char *fpressedservice; | 169 | char *fpressedservice; |
170 | char *fpressedaction; | 170 | char *fpressedaction; |
171 | char *fheldservice; | 171 | char *fheldservice; |
172 | char *fheldaction; | 172 | char *fheldaction; |
173 | } ipaq_buttons [] = { | 173 | } ipaq_buttons [] = { |
174 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 174 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
175 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 175 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
176 | "devicebuttons/ipaq_calendar", | 176 | "devicebuttons/ipaq_calendar", |
177 | "datebook", "nextView()", | 177 | "datebook", "nextView()", |
178 | "today", "raise()" }, | 178 | "today", "raise()" }, |
179 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 179 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
180 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 180 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
181 | "devicebuttons/ipaq_contact", | 181 | "devicebuttons/ipaq_contact", |
182 | "addressbook", "raise()", | 182 | "addressbook", "raise()", |
183 | "addressbook", "beamBusinessCard()" }, | 183 | "addressbook", "beamBusinessCard()" }, |
184 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 184 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
185 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 185 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
186 | "devicebuttons/ipaq_menu", | 186 | "devicebuttons/ipaq_menu", |
187 | "QPE/TaskBar", "toggleMenu()", | 187 | "QPE/TaskBar", "toggleMenu()", |
188 | "QPE/TaskBar", "toggleStartMenu()" }, | 188 | "QPE/TaskBar", "toggleStartMenu()" }, |
189 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 189 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
190 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 190 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
191 | "devicebuttons/ipaq_mail", | 191 | "devicebuttons/ipaq_mail", |
192 | "mail", "raise()", | 192 | "mail", "raise()", |
193 | "mail", "newMail()" }, | 193 | "mail", "newMail()" }, |
194 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 194 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
195 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 195 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
196 | "devicebuttons/ipaq_home", | 196 | "devicebuttons/ipaq_home", |
197 | "QPE/Launcher", "home()", | 197 | "QPE/Launcher", "home()", |
198 | "buttonsettings", "raise()" }, | 198 | "buttonsettings", "raise()" }, |
199 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 199 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
200 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 200 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
201 | "devicebuttons/ipaq_record", | 201 | "devicebuttons/ipaq_record", |
202 | "QPE/VMemo", "toggleRecord()", | 202 | "QPE/VMemo", "toggleRecord()", |
203 | "sound", "raise()" }, | 203 | "sound", "raise()" }, |
204 | }; | 204 | }; |
205 | 205 | ||
206 | struct z_button { | 206 | struct z_button { |
207 | Qt::Key code; | 207 | Qt::Key code; |
208 | char *utext; | 208 | char *utext; |
209 | char *pix; | 209 | char *pix; |
210 | char *fpressedservice; | 210 | char *fpressedservice; |
211 | char *fpressedaction; | 211 | char *fpressedaction; |
212 | char *fheldservice; | 212 | char *fheldservice; |
213 | char *fheldaction; | 213 | char *fheldaction; |
214 | } z_buttons [] = { | 214 | } z_buttons [] = { |
215 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 215 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
216 | "devicebuttons/z_calendar", | 216 | "devicebuttons/z_calendar", |
217 | "datebook", "nextView()", | 217 | "datebook", "nextView()", |
218 | "today", "raise()" }, | 218 | "today", "raise()" }, |
219 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 219 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
220 | "devicebuttons/z_contact", | 220 | "devicebuttons/z_contact", |
221 | "addressbook", "raise()", | 221 | "addressbook", "raise()", |
222 | "addressbook", "beamBusinessCard()" }, | 222 | "addressbook", "beamBusinessCard()" }, |
223 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 223 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
224 | "devicebuttons/z_home", | 224 | "devicebuttons/z_home", |
225 | "QPE/Launcher", "home()", | 225 | "QPE/Launcher", "home()", |
226 | "buttonsettings", "raise()" }, | 226 | "buttonsettings", "raise()" }, |
227 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 227 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
228 | "devicebuttons/z_menu", | 228 | "devicebuttons/z_menu", |
229 | "QPE/TaskBar", "toggleMenu()", | 229 | "QPE/TaskBar", "toggleMenu()", |
230 | "QPE/TaskBar", "toggleStartMenu()" }, | 230 | "QPE/TaskBar", "toggleStartMenu()" }, |
231 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 231 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
232 | "devicebuttons/z_mail", | 232 | "devicebuttons/z_mail", |
233 | "mail", "raise()", | 233 | "mail", "raise()", |
234 | "mail", "newMail()" }, | 234 | "mail", "newMail()" }, |
235 | }; | 235 | }; |
236 | 236 | ||
237 | struct z_button z_buttons_c700 [] = { | 237 | struct z_button z_buttons_c700 [] = { |
238 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 238 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
239 | "devicebuttons/z_calendar", | 239 | "devicebuttons/z_calendar", |
240 | "datebook", "nextView()", | 240 | "datebook", "nextView()", |
241 | "today", "raise()" }, | 241 | "today", "raise()" }, |
242 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 242 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
243 | "devicebuttons/z_contact", | 243 | "devicebuttons/z_contact", |
244 | "addressbook", "raise()", | 244 | "addressbook", "raise()", |
245 | "addressbook", "beamBusinessCard()" }, | 245 | "addressbook", "beamBusinessCard()" }, |
246 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 246 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
247 | "devicebuttons/z_home", | 247 | "devicebuttons/z_home", |
248 | "QPE/Launcher", "home()", | 248 | "QPE/Launcher", "home()", |
249 | "buttonsettings", "raise()" }, | 249 | "buttonsettings", "raise()" }, |
250 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 250 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
251 | "devicebuttons/z_menu", | 251 | "devicebuttons/z_menu", |
252 | "QPE/TaskBar", "toggleMenu()", | 252 | "QPE/TaskBar", "toggleMenu()", |
253 | "QPE/TaskBar", "toggleStartMenu()" }, | 253 | "QPE/TaskBar", "toggleStartMenu()" }, |
254 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 254 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
255 | "", | 255 | "", |
256 | "QPE/Rotation", "flip()", | 256 | "QPE/Rotation", "flip()", |
257 | "QPE/Rotation", "flip()" }, | 257 | "QPE/Rotation", "flip()" }, |
258 | }; | 258 | }; |
259 | 259 | ||
260 | struct s_button { | 260 | struct s_button { |
261 | uint model; | 261 | uint model; |
262 | Qt::Key code; | 262 | Qt::Key code; |
263 | char *utext; | 263 | char *utext; |
264 | char *pix; | 264 | char *pix; |
265 | char *fpressedservice; | 265 | char *fpressedservice; |
266 | char *fpressedaction; | 266 | char *fpressedaction; |
267 | char *fheldservice; | 267 | char *fheldservice; |
268 | char *fheldaction; | 268 | char *fheldaction; |
269 | } simpad_buttons [] = { | 269 | } simpad_buttons [] = { |
270 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 270 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
271 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 271 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
272 | "devicebuttons/simpad_menu", | 272 | "devicebuttons/simpad_lower_up", |
273 | "QPE/TaskBar", "toggleMenu()", | 273 | "datebook", "nextView()", |
274 | "QPE/TaskBar", "toggleStartMenu()" }, | 274 | "today", "raise()" }, |
275 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 275 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
276 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 276 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
277 | "devicebuttons/ipaq_home", | 277 | "devicebuttons/simpad_lower_down", |
278 | "QPE/Launcher", "home()", | 278 | "addressbook", "raise()", |
279 | "buttonsettings", "raise()" }, | 279 | "addressbook", "beamBusinessCard()" }, |
280 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
281 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), | ||
282 | "devicebuttons/simpad_lower_right", | ||
283 | "QPE/TaskBar", "toggleMenu()", | ||
284 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
285 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
286 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | ||
287 | "devicebuttons/simpad_lower_upper", | ||
288 | "QPE/Launcher", "home()", | ||
289 | "buttonsettings", "raise()" }, | ||
290 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
291 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), | ||
292 | "devicebuttons/simpad_lower_left", | ||
293 | "mail", "raise()", | ||
294 | "mail", "newMail()" }, | ||
295 | |||
296 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
297 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), | ||
298 | "devicebuttons/simpad_upper_up", | ||
299 | "datebook", "nextView()", | ||
300 | "today", "raise()" }, | ||
301 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
302 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), | ||
303 | "devicebuttons/simpad_upper_down", | ||
304 | "addressbook", "raise()", | ||
305 | "addressbook", "beamBusinessCard()" }, | ||
306 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
307 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), | ||
308 | "devicebuttons/simpad_upper_right", | ||
309 | "QPE/TaskBar", "toggleMenu()", | ||
310 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
311 | /*{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
312 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | ||
313 | "devicebuttons/simpad_lower_upper", | ||
314 | "QPE/Launcher", "home()", | ||
315 | "buttonsettings", "raise()" },*/ | ||
316 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
317 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | ||
318 | "devicebuttons/simpad_upper_left", | ||
319 | "mail", "raise()", | ||
320 | "mail", "newMail()" }, | ||
280 | }; | 321 | }; |
281 | 322 | ||
282 | static QCString makeChannel ( const char *str ) | 323 | static QCString makeChannel ( const char *str ) |
283 | { | 324 | { |
284 | if ( str && !::strchr ( str, '/' )) | 325 | if ( str && !::strchr ( str, '/' )) |
285 | return QCString ( "QPE/Application/" ) + str; | 326 | return QCString ( "QPE/Application/" ) + str; |
286 | else | 327 | else |
287 | return str; | 328 | return str; |
288 | } | 329 | } |
289 | 330 | ||
290 | static inline bool isQWS() | 331 | static inline bool isQWS() |
291 | { | 332 | { |
292 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 333 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
293 | } | 334 | } |
294 | 335 | ||
295 | ODevice *ODevice::inst ( ) | 336 | ODevice *ODevice::inst ( ) |
296 | { | 337 | { |
297 | static ODevice *dev = 0; | 338 | static ODevice *dev = 0; |
298 | 339 | ||
299 | if ( !dev ) { | 340 | if ( !dev ) { |
300 | if ( QFile::exists ( "/proc/hal/model" )) | 341 | if ( QFile::exists ( "/proc/hal/model" )) |
301 | dev = new iPAQ ( ); | 342 | dev = new iPAQ ( ); |
302 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 343 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
303 | dev = new Zaurus ( ); | 344 | dev = new Zaurus ( ); |
304 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) | 345 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) |
305 | dev = new SIMpad ( ); | 346 | dev = new SIMpad ( ); |
306 | else | 347 | else |
307 | dev = new ODevice ( ); | 348 | dev = new ODevice ( ); |
308 | 349 | ||
309 | dev-> init ( ); | 350 | dev-> init ( ); |
310 | } | 351 | } |
311 | return dev; | 352 | return dev; |
312 | } | 353 | } |
313 | 354 | ||
314 | 355 | ||
315 | /************************************************** | 356 | /************************************************** |
316 | * | 357 | * |
317 | * common | 358 | * common |
318 | * | 359 | * |
319 | **************************************************/ | 360 | **************************************************/ |
320 | 361 | ||
321 | 362 | ||
322 | ODevice::ODevice ( ) | 363 | ODevice::ODevice ( ) |
323 | { | 364 | { |
324 | d = new ODeviceData; | 365 | d = new ODeviceData; |
325 | 366 | ||
326 | d-> m_modelstr = "Unknown"; | 367 | d-> m_modelstr = "Unknown"; |
327 | d-> m_model = Model_Unknown; | 368 | d-> m_model = Model_Unknown; |
328 | d-> m_vendorstr = "Unknown"; | 369 | d-> m_vendorstr = "Unknown"; |
329 | d-> m_vendor = Vendor_Unknown; | 370 | d-> m_vendor = Vendor_Unknown; |
330 | d-> m_systemstr = "Unknown"; | 371 | d-> m_systemstr = "Unknown"; |
331 | d-> m_system = System_Unknown; | 372 | d-> m_system = System_Unknown; |
332 | d-> m_sysverstr = "0.0"; | 373 | d-> m_sysverstr = "0.0"; |
333 | d-> m_rotation = Rot0; | 374 | d-> m_rotation = Rot0; |
334 | d-> m_direction = CW; | 375 | d-> m_direction = CW; |
335 | 376 | ||
336 | d-> m_holdtime = 1000; // 1000ms | 377 | d-> m_holdtime = 1000; // 1000ms |
337 | d-> m_buttons = 0; | 378 | d-> m_buttons = 0; |
338 | } | 379 | } |
339 | 380 | ||
340 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 381 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
341 | { | 382 | { |
342 | if ( msg == "deviceButtonMappingChanged()" ) { | 383 | if ( msg == "deviceButtonMappingChanged()" ) { |
343 | reloadButtonMapping ( ); | 384 | reloadButtonMapping ( ); |
344 | } | 385 | } |
345 | } | 386 | } |
346 | 387 | ||
347 | void ODevice::init ( ) | 388 | void ODevice::init ( ) |
348 | { | 389 | { |
349 | } | 390 | } |
350 | 391 | ||
351 | /** | 392 | /** |
352 | * This method initialises the button mapping | 393 | * This method initialises the button mapping |
353 | */ | 394 | */ |
354 | void ODevice::initButtons ( ) | 395 | void ODevice::initButtons ( ) |
355 | { | 396 | { |
356 | if ( d-> m_buttons ) | 397 | if ( d-> m_buttons ) |
357 | return; | 398 | return; |
358 | 399 | ||
359 | // Simulation uses iPAQ 3660 device buttons | 400 | // Simulation uses iPAQ 3660 device buttons |
360 | 401 | ||
361 | qDebug ( "init Buttons" ); | 402 | qDebug ( "init Buttons" ); |
362 | d-> m_buttons = new QValueList <ODeviceButton>; | 403 | d-> m_buttons = new QValueList <ODeviceButton>; |
363 | 404 | ||
364 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 405 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
365 | i_button *ib = ipaq_buttons + i; | 406 | i_button *ib = ipaq_buttons + i; |
366 | ODeviceButton b; | 407 | ODeviceButton b; |
367 | 408 | ||
368 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 409 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
369 | b. setKeycode ( ib-> code ); | 410 | b. setKeycode ( ib-> code ); |
370 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 411 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
371 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 412 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
372 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 413 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
373 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 414 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
374 | d-> m_buttons-> append ( b ); | 415 | d-> m_buttons-> append ( b ); |
375 | } | 416 | } |
376 | } | 417 | } |
377 | reloadButtonMapping ( ); | 418 | reloadButtonMapping ( ); |
378 | 419 | ||
379 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 420 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
380 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 421 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
381 | } | 422 | } |
382 | 423 | ||
383 | ODevice::~ODevice ( ) | 424 | ODevice::~ODevice ( ) |
384 | { | 425 | { |
385 | delete d; | 426 | delete d; |
386 | } | 427 | } |
387 | 428 | ||
388 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 429 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
389 | { | 430 | { |
390 | return false; | 431 | return false; |
391 | } | 432 | } |
392 | 433 | ||
393 | //#include <linux/apm_bios.h> | 434 | //#include <linux/apm_bios.h> |
394 | 435 | ||
395 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 436 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
396 | 437 | ||
397 | /** | 438 | /** |
398 | * This method will try to suspend the device | 439 | * This method will try to suspend the device |
399 | * It only works if the user is the QWS Server and the apm application | 440 | * It only works if the user is the QWS Server and the apm application |
400 | * is installed. | 441 | * is installed. |
401 | * It tries to suspend and then waits some time cause some distributions | 442 | * It tries to suspend and then waits some time cause some distributions |
402 | * do have asynchronus apm implementations. | 443 | * do have asynchronus apm implementations. |
403 | * This method will either fail and return false or it'll suspend the | 444 | * This method will either fail and return false or it'll suspend the |
404 | * device and return once the device got woken up | 445 | * device and return once the device got woken up |
405 | * | 446 | * |
406 | * @return if the device got suspended | 447 | * @return if the device got suspended |
407 | */ | 448 | */ |
408 | bool ODevice::suspend ( ) | 449 | bool ODevice::suspend ( ) |
409 | { | 450 | { |
410 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 451 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
411 | return false; | 452 | return false; |
412 | 453 | ||
413 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 454 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
414 | return false; | 455 | return false; |
415 | 456 | ||
416 | bool res = false; | 457 | bool res = false; |
417 | 458 | ||
418 | struct timeval tvs, tvn; | 459 | struct timeval tvs, tvn; |
419 | ::gettimeofday ( &tvs, 0 ); | 460 | ::gettimeofday ( &tvs, 0 ); |
420 | 461 | ||
421 | ::sync ( ); // flush fs caches | 462 | ::sync ( ); // flush fs caches |
422 | res = ( ::system ( "apm --suspend" ) == 0 ); | 463 | res = ( ::system ( "apm --suspend" ) == 0 ); |
423 | 464 | ||
424 | // This is needed because the iPAQ apm implementation is asynchronous and we | 465 | // This is needed because the iPAQ apm implementation is asynchronous and we |
425 | // can not be sure when exactly the device is really suspended | 466 | // can not be sure when exactly the device is really suspended |
426 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 467 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
427 | 468 | ||
428 | if ( res ) { | 469 | if ( res ) { |
429 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 470 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
430 | ::usleep ( 200 * 1000 ); | 471 | ::usleep ( 200 * 1000 ); |
431 | ::gettimeofday ( &tvn, 0 ); | 472 | ::gettimeofday ( &tvn, 0 ); |
432 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 473 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
433 | } | 474 | } |
434 | 475 | ||
435 | return res; | 476 | return res; |
436 | } | 477 | } |
437 | 478 | ||
438 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 479 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
439 | 480 | ||
440 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 481 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
441 | 482 | ||
442 | /* VESA Blanking Levels */ | 483 | /* VESA Blanking Levels */ |
443 | #define VESA_NO_BLANKING 0 | 484 | #define VESA_NO_BLANKING 0 |
444 | #define VESA_VSYNC_SUSPEND 1 | 485 | #define VESA_VSYNC_SUSPEND 1 |
445 | #define VESA_HSYNC_SUSPEND 2 | 486 | #define VESA_HSYNC_SUSPEND 2 |
446 | #define VESA_POWERDOWN 3 | 487 | #define VESA_POWERDOWN 3 |
447 | 488 | ||
448 | /** | 489 | /** |
449 | * This sets the display on or off | 490 | * This sets the display on or off |
450 | */ | 491 | */ |
451 | bool ODevice::setDisplayStatus ( bool on ) | 492 | bool ODevice::setDisplayStatus ( bool on ) |
452 | { | 493 | { |
453 | if ( d-> m_model == Model_Unknown ) | 494 | if ( d-> m_model == Model_Unknown ) |
454 | return false; | 495 | return false; |
455 | 496 | ||
456 | bool res = false; | 497 | bool res = false; |
457 | int fd; | 498 | int fd; |
458 | 499 | ||
459 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 500 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
460 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 501 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
461 | ::close ( fd ); | 502 | ::close ( fd ); |
462 | } | 503 | } |
463 | return res; | 504 | return res; |
464 | } | 505 | } |
465 | 506 | ||
466 | /** | 507 | /** |
467 | * This sets the display brightness | 508 | * This sets the display brightness |
468 | * @return success or failure | 509 | * @return success or failure |
469 | */ | 510 | */ |
470 | bool ODevice::setDisplayBrightness ( int p) | 511 | bool ODevice::setDisplayBrightness ( int p) |
471 | { | 512 | { |
472 | Q_UNUSED( p ) | 513 | Q_UNUSED( p ) |
473 | return false; | 514 | return false; |
474 | } | 515 | } |
475 | 516 | ||
476 | int ODevice::displayBrightnessResolution ( ) const | 517 | int ODevice::displayBrightnessResolution ( ) const |
477 | { | 518 | { |
478 | return 16; | 519 | return 16; |
479 | } | 520 | } |
480 | 521 | ||
481 | /** | 522 | /** |
482 | * This returns the vendor as string | 523 | * This returns the vendor as string |
483 | * @return Vendor as QString | 524 | * @return Vendor as QString |
484 | */ | 525 | */ |
485 | QString ODevice::vendorString ( ) const | 526 | QString ODevice::vendorString ( ) const |
486 | { | 527 | { |
487 | return d-> m_vendorstr; | 528 | return d-> m_vendorstr; |
488 | } | 529 | } |
489 | 530 | ||
490 | /** | 531 | /** |
491 | * This returns the vendor as one of the values of OVendor | 532 | * This returns the vendor as one of the values of OVendor |
492 | * @return OVendor | 533 | * @return OVendor |
493 | */ | 534 | */ |
494 | OVendor ODevice::vendor ( ) const | 535 | OVendor ODevice::vendor ( ) const |
495 | { | 536 | { |
496 | return d-> m_vendor; | 537 | return d-> m_vendor; |
497 | } | 538 | } |
498 | 539 | ||
499 | /** | 540 | /** |
500 | * This returns the model as a string | 541 | * This returns the model as a string |
501 | * @return A string representing the model | 542 | * @return A string representing the model |
502 | */ | 543 | */ |
503 | QString ODevice::modelString ( ) const | 544 | QString ODevice::modelString ( ) const |
504 | { | 545 | { |
505 | return d-> m_modelstr; | 546 | return d-> m_modelstr; |
506 | } | 547 | } |
507 | 548 | ||
508 | /** | 549 | /** |
509 | * This does return the OModel used | 550 | * This does return the OModel used |
510 | */ | 551 | */ |
511 | OModel ODevice::model ( ) const | 552 | OModel ODevice::model ( ) const |
512 | { | 553 | { |
513 | return d-> m_model; | 554 | return d-> m_model; |
514 | } | 555 | } |
515 | 556 | ||
516 | /** | 557 | /** |
517 | * This does return the systen name | 558 | * This does return the systen name |
518 | */ | 559 | */ |
519 | QString ODevice::systemString ( ) const | 560 | QString ODevice::systemString ( ) const |
520 | { | 561 | { |
521 | return d-> m_systemstr; | 562 | return d-> m_systemstr; |
522 | } | 563 | } |
523 | 564 | ||
524 | /** | 565 | /** |
525 | * Return System as OSystem value | 566 | * Return System as OSystem value |
526 | */ | 567 | */ |
527 | OSystem ODevice::system ( ) const | 568 | OSystem ODevice::system ( ) const |
528 | { | 569 | { |
529 | return d-> m_system; | 570 | return d-> m_system; |
530 | } | 571 | } |
531 | 572 | ||
532 | /** | 573 | /** |
533 | * @return the version string of the base system | 574 | * @return the version string of the base system |
534 | */ | 575 | */ |
535 | QString ODevice::systemVersionString ( ) const | 576 | QString ODevice::systemVersionString ( ) const |
536 | { | 577 | { |
537 | return d-> m_sysverstr; | 578 | return d-> m_sysverstr; |
538 | } | 579 | } |
539 | 580 | ||
540 | /** | 581 | /** |
541 | * @return the current Transformation | 582 | * @return the current Transformation |
542 | */ | 583 | */ |
543 | Transformation ODevice::rotation ( ) const | 584 | Transformation ODevice::rotation ( ) const |
544 | { | 585 | { |
545 | return d-> m_rotation; | 586 | return d-> m_rotation; |
546 | } | 587 | } |
547 | 588 | ||
548 | /** | 589 | /** |
549 | * @return the current rotation direction | 590 | * @return the current rotation direction |
550 | */ | 591 | */ |
551 | ODirection ODevice::direction ( ) const | 592 | ODirection ODevice::direction ( ) const |
552 | { | 593 | { |
553 | return d-> m_direction; | 594 | return d-> m_direction; |
554 | } | 595 | } |
555 | 596 | ||
556 | /** | 597 | /** |
557 | * This plays an alarmSound | 598 | * This plays an alarmSound |
558 | */ | 599 | */ |
559 | void ODevice::alarmSound ( ) | 600 | void ODevice::alarmSound ( ) |
560 | { | 601 | { |
561 | #ifndef QT_NO_SOUND | 602 | #ifndef QT_NO_SOUND |
562 | static Sound snd ( "alarm" ); | 603 | static Sound snd ( "alarm" ); |
563 | 604 | ||
564 | if ( snd. isFinished ( )) | 605 | if ( snd. isFinished ( )) |
565 | snd. play ( ); | 606 | snd. play ( ); |
566 | #endif | 607 | #endif |
567 | } | 608 | } |
568 | 609 | ||
569 | /** | 610 | /** |
570 | * This plays a key sound | 611 | * This plays a key sound |
571 | */ | 612 | */ |
572 | void ODevice::keySound ( ) | 613 | void ODevice::keySound ( ) |
573 | { | 614 | { |
574 | #ifndef QT_NO_SOUND | 615 | #ifndef QT_NO_SOUND |
575 | static Sound snd ( "keysound" ); | 616 | static Sound snd ( "keysound" ); |
576 | 617 | ||
577 | if ( snd. isFinished ( )) | 618 | if ( snd. isFinished ( )) |
578 | snd. play ( ); | 619 | snd. play ( ); |
579 | #endif | 620 | #endif |
580 | } | 621 | } |
581 | 622 | ||
582 | /** | 623 | /** |
583 | * This plays a touch sound | 624 | * This plays a touch sound |
584 | */ | 625 | */ |
585 | void ODevice::touchSound ( ) | 626 | void ODevice::touchSound ( ) |
586 | { | 627 | { |
587 | 628 | ||
588 | #ifndef QT_NO_SOUND | 629 | #ifndef QT_NO_SOUND |
589 | static Sound snd ( "touchsound" ); | 630 | static Sound snd ( "touchsound" ); |
590 | 631 | ||
591 | if ( snd. isFinished ( )) | 632 | if ( snd. isFinished ( )) |
592 | snd. play ( ); | 633 | snd. play ( ); |
593 | #endif | 634 | #endif |
594 | } | 635 | } |
595 | 636 | ||
596 | /** | 637 | /** |
597 | * This method will return a list of leds | 638 | * This method will return a list of leds |
598 | * available on this device | 639 | * available on this device |
599 | * @return a list of LEDs. | 640 | * @return a list of LEDs. |
600 | */ | 641 | */ |
601 | QValueList <OLed> ODevice::ledList ( ) const | 642 | QValueList <OLed> ODevice::ledList ( ) const |
602 | { | 643 | { |
603 | return QValueList <OLed> ( ); | 644 | return QValueList <OLed> ( ); |
604 | } | 645 | } |
605 | 646 | ||
606 | /** | 647 | /** |
607 | * This does return the state of the LEDs | 648 | * This does return the state of the LEDs |
608 | */ | 649 | */ |
609 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 650 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
610 | { | 651 | { |
611 | return QValueList <OLedState> ( ); | 652 | return QValueList <OLedState> ( ); |
612 | } | 653 | } |
613 | 654 | ||
614 | /** | 655 | /** |
615 | * @return the state for a given OLed | 656 | * @return the state for a given OLed |
616 | */ | 657 | */ |
617 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 658 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
618 | { | 659 | { |
619 | return Led_Off; | 660 | return Led_Off; |
620 | } | 661 | } |
621 | 662 | ||
622 | /** | 663 | /** |
623 | * Set the state for a LED | 664 | * Set the state for a LED |
624 | * @param which Which OLed to use | 665 | * @param which Which OLed to use |
625 | * @param st The state to set | 666 | * @param st The state to set |
626 | * @return success or failure | 667 | * @return success or failure |
627 | */ | 668 | */ |
628 | bool ODevice::setLedState ( OLed which, OLedState st ) | 669 | bool ODevice::setLedState ( OLed which, OLedState st ) |
629 | { | 670 | { |
630 | Q_UNUSED( which ) | 671 | Q_UNUSED( which ) |
631 | Q_UNUSED( st ) | 672 | Q_UNUSED( st ) |
632 | return false; | 673 | return false; |
633 | } | 674 | } |
634 | 675 | ||
635 | /** | 676 | /** |
636 | * @return if the device has a light sensor | 677 | * @return if the device has a light sensor |
637 | */ | 678 | */ |
638 | bool ODevice::hasLightSensor ( ) const | 679 | bool ODevice::hasLightSensor ( ) const |
639 | { | 680 | { |
640 | return false; | 681 | return false; |
641 | } | 682 | } |
642 | 683 | ||
643 | /** | 684 | /** |
644 | * @return a value from the light senso | 685 | * @return a value from the light senso |
645 | */ | 686 | */ |
646 | int ODevice::readLightSensor ( ) | 687 | int ODevice::readLightSensor ( ) |
647 | { | 688 | { |
648 | return -1; | 689 | return -1; |
649 | } | 690 | } |
650 | 691 | ||
651 | /** | 692 | /** |
652 | * @return the light sensor resolution whatever that is ;) | 693 | * @return the light sensor resolution whatever that is ;) |
653 | */ | 694 | */ |
654 | int ODevice::lightSensorResolution ( ) const | 695 | int ODevice::lightSensorResolution ( ) const |
655 | { | 696 | { |
656 | return 0; | 697 | return 0; |
657 | } | 698 | } |
658 | 699 | ||
659 | /** | 700 | /** |
660 | * @return a list of hardware buttons | 701 | * @return a list of hardware buttons |
661 | */ | 702 | */ |
662 | const QValueList <ODeviceButton> &ODevice::buttons ( ) | 703 | const QValueList <ODeviceButton> &ODevice::buttons ( ) |
663 | { | 704 | { |