author | mickeyl <mickeyl> | 2004-04-24 15:46:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-24 15:46:03 (UTC) |
commit | f7b5905d990f374dd6cb177b7a03628cc593b7cf (patch) (unidiff) | |
tree | d4b2dc324fc54131dea3460462850cec786b8a88 | |
parent | 186c4d03ea8bf3aee4c535453409f1234442bff3 (diff) | |
download | opie-f7b5905d990f374dd6cb177b7a03628cc593b7cf.zip opie-f7b5905d990f374dd6cb177b7a03628cc593b7cf.tar.gz opie-f7b5905d990f374dd6cb177b7a03628cc593b7cf.tar.bz2 |
gcc 3.4 fixes
-rw-r--r-- | inputmethods/pickboard/pickboardcfg.cpp | 10 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardcfg.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/inputmethods/pickboard/pickboardcfg.cpp b/inputmethods/pickboard/pickboardcfg.cpp index e8b47cb..d500266 100644 --- a/inputmethods/pickboard/pickboardcfg.cpp +++ b/inputmethods/pickboard/pickboardcfg.cpp | |||
@@ -129,68 +129,68 @@ void PickboardConfig::doMenu(int i) | |||
129 | case 1: { | 129 | case 1: { |
130 | QMessageBox help("Pickboard Help", pickboard_help, | 130 | QMessageBox help("Pickboard Help", pickboard_help, |
131 | QMessageBox::NoIcon, 1, 0, 0); | 131 | QMessageBox::NoIcon, 1, 0, 0); |
132 | help.showMaximized(); | 132 | help.showMaximized(); |
133 | help.exec(); | 133 | help.exec(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | void StringConfig::draw(QPainter* p) | 138 | void StringConfig::draw(QPainter* p) |
139 | { | 139 | { |
140 | QFontMetrics fm = p->fontMetrics(); | 140 | QFontMetrics fm = p->fontMetrics(); |
141 | 141 | ||
142 | for (int r=0; r<nrows; r++) { | 142 | for (int r=0; r<nrows; r++) { |
143 | p->translate(0,fm.lineSpacing()); | 143 | p->translate(0,fm.lineSpacing()); |
144 | p->setPen(rowColor(r)); | 144 | p->setPen(rowColor(r)); |
145 | 145 | ||
146 | int tw=0; | 146 | int tw=0; |
147 | QString s; | 147 | QString s; |
148 | int i=0; | 148 | int i=0; |
149 | for (; !(s=text(r,i)).isNull(); ++i) { | 149 | for (; !(s=text(r,i)).isNull(); ++i) { |
150 | int w = fm.width(s); | 150 | int w = fm.width(s); |
151 | tw += w; | 151 | tw += w; |
152 | } | 152 | } |
153 | bool spread = spreadRow(r);// && parent->width() > tw; | 153 | bool spread = spreadRow(r);// && parent->width() > tw; |
154 | int xw = spread ? (parent->width()-tw)/(i-1) : 3; | 154 | int xw = spread ? (parent->width()-tw)/(i-1) : 3; |
155 | int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2; | 155 | int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2; |
156 | 156 | ||
157 | i=0; | 157 | i=0; |
158 | for (; !(s=text(r,i)).isNull(); ++i) { | 158 | for (; !(s=text(r,i)).isNull(); ++i) { |
159 | int w = fm.width(s)+xw; | 159 | int w = fm.width(s)+xw; |
160 | if ( highlight(r,i) ) { | 160 | if ( highlight(r,i) ) { |
161 | p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),Qt::black); | 161 | p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),::Qt::black); |
162 | p->setPen(Qt::white); | 162 | p->setPen(::Qt::white); |
163 | }else{ | 163 | }else{ |
164 | p->setPen(Qt::black); | 164 | p->setPen(::Qt::black); |
165 | } | 165 | } |
166 | p->drawText(x,-fm.descent()-1,s); | 166 | p->drawText(x,-fm.descent()-1,s); |
167 | x += w; | 167 | x += w; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void StringConfig::pickInRow(int r, int xpos, bool press) | 172 | void StringConfig::pickInRow(int r, int xpos, bool press) |
173 | { | 173 | { |
174 | QFontMetrics fm = parent->fontMetrics(); | 174 | QFontMetrics fm = parent->fontMetrics(); |
175 | 175 | ||
176 | int tw=0; | 176 | int tw=0; |
177 | QString s; | 177 | QString s; |
178 | int i=0; | 178 | int i=0; |
179 | for (; !(s=text(r,i)).isNull(); ++i) { | 179 | for (; !(s=text(r,i)).isNull(); ++i) { |
180 | int w = fm.width(s); | 180 | int w = fm.width(s); |
181 | tw += w; | 181 | tw += w; |
182 | } | 182 | } |
183 | bool spread = spreadRow(r) && parent->width() > tw; | 183 | bool spread = spreadRow(r) && parent->width() > tw; |
184 | int xw = spread ? (parent->width()-tw)/(i-1) : 3; | 184 | int xw = spread ? (parent->width()-tw)/(i-1) : 3; |
185 | int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2; | 185 | int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2; |
186 | 186 | ||
187 | i=0; | 187 | i=0; |
188 | for (; !(s=text(r,i)).isNull(); ++i) { | 188 | for (; !(s=text(r,i)).isNull(); ++i) { |
189 | int x2 = x + fm.width(s)+xw; | 189 | int x2 = x + fm.width(s)+xw; |
190 | if ( xpos >= x && xpos < x2 ) { | 190 | if ( xpos >= x && xpos < x2 ) { |
191 | pick(press, r, i); | 191 | pick(press, r, i); |
192 | return; | 192 | return; |
193 | } | 193 | } |
194 | x = x2; | 194 | x = x2; |
195 | } | 195 | } |
196 | } | 196 | } |
@@ -402,68 +402,68 @@ QStringList DictFilterConfig::capitalize(const QStringList& l) | |||
402 | return r; | 402 | return r; |
403 | } | 403 | } |
404 | } | 404 | } |
405 | return l; | 405 | return l; |
406 | } | 406 | } |
407 | 407 | ||
408 | QString DictFilterConfig::capitalize(const QString& s) | 408 | QString DictFilterConfig::capitalize(const QString& s) |
409 | { | 409 | { |
410 | switch ( shift ) { | 410 | switch ( shift ) { |
411 | case 1: { | 411 | case 1: { |
412 | QString u = s; | 412 | QString u = s; |
413 | u[0] = u[0].upper(); | 413 | u[0] = u[0].upper(); |
414 | return u; | 414 | return u; |
415 | break; | 415 | break; |
416 | } case 2: | 416 | } case 2: |
417 | return s.upper(); | 417 | return s.upper(); |
418 | break; | 418 | break; |
419 | } | 419 | } |
420 | return s; | 420 | return s; |
421 | } | 421 | } |
422 | 422 | ||
423 | void DictFilterConfig::pick(bool press, int row, int item) | 423 | void DictFilterConfig::pick(bool press, int row, int item) |
424 | { | 424 | { |
425 | if ( row == 0 ) { | 425 | if ( row == 0 ) { |
426 | if ( press ) { | 426 | if ( press ) { |
427 | if ( input.isEmpty() ) { | 427 | if ( input.isEmpty() ) { |
428 | lit0 = item; | 428 | lit0 = item; |
429 | if ( othermodes[item] == "Space" ) { | 429 | if ( othermodes[item] == "Space" ) { |
430 | updateItem(row,item); | 430 | updateItem(row,item); |
431 | generateText(" "); | 431 | generateText(" "); |
432 | } else if ( othermodes[item] == "Back" ) { | 432 | } else if ( othermodes[item] == "Back" ) { |
433 | updateItem(row,item); | 433 | updateItem(row,item); |
434 | generateKey(Qt::Key_Backspace); | 434 | generateKey(::Qt::Key_Backspace); |
435 | } else if ( othermodes[item] == "Enter" ) { | 435 | } else if ( othermodes[item] == "Enter" ) { |
436 | updateItem(row,item); | 436 | updateItem(row,item); |
437 | generateKey(Qt::Key_Return); | 437 | generateKey(::Qt::Key_Return); |
438 | } else if ( othermodes[item] == "Shift" ) { | 438 | } else if ( othermodes[item] == "Shift" ) { |
439 | updateItem(row,item); | 439 | updateItem(row,item); |
440 | shift = (shift+1)%3; | 440 | shift = (shift+1)%3; |
441 | } | 441 | } |
442 | } | 442 | } |
443 | } else { | 443 | } else { |
444 | if ( !input.isEmpty() ) { | 444 | if ( !input.isEmpty() ) { |
445 | input.clear(); | 445 | input.clear(); |
446 | if ( item>=0 ) { | 446 | if ( item>=0 ) { |
447 | generateText(capitalize(matches[item])); | 447 | generateText(capitalize(matches[item])); |
448 | } | 448 | } |
449 | shift = 0; | 449 | shift = 0; |
450 | matches.clear(); | 450 | matches.clear(); |
451 | updateRows(0,0); | 451 | updateRows(0,0); |
452 | } else if ( item < 3 ) { | 452 | } else if ( item < 3 ) { |
453 | lit0 = -1; | 453 | lit0 = -1; |
454 | changeMode(item+1); // I'm mode 0! #### | 454 | changeMode(item+1); // I'm mode 0! #### |
455 | updateRows(0,1); | 455 | updateRows(0,1); |
456 | } | 456 | } |
457 | if ( lit0 >= 0 ) { | 457 | if ( lit0 >= 0 ) { |
458 | if ( !shift || othermodes[lit0] != "Shift" ) { | 458 | if ( !shift || othermodes[lit0] != "Shift" ) { |
459 | updateItem(0,lit0); | 459 | updateItem(0,lit0); |
460 | lit0 = -1; | 460 | lit0 = -1; |
461 | } | 461 | } |
462 | } | 462 | } |
463 | } | 463 | } |
464 | } else { | 464 | } else { |
465 | lit0 = -1; | 465 | lit0 = -1; |
466 | if ( press && item >= 0 ) { | 466 | if ( press && item >= 0 ) { |
467 | lit1 = item; | 467 | lit1 = item; |
468 | add(sets[item]); | 468 | add(sets[item]); |
469 | updateItem(1,item); | 469 | updateItem(1,item); |
diff --git a/inputmethods/pickboard/pickboardcfg.h b/inputmethods/pickboard/pickboardcfg.h index e0dc0dd..b1913df 100644 --- a/inputmethods/pickboard/pickboardcfg.h +++ b/inputmethods/pickboard/pickboardcfg.h | |||
@@ -83,65 +83,65 @@ public: | |||
83 | virtual void pickPoint(const QPoint& p, bool press); | 83 | virtual void pickPoint(const QPoint& p, bool press); |
84 | virtual void draw(QPainter*)=0; | 84 | virtual void draw(QPainter*)=0; |
85 | virtual void fillMenu(QPopupMenu&); | 85 | virtual void fillMenu(QPopupMenu&); |
86 | virtual void doMenu(int); | 86 | virtual void doMenu(int); |
87 | 87 | ||
88 | protected: | 88 | protected: |
89 | void updateRows(int from, int to); | 89 | void updateRows(int from, int to); |
90 | virtual void updateItem(int r, int i); | 90 | virtual void updateItem(int r, int i); |
91 | virtual void pickInRow(int r, int xpos, bool press)=0; | 91 | virtual void pickInRow(int r, int xpos, bool press)=0; |
92 | 92 | ||
93 | void changeMode(int m); | 93 | void changeMode(int m); |
94 | virtual void generateText(const QString& s); | 94 | virtual void generateText(const QString& s); |
95 | void generateKey( int k ); | 95 | void generateKey( int k ); |
96 | 96 | ||
97 | virtual void pick(bool press, int row, int item)=0; | 97 | virtual void pick(bool press, int row, int item)=0; |
98 | 98 | ||
99 | protected: | 99 | protected: |
100 | PickboardPicks* parent; | 100 | PickboardPicks* parent; |
101 | int nrows; | 101 | int nrows; |
102 | private: | 102 | private: |
103 | int pressrow, pressx; | 103 | int pressrow, pressx; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | class StringConfig : public PickboardConfig { | 106 | class StringConfig : public PickboardConfig { |
107 | public: | 107 | public: |
108 | StringConfig(PickboardPicks* p) : PickboardConfig(p) { } | 108 | StringConfig(PickboardPicks* p) : PickboardConfig(p) { } |
109 | 109 | ||
110 | void draw(QPainter* p); | 110 | void draw(QPainter* p); |
111 | 111 | ||
112 | protected: | 112 | protected: |
113 | virtual QString text(int r, int i)=0; | 113 | virtual QString text(int r, int i)=0; |
114 | virtual bool spreadRow(int i)=0; | 114 | virtual bool spreadRow(int i)=0; |
115 | virtual QColor rowColor(int) { return Qt::black; } | 115 | virtual QColor rowColor(int) { return ::Qt::black; } |
116 | virtual void pickInRow(int r, int xpos, bool press); | 116 | virtual void pickInRow(int r, int xpos, bool press); |
117 | virtual void updateItem(int r, int i); | 117 | virtual void updateItem(int r, int i); |
118 | virtual bool highlight(int,int) const; | 118 | virtual bool highlight(int,int) const; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | class CharStringConfig : public StringConfig { | 121 | class CharStringConfig : public StringConfig { |
122 | QString input; | 122 | QString input; |
123 | QStringList chars; | 123 | QStringList chars; |
124 | public: | 124 | public: |
125 | CharStringConfig(PickboardPicks* p) : StringConfig(p) { } | 125 | CharStringConfig(PickboardPicks* p) : StringConfig(p) { } |
126 | 126 | ||
127 | void addChar(const QString& s); | 127 | void addChar(const QString& s); |
128 | virtual void doMenu(int); | 128 | virtual void doMenu(int); |
129 | 129 | ||
130 | protected: | 130 | protected: |
131 | QString text(int r, int i); | 131 | QString text(int r, int i); |
132 | bool spreadRow(int i); | 132 | bool spreadRow(int i); |
133 | void pick(bool press, int row, int item); | 133 | void pick(bool press, int row, int item); |
134 | }; | 134 | }; |
135 | 135 | ||
136 | class DictFilterConfig : public StringConfig { | 136 | class DictFilterConfig : public StringConfig { |
137 | QStringList matches; | 137 | QStringList matches; |
138 | QStringList sets; | 138 | QStringList sets; |
139 | QStringList othermodes; | 139 | QStringList othermodes; |
140 | int lit0; | 140 | int lit0; |
141 | int lit1; | 141 | int lit1; |
142 | int shift; | 142 | int shift; |
143 | QString capitalize(const QString& s); | 143 | QString capitalize(const QString& s); |
144 | QStringList capitalize(const QStringList& s); | 144 | QStringList capitalize(const QStringList& s); |
145 | 145 | ||
146 | public: | 146 | public: |
147 | QStringList input; | 147 | QStringList input; |