summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Unidiff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp8
1 files changed, 4 insertions, 4 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
@@ -102,105 +102,105 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
102Keyboard::~Keyboard() { 102Keyboard::~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 */
112void Keyboard::resizeEvent(QResizeEvent*) 112void 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 */
130void KeyboardPicks::initialise() 130void 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 */
139QSize KeyboardPicks::sizeHint() const 139QSize 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 */
146void KeyboardConfig::generateText(const QString &s) 146void 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 */
167void Keyboard::paintEvent(QPaintEvent* e) 167void 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
178void Keyboard::drawKeyboard(QPainter &p, int row, int col) 178void 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));