Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index cef7f63..5b73e59 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,48 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_ipaq.h" | 30 | #include "odevice_ipaq.h" |
31 | #include "odevice_jornada.h" | 31 | #include "odevice_jornada.h" |
32 | #include "odevice_ramses.h" | 32 | #include "odevice_ramses.h" |
33 | #include "odevice_simpad.h" | 33 | #include "odevice_simpad.h" |
34 | #include "odevice_yopy.h" | 34 | #include "odevice_yopy.h" |
35 | #include "odevice_zaurus.h" | 35 | #include "odevice_zaurus.h" |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qwindowsystem_qws.h> | 41 | #include <qwindowsystem_qws.h> |
42 | 42 | ||
43 | /* OPIE */ | 43 | /* OPIE */ |
44 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
45 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
46 | #include <qpe/sound.h> | 46 | #include <qpe/sound.h> |
47 | #include <qpe/qcopenvelope_qws.h> | 47 | #include <qpe/qcopenvelope_qws.h> |
48 | 48 | ||
@@ -122,48 +122,69 @@ ODevice *ODevice::inst() | |||
122 | } | 122 | } |
123 | if ( !dev ) dev = new ODevice(); | 123 | if ( !dev ) dev = new ODevice(); |
124 | dev->init(cpu_info); | 124 | dev->init(cpu_info); |
125 | } | 125 | } |
126 | return dev; | 126 | return dev; |
127 | } | 127 | } |
128 | 128 | ||
129 | ODevice::ODevice() | 129 | ODevice::ODevice() |
130 | { | 130 | { |
131 | d = new ODeviceData; | 131 | d = new ODeviceData; |
132 | 132 | ||
133 | d->m_modelstr = "Unknown"; | 133 | d->m_modelstr = "Unknown"; |
134 | d->m_model = Model_Unknown; | 134 | d->m_model = Model_Unknown; |
135 | d->m_vendorstr = "Unknown"; | 135 | d->m_vendorstr = "Unknown"; |
136 | d->m_vendor = Vendor_Unknown; | 136 | d->m_vendor = Vendor_Unknown; |
137 | d->m_systemstr = "Unknown"; | 137 | d->m_systemstr = "Unknown"; |
138 | d->m_system = System_Unknown; | 138 | d->m_system = System_Unknown; |
139 | d->m_sysverstr = "0.0"; | 139 | d->m_sysverstr = "0.0"; |
140 | d->m_rotation = Rot0; | 140 | d->m_rotation = Rot0; |
141 | d->m_direction = CW; | 141 | d->m_direction = CW; |
142 | 142 | ||
143 | d->m_holdtime = 1000; // 1000ms | 143 | d->m_holdtime = 1000; // 1000ms |
144 | d->m_buttons = 0; | 144 | d->m_buttons = 0; |
145 | d->m_cpu_frequencies = new QStrList; | 145 | d->m_cpu_frequencies = new QStrList; |
146 | |||
147 | // New distribution detection code first checks for legacy distributions, | ||
148 | // identified by /etc/familiar-version or /etc/oz_version. | ||
149 | // Then check for OpenEmbedded and lastly, read /etc/issue | ||
150 | |||
151 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | ||
152 | { | ||
153 | if ( QFile::exists( distributions[i].sysvfile ) ) | ||
154 | { | ||
155 | d->m_systemstr = distributions[i].sysstr; | ||
156 | d->m_system = distributions[i].system; | ||
157 | d->m_sysverstr = "<Unknown>"; | ||
158 | QFile f( distributions[i].sysvfile ); | ||
159 | if ( f.open( IO_ReadOnly ) ) | ||
160 | { | ||
161 | QTextStream ts( &f ); | ||
162 | d->m_sysverstr = ts.readLine(); | ||
163 | } | ||
164 | break; | ||
165 | } | ||
166 | } | ||
146 | } | 167 | } |
147 | 168 | ||
148 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 169 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
149 | { | 170 | { |
150 | if ( msg == "deviceButtonMappingChanged()" ) { | 171 | if ( msg == "deviceButtonMappingChanged()" ) { |
151 | reloadButtonMapping(); | 172 | reloadButtonMapping(); |
152 | } | 173 | } |
153 | } | 174 | } |
154 | 175 | ||
155 | void ODevice::init(const QString&) | 176 | void ODevice::init(const QString&) |
156 | { | 177 | { |
157 | } | 178 | } |
158 | 179 | ||
159 | /** | 180 | /** |
160 | * This method initialises the button mapping | 181 | * This method initialises the button mapping |
161 | */ | 182 | */ |
162 | void ODevice::initButtons() | 183 | void ODevice::initButtons() |
163 | { | 184 | { |
164 | if ( d->m_buttons ) | 185 | if ( d->m_buttons ) |
165 | return; | 186 | return; |
166 | 187 | ||
167 | qDebug ( "init Buttons" ); | 188 | qDebug ( "init Buttons" ); |
168 | d->m_buttons = new QValueList <ODeviceButton>; | 189 | d->m_buttons = new QValueList <ODeviceButton>; |
169 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 190 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |