author | mickeyl <mickeyl> | 2004-04-24 15:51:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-24 15:51:18 (UTC) |
commit | 629ced22fc26892442be433403a9cfa9f662f08a (patch) (unidiff) | |
tree | 830973cb7ba701b0a897220e1307ad3f1243384b /inputmethods/multikey | |
parent | f7b5905d990f374dd6cb177b7a03628cc593b7cf (diff) | |
download | opie-629ced22fc26892442be433403a9cfa9f662f08a.zip opie-629ced22fc26892442be433403a9cfa9f662f08a.tar.gz opie-629ced22fc26892442be433403a9cfa9f662f08a.tar.bz2 |
gcc 3.4 fixes
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 4f4f25f..7ddfd3e 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -50,205 +50,205 @@ static const char * const kb_config_xpm[] = { | |||
50 | " . ", | 50 | " . ", |
51 | " . ", | 51 | " . ", |
52 | " "}; | 52 | " "}; |
53 | 53 | ||
54 | /* Keyboard::Keyboard {{{1 */ | 54 | /* Keyboard::Keyboard {{{1 */ |
55 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 55 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
56 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), | 56 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), |
57 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), | 57 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), |
58 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), | 58 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), |
59 | pressedKeyRow(-1), pressedKeyCol(-1), | 59 | pressedKeyRow(-1), pressedKeyCol(-1), |
60 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 60 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
61 | configdlg(0) | 61 | configdlg(0) |
62 | 62 | ||
63 | { | 63 | { |
64 | 64 | ||
65 | // get the default font | 65 | // get the default font |
66 | Config *config = new Config( "qpe" ); | 66 | Config *config = new Config( "qpe" ); |
67 | config->setGroup( "Appearance" ); | 67 | config->setGroup( "Appearance" ); |
68 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | 68 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); |
69 | delete config; | 69 | delete config; |
70 | 70 | ||
71 | config = new Config("multikey"); | 71 | config = new Config("multikey"); |
72 | config->setGroup ("general"); | 72 | config->setGroup ("general"); |
73 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed | 73 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed |
74 | useRepeat = config->readBoolEntry ("useRepeat", 1); | 74 | useRepeat = config->readBoolEntry ("useRepeat", 1); |
75 | delete config; | 75 | delete config; |
76 | 76 | ||
77 | 77 | ||
78 | setFont( QFont( familyStr, 10 ) ); | 78 | setFont( QFont( familyStr, 10 ) ); |
79 | 79 | ||
80 | picks = new KeyboardPicks( this ); | 80 | picks = new KeyboardPicks( this ); |
81 | picks->setFont( QFont( familyStr, 10 ) ); | 81 | picks->setFont( QFont( familyStr, 10 ) ); |
82 | picks->initialise(); | 82 | picks->initialise(); |
83 | if (usePicks) { | 83 | if (usePicks) { |
84 | 84 | ||
85 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 85 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
86 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 86 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
87 | 87 | ||
88 | } else picks->hide(); | 88 | } else picks->hide(); |
89 | 89 | ||
90 | loadKeyboardColors(); | 90 | loadKeyboardColors(); |
91 | 91 | ||
92 | keys = new Keys(); | 92 | keys = new Keys(); |
93 | 93 | ||
94 | repeatTimer = new QTimer( this ); | 94 | repeatTimer = new QTimer( this ); |
95 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 95 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
96 | 96 | ||
97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); | 97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); |
98 | connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 98 | connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(receive(const QCString&,const QByteArray&))); | 99 | this, SLOT(receive(const QCString&,const QByteArray&))); |
100 | } | 100 | } |
101 | 101 | ||
102 | Keyboard::~Keyboard() { | 102 | Keyboard::~Keyboard() { |
103 | 103 | ||
104 | if ( configdlg ) { | 104 | if ( configdlg ) { |
105 | delete configdlg; | 105 | delete configdlg; |
106 | configdlg = 0; | 106 | configdlg = 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | /* Keyboard::resizeEvent {{{1 */ | 111 | /* Keyboard::resizeEvent {{{1 */ |
112 | void Keyboard::resizeEvent(QResizeEvent*) | 112 | void Keyboard::resizeEvent(QResizeEvent*) |
113 | { | 113 | { |
114 | int ph = picks->sizeHint().height(); | 114 | int ph = picks->sizeHint().height(); |
115 | picks->setGeometry( 0, 0, width(), ph ); | 115 | picks->setGeometry( 0, 0, width(), ph ); |
116 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); | 116 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); |
117 | 117 | ||
118 | int nk; // number of keys? | 118 | int nk; // number of keys? |
119 | if ( useLargeKeys ) { | 119 | if ( useLargeKeys ) { |
120 | nk = 15; | 120 | nk = 15; |
121 | } else { | 121 | } else { |
122 | nk = 19; | 122 | nk = 19; |
123 | } | 123 | } |
124 | defaultKeyWidth = (width()/nk)/2; | 124 | defaultKeyWidth = (width()/nk)/2; |
125 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? | 125 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | /* KeyboardPicks::initialize {{{1 */ | 129 | /* KeyboardPicks::initialize {{{1 */ |
130 | void KeyboardPicks::initialise() | 130 | void KeyboardPicks::initialise() |
131 | { | 131 | { |
132 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 132 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
133 | mode = 0; | 133 | mode = 0; |
134 | dc = new KeyboardConfig(this); | 134 | dc = new KeyboardConfig(this); |
135 | configs.append(dc); | 135 | configs.append(dc); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* KeyboardPicks::sizeHint {{{1 */ | 138 | /* KeyboardPicks::sizeHint {{{1 */ |
139 | QSize KeyboardPicks::sizeHint() const | 139 | QSize KeyboardPicks::sizeHint() const |
140 | { | 140 | { |
141 | return QSize(240,fontMetrics().lineSpacing()); | 141 | return QSize(240,fontMetrics().lineSpacing()); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | /* KeyboardConfig::generateText {{{1 */ | 145 | /* KeyboardConfig::generateText {{{1 */ |
146 | void KeyboardConfig::generateText(const QString &s) | 146 | void KeyboardConfig::generateText(const QString &s) |
147 | { | 147 | { |
148 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 148 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
149 | for (int i=0; i<(int)backspaces; i++) { | 149 | for (int i=0; i<(int)backspaces; i++) { |
150 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 150 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
151 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 151 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
152 | } | 152 | } |
153 | for (int i=0; i<(int)s.length(); i++) { | 153 | for (int i=0; i<(int)s.length(); i++) { |
154 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 154 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
155 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 155 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
156 | } | 156 | } |
157 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 157 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
158 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 158 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
159 | backspaces = 0; | 159 | backspaces = 0; |
160 | #endif | 160 | #endif |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | /* Keyboard::paintEvent {{{1 */ | 166 | /* Keyboard::paintEvent {{{1 */ |
167 | void Keyboard::paintEvent(QPaintEvent* e) | 167 | void Keyboard::paintEvent(QPaintEvent* e) |
168 | { | 168 | { |
169 | QPainter painter(this); | 169 | QPainter painter(this); |
170 | painter.setClipRect(e->rect()); | 170 | painter.setClipRect(e->rect()); |
171 | drawKeyboard( painter ); | 171 | drawKeyboard( painter ); |
172 | picks->dc->draw( &painter ); | 172 | picks->dc->draw( &painter ); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
176 | /* Keyboard::drawKeyboard {{{1 */ | 176 | /* Keyboard::drawKeyboard {{{1 */ |
177 | 177 | ||
178 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) | 178 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) |
179 | { | 179 | { |
180 | 180 | ||
181 | 181 | ||
182 | if (row != -1 && col != -1) { //just redraw one key | 182 | if (row != -1 && col != -1) { //just redraw one key |
183 | 183 | ||
184 | int x = 0; | 184 | int x = 0; |
185 | for (int i = 0; i < col; i++) { | 185 | for (int i = 0; i < col; i++) { |
186 | 186 | ||
187 | x += keys->width(row, i) * defaultKeyWidth; | 187 | x += keys->width(row, i) * defaultKeyWidth; |
188 | } | 188 | } |
189 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 189 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
190 | 190 | ||
191 | int keyWidth = keys->width(row, col); | 191 | int keyWidth = keys->width(row, col); |
192 | 192 | ||
193 | p.fillRect(x + 1, y + 1, | 193 | p.fillRect(x + 1, y + 1, |
194 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, | 194 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, |
195 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); | 195 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); |
196 | 196 | ||
197 | QImage *pix = keys->pix(row,col); | 197 | QImage *pix = keys->pix(row,col); |
198 | 198 | ||
199 | ushort c = keys->uni(row, col); | 199 | ushort c = keys->uni(row, col); |
200 | 200 | ||
201 | p.setPen(textcolor); | 201 | p.setPen(textcolor); |
202 | if (!pix) { | 202 | if (!pix) { |
203 | if ((shift || lock) && keys->shift(c)) | 203 | if ((shift || lock) && keys->shift(c)) |
204 | 204 | ||
205 | if (circumflex && keys->circumflex(keys->shift(c))) | 205 | if (circumflex && keys->circumflex(keys->shift(c))) |
206 | c = keys->circumflex(keys->shift(c)); | 206 | c = keys->circumflex(keys->shift(c)); |
207 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | 207 | else if (diaeresis && keys->diaeresis(keys->shift(c))) |
208 | c = keys->diaeresis(keys->shift(c)); | 208 | c = keys->diaeresis(keys->shift(c)); |
209 | else if (baccent && keys->baccent(keys->shift(c))) | 209 | else if (baccent && keys->baccent(keys->shift(c))) |
210 | c = keys->baccent(keys->shift(c)); | 210 | c = keys->baccent(keys->shift(c)); |
211 | else if (accent && keys->accent(keys->shift(c))) | 211 | else if (accent && keys->accent(keys->shift(c))) |
212 | c = keys->accent(keys->shift(c)); | 212 | c = keys->accent(keys->shift(c)); |
213 | else if (meta && keys->meta(keys->shift(c))) | 213 | else if (meta && keys->meta(keys->shift(c))) |
214 | c = keys->meta(keys->shift(c)); | 214 | c = keys->meta(keys->shift(c)); |
215 | else | 215 | else |
216 | c = keys->shift(c); | 216 | c = keys->shift(c); |
217 | 217 | ||
218 | else if (meta && keys->meta(c)) | 218 | else if (meta && keys->meta(c)) |
219 | c = keys->meta(c); | 219 | c = keys->meta(c); |
220 | else if (circumflex && keys->circumflex(c)) | 220 | else if (circumflex && keys->circumflex(c)) |
221 | c = keys->circumflex(c); | 221 | c = keys->circumflex(c); |
222 | else if (baccent && keys->baccent(c)) | 222 | else if (baccent && keys->baccent(c)) |
223 | c = keys->baccent(c); | 223 | c = keys->baccent(c); |
224 | else if (accent && keys->accent(c)) | 224 | else if (accent && keys->accent(c)) |
225 | c = keys->accent(c); | 225 | c = keys->accent(c); |
226 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | 226 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { |
227 | 227 | ||
228 | // the diaeresis key itself has to be in the diaeresisMap, | 228 | // the diaeresis key itself has to be in the diaeresisMap, |
229 | // or just do this to make it display the diaeresis char. | 229 | // or just do this to make it display the diaeresis char. |
230 | 230 | ||
231 | if (c == 0x2c6) | 231 | if (c == 0x2c6) |
232 | c = 0xa8; | 232 | c = 0xa8; |
233 | else | 233 | else |
234 | c = keys->diaeresis(c); | 234 | c = keys->diaeresis(c); |
235 | } | 235 | } |
236 | 236 | ||
237 | p.drawText(x, y, | 237 | p.drawText(x, y, |
238 | defaultKeyWidth * keyWidth + 3, keyHeight, | 238 | defaultKeyWidth * keyWidth + 3, keyHeight, |
239 | AlignCenter, (QChar)c); | 239 | AlignCenter, (QChar)c); |
240 | } | 240 | } |
241 | else | 241 | else |
242 | // center the image in the middle of the key | 242 | // center the image in the middle of the key |
243 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, | 243 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, |
244 | y + (keyHeight - pix->height())/2 + 1, | 244 | y + (keyHeight - pix->height())/2 + 1, |
245 | *pix ); | 245 | *pix ); |
246 | 246 | ||
247 | // this fixes the problem that the very right end of the board's vertical line | 247 | // this fixes the problem that the very right end of the board's vertical line |
248 | // gets painted over, because it's one pixel shorter than all other keys | 248 | // gets painted over, because it's one pixel shorter than all other keys |
249 | p.setPen(keycolor_lines); | 249 | p.setPen(keycolor_lines); |
250 | p.drawLine(width() - 1, 0, width() - 1, height()); | 250 | p.drawLine(width() - 1, 0, width() - 1, height()); |
251 | 251 | ||
252 | } else { | 252 | } else { |
253 | 253 | ||
254 | 254 | ||