summaryrefslogtreecommitdiff
path: root/libopie
authorzecke <zecke>2003-08-25 16:41:34 (UTC)
committer zecke <zecke>2003-08-25 16:41:34 (UTC)
commit93572d0abaae444a56051d21a6fdbb76d56726e3 (patch) (unidiff)
tree859d9d17e45d3acf2ecb9b4157ac96daba714ad6 /libopie
parent44b9e62c1e5071fc6e5f8e80204b9974dbc704b6 (diff)
downloadopie-93572d0abaae444a56051d21a6fdbb76d56726e3.zip
opie-93572d0abaae444a56051d21a6fdbb76d56726e3.tar.gz
opie-93572d0abaae444a56051d21a6fdbb76d56726e3.tar.bz2
add is null
and comment about constness
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.h3
-rw-r--r--libopie/odevicebutton.cpp4
-rw-r--r--libopie/odevicebutton.h2
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,256 +1,257 @@
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>
27 28
28#include <opie/odevicebutton.h> 29#include <opie/odevicebutton.h>
29 30
30#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 31#include <qpe/qpeapplication.h> /* for Transformation enum.. */
31 32
32class ODeviceData; 33class ODeviceData;
33 34
34namespace Opie { 35namespace Opie {
35 36
36/** 37/**
37 * The available devices 38 * The available devices
38 */ 39 */
39enum OModel { 40enum OModel {
40 Model_Unknown, // = 0 41 Model_Unknown, // = 0
41 42
42 Model_Series_Mask = 0xff000000, 43 Model_Series_Mask = 0xff000000,
43 44
44 Model_iPAQ = ( 1 << 24 ), 45 Model_iPAQ = ( 1 << 24 ),
45 46
46 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 47 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
47 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 48 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
48 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 49 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
49 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 50 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
50 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 51 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
51 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 52 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
52 53
53 Model_Zaurus = ( 2 << 24 ), 54 Model_Zaurus = ( 2 << 24 ),
54 55
55 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 56 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
56 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 57 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
57 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 58 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
58 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 59 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
59 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), 60 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ),
60 61
61 Model_SIMpad = ( 3 << 24 ), 62 Model_SIMpad = ( 3 << 24 ),
62 63
63 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), 64 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
64 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), 65 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
65 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), 66 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
66 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), 67 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
67 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), 68 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
68 69
69 Model_Ramses = ( 4 << 24 ), 70 Model_Ramses = ( 4 << 24 ),
70 71
71 Model_Ramses_All = ( Model_Ramses | 0xffffff ), 72 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
72 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), 73 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
73}; 74};
74 75
75/** 76/**
76 * The vendor of the device 77 * The vendor of the device
77 */ 78 */
78enum OVendor { 79enum OVendor {
79 Vendor_Unknown, 80 Vendor_Unknown,
80 81
81 Vendor_HP, 82 Vendor_HP,
82 Vendor_Sharp, 83 Vendor_Sharp,
83 Vendor_SIEMENS, 84 Vendor_SIEMENS,
84 Vendor_MundN, 85 Vendor_MundN,
85}; 86};
86 87
87/** 88/**
88 * The System used 89 * The System used
89 */ 90 */
90enum OSystem { 91enum OSystem {
91 System_Unknown, 92 System_Unknown,
92 93
93 System_Familiar, 94 System_Familiar,
94 System_Zaurus, 95 System_Zaurus,
95 System_OpenZaurus 96 System_OpenZaurus
96}; 97};
97 98
98enum OLedState { 99enum OLedState {
99 Led_Off, 100 Led_Off,
100 Led_On, 101 Led_On,
101 Led_BlinkSlow, 102 Led_BlinkSlow,
102 Led_BlinkFast 103 Led_BlinkFast
103}; 104};
104 105
105enum OLed { 106enum OLed {
106 Led_Mail, 107 Led_Mail,
107 Led_Power, 108 Led_Power,
108 Led_BlueTooth 109 Led_BlueTooth
109}; 110};
110 111
111enum OHardKey { 112enum OHardKey {
112 HardKey_Datebook = Qt::Key_F9, 113 HardKey_Datebook = Qt::Key_F9,
113 HardKey_Contacts = Qt::Key_F10, 114 HardKey_Contacts = Qt::Key_F10,
114 HardKey_Menu = Qt::Key_F11, 115 HardKey_Menu = Qt::Key_F11,
115 HardKey_Home = Qt::Key_F12, 116 HardKey_Home = Qt::Key_F12,
116 HardKey_Mail = Qt::Key_F13, 117 HardKey_Mail = Qt::Key_F13,
117 HardKey_Record = Qt::Key_F24, 118 HardKey_Record = Qt::Key_F24,
118 HardKey_Suspend = Qt::Key_F34, 119 HardKey_Suspend = Qt::Key_F34,
119 HardKey_Backlight = Qt::Key_F35, 120 HardKey_Backlight = Qt::Key_F35,
120}; 121};
121 122
122enum ODirection { 123enum ODirection {
123 CW = 0, 124 CW = 0,
124 CCW = 1, 125 CCW = 1,
125 Flip = 2, 126 Flip = 2,
126}; 127};
127 128
128/** 129/**
129 * A singleton which gives informations about device specefic option 130 * A singleton which gives informations about device specefic option
130 * like the Hardware used, LEDs, the Base Distribution and 131 * like the Hardware used, LEDs, the Base Distribution and
131 * hardware key mappings. 132 * hardware key mappings.
132 * 133 *
133 * @short A small class for device specefic options 134 * @short A small class for device specefic options
134 * @see QObject 135 * @see QObject
135 * @author Robert Griebl 136 * @author Robert Griebl
136 * @version 1.0 137 * @version 1.0
137 */ 138 */
138class ODevice : public QObject { 139class ODevice : public QObject {
139 Q_OBJECT 140 Q_OBJECT
140 141
141private: 142private:
142 /* disable copy */ 143 /* disable copy */
143 ODevice ( const ODevice & ); 144 ODevice ( const ODevice & );
144 145
145protected: 146protected:
146 ODevice ( ); 147 ODevice ( );
147 virtual void init ( ); 148 virtual void init ( );
148 virtual void initButtons ( ); 149 virtual void initButtons ( );
149 150
150 ODeviceData *d; 151 ODeviceData *d;
151 152
152public: 153public:
153 // sandman do we want to allow destructions? -zecke? 154 // sandman do we want to allow destructions? -zecke?
154 virtual ~ODevice ( ); 155 virtual ~ODevice ( );
155 156
156 static ODevice *inst ( ); 157 static ODevice *inst ( );
157 158
158 // information 159 // information
159 160
160 QString modelString ( ) const; 161 QString modelString ( ) const;
161 OModel model ( ) const; 162 OModel model ( ) const;
162 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } 163 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
163 164
164 QString vendorString ( ) const; 165 QString vendorString ( ) const;
165 OVendor vendor ( ) const; 166 OVendor vendor ( ) const;
166 167
167 QString systemString ( ) const; 168 QString systemString ( ) const;
168 OSystem system ( ) const; 169 OSystem system ( ) const;
169 170
170 QString systemVersionString ( ) const; 171 QString systemVersionString ( ) const;
171 172
172 Transformation rotation ( ) const; 173 Transformation rotation ( ) const;
173 ODirection direction ( ) const; 174 ODirection direction ( ) const;
174 175
175// system 176// system
176 177
177 virtual bool setSoftSuspend ( bool on ); 178 virtual bool setSoftSuspend ( bool on );
178 virtual bool suspend ( ); 179 virtual bool suspend ( );
179 180
180 virtual bool setDisplayStatus ( bool on ); 181 virtual bool setDisplayStatus ( bool on );
181 virtual bool setDisplayBrightness ( int brightness ); 182 virtual bool setDisplayBrightness ( int brightness );
182 virtual int displayBrightnessResolution ( ) const; 183 virtual int displayBrightnessResolution ( ) const;
183 virtual bool setDisplayContrast ( int contrast ); 184 virtual bool setDisplayContrast ( int contrast );
184 virtual int displayContrastResolution ( ) const; 185 virtual int displayContrastResolution ( ) const;
185 186
186 // don't add new virtual methods, use this: 187 // don't add new virtual methods, use this:
187 ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 188 ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
188 // and in your subclass do do overwrite 189 // and in your subclass do do overwrite
189 //protected virtual int virtual_hook(int, void *) 190 //protected virtual int virtual_hook(int, void *)
190 // which is defined below 191 // which is defined below
191 192
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
241signals: 242signals:
242 void buttonMappingChanged ( ); 243 void buttonMappingChanged ( );
243 244
244private slots: 245private slots:
245 void systemMessage ( const QCString &, const QByteArray & ); 246 void systemMessage ( const QCString &, const QByteArray & );
246 247
247protected: 248protected:
248 void reloadButtonMapping ( ); 249 void reloadButtonMapping ( );
249 /* ugly virtual hook */ 250 /* ugly virtual hook */
250 virtual void virtual_hook( int id, void* data ); 251 virtual void virtual_hook( int id, void* data );
251}; 252};
252 253
253} 254}
254 255
255#endif 256#endif
256 257
diff --git a/libopie/odevicebutton.cpp b/libopie/odevicebutton.cpp
index eccb57c..314eb51 100644
--- a/libopie/odevicebutton.cpp
+++ b/libopie/odevicebutton.cpp
@@ -1,235 +1,239 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qstring.h> 22#include <qstring.h>
23 23
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <opie/odevicebutton.h> 25#include <opie/odevicebutton.h>
26 26
27using namespace Opie; 27using namespace Opie;
28 28
29 29
30class OQCopMessageData { 30class OQCopMessageData {
31public: 31public:
32 QCString m_channel; 32 QCString m_channel;
33 QCString m_message; 33 QCString m_message;
34 QByteArray m_data; 34 QByteArray m_data;
35}; 35};
36 36
37 37
38OQCopMessage::OQCopMessage ( ) 38OQCopMessage::OQCopMessage ( )
39 : d ( 0 ) 39 : d ( 0 )
40{ 40{
41 init ( QCString ( ), QCString ( ), QByteArray ( )); 41 init ( QCString ( ), QCString ( ), QByteArray ( ));
42} 42}
43 43
44OQCopMessage::OQCopMessage ( const OQCopMessage &copy ) 44OQCopMessage::OQCopMessage ( const OQCopMessage &copy )
45 : d ( 0 ) 45 : d ( 0 )
46{ 46{
47 init ( copy. channel ( ), copy. message ( ), copy. data ( )); 47 init ( copy. channel ( ), copy. message ( ), copy. data ( ));
48} 48}
49 49
50OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) 50OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign )
51{ 51{
52 init ( assign. channel ( ), assign. message ( ), assign. data ( )); 52 init ( assign. channel ( ), assign. message ( ), assign. data ( ));
53 return *this; 53 return *this;
54} 54}
55 55
56OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) 56OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg )
57 : d ( 0 ) 57 : d ( 0 )
58{ 58{
59 init ( ch, m, arg ); 59 init ( ch, m, arg );
60} 60}
61 61
62void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) 62void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg )
63{ 63{
64 if ( !d ) 64 if ( !d )
65 d = new OQCopMessageData ( ); 65 d = new OQCopMessageData ( );
66 d-> m_channel = ch; 66 d-> m_channel = ch;
67 d-> m_message = m; 67 d-> m_message = m;
68 d-> m_data = arg; 68 d-> m_data = arg;
69} 69}
70 70
71bool OQCopMessage::send ( ) 71bool OQCopMessage::send ( )
72{ 72{
73 if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) ) 73 if ( d-> m_channel. isEmpty ( ) || d-> m_message. isEmpty ( ) )
74 return false; 74 return false;
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
84QCString OQCopMessage::channel ( ) const 84QCString OQCopMessage::channel ( ) const
85{ 85{
86 return d-> m_channel; 86 return d-> m_channel;
87} 87}
88 88
89QCString OQCopMessage::message ( ) const 89QCString OQCopMessage::message ( ) const
90{ 90{
91 return d-> m_message; 91 return d-> m_message;
92} 92}
93 93
94QByteArray OQCopMessage::data ( ) const 94QByteArray OQCopMessage::data ( ) const
95{ 95{
96 return d-> m_data; 96 return d-> m_data;
97} 97}
98 98
99bool OQCopMessage::isNull() const
100{
101 return d-> m_message.isNull() || d-> m_channel.isNull();
102}
99void OQCopMessage::setChannel ( const QCString &ch ) 103void OQCopMessage::setChannel ( const QCString &ch )
100{ 104{
101 d-> m_channel = ch; 105 d-> m_channel = ch;
102} 106}
103 107
104void OQCopMessage::setMessage ( const QCString &m ) 108void OQCopMessage::setMessage ( const QCString &m )
105{ 109{
106 d-> m_message = m; 110 d-> m_message = m;
107} 111}
108 112
109void OQCopMessage::setData ( const QByteArray &data ) 113void 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
123 \ingroup qtopiaemb 127 \ingroup qtopiaemb
124 \internal 128 \internal
125*/ 129*/
126 130
127ODeviceButton::ODeviceButton() 131ODeviceButton::ODeviceButton()
128{ 132{
129} 133}
130 134
131ODeviceButton::~ODeviceButton() 135ODeviceButton::~ODeviceButton()
132{ 136{
133} 137}
134 138
135/*! 139/*!
136 Returns the button's keycode. 140 Returns the button's keycode.
137 */ 141 */
138ushort ODeviceButton::keycode() const 142ushort ODeviceButton::keycode() const
139{ 143{
140 return m_Keycode; 144 return m_Keycode;
141} 145}
142 146
143 147
144/*! 148/*!
145 This function returns a human readable, translated description of the button. 149 This function returns a human readable, translated description of the button.
146 */ 150 */
147QString ODeviceButton::userText() const 151QString ODeviceButton::userText() const
148{ 152{
149 return m_UserText; 153 return m_UserText;
150} 154}
151 155
152/*! 156/*!
153 This function returns the pixmap for this button. If there isn't one 157 This function returns the pixmap for this button. If there isn't one
154 it will return an empty (null) pixmap. 158 it will return an empty (null) pixmap.
155 */ 159 */
156QPixmap ODeviceButton::pixmap() const 160QPixmap ODeviceButton::pixmap() const
157{ 161{
158 return m_Pixmap; 162 return m_Pixmap;
159} 163}
160 164
161/*! 165/*!
162 This function returns the factory preset (default) action for when this button 166 This function returns the factory preset (default) action for when this button
163 is pressed. The return value is a legal QCop message. 167 is pressed. The return value is a legal QCop message.
164 */ 168 */
165OQCopMessage ODeviceButton::factoryPresetPressedAction() const 169OQCopMessage ODeviceButton::factoryPresetPressedAction() const
166{ 170{
167 return m_FactoryPresetPressedAction; 171 return m_FactoryPresetPressedAction;
168} 172}
169 173
170/*! 174/*!
171 This function returns the user assigned action for when this button is pressed. 175 This function returns the user assigned action for when this button is pressed.
172 If no action is assigned, factoryPresetAction() is returned. 176 If no action is assigned, factoryPresetAction() is returned.
173 */ 177 */
174OQCopMessage ODeviceButton::pressedAction() const 178OQCopMessage ODeviceButton::pressedAction() const
175{ 179{
176 if (m_PressedAction.channel().isEmpty()) 180 if (m_PressedAction.channel().isEmpty())
177 return factoryPresetPressedAction(); 181 return factoryPresetPressedAction();
178 return m_PressedAction; 182 return m_PressedAction;
179} 183}
180 184
181/*! 185/*!
182 This function returns the factory preset (default) action for when this button 186 This function returns the factory preset (default) action for when this button
183 is pressed and held. The return value is a legal QCop message. 187 is pressed and held. The return value is a legal QCop message.
184 */ 188 */
185OQCopMessage ODeviceButton::factoryPresetHeldAction() const 189OQCopMessage ODeviceButton::factoryPresetHeldAction() const
186{ 190{
187 return m_FactoryPresetHeldAction; 191 return m_FactoryPresetHeldAction;
188} 192}
189 193
190/*! 194/*!
191 This function returns the user assigned action for when this button is pressed 195 This function returns the user assigned action for when this button is pressed
192 and held. If no action is assigned, factoryPresetAction() is returned. 196 and held. If no action is assigned, factoryPresetAction() is returned.
193 */ 197 */
194OQCopMessage ODeviceButton::heldAction() const 198OQCopMessage ODeviceButton::heldAction() const
195{ 199{
196 if (m_HeldAction.channel().isEmpty()) 200 if (m_HeldAction.channel().isEmpty())
197 return factoryPresetHeldAction(); 201 return factoryPresetHeldAction();
198 return m_HeldAction; 202 return m_HeldAction;
199} 203}
200 204
201void ODeviceButton::setKeycode(ushort keycode) 205void ODeviceButton::setKeycode(ushort keycode)
202{ 206{
203 m_Keycode = keycode; 207 m_Keycode = keycode;
204} 208}
205 209
206void ODeviceButton::setUserText(const QString& text) 210void ODeviceButton::setUserText(const QString& text)
207{ 211{
208 m_UserText = text; 212 m_UserText = text;
209} 213}
210 214
211void ODeviceButton::setPixmap(const QPixmap& picture) 215void ODeviceButton::setPixmap(const QPixmap& picture)
212{ 216{
213 m_Pixmap = picture; 217 m_Pixmap = picture;
214} 218}
215 219
216void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) 220void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action)
217{ 221{
218 m_FactoryPresetPressedAction = action; 222 m_FactoryPresetPressedAction = action;
219} 223}
220 224
221 225
222void ODeviceButton::setPressedAction(const OQCopMessage& action) 226void ODeviceButton::setPressedAction(const OQCopMessage& action)
223{ 227{
224 m_PressedAction = action; 228 m_PressedAction = action;
225} 229}
226 230
227void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) 231void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action)
228{ 232{
229 m_FactoryPresetHeldAction = action; 233 m_FactoryPresetHeldAction = action;
230} 234}
231 235
232void ODeviceButton::setHeldAction(const OQCopMessage& action) 236void ODeviceButton::setHeldAction(const OQCopMessage& action)
233{ 237{
234 m_HeldAction = action; 238 m_HeldAction = action;
235} 239}
diff --git a/libopie/odevicebutton.h b/libopie/odevicebutton.h
index fcc2af1..1621526 100644
--- a/libopie/odevicebutton.h
+++ b/libopie/odevicebutton.h
@@ -1,105 +1,107 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef DEVICE_BUTTON_H 20#ifndef DEVICE_BUTTON_H
21#define DEVICE_BUTTON_H 21#define DEVICE_BUTTON_H
22 22
23#include <qpixmap.h> 23#include <qpixmap.h>
24#include <qstring.h> 24#include <qstring.h>
25 25
26class OQCopMessageData; 26class OQCopMessageData;
27 27
28namespace Opie 28namespace Opie
29{ 29{
30 30
31class OQCopMessage { 31class OQCopMessage {
32public: 32public:
33 OQCopMessage ( ); 33 OQCopMessage ( );
34 OQCopMessage ( const OQCopMessage &copy ); 34 OQCopMessage ( const OQCopMessage &copy );
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
49private: 51private:
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
69class ODeviceButton 71class ODeviceButton
70{ 72{
71public: 73public:
72 ODeviceButton(); 74 ODeviceButton();
73 virtual ~ODeviceButton(); 75 virtual ~ODeviceButton();
74 76
75 ushort keycode ( ) const; 77 ushort keycode ( ) const;
76 QString userText ( ) const; 78 QString userText ( ) const;
77 QPixmap pixmap ( ) const; 79 QPixmap pixmap ( ) const;
78 OQCopMessage factoryPresetPressedAction ( ) const; 80 OQCopMessage factoryPresetPressedAction ( ) const;
79 OQCopMessage pressedAction ( ) const; 81 OQCopMessage pressedAction ( ) const;
80 OQCopMessage factoryPresetHeldAction ( ) const; 82 OQCopMessage factoryPresetHeldAction ( ) const;
81 OQCopMessage heldAction ( ) const; 83 OQCopMessage heldAction ( ) const;
82 84
83 void setKeycode ( ushort keycode ); 85 void setKeycode ( ushort keycode );
84 void setUserText ( const QString& text ); 86 void setUserText ( const QString& text );
85 void setPixmap ( const QPixmap& picture ); 87 void setPixmap ( const QPixmap& picture );
86 void setFactoryPresetPressedAction ( const OQCopMessage& qcopMessage ); 88 void setFactoryPresetPressedAction ( const OQCopMessage& qcopMessage );
87 void setPressedAction ( const OQCopMessage& qcopMessage ); 89 void setPressedAction ( const OQCopMessage& qcopMessage );
88 void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage ); 90 void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage );
89 void setHeldAction ( const OQCopMessage& qcopMessage ); 91 void setHeldAction ( const OQCopMessage& qcopMessage );
90 92
91private: 93private:
92 ushort m_Keycode; 94 ushort m_Keycode;
93 QString m_UserText; 95 QString m_UserText;
94 QPixmap m_Pixmap; 96 QPixmap m_Pixmap;
95 OQCopMessage m_FactoryPresetPressedAction; 97 OQCopMessage m_FactoryPresetPressedAction;
96 OQCopMessage m_PressedAction; 98 OQCopMessage m_PressedAction;
97 OQCopMessage m_FactoryPresetHeldAction; 99 OQCopMessage m_FactoryPresetHeldAction;
98 OQCopMessage m_HeldAction; 100 OQCopMessage m_HeldAction;
99 class Private; 101 class Private;
100 Private *d; 102 Private *d;
101}; 103};
102 104
103} 105}
104 106
105#endif 107#endif