-rw-r--r-- | libopie/odevice.h | 3 | ||||
-rw-r--r-- | libopie/odevicebutton.cpp | 4 | ||||
-rw-r--r-- | libopie/odevicebutton.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/libopie/odevice.h b/libopie/odevice.h index 650a2da..d8ad135 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -1,26 +1,27 @@ | |||
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 | Copyright (C) 2003 Holger 'zecke' Freyther (zecke@handhelds.org) | ||
3 | 4 | ||
4 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
8 | 9 | ||
9 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 13 | Library General Public License for more details. |
13 | 14 | ||
14 | You should have received a copy of the GNU Library General Public License | 15 | 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 | 16 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
18 | */ | 19 | */ |
19 | 20 | ||
20 | #ifndef _LIBOPIE_ODEVICE_H_ | 21 | #ifndef _LIBOPIE_ODEVICE_H_ |
21 | #define _LIBOPIE_ODEVICE_H_ | 22 | #define _LIBOPIE_ODEVICE_H_ |
22 | 23 | ||
23 | #include <qobject.h> | 24 | #include <qobject.h> |
24 | #include <qstring.h> | 25 | #include <qstring.h> |
25 | #include <qnamespace.h> | 26 | #include <qnamespace.h> |
26 | #include <qstrlist.h> | 27 | #include <qstrlist.h> |
@@ -192,49 +193,49 @@ public: | |||
192 | // input / output | 193 | // input / output |
193 | //FIXME playAlarmSound and al might be better -zecke | 194 | //FIXME playAlarmSound and al might be better -zecke |
194 | virtual void alarmSound ( ); | 195 | virtual void alarmSound ( ); |
195 | virtual void keySound ( ); | 196 | virtual void keySound ( ); |
196 | virtual void touchSound ( ); | 197 | virtual void touchSound ( ); |
197 | 198 | ||
198 | virtual QValueList <OLed> ledList ( ) const; | 199 | virtual QValueList <OLed> ledList ( ) const; |
199 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 200 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
200 | virtual OLedState ledState ( OLed led ) const; | 201 | virtual OLedState ledState ( OLed led ) const; |
201 | virtual bool setLedState ( OLed led, OLedState st ); | 202 | virtual bool setLedState ( OLed led, OLedState st ); |
202 | 203 | ||
203 | virtual bool hasLightSensor ( ) const; | 204 | virtual bool hasLightSensor ( ) const; |
204 | virtual int readLightSensor ( ); | 205 | virtual int readLightSensor ( ); |
205 | virtual int lightSensorResolution ( ) const; | 206 | virtual int lightSensorResolution ( ) const; |
206 | 207 | ||
207 | const QStrList &allowedCpuFrequencies() const; | 208 | const QStrList &allowedCpuFrequencies() const; |
208 | bool setCurrentCpuFrequency(uint index); | 209 | bool setCurrentCpuFrequency(uint index); |
209 | 210 | ||
210 | /** | 211 | /** |
211 | * Returns the available buttons on this device. The number and location | 212 | * Returns the available buttons on this device. The number and location |
212 | * of buttons will vary depending on the device. Button numbers will be assigned | 213 | * of buttons will vary depending on the device. Button numbers will be assigned |
213 | * by the device manufacturer and will be from most preferred button to least preffered | 214 | * by the device manufacturer and will be from most preferred button to least preffered |
214 | * button. Note that this list only contains "user mappable" buttons. | 215 | * button. Note that this list only contains "user mappable" buttons. |
215 | */ | 216 | */ |
216 | const QValueList<ODeviceButton> &buttons ( ); | 217 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; |
217 | 218 | ||
218 | /** | 219 | /** |
219 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 220 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
220 | * returns 0L | 221 | * returns 0L |
221 | */ | 222 | */ |
222 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 223 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
223 | 224 | ||
224 | /** | 225 | /** |
225 | * Reassigns the pressed action for \a button. To return to the factory | 226 | * Reassigns the pressed action for \a button. To return to the factory |
226 | * default pass an empty string as \a qcopMessage. | 227 | * default pass an empty string as \a qcopMessage. |
227 | */ | 228 | */ |
228 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 229 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
229 | 230 | ||
230 | /** | 231 | /** |
231 | * Reassigns the held action for \a button. To return to the factory | 232 | * Reassigns the held action for \a button. To return to the factory |
232 | * default pass an empty string as \a qcopMessage. | 233 | * default pass an empty string as \a qcopMessage. |
233 | */ | 234 | */ |
234 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 235 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
235 | 236 | ||
236 | /** | 237 | /** |
237 | * How long (in ms) you have to press a button for a "hold" action | 238 | * How long (in ms) you have to press a button for a "hold" action |
238 | */ | 239 | */ |
239 | uint buttonHoldTime ( ) const; | 240 | uint buttonHoldTime ( ) const; |
240 | 241 | ||
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp index eccb57c..314eb51 100644 --- a/libopie/odevicebutton.cpp +++ b/libopie/odevicebutton.cpp | |||
@@ -75,48 +75,52 @@ bool OQCopMessage::send ( ) | |||
75 | 75 | ||
76 | QCopEnvelope e ( d-> m_channel, d-> m_message ); | 76 | QCopEnvelope e ( d-> m_channel, d-> m_message ); |
77 | 77 | ||
78 | if ( d-> m_data. size ( )) | 78 | if ( d-> m_data. size ( )) |
79 | e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( )); | 79 | e. writeRawBytes ( d-> m_data. data ( ), d-> m_data. size ( )); |
80 | 80 | ||
81 | return true; | 81 | return true; |
82 | } | 82 | } |
83 | 83 | ||
84 | QCString OQCopMessage::channel ( ) const | 84 | QCString OQCopMessage::channel ( ) const |
85 | { | 85 | { |
86 | return d-> m_channel; | 86 | return d-> m_channel; |
87 | } | 87 | } |
88 | 88 | ||
89 | QCString OQCopMessage::message ( ) const | 89 | QCString OQCopMessage::message ( ) const |
90 | { | 90 | { |
91 | return d-> m_message; | 91 | return d-> m_message; |
92 | } | 92 | } |
93 | 93 | ||
94 | QByteArray OQCopMessage::data ( ) const | 94 | QByteArray OQCopMessage::data ( ) const |
95 | { | 95 | { |
96 | return d-> m_data; | 96 | return d-> m_data; |
97 | } | 97 | } |
98 | 98 | ||
99 | bool OQCopMessage::isNull() const | ||
100 | { | ||
101 | return d-> m_message.isNull() || d-> m_channel.isNull(); | ||
102 | } | ||
99 | void OQCopMessage::setChannel ( const QCString &ch ) | 103 | void OQCopMessage::setChannel ( const QCString &ch ) |
100 | { | 104 | { |
101 | d-> m_channel = ch; | 105 | d-> m_channel = ch; |
102 | } | 106 | } |
103 | 107 | ||
104 | void OQCopMessage::setMessage ( const QCString &m ) | 108 | void OQCopMessage::setMessage ( const QCString &m ) |
105 | { | 109 | { |
106 | d-> m_message = m; | 110 | d-> m_message = m; |
107 | } | 111 | } |
108 | 112 | ||
109 | void OQCopMessage::setData ( const QByteArray &data ) | 113 | void OQCopMessage::setData ( const QByteArray &data ) |
110 | { | 114 | { |
111 | d-> m_data = data; | 115 | d-> m_data = data; |
112 | } | 116 | } |
113 | 117 | ||
114 | /*! \class Opie::ODeviceButton | 118 | /*! \class Opie::ODeviceButton |
115 | \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device. | 119 | \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device. |
116 | 120 | ||
117 | This class represents a physical button on a Qtopia device. A | 121 | This class represents a physical button on a Qtopia device. A |
118 | device may have "user programmable" buttons. | 122 | device may have "user programmable" buttons. |
119 | The location and number of buttons will vary from device to | 123 | The location and number of buttons will vary from device to |
120 | device. userText() and pixmap() may be used to describe this button | 124 | device. userText() and pixmap() may be used to describe this button |
121 | to the user in help documentation. | 125 | to the user in help documentation. |
122 | 126 | ||
diff --git a/libopie/odevicebutton.h b/libopie/odevicebutton.h index fcc2af1..1621526 100644 --- a/libopie/odevicebutton.h +++ b/libopie/odevicebutton.h | |||
@@ -23,48 +23,50 @@ | |||
23 | #include <qpixmap.h> | 23 | #include <qpixmap.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | 25 | ||
26 | class OQCopMessageData; | 26 | class OQCopMessageData; |
27 | 27 | ||
28 | namespace Opie | 28 | namespace Opie |
29 | { | 29 | { |
30 | 30 | ||
31 | class OQCopMessage { | 31 | class OQCopMessage { |
32 | public: | 32 | public: |
33 | OQCopMessage ( ); | 33 | OQCopMessage ( ); |
34 | OQCopMessage ( const OQCopMessage © ); | 34 | OQCopMessage ( const OQCopMessage © ); |
35 | OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( )); | 35 | OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( )); |
36 | 36 | ||
37 | OQCopMessage &operator = ( const OQCopMessage &assign ); | 37 | OQCopMessage &operator = ( const OQCopMessage &assign ); |
38 | 38 | ||
39 | void setChannel ( const QCString &channel ); | 39 | void setChannel ( const QCString &channel ); |
40 | void setMessage ( const QCString &message ); | 40 | void setMessage ( const QCString &message ); |
41 | void setData ( const QByteArray &ba ); | 41 | void setData ( const QByteArray &ba ); |
42 | 42 | ||
43 | QCString channel ( ) const; | 43 | QCString channel ( ) const; |
44 | QCString message ( ) const; | 44 | QCString message ( ) const; |
45 | QByteArray data ( ) const; | 45 | QByteArray data ( ) const; |
46 | 46 | ||
47 | bool isNull()const; | ||
48 | |||
47 | bool send ( ); | 49 | bool send ( ); |
48 | 50 | ||
49 | private: | 51 | private: |
50 | void init ( const QCString &m_channel, const QCString &message, const QByteArray &args ); | 52 | void init ( const QCString &m_channel, const QCString &message, const QByteArray &args ); |
51 | 53 | ||
52 | OQCopMessageData *d; | 54 | OQCopMessageData *d; |
53 | class Private; | 55 | class Private; |
54 | Private* m_data; | 56 | Private* m_data; |
55 | }; | 57 | }; |
56 | 58 | ||
57 | 59 | ||
58 | /** | 60 | /** |
59 | * This class represents a physical button on a Qtopia device. A device may | 61 | * This class represents a physical button on a Qtopia device. A device may |
60 | * have n "user programmable" buttons, which are number 1..n. The location | 62 | * have n "user programmable" buttons, which are number 1..n. The location |
61 | * and number of buttons will vary from device to device. userText() and pixmap() | 63 | * and number of buttons will vary from device to device. userText() and pixmap() |
62 | * may be used to describe this button to the user in help documentation. | 64 | * may be used to describe this button to the user in help documentation. |
63 | * | 65 | * |
64 | * @version 1.0 | 66 | * @version 1.0 |
65 | * @author Trolltech | 67 | * @author Trolltech |
66 | * @short A representation of buttons | 68 | * @short A representation of buttons |
67 | */ | 69 | */ |
68 | 70 | ||
69 | class ODeviceButton | 71 | class ODeviceButton |
70 | { | 72 | { |