author | zecke <zecke> | 2004-08-20 21:59:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-20 21:59:48 (UTC) |
commit | e67b6a8748af0856d77eeb46048d36e58314793e (patch) (unidiff) | |
tree | 284808173f9574c3c466eb8c65865bd7aed6de2d | |
parent | da08f45abfb5e74c390d12736d3db9e8050068a2 (diff) | |
download | opie-e67b6a8748af0856d77eeb46048d36e58314793e.zip opie-e67b6a8748af0856d77eeb46048d36e58314793e.tar.gz opie-e67b6a8748af0856d77eeb46048d36e58314793e.tar.bz2 |
back out unintentional change. Use an unknown ODevice instead
of Internal::Zaurus
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 835586e..b58f9eb 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -54,193 +54,193 @@ | |||
54 | #include <signal.h> | 54 | #include <signal.h> |
55 | #include <sys/ioctl.h> | 55 | #include <sys/ioctl.h> |
56 | #include <sys/time.h> | 56 | #include <sys/time.h> |
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | #ifndef QT_NO_SOUND | 58 | #ifndef QT_NO_SOUND |
59 | #include <linux/soundcard.h> | 59 | #include <linux/soundcard.h> |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | namespace Opie { | 62 | namespace Opie { |
63 | namespace Core { | 63 | namespace Core { |
64 | 64 | ||
65 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 65 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
66 | 66 | ||
67 | 67 | ||
68 | /* STATIC and common implementation */ | 68 | /* STATIC and common implementation */ |
69 | /* EXPORT */ ODistribution distributions[] = { | 69 | /* EXPORT */ ODistribution distributions[] = { |
70 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 70 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
71 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | 71 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, |
72 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 72 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
73 | { System_Unknown, "Linux", "/etc/issue" }, | 73 | { System_Unknown, "Linux", "/etc/issue" }, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | /* EXPORT */ bool isQWS(){ | 77 | /* EXPORT */ bool isQWS(){ |
78 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 78 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 81 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
82 | if ( str && !::strchr ( str, '/' )) | 82 | if ( str && !::strchr ( str, '/' )) |
83 | return QCString ( "QPE/Application/" ) + str; | 83 | return QCString ( "QPE/Application/" ) + str; |
84 | else | 84 | else |
85 | return str; | 85 | return str; |
86 | } | 86 | } |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | /* Now the default implementation of ODevice */ | 90 | /* Now the default implementation of ODevice */ |
91 | 91 | ||
92 | struct default_button default_buttons [] = { | 92 | struct default_button default_buttons [] = { |
93 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 93 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
94 | "devicebuttons/z_calendar", | 94 | "devicebuttons/z_calendar", |
95 | "datebook", "nextView()", | 95 | "datebook", "nextView()", |
96 | "today", "raise()" }, | 96 | "today", "raise()" }, |
97 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 97 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
98 | "devicebuttons/z_contact", | 98 | "devicebuttons/z_contact", |
99 | "addressbook", "raise()", | 99 | "addressbook", "raise()", |
100 | "addressbook", "beamBusinessCard()" }, | 100 | "addressbook", "beamBusinessCard()" }, |
101 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 101 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
102 | "devicebuttons/z_home", | 102 | "devicebuttons/z_home", |
103 | "QPE/Launcher", "home()", | 103 | "QPE/Launcher", "home()", |
104 | "buttonsettings", "raise()" }, | 104 | "buttonsettings", "raise()" }, |
105 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 105 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
106 | "devicebuttons/z_menu", | 106 | "devicebuttons/z_menu", |
107 | "QPE/TaskBar", "toggleMenu()", | 107 | "QPE/TaskBar", "toggleMenu()", |
108 | "QPE/TaskBar", "toggleStartMenu()" }, | 108 | "QPE/TaskBar", "toggleStartMenu()" }, |
109 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 109 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
110 | "devicebuttons/z_mail", | 110 | "devicebuttons/z_mail", |
111 | "opiemail", "raise()", | 111 | "opiemail", "raise()", |
112 | "opiemail", "newMail()" }, | 112 | "opiemail", "newMail()" }, |
113 | }; | 113 | }; |
114 | 114 | ||
115 | ODevice *ODevice::inst() | 115 | ODevice *ODevice::inst() |
116 | { | 116 | { |
117 | static ODevice *dev = 0; | 117 | static ODevice *dev = 0; |
118 | 118 | ||
119 | // rewrite this to only use /proc/cpuinfo or so | 119 | // rewrite this to only use /proc/cpuinfo or so |
120 | QString cpu_info; | 120 | QString cpu_info; |
121 | 121 | ||
122 | if ( !dev ) | 122 | if ( !dev ) |
123 | { | 123 | { |
124 | QFile f( PATH_PROC_CPUINFO ); | 124 | QFile f( PATH_PROC_CPUINFO ); |
125 | if ( f.open( IO_ReadOnly ) ) | 125 | if ( f.open( IO_ReadOnly ) ) |
126 | { | 126 | { |
127 | QTextStream s( &f ); | 127 | QTextStream s( &f ); |
128 | while ( !s.atEnd() ) | 128 | while ( !s.atEnd() ) |
129 | { | 129 | { |
130 | QString line; | 130 | QString line; |
131 | line = s.readLine(); | 131 | line = s.readLine(); |
132 | if ( line.startsWith( "Hardware" ) ) | 132 | if ( line.startsWith( "Hardware" ) ) |
133 | { | 133 | { |
134 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 134 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
135 | cpu_info = line; | 135 | cpu_info = line; |
136 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 136 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
137 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 137 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
138 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 138 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
139 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 139 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
140 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 140 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
141 | else qWarning( "ODevice() - unknown hardware - using default." ); | 141 | else qWarning( "ODevice() - unknown hardware - using default." ); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } | 145 | } |
146 | else | 146 | else |
147 | { | 147 | { |
148 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 148 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
149 | } | 149 | } |
150 | if ( !dev ) dev = new Internal::Zaurus(); | 150 | if ( !dev ) dev = new ODevice(); |
151 | dev->init(cpu_info); | 151 | dev->init(cpu_info); |
152 | } | 152 | } |
153 | return dev; | 153 | return dev; |
154 | } | 154 | } |
155 | 155 | ||
156 | ODevice::ODevice() | 156 | ODevice::ODevice() |
157 | { | 157 | { |
158 | d = new ODeviceData; | 158 | d = new ODeviceData; |
159 | 159 | ||
160 | d->m_modelstr = "Unknown"; | 160 | d->m_modelstr = "Unknown"; |
161 | d->m_model = Model_Unknown; | 161 | d->m_model = Model_Unknown; |
162 | d->m_vendorstr = "Unknown"; | 162 | d->m_vendorstr = "Unknown"; |
163 | d->m_vendor = Vendor_Unknown; | 163 | d->m_vendor = Vendor_Unknown; |
164 | d->m_systemstr = "Unknown"; | 164 | d->m_systemstr = "Unknown"; |
165 | d->m_system = System_Unknown; | 165 | d->m_system = System_Unknown; |
166 | d->m_sysverstr = "0.0"; | 166 | d->m_sysverstr = "0.0"; |
167 | d->m_rotation = Rot0; | 167 | d->m_rotation = Rot0; |
168 | d->m_direction = CW; | 168 | d->m_direction = CW; |
169 | 169 | ||
170 | d->m_holdtime = 1000; // 1000ms | 170 | d->m_holdtime = 1000; // 1000ms |
171 | d->m_buttons = 0; | 171 | d->m_buttons = 0; |
172 | d->m_cpu_frequencies = new QStrList; | 172 | d->m_cpu_frequencies = new QStrList; |
173 | 173 | ||
174 | // New distribution detection code first checks for legacy distributions, | 174 | // New distribution detection code first checks for legacy distributions, |
175 | // identified by /etc/familiar-version or /etc/oz_version. | 175 | // identified by /etc/familiar-version or /etc/oz_version. |
176 | // Then check for OpenEmbedded and lastly, read /etc/issue | 176 | // Then check for OpenEmbedded and lastly, read /etc/issue |
177 | 177 | ||
178 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | 178 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) |
179 | { | 179 | { |
180 | if ( QFile::exists( distributions[i].sysvfile ) ) | 180 | if ( QFile::exists( distributions[i].sysvfile ) ) |
181 | { | 181 | { |
182 | d->m_systemstr = distributions[i].sysstr; | 182 | d->m_systemstr = distributions[i].sysstr; |
183 | d->m_system = distributions[i].system; | 183 | d->m_system = distributions[i].system; |
184 | d->m_sysverstr = "<Unknown>"; | 184 | d->m_sysverstr = "<Unknown>"; |
185 | QFile f( distributions[i].sysvfile ); | 185 | QFile f( distributions[i].sysvfile ); |
186 | if ( f.open( IO_ReadOnly ) ) | 186 | if ( f.open( IO_ReadOnly ) ) |
187 | { | 187 | { |
188 | QTextStream ts( &f ); | 188 | QTextStream ts( &f ); |
189 | d->m_sysverstr = ts.readLine(); | 189 | d->m_sysverstr = ts.readLine(); |
190 | } | 190 | } |
191 | break; | 191 | break; |
192 | } | 192 | } |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 196 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
197 | { | 197 | { |
198 | if ( msg == "deviceButtonMappingChanged()" ) { | 198 | if ( msg == "deviceButtonMappingChanged()" ) { |
199 | reloadButtonMapping(); | 199 | reloadButtonMapping(); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | void ODevice::init(const QString&) | 203 | void ODevice::init(const QString&) |
204 | { | 204 | { |
205 | } | 205 | } |
206 | 206 | ||
207 | /** | 207 | /** |
208 | * This method initialises the button mapping | 208 | * This method initialises the button mapping |
209 | */ | 209 | */ |
210 | void ODevice::initButtons() | 210 | void ODevice::initButtons() |
211 | { | 211 | { |
212 | if ( d->m_buttons ) | 212 | if ( d->m_buttons ) |
213 | return; | 213 | return; |
214 | 214 | ||
215 | qDebug ( "init Buttons" ); | 215 | qDebug ( "init Buttons" ); |
216 | d->m_buttons = new QValueList <ODeviceButton>; | 216 | d->m_buttons = new QValueList <ODeviceButton>; |
217 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 217 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
218 | default_button *db = default_buttons + i; | 218 | default_button *db = default_buttons + i; |
219 | ODeviceButton b; | 219 | ODeviceButton b; |
220 | b. setKeycode ( db->code ); | 220 | b. setKeycode ( db->code ); |
221 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 221 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
222 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 222 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
223 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 223 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
224 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 224 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
225 | d->m_buttons->append ( b ); | 225 | d->m_buttons->append ( b ); |
226 | } | 226 | } |
227 | 227 | ||
228 | reloadButtonMapping(); | 228 | reloadButtonMapping(); |
229 | 229 | ||
230 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 230 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
231 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 231 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
232 | } | 232 | } |
233 | 233 | ||
234 | ODevice::~ODevice() | 234 | ODevice::~ODevice() |
235 | { | 235 | { |
236 | // we leak m_devicebuttons and m_cpu_frequency | 236 | // we leak m_devicebuttons and m_cpu_frequency |
237 | // but it's a singleton and it is not so importantant | 237 | // but it's a singleton and it is not so importantant |
238 | // -zecke | 238 | // -zecke |
239 | delete d; | 239 | delete d; |
240 | } | 240 | } |
241 | 241 | ||
242 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 242 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
243 | { | 243 | { |
244 | return false; | 244 | return false; |
245 | } | 245 | } |
246 | 246 | ||