author | schurig <schurig> | 2003-06-17 06:34:27 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-17 06:34:27 (UTC) |
commit | 350e9cf9f8607202d78cba4400aec90ad075a763 (patch) (unidiff) | |
tree | 69fa6761dda8893c9c801f5408bff837e3f54c7d | |
parent | 9d006f21949fc9a25e323e2fd20fab0bfb249b49 (diff) | |
download | opie-350e9cf9f8607202d78cba4400aec90ad075a763.zip opie-350e9cf9f8607202d78cba4400aec90ad075a763.tar.gz opie-350e9cf9f8607202d78cba4400aec90ad075a763.tar.bz2 |
added helpful comment on usage of virtualHook
-rw-r--r-- | libopie/odevice.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libopie/odevice.h b/libopie/odevice.h index a232d69..650a2da 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -90,161 +90,167 @@ enum OVendor { | |||
90 | enum OSystem { | 90 | enum OSystem { |
91 | System_Unknown, | 91 | System_Unknown, |
92 | 92 | ||
93 | System_Familiar, | 93 | System_Familiar, |
94 | System_Zaurus, | 94 | System_Zaurus, |
95 | System_OpenZaurus | 95 | System_OpenZaurus |
96 | }; | 96 | }; |
97 | 97 | ||
98 | enum OLedState { | 98 | enum OLedState { |
99 | Led_Off, | 99 | Led_Off, |
100 | Led_On, | 100 | Led_On, |
101 | Led_BlinkSlow, | 101 | Led_BlinkSlow, |
102 | Led_BlinkFast | 102 | Led_BlinkFast |
103 | }; | 103 | }; |
104 | 104 | ||
105 | enum OLed { | 105 | enum OLed { |
106 | Led_Mail, | 106 | Led_Mail, |
107 | Led_Power, | 107 | Led_Power, |
108 | Led_BlueTooth | 108 | Led_BlueTooth |
109 | }; | 109 | }; |
110 | 110 | ||
111 | enum OHardKey { | 111 | enum OHardKey { |
112 | HardKey_Datebook = Qt::Key_F9, | 112 | HardKey_Datebook = Qt::Key_F9, |
113 | HardKey_Contacts = Qt::Key_F10, | 113 | HardKey_Contacts = Qt::Key_F10, |
114 | HardKey_Menu = Qt::Key_F11, | 114 | HardKey_Menu = Qt::Key_F11, |
115 | HardKey_Home = Qt::Key_F12, | 115 | HardKey_Home = Qt::Key_F12, |
116 | HardKey_Mail = Qt::Key_F13, | 116 | HardKey_Mail = Qt::Key_F13, |
117 | HardKey_Record = Qt::Key_F24, | 117 | HardKey_Record = Qt::Key_F24, |
118 | HardKey_Suspend = Qt::Key_F34, | 118 | HardKey_Suspend = Qt::Key_F34, |
119 | HardKey_Backlight = Qt::Key_F35, | 119 | HardKey_Backlight = Qt::Key_F35, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | enum ODirection { | 122 | enum ODirection { |
123 | CW = 0, | 123 | CW = 0, |
124 | CCW = 1, | 124 | CCW = 1, |
125 | Flip = 2, | 125 | Flip = 2, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * A singleton which gives informations about device specefic option | 129 | * A singleton which gives informations about device specefic option |
130 | * like the Hardware used, LEDs, the Base Distribution and | 130 | * like the Hardware used, LEDs, the Base Distribution and |
131 | * hardware key mappings. | 131 | * hardware key mappings. |
132 | * | 132 | * |
133 | * @short A small class for device specefic options | 133 | * @short A small class for device specefic options |
134 | * @see QObject | 134 | * @see QObject |
135 | * @author Robert Griebl | 135 | * @author Robert Griebl |
136 | * @version 1.0 | 136 | * @version 1.0 |
137 | */ | 137 | */ |
138 | class ODevice : public QObject { | 138 | class ODevice : public QObject { |
139 | Q_OBJECT | 139 | Q_OBJECT |
140 | 140 | ||
141 | private: | 141 | private: |
142 | /* disable copy */ | 142 | /* disable copy */ |
143 | ODevice ( const ODevice & ); | 143 | ODevice ( const ODevice & ); |
144 | 144 | ||
145 | protected: | 145 | protected: |
146 | ODevice ( ); | 146 | ODevice ( ); |
147 | virtual void init ( ); | 147 | virtual void init ( ); |
148 | virtual void initButtons ( ); | 148 | virtual void initButtons ( ); |
149 | 149 | ||
150 | ODeviceData *d; | 150 | ODeviceData *d; |
151 | 151 | ||
152 | public: | 152 | public: |
153 | // sandman do we want to allow destructions? -zecke? | 153 | // sandman do we want to allow destructions? -zecke? |
154 | virtual ~ODevice ( ); | 154 | virtual ~ODevice ( ); |
155 | 155 | ||
156 | static ODevice *inst ( ); | 156 | static ODevice *inst ( ); |
157 | 157 | ||
158 | // information | 158 | // information |
159 | 159 | ||
160 | QString modelString ( ) const; | 160 | QString modelString ( ) const; |
161 | OModel model ( ) const; | 161 | OModel model ( ) const; |
162 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | 162 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } |
163 | 163 | ||
164 | QString vendorString ( ) const; | 164 | QString vendorString ( ) const; |
165 | OVendor vendor ( ) const; | 165 | OVendor vendor ( ) const; |
166 | 166 | ||
167 | QString systemString ( ) const; | 167 | QString systemString ( ) const; |
168 | OSystem system ( ) const; | 168 | OSystem system ( ) const; |
169 | 169 | ||
170 | QString systemVersionString ( ) const; | 170 | QString systemVersionString ( ) const; |
171 | 171 | ||
172 | Transformation rotation ( ) const; | 172 | Transformation rotation ( ) const; |
173 | ODirection direction ( ) const; | 173 | ODirection direction ( ) const; |
174 | 174 | ||
175 | // system | 175 | // system |
176 | 176 | ||
177 | virtual bool setSoftSuspend ( bool on ); | 177 | virtual bool setSoftSuspend ( bool on ); |
178 | virtual bool suspend ( ); | 178 | virtual bool suspend ( ); |
179 | 179 | ||
180 | virtual bool setDisplayStatus ( bool on ); | 180 | virtual bool setDisplayStatus ( bool on ); |
181 | virtual bool setDisplayBrightness ( int brightness ); | 181 | virtual bool setDisplayBrightness ( int brightness ); |
182 | virtual int displayBrightnessResolution ( ) const; | 182 | virtual int displayBrightnessResolution ( ) const; |
183 | virtual bool setDisplayContrast ( int contrast ); | 183 | virtual bool setDisplayContrast ( int contrast ); |
184 | virtual int displayContrastResolution ( ) const; | 184 | virtual int displayContrastResolution ( ) const; |
185 | 185 | ||
186 | // don't add new virtual methods, use this: | ||
187 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | ||
188 | // and in your subclass do do overwrite | ||
189 | //protected virtual int virtual_hook(int, void *) | ||
190 | // which is defined below | ||
191 | |||
186 | // input / output | 192 | // input / output |
187 | //FIXME playAlarmSound and al might be better -zecke | 193 | //FIXME playAlarmSound and al might be better -zecke |
188 | virtual void alarmSound ( ); | 194 | virtual void alarmSound ( ); |
189 | virtual void keySound ( ); | 195 | virtual void keySound ( ); |
190 | virtual void touchSound ( ); | 196 | virtual void touchSound ( ); |
191 | 197 | ||
192 | virtual QValueList <OLed> ledList ( ) const; | 198 | virtual QValueList <OLed> ledList ( ) const; |
193 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 199 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
194 | virtual OLedState ledState ( OLed led ) const; | 200 | virtual OLedState ledState ( OLed led ) const; |
195 | virtual bool setLedState ( OLed led, OLedState st ); | 201 | virtual bool setLedState ( OLed led, OLedState st ); |
196 | 202 | ||
197 | virtual bool hasLightSensor ( ) const; | 203 | virtual bool hasLightSensor ( ) const; |
198 | virtual int readLightSensor ( ); | 204 | virtual int readLightSensor ( ); |
199 | virtual int lightSensorResolution ( ) const; | 205 | virtual int lightSensorResolution ( ) const; |
200 | 206 | ||
201 | const QStrList &allowedCpuFrequencies() const; | 207 | const QStrList &allowedCpuFrequencies() const; |
202 | bool setCurrentCpuFrequency(uint index); | 208 | bool setCurrentCpuFrequency(uint index); |
203 | 209 | ||
204 | /** | 210 | /** |
205 | * Returns the available buttons on this device. The number and location | 211 | * Returns the available buttons on this device. The number and location |
206 | * of buttons will vary depending on the device. Button numbers will be assigned | 212 | * of buttons will vary depending on the device. Button numbers will be assigned |
207 | * by the device manufacturer and will be from most preferred button to least preffered | 213 | * by the device manufacturer and will be from most preferred button to least preffered |
208 | * button. Note that this list only contains "user mappable" buttons. | 214 | * button. Note that this list only contains "user mappable" buttons. |
209 | */ | 215 | */ |
210 | const QValueList<ODeviceButton> &buttons ( ); | 216 | const QValueList<ODeviceButton> &buttons ( ); |
211 | 217 | ||
212 | /** | 218 | /** |
213 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 219 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
214 | * returns 0L | 220 | * returns 0L |
215 | */ | 221 | */ |
216 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 222 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
217 | 223 | ||
218 | /** | 224 | /** |
219 | * Reassigns the pressed action for \a button. To return to the factory | 225 | * Reassigns the pressed action for \a button. To return to the factory |
220 | * default pass an empty string as \a qcopMessage. | 226 | * default pass an empty string as \a qcopMessage. |
221 | */ | 227 | */ |
222 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 228 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
223 | 229 | ||
224 | /** | 230 | /** |
225 | * Reassigns the held action for \a button. To return to the factory | 231 | * Reassigns the held action for \a button. To return to the factory |
226 | * default pass an empty string as \a qcopMessage. | 232 | * default pass an empty string as \a qcopMessage. |
227 | */ | 233 | */ |
228 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 234 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
229 | 235 | ||
230 | /** | 236 | /** |
231 | * How long (in ms) you have to press a button for a "hold" action | 237 | * How long (in ms) you have to press a button for a "hold" action |
232 | */ | 238 | */ |
233 | uint buttonHoldTime ( ) const; | 239 | uint buttonHoldTime ( ) const; |
234 | 240 | ||
235 | signals: | 241 | signals: |
236 | void buttonMappingChanged ( ); | 242 | void buttonMappingChanged ( ); |
237 | 243 | ||
238 | private slots: | 244 | private slots: |
239 | void systemMessage ( const QCString &, const QByteArray & ); | 245 | void systemMessage ( const QCString &, const QByteArray & ); |
240 | 246 | ||
241 | protected: | 247 | protected: |
242 | void reloadButtonMapping ( ); | 248 | void reloadButtonMapping ( ); |
243 | /* ugly virtual hook */ | 249 | /* ugly virtual hook */ |
244 | virtual void virtual_hook( int id, void* data ); | 250 | virtual void virtual_hook( int id, void* data ); |
245 | }; | 251 | }; |
246 | 252 | ||
247 | } | 253 | } |
248 | 254 | ||
249 | #endif | 255 | #endif |
250 | 256 | ||