Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index c6e031f..8f5be8b 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,532 +1,534 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | 3 | =. (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | 30 | ||
31 | #include "odevice_beagle.h" | 31 | #include "odevice_beagle.h" |
32 | #include "odevice_ipaq.h" | 32 | #include "odevice_ipaq.h" |
33 | #include "odevice_mypal.h" | 33 | #include "odevice_mypal.h" |
34 | #include "odevice_jornada.h" | 34 | #include "odevice_jornada.h" |
35 | #include "odevice_ramses.h" | 35 | #include "odevice_ramses.h" |
36 | #include "odevice_simpad.h" | 36 | #include "odevice_simpad.h" |
37 | #include "odevice_yopy.h" | 37 | #include "odevice_yopy.h" |
38 | #include "odevice_zaurus.h" | 38 | #include "odevice_zaurus.h" |
39 | #include "odevice_genuineintel.h" | 39 | #include "odevice_genuineintel.h" |
40 | #include "odevice_htc.h" | 40 | #include "odevice_htc.h" |
41 | #include "odevice_motorola_ezx.h" | ||
41 | 42 | ||
42 | /* QT */ | 43 | /* QT */ |
43 | #include <qapplication.h> | 44 | #include <qapplication.h> |
44 | #include <qfile.h> | 45 | #include <qfile.h> |
45 | #include <qtextstream.h> | 46 | #include <qtextstream.h> |
46 | #include <qwindowsystem_qws.h> | 47 | #include <qwindowsystem_qws.h> |
47 | 48 | ||
48 | /* OPIE */ | 49 | /* OPIE */ |
49 | #include <qpe/config.h> | 50 | #include <qpe/config.h> |
50 | #include <qpe/sound.h> | 51 | #include <qpe/sound.h> |
51 | #include <qpe/qcopenvelope_qws.h> | 52 | #include <qpe/qcopenvelope_qws.h> |
52 | #include <qpe/sound.h> | 53 | #include <qpe/sound.h> |
53 | 54 | ||
54 | #include <opie2/okeyfilter.h> | 55 | #include <opie2/okeyfilter.h> |
55 | #include <opie2/oresource.h> | 56 | #include <opie2/oresource.h> |
56 | 57 | ||
57 | /* STD */ | 58 | /* STD */ |
58 | #include <fcntl.h> | 59 | #include <fcntl.h> |
59 | #include <math.h> | 60 | #include <math.h> |
60 | #include <stdlib.h> | 61 | #include <stdlib.h> |
61 | #include <signal.h> | 62 | #include <signal.h> |
62 | #include <sys/ioctl.h> | 63 | #include <sys/ioctl.h> |
63 | #include <sys/time.h> | 64 | #include <sys/time.h> |
64 | #include <unistd.h> | 65 | #include <unistd.h> |
65 | #ifndef QT_NO_SOUND | 66 | #ifndef QT_NO_SOUND |
66 | #include <linux/soundcard.h> | 67 | #include <linux/soundcard.h> |
67 | #endif | 68 | #endif |
68 | 69 | ||
69 | namespace Opie { | 70 | namespace Opie { |
70 | namespace Core { | 71 | namespace Core { |
71 | 72 | ||
72 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 73 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
73 | 74 | ||
74 | 75 | ||
75 | /* STATIC and common implementation */ | 76 | /* STATIC and common implementation */ |
76 | /* EXPORT */ ODistribution distributions[] = { | 77 | /* EXPORT */ ODistribution distributions[] = { |
77 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 78 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
78 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, | 79 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, |
79 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 80 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
80 | { System_Unknown, "Linux", "/etc/issue" }, | 81 | { System_Unknown, "Linux", "/etc/issue" }, |
81 | }; | 82 | }; |
82 | 83 | ||
83 | 84 | ||
84 | /* EXPORT */ bool isQWS(){ | 85 | /* EXPORT */ bool isQWS(){ |
85 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 86 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
86 | } | 87 | } |
87 | 88 | ||
88 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 89 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
89 | if ( str && !::strchr ( str, '/' )) | 90 | if ( str && !::strchr ( str, '/' )) |
90 | return QCString ( "QPE/Application/" ) + str; | 91 | return QCString ( "QPE/Application/" ) + str; |
91 | else | 92 | else |
92 | return str; | 93 | return str; |
93 | } | 94 | } |
94 | 95 | ||
95 | 96 | ||
96 | 97 | ||
97 | /* Now the default implementation of ODevice */ | 98 | /* Now the default implementation of ODevice */ |
98 | 99 | ||
99 | struct default_button default_buttons [] = { | 100 | struct default_button default_buttons [] = { |
100 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 101 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
101 | "devicebuttons/z_calendar", | 102 | "devicebuttons/z_calendar", |
102 | "datebook", "nextView()", | 103 | "datebook", "nextView()", |
103 | "today", "raise()" }, | 104 | "today", "raise()" }, |
104 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 105 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
105 | "devicebuttons/z_contact", | 106 | "devicebuttons/z_contact", |
106 | "addressbook", "raise()", | 107 | "addressbook", "raise()", |
107 | "addressbook", "beamBusinessCard()" }, | 108 | "addressbook", "beamBusinessCard()" }, |
108 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 109 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
109 | "devicebuttons/z_home", | 110 | "devicebuttons/z_home", |
110 | "QPE/Launcher", "home()", | 111 | "QPE/Launcher", "home()", |
111 | "buttonsettings", "raise()" }, | 112 | "buttonsettings", "raise()" }, |
112 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 113 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
113 | "devicebuttons/z_menu", | 114 | "devicebuttons/z_menu", |
114 | "QPE/TaskBar", "toggleMenu()", | 115 | "QPE/TaskBar", "toggleMenu()", |
115 | "QPE/TaskBar", "toggleStartMenu()" }, | 116 | "QPE/TaskBar", "toggleStartMenu()" }, |
116 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 117 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
117 | "devicebuttons/z_mail", | 118 | "devicebuttons/z_mail", |
118 | "opiemail", "raise()", | 119 | "opiemail", "raise()", |
119 | "opiemail", "newMail()" }, | 120 | "opiemail", "newMail()" }, |
120 | }; | 121 | }; |
121 | 122 | ||
122 | ODevice *ODevice::inst() | 123 | ODevice *ODevice::inst() |
123 | { | 124 | { |
124 | static ODevice *dev = 0; | 125 | static ODevice *dev = 0; |
125 | QString cpu_info; | 126 | QString cpu_info; |
126 | 127 | ||
127 | if ( !dev ) | 128 | if ( !dev ) |
128 | { | 129 | { |
129 | QFile f( PATH_PROC_CPUINFO ); | 130 | QFile f( PATH_PROC_CPUINFO ); |
130 | if ( f.open( IO_ReadOnly ) ) | 131 | if ( f.open( IO_ReadOnly ) ) |
131 | { | 132 | { |
132 | QTextStream s( &f ); | 133 | QTextStream s( &f ); |
133 | while ( !s.atEnd() ) | 134 | while ( !s.atEnd() ) |
134 | { | 135 | { |
135 | QString line; | 136 | QString line; |
136 | line = s.readLine(); | 137 | line = s.readLine(); |
137 | if ( line.startsWith( "Hardware" ) ) | 138 | if ( line.startsWith( "Hardware" ) ) |
138 | { | 139 | { |
139 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 140 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
140 | cpu_info = line; | 141 | cpu_info = line; |
141 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 142 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
142 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 143 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
143 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); | 144 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); |
144 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 145 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
145 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 146 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
146 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 147 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
147 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 148 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
148 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); | 149 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); |
150 | else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); | ||
149 | 151 | ||
150 | else qWarning( "ODevice() - unknown hardware - using default." ); | 152 | else qWarning( "ODevice() - unknown hardware - using default." ); |
151 | break; | 153 | break; |
152 | } else if ( line.startsWith( "vendor_id" ) ) { | 154 | } else if ( line.startsWith( "vendor_id" ) ) { |
153 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 155 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
154 | cpu_info = line; | 156 | cpu_info = line; |
155 | if( line.contains( "genuineintel", false ) ) { | 157 | if( line.contains( "genuineintel", false ) ) { |
156 | dev = new Internal::GenuineIntel(); | 158 | dev = new Internal::GenuineIntel(); |
157 | break; | 159 | break; |
158 | } | 160 | } |
159 | } | 161 | } |
160 | } | 162 | } |
161 | } | 163 | } |
162 | else | 164 | else |
163 | { | 165 | { |
164 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 166 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
165 | } | 167 | } |
166 | if ( !dev ) dev = new ODevice(); | 168 | if ( !dev ) dev = new ODevice(); |
167 | dev->init(cpu_info); | 169 | dev->init(cpu_info); |
168 | } | 170 | } |
169 | return dev; | 171 | return dev; |
170 | } | 172 | } |
171 | 173 | ||
172 | ODevice::ODevice() | 174 | ODevice::ODevice() |
173 | { | 175 | { |
174 | d = new ODeviceData; | 176 | d = new ODeviceData; |
175 | 177 | ||
176 | d->m_modelstr = "Unknown"; | 178 | d->m_modelstr = "Unknown"; |
177 | d->m_model = Model_Unknown; | 179 | d->m_model = Model_Unknown; |
178 | d->m_vendorstr = "Unknown"; | 180 | d->m_vendorstr = "Unknown"; |
179 | d->m_vendor = Vendor_Unknown; | 181 | d->m_vendor = Vendor_Unknown; |
180 | d->m_systemstr = "Unknown"; | 182 | d->m_systemstr = "Unknown"; |
181 | d->m_system = System_Unknown; | 183 | d->m_system = System_Unknown; |
182 | d->m_sysverstr = "0.0"; | 184 | d->m_sysverstr = "0.0"; |
183 | d->m_rotation = Rot0; | 185 | d->m_rotation = Rot0; |
184 | d->m_direction = CW; | 186 | d->m_direction = CW; |
185 | d->m_qteDriver = "Transformed"; | 187 | d->m_qteDriver = "Transformed"; |
186 | 188 | ||
187 | d->m_holdtime = 1000; // 1000ms | 189 | d->m_holdtime = 1000; // 1000ms |
188 | d->m_buttons = 0; | 190 | d->m_buttons = 0; |
189 | d->m_cpu_frequencies = new QStrList; | 191 | d->m_cpu_frequencies = new QStrList; |
190 | 192 | ||
191 | 193 | ||
192 | /* mixer */ | 194 | /* mixer */ |
193 | d->m_sound = d->m_vol = d->m_mixer = -1; | 195 | d->m_sound = d->m_vol = d->m_mixer = -1; |
194 | 196 | ||
195 | /* System QCopChannel created */ | 197 | /* System QCopChannel created */ |
196 | d->m_initializedButtonQcop = false; | 198 | d->m_initializedButtonQcop = false; |
197 | 199 | ||
198 | // New distribution detection code first checks for legacy distributions, | 200 | // New distribution detection code first checks for legacy distributions, |
199 | // identified by /etc/familiar-version or /etc/oz_version. | 201 | // identified by /etc/familiar-version or /etc/oz_version. |
200 | // Then check for OpenEmbedded and lastly, read /etc/issue | 202 | // Then check for OpenEmbedded and lastly, read /etc/issue |
201 | 203 | ||
202 | for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i ) | 204 | for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i ) |
203 | { | 205 | { |
204 | if ( QFile::exists( distributions[i].sysvfile ) ) | 206 | if ( QFile::exists( distributions[i].sysvfile ) ) |
205 | { | 207 | { |
206 | d->m_systemstr = distributions[i].sysstr; | 208 | d->m_systemstr = distributions[i].sysstr; |
207 | d->m_system = distributions[i].system; | 209 | d->m_system = distributions[i].system; |
208 | d->m_sysverstr = "<Unknown>"; | 210 | d->m_sysverstr = "<Unknown>"; |
209 | QFile f( distributions[i].sysvfile ); | 211 | QFile f( distributions[i].sysvfile ); |
210 | if ( f.open( IO_ReadOnly ) ) | 212 | if ( f.open( IO_ReadOnly ) ) |
211 | { | 213 | { |
212 | QTextStream ts( &f ); | 214 | QTextStream ts( &f ); |
213 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); | 215 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); |
214 | } | 216 | } |
215 | break; | 217 | break; |
216 | } | 218 | } |
217 | } | 219 | } |
218 | } | 220 | } |
219 | 221 | ||
220 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 222 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
221 | { | 223 | { |
222 | if ( msg == "deviceButtonMappingChanged()" ) { | 224 | if ( msg == "deviceButtonMappingChanged()" ) { |
223 | reloadButtonMapping(); | 225 | reloadButtonMapping(); |
224 | } | 226 | } |
225 | } | 227 | } |
226 | 228 | ||
227 | void ODevice::init(const QString&) | 229 | void ODevice::init(const QString&) |
228 | { | 230 | { |
229 | } | 231 | } |
230 | 232 | ||
231 | /** | 233 | /** |
232 | * This method initialises the button mapping | 234 | * This method initialises the button mapping |
233 | */ | 235 | */ |
234 | void ODevice::initButtons() | 236 | void ODevice::initButtons() |
235 | { | 237 | { |
236 | if ( d->m_buttons ) | 238 | if ( d->m_buttons ) |
237 | return; | 239 | return; |
238 | 240 | ||
239 | qDebug ( "init Buttons" ); | 241 | qDebug ( "init Buttons" ); |
240 | d->m_buttons = new QValueList <ODeviceButton>; | 242 | d->m_buttons = new QValueList <ODeviceButton>; |
241 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 243 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
242 | default_button *db = default_buttons + i; | 244 | default_button *db = default_buttons + i; |
243 | ODeviceButton b; | 245 | ODeviceButton b; |
244 | b. setKeycode ( db->code ); | 246 | b. setKeycode ( db->code ); |
245 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 247 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
246 | b. setPixmap ( OResource::loadPixmap ( db->pix )); | 248 | b. setPixmap ( OResource::loadPixmap ( db->pix )); |
247 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 249 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
248 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 250 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
249 | d->m_buttons->append ( b ); | 251 | d->m_buttons->append ( b ); |
250 | } | 252 | } |
251 | 253 | ||
252 | reloadButtonMapping(); | 254 | reloadButtonMapping(); |
253 | } | 255 | } |
254 | 256 | ||
255 | ODevice::~ODevice() | 257 | ODevice::~ODevice() |
256 | { | 258 | { |
257 | // we leak m_devicebuttons and m_cpu_frequency | 259 | // we leak m_devicebuttons and m_cpu_frequency |
258 | // but it's a singleton and it is not so importantant | 260 | // but it's a singleton and it is not so importantant |
259 | // -zecke | 261 | // -zecke |
260 | delete d; | 262 | delete d; |
261 | } | 263 | } |
262 | 264 | ||
263 | /** | 265 | /** |
264 | * This method will try to suspend the device | 266 | * This method will try to suspend the device |
265 | * It only works if the user is the QWS Server and the apm application | 267 | * It only works if the user is the QWS Server and the apm application |
266 | * is installed. | 268 | * is installed. |
267 | * It tries to suspend and then waits some time cause some distributions | 269 | * It tries to suspend and then waits some time cause some distributions |
268 | * do have asynchronus apm implementations. | 270 | * do have asynchronus apm implementations. |
269 | * This method will either fail and return false or it'll suspend the | 271 | * This method will either fail and return false or it'll suspend the |
270 | * device and return once the device got woken up | 272 | * device and return once the device got woken up |
271 | * | 273 | * |
272 | * @return if the device got suspended | 274 | * @return if the device got suspended |
273 | */ | 275 | */ |
274 | bool ODevice::suspend() | 276 | bool ODevice::suspend() |
275 | { | 277 | { |
276 | return false; // default implementation == unknown device or qvfb | 278 | return false; // default implementation == unknown device or qvfb |
277 | } | 279 | } |
278 | 280 | ||
279 | /** | 281 | /** |
280 | * This sets the display on or off | 282 | * This sets the display on or off |
281 | */ | 283 | */ |
282 | bool ODevice::setDisplayStatus( bool on ) | 284 | bool ODevice::setDisplayStatus( bool on ) |
283 | { | 285 | { |
284 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); | 286 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); |
285 | return false; // don't do anything for unknown models | 287 | return false; // don't do anything for unknown models |
286 | } | 288 | } |
287 | 289 | ||
288 | /** | 290 | /** |
289 | * This sets the display brightness | 291 | * This sets the display brightness |
290 | * | 292 | * |
291 | * @param b The brightness to be set on a scale from 0 to 255 | 293 | * @param b The brightness to be set on a scale from 0 to 255 |
292 | * @return success or failure | 294 | * @return success or failure |
293 | */ | 295 | */ |
294 | bool ODevice::setDisplayBrightness( int b ) | 296 | bool ODevice::setDisplayBrightness( int b ) |
295 | { | 297 | { |
296 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); | 298 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); |
297 | return false; | 299 | return false; |
298 | } | 300 | } |
299 | 301 | ||
300 | /** | 302 | /** |
301 | * | 303 | * |
302 | * @returns the number of steppings on the brightness slider | 304 | * @returns the number of steppings on the brightness slider |
303 | * in the Light-'n-Power settings. Values smaller than zero and bigger | 305 | * in the Light-'n-Power settings. Values smaller than zero and bigger |
304 | * than 255 do not make sense. | 306 | * than 255 do not make sense. |
305 | * | 307 | * |
306 | * \sa QSlider::setLineStep | 308 | * \sa QSlider::setLineStep |
307 | * \sa QSlider::setPageStep | 309 | * \sa QSlider::setPageStep |
308 | */ | 310 | */ |
309 | int ODevice::displayBrightnessResolution() const | 311 | int ODevice::displayBrightnessResolution() const |
310 | { | 312 | { |
311 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 313 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
312 | return 16; | 314 | return 16; |
313 | } | 315 | } |
314 | 316 | ||
315 | /** | 317 | /** |
316 | * This sets the display contrast | 318 | * This sets the display contrast |
317 | * @param p The contrast to be set on a scale from 0 to 255 | 319 | * @param p The contrast to be set on a scale from 0 to 255 |
318 | * @returns success or failure | 320 | * @returns success or failure |
319 | */ | 321 | */ |
320 | bool ODevice::setDisplayContrast( int p ) | 322 | bool ODevice::setDisplayContrast( int p ) |
321 | { | 323 | { |
322 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); | 324 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); |
323 | return false; | 325 | return false; |
324 | } | 326 | } |
325 | 327 | ||
326 | /** | 328 | /** |
327 | * @returns the maximum value for the contrast settings slider | 329 | * @returns the maximum value for the contrast settings slider |
328 | * or 0 if the device doesn't support setting of a contrast | 330 | * or 0 if the device doesn't support setting of a contrast |
329 | */ | 331 | */ |
330 | int ODevice::displayContrastResolution() const | 332 | int ODevice::displayContrastResolution() const |
331 | { | 333 | { |
332 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 334 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
333 | return 0; | 335 | return 0; |
334 | } | 336 | } |
335 | 337 | ||
336 | /** | 338 | /** |
337 | * This returns the vendor as string | 339 | * This returns the vendor as string |
338 | * @return Vendor as QString | 340 | * @return Vendor as QString |
339 | */ | 341 | */ |
340 | QString ODevice::vendorString() const | 342 | QString ODevice::vendorString() const |
341 | { | 343 | { |
342 | return d->m_vendorstr; | 344 | return d->m_vendorstr; |
343 | } | 345 | } |
344 | 346 | ||
345 | /** | 347 | /** |
346 | * This returns the vendor as one of the values of OVendor | 348 | * This returns the vendor as one of the values of OVendor |
347 | * @return OVendor | 349 | * @return OVendor |
348 | */ | 350 | */ |
349 | OVendor ODevice::vendor() const | 351 | OVendor ODevice::vendor() const |
350 | { | 352 | { |
351 | return d->m_vendor; | 353 | return d->m_vendor; |
352 | } | 354 | } |
353 | 355 | ||
354 | /** | 356 | /** |
355 | * This returns the model as a string | 357 | * This returns the model as a string |
356 | * @return A string representing the model | 358 | * @return A string representing the model |
357 | */ | 359 | */ |
358 | QString ODevice::modelString() const | 360 | QString ODevice::modelString() const |
359 | { | 361 | { |
360 | return d->m_modelstr; | 362 | return d->m_modelstr; |
361 | } | 363 | } |
362 | 364 | ||
363 | /** | 365 | /** |
364 | * This does return the OModel used | 366 | * This does return the OModel used |
365 | */ | 367 | */ |
366 | OModel ODevice::model() const | 368 | OModel ODevice::model() const |
367 | { | 369 | { |
368 | return d->m_model; | 370 | return d->m_model; |
369 | } | 371 | } |
370 | 372 | ||
371 | /** | 373 | /** |
372 | * This does return the systen name | 374 | * This does return the systen name |
373 | */ | 375 | */ |
374 | QString ODevice::systemString() const | 376 | QString ODevice::systemString() const |
375 | { | 377 | { |
376 | return d->m_systemstr; | 378 | return d->m_systemstr; |
377 | } | 379 | } |
378 | 380 | ||
379 | /** | 381 | /** |
380 | * Return System as OSystem value | 382 | * Return System as OSystem value |
381 | */ | 383 | */ |
382 | OSystem ODevice::system() const | 384 | OSystem ODevice::system() const |
383 | { | 385 | { |
384 | return d->m_system; | 386 | return d->m_system; |
385 | } | 387 | } |
386 | 388 | ||
387 | /** | 389 | /** |
388 | * @return the version string of the base system | 390 | * @return the version string of the base system |
389 | */ | 391 | */ |
390 | QString ODevice::systemVersionString() const | 392 | QString ODevice::systemVersionString() const |
391 | { | 393 | { |
392 | return d->m_sysverstr; | 394 | return d->m_sysverstr; |
393 | } | 395 | } |
394 | 396 | ||
395 | /** | 397 | /** |
396 | * @return the current Transformation | 398 | * @return the current Transformation |
397 | */ | 399 | */ |
398 | Transformation ODevice::rotation() const | 400 | Transformation ODevice::rotation() const |
399 | { | 401 | { |
400 | return d->m_rotation; | 402 | return d->m_rotation; |
401 | } | 403 | } |
402 | 404 | ||
403 | /** | 405 | /** |
404 | * @return the current rotation direction | 406 | * @return the current rotation direction |
405 | */ | 407 | */ |
406 | ODirection ODevice::direction() const | 408 | ODirection ODevice::direction() const |
407 | { | 409 | { |
408 | return d->m_direction; | 410 | return d->m_direction; |
409 | } | 411 | } |
410 | 412 | ||
411 | QString ODevice::qteDriver() const | 413 | QString ODevice::qteDriver() const |
412 | { | 414 | { |
413 | return d->m_qteDriver; | 415 | return d->m_qteDriver; |
414 | } | 416 | } |
415 | 417 | ||
416 | /** | 418 | /** |
417 | * This plays an alarm sound | 419 | * This plays an alarm sound |
418 | */ | 420 | */ |
419 | void ODevice::playAlarmSound() | 421 | void ODevice::playAlarmSound() |
420 | { | 422 | { |
421 | #ifndef QT_NO_SOUND | 423 | #ifndef QT_NO_SOUND |
422 | static Sound snd ( "alarm" ); | 424 | static Sound snd ( "alarm" ); |
423 | 425 | ||
424 | if ( snd. isFinished()) | 426 | if ( snd. isFinished()) |
425 | snd. play(); | 427 | snd. play(); |
426 | #endif | 428 | #endif |
427 | } | 429 | } |
428 | 430 | ||
429 | /** | 431 | /** |
430 | * This plays a key sound | 432 | * This plays a key sound |
431 | */ | 433 | */ |
432 | void ODevice::playKeySound() | 434 | void ODevice::playKeySound() |
433 | { | 435 | { |
434 | #ifndef QT_NO_SOUND | 436 | #ifndef QT_NO_SOUND |
435 | static Sound snd ( "keysound" ); | 437 | static Sound snd ( "keysound" ); |
436 | 438 | ||
437 | if ( snd. isFinished()) | 439 | if ( snd. isFinished()) |
438 | snd. play(); | 440 | snd. play(); |
439 | #endif | 441 | #endif |
440 | } | 442 | } |
441 | 443 | ||
442 | /** | 444 | /** |
443 | * This plays a touch sound | 445 | * This plays a touch sound |
444 | */ | 446 | */ |
445 | void ODevice::playTouchSound() | 447 | void ODevice::playTouchSound() |
446 | { | 448 | { |
447 | #ifndef QT_NO_SOUND | 449 | #ifndef QT_NO_SOUND |
448 | static Sound snd ( "touchsound" ); | 450 | static Sound snd ( "touchsound" ); |
449 | 451 | ||
450 | if ( snd. isFinished()) | 452 | if ( snd. isFinished()) |
451 | snd. play(); | 453 | snd. play(); |
452 | #endif | 454 | #endif |
453 | } | 455 | } |
454 | 456 | ||
455 | /** | 457 | /** |
456 | * This method will return a list of leds | 458 | * This method will return a list of leds |
457 | * available on this device | 459 | * available on this device |
458 | * @return a list of LEDs. | 460 | * @return a list of LEDs. |
459 | */ | 461 | */ |
460 | QValueList <OLed> ODevice::ledList() const | 462 | QValueList <OLed> ODevice::ledList() const |
461 | { | 463 | { |
462 | return QValueList <OLed>(); | 464 | return QValueList <OLed>(); |
463 | } | 465 | } |
464 | 466 | ||
465 | /** | 467 | /** |
466 | * This does return the state of the LEDs | 468 | * This does return the state of the LEDs |
467 | */ | 469 | */ |
468 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 470 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
469 | { | 471 | { |
470 | return QValueList <OLedState>(); | 472 | return QValueList <OLedState>(); |
471 | } | 473 | } |
472 | 474 | ||
473 | /** | 475 | /** |
474 | * @return the state for a given OLed | 476 | * @return the state for a given OLed |
475 | */ | 477 | */ |
476 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 478 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
477 | { | 479 | { |
478 | return Led_Off; | 480 | return Led_Off; |
479 | } | 481 | } |
480 | 482 | ||
481 | /** | 483 | /** |
482 | * Set the state for a LED | 484 | * Set the state for a LED |
483 | * @param which Which OLed to use | 485 | * @param which Which OLed to use |
484 | * @param st The state to set | 486 | * @param st The state to set |
485 | * @return success or failure | 487 | * @return success or failure |
486 | */ | 488 | */ |
487 | bool ODevice::setLedState ( OLed which, OLedState st ) | 489 | bool ODevice::setLedState ( OLed which, OLedState st ) |
488 | { | 490 | { |
489 | Q_UNUSED( which ) | 491 | Q_UNUSED( which ) |
490 | Q_UNUSED( st ) | 492 | Q_UNUSED( st ) |
491 | return false; | 493 | return false; |
492 | } | 494 | } |
493 | 495 | ||
494 | /** | 496 | /** |
495 | * @return if the device has a light sensor | 497 | * @return if the device has a light sensor |
496 | */ | 498 | */ |
497 | bool ODevice::hasLightSensor() const | 499 | bool ODevice::hasLightSensor() const |
498 | { | 500 | { |
499 | return false; | 501 | return false; |
500 | } | 502 | } |
501 | 503 | ||
502 | /** | 504 | /** |
503 | * @return a value from the light sensor | 505 | * @return a value from the light sensor |
504 | */ | 506 | */ |
505 | int ODevice::readLightSensor() | 507 | int ODevice::readLightSensor() |
506 | { | 508 | { |
507 | return -1; | 509 | return -1; |
508 | } | 510 | } |
509 | 511 | ||
510 | /** | 512 | /** |
511 | * @return the light sensor resolution | 513 | * @return the light sensor resolution |
512 | */ | 514 | */ |
513 | int ODevice::lightSensorResolution() const | 515 | int ODevice::lightSensorResolution() const |
514 | { | 516 | { |
515 | return 0; | 517 | return 0; |
516 | } | 518 | } |
517 | 519 | ||
518 | /** | 520 | /** |
519 | * @return if the device has a hinge sensor | 521 | * @return if the device has a hinge sensor |
520 | */ | 522 | */ |
521 | bool ODevice::hasHingeSensor() const | 523 | bool ODevice::hasHingeSensor() const |
522 | { | 524 | { |
523 | return false; | 525 | return false; |
524 | } | 526 | } |
525 | 527 | ||
526 | /** | 528 | /** |
527 | * @return a value from the hinge sensor | 529 | * @return a value from the hinge sensor |
528 | */ | 530 | */ |
529 | OHingeStatus ODevice::readHingeSensor()const | 531 | OHingeStatus ODevice::readHingeSensor()const |
530 | { | 532 | { |
531 | return CASE_UNKNOWN; | 533 | return CASE_UNKNOWN; |
532 | } | 534 | } |