author | treke <treke> | 2003-12-08 06:52:35 (UTC) |
---|---|---|
committer | treke <treke> | 2003-12-08 06:52:35 (UTC) |
commit | 7b4e723545a645056156246d27b2c26c78d599f3 (patch) (unidiff) | |
tree | 8b349615fc1441a60bc418e10c53b1799db895e4 | |
parent | 3bbeef6702ef80b7506b5393cc51d1fd5b04559d (diff) | |
download | opie-7b4e723545a645056156246d27b2c26c78d599f3.zip opie-7b4e723545a645056156246d27b2c26c78d599f3.tar.gz opie-7b4e723545a645056156246d27b2c26c78d599f3.tar.bz2 |
Automatic rotation. This might break binary compatibility, so beware including
in BRANCH_1_0
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 43 | ||||
-rw-r--r-- | core/applets/rotateapplet/rotate.h | 1 | ||||
-rw-r--r-- | libopie/odevice.cpp | 124 | ||||
-rw-r--r-- | libopie/odevice.h | 4 | ||||
-rw-r--r-- | qt/qt-2.3.7.patch/qte237-all.patch | 11 |
5 files changed, 163 insertions, 20 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index ac6b259..0da2f0c 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp | |||
@@ -1,172 +1,213 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> | 3 | .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <, > . <= redistribute it and/or modify it under | 6 | .> <, > . <= redistribute it and/or modify it under |
7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%+i> _;_. | 11 | .%+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. . .: details. | 18 | ++= -. . .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-= this library; see the file COPYING.LIB. | 22 | -- :-= this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | 32 | ||
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qiconset.h> | 35 | #include <qiconset.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | 37 | ||
38 | #include <opie/odevice.h> | 38 | #include <opie/odevice.h> |
39 | 39 | ||
40 | #include "rotate.h" | 40 | #include "rotate.h" |
41 | 41 | ||
42 | using namespace Opie; | 42 | using namespace Opie; |
43 | 43 | ||
44 | 44 | ||
45 | RotateApplet::RotateApplet ( ) | 45 | RotateApplet::RotateApplet ( ) |
46 | : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) | 46 | : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) |
47 | { | 47 | { |
48 | 48 | ||
49 | #if !defined(QT_NO_COP) | 49 | #if !defined(QT_NO_COP) |
50 | QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); | 50 | QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); |
51 | connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 51 | connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
52 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 52 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | } | 55 | } |
56 | 56 | ||
57 | RotateApplet::~RotateApplet ( ) | 57 | RotateApplet::~RotateApplet ( ) |
58 | { | 58 | { |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Qcop receive method. | 63 | * Qcop receive method. |
64 | */ | 64 | */ |
65 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) { | 65 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) { |
66 | QDataStream stream( data, IO_ReadOnly ); | 66 | QDataStream stream( data, IO_ReadOnly ); |
67 | if ( msg == "flip()" ) { | 67 | if ( msg == "flip()" ) { |
68 | activated ( ); | 68 | activated ( ); |
69 | } | 69 | } else if ( msg == "rotateDefault()") { |
70 | rotateDefault(); | ||
71 | } | ||
70 | } | 72 | } |
71 | 73 | ||
72 | 74 | ||
73 | int RotateApplet::position ( ) const | 75 | int RotateApplet::position ( ) const |
74 | { | 76 | { |
75 | return 3; | 77 | return 3; |
76 | } | 78 | } |
77 | 79 | ||
78 | QString RotateApplet::name ( ) const | 80 | QString RotateApplet::name ( ) const |
79 | { | 81 | { |
80 | return tr( "Rotate shortcut" ); | 82 | return tr( "Rotate shortcut" ); |
81 | } | 83 | } |
82 | 84 | ||
83 | QString RotateApplet::text ( ) const | 85 | QString RotateApplet::text ( ) const |
84 | { | 86 | { |
85 | return tr( "Rotate" ); | 87 | return tr( "Rotate" ); |
86 | } | 88 | } |
87 | 89 | ||
88 | /*QString RotateApplet::tr( const char* s ) const | 90 | /*QString RotateApplet::tr( const char* s ) const |
89 | { | 91 | { |
90 | return qApp->translate( "RotateApplet", s, 0 ); | 92 | return qApp->translate( "RotateApplet", s, 0 ); |
91 | } | 93 | } |
92 | 94 | ||
93 | QString RotateApplet::tr( const char* s, const char* p ) const | 95 | QString RotateApplet::tr( const char* s, const char* p ) const |
94 | { | 96 | { |
95 | return qApp->translate( "RotateApplet", s, p ); | 97 | return qApp->translate( "RotateApplet", s, p ); |
96 | } | 98 | } |
97 | */ | 99 | */ |
98 | 100 | ||
99 | QIconSet RotateApplet::icon ( ) const | 101 | QIconSet RotateApplet::icon ( ) const |
100 | { | 102 | { |
101 | QPixmap pix; | 103 | QPixmap pix; |
102 | QImage img = Resource::loadImage ( "Rotation" ); | 104 | QImage img = Resource::loadImage ( "Rotation" ); |
103 | 105 | ||
104 | if ( !img. isNull ( )) | 106 | if ( !img. isNull ( )) |
105 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); | 107 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); |
106 | return pix; | 108 | return pix; |
107 | } | 109 | } |
108 | 110 | ||
109 | QPopupMenu *RotateApplet::popup ( QWidget * ) const | 111 | QPopupMenu *RotateApplet::popup ( QWidget * ) const |
110 | { | 112 | { |
111 | return 0; | 113 | return 0; |
112 | } | 114 | } |
113 | 115 | ||
116 | void RotateApplet::rotateDefault ( ) | ||
117 | { | ||
118 | |||
119 | int rot = ODevice::inst()->rotation(); | ||
120 | |||
121 | switch (rot) { | ||
122 | case Rot0: | ||
123 | rot=0; | ||
124 | break; | ||
125 | case Rot90: | ||
126 | rot=90; | ||
127 | break; | ||
128 | case Rot180: | ||
129 | rot=180; | ||
130 | break; | ||
131 | case Rot270: | ||
132 | rot=270; | ||
133 | break; | ||
134 | default: | ||
135 | rot=0; | ||
136 | break; | ||
137 | } | ||
138 | Config cfg( "qpe" ); | ||
139 | cfg.setGroup( "Appearance" ); | ||
140 | |||
141 | bool rotateDisabled = cfg.readBoolEntry( "rotateEnabled",false ); | ||
142 | |||
143 | if (rotateDisabled == true) | ||
144 | return; | ||
145 | |||
146 | // hide inputs methods before rotation | ||
147 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | ||
148 | |||
149 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); | ||
150 | env << rot; | ||
151 | |||
152 | m_flipped = false; | ||
153 | |||
154 | } | ||
114 | void RotateApplet::activated ( ) | 155 | void RotateApplet::activated ( ) |
115 | { | 156 | { |
116 | 157 | ||
117 | int defaultRotation = QPEApplication::defaultRotation(); | 158 | int defaultRotation = QPEApplication::defaultRotation(); |
118 | int newRotation = defaultRotation; | 159 | int newRotation = defaultRotation; |
119 | 160 | ||
120 | Config cfg( "qpe" ); | 161 | Config cfg( "qpe" ); |
121 | cfg.setGroup( "Appearance" ); | 162 | cfg.setGroup( "Appearance" ); |
122 | 163 | ||
123 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 164 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
124 | ODirection rot = CW; | 165 | ODirection rot = CW; |
125 | 166 | ||
126 | if (rotDirection == -1) { | 167 | if (rotDirection == -1) { |
127 | rot = ODevice::inst ( )-> direction ( ); | 168 | rot = ODevice::inst ( )-> direction ( ); |
128 | } else { | 169 | } else { |
129 | rot = (ODirection)rotDirection; | 170 | rot = (ODirection)rotDirection; |
130 | } | 171 | } |
131 | 172 | ||
132 | // hide inputs methods before rotation | 173 | // hide inputs methods before rotation |
133 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | 174 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); |
134 | 175 | ||
135 | if ( m_flipped ) { | 176 | if ( m_flipped ) { |
136 | // if flipped, flip back to the original state, | 177 | // if flipped, flip back to the original state, |
137 | // regardless of rotation direction | 178 | // regardless of rotation direction |
138 | newRotation = defaultRotation; | 179 | newRotation = defaultRotation; |
139 | } else { | 180 | } else { |
140 | if ( rot == CCW ) { | 181 | if ( rot == CCW ) { |
141 | newRotation = ( defaultRotation + 90 ) % 360; | 182 | newRotation = ( defaultRotation + 90 ) % 360; |
142 | } else if ( rot == CW ) { | 183 | } else if ( rot == CW ) { |
143 | newRotation = ( defaultRotation + 270 ) % 360; | 184 | newRotation = ( defaultRotation + 270 ) % 360; |
144 | } else if ( rot == Flip ) { | 185 | } else if ( rot == Flip ) { |
145 | newRotation = ( defaultRotation + 180 ) % 360; | 186 | newRotation = ( defaultRotation + 180 ) % 360; |
146 | } | 187 | } |
147 | } | 188 | } |
148 | 189 | ||
149 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); | 190 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); |
150 | env << newRotation; | 191 | env << newRotation; |
151 | 192 | ||
152 | m_flipped = !m_flipped; | 193 | m_flipped = !m_flipped; |
153 | } | 194 | } |
154 | 195 | ||
155 | 196 | ||
156 | QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 197 | QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
157 | { | 198 | { |
158 | *iface = 0; | 199 | *iface = 0; |
159 | if ( uuid == IID_QUnknown ) | 200 | if ( uuid == IID_QUnknown ) |
160 | *iface = this; | 201 | *iface = this; |
161 | else if ( uuid == IID_MenuApplet ) | 202 | else if ( uuid == IID_MenuApplet ) |
162 | *iface = this; | 203 | *iface = this; |
163 | 204 | ||
164 | if ( *iface ) | 205 | if ( *iface ) |
165 | (*iface)-> addRef ( ); | 206 | (*iface)-> addRef ( ); |
166 | return QS_OK; | 207 | return QS_OK; |
167 | } | 208 | } |
168 | 209 | ||
169 | Q_EXPORT_INTERFACE( ) | 210 | Q_EXPORT_INTERFACE( ) |
170 | { | 211 | { |
171 | Q_CREATE_INSTANCE( RotateApplet ) | 212 | Q_CREATE_INSTANCE( RotateApplet ) |
172 | } | 213 | } |
diff --git a/core/applets/rotateapplet/rotate.h b/core/applets/rotateapplet/rotate.h index de2a707..572b82a 100644 --- a/core/applets/rotateapplet/rotate.h +++ b/core/applets/rotateapplet/rotate.h | |||
@@ -1,71 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> | 3 | .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <_, > . <= redistribute it and/or modify it under | 6 | .> <_, > . <= redistribute it and/or modify it under |
7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%+i> _;_. | 11 | .%+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. . .: details. | 18 | ++= -. . .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-= this library; see the file COPYING.LIB. | 22 | -- :-= this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | #ifndef __OPIE_ROTATE_APPLET_H__ | 31 | #ifndef __OPIE_ROTATE_APPLET_H__ |
32 | #define __OPIE_ROTATE_APPLET_H__ | 32 | #define __OPIE_ROTATE_APPLET_H__ |
33 | 33 | ||
34 | #include <qpe/menuappletinterface.h> | 34 | #include <qpe/menuappletinterface.h> |
35 | #include <qobject.h> | 35 | #include <qobject.h> |
36 | 36 | ||
37 | #include <qobject.h> | 37 | #include <qobject.h> |
38 | 38 | ||
39 | class RotateApplet : public QObject, public MenuAppletInterface | 39 | class RotateApplet : public QObject, public MenuAppletInterface |
40 | { | 40 | { |
41 | 41 | ||
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | 43 | ||
44 | public: | 44 | public: |
45 | RotateApplet ( ); | 45 | RotateApplet ( ); |
46 | virtual ~RotateApplet ( ); | 46 | virtual ~RotateApplet ( ); |
47 | 47 | ||
48 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 48 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
49 | Q_REFCOUNT | 49 | Q_REFCOUNT |
50 | 50 | ||
51 | virtual int position() const; | 51 | virtual int position() const; |
52 | 52 | ||
53 | virtual QString name ( ) const; | 53 | virtual QString name ( ) const; |
54 | virtual QIconSet icon ( ) const; | 54 | virtual QIconSet icon ( ) const; |
55 | virtual QString text ( ) const; | 55 | virtual QString text ( ) const; |
56 | /* virtual QString tr( const char* ) const; | 56 | /* virtual QString tr( const char* ) const; |
57 | virtual QString tr( const char*, const char* ) const; | 57 | virtual QString tr( const char*, const char* ) const; |
58 | */ | 58 | */ |
59 | virtual QPopupMenu *popup ( QWidget *parent ) const; | 59 | virtual QPopupMenu *popup ( QWidget *parent ) const; |
60 | virtual void activated ( ); | 60 | virtual void activated ( ); |
61 | virtual void rotateDefault ( ); | ||
61 | 62 | ||
62 | private slots: | 63 | private slots: |
63 | void channelReceived( const QCString &msg, const QByteArray & data ); | 64 | void channelReceived( const QCString &msg, const QByteArray & data ); |
64 | 65 | ||
65 | private: | 66 | private: |
66 | ulong ref; | 67 | ulong ref; |
67 | bool m_flipped; | 68 | bool m_flipped; |
68 | 69 | ||
69 | }; | 70 | }; |
70 | 71 | ||
71 | #endif | 72 | #endif |
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9373ef9..5038cc9 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1,807 +1,812 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #ifndef QT_NO_SOUND | 26 | #ifndef QT_NO_SOUND |
27 | #include <linux/soundcard.h> | 27 | #include <linux/soundcard.h> |
28 | #endif | 28 | #endif |
29 | #include <math.h> | 29 | #include <math.h> |
30 | 30 | ||
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qpe/sound.h> | 35 | #include <qpe/sound.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | 39 | ||
40 | #include "odevice.h" | 40 | #include "odevice.h" |
41 | 41 | ||
42 | #include <qwindowsystem_qws.h> | 42 | #include <qwindowsystem_qws.h> |
43 | 43 | ||
44 | #ifndef ARRAY_SIZE | 44 | #ifndef ARRAY_SIZE |
45 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 45 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | // _IO and friends are only defined in kernel headers ... | 48 | // _IO and friends are only defined in kernel headers ... |
49 | 49 | ||
50 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 50 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
51 | 51 | ||
52 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 52 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
53 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 53 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
54 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 54 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
55 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 55 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
56 | 56 | ||
57 | using namespace Opie; | 57 | using namespace Opie; |
58 | 58 | ||
59 | class ODeviceData { | 59 | class ODeviceData { |
60 | public: | 60 | public: |
61 | QString m_vendorstr; | 61 | QString m_vendorstr; |
62 | OVendor m_vendor; | 62 | OVendor m_vendor; |
63 | 63 | ||
64 | QString m_modelstr; | 64 | QString m_modelstr; |
65 | OModel m_model; | 65 | OModel m_model; |
66 | 66 | ||
67 | QString m_systemstr; | 67 | QString m_systemstr; |
68 | OSystem m_system; | 68 | OSystem m_system; |
69 | 69 | ||
70 | QString m_sysverstr; | 70 | QString m_sysverstr; |
71 | 71 | ||
72 | Transformation m_rotation; | 72 | Transformation m_rotation; |
73 | ODirection m_direction; | 73 | ODirection m_direction; |
74 | 74 | ||
75 | QValueList <ODeviceButton> *m_buttons; | 75 | QValueList <ODeviceButton> *m_buttons; |
76 | uint m_holdtime; | 76 | uint m_holdtime; |
77 | QStrList *m_cpu_frequencies; | 77 | QStrList *m_cpu_frequencies; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { | 80 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { |
81 | protected: | 81 | protected: |
82 | virtual void init ( ); | 82 | virtual void init ( ); |
83 | virtual void initButtons ( ); | 83 | virtual void initButtons ( ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | virtual bool setSoftSuspend ( bool soft ); | 86 | virtual bool setSoftSuspend ( bool soft ); |
87 | 87 | ||
88 | virtual bool setDisplayBrightness ( int b ); | 88 | virtual bool setDisplayBrightness ( int b ); |
89 | virtual int displayBrightnessResolution ( ) const; | 89 | virtual int displayBrightnessResolution ( ) const; |
90 | 90 | ||
91 | virtual void alarmSound ( ); | 91 | virtual void alarmSound ( ); |
92 | 92 | ||
93 | virtual QValueList <OLed> ledList ( ) const; | 93 | virtual QValueList <OLed> ledList ( ) const; |
94 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 94 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
95 | virtual OLedState ledState ( OLed led ) const; | 95 | virtual OLedState ledState ( OLed led ) const; |
96 | virtual bool setLedState ( OLed led, OLedState st ); | 96 | virtual bool setLedState ( OLed led, OLedState st ); |
97 | 97 | ||
98 | virtual bool hasLightSensor ( ) const; | 98 | virtual bool hasLightSensor ( ) const; |
99 | virtual int readLightSensor ( ); | 99 | virtual int readLightSensor ( ); |
100 | virtual int lightSensorResolution ( ) const; | 100 | virtual int lightSensorResolution ( ) const; |
101 | 101 | ||
102 | protected: | 102 | protected: |
103 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 103 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
104 | virtual void timerEvent ( QTimerEvent *te ); | 104 | virtual void timerEvent ( QTimerEvent *te ); |
105 | 105 | ||
106 | int m_power_timer; | 106 | int m_power_timer; |
107 | 107 | ||
108 | OLedState m_leds [2]; | 108 | OLedState m_leds [2]; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | class Jornada : public ODevice { | 111 | class Jornada : public ODevice { |
112 | protected: | 112 | protected: |
113 | virtual void init ( ); | 113 | virtual void init ( ); |
114 | //virtual void initButtons ( ); | 114 | //virtual void initButtons ( ); |
115 | public: | 115 | public: |
116 | virtual bool setSoftSuspend ( bool soft ); | 116 | virtual bool setSoftSuspend ( bool soft ); |
117 | virtual bool setDisplayBrightness ( int b ); | 117 | virtual bool setDisplayBrightness ( int b ); |
118 | virtual int displayBrightnessResolution ( ) const; | 118 | virtual int displayBrightnessResolution ( ) const; |
119 | static bool isJornada(); | 119 | static bool isJornada(); |
120 | 120 | ||
121 | }; | 121 | }; |
122 | 122 | ||
123 | class Zaurus : public ODevice { | 123 | class Zaurus : public ODevice { |
124 | protected: | 124 | protected: |
125 | virtual void init ( ); | 125 | virtual void init ( ); |
126 | virtual void initButtons ( ); | 126 | virtual void initButtons ( ); |
127 | 127 | ||
128 | public: | 128 | public: |
129 | virtual bool setSoftSuspend ( bool soft ); | 129 | virtual bool setSoftSuspend ( bool soft ); |
130 | 130 | ||
131 | virtual bool setDisplayBrightness ( int b ); | 131 | virtual bool setDisplayBrightness ( int b ); |
132 | virtual int displayBrightnessResolution ( ) const; | 132 | virtual int displayBrightnessResolution ( ) const; |
133 | 133 | ||
134 | virtual void alarmSound ( ); | 134 | virtual void alarmSound ( ); |
135 | virtual void keySound ( ); | 135 | virtual void keySound ( ); |
136 | virtual void touchSound ( ); | 136 | virtual void touchSound ( ); |
137 | 137 | ||
138 | virtual QValueList <OLed> ledList ( ) const; | 138 | virtual QValueList <OLed> ledList ( ) const; |
139 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 139 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
140 | virtual OLedState ledState ( OLed led ) const; | 140 | virtual OLedState ledState ( OLed led ) const; |
141 | virtual bool setLedState ( OLed led, OLedState st ); | 141 | virtual bool setLedState ( OLed led, OLedState st ); |
142 | 142 | ||
143 | static bool isZaurus(); | 143 | static bool isZaurus(); |
144 | |||
145 | // Does this break BC? | ||
146 | virtual bool suspend ( ); | ||
147 | virtual Transformation rotation ( ) const; | ||
148 | virtual ODirection direction ( ) const; | ||
144 | 149 | ||
145 | protected: | 150 | protected: |
146 | virtual void buzzer ( int snd ); | 151 | virtual void buzzer ( int snd ); |
147 | 152 | ||
148 | OLedState m_leds [1]; | 153 | OLedState m_leds [1]; |
149 | bool m_embedix; | 154 | bool m_embedix; |
150 | }; | 155 | }; |
151 | 156 | ||
152 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { | 157 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { |
153 | protected: | 158 | protected: |
154 | virtual void init ( ); | 159 | virtual void init ( ); |
155 | virtual void initButtons ( ); | 160 | virtual void initButtons ( ); |
156 | 161 | ||
157 | public: | 162 | public: |
158 | virtual bool setSoftSuspend ( bool soft ); | 163 | virtual bool setSoftSuspend ( bool soft ); |
159 | virtual bool suspend(); | 164 | virtual bool suspend(); |
160 | 165 | ||
161 | virtual bool setDisplayStatus( bool on ); | 166 | virtual bool setDisplayStatus( bool on ); |
162 | virtual bool setDisplayBrightness ( int b ); | 167 | virtual bool setDisplayBrightness ( int b ); |
163 | virtual int displayBrightnessResolution ( ) const; | 168 | virtual int displayBrightnessResolution ( ) const; |
164 | 169 | ||
165 | virtual void alarmSound ( ); | 170 | virtual void alarmSound ( ); |
166 | 171 | ||
167 | virtual QValueList <OLed> ledList ( ) const; | 172 | virtual QValueList <OLed> ledList ( ) const; |
168 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 173 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
169 | virtual OLedState ledState ( OLed led ) const; | 174 | virtual OLedState ledState ( OLed led ) const; |
170 | virtual bool setLedState ( OLed led, OLedState st ); | 175 | virtual bool setLedState ( OLed led, OLedState st ); |
171 | 176 | ||
172 | protected: | 177 | protected: |
173 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 178 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
174 | virtual void timerEvent ( QTimerEvent *te ); | 179 | virtual void timerEvent ( QTimerEvent *te ); |
175 | 180 | ||
176 | int m_power_timer; | 181 | int m_power_timer; |
177 | 182 | ||
178 | OLedState m_leds [1]; //FIXME check if really only one | 183 | OLedState m_leds [1]; //FIXME check if really only one |
179 | }; | 184 | }; |
180 | 185 | ||
181 | class Ramses : public ODevice, public QWSServer::KeyboardFilter { | 186 | class Ramses : public ODevice, public QWSServer::KeyboardFilter { |
182 | protected: | 187 | protected: |
183 | virtual void init ( ); | 188 | virtual void init ( ); |
184 | 189 | ||
185 | public: | 190 | public: |
186 | virtual bool setSoftSuspend ( bool soft ); | 191 | virtual bool setSoftSuspend ( bool soft ); |
187 | virtual bool suspend ( ); | 192 | virtual bool suspend ( ); |
188 | 193 | ||
189 | virtual bool setDisplayStatus( bool on ); | 194 | virtual bool setDisplayStatus( bool on ); |
190 | virtual bool setDisplayBrightness ( int b ); | 195 | virtual bool setDisplayBrightness ( int b ); |
191 | virtual int displayBrightnessResolution ( ) const; | 196 | virtual int displayBrightnessResolution ( ) const; |
192 | virtual bool setDisplayContrast ( int b ); | 197 | virtual bool setDisplayContrast ( int b ); |
193 | virtual int displayContrastResolution ( ) const; | 198 | virtual int displayContrastResolution ( ) const; |
194 | 199 | ||
195 | protected: | 200 | protected: |
196 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 201 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
197 | virtual void timerEvent ( QTimerEvent *te ); | 202 | virtual void timerEvent ( QTimerEvent *te ); |
198 | 203 | ||
199 | int m_power_timer; | 204 | int m_power_timer; |
200 | }; | 205 | }; |
201 | 206 | ||
202 | struct i_button { | 207 | struct i_button { |
203 | uint model; | 208 | uint model; |
204 | Qt::Key code; | 209 | Qt::Key code; |
205 | char *utext; | 210 | char *utext; |
206 | char *pix; | 211 | char *pix; |
207 | char *fpressedservice; | 212 | char *fpressedservice; |
208 | char *fpressedaction; | 213 | char *fpressedaction; |
209 | char *fheldservice; | 214 | char *fheldservice; |
210 | char *fheldaction; | 215 | char *fheldaction; |
211 | } ipaq_buttons [] = { | 216 | } ipaq_buttons [] = { |
212 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 217 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
213 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 218 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
214 | "devicebuttons/ipaq_calendar", | 219 | "devicebuttons/ipaq_calendar", |
215 | "datebook", "nextView()", | 220 | "datebook", "nextView()", |
216 | "today", "raise()" }, | 221 | "today", "raise()" }, |
217 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 222 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
218 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 223 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
219 | "devicebuttons/ipaq_contact", | 224 | "devicebuttons/ipaq_contact", |
220 | "addressbook", "raise()", | 225 | "addressbook", "raise()", |
221 | "addressbook", "beamBusinessCard()" }, | 226 | "addressbook", "beamBusinessCard()" }, |
222 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 227 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
223 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 228 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
224 | "devicebuttons/ipaq_menu", | 229 | "devicebuttons/ipaq_menu", |
225 | "QPE/TaskBar", "toggleMenu()", | 230 | "QPE/TaskBar", "toggleMenu()", |
226 | "QPE/TaskBar", "toggleStartMenu()" }, | 231 | "QPE/TaskBar", "toggleStartMenu()" }, |
227 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 232 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
228 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 233 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
229 | "devicebuttons/ipaq_mail", | 234 | "devicebuttons/ipaq_mail", |
230 | "mail", "raise()", | 235 | "mail", "raise()", |
231 | "mail", "newMail()" }, | 236 | "mail", "newMail()" }, |
232 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 237 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
233 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 238 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
234 | "devicebuttons/ipaq_home", | 239 | "devicebuttons/ipaq_home", |
235 | "QPE/Launcher", "home()", | 240 | "QPE/Launcher", "home()", |
236 | "buttonsettings", "raise()" }, | 241 | "buttonsettings", "raise()" }, |
237 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 242 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
238 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 243 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
239 | "devicebuttons/ipaq_record", | 244 | "devicebuttons/ipaq_record", |
240 | "QPE/VMemo", "toggleRecord()", | 245 | "QPE/VMemo", "toggleRecord()", |
241 | "sound", "raise()" }, | 246 | "sound", "raise()" }, |
242 | }; | 247 | }; |
243 | 248 | ||
244 | struct z_button { | 249 | struct z_button { |
245 | Qt::Key code; | 250 | Qt::Key code; |
246 | char *utext; | 251 | char *utext; |
247 | char *pix; | 252 | char *pix; |
248 | char *fpressedservice; | 253 | char *fpressedservice; |
249 | char *fpressedaction; | 254 | char *fpressedaction; |
250 | char *fheldservice; | 255 | char *fheldservice; |
251 | char *fheldaction; | 256 | char *fheldaction; |
252 | } z_buttons [] = { | 257 | } z_buttons [] = { |
253 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 258 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
254 | "devicebuttons/z_calendar", | 259 | "devicebuttons/z_calendar", |
255 | "datebook", "nextView()", | 260 | "datebook", "nextView()", |
256 | "today", "raise()" }, | 261 | "today", "raise()" }, |
257 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 262 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
258 | "devicebuttons/z_contact", | 263 | "devicebuttons/z_contact", |
259 | "addressbook", "raise()", | 264 | "addressbook", "raise()", |
260 | "addressbook", "beamBusinessCard()" }, | 265 | "addressbook", "beamBusinessCard()" }, |
261 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 266 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
262 | "devicebuttons/z_home", | 267 | "devicebuttons/z_home", |
263 | "QPE/Launcher", "home()", | 268 | "QPE/Launcher", "home()", |
264 | "buttonsettings", "raise()" }, | 269 | "buttonsettings", "raise()" }, |
265 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 270 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
266 | "devicebuttons/z_menu", | 271 | "devicebuttons/z_menu", |
267 | "QPE/TaskBar", "toggleMenu()", | 272 | "QPE/TaskBar", "toggleMenu()", |
268 | "QPE/TaskBar", "toggleStartMenu()" }, | 273 | "QPE/TaskBar", "toggleStartMenu()" }, |
269 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 274 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
270 | "devicebuttons/z_mail", | 275 | "devicebuttons/z_mail", |
271 | "mail", "raise()", | 276 | "mail", "raise()", |
272 | "mail", "newMail()" }, | 277 | "mail", "newMail()" }, |
273 | }; | 278 | }; |
274 | 279 | ||
275 | struct z_button z_buttons_c700 [] = { | 280 | struct z_button z_buttons_c700 [] = { |
276 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 281 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
277 | "devicebuttons/z_calendar", | 282 | "devicebuttons/z_calendar", |
278 | "datebook", "nextView()", | 283 | "datebook", "nextView()", |
279 | "today", "raise()" }, | 284 | "today", "raise()" }, |
280 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 285 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
281 | "devicebuttons/z_contact", | 286 | "devicebuttons/z_contact", |
282 | "addressbook", "raise()", | 287 | "addressbook", "raise()", |
283 | "addressbook", "beamBusinessCard()" }, | 288 | "addressbook", "beamBusinessCard()" }, |
284 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 289 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
285 | "devicebuttons/z_home", | 290 | "devicebuttons/z_home", |
286 | "QPE/Launcher", "home()", | 291 | "QPE/Launcher", "home()", |
287 | "buttonsettings", "raise()" }, | 292 | "buttonsettings", "raise()" }, |
288 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 293 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
289 | "devicebuttons/z_menu", | 294 | "devicebuttons/z_menu", |
290 | "QPE/TaskBar", "toggleMenu()", | 295 | "QPE/TaskBar", "toggleMenu()", |
291 | "QPE/TaskBar", "toggleStartMenu()" }, | 296 | "QPE/TaskBar", "toggleStartMenu()" }, |
292 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 297 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
293 | "", | 298 | "", |
294 | "QPE/Rotation", "flip()", | 299 | "QPE/Rotation", "rotateDefault()", |
295 | "QPE/Rotation", "flip()" }, | 300 | "QPE/Rotation", "rotateDefault()" }, |
296 | }; | 301 | }; |
297 | 302 | ||
298 | struct s_button { | 303 | struct s_button { |
299 | uint model; | 304 | uint model; |
300 | Qt::Key code; | 305 | Qt::Key code; |
301 | char *utext; | 306 | char *utext; |
302 | char *pix; | 307 | char *pix; |
303 | char *fpressedservice; | 308 | char *fpressedservice; |
304 | char *fpressedaction; | 309 | char *fpressedaction; |
305 | char *fheldservice; | 310 | char *fheldservice; |
306 | char *fheldaction; | 311 | char *fheldaction; |
307 | } simpad_buttons [] = { | 312 | } simpad_buttons [] = { |
308 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 313 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
309 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 314 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
310 | "devicebuttons/simpad_lower_up", | 315 | "devicebuttons/simpad_lower_up", |
311 | "datebook", "nextView()", | 316 | "datebook", "nextView()", |
312 | "today", "raise()" }, | 317 | "today", "raise()" }, |
313 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 318 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
314 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), | 319 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
315 | "devicebuttons/simpad_lower_down", | 320 | "devicebuttons/simpad_lower_down", |
316 | "addressbook", "raise()", | 321 | "addressbook", "raise()", |
317 | "addressbook", "beamBusinessCard()" }, | 322 | "addressbook", "beamBusinessCard()" }, |
318 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 323 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
319 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), | 324 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), |
320 | "devicebuttons/simpad_lower_right", | 325 | "devicebuttons/simpad_lower_right", |
321 | "QPE/TaskBar", "toggleMenu()", | 326 | "QPE/TaskBar", "toggleMenu()", |
322 | "QPE/TaskBar", "toggleStartMenu()" }, | 327 | "QPE/TaskBar", "toggleStartMenu()" }, |
323 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 328 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
324 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), | 329 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), |
325 | "devicebuttons/simpad_lower_left", | 330 | "devicebuttons/simpad_lower_left", |
326 | "mail", "raise()", | 331 | "mail", "raise()", |
327 | "mail", "newMail()" }, | 332 | "mail", "newMail()" }, |
328 | 333 | ||
329 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 334 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
330 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), | 335 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), |
331 | "devicebuttons/simpad_upper_up", | 336 | "devicebuttons/simpad_upper_up", |
332 | "QPE/Launcher", "home()", | 337 | "QPE/Launcher", "home()", |
333 | "buttonsettings", "raise()" }, | 338 | "buttonsettings", "raise()" }, |
334 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 339 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
335 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), | 340 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), |
336 | "devicebuttons/simpad_upper_down", | 341 | "devicebuttons/simpad_upper_down", |
337 | "addressbook", "raise()", | 342 | "addressbook", "raise()", |
338 | "addressbook", "beamBusinessCard()" }, | 343 | "addressbook", "beamBusinessCard()" }, |
339 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 344 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
340 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), | 345 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), |
341 | "devicebuttons/simpad_upper_right", | 346 | "devicebuttons/simpad_upper_right", |
342 | "QPE/TaskBar", "toggleMenu()", | 347 | "QPE/TaskBar", "toggleMenu()", |
343 | "QPE/TaskBar", "toggleStartMenu()" }, | 348 | "QPE/TaskBar", "toggleStartMenu()" }, |
344 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 349 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
345 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | 350 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), |
346 | "devicebuttons/simpad_upper_left", | 351 | "devicebuttons/simpad_upper_left", |
347 | "QPE/Rotation", "flip()", | 352 | "QPE/Rotation", "flip()", |
348 | "QPE/Rotation", "flip()" }, | 353 | "QPE/Rotation", "flip()" }, |
349 | /* | 354 | /* |
350 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 355 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
351 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 356 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
352 | "devicebuttons/simpad_lower_upper", | 357 | "devicebuttons/simpad_lower_upper", |
353 | "QPE/Launcher", "home()", | 358 | "QPE/Launcher", "home()", |
354 | "buttonsettings", "raise()" }, | 359 | "buttonsettings", "raise()" }, |
355 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 360 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
356 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 361 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
357 | "devicebuttons/simpad_upper_lower", | 362 | "devicebuttons/simpad_upper_lower", |
358 | "QPE/Launcher", "home()", | 363 | "QPE/Launcher", "home()", |
359 | "buttonsettings", "raise()" }, | 364 | "buttonsettings", "raise()" }, |
360 | */ | 365 | */ |
361 | }; | 366 | }; |
362 | 367 | ||
363 | struct r_button { | 368 | struct r_button { |
364 | uint model; | 369 | uint model; |
365 | Qt::Key code; | 370 | Qt::Key code; |
366 | char *utext; | 371 | char *utext; |
367 | char *pix; | 372 | char *pix; |
368 | char *fpressedservice; | 373 | char *fpressedservice; |
369 | char *fpressedaction; | 374 | char *fpressedaction; |
370 | char *fheldservice; | 375 | char *fheldservice; |
371 | char *fheldaction; | 376 | char *fheldaction; |
372 | } ramses_buttons [] = { | 377 | } ramses_buttons [] = { |
373 | { Model_Ramses_MNCI, | 378 | { Model_Ramses_MNCI, |
374 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 379 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
375 | "devicebuttons/z_menu", | 380 | "devicebuttons/z_menu", |
376 | "QPE/TaskBar", "toggleMenu()", | 381 | "QPE/TaskBar", "toggleMenu()", |
377 | "QPE/TaskBar", "toggleStartMenu()" }, | 382 | "QPE/TaskBar", "toggleStartMenu()" }, |
378 | { Model_Ramses_MNCI, | 383 | { Model_Ramses_MNCI, |
379 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 384 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
380 | "devicebuttons/ipaq_home", | 385 | "devicebuttons/ipaq_home", |
381 | "QPE/Launcher", "home()", | 386 | "QPE/Launcher", "home()", |
382 | "buttonsettings", "raise()" }, | 387 | "buttonsettings", "raise()" }, |
383 | }; | 388 | }; |
384 | 389 | ||
385 | class Yopy : public ODevice { | 390 | class Yopy : public ODevice { |
386 | protected: | 391 | protected: |
387 | virtual void init ( ); | 392 | virtual void init ( ); |
388 | virtual void initButtons ( ); | 393 | virtual void initButtons ( ); |
389 | 394 | ||
390 | public: | 395 | public: |
391 | virtual bool suspend ( ); | 396 | virtual bool suspend ( ); |
392 | 397 | ||
393 | virtual bool setDisplayBrightness ( int b ); | 398 | virtual bool setDisplayBrightness ( int b ); |
394 | virtual int displayBrightnessResolution ( ) const; | 399 | virtual int displayBrightnessResolution ( ) const; |
395 | 400 | ||
396 | static bool isYopy ( ); | 401 | static bool isYopy ( ); |
397 | }; | 402 | }; |
398 | 403 | ||
399 | struct yopy_button { | 404 | struct yopy_button { |
400 | Qt::Key code; | 405 | Qt::Key code; |
401 | char *utext; | 406 | char *utext; |
402 | char *pix; | 407 | char *pix; |
403 | char *fpressedservice; | 408 | char *fpressedservice; |
404 | char *fpressedaction; | 409 | char *fpressedaction; |
405 | char *fheldservice; | 410 | char *fheldservice; |
406 | char *fheldaction; | 411 | char *fheldaction; |
407 | } yopy_buttons [] = { | 412 | } yopy_buttons [] = { |
408 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), | 413 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), |
409 | "devicebuttons/yopy_action", | 414 | "devicebuttons/yopy_action", |
410 | "datebook", "nextView()", | 415 | "datebook", "nextView()", |
411 | "today", "raise()" }, | 416 | "today", "raise()" }, |
412 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), | 417 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), |
413 | "devicebuttons/yopy_ok", | 418 | "devicebuttons/yopy_ok", |
414 | "addressbook", "raise()", | 419 | "addressbook", "raise()", |
415 | "addressbook", "beamBusinessCard()" }, | 420 | "addressbook", "beamBusinessCard()" }, |
416 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"), | 421 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"), |
417 | "devicebuttons/yopy_end", | 422 | "devicebuttons/yopy_end", |
418 | "QPE/Launcher", "home()", | 423 | "QPE/Launcher", "home()", |
419 | "buttonsettings", "raise()" }, | 424 | "buttonsettings", "raise()" }, |
420 | }; | 425 | }; |
421 | 426 | ||
422 | static QCString makeChannel ( const char *str ) | 427 | static QCString makeChannel ( const char *str ) |
423 | { | 428 | { |
424 | if ( str && !::strchr ( str, '/' )) | 429 | if ( str && !::strchr ( str, '/' )) |
425 | return QCString ( "QPE/Application/" ) + str; | 430 | return QCString ( "QPE/Application/" ) + str; |
426 | else | 431 | else |
427 | return str; | 432 | return str; |
428 | } | 433 | } |
429 | 434 | ||
430 | static inline bool isQWS() | 435 | static inline bool isQWS() |
431 | { | 436 | { |
432 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 437 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
433 | } | 438 | } |
434 | 439 | ||
435 | ODevice *ODevice::inst ( ) | 440 | ODevice *ODevice::inst ( ) |
436 | { | 441 | { |
437 | static ODevice *dev = 0; | 442 | static ODevice *dev = 0; |
438 | 443 | ||
439 | if ( !dev ) { | 444 | if ( !dev ) { |
440 | if ( QFile::exists ( "/proc/hal/model" )) | 445 | if ( QFile::exists ( "/proc/hal/model" )) |
441 | dev = new iPAQ ( ); | 446 | dev = new iPAQ ( ); |
442 | else if ( Zaurus::isZaurus() ) | 447 | else if ( Zaurus::isZaurus() ) |
443 | dev = new Zaurus ( ); | 448 | dev = new Zaurus ( ); |
444 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) | 449 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) |
445 | dev = new SIMpad ( ); | 450 | dev = new SIMpad ( ); |
446 | else if ( QFile::exists ( "/proc/sys/board/name" )) | 451 | else if ( QFile::exists ( "/proc/sys/board/name" )) |
447 | dev = new Ramses ( ); | 452 | dev = new Ramses ( ); |
448 | else if ( Yopy::isYopy() ) | 453 | else if ( Yopy::isYopy() ) |
449 | dev = new Yopy ( ); | 454 | dev = new Yopy ( ); |
450 | else if ( Jornada::isJornada() ) | 455 | else if ( Jornada::isJornada() ) |
451 | dev = new Jornada ( ); | 456 | dev = new Jornada ( ); |
452 | else | 457 | else |
453 | dev = new ODevice ( ); | 458 | dev = new ODevice ( ); |
454 | dev-> init ( ); | 459 | dev-> init ( ); |
455 | } | 460 | } |
456 | return dev; | 461 | return dev; |
457 | } | 462 | } |
458 | 463 | ||
459 | 464 | ||
460 | /************************************************** | 465 | /************************************************** |
461 | * | 466 | * |
462 | * common | 467 | * common |
463 | * | 468 | * |
464 | **************************************************/ | 469 | **************************************************/ |
465 | 470 | ||
466 | 471 | ||
467 | ODevice::ODevice ( ) | 472 | ODevice::ODevice ( ) |
468 | { | 473 | { |
469 | d = new ODeviceData; | 474 | d = new ODeviceData; |
470 | 475 | ||
471 | d-> m_modelstr = "Unknown"; | 476 | d-> m_modelstr = "Unknown"; |
472 | d-> m_model = Model_Unknown; | 477 | d-> m_model = Model_Unknown; |
473 | d-> m_vendorstr = "Unknown"; | 478 | d-> m_vendorstr = "Unknown"; |
474 | d-> m_vendor = Vendor_Unknown; | 479 | d-> m_vendor = Vendor_Unknown; |
475 | d-> m_systemstr = "Unknown"; | 480 | d-> m_systemstr = "Unknown"; |
476 | d-> m_system = System_Unknown; | 481 | d-> m_system = System_Unknown; |
477 | d-> m_sysverstr = "0.0"; | 482 | d-> m_sysverstr = "0.0"; |
478 | d-> m_rotation = Rot0; | 483 | d-> m_rotation = Rot0; |
479 | d-> m_direction = CW; | 484 | d-> m_direction = CW; |
480 | 485 | ||
481 | d-> m_holdtime = 1000; // 1000ms | 486 | d-> m_holdtime = 1000; // 1000ms |
482 | d-> m_buttons = 0; | 487 | d-> m_buttons = 0; |
483 | d-> m_cpu_frequencies = new QStrList; | 488 | d-> m_cpu_frequencies = new QStrList; |
484 | } | 489 | } |
485 | 490 | ||
486 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 491 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
487 | { | 492 | { |
488 | if ( msg == "deviceButtonMappingChanged()" ) { | 493 | if ( msg == "deviceButtonMappingChanged()" ) { |
489 | reloadButtonMapping ( ); | 494 | reloadButtonMapping ( ); |
490 | } | 495 | } |
491 | } | 496 | } |
492 | 497 | ||
493 | void ODevice::init ( ) | 498 | void ODevice::init ( ) |
494 | { | 499 | { |
495 | } | 500 | } |
496 | 501 | ||
497 | /** | 502 | /** |
498 | * This method initialises the button mapping | 503 | * This method initialises the button mapping |
499 | */ | 504 | */ |
500 | void ODevice::initButtons ( ) | 505 | void ODevice::initButtons ( ) |
501 | { | 506 | { |
502 | if ( d-> m_buttons ) | 507 | if ( d-> m_buttons ) |
503 | return; | 508 | return; |
504 | 509 | ||
505 | // Simulation uses iPAQ 3660 device buttons | 510 | // Simulation uses iPAQ 3660 device buttons |
506 | 511 | ||
507 | qDebug ( "init Buttons" ); | 512 | qDebug ( "init Buttons" ); |
508 | d-> m_buttons = new QValueList <ODeviceButton>; | 513 | d-> m_buttons = new QValueList <ODeviceButton>; |
509 | 514 | ||
510 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 515 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
511 | i_button *ib = ipaq_buttons + i; | 516 | i_button *ib = ipaq_buttons + i; |
512 | ODeviceButton b; | 517 | ODeviceButton b; |
513 | 518 | ||
514 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 519 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
515 | b. setKeycode ( ib-> code ); | 520 | b. setKeycode ( ib-> code ); |
516 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 521 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
517 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 522 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
518 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 523 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
519 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 524 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
520 | d-> m_buttons-> append ( b ); | 525 | d-> m_buttons-> append ( b ); |
521 | } | 526 | } |
522 | } | 527 | } |
523 | reloadButtonMapping ( ); | 528 | reloadButtonMapping ( ); |
524 | 529 | ||
525 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 530 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
526 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 531 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
527 | } | 532 | } |
528 | 533 | ||
529 | ODevice::~ODevice ( ) | 534 | ODevice::~ODevice ( ) |
530 | { | 535 | { |
531 | // we leak m_devicebuttons and m_cpu_frequency | 536 | // we leak m_devicebuttons and m_cpu_frequency |
532 | // but it's a singleton and it is not so importantant | 537 | // but it's a singleton and it is not so importantant |
533 | // -zecke | 538 | // -zecke |
534 | delete d; | 539 | delete d; |
535 | } | 540 | } |
536 | 541 | ||
537 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 542 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
538 | { | 543 | { |
539 | return false; | 544 | return false; |
540 | } | 545 | } |
541 | 546 | ||
542 | //#include <linux/apm_bios.h> | 547 | //#include <linux/apm_bios.h> |
543 | 548 | ||
544 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 549 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
545 | 550 | ||
546 | /** | 551 | /** |
547 | * This method will try to suspend the device | 552 | * This method will try to suspend the device |
548 | * It only works if the user is the QWS Server and the apm application | 553 | * It only works if the user is the QWS Server and the apm application |
549 | * is installed. | 554 | * is installed. |
550 | * It tries to suspend and then waits some time cause some distributions | 555 | * It tries to suspend and then waits some time cause some distributions |
551 | * do have asynchronus apm implementations. | 556 | * do have asynchronus apm implementations. |
552 | * This method will either fail and return false or it'll suspend the | 557 | * This method will either fail and return false or it'll suspend the |
553 | * device and return once the device got woken up | 558 | * device and return once the device got woken up |
554 | * | 559 | * |
555 | * @return if the device got suspended | 560 | * @return if the device got suspended |
556 | */ | 561 | */ |
557 | bool ODevice::suspend ( ) | 562 | bool ODevice::suspend ( ) |
558 | { | 563 | { |
559 | qDebug("ODevice::suspend"); | 564 | qDebug("ODevice::suspend"); |
560 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 565 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
561 | return false; | 566 | return false; |
562 | 567 | ||
563 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 568 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
564 | return false; | 569 | return false; |
565 | 570 | ||
566 | bool res = false; | 571 | bool res = false; |
567 | 572 | ||
568 | struct timeval tvs, tvn; | 573 | struct timeval tvs, tvn; |
569 | ::gettimeofday ( &tvs, 0 ); | 574 | ::gettimeofday ( &tvs, 0 ); |
570 | 575 | ||
571 | ::sync ( ); // flush fs caches | 576 | ::sync ( ); // flush fs caches |
572 | res = ( ::system ( "apm --suspend" ) == 0 ); | 577 | res = ( ::system ( "apm --suspend" ) == 0 ); |
573 | 578 | ||
574 | // This is needed because the iPAQ apm implementation is asynchronous and we | 579 | // This is needed because the iPAQ apm implementation is asynchronous and we |
575 | // can not be sure when exactly the device is really suspended | 580 | // can not be sure when exactly the device is really suspended |
576 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 581 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
577 | 582 | ||
578 | if ( res ) { | 583 | if ( res ) { |
579 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 584 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
580 | ::usleep ( 200 * 1000 ); | 585 | ::usleep ( 200 * 1000 ); |
581 | ::gettimeofday ( &tvn, 0 ); | 586 | ::gettimeofday ( &tvn, 0 ); |
582 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 587 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
583 | } | 588 | } |
584 | 589 | ||
585 | return res; | 590 | return res; |
586 | } | 591 | } |
587 | 592 | ||
588 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 593 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
589 | 594 | ||
590 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 595 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
591 | 596 | ||
592 | /* VESA Blanking Levels */ | 597 | /* VESA Blanking Levels */ |
593 | #define VESA_NO_BLANKING 0 | 598 | #define VESA_NO_BLANKING 0 |
594 | #define VESA_VSYNC_SUSPEND 1 | 599 | #define VESA_VSYNC_SUSPEND 1 |
595 | #define VESA_HSYNC_SUSPEND 2 | 600 | #define VESA_HSYNC_SUSPEND 2 |
596 | #define VESA_POWERDOWN 3 | 601 | #define VESA_POWERDOWN 3 |
597 | 602 | ||
598 | /** | 603 | /** |
599 | * This sets the display on or off | 604 | * This sets the display on or off |
600 | */ | 605 | */ |
601 | bool ODevice::setDisplayStatus ( bool on ) | 606 | bool ODevice::setDisplayStatus ( bool on ) |
602 | { | 607 | { |
603 | qDebug("ODevice::setDisplayStatus(%d)", on); | 608 | qDebug("ODevice::setDisplayStatus(%d)", on); |
604 | 609 | ||
605 | if ( d-> m_model == Model_Unknown ) | 610 | if ( d-> m_model == Model_Unknown ) |
606 | return false; | 611 | return false; |
607 | 612 | ||
608 | bool res = false; | 613 | bool res = false; |
609 | int fd; | 614 | int fd; |
610 | 615 | ||
611 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 616 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
612 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 617 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
613 | ::close ( fd ); | 618 | ::close ( fd ); |
614 | } | 619 | } |
615 | return res; | 620 | return res; |
616 | } | 621 | } |
617 | 622 | ||
618 | /** | 623 | /** |
619 | * This sets the display brightness | 624 | * This sets the display brightness |
620 | * | 625 | * |
621 | * @param p The brightness to be set on a scale from 0 to 255 | 626 | * @param p The brightness to be set on a scale from 0 to 255 |
622 | * @return success or failure | 627 | * @return success or failure |
623 | */ | 628 | */ |
624 | bool ODevice::setDisplayBrightness ( int p) | 629 | bool ODevice::setDisplayBrightness ( int p) |
625 | { | 630 | { |
626 | Q_UNUSED( p ) | 631 | Q_UNUSED( p ) |
627 | return false; | 632 | return false; |
628 | } | 633 | } |
629 | 634 | ||
630 | /** | 635 | /** |
631 | * @return returns the number of steppings on the brightness slider | 636 | * @return returns the number of steppings on the brightness slider |
632 | * in the Light-'n-Power settings. | 637 | * in the Light-'n-Power settings. |
633 | */ | 638 | */ |
634 | int ODevice::displayBrightnessResolution ( ) const | 639 | int ODevice::displayBrightnessResolution ( ) const |
635 | { | 640 | { |
636 | return 16; | 641 | return 16; |
637 | } | 642 | } |
638 | 643 | ||
639 | /** | 644 | /** |
640 | * This sets the display contrast | 645 | * This sets the display contrast |
641 | * @param p The contrast to be set on a scale from 0 to 255 | 646 | * @param p The contrast to be set on a scale from 0 to 255 |
642 | * @return success or failure | 647 | * @return success or failure |
643 | */ | 648 | */ |
644 | bool ODevice::setDisplayContrast ( int p) | 649 | bool ODevice::setDisplayContrast ( int p) |
645 | { | 650 | { |
646 | Q_UNUSED( p ) | 651 | Q_UNUSED( p ) |
647 | return false; | 652 | return false; |
648 | } | 653 | } |
649 | 654 | ||
650 | /** | 655 | /** |
651 | * @return return the max value for the brightness settings slider | 656 | * @return return the max value for the brightness settings slider |
652 | * or 0 if the device doesn't support setting of a contrast | 657 | * or 0 if the device doesn't support setting of a contrast |
653 | */ | 658 | */ |
654 | int ODevice::displayContrastResolution ( ) const | 659 | int ODevice::displayContrastResolution ( ) const |
655 | { | 660 | { |
656 | return 0; | 661 | return 0; |
657 | } | 662 | } |
658 | 663 | ||
659 | /** | 664 | /** |
660 | * This returns the vendor as string | 665 | * This returns the vendor as string |
661 | * @return Vendor as QString | 666 | * @return Vendor as QString |
662 | */ | 667 | */ |
663 | QString ODevice::vendorString ( ) const | 668 | QString ODevice::vendorString ( ) const |
664 | { | 669 | { |
665 | return d-> m_vendorstr; | 670 | return d-> m_vendorstr; |
666 | } | 671 | } |
667 | 672 | ||
668 | /** | 673 | /** |
669 | * This returns the vendor as one of the values of OVendor | 674 | * This returns the vendor as one of the values of OVendor |
670 | * @return OVendor | 675 | * @return OVendor |
671 | */ | 676 | */ |
672 | OVendor ODevice::vendor ( ) const | 677 | OVendor ODevice::vendor ( ) const |
673 | { | 678 | { |
674 | return d-> m_vendor; | 679 | return d-> m_vendor; |
675 | } | 680 | } |
676 | 681 | ||
677 | /** | 682 | /** |
678 | * This returns the model as a string | 683 | * This returns the model as a string |
679 | * @return A string representing the model | 684 | * @return A string representing the model |
680 | */ | 685 | */ |
681 | QString ODevice::modelString ( ) const | 686 | QString ODevice::modelString ( ) const |
682 | { | 687 | { |
683 | return d-> m_modelstr; | 688 | return d-> m_modelstr; |
684 | } | 689 | } |
685 | 690 | ||
686 | /** | 691 | /** |
687 | * This does return the OModel used | 692 | * This does return the OModel used |
688 | */ | 693 | */ |
689 | OModel ODevice::model ( ) const | 694 | OModel ODevice::model ( ) const |
690 | { | 695 | { |
691 | return d-> m_model; | 696 | return d-> m_model; |
692 | } | 697 | } |
693 | 698 | ||
694 | /** | 699 | /** |
695 | * This does return the systen name | 700 | * This does return the systen name |
696 | */ | 701 | */ |
697 | QString ODevice::systemString ( ) const | 702 | QString ODevice::systemString ( ) const |
698 | { | 703 | { |
699 | return d-> m_systemstr; | 704 | return d-> m_systemstr; |
700 | } | 705 | } |
701 | 706 | ||
702 | /** | 707 | /** |
703 | * Return System as OSystem value | 708 | * Return System as OSystem value |
704 | */ | 709 | */ |
705 | OSystem ODevice::system ( ) const | 710 | OSystem ODevice::system ( ) const |
706 | { | 711 | { |
707 | return d-> m_system; | 712 | return d-> m_system; |
708 | } | 713 | } |
709 | 714 | ||
710 | /** | 715 | /** |
711 | * @return the version string of the base system | 716 | * @return the version string of the base system |
712 | */ | 717 | */ |
713 | QString ODevice::systemVersionString ( ) const | 718 | QString ODevice::systemVersionString ( ) const |
714 | { | 719 | { |
715 | return d-> m_sysverstr; | 720 | return d-> m_sysverstr; |
716 | } | 721 | } |
717 | 722 | ||
718 | /** | 723 | /** |
719 | * @return the current Transformation | 724 | * @return the current Transformation |
720 | */ | 725 | */ |
721 | Transformation ODevice::rotation ( ) const | 726 | Transformation ODevice::rotation ( ) const |
722 | { | 727 | { |
723 | return d-> m_rotation; | 728 | return d-> m_rotation; |
724 | } | 729 | } |
725 | 730 | ||
726 | /** | 731 | /** |
727 | * @return the current rotation direction | 732 | * @return the current rotation direction |
728 | */ | 733 | */ |
729 | ODirection ODevice::direction ( ) const | 734 | ODirection ODevice::direction ( ) const |
730 | { | 735 | { |
731 | return d-> m_direction; | 736 | return d-> m_direction; |
732 | } | 737 | } |
733 | 738 | ||
734 | /** | 739 | /** |
735 | * This plays an alarmSound | 740 | * This plays an alarmSound |
736 | */ | 741 | */ |
737 | void ODevice::alarmSound ( ) | 742 | void ODevice::alarmSound ( ) |
738 | { | 743 | { |
739 | #ifndef QT_NO_SOUND | 744 | #ifndef QT_NO_SOUND |
740 | static Sound snd ( "alarm" ); | 745 | static Sound snd ( "alarm" ); |
741 | 746 | ||
742 | if ( snd. isFinished ( )) | 747 | if ( snd. isFinished ( )) |
743 | snd. play ( ); | 748 | snd. play ( ); |
744 | #endif | 749 | #endif |
745 | } | 750 | } |
746 | 751 | ||
747 | /** | 752 | /** |
748 | * This plays a key sound | 753 | * This plays a key sound |
749 | */ | 754 | */ |
750 | void ODevice::keySound ( ) | 755 | void ODevice::keySound ( ) |
751 | { | 756 | { |
752 | #ifndef QT_NO_SOUND | 757 | #ifndef QT_NO_SOUND |
753 | static Sound snd ( "keysound" ); | 758 | static Sound snd ( "keysound" ); |
754 | 759 | ||
755 | if ( snd. isFinished ( )) | 760 | if ( snd. isFinished ( )) |
756 | snd. play ( ); | 761 | snd. play ( ); |
757 | #endif | 762 | #endif |
758 | } | 763 | } |
759 | 764 | ||
760 | /** | 765 | /** |
761 | * This plays a touch sound | 766 | * This plays a touch sound |
762 | */ | 767 | */ |
763 | void ODevice::touchSound ( ) | 768 | void ODevice::touchSound ( ) |
764 | { | 769 | { |
765 | #ifndef QT_NO_SOUND | 770 | #ifndef QT_NO_SOUND |
766 | static Sound snd ( "touchsound" ); | 771 | static Sound snd ( "touchsound" ); |
767 | 772 | ||
768 | if ( snd. isFinished ( )) | 773 | if ( snd. isFinished ( )) |
769 | snd. play ( ); | 774 | snd. play ( ); |
770 | #endif | 775 | #endif |
771 | } | 776 | } |
772 | 777 | ||
773 | /** | 778 | /** |
774 | * This method will return a list of leds | 779 | * This method will return a list of leds |
775 | * available on this device | 780 | * available on this device |
776 | * @return a list of LEDs. | 781 | * @return a list of LEDs. |
777 | */ | 782 | */ |
778 | QValueList <OLed> ODevice::ledList ( ) const | 783 | QValueList <OLed> ODevice::ledList ( ) const |
779 | { | 784 | { |
780 | return QValueList <OLed> ( ); | 785 | return QValueList <OLed> ( ); |
781 | } | 786 | } |
782 | 787 | ||
783 | /** | 788 | /** |
784 | * This does return the state of the LEDs | 789 | * This does return the state of the LEDs |
785 | */ | 790 | */ |
786 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 791 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
787 | { | 792 | { |
788 | return QValueList <OLedState> ( ); | 793 | return QValueList <OLedState> ( ); |
789 | } | 794 | } |
790 | 795 | ||
791 | /** | 796 | /** |
792 | * @return the state for a given OLed | 797 | * @return the state for a given OLed |
793 | */ | 798 | */ |
794 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 799 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
795 | { | 800 | { |
796 | return Led_Off; | 801 | return Led_Off; |
797 | } | 802 | } |
798 | 803 | ||
799 | /** | 804 | /** |
800 | * Set the state for a LED | 805 | * Set the state for a LED |
801 | * @param which Which OLed to use | 806 | * @param which Which OLed to use |
802 | * @param st The state to set | 807 | * @param st The state to set |
803 | * @return success or failure | 808 | * @return success or failure |
804 | */ | 809 | */ |
805 | bool ODevice::setLedState ( OLed which, OLedState st ) | 810 | bool ODevice::setLedState ( OLed which, OLedState st ) |
806 | { | 811 | { |
807 | Q_UNUSED( which ) | 812 | Q_UNUSED( which ) |
@@ -1123,1371 +1128,1456 @@ void iPAQ::init ( ) | |||
1123 | else if ( d-> m_modelstr == "H5400" ) | 1128 | else if ( d-> m_modelstr == "H5400" ) |
1124 | d-> m_model = Model_iPAQ_H5xxx; | 1129 | d-> m_model = Model_iPAQ_H5xxx; |
1125 | else | 1130 | else |
1126 | d-> m_model = Model_Unknown; | 1131 | d-> m_model = Model_Unknown; |
1127 | 1132 | ||
1128 | f. close ( ); | 1133 | f. close ( ); |
1129 | } | 1134 | } |
1130 | 1135 | ||
1131 | switch ( d-> m_model ) { | 1136 | switch ( d-> m_model ) { |
1132 | case Model_iPAQ_H31xx: | 1137 | case Model_iPAQ_H31xx: |
1133 | case Model_iPAQ_H38xx: | 1138 | case Model_iPAQ_H38xx: |
1134 | d-> m_rotation = Rot90; | 1139 | d-> m_rotation = Rot90; |
1135 | break; | 1140 | break; |
1136 | case Model_iPAQ_H36xx: | 1141 | case Model_iPAQ_H36xx: |
1137 | case Model_iPAQ_H37xx: | 1142 | case Model_iPAQ_H37xx: |
1138 | case Model_iPAQ_H39xx: | 1143 | case Model_iPAQ_H39xx: |
1139 | 1144 | ||
1140 | default: | 1145 | default: |
1141 | d-> m_rotation = Rot270; | 1146 | d-> m_rotation = Rot270; |
1142 | break; | 1147 | break; |
1143 | case Model_iPAQ_H5xxx: | 1148 | case Model_iPAQ_H5xxx: |
1144 | d-> m_rotation = Rot0; | 1149 | d-> m_rotation = Rot0; |
1145 | } | 1150 | } |
1146 | 1151 | ||
1147 | f. setName ( "/etc/familiar-version" ); | 1152 | f. setName ( "/etc/familiar-version" ); |
1148 | if ( f. open ( IO_ReadOnly )) { | 1153 | if ( f. open ( IO_ReadOnly )) { |
1149 | d-> m_systemstr = "Familiar"; | 1154 | d-> m_systemstr = "Familiar"; |
1150 | d-> m_system = System_Familiar; | 1155 | d-> m_system = System_Familiar; |
1151 | 1156 | ||
1152 | QTextStream ts ( &f ); | 1157 | QTextStream ts ( &f ); |
1153 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 1158 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
1154 | 1159 | ||
1155 | f. close ( ); | 1160 | f. close ( ); |
1156 | } else { | 1161 | } else { |
1157 | f. setName ( "/etc/oz_version" ); | 1162 | f. setName ( "/etc/oz_version" ); |
1158 | 1163 | ||
1159 | if ( f. open ( IO_ReadOnly )) { | 1164 | if ( f. open ( IO_ReadOnly )) { |
1160 | d-> m_systemstr = "OpenEmbedded/iPaq"; | 1165 | d-> m_systemstr = "OpenEmbedded/iPaq"; |
1161 | d-> m_system = System_Familiar; | 1166 | d-> m_system = System_Familiar; |
1162 | 1167 | ||
1163 | QTextStream ts ( &f ); | 1168 | QTextStream ts ( &f ); |
1164 | ts.setDevice ( &f ); | 1169 | ts.setDevice ( &f ); |
1165 | d-> m_sysverstr = ts. readLine ( ); | 1170 | d-> m_sysverstr = ts. readLine ( ); |
1166 | f. close ( ); | 1171 | f. close ( ); |
1167 | } | 1172 | } |
1168 | } | 1173 | } |
1169 | 1174 | ||
1170 | 1175 | ||
1171 | 1176 | ||
1172 | 1177 | ||
1173 | 1178 | ||
1174 | m_leds [0] = m_leds [1] = Led_Off; | 1179 | m_leds [0] = m_leds [1] = Led_Off; |
1175 | 1180 | ||
1176 | m_power_timer = 0; | 1181 | m_power_timer = 0; |
1177 | 1182 | ||
1178 | } | 1183 | } |
1179 | 1184 | ||
1180 | void iPAQ::initButtons ( ) | 1185 | void iPAQ::initButtons ( ) |
1181 | { | 1186 | { |
1182 | if ( d-> m_buttons ) | 1187 | if ( d-> m_buttons ) |
1183 | return; | 1188 | return; |
1184 | 1189 | ||
1185 | if ( isQWS( ) ) | 1190 | if ( isQWS( ) ) |
1186 | QWSServer::setKeyboardFilter ( this ); | 1191 | QWSServer::setKeyboardFilter ( this ); |
1187 | 1192 | ||
1188 | d-> m_buttons = new QValueList <ODeviceButton>; | 1193 | d-> m_buttons = new QValueList <ODeviceButton>; |
1189 | 1194 | ||
1190 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 1195 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
1191 | i_button *ib = ipaq_buttons + i; | 1196 | i_button *ib = ipaq_buttons + i; |
1192 | ODeviceButton b; | 1197 | ODeviceButton b; |
1193 | 1198 | ||
1194 | if (( ib-> model & d-> m_model ) == d-> m_model ) { | 1199 | if (( ib-> model & d-> m_model ) == d-> m_model ) { |
1195 | b. setKeycode ( ib-> code ); | 1200 | b. setKeycode ( ib-> code ); |
1196 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 1201 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
1197 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 1202 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
1198 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 1203 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
1199 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 1204 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
1200 | 1205 | ||
1201 | d-> m_buttons-> append ( b ); | 1206 | d-> m_buttons-> append ( b ); |
1202 | } | 1207 | } |
1203 | } | 1208 | } |
1204 | reloadButtonMapping ( ); | 1209 | reloadButtonMapping ( ); |
1205 | 1210 | ||
1206 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1211 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
1207 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 1212 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
1208 | } | 1213 | } |
1209 | 1214 | ||
1210 | 1215 | ||
1211 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 1216 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
1212 | 1217 | ||
1213 | typedef struct { | 1218 | typedef struct { |
1214 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 1219 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
1215 | unsigned char TotalTime; /* Units of 5 seconds */ | 1220 | unsigned char TotalTime; /* Units of 5 seconds */ |
1216 | unsigned char OnTime; /* units of 100m/s */ | 1221 | unsigned char OnTime; /* units of 100m/s */ |
1217 | unsigned char OffTime; /* units of 100m/s */ | 1222 | unsigned char OffTime; /* units of 100m/s */ |
1218 | } LED_IN; | 1223 | } LED_IN; |
1219 | 1224 | ||
1220 | typedef struct { | 1225 | typedef struct { |
1221 | unsigned char mode; | 1226 | unsigned char mode; |
1222 | unsigned char pwr; | 1227 | unsigned char pwr; |
1223 | unsigned char brightness; | 1228 | unsigned char brightness; |
1224 | } FLITE_IN; | 1229 | } FLITE_IN; |
1225 | 1230 | ||
1226 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 1231 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
1227 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 1232 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
1228 | 1233 | ||
1229 | 1234 | ||
1230 | QValueList <OLed> iPAQ::ledList ( ) const | 1235 | QValueList <OLed> iPAQ::ledList ( ) const |
1231 | { | 1236 | { |
1232 | QValueList <OLed> vl; | 1237 | QValueList <OLed> vl; |
1233 | vl << Led_Power; | 1238 | vl << Led_Power; |
1234 | 1239 | ||
1235 | if ( d-> m_model == Model_iPAQ_H38xx ) | 1240 | if ( d-> m_model == Model_iPAQ_H38xx ) |
1236 | vl << Led_BlueTooth; | 1241 | vl << Led_BlueTooth; |
1237 | return vl; | 1242 | return vl; |
1238 | } | 1243 | } |
1239 | 1244 | ||
1240 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 1245 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
1241 | { | 1246 | { |
1242 | QValueList <OLedState> vl; | 1247 | QValueList <OLedState> vl; |
1243 | 1248 | ||
1244 | if ( l == Led_Power ) | 1249 | if ( l == Led_Power ) |
1245 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 1250 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
1246 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) | 1251 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) |
1247 | vl << Led_Off; // << Led_On << ??? | 1252 | vl << Led_Off; // << Led_On << ??? |
1248 | 1253 | ||
1249 | return vl; | 1254 | return vl; |
1250 | } | 1255 | } |
1251 | 1256 | ||
1252 | OLedState iPAQ::ledState ( OLed l ) const | 1257 | OLedState iPAQ::ledState ( OLed l ) const |
1253 | { | 1258 | { |
1254 | switch ( l ) { | 1259 | switch ( l ) { |
1255 | case Led_Power: | 1260 | case Led_Power: |
1256 | return m_leds [0]; | 1261 | return m_leds [0]; |
1257 | case Led_BlueTooth: | 1262 | case Led_BlueTooth: |
1258 | return m_leds [1]; | 1263 | return m_leds [1]; |
1259 | default: | 1264 | default: |
1260 | return Led_Off; | 1265 | return Led_Off; |
1261 | } | 1266 | } |
1262 | } | 1267 | } |
1263 | 1268 | ||
1264 | bool iPAQ::setLedState ( OLed l, OLedState st ) | 1269 | bool iPAQ::setLedState ( OLed l, OLedState st ) |
1265 | { | 1270 | { |
1266 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); | 1271 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); |
1267 | 1272 | ||
1268 | if ( l == Led_Power ) { | 1273 | if ( l == Led_Power ) { |
1269 | if ( fd >= 0 ) { | 1274 | if ( fd >= 0 ) { |
1270 | LED_IN leds; | 1275 | LED_IN leds; |
1271 | ::memset ( &leds, 0, sizeof( leds )); | 1276 | ::memset ( &leds, 0, sizeof( leds )); |
1272 | leds. TotalTime = 0; | 1277 | leds. TotalTime = 0; |
1273 | leds. OnTime = 0; | 1278 | leds. OnTime = 0; |
1274 | leds. OffTime = 1; | 1279 | leds. OffTime = 1; |
1275 | leds. OffOnBlink = 2; | 1280 | leds. OffOnBlink = 2; |
1276 | 1281 | ||
1277 | switch ( st ) { | 1282 | switch ( st ) { |
1278 | case Led_Off : leds. OffOnBlink = 0; break; | 1283 | case Led_Off : leds. OffOnBlink = 0; break; |
1279 | case Led_On : leds. OffOnBlink = 1; break; | 1284 | case Led_On : leds. OffOnBlink = 1; break; |
1280 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 1285 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
1281 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 1286 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
1282 | } | 1287 | } |
1283 | 1288 | ||
1284 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 1289 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
1285 | m_leds [0] = st; | 1290 | m_leds [0] = st; |
1286 | return true; | 1291 | return true; |
1287 | } | 1292 | } |
1288 | } | 1293 | } |
1289 | } | 1294 | } |
1290 | return false; | 1295 | return false; |
1291 | } | 1296 | } |
1292 | 1297 | ||
1293 | 1298 | ||
1294 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 1299 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
1295 | { | 1300 | { |
1296 | int newkeycode = keycode; | 1301 | int newkeycode = keycode; |
1297 | 1302 | ||
1298 | switch ( keycode ) { | 1303 | switch ( keycode ) { |
1299 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 1304 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
1300 | case HardKey_Menu: { | 1305 | case HardKey_Menu: { |
1301 | if (( d-> m_model == Model_iPAQ_H38xx ) || | 1306 | if (( d-> m_model == Model_iPAQ_H38xx ) || |
1302 | ( d-> m_model == Model_iPAQ_H39xx ) || | 1307 | ( d-> m_model == Model_iPAQ_H39xx ) || |
1303 | ( d-> m_model == Model_iPAQ_H5xxx)) { | 1308 | ( d-> m_model == Model_iPAQ_H5xxx)) { |
1304 | newkeycode = HardKey_Mail; | 1309 | newkeycode = HardKey_Mail; |
1305 | } | 1310 | } |
1306 | break; | 1311 | break; |
1307 | } | 1312 | } |
1308 | 1313 | ||
1309 | // Rotate cursor keys 180° | 1314 | // Rotate cursor keys 180° |
1310 | case Key_Left : | 1315 | case Key_Left : |
1311 | case Key_Right: | 1316 | case Key_Right: |
1312 | case Key_Up : | 1317 | case Key_Up : |
1313 | case Key_Down : { | 1318 | case Key_Down : { |
1314 | if (( d-> m_model == Model_iPAQ_H31xx ) || | 1319 | if (( d-> m_model == Model_iPAQ_H31xx ) || |
1315 | ( d-> m_model == Model_iPAQ_H38xx )) { | 1320 | ( d-> m_model == Model_iPAQ_H38xx )) { |
1316 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 1321 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
1317 | } | 1322 | } |
1318 | break; | 1323 | break; |
1319 | } | 1324 | } |
1320 | 1325 | ||
1321 | // map Power Button short/long press to F34/F35 | 1326 | // map Power Button short/long press to F34/F35 |
1322 | case Key_SysReq: { | 1327 | case Key_SysReq: { |
1323 | if ( isPress ) { | 1328 | if ( isPress ) { |
1324 | if ( m_power_timer ) | 1329 | if ( m_power_timer ) |
1325 | killTimer ( m_power_timer ); | 1330 | killTimer ( m_power_timer ); |
1326 | m_power_timer = startTimer ( 500 ); | 1331 | m_power_timer = startTimer ( 500 ); |
1327 | } | 1332 | } |
1328 | else if ( m_power_timer ) { | 1333 | else if ( m_power_timer ) { |
1329 | killTimer ( m_power_timer ); | 1334 | killTimer ( m_power_timer ); |
1330 | m_power_timer = 0; | 1335 | m_power_timer = 0; |
1331 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 1336 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
1332 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 1337 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
1333 | } | 1338 | } |
1334 | newkeycode = Key_unknown; | 1339 | newkeycode = Key_unknown; |
1335 | break; | 1340 | break; |
1336 | } | 1341 | } |
1337 | } | 1342 | } |
1338 | 1343 | ||
1339 | if ( newkeycode != keycode ) { | 1344 | if ( newkeycode != keycode ) { |
1340 | if ( newkeycode != Key_unknown ) | 1345 | if ( newkeycode != Key_unknown ) |
1341 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 1346 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
1342 | return true; | 1347 | return true; |
1343 | } | 1348 | } |
1344 | else | 1349 | else |
1345 | return false; | 1350 | return false; |
1346 | } | 1351 | } |
1347 | 1352 | ||
1348 | void iPAQ::timerEvent ( QTimerEvent * ) | 1353 | void iPAQ::timerEvent ( QTimerEvent * ) |
1349 | { | 1354 | { |
1350 | killTimer ( m_power_timer ); | 1355 | killTimer ( m_power_timer ); |
1351 | m_power_timer = 0; | 1356 | m_power_timer = 0; |
1352 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 1357 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
1353 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 1358 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
1354 | } | 1359 | } |
1355 | 1360 | ||
1356 | 1361 | ||
1357 | void iPAQ::alarmSound ( ) | 1362 | void iPAQ::alarmSound ( ) |
1358 | { | 1363 | { |
1359 | #ifndef QT_NO_SOUND | 1364 | #ifndef QT_NO_SOUND |
1360 | static Sound snd ( "alarm" ); | 1365 | static Sound snd ( "alarm" ); |
1361 | int fd; | 1366 | int fd; |
1362 | int vol; | 1367 | int vol; |
1363 | bool vol_reset = false; | 1368 | bool vol_reset = false; |
1364 | 1369 | ||
1365 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 1370 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
1366 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 1371 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
1367 | Config cfg ( "qpe" ); | 1372 | Config cfg ( "qpe" ); |
1368 | cfg. setGroup ( "Volume" ); | 1373 | cfg. setGroup ( "Volume" ); |
1369 | 1374 | ||
1370 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 1375 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
1371 | if ( volalarm < 0 ) | 1376 | if ( volalarm < 0 ) |
1372 | volalarm = 0; | 1377 | volalarm = 0; |
1373 | else if ( volalarm > 100 ) | 1378 | else if ( volalarm > 100 ) |
1374 | volalarm = 100; | 1379 | volalarm = 100; |
1375 | volalarm |= ( volalarm << 8 ); | 1380 | volalarm |= ( volalarm << 8 ); |
1376 | 1381 | ||
1377 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 1382 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
1378 | vol_reset = true; | 1383 | vol_reset = true; |
1379 | } | 1384 | } |
1380 | } | 1385 | } |
1381 | 1386 | ||
1382 | snd. play ( ); | 1387 | snd. play ( ); |
1383 | while ( !snd. isFinished ( )) | 1388 | while ( !snd. isFinished ( )) |
1384 | qApp-> processEvents ( ); | 1389 | qApp-> processEvents ( ); |
1385 | 1390 | ||
1386 | if ( fd >= 0 ) { | 1391 | if ( fd >= 0 ) { |
1387 | if ( vol_reset ) | 1392 | if ( vol_reset ) |
1388 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 1393 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
1389 | ::close ( fd ); | 1394 | ::close ( fd ); |
1390 | } | 1395 | } |
1391 | #endif | 1396 | #endif |
1392 | } | 1397 | } |
1393 | 1398 | ||
1394 | 1399 | ||
1395 | bool iPAQ::setSoftSuspend ( bool soft ) | 1400 | bool iPAQ::setSoftSuspend ( bool soft ) |
1396 | { | 1401 | { |
1397 | bool res = false; | 1402 | bool res = false; |
1398 | int fd; | 1403 | int fd; |
1399 | 1404 | ||
1400 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 1405 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
1401 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 1406 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
1402 | res = true; | 1407 | res = true; |
1403 | else | 1408 | else |
1404 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 1409 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
1405 | 1410 | ||
1406 | ::close ( fd ); | 1411 | ::close ( fd ); |
1407 | } | 1412 | } |
1408 | else | 1413 | else |
1409 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 1414 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
1410 | 1415 | ||
1411 | return res; | 1416 | return res; |
1412 | } | 1417 | } |
1413 | 1418 | ||
1414 | 1419 | ||
1415 | bool iPAQ::setDisplayBrightness ( int bright ) | 1420 | bool iPAQ::setDisplayBrightness ( int bright ) |
1416 | { | 1421 | { |
1417 | bool res = false; | 1422 | bool res = false; |
1418 | int fd; | 1423 | int fd; |
1419 | 1424 | ||
1420 | if ( bright > 255 ) | 1425 | if ( bright > 255 ) |
1421 | bright = 255; | 1426 | bright = 255; |
1422 | if ( bright < 0 ) | 1427 | if ( bright < 0 ) |
1423 | bright = 0; | 1428 | bright = 0; |
1424 | 1429 | ||
1425 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 1430 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
1426 | FLITE_IN bl; | 1431 | FLITE_IN bl; |
1427 | bl. mode = 1; | 1432 | bl. mode = 1; |
1428 | bl. pwr = bright ? 1 : 0; | 1433 | bl. pwr = bright ? 1 : 0; |
1429 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 1434 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
1430 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 1435 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
1431 | ::close ( fd ); | 1436 | ::close ( fd ); |
1432 | } | 1437 | } |
1433 | return res; | 1438 | return res; |
1434 | } | 1439 | } |
1435 | 1440 | ||
1436 | int iPAQ::displayBrightnessResolution ( ) const | 1441 | int iPAQ::displayBrightnessResolution ( ) const |
1437 | { | 1442 | { |
1438 | switch ( model ( )) { | 1443 | switch ( model ( )) { |
1439 | case Model_iPAQ_H31xx: | 1444 | case Model_iPAQ_H31xx: |
1440 | case Model_iPAQ_H36xx: | 1445 | case Model_iPAQ_H36xx: |
1441 | case Model_iPAQ_H37xx: | 1446 | case Model_iPAQ_H37xx: |
1442 | return 128; // really 256, but >128 could damage the LCD | 1447 | return 128; // really 256, but >128 could damage the LCD |
1443 | 1448 | ||
1444 | case Model_iPAQ_H38xx: | 1449 | case Model_iPAQ_H38xx: |
1445 | case Model_iPAQ_H39xx: | 1450 | case Model_iPAQ_H39xx: |
1446 | return 64; | 1451 | return 64; |
1447 | case Model_iPAQ_H5xxx: | 1452 | case Model_iPAQ_H5xxx: |
1448 | return 255; | 1453 | return 255; |
1449 | 1454 | ||
1450 | default: | 1455 | default: |
1451 | return 2; | 1456 | return 2; |
1452 | } | 1457 | } |
1453 | } | 1458 | } |
1454 | 1459 | ||
1455 | 1460 | ||
1456 | bool iPAQ::hasLightSensor ( ) const | 1461 | bool iPAQ::hasLightSensor ( ) const |
1457 | { | 1462 | { |
1458 | return true; | 1463 | return true; |
1459 | } | 1464 | } |
1460 | 1465 | ||
1461 | int iPAQ::readLightSensor ( ) | 1466 | int iPAQ::readLightSensor ( ) |
1462 | { | 1467 | { |
1463 | int fd; | 1468 | int fd; |
1464 | int val = -1; | 1469 | int val = -1; |
1465 | 1470 | ||
1466 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 1471 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
1467 | char buffer [8]; | 1472 | char buffer [8]; |
1468 | 1473 | ||
1469 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 1474 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
1470 | char *endptr; | 1475 | char *endptr; |
1471 | 1476 | ||
1472 | buffer [4] = 0; | 1477 | buffer [4] = 0; |
1473 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 1478 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
1474 | 1479 | ||
1475 | if ( *endptr != 0 ) | 1480 | if ( *endptr != 0 ) |
1476 | val = -1; | 1481 | val = -1; |
1477 | } | 1482 | } |
1478 | ::close ( fd ); | 1483 | ::close ( fd ); |
1479 | } | 1484 | } |
1480 | 1485 | ||
1481 | return val; | 1486 | return val; |
1482 | } | 1487 | } |
1483 | 1488 | ||
1484 | int iPAQ::lightSensorResolution ( ) const | 1489 | int iPAQ::lightSensorResolution ( ) const |
1485 | { | 1490 | { |
1486 | return 256; | 1491 | return 256; |
1487 | } | 1492 | } |
1488 | 1493 | ||
1489 | /************************************************** | 1494 | /************************************************** |
1490 | * | 1495 | * |
1491 | * Zaurus | 1496 | * Zaurus |
1492 | * | 1497 | * |
1493 | **************************************************/ | 1498 | **************************************************/ |
1494 | 1499 | ||
1495 | // Check whether this device is the sharp zaurus.. | 1500 | // Check whether this device is the sharp zaurus.. |
1496 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 1501 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
1497 | // class up into individual classes. We need three classes | 1502 | // class up into individual classes. We need three classes |
1498 | // | 1503 | // |
1499 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 1504 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
1500 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 1505 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
1501 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860) | 1506 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860) |
1502 | // | 1507 | // |
1503 | // Only question right now is: Do we really need to do it? Because as soon | 1508 | // Only question right now is: Do we really need to do it? Because as soon |
1504 | // as the OpenZaurus kernel is ready, there will be a unified interface for all | 1509 | // as the OpenZaurus kernel is ready, there will be a unified interface for all |
1505 | // Zaurus models (concerning apm, backlight, buttons, etc.) | 1510 | // Zaurus models (concerning apm, backlight, buttons, etc.) |
1506 | // | 1511 | // |
1507 | // Comments? - mickeyl. | 1512 | // Comments? - mickeyl. |
1508 | 1513 | ||
1509 | bool Zaurus::isZaurus() | 1514 | bool Zaurus::isZaurus() |
1510 | { | 1515 | { |
1511 | 1516 | ||
1512 | // If the special devices by embedix exist, it is quite simple: it is a Zaurus ! | 1517 | // If the special devices by embedix exist, it is quite simple: it is a Zaurus ! |
1513 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){ | 1518 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){ |
1514 | return true; | 1519 | return true; |
1515 | } | 1520 | } |
1516 | 1521 | ||
1517 | // On non-embedix kernels, we have to look closer. | 1522 | // On non-embedix kernels, we have to look closer. |
1518 | bool is_zaurus = false; | 1523 | bool is_zaurus = false; |
1519 | QFile f ( "/proc/cpuinfo" ); | 1524 | QFile f ( "/proc/cpuinfo" ); |
1520 | if ( f. open ( IO_ReadOnly ) ) { | 1525 | if ( f. open ( IO_ReadOnly ) ) { |
1521 | QString model; | 1526 | QString model; |
1522 | QFile f ( "/proc/cpuinfo" ); | 1527 | QFile f ( "/proc/cpuinfo" ); |
1523 | 1528 | ||
1524 | QTextStream ts ( &f ); | 1529 | QTextStream ts ( &f ); |
1525 | QString line; | 1530 | QString line; |
1526 | while( line = ts. readLine ( ) ) { | 1531 | while( line = ts. readLine ( ) ) { |
1527 | if ( line. left ( 8 ) == "Hardware" ) | 1532 | if ( line. left ( 8 ) == "Hardware" ) |
1528 | break; | 1533 | break; |
1529 | } | 1534 | } |
1530 | int loc = line. find ( ":" ); | 1535 | int loc = line. find ( ":" ); |
1531 | if ( loc != -1 ) | 1536 | if ( loc != -1 ) |
1532 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 1537 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
1533 | 1538 | ||
1534 | if ( model == "Sharp-Collie" | 1539 | if ( model == "Sharp-Collie" |
1535 | || model == "Collie" | 1540 | || model == "Collie" |
1536 | || model == "SHARP Corgi" | 1541 | || model == "SHARP Corgi" |
1537 | || model == "SHARP Shepherd" | 1542 | || model == "SHARP Shepherd" |
1538 | || model == "SHARP Poodle" | 1543 | || model == "SHARP Poodle" |
1539 | || model == "SHARP Husky" | 1544 | || model == "SHARP Husky" |
1540 | ) | 1545 | ) |
1541 | is_zaurus = true; | 1546 | is_zaurus = true; |
1542 | 1547 | ||
1543 | } | 1548 | } |
1544 | return is_zaurus; | 1549 | return is_zaurus; |
1545 | } | 1550 | } |
1546 | 1551 | ||
1547 | 1552 | ||
1548 | void Zaurus::init ( ) | 1553 | void Zaurus::init ( ) |
1549 | { | 1554 | { |
1550 | d-> m_vendorstr = "Sharp"; | 1555 | d-> m_vendorstr = "Sharp"; |
1551 | d-> m_vendor = Vendor_Sharp; | 1556 | d-> m_vendor = Vendor_Sharp; |
1552 | m_embedix = true; // Not openzaurus means: It has an embedix kernel ! | 1557 | m_embedix = true; // Not openzaurus means: It has an embedix kernel ! |
1553 | 1558 | ||
1554 | // QFile f ( "/proc/filesystems" ); | 1559 | // QFile f ( "/proc/filesystems" ); |
1555 | QString model; | 1560 | QString model; |
1556 | 1561 | ||
1557 | // It isn't a good idea to check the system configuration to | 1562 | // It isn't a good idea to check the system configuration to |
1558 | // detect the distribution ! | 1563 | // detect the distribution ! |
1559 | // Otherwise it may happen that any other distribution is detected as openzaurus, just | 1564 | // Otherwise it may happen that any other distribution is detected as openzaurus, just |
1560 | // because it uses a jffs2 filesystem.. | 1565 | // because it uses a jffs2 filesystem.. |
1561 | // (eilers) | 1566 | // (eilers) |
1562 | // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 1567 | // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
1563 | QFile f ("/etc/oz_version"); | 1568 | QFile f ("/etc/oz_version"); |
1564 | if ( f.exists() ){ | 1569 | if ( f.exists() ){ |
1565 | d-> m_vendorstr = "OpenZaurus Team"; | 1570 | d-> m_vendorstr = "OpenZaurus Team"; |
1566 | d-> m_systemstr = "OpenZaurus"; | 1571 | d-> m_systemstr = "OpenZaurus"; |
1567 | d-> m_system = System_OpenZaurus; | 1572 | d-> m_system = System_OpenZaurus; |
1568 | 1573 | ||
1569 | if ( f. open ( IO_ReadOnly )) { | 1574 | if ( f. open ( IO_ReadOnly )) { |
1570 | QTextStream ts ( &f ); | 1575 | QTextStream ts ( &f ); |
1571 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); | 1576 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); |
1572 | f. close ( ); | 1577 | f. close ( ); |
1573 | } | 1578 | } |
1574 | 1579 | ||
1575 | // Openzaurus sometimes uses the embedix kernel! | 1580 | // Openzaurus sometimes uses the embedix kernel! |
1576 | // => Check whether this is an embedix kernel | 1581 | // => Check whether this is an embedix kernel |
1577 | FILE *uname = popen("uname -r", "r"); | 1582 | FILE *uname = popen("uname -r", "r"); |
1578 | QString line; | 1583 | QString line; |
1579 | if ( f.open(IO_ReadOnly, uname) ) { | 1584 | if ( f.open(IO_ReadOnly, uname) ) { |
1580 | QTextStream ts ( &f ); | 1585 | QTextStream ts ( &f ); |
1581 | line = ts. readLine ( ); | 1586 | line = ts. readLine ( ); |
1582 | int loc = line. find ( "embedix" ); | 1587 | int loc = line. find ( "embedix" ); |
1583 | if ( loc != -1 ) | 1588 | if ( loc != -1 ) |
1584 | m_embedix = true; | 1589 | m_embedix = true; |
1585 | else | 1590 | else |
1586 | m_embedix = false; | 1591 | m_embedix = false; |
1587 | f. close ( ); | 1592 | f. close ( ); |
1588 | } | 1593 | } |
1589 | pclose(uname); | 1594 | pclose(uname); |
1590 | } | 1595 | } |
1591 | else { | 1596 | else { |
1592 | d-> m_systemstr = "Zaurus"; | 1597 | d-> m_systemstr = "Zaurus"; |
1593 | d-> m_system = System_Zaurus; | 1598 | d-> m_system = System_Zaurus; |
1594 | } | 1599 | } |
1595 | 1600 | ||
1596 | f. setName ( "/proc/cpuinfo" ); | 1601 | f. setName ( "/proc/cpuinfo" ); |
1597 | if ( f. open ( IO_ReadOnly ) ) { | 1602 | if ( f. open ( IO_ReadOnly ) ) { |
1598 | QTextStream ts ( &f ); | 1603 | QTextStream ts ( &f ); |
1599 | QString line; | 1604 | QString line; |
1600 | while( line = ts. readLine ( ) ) { | 1605 | while( line = ts. readLine ( ) ) { |
1601 | if ( line. left ( 8 ) == "Hardware" ) | 1606 | if ( line. left ( 8 ) == "Hardware" ) |
1602 | break; | 1607 | break; |
1603 | } | 1608 | } |
1604 | int loc = line. find ( ":" ); | 1609 | int loc = line. find ( ":" ); |
1605 | if ( loc != -1 ) | 1610 | if ( loc != -1 ) |
1606 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 1611 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
1607 | } | 1612 | } |
1608 | 1613 | ||
1609 | if ( model == "SHARP Corgi" ) { | 1614 | if ( model == "SHARP Corgi" ) { |
1610 | d-> m_model = Model_Zaurus_SLC7x0; | 1615 | d-> m_model = Model_Zaurus_SLC7x0; |
1611 | d-> m_modelstr = "Zaurus SL-C700"; | 1616 | d-> m_modelstr = "Zaurus SL-C700"; |
1612 | } else if ( model == "SHARP Shepherd" ) { | 1617 | } else if ( model == "SHARP Shepherd" ) { |
1613 | d-> m_model = Model_Zaurus_SLC7x0; | 1618 | d-> m_model = Model_Zaurus_SLC7x0; |
1614 | d-> m_modelstr = "Zaurus SL-C750"; | 1619 | d-> m_modelstr = "Zaurus SL-C750"; |
1615 | } else if ( model == "SHARP Husky" ) { | 1620 | } else if ( model == "SHARP Husky" ) { |
1616 | d-> m_model = Model_Zaurus_SLC7x0; | 1621 | d-> m_model = Model_Zaurus_SLC7x0; |
1617 | d-> m_modelstr = "Zaurus SL-C760"; | 1622 | d-> m_modelstr = "Zaurus SL-C760"; |
1618 | } else if ( model == "SHARP Poodle" ) { | 1623 | } else if ( model == "SHARP Poodle" ) { |
1619 | d-> m_model = Model_Zaurus_SLB600; | 1624 | d-> m_model = Model_Zaurus_SLB600; |
1620 | d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; | 1625 | d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; |
1621 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 1626 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
1622 | d-> m_model = Model_Zaurus_SL5500; | 1627 | d-> m_model = Model_Zaurus_SL5500; |
1623 | d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 1628 | d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
1624 | } else { | 1629 | } else { |
1625 | d-> m_model = Model_Zaurus_SL5500; | 1630 | d-> m_model = Model_Zaurus_SL5500; |
1626 | d-> m_modelstr = "Zaurus (Model unknown)"; | 1631 | d-> m_modelstr = "Zaurus (Model unknown)"; |
1627 | } | 1632 | } |
1628 | 1633 | ||
1629 | bool flipstate = false; | 1634 | bool flipstate = false; |
1630 | switch ( d-> m_model ) { | 1635 | switch ( d-> m_model ) { |
1631 | case Model_Zaurus_SLA300: | 1636 | case Model_Zaurus_SLA300: |
1632 | d-> m_rotation = Rot0; | 1637 | d-> m_rotation = Rot0; |
1633 | break; | 1638 | break; |
1634 | case Model_Zaurus_SLC7x0: | 1639 | case Model_Zaurus_SLC7x0: |
1635 | // Note: need to 1) set flipstate based on physical screen orientation | 1640 | d-> m_rotation = rotation(); |
1636 | // and 2) check to see if the user overrode the rotation direction | 1641 | d-> m_direction = direction(); |
1637 | // using appearance, and if so, remove that item from the Config to | ||
1638 | // ensure the rotate applet flips us back to the previous state. | ||
1639 | // treke said he has patches for detecting the phys. so where are they, treke? -mickeyl. | ||
1640 | if ( flipstate ) { | ||
1641 | // 480x640 | ||
1642 | d-> m_rotation = Rot0; | ||
1643 | d-> m_direction = CW; | ||
1644 | } else { | ||
1645 | // 640x480 | ||
1646 | d-> m_rotation = Rot270; | ||
1647 | d-> m_direction = CCW; | ||
1648 | } | ||
1649 | break; | 1642 | break; |
1650 | case Model_Zaurus_SLB600: | 1643 | case Model_Zaurus_SLB600: |
1651 | case Model_Zaurus_SL5500: | 1644 | case Model_Zaurus_SL5500: |
1652 | case Model_Zaurus_SL5000: | 1645 | case Model_Zaurus_SL5000: |
1653 | default: | 1646 | default: |
1654 | d-> m_rotation = Rot270; | 1647 | d-> m_rotation = Rot270; |
1655 | break; | 1648 | break; |
1656 | } | 1649 | } |
1657 | m_leds [0] = Led_Off; | 1650 | m_leds [0] = Led_Off; |
1658 | } | 1651 | } |
1659 | 1652 | ||
1660 | void Zaurus::initButtons ( ) | 1653 | void Zaurus::initButtons ( ) |
1661 | { | 1654 | { |
1662 | if ( d-> m_buttons ) | 1655 | if ( d-> m_buttons ) |
1663 | return; | 1656 | return; |
1664 | 1657 | ||
1665 | d-> m_buttons = new QValueList <ODeviceButton>; | 1658 | d-> m_buttons = new QValueList <ODeviceButton>; |
1666 | 1659 | ||
1667 | struct z_button * pz_buttons; | 1660 | struct z_button * pz_buttons; |
1668 | int buttoncount; | 1661 | int buttoncount; |
1669 | switch ( d-> m_model ) { | 1662 | switch ( d-> m_model ) { |
1670 | case Model_Zaurus_SLC7x0: | 1663 | case Model_Zaurus_SLC7x0: |
1671 | pz_buttons = z_buttons_c700; | 1664 | pz_buttons = z_buttons_c700; |
1672 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 1665 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
1673 | break; | 1666 | break; |
1674 | default: | 1667 | default: |
1675 | pz_buttons = z_buttons; | 1668 | pz_buttons = z_buttons; |
1676 | buttoncount = ARRAY_SIZE(z_buttons); | 1669 | buttoncount = ARRAY_SIZE(z_buttons); |
1677 | break; | 1670 | break; |
1678 | } | 1671 | } |
1679 | 1672 | ||
1680 | for ( int i = 0; i < buttoncount; i++ ) { | 1673 | for ( int i = 0; i < buttoncount; i++ ) { |
1681 | struct z_button *zb = pz_buttons + i; | 1674 | struct z_button *zb = pz_buttons + i; |
1682 | ODeviceButton b; | 1675 | ODeviceButton b; |
1683 | 1676 | ||
1684 | b. setKeycode ( zb-> code ); | 1677 | b. setKeycode ( zb-> code ); |
1685 | b. setUserText ( QObject::tr ( "Button", zb-> utext )); | 1678 | b. setUserText ( QObject::tr ( "Button", zb-> utext )); |
1686 | b. setPixmap ( Resource::loadPixmap ( zb-> pix )); | 1679 | b. setPixmap ( Resource::loadPixmap ( zb-> pix )); |
1687 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), | 1680 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), |
1688 | zb-> fpressedaction )); | 1681 | zb-> fpressedaction )); |
1689 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), | 1682 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), |
1690 | zb-> fheldaction )); | 1683 | zb-> fheldaction )); |
1691 | 1684 | ||
1692 | d-> m_buttons-> append ( b ); | 1685 | d-> m_buttons-> append ( b ); |
1693 | } | 1686 | } |
1694 | 1687 | ||
1695 | reloadButtonMapping ( ); | 1688 | reloadButtonMapping ( ); |
1696 | 1689 | ||
1697 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1690 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
1698 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), | 1691 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), |
1699 | this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 1692 | this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
1700 | } | 1693 | } |
1701 | 1694 | ||
1702 | #include <unistd.h> | 1695 | #include <unistd.h> |
1703 | #include <fcntl.h> | 1696 | #include <fcntl.h> |
1704 | #include <sys/ioctl.h> | 1697 | #include <sys/ioctl.h> |
1705 | 1698 | ||
1706 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 1699 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
1707 | 1700 | ||
1708 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 1701 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
1709 | 1702 | ||
1710 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1703 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1711 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 1704 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
1712 | 1705 | ||
1713 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 1706 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
1714 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 1707 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
1715 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 1708 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
1716 | 1709 | ||
1717 | /* --- for SHARP_BUZZER device --- */ | 1710 | /* --- for SHARP_BUZZER device --- */ |
1718 | 1711 | ||
1719 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1712 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1720 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 1713 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
1721 | 1714 | ||
1722 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 1715 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
1723 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 1716 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
1724 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 1717 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
1725 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 1718 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
1726 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 1719 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
1727 | 1720 | ||
1728 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 1721 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
1729 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 1722 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
1730 | 1723 | ||
1731 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 1724 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
1732 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 1725 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
1733 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 1726 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
1734 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 1727 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
1735 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 1728 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
1736 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 1729 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
1737 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 1730 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
1738 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 1731 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
1739 | 1732 | ||
1740 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 1733 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
1741 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 1734 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
1742 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 1735 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
1743 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 1736 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
1744 | // | 1737 | // |
1745 | 1738 | ||
1746 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1739 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1747 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 1740 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
1748 | 1741 | ||
1742 | #define SHARP_IOCTL_GET_ROTATION 0x413c | ||
1743 | |||
1749 | typedef struct sharp_led_status { | 1744 | typedef struct sharp_led_status { |
1750 | int which; /* select which LED status is wanted. */ | 1745 | int which; /* select which LED status is wanted. */ |
1751 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 1746 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
1752 | } sharp_led_status; | 1747 | } sharp_led_status; |
1753 | 1748 | ||
1754 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 1749 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
1755 | 1750 | ||
1756 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 1751 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
1757 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 1752 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
1758 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 1753 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
1759 | 1754 | ||
1760 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 1755 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
1761 | 1756 | ||
1762 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 1757 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
1763 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 1758 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
1764 | #define APM_EVT_POWER_BUTTON (1 << 0) | 1759 | #define APM_EVT_POWER_BUTTON (1 << 0) |
1765 | 1760 | ||
1766 | #define FL_IOCTL_STEP_CONTRAST 100 | 1761 | #define FL_IOCTL_STEP_CONTRAST 100 |
1767 | 1762 | ||
1768 | 1763 | ||
1769 | void Zaurus::buzzer ( int sound ) | 1764 | void Zaurus::buzzer ( int sound ) |
1770 | { | 1765 | { |
1771 | #ifndef QT_NO_SOUND | 1766 | #ifndef QT_NO_SOUND |
1772 | QString soundname; | 1767 | QString soundname; |
1773 | 1768 | ||
1774 | // Not all devices have real sound | 1769 | // Not all devices have real sound |
1775 | if ( d->m_model == Model_Zaurus_SLC7x0 | 1770 | if ( d->m_model == Model_Zaurus_SLC7x0 |
1776 | || d->m_model == Model_Zaurus_SLB600 ){ | 1771 | || d->m_model == Model_Zaurus_SLB600 ){ |
1777 | 1772 | ||
1778 | switch ( sound ){ | 1773 | switch ( sound ){ |
1779 | case SHARP_BUZ_SCHEDULE_ALARM: | 1774 | case SHARP_BUZ_SCHEDULE_ALARM: |
1780 | soundname = "alarm"; | 1775 | soundname = "alarm"; |
1781 | break; | 1776 | break; |
1782 | case SHARP_BUZ_TOUCHSOUND: | 1777 | case SHARP_BUZ_TOUCHSOUND: |
1783 | soundname = "touchsound"; | 1778 | soundname = "touchsound"; |
1784 | break; | 1779 | break; |
1785 | case SHARP_BUZ_KEYSOUND: | 1780 | case SHARP_BUZ_KEYSOUND: |
1786 | soundname = "keysound"; | 1781 | soundname = "keysound"; |
1787 | break; | 1782 | break; |
1788 | default: | 1783 | default: |
1789 | soundname = "alarm"; | 1784 | soundname = "alarm"; |
1790 | 1785 | ||
1791 | } | 1786 | } |
1792 | } | 1787 | } |
1793 | 1788 | ||
1794 | // If a soundname is defined, we expect that this device has | 1789 | // If a soundname is defined, we expect that this device has |
1795 | // sound capabilities.. Otherwise we expect to have the buzzer | 1790 | // sound capabilities.. Otherwise we expect to have the buzzer |
1796 | // device.. | 1791 | // device.. |
1797 | if ( !soundname.isEmpty() ){ | 1792 | if ( !soundname.isEmpty() ){ |
1798 | int fd; | 1793 | int fd; |
1799 | int vol; | 1794 | int vol; |
1800 | bool vol_reset = false; | 1795 | bool vol_reset = false; |
1801 | 1796 | ||
1802 | Sound snd ( soundname ); | 1797 | Sound snd ( soundname ); |
1803 | 1798 | ||
1804 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 1799 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
1805 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 1800 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
1806 | Config cfg ( "qpe" ); | 1801 | Config cfg ( "qpe" ); |
1807 | cfg. setGroup ( "Volume" ); | 1802 | cfg. setGroup ( "Volume" ); |
1808 | 1803 | ||
1809 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 1804 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
1810 | if ( volalarm < 0 ) | 1805 | if ( volalarm < 0 ) |
1811 | volalarm = 0; | 1806 | volalarm = 0; |
1812 | else if ( volalarm > 100 ) | 1807 | else if ( volalarm > 100 ) |
1813 | volalarm = 100; | 1808 | volalarm = 100; |
1814 | volalarm |= ( volalarm << 8 ); | 1809 | volalarm |= ( volalarm << 8 ); |
1815 | 1810 | ||
1816 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 1811 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
1817 | vol_reset = true; | 1812 | vol_reset = true; |
1818 | } | 1813 | } |
1819 | } | 1814 | } |
1820 | 1815 | ||
1821 | snd. play ( ); | 1816 | snd. play ( ); |
1822 | while ( !snd. isFinished ( )) | 1817 | while ( !snd. isFinished ( )) |
1823 | qApp-> processEvents ( ); | 1818 | qApp-> processEvents ( ); |
1824 | 1819 | ||
1825 | if ( fd >= 0 ) { | 1820 | if ( fd >= 0 ) { |
1826 | if ( vol_reset ) | 1821 | if ( vol_reset ) |
1827 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 1822 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
1828 | ::close ( fd ); | 1823 | ::close ( fd ); |
1829 | } | 1824 | } |
1830 | } else { | 1825 | } else { |
1831 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 1826 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
1832 | 1827 | ||
1833 | if ( fd >= 0 ) { | 1828 | if ( fd >= 0 ) { |
1834 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 1829 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
1835 | ::close ( fd ); | 1830 | ::close ( fd ); |
1836 | } | 1831 | } |
1837 | 1832 | ||
1838 | } | 1833 | } |
1839 | #endif | 1834 | #endif |
1840 | } | 1835 | } |
1841 | 1836 | ||
1842 | 1837 | ||
1843 | void Zaurus::alarmSound ( ) | 1838 | void Zaurus::alarmSound ( ) |
1844 | { | 1839 | { |
1845 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 1840 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
1846 | } | 1841 | } |
1847 | 1842 | ||
1848 | void Zaurus::touchSound ( ) | 1843 | void Zaurus::touchSound ( ) |
1849 | { | 1844 | { |
1850 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 1845 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
1851 | } | 1846 | } |
1852 | 1847 | ||
1853 | void Zaurus::keySound ( ) | 1848 | void Zaurus::keySound ( ) |
1854 | { | 1849 | { |
1855 | buzzer ( SHARP_BUZ_KEYSOUND ); | 1850 | buzzer ( SHARP_BUZ_KEYSOUND ); |
1856 | } | 1851 | } |
1857 | 1852 | ||
1858 | 1853 | ||
1859 | QValueList <OLed> Zaurus::ledList ( ) const | 1854 | QValueList <OLed> Zaurus::ledList ( ) const |
1860 | { | 1855 | { |
1861 | QValueList <OLed> vl; | 1856 | QValueList <OLed> vl; |
1862 | vl << Led_Mail; | 1857 | vl << Led_Mail; |
1863 | return vl; | 1858 | return vl; |
1864 | } | 1859 | } |
1865 | 1860 | ||
1866 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | 1861 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const |
1867 | { | 1862 | { |
1868 | QValueList <OLedState> vl; | 1863 | QValueList <OLedState> vl; |
1869 | 1864 | ||
1870 | if ( l == Led_Mail ) | 1865 | if ( l == Led_Mail ) |
1871 | vl << Led_Off << Led_On << Led_BlinkSlow; | 1866 | vl << Led_Off << Led_On << Led_BlinkSlow; |
1872 | return vl; | 1867 | return vl; |
1873 | } | 1868 | } |
1874 | 1869 | ||
1875 | OLedState Zaurus::ledState ( OLed which ) const | 1870 | OLedState Zaurus::ledState ( OLed which ) const |
1876 | { | 1871 | { |
1877 | if ( which == Led_Mail ) | 1872 | if ( which == Led_Mail ) |
1878 | return m_leds [0]; | 1873 | return m_leds [0]; |
1879 | else | 1874 | else |
1880 | return Led_Off; | 1875 | return Led_Off; |
1881 | } | 1876 | } |
1882 | 1877 | ||
1883 | bool Zaurus::setLedState ( OLed which, OLedState st ) | 1878 | bool Zaurus::setLedState ( OLed which, OLedState st ) |
1884 | { | 1879 | { |
1885 | if (!m_embedix) // Currently not supported on non_embedix kernels | 1880 | if (!m_embedix) // Currently not supported on non_embedix kernels |
1886 | return false; | 1881 | return false; |
1887 | 1882 | ||
1888 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 1883 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
1889 | 1884 | ||
1890 | if ( which == Led_Mail ) { | 1885 | if ( which == Led_Mail ) { |
1891 | if ( fd >= 0 ) { | 1886 | if ( fd >= 0 ) { |
1892 | struct sharp_led_status leds; | 1887 | struct sharp_led_status leds; |
1893 | ::memset ( &leds, 0, sizeof( leds )); | 1888 | ::memset ( &leds, 0, sizeof( leds )); |
1894 | leds. which = SHARP_LED_MAIL_EXISTS; | 1889 | leds. which = SHARP_LED_MAIL_EXISTS; |
1895 | bool ok = true; | 1890 | bool ok = true; |
1896 | 1891 | ||
1897 | switch ( st ) { | 1892 | switch ( st ) { |
1898 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 1893 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
1899 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 1894 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
1900 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 1895 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
1901 | default : ok = false; | 1896 | default : ok = false; |
1902 | } | 1897 | } |
1903 | 1898 | ||
1904 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 1899 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
1905 | m_leds [0] = st; | 1900 | m_leds [0] = st; |
1906 | return true; | 1901 | return true; |
1907 | } | 1902 | } |
1908 | } | 1903 | } |
1909 | } | 1904 | } |
1910 | return false; | 1905 | return false; |
1911 | } | 1906 | } |
1912 | 1907 | ||
1913 | bool Zaurus::setSoftSuspend ( bool soft ) | 1908 | bool Zaurus::setSoftSuspend ( bool soft ) |
1914 | { | 1909 | { |
1915 | if (!m_embedix) { | 1910 | if (!m_embedix) { |
1916 | /* non-Embedix kernels dont have kernel autosuspend */ | 1911 | /* non-Embedix kernels dont have kernel autosuspend */ |
1917 | return ODevice::setSoftSuspend( soft ); | 1912 | return ODevice::setSoftSuspend( soft ); |
1918 | } | 1913 | } |
1919 | 1914 | ||
1920 | bool res = false; | 1915 | bool res = false; |
1921 | int fd; | 1916 | int fd; |
1922 | 1917 | ||
1923 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | 1918 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || |
1924 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | 1919 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { |
1925 | 1920 | ||
1926 | int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources | 1921 | int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources |
1927 | 1922 | ||
1928 | if ( sources >= 0 ) { | 1923 | if ( sources >= 0 ) { |
1929 | if ( soft ) | 1924 | if ( soft ) |
1930 | sources &= ~APM_EVT_POWER_BUTTON; | 1925 | sources &= ~APM_EVT_POWER_BUTTON; |
1931 | else | 1926 | else |
1932 | sources |= APM_EVT_POWER_BUTTON; | 1927 | sources |= APM_EVT_POWER_BUTTON; |
1933 | 1928 | ||
1934 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources | 1929 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources |
1935 | res = true; | 1930 | res = true; |
1936 | else | 1931 | else |
1937 | perror ( "APM_IOCGEVTSRC" ); | 1932 | perror ( "APM_IOCGEVTSRC" ); |
1938 | } | 1933 | } |
1939 | else | 1934 | else |
1940 | perror ( "APM_IOCGEVTSRC" ); | 1935 | perror ( "APM_IOCGEVTSRC" ); |
1941 | 1936 | ||
1942 | ::close ( fd ); | 1937 | ::close ( fd ); |
1943 | } | 1938 | } |
1944 | else | 1939 | else |
1945 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); | 1940 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); |
1946 | 1941 | ||
1947 | return res; | 1942 | return res; |
1948 | } | 1943 | } |
1949 | 1944 | ||
1950 | 1945 | ||
1951 | bool Zaurus::setDisplayBrightness ( int bright ) | 1946 | bool Zaurus::setDisplayBrightness ( int bright ) |
1952 | { | 1947 | { |
1953 | // FIXME The C7x0 have a proc-interface (/proc/drivers/corgi-bl) which | 1948 | // FIXME The C7x0 have a proc-interface (/proc/drivers/corgi-bl) which |
1954 | // is nice to use. Currently it exposes 16+1 levels. Implement this! | 1949 | // is nice to use. Currently it exposes 16+1 levels. Implement this! |
1955 | // (or wait for kergoth unifying the interfaces in the OpenZaurus kernel.) | 1950 | // (or wait for kergoth unifying the interfaces in the OpenZaurus kernel.) |
1956 | bool res = false; | 1951 | bool res = false; |
1957 | int fd; | 1952 | int fd; |
1958 | 1953 | ||
1959 | if ( bright > 255 ) | 1954 | if ( bright > 255 ) |
1960 | bright = 255; | 1955 | bright = 255; |
1961 | if ( bright < 0 ) | 1956 | if ( bright < 0 ) |
1962 | bright = 0; | 1957 | bright = 0; |
1963 | 1958 | ||
1964 | if (m_embedix) { | 1959 | if (m_embedix) { |
1965 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { | 1960 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { |
1966 | int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus | 1961 | int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus |
1967 | if ( bright && !bl ) | 1962 | if ( bright && !bl ) |
1968 | bl = 1; | 1963 | bl = 1; |
1969 | res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); | 1964 | res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); |
1970 | ::close ( fd ); | 1965 | ::close ( fd ); |
1971 | } | 1966 | } |
1972 | } else { | 1967 | } else { |
1973 | #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ | 1968 | #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ |
1974 | if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { | 1969 | if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { |
1975 | res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); | 1970 | res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); |
1976 | ::close ( fd ); | 1971 | ::close ( fd ); |
1977 | } | 1972 | } |
1978 | } | 1973 | } |
1979 | return res; | 1974 | return res; |
1980 | } | 1975 | } |
1981 | 1976 | ||
1977 | bool Zaurus::suspend ( ) | ||
1978 | { | ||
1979 | qDebug("ODevice::suspend"); | ||
1980 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
1981 | return false; | ||
1982 | |||
1983 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | ||
1984 | return false; | ||
1985 | |||
1986 | bool res = false; | ||
1987 | |||
1988 | struct timeval tvs, tvn; | ||
1989 | ::gettimeofday ( &tvs, 0 ); | ||
1990 | |||
1991 | ::sync ( ); // flush fs caches | ||
1992 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
1993 | |||
1994 | // This is needed because the iPAQ apm implementation is asynchronous and we | ||
1995 | // can not be sure when exactly the device is really suspended | ||
1996 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | ||
1997 | |||
1998 | if ( res ) { | ||
1999 | do { // Yes, wait 15 seconds. This APM bug sucks big time. | ||
2000 | ::usleep ( 200 * 1000 ); | ||
2001 | ::gettimeofday ( &tvn, 0 ); | ||
2002 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); | ||
2003 | } | ||
2004 | |||
2005 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); | ||
2006 | return res; | ||
2007 | } | ||
2008 | |||
2009 | |||
2010 | Transformation Zaurus::rotation ( ) const | ||
2011 | { | ||
2012 | Transformation rot; | ||
2013 | int handle = 0; | ||
2014 | int retval = 0; | ||
2015 | |||
2016 | switch ( d-> m_model ) { | ||
2017 | case Model_Zaurus_SLC7x0: | ||
2018 | handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); | ||
2019 | if (handle == -1) { | ||
2020 | return Rot270; | ||
2021 | } else { | ||
2022 | retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); | ||
2023 | ::close (handle); | ||
2024 | |||
2025 | if (retval == 2 ) | ||
2026 | rot = Rot0; | ||
2027 | else | ||
2028 | rot = Rot270; | ||
2029 | } | ||
2030 | break; | ||
2031 | case Model_Zaurus_SLA300: | ||
2032 | case Model_Zaurus_SLB600: | ||
2033 | case Model_Zaurus_SL5500: | ||
2034 | case Model_Zaurus_SL5000: | ||
2035 | default: | ||
2036 | rot = d-> m_rotation; | ||
2037 | break; | ||
2038 | } | ||
2039 | |||
2040 | return rot; | ||
2041 | } | ||
2042 | ODirection Zaurus::direction ( ) const | ||
2043 | { | ||
2044 | ODirection dir; | ||
2045 | int handle = 0; | ||
2046 | int retval = 0; | ||
2047 | switch ( d-> m_model ) { | ||
2048 | case Model_Zaurus_SLC7x0: | ||
2049 | handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); | ||
2050 | if (handle == -1) { | ||
2051 | dir = Rot270; | ||
2052 | } else { | ||
2053 | retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); | ||
2054 | ::close (handle); | ||
2055 | if (retval == 2 ) | ||
2056 | dir = CCW; | ||
2057 | else | ||
2058 | dir = CW; | ||
2059 | } | ||
2060 | break; | ||
2061 | case Model_Zaurus_SLA300: | ||
2062 | case Model_Zaurus_SLB600: | ||
2063 | case Model_Zaurus_SL5500: | ||
2064 | case Model_Zaurus_SL5000: | ||
2065 | default: | ||
2066 | dir = d-> m_direction; | ||
2067 | break; | ||
2068 | } | ||
2069 | return dir; | ||
2070 | |||
2071 | } | ||
1982 | 2072 | ||
1983 | int Zaurus::displayBrightnessResolution ( ) const | 2073 | int Zaurus::displayBrightnessResolution ( ) const |
1984 | { | 2074 | { |
1985 | if (m_embedix) | 2075 | if (m_embedix) |
1986 | return 5; | 2076 | return 5; |
1987 | else | 2077 | else |
1988 | return 256; | 2078 | return 256; |
1989 | } | 2079 | } |
1990 | 2080 | ||
1991 | /************************************************** | 2081 | /************************************************** |
1992 | * | 2082 | * |
1993 | * SIMpad | 2083 | * SIMpad |
1994 | * | 2084 | * |
1995 | **************************************************/ | 2085 | **************************************************/ |
1996 | 2086 | ||
1997 | void SIMpad::init ( ) | 2087 | void SIMpad::init ( ) |
1998 | { | 2088 | { |
1999 | d-> m_vendorstr = "SIEMENS"; | 2089 | d-> m_vendorstr = "SIEMENS"; |
2000 | d-> m_vendor = Vendor_SIEMENS; | 2090 | d-> m_vendor = Vendor_SIEMENS; |
2001 | 2091 | ||
2002 | QFile f ( "/proc/hal/model" ); | 2092 | QFile f ( "/proc/hal/model" ); |
2003 | 2093 | ||
2004 | //TODO Implement model checking | 2094 | //TODO Implement model checking |
2005 | //FIXME For now we assume an SL4 | 2095 | //FIXME For now we assume an SL4 |
2006 | 2096 | ||
2007 | d-> m_modelstr = "SL4"; | 2097 | d-> m_modelstr = "SL4"; |
2008 | d-> m_model = Model_SIMpad_SL4; | 2098 | d-> m_model = Model_SIMpad_SL4; |
2009 | 2099 | ||
2010 | switch ( d-> m_model ) { | 2100 | switch ( d-> m_model ) { |
2011 | default: | 2101 | default: |
2012 | d-> m_rotation = Rot0; | 2102 | d-> m_rotation = Rot0; |
2013 | d-> m_direction = CCW; | 2103 | d-> m_direction = CCW; |
2014 | d-> m_holdtime = 1000; // 1000ms | 2104 | d-> m_holdtime = 1000; // 1000ms |
2015 | 2105 | ||
2016 | break; | 2106 | break; |
2017 | } | 2107 | } |
2018 | 2108 | ||
2019 | f. setName ( "/etc/familiar-version" ); | 2109 | f. setName ( "/etc/familiar-version" ); |
2020 | if ( f. open ( IO_ReadOnly )) { | 2110 | if ( f. open ( IO_ReadOnly )) { |
2021 | d-> m_systemstr = "Familiar"; | 2111 | d-> m_systemstr = "Familiar"; |
2022 | d-> m_system = System_Familiar; | 2112 | d-> m_system = System_Familiar; |
2023 | 2113 | ||
2024 | QTextStream ts ( &f ); | 2114 | QTextStream ts ( &f ); |
2025 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 2115 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
2026 | 2116 | ||
2027 | f. close ( ); | 2117 | f. close ( ); |
2028 | } else { | 2118 | } else { |
2029 | f. setName ( "/etc/oz_version" ); | 2119 | f. setName ( "/etc/oz_version" ); |
2030 | 2120 | ||
2031 | if ( f. open ( IO_ReadOnly )) { | 2121 | if ( f. open ( IO_ReadOnly )) { |
2032 | d-> m_systemstr = "OpenEmbedded/SIMpad"; | 2122 | d-> m_systemstr = "OpenEmbedded/SIMpad"; |
2033 | d-> m_system = System_OpenZaurus; | 2123 | d-> m_system = System_OpenZaurus; |
2034 | 2124 | ||
2035 | QTextStream ts ( &f ); | 2125 | QTextStream ts ( &f ); |
2036 | ts.setDevice ( &f ); | 2126 | ts.setDevice ( &f ); |
2037 | d-> m_sysverstr = ts. readLine ( ); | 2127 | d-> m_sysverstr = ts. readLine ( ); |
2038 | f. close ( ); | 2128 | f. close ( ); |
2039 | } | 2129 | } |
2040 | } | 2130 | } |
2041 | 2131 | ||
2042 | m_leds [0] = m_leds [1] = Led_Off; | 2132 | m_leds [0] = m_leds [1] = Led_Off; |
2043 | 2133 | ||
2044 | m_power_timer = 0; | 2134 | m_power_timer = 0; |
2045 | 2135 | ||
2046 | } | 2136 | } |
2047 | 2137 | ||
2048 | void SIMpad::initButtons ( ) | 2138 | void SIMpad::initButtons ( ) |
2049 | { | 2139 | { |
2050 | if ( d-> m_buttons ) | 2140 | if ( d-> m_buttons ) |
2051 | return; | 2141 | return; |
2052 | 2142 | ||
2053 | if ( isQWS( ) ) | 2143 | if ( isQWS( ) ) |
2054 | QWSServer::setKeyboardFilter ( this ); | 2144 | QWSServer::setKeyboardFilter ( this ); |
2055 | 2145 | ||
2056 | d-> m_buttons = new QValueList <ODeviceButton>; | 2146 | d-> m_buttons = new QValueList <ODeviceButton>; |
2057 | 2147 | ||
2058 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 2148 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { |
2059 | s_button *sb = simpad_buttons + i; | 2149 | s_button *sb = simpad_buttons + i; |
2060 | ODeviceButton b; | 2150 | ODeviceButton b; |
2061 | 2151 | ||
2062 | if (( sb-> model & d-> m_model ) == d-> m_model ) { | 2152 | if (( sb-> model & d-> m_model ) == d-> m_model ) { |
2063 | b. setKeycode ( sb-> code ); | 2153 | b. setKeycode ( sb-> code ); |
2064 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); | 2154 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); |
2065 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); | 2155 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); |
2066 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); | 2156 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); |
2067 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); | 2157 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); |
2068 | 2158 | ||
2069 | d-> m_buttons-> append ( b ); | 2159 | d-> m_buttons-> append ( b ); |
2070 | } | 2160 | } |
2071 | } | 2161 | } |
2072 | reloadButtonMapping ( ); | 2162 | reloadButtonMapping ( ); |
2073 | 2163 | ||
2074 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 2164 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
2075 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 2165 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
2076 | } | 2166 | } |
2077 | 2167 | ||
2078 | // SIMpad boardcontrol register CS3 | 2168 | // SIMpad boardcontrol register CS3 |
2079 | #define SIMPAD_BOARDCONTROL "/proc/cs3" | 2169 | #define SIMPAD_BOARDCONTROL "/proc/cs3" |
2080 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA | 2170 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA |
2081 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA | 2171 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA |
2082 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's | 2172 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's |
2083 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V | 2173 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V |
2084 | #define SIMPAD_DISPLAY_ON 0x0010 | 2174 | #define SIMPAD_DISPLAY_ON 0x0010 |
2085 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 | 2175 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 |
2086 | #define SIMPAD_MQ_RESET 0x0040 | 2176 | #define SIMPAD_MQ_RESET 0x0040 |
2087 | #define SIMPAD_PCMCIA_RESET 0x0080 | 2177 | #define SIMPAD_PCMCIA_RESET 0x0080 |
2088 | #define SIMPAD_DECT_POWER_ON 0x0100 | 2178 | #define SIMPAD_DECT_POWER_ON 0x0100 |
2089 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave | 2179 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave |
2090 | #define SIMPAD_RS232_ON 0x0400 | 2180 | #define SIMPAD_RS232_ON 0x0400 |
2091 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave | 2181 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave |
2092 | #define SIMPAD_LED2_ON 0x1000 | 2182 | #define SIMPAD_LED2_ON 0x1000 |
2093 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode | 2183 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode |
2094 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit | 2184 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit |
2095 | #define SIMPAD_RESET_SIMCARD 0x8000 | 2185 | #define SIMPAD_RESET_SIMCARD 0x8000 |
2096 | 2186 | ||
2097 | //SIMpad touchscreen backlight strength control | 2187 | //SIMpad touchscreen backlight strength control |
2098 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" | 2188 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" |
2099 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 | 2189 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 |
2100 | 2190 | ||
2101 | QValueList <OLed> SIMpad::ledList ( ) const | 2191 | QValueList <OLed> SIMpad::ledList ( ) const |
2102 | { | 2192 | { |
2103 | QValueList <OLed> vl; | 2193 | QValueList <OLed> vl; |
2104 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? | 2194 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? |
2105 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway | 2195 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway |
2106 | return vl; | 2196 | return vl; |
2107 | } | 2197 | } |
2108 | 2198 | ||
2109 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const | 2199 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const |
2110 | { | 2200 | { |
2111 | QValueList <OLedState> vl; | 2201 | QValueList <OLedState> vl; |
2112 | 2202 | ||
2113 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? | 2203 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? |
2114 | vl << Led_Off << Led_On; | 2204 | vl << Led_Off << Led_On; |
2115 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway | 2205 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway |
2116 | //vl << Led_Off; | 2206 | //vl << Led_Off; |
2117 | return vl; | 2207 | return vl; |
2118 | } | 2208 | } |
2119 | 2209 | ||
2120 | OLedState SIMpad::ledState ( OLed l ) const | 2210 | OLedState SIMpad::ledState ( OLed l ) const |
2121 | { | 2211 | { |
2122 | switch ( l ) { | 2212 | switch ( l ) { |
2123 | case Led_Power: | 2213 | case Led_Power: |
2124 | return m_leds [0]; | 2214 | return m_leds [0]; |
2125 | //case Led_Mail: | 2215 | //case Led_Mail: |
2126 | //return m_leds [1]; | 2216 | //return m_leds [1]; |
2127 | default: | 2217 | default: |
2128 | return Led_Off; | 2218 | return Led_Off; |
2129 | } | 2219 | } |
2130 | } | 2220 | } |
2131 | 2221 | ||
2132 | bool SIMpad::setLedState ( OLed l, OLedState st ) | 2222 | bool SIMpad::setLedState ( OLed l, OLedState st ) |
2133 | { | 2223 | { |
2134 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); | 2224 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); |
2135 | 2225 | ||
2136 | if ( l == Led_Power ) { | 2226 | if ( l == Led_Power ) { |
2137 | if ( fd >= 0 ) { | 2227 | if ( fd >= 0 ) { |
2138 | LED_IN leds; | 2228 | LED_IN leds; |
2139 | ::memset ( &leds, 0, sizeof( leds )); | 2229 | ::memset ( &leds, 0, sizeof( leds )); |
2140 | leds. TotalTime = 0; | 2230 | leds. TotalTime = 0; |
2141 | leds. OnTime = 0; | 2231 | leds. OnTime = 0; |
2142 | leds. OffTime = 1; | 2232 | leds. OffTime = 1; |
2143 | leds. OffOnBlink = 2; | 2233 | leds. OffOnBlink = 2; |
2144 | 2234 | ||
2145 | switch ( st ) { | 2235 | switch ( st ) { |
2146 | case Led_Off : leds. OffOnBlink = 0; break; | 2236 | case Led_Off : leds. OffOnBlink = 0; break; |
2147 | case Led_On : leds. OffOnBlink = 1; break; | 2237 | case Led_On : leds. OffOnBlink = 1; break; |
2148 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 2238 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
2149 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 2239 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
2150 | } | 2240 | } |
2151 | 2241 | ||
2152 | { | 2242 | { |
2153 | /*TODO Implement this like that: | 2243 | /*TODO Implement this like that: |
2154 | read from cs3 | 2244 | read from cs3 |
2155 | && with SIMPAD_LED2_ON | 2245 | && with SIMPAD_LED2_ON |
2156 | write to cs3 */ | 2246 | write to cs3 */ |
2157 | m_leds [0] = st; | 2247 | m_leds [0] = st; |
2158 | return true; | 2248 | return true; |
2159 | } | 2249 | } |
2160 | } | 2250 | } |
2161 | } | 2251 | } |
2162 | return false; | 2252 | return false; |
2163 | } | 2253 | } |
2164 | 2254 | ||
2165 | 2255 | ||
2166 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 2256 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
2167 | { | 2257 | { |
2168 | //TODO | 2258 | //TODO |
2169 | return false; | 2259 | return false; |
2170 | } | 2260 | } |
2171 | 2261 | ||
2172 | void SIMpad::timerEvent ( QTimerEvent * ) | 2262 | void SIMpad::timerEvent ( QTimerEvent * ) |
2173 | { | 2263 | { |
2174 | killTimer ( m_power_timer ); | 2264 | killTimer ( m_power_timer ); |
2175 | m_power_timer = 0; | 2265 | m_power_timer = 0; |
2176 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 2266 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
2177 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 2267 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
2178 | } | 2268 | } |
2179 | 2269 | ||
2180 | 2270 | ||
2181 | void SIMpad::alarmSound ( ) | 2271 | void SIMpad::alarmSound ( ) |
2182 | { | 2272 | { |
2183 | #ifndef QT_NO_SOUND | 2273 | #ifndef QT_NO_SOUND |
2184 | static Sound snd ( "alarm" ); | 2274 | static Sound snd ( "alarm" ); |
2185 | int fd; | 2275 | int fd; |
2186 | int vol; | 2276 | int vol; |
2187 | bool vol_reset = false; | 2277 | bool vol_reset = false; |
2188 | 2278 | ||
2189 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 2279 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
2190 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 2280 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
2191 | Config cfg ( "qpe" ); | 2281 | Config cfg ( "qpe" ); |
2192 | cfg. setGroup ( "Volume" ); | 2282 | cfg. setGroup ( "Volume" ); |
2193 | 2283 | ||
2194 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 2284 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
2195 | if ( volalarm < 0 ) | 2285 | if ( volalarm < 0 ) |
2196 | volalarm = 0; | 2286 | volalarm = 0; |
2197 | else if ( volalarm > 100 ) | 2287 | else if ( volalarm > 100 ) |
2198 | volalarm = 100; | 2288 | volalarm = 100; |
2199 | volalarm |= ( volalarm << 8 ); | 2289 | volalarm |= ( volalarm << 8 ); |
2200 | 2290 | ||
2201 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 2291 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
2202 | vol_reset = true; | 2292 | vol_reset = true; |
2203 | } | 2293 | } |
2204 | } | 2294 | } |
2205 | 2295 | ||
2206 | snd. play ( ); | 2296 | snd. play ( ); |
2207 | while ( !snd. isFinished ( )) | 2297 | while ( !snd. isFinished ( )) |
2208 | qApp-> processEvents ( ); | 2298 | qApp-> processEvents ( ); |
2209 | 2299 | ||
2210 | if ( fd >= 0 ) { | 2300 | if ( fd >= 0 ) { |
2211 | if ( vol_reset ) | 2301 | if ( vol_reset ) |
2212 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 2302 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
2213 | ::close ( fd ); | 2303 | ::close ( fd ); |
2214 | } | 2304 | } |
2215 | #endif | 2305 | #endif |
2216 | } | 2306 | } |
2217 | 2307 | ||
2218 | 2308 | ||
2219 | bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm | 2309 | bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm |
2220 | { | 2310 | { |
2221 | qDebug( "ODevice for SIMpad: suspend()" ); | 2311 | qDebug( "ODevice for SIMpad: suspend()" ); |
2222 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 2312 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
2223 | return false; | 2313 | return false; |
2224 | 2314 | ||
2225 | bool res = false; | 2315 | bool res = false; |
2226 | 2316 | ||
2227 | struct timeval tvs, tvn; | 2317 | struct timeval tvs, tvn; |
2228 | ::gettimeofday ( &tvs, 0 ); | 2318 | ::gettimeofday ( &tvs, 0 ); |
2229 | 2319 | ||
2230 | ::sync ( ); // flush fs caches | 2320 | ::sync ( ); // flush fs caches |
2231 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) | 2321 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) |
2232 | 2322 | ||
2233 | return res; | 2323 | return res; |
2234 | } | 2324 | } |
2235 | 2325 | ||
2236 | 2326 | ||
2237 | bool SIMpad::setSoftSuspend ( bool soft ) | 2327 | bool SIMpad::setSoftSuspend ( bool soft ) |
2238 | { | 2328 | { |
2239 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); | 2329 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); |
2240 | return false; | 2330 | return false; |
2241 | } | 2331 | } |
2242 | 2332 | ||
2243 | 2333 | ||
2244 | bool SIMpad::setDisplayStatus ( bool on ) | 2334 | bool SIMpad::setDisplayStatus ( bool on ) |
2245 | { | 2335 | { |
2246 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); | 2336 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); |
2247 | 2337 | ||
2248 | bool res = false; | 2338 | bool res = false; |
2249 | int fd; | 2339 | int fd; |
2250 | 2340 | ||
2251 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) | 2341 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) |
2252 | 2342 | ||
2253 | res = ( ::system( (const char*) cmdline ) == 0 ); | 2343 | res = ( ::system( (const char*) cmdline ) == 0 ); |
2254 | 2344 | ||
2255 | return res; | 2345 | return res; |
2256 | } | 2346 | } |
2257 | 2347 | ||
2258 | 2348 | ||
2259 | bool SIMpad::setDisplayBrightness ( int bright ) | 2349 | bool SIMpad::setDisplayBrightness ( int bright ) |
2260 | { | 2350 | { |
2261 | qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); | 2351 | qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); |
2262 | bool res = false; | 2352 | bool res = false; |
2263 | int fd; | 2353 | int fd; |
2264 | 2354 | ||
2265 | if ( bright > 255 ) | 2355 | if ( bright > 255 ) |
2266 | bright = 255; | 2356 | bright = 255; |
2267 | if ( bright < 1 ) | 2357 | if ( bright < 1 ) |
2268 | bright = 0; | 2358 | bright = 0; |
2269 | 2359 | ||
2270 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { | 2360 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { |
2271 | int value = 255 - bright; | 2361 | int value = 255 - bright; |
2272 | const int mask = SIMPAD_BACKLIGHT_MASK; | 2362 | const int mask = SIMPAD_BACKLIGHT_MASK; |
2273 | value = value << 8; | 2363 | value = value << 8; |
2274 | value += mask; | 2364 | value += mask; |
2275 | char writeCommand[100]; | 2365 | char writeCommand[100]; |
2276 | const int count = sprintf( writeCommand, "0x%x\n", value ); | 2366 | const int count = sprintf( writeCommand, "0x%x\n", value ); |
2277 | res = ( ::write ( fd, writeCommand, count ) != -1 ); | 2367 | res = ( ::write ( fd, writeCommand, count ) != -1 ); |
2278 | ::close ( fd ); | 2368 | ::close ( fd ); |
2279 | } | 2369 | } |
2280 | return res; | 2370 | return res; |
2281 | } | 2371 | } |
2282 | 2372 | ||
2283 | 2373 | ||
2284 | int SIMpad::displayBrightnessResolution ( ) const | 2374 | int SIMpad::displayBrightnessResolution ( ) const |
2285 | { | 2375 | { |
2286 | return 255; // All SIMpad models share the same display | 2376 | return 255; // All SIMpad models share the same display |
2287 | } | 2377 | } |
2288 | 2378 | ||
2289 | /************************************************** | 2379 | /************************************************** |
2290 | * | 2380 | * |
2291 | * Ramses | 2381 | * Ramses |
2292 | * | 2382 | * |
2293 | **************************************************/ | 2383 | **************************************************/ |
2294 | 2384 | ||
2295 | void Ramses::init() | 2385 | void Ramses::init() |
2296 | { | 2386 | { |
2297 | d->m_vendorstr = "M und N"; | 2387 | d->m_vendorstr = "M und N"; |
2298 | d->m_vendor = Vendor_MundN; | 2388 | d->m_vendor = Vendor_MundN; |
2299 | 2389 | ||
2300 | QFile f("/proc/sys/board/ramses"); | 2390 | QFile f("/proc/sys/board/ramses"); |
2301 | 2391 | ||
2302 | d->m_modelstr = "Ramses"; | 2392 | d->m_modelstr = "Ramses"; |
2303 | d->m_model = Model_Ramses_MNCI; | 2393 | d->m_model = Model_Ramses_MNCI; |
2304 | 2394 | ||
2305 | d->m_rotation = Rot0; | 2395 | d->m_rotation = Rot0; |
2306 | d->m_holdtime = 1000; | 2396 | d->m_holdtime = 1000; |
2307 | 2397 | ||
2308 | f.setName("/etc/oz_version"); | 2398 | f.setName("/etc/oz_version"); |
2309 | 2399 | ||
2310 | if (f.open(IO_ReadOnly)) { | 2400 | if (f.open(IO_ReadOnly)) { |
2311 | d->m_systemstr = "OpenEmbedded/Ramses"; | 2401 | d->m_systemstr = "OpenEmbedded/Ramses"; |
2312 | d->m_system = System_OpenZaurus; | 2402 | d->m_system = System_OpenZaurus; |
2313 | 2403 | ||
2314 | QTextStream ts(&f); | 2404 | QTextStream ts(&f); |
2315 | ts.setDevice(&f); | 2405 | ts.setDevice(&f); |
2316 | d->m_sysverstr = ts.readLine(); | 2406 | d->m_sysverstr = ts.readLine(); |
2317 | f.close(); | 2407 | f.close(); |
2318 | } | 2408 | } |
2319 | 2409 | ||
2320 | m_power_timer = 0; | 2410 | m_power_timer = 0; |
2321 | 2411 | ||
2322 | #ifdef QT_QWS_ALLOW_OVERCLOCK | 2412 | #ifdef QT_QWS_ALLOW_OVERCLOCK |
2323 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** | 2413 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** |
2324 | #define OC(x...) x | 2414 | #define OC(x...) x |
2325 | #else | 2415 | #else |
2326 | #define OC(x...) | 2416 | #define OC(x...) |
2327 | #endif | 2417 | #endif |
2328 | 2418 | ||
2329 | 2419 | ||
2330 | // This table is true for a Intel XScale PXA 255 | 2420 | // This table is true for a Intel XScale PXA 255 |
2331 | 2421 | ||
2332 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 | 2422 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 |
2333 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem | 2423 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem |
2334 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 | 2424 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 |
2335 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem | 2425 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem |
2336 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 | 2426 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 |
2337 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem | 2427 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem |
2338 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 | 2428 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 |
2339 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 | 2429 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 |
2340 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus | 2430 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus |
2341 | 2431 | ||
2342 | } | 2432 | } |
2343 | 2433 | ||
2344 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) | 2434 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) |
2345 | { | 2435 | { |
2346 | Q_UNUSED( keycode ); | 2436 | Q_UNUSED( keycode ); |
2347 | Q_UNUSED( modifiers ); | 2437 | Q_UNUSED( modifiers ); |
2348 | Q_UNUSED( isPress ); | 2438 | Q_UNUSED( isPress ); |
2349 | Q_UNUSED( autoRepeat ); | 2439 | Q_UNUSED( autoRepeat ); |
2350 | return false; | 2440 | return false; |
2351 | } | 2441 | } |
2352 | 2442 | ||
2353 | void Ramses::timerEvent(QTimerEvent *) | 2443 | void Ramses::timerEvent(QTimerEvent *) |
2354 | { | 2444 | { |
2355 | killTimer(m_power_timer); | 2445 | killTimer(m_power_timer); |
2356 | m_power_timer = 0; | 2446 | m_power_timer = 0; |
2357 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); | 2447 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); |
2358 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); | 2448 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); |
2359 | } | 2449 | } |
2360 | 2450 | ||
2361 | 2451 | ||
2362 | bool Ramses::setSoftSuspend(bool soft) | 2452 | bool Ramses::setSoftSuspend(bool soft) |
2363 | { | 2453 | { |
2364 | qDebug("Ramses::setSoftSuspend(%d)", soft); | 2454 | qDebug("Ramses::setSoftSuspend(%d)", soft); |
2365 | #if 0 | 2455 | #if 0 |
2366 | bool res = false; | 2456 | bool res = false; |
2367 | int fd; | 2457 | int fd; |
2368 | 2458 | ||
2369 | if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || | 2459 | if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || |
2370 | ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { | 2460 | ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { |
2371 | 2461 | ||
2372 | int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources | 2462 | int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources |
2373 | 2463 | ||
2374 | if (sources >= 0) { | 2464 | if (sources >= 0) { |
2375 | if (soft) | 2465 | if (soft) |
2376 | sources &= ~APM_EVT_POWER_BUTTON; | 2466 | sources &= ~APM_EVT_POWER_BUTTON; |
2377 | else | 2467 | else |
2378 | sources |= APM_EVT_POWER_BUTTON; | 2468 | sources |= APM_EVT_POWER_BUTTON; |
2379 | 2469 | ||
2380 | if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources | 2470 | if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources |
2381 | res = true; | 2471 | res = true; |
2382 | else | 2472 | else |
2383 | perror("APM_IOCGEVTSRC"); | 2473 | perror("APM_IOCGEVTSRC"); |
2384 | } | 2474 | } |
2385 | else | 2475 | else |
2386 | perror("APM_IOCGEVTSRC"); | 2476 | perror("APM_IOCGEVTSRC"); |
2387 | 2477 | ||
2388 | ::close(fd); | 2478 | ::close(fd); |
2389 | } | 2479 | } |
2390 | else | 2480 | else |
2391 | perror("/dev/apm_bios or /dev/misc/apm_bios"); | 2481 | perror("/dev/apm_bios or /dev/misc/apm_bios"); |
2392 | 2482 | ||
2393 | return res; | 2483 | return res; |
2394 | #else | 2484 | #else |
2395 | return true; | 2485 | return true; |
2396 | #endif | 2486 | #endif |
2397 | } | 2487 | } |
2398 | 2488 | ||
2399 | bool Ramses::suspend ( ) | 2489 | bool Ramses::suspend ( ) |
2400 | { | 2490 | { |
2401 | qDebug("Ramses::suspend"); | 2491 | qDebug("Ramses::suspend"); |
2402 | return false; | 2492 | return false; |
2403 | } | 2493 | } |
2404 | 2494 | ||
2405 | /** | 2495 | /** |
2406 | * This sets the display on or off | 2496 | * This sets the display on or off |
2407 | */ | 2497 | */ |
2408 | bool Ramses::setDisplayStatus(bool on) | 2498 | bool Ramses::setDisplayStatus(bool on) |
2409 | { | 2499 | { |
2410 | qDebug("Ramses::setDisplayStatus(%d)", on); | 2500 | qDebug("Ramses::setDisplayStatus(%d)", on); |
2411 | #if 0 | 2501 | #if 0 |
2412 | bool res = false; | 2502 | bool res = false; |
2413 | int fd; | 2503 | int fd; |
2414 | 2504 | ||
2415 | if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { | 2505 | if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { |
2416 | res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); | 2506 | res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); |
2417 | ::close(fd); | 2507 | ::close(fd); |
2418 | } | 2508 | } |
2419 | return res; | 2509 | return res; |
2420 | #else | 2510 | #else |
2421 | return true; | 2511 | return true; |
2422 | #endif | 2512 | #endif |
2423 | } | 2513 | } |
2424 | 2514 | ||
2425 | 2515 | ||
2426 | /* | 2516 | /* |
2427 | * We get something between 0..255 into us | 2517 | * We get something between 0..255 into us |
2428 | */ | 2518 | */ |
2429 | bool Ramses::setDisplayBrightness(int bright) | 2519 | bool Ramses::setDisplayBrightness(int bright) |
2430 | { | 2520 | { |
2431 | qDebug("Ramses::setDisplayBrightness(%d)", bright); | 2521 | qDebug("Ramses::setDisplayBrightness(%d)", bright); |
2432 | bool res = false; | 2522 | bool res = false; |
2433 | int fd; | 2523 | int fd; |
2434 | 2524 | ||
2435 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) | 2525 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) |
2436 | 2526 | ||
2437 | if (bright > 255 ) | 2527 | if (bright > 255 ) |
2438 | bright = 255; | 2528 | bright = 255; |
2439 | if (bright < 0) | 2529 | if (bright < 0) |
2440 | bright = 0; | 2530 | bright = 0; |
2441 | 2531 | ||
2442 | // Turn backlight completely off | 2532 | // Turn backlight completely off |
2443 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { | 2533 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { |
2444 | char writeCommand[10]; | 2534 | char writeCommand[10]; |
2445 | const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); | 2535 | const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); |
2446 | res = (::write(fd, writeCommand, count) != -1); | 2536 | res = (::write(fd, writeCommand, count) != -1); |
2447 | ::close(fd); | 2537 | ::close(fd); |
2448 | } | 2538 | } |
2449 | 2539 | ||
2450 | // scale backlight brightness to hardware | 2540 | // scale backlight brightness to hardware |
2451 | bright = 500-(bright * 500 / 255); | 2541 | bright = 500-(bright * 500 / 255); |
2452 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { | 2542 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { |
2453 | qDebug(" %d -> pwm1", bright); | 2543 | qDebug(" %d -> pwm1", bright); |
2454 | char writeCommand[100]; | 2544 | char writeCommand[100]; |
2455 | const int count = sprintf(writeCommand, "%d\n", bright); | 2545 | const int count = sprintf(writeCommand, "%d\n", bright); |
2456 | res = (::write(fd, writeCommand, count) != -1); | 2546 | res = (::write(fd, writeCommand, count) != -1); |
2457 | ::close(fd); | 2547 | ::close(fd); |
2458 | } | 2548 | } |
2459 | return res; | 2549 | return res; |
2460 | } | 2550 | } |
2461 | 2551 | ||
2462 | 2552 | ||
2463 | int Ramses::displayBrightnessResolution() const | 2553 | int Ramses::displayBrightnessResolution() const |
2464 | { | 2554 | { |
2465 | return 32; | 2555 | return 32; |
2466 | } | 2556 | } |
2467 | 2557 | ||
2468 | bool Ramses::setDisplayContrast(int contr) | 2558 | bool Ramses::setDisplayContrast(int contr) |
2469 | { | 2559 | { |
2470 | qDebug("Ramses::setDisplayContrast(%d)", contr); | 2560 | qDebug("Ramses::setDisplayContrast(%d)", contr); |
2471 | bool res = false; | 2561 | bool res = false; |
2472 | int fd; | 2562 | int fd; |
2473 | 2563 | ||
2474 | // pwm0 contrast: 20 steps 79..90 (dunkel->hell) | 2564 | // pwm0 contrast: 20 steps 79..90 (dunkel->hell) |
2475 | 2565 | ||
2476 | if (contr > 255 ) | 2566 | if (contr > 255 ) |
2477 | contr = 255; | 2567 | contr = 255; |
2478 | if (contr < 0) | 2568 | if (contr < 0) |
2479 | contr = 0; | 2569 | contr = 0; |
2480 | contr = 90 - (contr * 20 / 255); | 2570 | contr = 90 - (contr * 20 / 255); |
2481 | 2571 | ||
2482 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { | 2572 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { |
2483 | qDebug(" %d -> pwm0", contr); | 2573 | qDebug(" %d -> pwm0", contr); |
2484 | char writeCommand[100]; | 2574 | char writeCommand[100]; |
2485 | const int count = sprintf(writeCommand, "%d\n", contr); | 2575 | const int count = sprintf(writeCommand, "%d\n", contr); |
2486 | res = (::write(fd, writeCommand, count) != -1); | 2576 | res = (::write(fd, writeCommand, count) != -1); |
2487 | res = true; | 2577 | res = true; |
2488 | ::close(fd); | 2578 | ::close(fd); |
2489 | } | 2579 | } |
2490 | return res; | 2580 | return res; |
2491 | } | 2581 | } |
2492 | 2582 | ||
2493 | 2583 | ||
diff --git a/libopie/odevice.h b/libopie/odevice.h index 25910b5..8273761 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -1,274 +1,274 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | Copyright (C) 2003 Holger 'zecke' Freyther (zecke@handhelds.org) | 3 | Copyright (C) 2003 Holger 'zecke' Freyther (zecke@handhelds.org) |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _LIBOPIE_ODEVICE_H_ | 21 | #ifndef _LIBOPIE_ODEVICE_H_ |
22 | #define _LIBOPIE_ODEVICE_H_ | 22 | #define _LIBOPIE_ODEVICE_H_ |
23 | 23 | ||
24 | #include <qobject.h> | 24 | #include <qobject.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qnamespace.h> | 26 | #include <qnamespace.h> |
27 | #include <qstrlist.h> | 27 | #include <qstrlist.h> |
28 | 28 | ||
29 | #include <opie/odevicebutton.h> | 29 | #include <opie/odevicebutton.h> |
30 | 30 | ||
31 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 31 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
32 | 32 | ||
33 | class ODeviceData; | 33 | class ODeviceData; |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * The available devices | 38 | * The available devices |
39 | */ | 39 | */ |
40 | enum OModel { | 40 | enum OModel { |
41 | Model_Unknown, // = 0 | 41 | Model_Unknown, // = 0 |
42 | 42 | ||
43 | Model_Series_Mask = 0xff000000, | 43 | Model_Series_Mask = 0xff000000, |
44 | 44 | ||
45 | Model_iPAQ = ( 1 << 24 ), | 45 | Model_iPAQ = ( 1 << 24 ), |
46 | 46 | ||
47 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 47 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
48 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 48 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
49 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 49 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
50 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 50 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
51 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 51 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
52 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 52 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
53 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ), | 53 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ), |
54 | 54 | ||
55 | Model_Jornada = ( 6 << 24 ), | 55 | Model_Jornada = ( 6 << 24 ), |
56 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 56 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
57 | 57 | ||
58 | Model_Zaurus = ( 2 << 24 ), | 58 | Model_Zaurus = ( 2 << 24 ), |
59 | 59 | ||
60 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 60 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
61 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 61 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
62 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 62 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
63 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 63 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
64 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 64 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
65 | 65 | ||
66 | Model_SIMpad = ( 3 << 24 ), | 66 | Model_SIMpad = ( 3 << 24 ), |
67 | 67 | ||
68 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 68 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
69 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 69 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
70 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 70 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
71 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 71 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
72 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 72 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
73 | 73 | ||
74 | Model_Ramses = ( 4 << 24 ), | 74 | Model_Ramses = ( 4 << 24 ), |
75 | 75 | ||
76 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 76 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
77 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 77 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
78 | 78 | ||
79 | Model_Yopy = ( 5 << 24 ), | 79 | Model_Yopy = ( 5 << 24 ), |
80 | 80 | ||
81 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 81 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
82 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 82 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
83 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 83 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
84 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 84 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
85 | 85 | ||
86 | }; | 86 | }; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * The vendor of the device | 89 | * The vendor of the device |
90 | */ | 90 | */ |
91 | enum OVendor { | 91 | enum OVendor { |
92 | Vendor_Unknown, | 92 | Vendor_Unknown, |
93 | 93 | ||
94 | Vendor_HP, | 94 | Vendor_HP, |
95 | Vendor_Sharp, | 95 | Vendor_Sharp, |
96 | Vendor_SIEMENS, | 96 | Vendor_SIEMENS, |
97 | Vendor_MundN, | 97 | Vendor_MundN, |
98 | Vendor_GMate, | 98 | Vendor_GMate, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * The System used | 102 | * The System used |
103 | */ | 103 | */ |
104 | enum OSystem { | 104 | enum OSystem { |
105 | System_Unknown, | 105 | System_Unknown, |
106 | 106 | ||
107 | System_Familiar, | 107 | System_Familiar, |
108 | System_Zaurus, | 108 | System_Zaurus, |
109 | System_OpenZaurus, | 109 | System_OpenZaurus, |
110 | System_Linupy, | 110 | System_Linupy, |
111 | }; | 111 | }; |
112 | 112 | ||
113 | enum OLedState { | 113 | enum OLedState { |
114 | Led_Off, | 114 | Led_Off, |
115 | Led_On, | 115 | Led_On, |
116 | Led_BlinkSlow, | 116 | Led_BlinkSlow, |
117 | Led_BlinkFast | 117 | Led_BlinkFast |
118 | }; | 118 | }; |
119 | 119 | ||
120 | enum OLed { | 120 | enum OLed { |
121 | Led_Mail, | 121 | Led_Mail, |
122 | Led_Power, | 122 | Led_Power, |
123 | Led_BlueTooth | 123 | Led_BlueTooth |
124 | }; | 124 | }; |
125 | 125 | ||
126 | enum OHardKey { | 126 | enum OHardKey { |
127 | HardKey_Datebook = Qt::Key_F9, | 127 | HardKey_Datebook = Qt::Key_F9, |
128 | HardKey_Contacts = Qt::Key_F10, | 128 | HardKey_Contacts = Qt::Key_F10, |
129 | HardKey_Menu = Qt::Key_F11, | 129 | HardKey_Menu = Qt::Key_F11, |
130 | HardKey_Home = Qt::Key_F12, | 130 | HardKey_Home = Qt::Key_F12, |
131 | HardKey_Mail = Qt::Key_F13, | 131 | HardKey_Mail = Qt::Key_F13, |
132 | HardKey_Record = Qt::Key_F24, | 132 | HardKey_Record = Qt::Key_F24, |
133 | HardKey_Suspend = Qt::Key_F34, | 133 | HardKey_Suspend = Qt::Key_F34, |
134 | HardKey_Backlight = Qt::Key_F35, | 134 | HardKey_Backlight = Qt::Key_F35, |
135 | HardKey_Action = Qt::Key_F10, | 135 | HardKey_Action = Qt::Key_F10, |
136 | HardKey_OK = Qt::Key_F11, | 136 | HardKey_OK = Qt::Key_F11, |
137 | HardKey_End = Qt::Key_F12, | 137 | HardKey_End = Qt::Key_F12, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | enum ODirection { | 140 | enum ODirection { |
141 | CW = 0, | 141 | CW = 0, |
142 | CCW = 1, | 142 | CCW = 1, |
143 | Flip = 2, | 143 | Flip = 2, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * A singleton which gives informations about device specefic option | 147 | * A singleton which gives informations about device specefic option |
148 | * like the Hardware used, LEDs, the Base Distribution and | 148 | * like the Hardware used, LEDs, the Base Distribution and |
149 | * hardware key mappings. | 149 | * hardware key mappings. |
150 | * | 150 | * |
151 | * @short A small class for device specefic options | 151 | * @short A small class for device specefic options |
152 | * @see QObject | 152 | * @see QObject |
153 | * @author Robert Griebl | 153 | * @author Robert Griebl |
154 | * @version 1.0 | 154 | * @version 1.0 |
155 | */ | 155 | */ |
156 | class ODevice : public QObject { | 156 | class ODevice : public QObject { |
157 | Q_OBJECT | 157 | Q_OBJECT |
158 | 158 | ||
159 | private: | 159 | private: |
160 | /* disable copy */ | 160 | /* disable copy */ |
161 | ODevice ( const ODevice & ); | 161 | ODevice ( const ODevice & ); |
162 | 162 | ||
163 | protected: | 163 | protected: |
164 | ODevice ( ); | 164 | ODevice ( ); |
165 | virtual void init ( ); | 165 | virtual void init ( ); |
166 | virtual void initButtons ( ); | 166 | virtual void initButtons ( ); |
167 | 167 | ||
168 | ODeviceData *d; | 168 | ODeviceData *d; |
169 | 169 | ||
170 | public: | 170 | public: |
171 | // sandman do we want to allow destructions? -zecke? | 171 | // sandman do we want to allow destructions? -zecke? |
172 | virtual ~ODevice ( ); | 172 | virtual ~ODevice ( ); |
173 | 173 | ||
174 | static ODevice *inst ( ); | 174 | static ODevice *inst ( ); |
175 | 175 | ||
176 | // information | 176 | // information |
177 | 177 | ||
178 | QString modelString ( ) const; | 178 | QString modelString ( ) const; |
179 | OModel model ( ) const; | 179 | OModel model ( ) const; |
180 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | 180 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } |
181 | 181 | ||
182 | QString vendorString ( ) const; | 182 | QString vendorString ( ) const; |
183 | OVendor vendor ( ) const; | 183 | OVendor vendor ( ) const; |
184 | 184 | ||
185 | QString systemString ( ) const; | 185 | QString systemString ( ) const; |
186 | OSystem system ( ) const; | 186 | OSystem system ( ) const; |
187 | 187 | ||
188 | QString systemVersionString ( ) const; | 188 | QString systemVersionString ( ) const; |
189 | 189 | ||
190 | Transformation rotation ( ) const; | 190 | virtual Transformation rotation ( ) const; |
191 | ODirection direction ( ) const; | 191 | virtual ODirection direction ( ) const; |
192 | 192 | ||
193 | // system | 193 | // system |
194 | 194 | ||
195 | virtual bool setSoftSuspend ( bool on ); | 195 | virtual bool setSoftSuspend ( bool on ); |
196 | virtual bool suspend ( ); | 196 | virtual bool suspend ( ); |
197 | 197 | ||
198 | virtual bool setDisplayStatus ( bool on ); | 198 | virtual bool setDisplayStatus ( bool on ); |
199 | virtual bool setDisplayBrightness ( int brightness ); | 199 | virtual bool setDisplayBrightness ( int brightness ); |
200 | virtual int displayBrightnessResolution ( ) const; | 200 | virtual int displayBrightnessResolution ( ) const; |
201 | virtual bool setDisplayContrast ( int contrast ); | 201 | virtual bool setDisplayContrast ( int contrast ); |
202 | virtual int displayContrastResolution ( ) const; | 202 | virtual int displayContrastResolution ( ) const; |
203 | 203 | ||
204 | // don't add new virtual methods, use this: | 204 | // don't add new virtual methods, use this: |
205 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 205 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
206 | // and in your subclass do do overwrite | 206 | // and in your subclass do do overwrite |
207 | //protected virtual int virtual_hook(int, void *) | 207 | //protected virtual int virtual_hook(int, void *) |
208 | // which is defined below | 208 | // which is defined below |
209 | 209 | ||
210 | // input / output | 210 | // input / output |
211 | //FIXME playAlarmSound and al might be better -zecke | 211 | //FIXME playAlarmSound and al might be better -zecke |
212 | virtual void alarmSound ( ); | 212 | virtual void alarmSound ( ); |
213 | virtual void keySound ( ); | 213 | virtual void keySound ( ); |
214 | virtual void touchSound ( ); | 214 | virtual void touchSound ( ); |
215 | 215 | ||
216 | virtual QValueList <OLed> ledList ( ) const; | 216 | virtual QValueList <OLed> ledList ( ) const; |
217 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 217 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
218 | virtual OLedState ledState ( OLed led ) const; | 218 | virtual OLedState ledState ( OLed led ) const; |
219 | virtual bool setLedState ( OLed led, OLedState st ); | 219 | virtual bool setLedState ( OLed led, OLedState st ); |
220 | 220 | ||
221 | virtual bool hasLightSensor ( ) const; | 221 | virtual bool hasLightSensor ( ) const; |
222 | virtual int readLightSensor ( ); | 222 | virtual int readLightSensor ( ); |
223 | virtual int lightSensorResolution ( ) const; | 223 | virtual int lightSensorResolution ( ) const; |
224 | 224 | ||
225 | const QStrList &allowedCpuFrequencies() const; | 225 | const QStrList &allowedCpuFrequencies() const; |
226 | bool setCurrentCpuFrequency(uint index); | 226 | bool setCurrentCpuFrequency(uint index); |
227 | 227 | ||
228 | /** | 228 | /** |
229 | * Returns the available buttons on this device. The number and location | 229 | * Returns the available buttons on this device. The number and location |
230 | * of buttons will vary depending on the device. Button numbers will be assigned | 230 | * of buttons will vary depending on the device. Button numbers will be assigned |
231 | * by the device manufacturer and will be from most preferred button to least preffered | 231 | * by the device manufacturer and will be from most preferred button to least preffered |
232 | * button. Note that this list only contains "user mappable" buttons. | 232 | * button. Note that this list only contains "user mappable" buttons. |
233 | */ | 233 | */ |
234 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; | 234 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; |
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 237 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
238 | * returns 0L | 238 | * returns 0L |
239 | */ | 239 | */ |
240 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 240 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
241 | 241 | ||
242 | /** | 242 | /** |
243 | * Reassigns the pressed action for \a button. To return to the factory | 243 | * Reassigns the pressed action for \a button. To return to the factory |
244 | * default pass an empty string as \a qcopMessage. | 244 | * default pass an empty string as \a qcopMessage. |
245 | */ | 245 | */ |
246 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 246 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * Reassigns the held action for \a button. To return to the factory | 249 | * Reassigns the held action for \a button. To return to the factory |
250 | * default pass an empty string as \a qcopMessage. | 250 | * default pass an empty string as \a qcopMessage. |
251 | */ | 251 | */ |
252 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 252 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
253 | 253 | ||
254 | /** | 254 | /** |
255 | * How long (in ms) you have to press a button for a "hold" action | 255 | * How long (in ms) you have to press a button for a "hold" action |
256 | */ | 256 | */ |
257 | uint buttonHoldTime ( ) const; | 257 | uint buttonHoldTime ( ) const; |
258 | 258 | ||
259 | signals: | 259 | signals: |
260 | void buttonMappingChanged ( ); | 260 | void buttonMappingChanged ( ); |
261 | 261 | ||
262 | private slots: | 262 | private slots: |
263 | void systemMessage ( const QCString &, const QByteArray & ); | 263 | void systemMessage ( const QCString &, const QByteArray & ); |
264 | 264 | ||
265 | protected: | 265 | protected: |
266 | void reloadButtonMapping ( ); | 266 | void reloadButtonMapping ( ); |
267 | /* ugly virtual hook */ | 267 | /* ugly virtual hook */ |
268 | virtual void virtual_hook( int id, void* data ); | 268 | virtual void virtual_hook( int id, void* data ); |
269 | }; | 269 | }; |
270 | 270 | ||
271 | } | 271 | } |
272 | 272 | ||
273 | #endif | 273 | #endif |
274 | 274 | ||
diff --git a/qt/qt-2.3.7.patch/qte237-all.patch b/qt/qt-2.3.7.patch/qte237-all.patch index 233996a..e6cf0a4 100644 --- a/qt/qt-2.3.7.patch/qte237-all.patch +++ b/qt/qt-2.3.7.patch/qte237-all.patch | |||
@@ -1,410 +1,421 @@ | |||
1 | diff -ru qt-2.3.5_fresh/include/qapplication.h qt-2.3.5/include/qapplication.h | 1 | diff -ru qt-2.3.5_fresh/include/qapplication.h qt-2.3.5/include/qapplication.h |
2 | --- qt-2.3.5_fresh/include/qapplication.h2003-05-13 15:56:10.000000000 +0200 | 2 | --- qt-2.3.5_fresh/include/qapplication.h2003-05-13 15:56:10.000000000 +0200 |
3 | +++ qt-2.3.5/include/qapplication.h2003-05-13 15:58:18.000000000 +0200 | 3 | +++ qt-2.3.5/include/qapplication.h2003-05-13 15:58:18.000000000 +0200 |
4 | @@ -61,6 +61,10 @@ | 4 | @@ -61,6 +61,10 @@ |
5 | class QSemaphore; | 5 | class QSemaphore; |
6 | #endif | 6 | #endif |
7 | 7 | ||
8 | +#if !defined( QT_WEAK_SYMBOL ) | 8 | +#if !defined( QT_WEAK_SYMBOL ) |
9 | +#define QT_WEAK_SYMBOL | 9 | +#define QT_WEAK_SYMBOL |
10 | +#endif | 10 | +#endif |
11 | + | 11 | + |
12 | // REMOVE IN 3.0 (just here for moc source compatibility) | 12 | // REMOVE IN 3.0 (just here for moc source compatibility) |
13 | #define QNonBaseApplication QApplication | 13 | #define QNonBaseApplication QApplication |
14 | 14 | ||
15 | @@ -85,7 +89,10 @@ | 15 | @@ -85,7 +89,10 @@ |
16 | 16 | ||
17 | #ifndef QT_NO_STYLE | 17 | #ifndef QT_NO_STYLE |
18 | static QStyle &style(); | 18 | static QStyle &style(); |
19 | - static void setStyle( QStyle* ); | 19 | - static void setStyle( QStyle* ); |
20 | + static void setStyle( QStyle* ) QT_WEAK_SYMBOL; | 20 | + static void setStyle( QStyle* ) QT_WEAK_SYMBOL; |
21 | +private: | 21 | +private: |
22 | +static void setStyle_NonWeak( QStyle* ); | 22 | +static void setStyle_NonWeak( QStyle* ); |
23 | +public: | 23 | +public: |
24 | #endif | 24 | #endif |
25 | #if 1/* OBSOLETE */ | 25 | #if 1/* OBSOLETE */ |
26 | enum ColorMode { NormalColors, CustomColors }; | 26 | enum ColorMode { NormalColors, CustomColors }; |
27 | @@ -106,11 +113,19 @@ | 27 | @@ -106,11 +113,19 @@ |
28 | #ifndef QT_NO_PALETTE | 28 | #ifndef QT_NO_PALETTE |
29 | static QPalette palette( const QWidget* = 0 ); | 29 | static QPalette palette( const QWidget* = 0 ); |
30 | static void setPalette( const QPalette &, bool informWidgets=FALSE, | 30 | static void setPalette( const QPalette &, bool informWidgets=FALSE, |
31 | + const char* className = 0 ) QT_WEAK_SYMBOL; | 31 | + const char* className = 0 ) QT_WEAK_SYMBOL; |
32 | +private: | 32 | +private: |
33 | + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE, | 33 | + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE, |
34 | const char* className = 0 ); | 34 | const char* className = 0 ); |
35 | +public: | 35 | +public: |
36 | #endif | 36 | #endif |
37 | static QFont font( const QWidget* = 0 ); | 37 | static QFont font( const QWidget* = 0 ); |
38 | static void setFont( const QFont &, bool informWidgets=FALSE, | 38 | static void setFont( const QFont &, bool informWidgets=FALSE, |
39 | + const char* className = 0 ) QT_WEAK_SYMBOL; | 39 | + const char* className = 0 ) QT_WEAK_SYMBOL; |
40 | +private: | 40 | +private: |
41 | + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE, | 41 | + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE, |
42 | const char* className = 0 ); | 42 | const char* className = 0 ); |
43 | +public: | 43 | +public: |
44 | static QFontMetrics fontMetrics(); | 44 | static QFontMetrics fontMetrics(); |
45 | 45 | ||
46 | QWidget *mainWidget() const; | 46 | QWidget *mainWidget() const; |
47 | @@ -207,7 +222,10 @@ | 47 | @@ -207,7 +222,10 @@ |
48 | void qwsSetCustomColors( QRgb *colortable, int start, int numColors ); | 48 | void qwsSetCustomColors( QRgb *colortable, int start, int numColors ); |
49 | #ifndef QT_NO_QWS_MANAGER | 49 | #ifndef QT_NO_QWS_MANAGER |
50 | static QWSDecoration &qwsDecoration(); | 50 | static QWSDecoration &qwsDecoration(); |
51 | - static void qwsSetDecoration( QWSDecoration *); | 51 | - static void qwsSetDecoration( QWSDecoration *); |
52 | + static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL; | 52 | + static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL; |
53 | +private: | 53 | +private: |
54 | + static void qwsSetDecoration_NonWeak( QWSDecoration *); | 54 | + static void qwsSetDecoration_NonWeak( QWSDecoration *); |
55 | +public: | 55 | +public: |
56 | #endif | 56 | #endif |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | diff -ru qt-2.3.5_fresh/include/qfontdatabase.h qt-2.3.5/include/qfontdatabase.h | 59 | diff -ru qt-2.3.5_fresh/include/qfontdatabase.h qt-2.3.5/include/qfontdatabase.h |
60 | --- qt-2.3.5_fresh/include/qfontdatabase.h2003-05-13 15:56:11.000000000 +0200 | 60 | --- qt-2.3.5_fresh/include/qfontdatabase.h2003-05-13 15:56:11.000000000 +0200 |
61 | +++ qt-2.3.5/include/qfontdatabase.h2003-05-13 15:58:18.000000000 +0200 | 61 | +++ qt-2.3.5/include/qfontdatabase.h2003-05-13 15:58:18.000000000 +0200 |
62 | @@ -59,6 +59,10 @@ | 62 | @@ -59,6 +59,10 @@ |
63 | class QDiskFont; | 63 | class QDiskFont; |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | +#if !defined( QT_WEAK_SYMBOL ) | 66 | +#if !defined( QT_WEAK_SYMBOL ) |
67 | +#define QT_WEAK_SYMBOL | 67 | +#define QT_WEAK_SYMBOL |
68 | +#endif | 68 | +#endif |
69 | + | 69 | + |
70 | class QFontDatabasePrivate; | 70 | class QFontDatabasePrivate; |
71 | 71 | ||
72 | class Q_EXPORT QFontDatabase | 72 | class Q_EXPORT QFontDatabase |
73 | @@ -67,9 +71,16 @@ | 73 | @@ -67,9 +71,16 @@ |
74 | QFontDatabase(); | 74 | QFontDatabase(); |
75 | 75 | ||
76 | QStringList families( bool onlyForLocale = TRUE ) const; | 76 | QStringList families( bool onlyForLocale = TRUE ) const; |
77 | + | 77 | + |
78 | + | 78 | + |
79 | QValueList<int> pointSizes( const QString &family, | 79 | QValueList<int> pointSizes( const QString &family, |
80 | const QString &style = QString::null, | 80 | const QString &style = QString::null, |
81 | - const QString &charSet = QString::null ); | 81 | - const QString &charSet = QString::null ); |
82 | + const QString &charSet = QString::null ) QT_WEAK_SYMBOL; | 82 | + const QString &charSet = QString::null ) QT_WEAK_SYMBOL; |
83 | +private: | 83 | +private: |
84 | + QValueList<int> pointSizes_NonWeak( const QString &family, | 84 | + QValueList<int> pointSizes_NonWeak( const QString &family, |
85 | + const QString &style, | 85 | + const QString &style, |
86 | + const QString &charSet ); | 86 | + const QString &charSet ); |
87 | +public: | 87 | +public: |
88 | QStringList styles( const QString &family, | 88 | QStringList styles( const QString &family, |
89 | const QString &charSet = QString::null ) const; | 89 | const QString &charSet = QString::null ) const; |
90 | QStringList charSets( const QString &familyName, | 90 | QStringList charSets( const QString &familyName, |
91 | diff -ru qt-2.3.5_fresh/src/kernel/qapplication.cpp qt-2.3.5/src/kernel/qapplication.cpp | 91 | diff -ru qt-2.3.5_fresh/src/kernel/qapplication.cpp qt-2.3.5/src/kernel/qapplication.cpp |
92 | --- qt-2.3.5_fresh/src/kernel/qapplication.cpp2003-05-13 15:56:10.000000000 +0200 | 92 | --- qt-2.3.5_fresh/src/kernel/qapplication.cpp2003-05-13 15:56:10.000000000 +0200 |
93 | +++ qt-2.3.5/src/kernel/qapplication.cpp2003-05-13 15:58:19.000000000 +0200 | 93 | +++ qt-2.3.5/src/kernel/qapplication.cpp2003-05-13 15:58:19.000000000 +0200 |
94 | @@ -35,6 +35,8 @@ | 94 | @@ -35,6 +35,8 @@ |
95 | ** | 95 | ** |
96 | **********************************************************************/ | 96 | **********************************************************************/ |
97 | 97 | ||
98 | +#define QT_WEAK_SYMBOL__attribute__(( weak )) | 98 | +#define QT_WEAK_SYMBOL__attribute__(( weak )) |
99 | + | 99 | + |
100 | #include "qobjectlist.h" | 100 | #include "qobjectlist.h" |
101 | #include "qobjectdict.h" | 101 | #include "qobjectdict.h" |
102 | #include "qapplication.h" | 102 | #include "qapplication.h" |
103 | @@ -933,11 +935,16 @@ | 103 | @@ -933,11 +935,16 @@ |
104 | #ifndef QT_NO_STYLE | 104 | #ifndef QT_NO_STYLE |
105 | void QApplication::setStyle( QStyle *style ) | 105 | void QApplication::setStyle( QStyle *style ) |
106 | { | 106 | { |
107 | +setStyle_NonWeak ( style ); | 107 | +setStyle_NonWeak ( style ); |
108 | +} | 108 | +} |
109 | + | 109 | + |
110 | +void QApplication::setStyle_NonWeak( QStyle *style ) | 110 | +void QApplication::setStyle_NonWeak( QStyle *style ) |
111 | +{ | 111 | +{ |
112 | QStyle* old = app_style; | 112 | QStyle* old = app_style; |
113 | - app_style = style; | 113 | - app_style = style; |
114 | 114 | ||
115 | if ( startingUp() ) { | 115 | if ( startingUp() ) { |
116 | delete old; | 116 | delete old; |
117 | +app_style = style; | 117 | +app_style = style; |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | 120 | ||
121 | @@ -958,6 +965,8 @@ | 121 | @@ -958,6 +965,8 @@ |
122 | old->unPolish( qApp ); | 122 | old->unPolish( qApp ); |
123 | } | 123 | } |
124 | 124 | ||
125 | + app_style = style; | 125 | + app_style = style; |
126 | + | 126 | + |
127 | // take care of possible palette requirements of certain gui | 127 | // take care of possible palette requirements of certain gui |
128 | // styles. Do it before polishing the application since the style | 128 | // styles. Do it before polishing the application since the style |
129 | // might call QApplication::setStyle() itself | 129 | // might call QApplication::setStyle() itself |
130 | @@ -1184,13 +1193,30 @@ | 130 | @@ -1184,13 +1193,30 @@ |
131 | \sa QWidget::setPalette(), palette(), QStyle::polish() | 131 | \sa QWidget::setPalette(), palette(), QStyle::polish() |
132 | */ | 132 | */ |
133 | 133 | ||
134 | -void QApplication::setPalette( const QPalette &palette, bool informWidgets, | 134 | -void QApplication::setPalette( const QPalette &palette, bool informWidgets, |
135 | +void QApplication::setPalette ( const QPalette &palette, bool informWidgets, | 135 | +void QApplication::setPalette ( const QPalette &palette, bool informWidgets, |
136 | + const char* className ) | 136 | + const char* className ) |
137 | +{ | 137 | +{ |
138 | +setPalette_NonWeak ( palette, informWidgets, className ); | 138 | +setPalette_NonWeak ( palette, informWidgets, className ); |
139 | +} | 139 | +} |
140 | + | 140 | + |
141 | +void QApplication::setPalette_NonWeak ( const QPalette &palette, bool informWidgets, | 141 | +void QApplication::setPalette_NonWeak ( const QPalette &palette, bool informWidgets, |
142 | const char* className ) | 142 | const char* className ) |
143 | { | 143 | { |
144 | QPalette pal = palette; | 144 | QPalette pal = palette; |
145 | #ifndef QT_NO_STYLE | 145 | #ifndef QT_NO_STYLE |
146 | - if ( !startingUp() ) | 146 | - if ( !startingUp() ) |
147 | + if ( !startingUp() ) { | 147 | + if ( !startingUp() ) { |
148 | qApp->style().polish( pal );// NB: non-const reference | 148 | qApp->style().polish( pal );// NB: non-const reference |
149 | +if ( className ) { | 149 | +if ( className ) { |
150 | + // if we just polished a class specific palette (this normally | 150 | + // if we just polished a class specific palette (this normally |
151 | + // only called by qt_fix_tooltips - see below), we better re- | 151 | + // only called by qt_fix_tooltips - see below), we better re- |
152 | + // polish the global palette. Some styles like liquid can get | 152 | + // polish the global palette. Some styles like liquid can get |
153 | + // confused, because they can not detect if the polished palette | 153 | + // confused, because they can not detect if the polished palette |
154 | + // is the global one or only a class specific one. | 154 | + // is the global one or only a class specific one. |
155 | + // (liquid uses this palette to calculate blending pixmaps) | 155 | + // (liquid uses this palette to calculate blending pixmaps) |
156 | + QPalette p = qApp-> palette ( ); | 156 | + QPalette p = qApp-> palette ( ); |
157 | + qApp->style().polish ( p ); | 157 | + qApp->style().polish ( p ); |
158 | +} | 158 | +} |
159 | + } | 159 | + } |
160 | #endif | 160 | #endif |
161 | bool all = FALSE; | 161 | bool all = FALSE; |
162 | if ( !className ) { | 162 | if ( !className ) { |
163 | @@ -1275,6 +1301,12 @@ | 163 | @@ -1275,6 +1301,12 @@ |
164 | void QApplication::setFont( const QFont &font, bool informWidgets, | 164 | void QApplication::setFont( const QFont &font, bool informWidgets, |
165 | const char* className ) | 165 | const char* className ) |
166 | { | 166 | { |
167 | +setFont_NonWeak ( font, informWidgets, className ); | 167 | +setFont_NonWeak ( font, informWidgets, className ); |
168 | +} | 168 | +} |
169 | + | 169 | + |
170 | +void QApplication::setFont_NonWeak( const QFont &font, bool informWidgets, | 170 | +void QApplication::setFont_NonWeak( const QFont &font, bool informWidgets, |
171 | + const char* className ) | 171 | + const char* className ) |
172 | +{ | 172 | +{ |
173 | bool all = FALSE; | 173 | bool all = FALSE; |
174 | if ( !className ) { | 174 | if ( !className ) { |
175 | if ( !app_font ) { | 175 | if ( !app_font ) { |
176 | Nur in qt-2.3.5/src/kernel: qapplication.cpp.orig. | 176 | Nur in qt-2.3.5/src/kernel: qapplication.cpp.orig. |
177 | diff -ru qt-2.3.5_fresh/src/kernel/qapplication.h qt-2.3.5/src/kernel/qapplication.h | 177 | diff -ru qt-2.3.5_fresh/src/kernel/qapplication.h qt-2.3.5/src/kernel/qapplication.h |
178 | --- qt-2.3.5_fresh/src/kernel/qapplication.h2003-05-13 15:56:10.000000000 +0200 | 178 | --- qt-2.3.5_fresh/src/kernel/qapplication.h2003-05-13 15:56:10.000000000 +0200 |
179 | +++ qt-2.3.5/src/kernel/qapplication.h2003-05-13 15:58:18.000000000 +0200 | 179 | +++ qt-2.3.5/src/kernel/qapplication.h2003-05-13 15:58:18.000000000 +0200 |
180 | @@ -61,6 +61,10 @@ | 180 | @@ -61,6 +61,10 @@ |
181 | class QSemaphore; | 181 | class QSemaphore; |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | +#if !defined( QT_WEAK_SYMBOL ) | 184 | +#if !defined( QT_WEAK_SYMBOL ) |
185 | +#define QT_WEAK_SYMBOL | 185 | +#define QT_WEAK_SYMBOL |
186 | +#endif | 186 | +#endif |
187 | + | 187 | + |
188 | // REMOVE IN 3.0 (just here for moc source compatibility) | 188 | // REMOVE IN 3.0 (just here for moc source compatibility) |
189 | #define QNonBaseApplication QApplication | 189 | #define QNonBaseApplication QApplication |
190 | 190 | ||
191 | @@ -85,7 +89,10 @@ | 191 | @@ -85,7 +89,10 @@ |
192 | 192 | ||
193 | #ifndef QT_NO_STYLE | 193 | #ifndef QT_NO_STYLE |
194 | static QStyle &style(); | 194 | static QStyle &style(); |
195 | - static void setStyle( QStyle* ); | 195 | - static void setStyle( QStyle* ); |
196 | + static void setStyle( QStyle* ) QT_WEAK_SYMBOL; | 196 | + static void setStyle( QStyle* ) QT_WEAK_SYMBOL; |
197 | +private: | 197 | +private: |
198 | +static void setStyle_NonWeak( QStyle* ); | 198 | +static void setStyle_NonWeak( QStyle* ); |
199 | +public: | 199 | +public: |
200 | #endif | 200 | #endif |
201 | #if 1/* OBSOLETE */ | 201 | #if 1/* OBSOLETE */ |
202 | enum ColorMode { NormalColors, CustomColors }; | 202 | enum ColorMode { NormalColors, CustomColors }; |
203 | @@ -106,11 +113,19 @@ | 203 | @@ -106,11 +113,19 @@ |
204 | #ifndef QT_NO_PALETTE | 204 | #ifndef QT_NO_PALETTE |
205 | static QPalette palette( const QWidget* = 0 ); | 205 | static QPalette palette( const QWidget* = 0 ); |
206 | static void setPalette( const QPalette &, bool informWidgets=FALSE, | 206 | static void setPalette( const QPalette &, bool informWidgets=FALSE, |
207 | + const char* className = 0 ) QT_WEAK_SYMBOL; | 207 | + const char* className = 0 ) QT_WEAK_SYMBOL; |
208 | +private: | 208 | +private: |
209 | + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE, | 209 | + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE, |
210 | const char* className = 0 ); | 210 | const char* className = 0 ); |
211 | +public: | 211 | +public: |
212 | #endif | 212 | #endif |
213 | static QFont font( const QWidget* = 0 ); | 213 | static QFont font( const QWidget* = 0 ); |
214 | static void setFont( const QFont &, bool informWidgets=FALSE, | 214 | static void setFont( const QFont &, bool informWidgets=FALSE, |
215 | + const char* className = 0 ) QT_WEAK_SYMBOL; | 215 | + const char* className = 0 ) QT_WEAK_SYMBOL; |
216 | +private: | 216 | +private: |
217 | + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE, | 217 | + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE, |
218 | const char* className = 0 ); | 218 | const char* className = 0 ); |
219 | +public: | 219 | +public: |
220 | static QFontMetrics fontMetrics(); | 220 | static QFontMetrics fontMetrics(); |
221 | 221 | ||
222 | QWidget *mainWidget() const; | 222 | QWidget *mainWidget() const; |
223 | @@ -207,7 +222,10 @@ | 223 | @@ -207,7 +222,10 @@ |
224 | void qwsSetCustomColors( QRgb *colortable, int start, int numColors ); | 224 | void qwsSetCustomColors( QRgb *colortable, int start, int numColors ); |
225 | #ifndef QT_NO_QWS_MANAGER | 225 | #ifndef QT_NO_QWS_MANAGER |
226 | static QWSDecoration &qwsDecoration(); | 226 | static QWSDecoration &qwsDecoration(); |
227 | - static void qwsSetDecoration( QWSDecoration *); | 227 | - static void qwsSetDecoration( QWSDecoration *); |
228 | + static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL; | 228 | + static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL; |
229 | +private: | 229 | +private: |
230 | + static void qwsSetDecoration_NonWeak( QWSDecoration *); | 230 | + static void qwsSetDecoration_NonWeak( QWSDecoration *); |
231 | +public: | 231 | +public: |
232 | #endif | 232 | #endif |
233 | #endif | 233 | #endif |
234 | 234 | ||
235 | diff -ru qt-2.3.5_fresh/src/kernel/qapplication_qws.cpp qt-2.3.5/src/kernel/qapplication_qws.cpp | 235 | diff -ru qt-2.3.5_fresh/src/kernel/qapplication_qws.cpp qt-2.3.5/src/kernel/qapplication_qws.cpp |
236 | --- qt-2.3.5_fresh/src/kernel/qapplication_qws.cpp2003-05-13 15:56:10.000000000 +0200 | 236 | --- qt-2.3.5_fresh/src/kernel/qapplication_qws.cpp2003-05-13 15:56:10.000000000 +0200 |
237 | +++ qt-2.3.5/src/kernel/qapplication_qws.cpp2003-05-13 15:58:18.000000000 +0200 | 237 | +++ qt-2.3.5/src/kernel/qapplication_qws.cpp2003-05-13 15:58:18.000000000 +0200 |
238 | @@ -2737,6 +2737,11 @@ | 238 | @@ -2737,6 +2737,11 @@ |
239 | */ | 239 | */ |
240 | void QApplication::qwsSetDecoration( QWSDecoration *d ) | 240 | void QApplication::qwsSetDecoration( QWSDecoration *d ) |
241 | { | 241 | { |
242 | +qwsSetDecoration_NonWeak ( d ); | 242 | +qwsSetDecoration_NonWeak ( d ); |
243 | +} | 243 | +} |
244 | + | 244 | + |
245 | +void QApplication::qwsSetDecoration_NonWeak( QWSDecoration *d ) | 245 | +void QApplication::qwsSetDecoration_NonWeak( QWSDecoration *d ) |
246 | +{ | 246 | +{ |
247 | if ( d ) { | 247 | if ( d ) { |
248 | delete qws_decoration; | 248 | delete qws_decoration; |
249 | qws_decoration = d; | 249 | qws_decoration = d; |
250 | Nur in qt-2.3.5/src/kernel: qapplication_qws.cpp.orig. | 250 | Nur in qt-2.3.5/src/kernel: qapplication_qws.cpp.orig. |
251 | diff -ru qt-2.3.5_fresh/src/kernel/qfontdatabase.cpp qt-2.3.5/src/kernel/qfontdatabase.cpp | 251 | diff -ru qt-2.3.5_fresh/src/kernel/qfontdatabase.cpp qt-2.3.5/src/kernel/qfontdatabase.cpp |
252 | --- qt-2.3.5_fresh/src/kernel/qfontdatabase.cpp2003-05-13 15:56:11.000000000 +0200 | 252 | --- qt-2.3.5_fresh/src/kernel/qfontdatabase.cpp2003-05-13 15:56:11.000000000 +0200 |
253 | +++ qt-2.3.5/src/kernel/qfontdatabase.cpp2003-05-13 15:58:18.000000000 +0200 | 253 | +++ qt-2.3.5/src/kernel/qfontdatabase.cpp2003-05-13 15:58:18.000000000 +0200 |
254 | @@ -35,6 +35,8 @@ | 254 | @@ -35,6 +35,8 @@ |
255 | ** | 255 | ** |
256 | **********************************************************************/ | 256 | **********************************************************************/ |
257 | 257 | ||
258 | +#define QT_WEAK_SYMBOL __attribute__(( weak )) | 258 | +#define QT_WEAK_SYMBOL __attribute__(( weak )) |
259 | + | 259 | + |
260 | #include "qfontdatabase.h" | 260 | #include "qfontdatabase.h" |
261 | 261 | ||
262 | #ifndef QT_NO_FONTDATABASE | 262 | #ifndef QT_NO_FONTDATABASE |
263 | @@ -2424,6 +2426,13 @@ | 263 | @@ -2424,6 +2426,13 @@ |
264 | const QString &style, | 264 | const QString &style, |
265 | const QString &charSet ) | 265 | const QString &charSet ) |
266 | { | 266 | { |
267 | +return pointSizes_NonWeak ( family, style, charSet ); | 267 | +return pointSizes_NonWeak ( family, style, charSet ); |
268 | +} | 268 | +} |
269 | + | 269 | + |
270 | +QValueList<int> QFontDatabase::pointSizes_NonWeak ( const QString &family, | 270 | +QValueList<int> QFontDatabase::pointSizes_NonWeak ( const QString &family, |
271 | + const QString &style, | 271 | + const QString &style, |
272 | + const QString &charSet ) | 272 | + const QString &charSet ) |
273 | +{ | 273 | +{ |
274 | QString cs( charSet ); | 274 | QString cs( charSet ); |
275 | if ( charSet.isEmpty() ) { | 275 | if ( charSet.isEmpty() ) { |
276 | QStringList lst = charSets( family ); | 276 | QStringList lst = charSets( family ); |
277 | diff -ru qt-2.3.5_fresh/src/kernel/qfontdatabase.h qt-2.3.5/src/kernel/qfontdatabase.h | 277 | diff -ru qt-2.3.5_fresh/src/kernel/qfontdatabase.h qt-2.3.5/src/kernel/qfontdatabase.h |
278 | --- qt-2.3.5_fresh/src/kernel/qfontdatabase.h2003-05-13 15:56:11.000000000 +0200 | 278 | --- qt-2.3.5_fresh/src/kernel/qfontdatabase.h2003-05-13 15:56:11.000000000 +0200 |
279 | +++ qt-2.3.5/src/kernel/qfontdatabase.h2003-05-13 15:58:18.000000000 +0200 | 279 | +++ qt-2.3.5/src/kernel/qfontdatabase.h2003-05-13 15:58:18.000000000 +0200 |
280 | @@ -59,6 +59,10 @@ | 280 | @@ -59,6 +59,10 @@ |
281 | class QDiskFont; | 281 | class QDiskFont; |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | +#if !defined( QT_WEAK_SYMBOL ) | 284 | +#if !defined( QT_WEAK_SYMBOL ) |
285 | +#define QT_WEAK_SYMBOL | 285 | +#define QT_WEAK_SYMBOL |
286 | +#endif | 286 | +#endif |
287 | + | 287 | + |
288 | class QFontDatabasePrivate; | 288 | class QFontDatabasePrivate; |
289 | 289 | ||
290 | class Q_EXPORT QFontDatabase | 290 | class Q_EXPORT QFontDatabase |
291 | @@ -67,9 +71,16 @@ | 291 | @@ -67,9 +71,16 @@ |
292 | QFontDatabase(); | 292 | QFontDatabase(); |
293 | 293 | ||
294 | QStringList families( bool onlyForLocale = TRUE ) const; | 294 | QStringList families( bool onlyForLocale = TRUE ) const; |
295 | + | 295 | + |
296 | + | 296 | + |
297 | QValueList<int> pointSizes( const QString &family, | 297 | QValueList<int> pointSizes( const QString &family, |
298 | const QString &style = QString::null, | 298 | const QString &style = QString::null, |
299 | - const QString &charSet = QString::null ); | 299 | - const QString &charSet = QString::null ); |
300 | + const QString &charSet = QString::null ) QT_WEAK_SYMBOL; | 300 | + const QString &charSet = QString::null ) QT_WEAK_SYMBOL; |
301 | +private: | 301 | +private: |
302 | + QValueList<int> pointSizes_NonWeak( const QString &family, | 302 | + QValueList<int> pointSizes_NonWeak( const QString &family, |
303 | + const QString &style, | 303 | + const QString &style, |
304 | + const QString &charSet ); | 304 | + const QString &charSet ); |
305 | +public: | 305 | +public: |
306 | QStringList styles( const QString &family, | 306 | QStringList styles( const QString &family, |
307 | const QString &charSet = QString::null ) const; | 307 | const QString &charSet = QString::null ) const; |
308 | QStringList charSets( const QString &familyName, | 308 | QStringList charSets( const QString &familyName, |
309 | diff -ru qt-2.3.5_fresh/src/kernel/qgfxraster_qws.cpp qt-2.3.5/src/kernel/qgfxraster_qws.cpp | 309 | diff -ru qt-2.3.5_fresh/src/kernel/qgfxraster_qws.cpp qt-2.3.5/src/kernel/qgfxraster_qws.cpp |
310 | --- qt-2.3.5_fresh/src/kernel/qgfxraster_qws.cpp2003-05-13 15:56:11.000000000 +0200 | 310 | --- qt-2.3.5_fresh/src/kernel/qgfxraster_qws.cpp2003-05-13 15:56:11.000000000 +0200 |
311 | +++ qt-2.3.5/src/kernel/qgfxraster_qws.cpp2003-05-13 15:58:18.000000000 +0200 | 311 | +++ qt-2.3.5/src/kernel/qgfxraster_qws.cpp2003-05-13 15:58:18.000000000 +0200 |
312 | @@ -4205,7 +4205,7 @@ | 312 | @@ -4205,7 +4205,7 @@ |
313 | setAlphaType(IgnoreAlpha); | 313 | setAlphaType(IgnoreAlpha); |
314 | if ( w <= 0 || h <= 0 || !ncliprect ) return; | 314 | if ( w <= 0 || h <= 0 || !ncliprect ) return; |
315 | GFX_START(QRect(rx+xoffs, ry+yoffs, w+1, h+1)) | 315 | GFX_START(QRect(rx+xoffs, ry+yoffs, w+1, h+1)) |
316 | -#ifdef QWS_EXPERIMENTAL_FASTPATH | 316 | -#ifdef QWS_EXPERIMENTAL_FASTPATH |
317 | +#if 0 // def QWS_EXPERIMENTAL_FASTPATH !! this is crashing HancomWord on OZ !! | 317 | +#if 0 // def QWS_EXPERIMENTAL_FASTPATH !! this is crashing HancomWord on OZ !! |
318 | // ### fix for 8bpp | 318 | // ### fix for 8bpp |
319 | // This seems to be reliable now, at least for 16bpp | 319 | // This seems to be reliable now, at least for 16bpp |
320 | 320 | ||
321 | Nur in qt-2.3.5/src/kernel: qgfxraster_qws.cpp.orig. | 321 | Nur in qt-2.3.5/src/kernel: qgfxraster_qws.cpp.orig. |
322 | diff -ru qt-2.3.5_fresh/src/kernel/qwindowsystem_qws.cpp qt-2.3.5/src/kernel/qwindowsystem_qws.cpp | 322 | diff -ru qt-2.3.5_fresh/src/kernel/qwindowsystem_qws.cpp qt-2.3.5/src/kernel/qwindowsystem_qws.cpp |
323 | --- qt-2.3.5_fresh/src/kernel/qwindowsystem_qws.cpp2003-05-13 15:56:11.000000000 +0200 | 323 | --- qt-2.3.5_fresh/src/kernel/qwindowsystem_qws.cpp2003-05-13 15:56:11.000000000 +0200 |
324 | +++ qt-2.3.5/src/kernel/qwindowsystem_qws.cpp2003-05-13 15:58:19.000000000 +0200 | 324 | +++ qt-2.3.5/src/kernel/qwindowsystem_qws.cpp2003-05-13 15:58:19.000000000 +0200 |
325 | @@ -843,6 +843,18 @@ | 325 | @@ -843,6 +843,18 @@ |
326 | { | 326 | { |
327 | } | 327 | } |
328 | 328 | ||
329 | +static void catchSegvSignal( int ) | 329 | +static void catchSegvSignal( int ) |
330 | +{ | 330 | +{ |
331 | +#ifndef QT_NO_QWS_KEYBOARD | 331 | +#ifndef QT_NO_QWS_KEYBOARD |
332 | + if ( qwsServer ) | 332 | + if ( qwsServer ) |
333 | +qwsServer->closeKeyboard(); | 333 | +qwsServer->closeKeyboard(); |
334 | +#endif | 334 | +#endif |
335 | + QWSServer::closedown(); | 335 | + QWSServer::closedown(); |
336 | + fprintf(stderr, "Segmentation fault.\n"); | 336 | + fprintf(stderr, "Segmentation fault.\n"); |
337 | + exit(1); | 337 | + exit(1); |
338 | +} | 338 | +} |
339 | + | 339 | + |
340 | + | 340 | + |
341 | /*! | 341 | /*! |
342 | \class QWSServer qwindowsystem_qws.h | 342 | \class QWSServer qwindowsystem_qws.h |
343 | \brief Server-specific functionality in Qt/Embedded | 343 | \brief Server-specific functionality in Qt/Embedded |
344 | @@ -912,6 +924,7 @@ | 344 | @@ -912,6 +924,7 @@ |
345 | } | 345 | } |
346 | 346 | ||
347 | signal(SIGPIPE, ignoreSignal); //we get it when we read | 347 | signal(SIGPIPE, ignoreSignal); //we get it when we read |
348 | + signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash | 348 | + signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash |
349 | #endif | 349 | #endif |
350 | focusw = 0; | 350 | focusw = 0; |
351 | mouseGrabber = 0; | 351 | mouseGrabber = 0; |
352 | diff -ru qt-2.3.5_fresh/src/widgets/qcommonstyle.cpp qt-2.3.5/src/widgets/qcommonstyle.cpp | 352 | diff -ru qt-2.3.5_fresh/src/widgets/qcommonstyle.cpp qt-2.3.5/src/widgets/qcommonstyle.cpp |
353 | --- qt-2.3.5_fresh/src/widgets/qcommonstyle.cpp2003-05-13 15:56:12.000000000 +0200 | 353 | --- qt-2.3.5_fresh/src/widgets/qcommonstyle.cpp2003-05-13 15:56:12.000000000 +0200 |
354 | +++ qt-2.3.5/src/widgets/qcommonstyle.cpp2003-05-13 15:58:19.000000000 +0200 | 354 | +++ qt-2.3.5/src/widgets/qcommonstyle.cpp2003-05-13 15:58:19.000000000 +0200 |
355 | @@ -566,7 +566,7 @@ | 355 | @@ -566,7 +566,7 @@ |
356 | bool enabled, bool active ) | 356 | bool enabled, bool active ) |
357 | { | 357 | { |
358 | #ifndef QT_NO_MENUBAR | 358 | #ifndef QT_NO_MENUBAR |
359 | -#ifndef QT_NO_STYLE_SGI | 359 | -#ifndef QT_NO_STYLE_SGI |
360 | +#if 1 // #ifndef QT_NO_STYLE_SGI | 360 | +#if 1 // #ifndef QT_NO_STYLE_SGI |
361 | if (draw_menu_bar_impl != 0) { | 361 | if (draw_menu_bar_impl != 0) { |
362 | QDrawMenuBarItemImpl impl = draw_menu_bar_impl; | 362 | QDrawMenuBarItemImpl impl = draw_menu_bar_impl; |
363 | (this->*impl)(p, x, y, w, h, mi, g, enabled, active); | 363 | (this->*impl)(p, x, y, w, h, mi, g, enabled, active); |
364 | Nur in qt-2.3.5/src/widgets: qcommonstyle.cpp.orig. | 364 | Nur in qt-2.3.5/src/widgets: qcommonstyle.cpp.orig. |
365 | diff -ru qt-2.3.5_fresh/src/widgets/qlistview.cpp qt-2.3.5/src/widgets/qlistview.cpp | 365 | diff -ru qt-2.3.5_fresh/src/widgets/qlistview.cpp qt-2.3.5/src/widgets/qlistview.cpp |
366 | --- qt-2.3.5_fresh/src/widgets/qlistview.cpp2003-05-13 15:56:12.000000000 +0200 | 366 | --- qt-2.3.5_fresh/src/widgets/qlistview.cpp2003-05-13 15:56:12.000000000 +0200 |
367 | +++ qt-2.3.5/src/widgets/qlistview.cpp2003-05-13 15:58:18.000000000 +0200 | 367 | +++ qt-2.3.5/src/widgets/qlistview.cpp2003-05-13 15:58:18.000000000 +0200 |
368 | @@ -4968,9 +4968,9 @@ | 368 | @@ -4968,9 +4968,9 @@ |
369 | l = l->childItem ? l->childItem : l->siblingItem; | 369 | l = l->childItem ? l->childItem : l->siblingItem; |
370 | 370 | ||
371 | if ( l && l->height() ) | 371 | if ( l && l->height() ) |
372 | -s.setHeight( s.height() + 10 * l->height() ); | 372 | -s.setHeight( s.height() + 10 * l->height() ); |
373 | - else | 373 | - else |
374 | -s.setHeight( s.height() + 140 ); | 374 | -s.setHeight( s.height() + 140 ); |
375 | +s.setHeight( s.height() + 4 /*10*/ * l->height() ); | 375 | +s.setHeight( s.height() + 4 /*10*/ * l->height() ); |
376 | + else // ^v much too big for handhelds | 376 | + else // ^v much too big for handhelds |
377 | +s.setHeight( s.height() + 30 /*140*/ ); | 377 | +s.setHeight( s.height() + 30 /*140*/ ); |
378 | 378 | ||
379 | if ( s.width() > s.height() * 3 ) | 379 | if ( s.width() > s.height() * 3 ) |
380 | s.setHeight( s.width() / 3 ); | 380 | s.setHeight( s.width() / 3 ); |
381 | diff -ru qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp qt-2.3.5/src/widgets/qtoolbutton.cpp | 381 | diff -ru qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp qt-2.3.5/src/widgets/qtoolbutton.cpp |
382 | --- qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp2003-05-13 15:56:12.000000000 +0200 | 382 | --- qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp2003-05-13 15:56:12.000000000 +0200 |
383 | +++ qt-2.3.5/src/widgets/qtoolbutton.cpp2003-05-13 15:58:18.000000000 +0200 | 383 | +++ qt-2.3.5/src/widgets/qtoolbutton.cpp2003-05-13 15:58:18.000000000 +0200 |
384 | @@ -230,7 +230,7 @@ | 384 | @@ -230,7 +230,7 @@ |
385 | else | 385 | else |
386 | QToolTip::add( this, textLabel ); | 386 | QToolTip::add( this, textLabel ); |
387 | } | 387 | } |
388 | -#endif | 388 | -#endif |
389 | +#endif | 389 | +#endif |
390 | } | 390 | } |
391 | 391 | ||
392 | 392 | ||
393 | @@ -324,12 +324,12 @@ | 393 | @@ -324,12 +324,12 @@ |
394 | QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal); | 394 | QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal); |
395 | w = pm.width(); | 395 | w = pm.width(); |
396 | h = pm.height(); | 396 | h = pm.height(); |
397 | -if ( w < 32 ) | 397 | -if ( w < 32 ) |
398 | - w = 32; | 398 | - w = 32; |
399 | -if ( h < 32 ) | 399 | -if ( h < 32 ) |
400 | - h = 32; | 400 | - h = 32; |
401 | +if ( w < 24 ) | 401 | +if ( w < 24 ) |
402 | + w = 24; | 402 | + w = 24; |
403 | +if ( h < 24 ) | 403 | +if ( h < 24 ) |
404 | + h = 24; | 404 | + h = 24; |
405 | } else { | 405 | } else { |
406 | -w = h = 16; | 406 | -w = h = 16; |
407 | +w = h = 14; | 407 | +w = h = 14; |
408 | QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal); | 408 | QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal); |
409 | w = pm.width(); | 409 | w = pm.width(); |
410 | h = pm.height(); | 410 | h = pm.height(); |
411 | --- qt-2.3.7/src/kernel/qkeyboard_qws.cpp~c7xxrotate2003-07-16 18:20:25.000000000 -0700 | ||
412 | +++ qt-2.3.7/src/kernel/qkeyboard_qws.cpp2003-12-07 15:54:10.000000000 -0800 | ||
413 | @@ -238,7 +238,7 @@ | ||
414 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 63 | ||
415 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 64 | ||
416 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 65 | ||
417 | - { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 66 | ||
418 | + { Qt::Key_F14, 0xffff , 0xffff , 0xffff }, // 66 | ||
419 | { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67 | ||
420 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 68 | ||
421 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 69 | ||