Diffstat (limited to 'libopie2/opiecore/device/odevice_genuineintel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.cpp | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice_genuineintel.cpp b/libopie2/opiecore/device/odevice_genuineintel.cpp new file mode 100644 index 0000000..61ba052 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_genuineintel.cpp | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org> | ||
4 | =. | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | |||
30 | #include "odevice_genuineintel.h" | ||
31 | |||
32 | /* QT */ | ||
33 | #include <qapplication.h> | ||
34 | #include <qfile.h> | ||
35 | #include <qtextstream.h> | ||
36 | #include <qwindowsystem_qws.h> | ||
37 | |||
38 | /* OPIE */ | ||
39 | #include <qpe/config.h> | ||
40 | #include <qpe/resource.h> | ||
41 | #include <qpe/sound.h> | ||
42 | #include <qpe/qcopenvelope_qws.h> | ||
43 | #include <opie2/okeyfilter.h> | ||
44 | |||
45 | #ifndef QT_NO_SOUND | ||
46 | #include <linux/soundcard.h> | ||
47 | #endif | ||
48 | |||
49 | using namespace Opie::Core; | ||
50 | using namespace Opie::Core::Internal; | ||
51 | |||
52 | struct gi_button genuineintel_buttons [] = { | ||
53 | { | ||
54 | Qt::Key_F1, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | ||
55 | "devicebuttons/ipaq_calendar", | ||
56 | "datebook", "nextView()", | ||
57 | "today", "raise()" }, | ||
58 | { | ||
59 | Qt::Key_F2, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | ||
60 | "devicebuttons/ipaq_contact", | ||
61 | "addressbook", "raise()", | ||
62 | "addressbook", "beamBusinessCard()" }, | ||
63 | { | ||
64 | Qt::Key_F3, QT_TRANSLATE_NOOP("Button", "Menu Button"), | ||
65 | "devicebuttons/ipaq_menu", | ||
66 | "QPE/TaskBar", "toggleMenu()", | ||
67 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
68 | { | ||
69 | Qt::Key_F4, QT_TRANSLATE_NOOP("Button", "Mail Button"), | ||
70 | "devicebuttons/ipaq_mail", | ||
71 | "opiemail", "raise()", | ||
72 | "opiemail", "newMail()" }, | ||
73 | { | ||
74 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Home Button"), | ||
75 | "devicebuttons/ipaq_home", | ||
76 | "QPE/Launcher", "home()", | ||
77 | "buttonsettings", "raise()" }, | ||
78 | { | ||
79 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Record Button"), | ||
80 | "devicebuttons/ipaq_record", | ||
81 | "QPE/VMemo", "toggleRecord()", | ||
82 | "sound", "raise()" }, | ||
83 | }; | ||
84 | |||
85 | void GenuineIntel::init(const QString& model) | ||
86 | { | ||
87 | d->m_vendorstr = "Intel"; | ||
88 | d->m_vendor = Vendor_GenuineIntel; | ||
89 | |||
90 | QStringList SL = QStringList::split( " ", model ); | ||
91 | |||
92 | d->m_model = Model_GenuineIntel; | ||
93 | d->m_rotation = Rot0; | ||
94 | } | ||
95 | |||
96 | void GenuineIntel::initButtons() | ||
97 | { | ||
98 | if ( d->m_buttons ) | ||
99 | return; | ||
100 | |||
101 | if ( isQWS( ) ) { | ||
102 | addPreHandler(this); | ||
103 | } | ||
104 | |||
105 | d->m_buttons = new QValueList <ODeviceButton>; | ||
106 | |||
107 | for ( uint i = 0; i < ( sizeof( genuineintel_buttons ) / sizeof( gi_button )); i++ ) { | ||
108 | gi_button *ib = genuineintel_buttons + i; | ||
109 | ODeviceButton b; | ||
110 | |||
111 | b. setKeycode ( ib->code ); | ||
112 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | ||
113 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | ||
114 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | ||
115 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | ||
116 | |||
117 | d->m_buttons->append ( b ); | ||
118 | } | ||
119 | reloadButtonMapping(); | ||
120 | } | ||
121 | |||
122 | QValueList <OLed> GenuineIntel::ledList() const | ||
123 | { | ||
124 | QValueList <OLed> vl; | ||
125 | return vl; //none | ||
126 | } | ||
127 | |||
128 | QValueList <OLedState> GenuineIntel::ledStateList ( OLed ) const | ||
129 | { | ||
130 | QValueList <OLedState> vl; | ||
131 | return vl; // none | ||
132 | } | ||
133 | |||
134 | OLedState GenuineIntel::ledState ( OLed ) const | ||
135 | { | ||
136 | return Led_Off; | ||
137 | } | ||
138 | |||
139 | bool GenuineIntel::setLedState ( OLed , OLedState ) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | |||
144 | |||
145 | bool GenuineIntel::filter ( int /*unicode*/, int , int , bool , bool ) | ||
146 | { | ||
147 | return false; | ||
148 | } | ||
149 | |||
150 | void GenuineIntel::playAlarmSound() | ||
151 | { | ||
152 | #ifndef QT_NO_SOUND | ||
153 | static Sound snd ( "alarm" ); | ||
154 | if(!snd.isFinished()) | ||
155 | return; | ||
156 | |||
157 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | ||
158 | snd. play(); | ||
159 | #endif | ||
160 | } | ||
161 | |||
162 | |||
163 | bool GenuineIntel::setSoftSuspend ( bool ) | ||
164 | { | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | |||
169 | bool GenuineIntel::setDisplayBrightness ( int ) | ||
170 | { | ||
171 | return false; | ||
172 | } | ||
173 | |||
174 | int GenuineIntel::displayBrightnessResolution() const | ||
175 | { | ||
176 | return 1; // perhaps to avoid division by zero | ||
177 | } | ||
178 | |||
179 | |||
180 | bool GenuineIntel::hasLightSensor() const | ||
181 | { | ||
182 | return false; | ||
183 | } | ||
184 | |||
185 | int GenuineIntel::readLightSensor() | ||
186 | { | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | int GenuineIntel::lightSensorResolution() const | ||
191 | { | ||
192 | return 1; // see above | ||
193 | } | ||