-rw-r--r-- | inputmethods/dvorak/dvorak.cpp | 2 | ||||
-rw-r--r-- | inputmethods/dvorak/dvorak.h | 4 | ||||
-rw-r--r-- | inputmethods/dvorak/dvorakimpl.cpp | 6 | ||||
-rw-r--r-- | inputmethods/dvorak/dvorakimpl.h | 13 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboard.cpp | 1 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboard.h | 5 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboardimpl.cpp | 4 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboardimpl.h | 12 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboard.cpp | 1 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboard.h | 5 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboardimpl.cpp | 8 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboardimpl.h | 13 | ||||
-rw-r--r-- | inputmethods/kjumpx/keyboard.cpp | 1 | ||||
-rw-r--r-- | inputmethods/kjumpx/keyboard.h | 5 | ||||
-rw-r--r-- | inputmethods/kjumpx/keyboardimpl.cpp | 4 | ||||
-rw-r--r-- | inputmethods/kjumpx/keyboardimpl.h | 12 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 1 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.h | 5 | ||||
-rw-r--r-- | inputmethods/multikey/keyboardimpl.cpp | 4 | ||||
-rw-r--r-- | inputmethods/multikey/keyboardimpl.h | 13 |
20 files changed, 94 insertions, 25 deletions
diff --git a/inputmethods/dvorak/dvorak.cpp b/inputmethods/dvorak/dvorak.cpp index 29b5bd0..97afa0a 100644 --- a/inputmethods/dvorak/dvorak.cpp +++ b/inputmethods/dvorak/dvorak.cpp | |||
@@ -1,129 +1,131 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "dvorak.h" | 21 | #include "dvorak.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | 24 | ||
25 | #include <qwindowsystem_qws.h> | 25 | #include <qwindowsystem_qws.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | 31 | ||
32 | #define USE_SMALL_BACKSPACE | 32 | #define USE_SMALL_BACKSPACE |
33 | 33 | ||
34 | using namespace Dvorak; | ||
35 | |||
34 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : | 36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : |
35 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
36 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
37 | unicode(-1), qkeycode(0), modifiers(0) | 39 | unicode(-1), qkeycode(0), modifiers(0) |
38 | { | 40 | { |
39 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
40 | // setFont( QFont( "Helvetica", 8 ) ); | 42 | // setFont( QFont( "Helvetica", 8 ) ); |
41 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 43 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
42 | setPalette(QPalette(QColor(220,220,220))); // Gray | 44 | setPalette(QPalette(QColor(220,220,220))); // Gray |
43 | 45 | ||
44 | picks = new KeyboardPicks( this ); | 46 | picks = new KeyboardPicks( this ); |
45 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 47 | picks->setFont( QFont( "smallsmooth", 9 ) ); |
46 | setFont( QFont( "smallsmooth", 9 ) ); | 48 | setFont( QFont( "smallsmooth", 9 ) ); |
47 | picks->initialise(); | 49 | picks->initialise(); |
48 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
49 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
50 | 52 | ||
51 | repeatTimer = new QTimer( this ); | 53 | repeatTimer = new QTimer( this ); |
52 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 54 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
53 | } | 55 | } |
54 | 56 | ||
55 | void Keyboard::resizeEvent(QResizeEvent*) | 57 | void Keyboard::resizeEvent(QResizeEvent*) |
56 | { | 58 | { |
57 | int ph = picks->sizeHint().height(); | 59 | int ph = picks->sizeHint().height(); |
58 | picks->setGeometry( 0, 0, width(), ph ); | 60 | picks->setGeometry( 0, 0, width(), ph ); |
59 | keyHeight = (height()-ph)/5; | 61 | keyHeight = (height()-ph)/5; |
60 | int nk; | 62 | int nk; |
61 | if ( useOptiKeys ) { | 63 | if ( useOptiKeys ) { |
62 | nk = 15; | 64 | nk = 15; |
63 | } else if ( useLargeKeys ) { | 65 | } else if ( useLargeKeys ) { |
64 | nk = 15; | 66 | nk = 15; |
65 | } else { | 67 | } else { |
66 | nk = 19; | 68 | nk = 19; |
67 | } | 69 | } |
68 | defaultKeyWidth = width()/nk; | 70 | defaultKeyWidth = width()/nk; |
69 | xoffs = (width()-defaultKeyWidth*nk)/2; | 71 | xoffs = (width()-defaultKeyWidth*nk)/2; |
70 | } | 72 | } |
71 | 73 | ||
72 | void KeyboardPicks::initialise() | 74 | void KeyboardPicks::initialise() |
73 | { | 75 | { |
74 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 76 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
75 | mode = 0; | 77 | mode = 0; |
76 | dc = new KeyboardConfig(this); | 78 | dc = new KeyboardConfig(this); |
77 | configs.append(dc); | 79 | configs.append(dc); |
78 | } | 80 | } |
79 | 81 | ||
80 | QSize KeyboardPicks::sizeHint() const | 82 | QSize KeyboardPicks::sizeHint() const |
81 | { | 83 | { |
82 | return QSize(240,fontMetrics().lineSpacing()); | 84 | return QSize(240,fontMetrics().lineSpacing()); |
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
86 | void KeyboardConfig::generateText(const QString &s) | 88 | void KeyboardConfig::generateText(const QString &s) |
87 | { | 89 | { |
88 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 90 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
89 | for (int i=0; i<(int)backspaces; i++) { | 91 | for (int i=0; i<(int)backspaces; i++) { |
90 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 92 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); |
91 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 93 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); |
92 | } | 94 | } |
93 | for (int i=0; i<(int)s.length(); i++) { | 95 | for (int i=0; i<(int)s.length(); i++) { |
94 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 96 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
95 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 97 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
96 | } | 98 | } |
97 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 99 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); |
98 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 100 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); |
99 | backspaces = 0; | 101 | backspaces = 0; |
100 | #endif | 102 | #endif |
101 | } | 103 | } |
102 | 104 | ||
103 | 105 | ||
104 | //PC keyboard layout and scancodes | 106 | //PC keyboard layout and scancodes |
105 | 107 | ||
106 | /* | 108 | /* |
107 | Format: length, code, length, code, ..., 0 | 109 | Format: length, code, length, code, ..., 0 |
108 | 110 | ||
109 | length is measured in half the width of a standard key. | 111 | length is measured in half the width of a standard key. |
110 | If code < 0x80 we have length/2 consecutive standard keys, | 112 | If code < 0x80 we have length/2 consecutive standard keys, |
111 | starting with scancode code. | 113 | starting with scancode code. |
112 | 114 | ||
113 | Special keys are hardcoded, one at a time, with length of key | 115 | Special keys are hardcoded, one at a time, with length of key |
114 | and code >= 0x80, these are NOT standard PC scancodes, but are looked | 116 | and code >= 0x80, these are NOT standard PC scancodes, but are looked |
115 | up in specialM[]. (The special keys are not keymappable.) | 117 | up in specialM[]. (The special keys are not keymappable.) |
116 | 118 | ||
117 | */ | 119 | */ |
118 | 120 | ||
119 | static const uchar * const keyboard_opti[5] = { | 121 | static const uchar * const keyboard_opti[5] = { |
120 | (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", | 122 | (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", |
121 | (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", | 123 | (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", |
122 | (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", | 124 | (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", |
123 | (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", | 125 | (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", |
124 | (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" | 126 | (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" |
125 | }; | 127 | }; |
126 | 128 | ||
127 | static const uchar * const keyboard_standard[5] = { | 129 | static const uchar * const keyboard_standard[5] = { |
128 | 130 | ||
129 | #ifdef USE_SMALL_BACKSPACE | 131 | #ifdef USE_SMALL_BACKSPACE |
diff --git a/inputmethods/dvorak/dvorak.h b/inputmethods/dvorak/dvorak.h index 38ae338..216b5e5 100644 --- a/inputmethods/dvorak/dvorak.h +++ b/inputmethods/dvorak/dvorak.h | |||
@@ -1,103 +1,107 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qframe.h> | 20 | #include <qframe.h> |
21 | #include "../pickboard/pickboardcfg.h" | 21 | #include "../pickboard/pickboardcfg.h" |
22 | #include "../pickboard/pickboardpicks.h" | 22 | #include "../pickboard/pickboardpicks.h" |
23 | 23 | ||
24 | class QTimer; | 24 | class QTimer; |
25 | 25 | ||
26 | namespace Dvorak | ||
27 | { | ||
28 | |||
26 | class KeyboardConfig : public DictFilterConfig | 29 | class KeyboardConfig : public DictFilterConfig |
27 | { | 30 | { |
28 | public: | 31 | public: |
29 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } | 32 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } |
30 | virtual void generateText(const QString &s); | 33 | virtual void generateText(const QString &s); |
31 | void decBackspaces() { if (backspaces) backspaces--; } | 34 | void decBackspaces() { if (backspaces) backspaces--; } |
32 | void incBackspaces() { backspaces++; } | 35 | void incBackspaces() { backspaces++; } |
33 | void resetBackspaces() { backspaces = 0; } | 36 | void resetBackspaces() { backspaces = 0; } |
34 | private: | 37 | private: |
35 | int backspaces; | 38 | int backspaces; |
36 | }; | 39 | }; |
37 | 40 | ||
38 | 41 | ||
39 | class KeyboardPicks : public PickboardPicks | 42 | class KeyboardPicks : public PickboardPicks |
40 | { | 43 | { |
41 | Q_OBJECT | 44 | Q_OBJECT |
42 | public: | 45 | public: |
43 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) | 46 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) |
44 | : PickboardPicks(parent, name, f) { } | 47 | : PickboardPicks(parent, name, f) { } |
45 | void initialise(); | 48 | void initialise(); |
46 | virtual QSize sizeHint() const; | 49 | virtual QSize sizeHint() const; |
47 | KeyboardConfig *dc; | 50 | KeyboardConfig *dc; |
48 | }; | 51 | }; |
49 | 52 | ||
50 | class Keyboard : public QFrame | 53 | class Keyboard : public QFrame |
51 | { | 54 | { |
52 | Q_OBJECT | 55 | Q_OBJECT |
53 | public: | 56 | public: |
54 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
55 | 58 | ||
56 | void resetState(); | 59 | void resetState(); |
57 | 60 | ||
58 | void mousePressEvent(QMouseEvent*); | 61 | void mousePressEvent(QMouseEvent*); |
59 | void mouseReleaseEvent(QMouseEvent*); | 62 | void mouseReleaseEvent(QMouseEvent*); |
60 | void resizeEvent(QResizeEvent*); | 63 | void resizeEvent(QResizeEvent*); |
61 | void paintEvent(QPaintEvent* e); | 64 | void paintEvent(QPaintEvent* e); |
62 | void timerEvent(QTimerEvent* e); | 65 | void timerEvent(QTimerEvent* e); |
63 | void drawKeyboard( QPainter &p, int key = -1 ); | 66 | void drawKeyboard( QPainter &p, int key = -1 ); |
64 | 67 | ||
65 | void setMode(int mode) { useOptiKeys = mode; } | 68 | void setMode(int mode) { useOptiKeys = mode; } |
66 | 69 | ||
67 | QSize sizeHint() const; | 70 | QSize sizeHint() const; |
68 | 71 | ||
69 | signals: | 72 | signals: |
70 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); | 73 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); |
71 | 74 | ||
72 | private slots: | 75 | private slots: |
73 | void repeat(); | 76 | void repeat(); |
74 | 77 | ||
75 | private: | 78 | private: |
76 | int getKey( int &w, int j = -1 ); | 79 | int getKey( int &w, int j = -1 ); |
77 | void clearHighlight(); | 80 | void clearHighlight(); |
78 | 81 | ||
79 | uint shift:1; | 82 | uint shift:1; |
80 | uint lock:1; | 83 | uint lock:1; |
81 | uint ctrl:1; | 84 | uint ctrl:1; |
82 | uint alt:1; | 85 | uint alt:1; |
83 | uint useLargeKeys:1; | 86 | uint useLargeKeys:1; |
84 | uint useOptiKeys:1; | 87 | uint useOptiKeys:1; |
85 | 88 | ||
86 | int pressedKey; | 89 | int pressedKey; |
87 | 90 | ||
88 | KeyboardPicks *picks; | 91 | KeyboardPicks *picks; |
89 | 92 | ||
90 | int keyHeight; | 93 | int keyHeight; |
91 | int defaultKeyWidth; | 94 | int defaultKeyWidth; |
92 | int xoffs; | 95 | int xoffs; |
93 | 96 | ||
94 | int unicode; | 97 | int unicode; |
95 | int qkeycode; | 98 | int qkeycode; |
96 | int modifiers; | 99 | int modifiers; |
97 | 100 | ||
98 | int pressTid; | 101 | int pressTid; |
99 | bool pressed; | 102 | bool pressed; |
100 | 103 | ||
101 | QTimer *repeatTimer; | 104 | QTimer *repeatTimer; |
102 | }; | 105 | }; |
103 | 106 | ||
107 | } // namespace Dvorak | ||
diff --git a/inputmethods/dvorak/dvorakimpl.cpp b/inputmethods/dvorak/dvorakimpl.cpp index 3c83464..8050ce1 100644 --- a/inputmethods/dvorak/dvorakimpl.cpp +++ b/inputmethods/dvorak/dvorakimpl.cpp | |||
@@ -1,130 +1,130 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include "dvorak.h" | 22 | #include "dvorak.h" |
23 | #include "dvorakimpl.h" | 23 | #include "dvorakimpl.h" |
24 | 24 | ||
25 | /* XPM */ | 25 | /* XPM */ |
26 | static const char * kb_xpm[] = { | 26 | static const char * const kb_xpm[] = { |
27 | "28 13 4 1", | 27 | "28 13 4 1", |
28 | " c None", | 28 | " c None", |
29 | ". c #4C4C4C", | 29 | ". c #4C4C4C", |
30 | "+ c #FFF7DD", | 30 | "+ c #FFF7DD", |
31 | "@ c #D6CFBA", | 31 | "@ c #D6CFBA", |
32 | " .......................... ", | 32 | " .......................... ", |
33 | " .+++.+++.+++.+++.+++.++++. ", | 33 | " .+++.+++.+++.+++.+++.++++. ", |
34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", | 34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", |
35 | " .......................... ", | 35 | " .......................... ", |
36 | " .+++++.+++.+++.+++.++++++. ", | 36 | " .+++++.+++.+++.+++.++++++. ", |
37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", | 37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", |
38 | " .......................... ", | 38 | " .......................... ", |
39 | " .++++++.+++.+++.+++.+++++. ", | 39 | " .++++++.+++.+++.+++.+++++. ", |
40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", | 40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", |
41 | " .......................... ", | 41 | " .......................... ", |
42 | " .++++.++++++++++++++.++++. ", | 42 | " .++++.++++++++++++++.++++. ", |
43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", | 43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", |
44 | " .......................... "}; | 44 | " .......................... "}; |
45 | 45 | ||
46 | 46 | ||
47 | /* XPM */ | 47 | /* XPM */ |
48 | static char * opti_xpm[] = { | 48 | static const char * const opti_xpm[] = { |
49 | "28 13 4 1", | 49 | "28 13 4 1", |
50 | " c None", | 50 | " c None", |
51 | ". c #4C4C4C", | 51 | ". c #4C4C4C", |
52 | "+ c #FFF7DD", | 52 | "+ c #FFF7DD", |
53 | "@ c #D6CFBA", | 53 | "@ c #D6CFBA", |
54 | " ......................... ", | 54 | " ......................... ", |
55 | " .+++.+++.+++.+++.+++.+++. ", | 55 | " .+++.+++.+++.+++.+++.+++. ", |
56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
57 | " ......................... ", | 57 | " ......................... ", |
58 | " .+++.+++.+++.+++.+++.+++. ", | 58 | " .+++.+++.+++.+++.+++.+++. ", |
59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
60 | " ......................... ", | 60 | " ......................... ", |
61 | " .+++.+++.+++.+++.+++.+++. ", | 61 | " .+++.+++.+++.+++.+++.+++. ", |
62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
63 | " ......................... ", | 63 | " ......................... ", |
64 | " .+++.+++.+++.+++.+++.+++. ", | 64 | " .+++.+++.+++.+++.+++.+++. ", |
65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
66 | " ......................... "}; | 66 | " ......................... "}; |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | KeyboardImpl::KeyboardImpl() | 70 | KeyboardImpl::KeyboardImpl() |
71 | : input(0), icn(0), ref(0) | 71 | : input(0), icn(0), ref(0) |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | KeyboardImpl::~KeyboardImpl() | 75 | KeyboardImpl::~KeyboardImpl() |
76 | { | 76 | { |
77 | delete input; | 77 | delete input; |
78 | delete icn; | 78 | delete icn; |
79 | } | 79 | } |
80 | 80 | ||
81 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 81 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
82 | { | 82 | { |
83 | if ( !input ) | 83 | if ( !input ) |
84 | input = new Keyboard( parent, "Keyboard", f ); | 84 | input = new Dvorak::Keyboard( parent, "Keyboard", f ); |
85 | return input; | 85 | return input; |
86 | } | 86 | } |
87 | 87 | ||
88 | void KeyboardImpl::resetState() | 88 | void KeyboardImpl::resetState() |
89 | { | 89 | { |
90 | if ( input ) | 90 | if ( input ) |
91 | input->resetState(); | 91 | input->resetState(); |
92 | } | 92 | } |
93 | 93 | ||
94 | QPixmap *KeyboardImpl::icon() | 94 | QPixmap *KeyboardImpl::icon() |
95 | { | 95 | { |
96 | if ( !icn ) | 96 | if ( !icn ) |
97 | icn = new QPixmap( (const char **)kb_xpm ); | 97 | icn = new QPixmap( (const char **)kb_xpm ); |
98 | return icn; | 98 | return icn; |
99 | } | 99 | } |
100 | 100 | ||
101 | QString KeyboardImpl::name() | 101 | QString KeyboardImpl::name() |
102 | { | 102 | { |
103 | return qApp->translate( "InputMethods", "Dvorak" ); | 103 | return qApp->translate( "InputMethods", "Dvorak" ); |
104 | } | 104 | } |
105 | 105 | ||
106 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 106 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
107 | { | 107 | { |
108 | if ( input ) | 108 | if ( input ) |
109 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 109 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
110 | } | 110 | } |
111 | 111 | ||
112 | #ifndef QT_NO_COMPONENT | 112 | #ifndef QT_NO_COMPONENT |
113 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 113 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
114 | { | 114 | { |
115 | *iface = 0; | 115 | *iface = 0; |
116 | if ( uuid == IID_QUnknown ) | 116 | if ( uuid == IID_QUnknown ) |
117 | *iface = this; | 117 | *iface = this; |
118 | else if ( uuid == IID_InputMethod ) | 118 | else if ( uuid == IID_InputMethod ) |
119 | *iface = this; | 119 | *iface = this; |
120 | 120 | ||
121 | if ( *iface ) | 121 | if ( *iface ) |
122 | (*iface)->addRef(); | 122 | (*iface)->addRef(); |
123 | return QS_OK; | 123 | return QS_OK; |
124 | } | 124 | } |
125 | 125 | ||
126 | Q_EXPORT_INTERFACE() | 126 | Q_EXPORT_INTERFACE() |
127 | { | 127 | { |
128 | Q_CREATE_INSTANCE( KeyboardImpl ) | 128 | Q_CREATE_INSTANCE( KeyboardImpl ) |
129 | } | 129 | } |
130 | #endif | 130 | #endif |
diff --git a/inputmethods/dvorak/dvorakimpl.h b/inputmethods/dvorak/dvorakimpl.h index e756364..bd9fa88 100644 --- a/inputmethods/dvorak/dvorakimpl.h +++ b/inputmethods/dvorak/dvorakimpl.h | |||
@@ -1,51 +1,60 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef KEYBOARDIMPL_H | 20 | #ifndef KEYBOARDIMPL_H |
21 | #define KEYBOARDIMPL_H | 21 | #define KEYBOARDIMPL_H |
22 | 22 | ||
23 | #include <qpe/inputmethodinterface.h> | 23 | #include <qpe/inputmethodinterface.h> |
24 | 24 | ||
25 | class Keyboard; | 25 | namespace Dvorak |
26 | { | ||
27 | class Keyboard; | ||
28 | } | ||
29 | |||
26 | class QPixmap; | 30 | class QPixmap; |
27 | 31 | ||
32 | namespace | ||
33 | { | ||
34 | |||
28 | class KeyboardImpl : public InputMethodInterface | 35 | class KeyboardImpl : public InputMethodInterface |
29 | { | 36 | { |
30 | public: | 37 | public: |
31 | KeyboardImpl(); | 38 | KeyboardImpl(); |
32 | virtual ~KeyboardImpl(); | 39 | virtual ~KeyboardImpl(); |
33 | 40 | ||
34 | #ifndef QT_NO_COMPONENT | 41 | #ifndef QT_NO_COMPONENT |
35 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 42 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
36 | Q_REFCOUNT | 43 | Q_REFCOUNT |
37 | #endif | 44 | #endif |
38 | 45 | ||
39 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); | 46 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); |
40 | virtual void resetState(); | 47 | virtual void resetState(); |
41 | virtual QPixmap *icon(); | 48 | virtual QPixmap *icon(); |
42 | virtual QString name(); | 49 | virtual QString name(); |
43 | virtual void onKeyPress( QObject *receiver, const char *slot ); | 50 | virtual void onKeyPress( QObject *receiver, const char *slot ); |
44 | 51 | ||
45 | private: | 52 | private: |
46 | Keyboard *input; | 53 | Dvorak::Keyboard *input; |
47 | QPixmap *icn; | 54 | QPixmap *icn; |
48 | ulong ref; | 55 | ulong ref; |
49 | }; | 56 | }; |
50 | 57 | ||
58 | } // anonymous namespace | ||
59 | |||
51 | #endif | 60 | #endif |
diff --git a/inputmethods/jumpx/keyboard.cpp b/inputmethods/jumpx/keyboard.cpp index 0b8fc14..0cfb4be 100644 --- a/inputmethods/jumpx/keyboard.cpp +++ b/inputmethods/jumpx/keyboard.cpp | |||
@@ -31,192 +31,193 @@ static const int letterh = 14; | |||
31 | static const int num1x1 = 130; | 31 | static const int num1x1 = 130; |
32 | static const int num1x2 = 137; | 32 | static const int num1x2 = 137; |
33 | static const int num1w = num1x2 - num1x1; | 33 | static const int num1w = num1x2 - num1x1; |
34 | 34 | ||
35 | static const int specialx1 = 138; | 35 | static const int specialx1 = 138; |
36 | static const int specialx2 = 170; | 36 | static const int specialx2 = 170; |
37 | static const int specialw = 16; | 37 | static const int specialw = 16; |
38 | 38 | ||
39 | static const int num2x1 = 171; | 39 | static const int num2x1 = 171; |
40 | static const int num2x2 = 178; | 40 | static const int num2x2 = 178; |
41 | static const int num2w = num2x2 - num2x1; | 41 | static const int num2w = num2x2 - num2x1; |
42 | 42 | ||
43 | static const int mod2x1 = 179; | 43 | static const int mod2x1 = 179; |
44 | static const int mod2x2 = 203; | 44 | static const int mod2x2 = 203; |
45 | static const int mod2w = mod2x2 - mod2x1; | 45 | static const int mod2w = mod2x2 - mod2x1; |
46 | 46 | ||
47 | static const int cursorx1 = 207; | 47 | static const int cursorx1 = 207; |
48 | static const int cursorw = 16; | 48 | static const int cursorw = 16; |
49 | 49 | ||
50 | static const int myParenID = -10; | 50 | static const int myParenID = -10; |
51 | 51 | ||
52 | 52 | ||
53 | typedef struct mapElement | 53 | typedef struct mapElement |
54 | { | 54 | { |
55 | int qcode; | 55 | int qcode; |
56 | ushort unicode; | 56 | ushort unicode; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static const mapElement mod1Map[] = { | 59 | static const mapElement mod1Map[] = { |
60 | { Qt::Key_Escape, 27 }, | 60 | { Qt::Key_Escape, 27 }, |
61 | { Qt::Key_Tab, 9 }, | 61 | { Qt::Key_Tab, 9 }, |
62 | { Qt::Key_Return, 13 }, | 62 | { Qt::Key_Return, 13 }, |
63 | { Qt::Key_Alt, 0 }, | 63 | { Qt::Key_Alt, 0 }, |
64 | { Qt::Key_Control, 0 }, | 64 | { Qt::Key_Control, 0 }, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static const uchar *const letterMap[] = { | 67 | static const uchar *const letterMap[] = { |
68 | (const uchar *const)"zvchwk", | 68 | (const uchar *const)"zvchwk", |
69 | (const uchar *const)"fitaly", | 69 | (const uchar *const)"fitaly", |
70 | (const uchar *const)" ne ", | 70 | (const uchar *const)" ne ", |
71 | (const uchar *const)"gdorsb", | 71 | (const uchar *const)"gdorsb", |
72 | (const uchar *const)"qjumpx", | 72 | (const uchar *const)"qjumpx", |
73 | }; | 73 | }; |
74 | 74 | ||
75 | static const uchar *const letterMapShift[] = { | 75 | static const uchar *const letterMapShift[] = { |
76 | (const uchar *const)"ZVCHWK", | 76 | (const uchar *const)"ZVCHWK", |
77 | (const uchar *const)"FITALY", | 77 | (const uchar *const)"FITALY", |
78 | (const uchar *const)" NE ", | 78 | (const uchar *const)" NE ", |
79 | (const uchar *const)"GDORSB", | 79 | (const uchar *const)"GDORSB", |
80 | (const uchar *const)"QJUMPX", | 80 | (const uchar *const)"QJUMPX", |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static const uchar *const num1Map = (const uchar *const)"12345"; | 83 | static const uchar *const num1Map = (const uchar *const)"12345"; |
84 | 84 | ||
85 | static const uchar *const specialMap[] = { | 85 | static const uchar *const specialMap[] = { |
86 | (const uchar *const)"-+", | 86 | (const uchar *const)"-+", |
87 | (const uchar *const)"*!", | 87 | (const uchar *const)"*!", |
88 | (const uchar *const)",'", | 88 | (const uchar *const)",'", |
89 | (const uchar *const)".%", | 89 | (const uchar *const)".%", |
90 | (const uchar *const)"/$", | 90 | (const uchar *const)"/$", |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static const uchar *const specialMapShift[] = { | 93 | static const uchar *const specialMapShift[] = { |
94 | (const uchar *const)"_=", | 94 | (const uchar *const)"_=", |
95 | (const uchar *const)"#?", | 95 | (const uchar *const)"#?", |
96 | (const uchar *const)";\"", | 96 | (const uchar *const)";\"", |
97 | (const uchar *const)":|", | 97 | (const uchar *const)":|", |
98 | (const uchar *const)"\\&", | 98 | (const uchar *const)"\\&", |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static const uchar *const specialMapParen[] = { | 101 | static const uchar *const specialMapParen[] = { |
102 | (const uchar *const)"()", | 102 | (const uchar *const)"()", |
103 | (const uchar *const)"[]", | 103 | (const uchar *const)"[]", |
104 | (const uchar *const)"{}", | 104 | (const uchar *const)"{}", |
105 | (const uchar *const)"<>", | 105 | (const uchar *const)"<>", |
106 | (const uchar *const)"@~", | 106 | (const uchar *const)"@~", |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static const uchar *const num2Map = (const uchar *const)"67890"; | 109 | static const uchar *const num2Map = (const uchar *const)"67890"; |
110 | 110 | ||
111 | static const mapElement mod2Map[] = { | 111 | static const mapElement mod2Map[] = { |
112 | { Qt::Key_Backspace, 8 }, | 112 | { Qt::Key_Backspace, 8 }, |
113 | { Qt::Key_Delete, 0 }, | 113 | { Qt::Key_Delete, 0 }, |
114 | { Qt::Key_Return, 13 }, | 114 | { Qt::Key_Return, 13 }, |
115 | { Qt::Key_Shift, 0 }, | 115 | { Qt::Key_Shift, 0 }, |
116 | { myParenID, 0 }, | 116 | { myParenID, 0 }, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static const int cursorMap[][2] = { | 119 | static const int cursorMap[][2] = { |
120 | { Qt::Key_Home, Qt::Key_PageUp }, | 120 | { Qt::Key_Home, Qt::Key_PageUp }, |
121 | { Qt::Key_End, Qt::Key_PageDown }, | 121 | { Qt::Key_End, Qt::Key_PageDown }, |
122 | { Qt::Key_Up, Qt::Key_Up }, | 122 | { Qt::Key_Up, Qt::Key_Up }, |
123 | { Qt::Key_Left, Qt::Key_Right }, | 123 | { Qt::Key_Left, Qt::Key_Right }, |
124 | { Qt::Key_Down, Qt::Key_Down }, | 124 | { Qt::Key_Down, Qt::Key_Down }, |
125 | }; | 125 | }; |
126 | 126 | ||
127 | using namespace JumpX; | ||
127 | 128 | ||
128 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : | 129 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : |
129 | QFrame(parent, name, f), | 130 | QFrame(parent, name, f), |
130 | shift(0), paren(0), ctrl(0), alt(0), | 131 | shift(0), paren(0), ctrl(0), alt(0), |
131 | pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), | 132 | pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), |
132 | isnoncont(false), | 133 | isnoncont(false), |
133 | slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), | 134 | slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), |
134 | enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), | 135 | enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), |
135 | releasedPix(NULL), pressedPix(NULL) | 136 | releasedPix(NULL), pressedPix(NULL) |
136 | { | 137 | { |
137 | //setPalette(QPalette(QColor(240,240,230))); // Beige! | 138 | //setPalette(QPalette(QColor(240,240,230))); // Beige! |
138 | 139 | ||
139 | releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("jumpx/released"); | 140 | releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("jumpx/released"); |
140 | pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("jumpx/pressed"); | 141 | pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("jumpx/pressed"); |
141 | pressedDigit = Resource::loadPixmap("jumpx/pressed"); | 142 | pressedDigit = Resource::loadPixmap("jumpx/pressed"); |
142 | 143 | ||
143 | QPixmap tmp; | 144 | QPixmap tmp; |
144 | 145 | ||
145 | tmp = Resource::loadPixmap("jumpx/releasedShift"); | 146 | tmp = Resource::loadPixmap("jumpx/releasedShift"); |
146 | bitBlt(&releasedShift, letterx1, 0, &tmp); | 147 | bitBlt(&releasedShift, letterx1, 0, &tmp); |
147 | 148 | ||
148 | tmp = Resource::loadPixmap("jumpx/releasedParen"); | 149 | tmp = Resource::loadPixmap("jumpx/releasedParen"); |
149 | bitBlt(&releasedParen, specialx1, 0, &tmp); | 150 | bitBlt(&releasedParen, specialx1, 0, &tmp); |
150 | 151 | ||
151 | tmp = Resource::loadPixmap("jumpx/pressedShift"); | 152 | tmp = Resource::loadPixmap("jumpx/pressedShift"); |
152 | bitBlt(&pressedShift, letterx1, 0, &tmp); | 153 | bitBlt(&pressedShift, letterx1, 0, &tmp); |
153 | 154 | ||
154 | tmp = Resource::loadPixmap("jumpx/pressedParen"); | 155 | tmp = Resource::loadPixmap("jumpx/pressedParen"); |
155 | bitBlt(&pressedParen, specialx1, 0, &tmp); | 156 | bitBlt(&pressedParen, specialx1, 0, &tmp); |
156 | 157 | ||
157 | tmp = Resource::loadPixmap("jumpx/pressedDigit"); | 158 | tmp = Resource::loadPixmap("jumpx/pressedDigit"); |
158 | bitBlt(&pressedDigit, specialx1, 0, &tmp); | 159 | bitBlt(&pressedDigit, specialx1, 0, &tmp); |
159 | 160 | ||
160 | offscreen = QPixmap( releasedPlain ); | 161 | offscreen = QPixmap( releasedPlain ); |
161 | 162 | ||
162 | releasedPix = &releasedPlain; | 163 | releasedPix = &releasedPlain; |
163 | pressedPix = &pressedPlain; | 164 | pressedPix = &pressedPlain; |
164 | slidePix = &pressedPlain; | 165 | slidePix = &pressedPlain; |
165 | 166 | ||
166 | delayTimer = new QTimer(this); | 167 | delayTimer = new QTimer(this); |
167 | rateTimer = new QTimer(this); | 168 | rateTimer = new QTimer(this); |
168 | connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); | 169 | connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); |
169 | connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); | 170 | connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); |
170 | } | 171 | } |
171 | 172 | ||
172 | void Keyboard::resizeEvent(QResizeEvent*) | 173 | void Keyboard::resizeEvent(QResizeEvent*) |
173 | { | 174 | { |
174 | //cout << "resizeEvent()" << endl; | 175 | //cout << "resizeEvent()" << endl; |
175 | } | 176 | } |
176 | 177 | ||
177 | void Keyboard::paintEvent(QPaintEvent*) | 178 | void Keyboard::paintEvent(QPaintEvent*) |
178 | { | 179 | { |
179 | bitBlt(this, 0, 0, &offscreen); | 180 | bitBlt(this, 0, 0, &offscreen); |
180 | } | 181 | } |
181 | 182 | ||
182 | void Keyboard::mousePressEvent(QMouseEvent *e) | 183 | void Keyboard::mousePressEvent(QMouseEvent *e) |
183 | { | 184 | { |
184 | pressedx = -1; | 185 | pressedx = -1; |
185 | pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; | 186 | pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; |
186 | 187 | ||
187 | int x = e->x(); | 188 | int x = e->x(); |
188 | int y = e->y(); | 189 | int y = e->y(); |
189 | 190 | ||
190 | int row = (y - 1) / letterh; | 191 | int row = (y - 1) / letterh; |
191 | 192 | ||
192 | if ( x <= mod1x2 ) // mod1 | 193 | if ( x <= mod1x2 ) // mod1 |
193 | { | 194 | { |
194 | pressedx = mod1x1; | 195 | pressedx = mod1x1; |
195 | pressedy = row * letterh; | 196 | pressedy = row * letterh; |
196 | pressedw = mod1w + 1; | 197 | pressedw = mod1w + 1; |
197 | pressedh = letterh + 1; | 198 | pressedh = letterh + 1; |
198 | if ( row == 2 ) // return | 199 | if ( row == 2 ) // return |
199 | { | 200 | { |
200 | pressed2x = mod2x1; | 201 | pressed2x = mod2x1; |
201 | pressed2y = 2 * letterh; | 202 | pressed2y = 2 * letterh; |
202 | pressed2w = mod2w + 1; | 203 | pressed2w = mod2w + 1; |
203 | pressed2h = letterh + 1; | 204 | pressed2h = letterh + 1; |
204 | isnoncont = true; | 205 | isnoncont = true; |
205 | } | 206 | } |
206 | else if ( row == 3 ) // alt | 207 | else if ( row == 3 ) // alt |
207 | alt = 1; | 208 | alt = 1; |
208 | else if ( row == 4 ) // ctrl | 209 | else if ( row == 4 ) // ctrl |
209 | ctrl = 1; | 210 | ctrl = 1; |
210 | pressedKeyUnicode = mod1Map[row].unicode; | 211 | pressedKeyUnicode = mod1Map[row].unicode; |
211 | pressedKeyQcode = mod1Map[row].qcode; | 212 | pressedKeyQcode = mod1Map[row].qcode; |
212 | } | 213 | } |
213 | else if ( x >= letterx1 && x <= letterx2 ) // letter | 214 | else if ( x >= letterx1 && x <= letterx2 ) // letter |
214 | { | 215 | { |
215 | int column = (x - letterx1 - 1) / letterw; | 216 | int column = (x - letterx1 - 1) / letterw; |
216 | QChar temp; | 217 | QChar temp; |
217 | if ( shift ) | 218 | if ( shift ) |
218 | temp = QChar( letterMapShift[row][column] ); | 219 | temp = QChar( letterMapShift[row][column] ); |
219 | else | 220 | else |
220 | temp = QChar( letterMap[row][column] ); | 221 | temp = QChar( letterMap[row][column] ); |
221 | if ( temp == ' ' ) // space | 222 | if ( temp == ' ' ) // space |
222 | { | 223 | { |
diff --git a/inputmethods/jumpx/keyboard.h b/inputmethods/jumpx/keyboard.h index 1be095d..689d95a 100644 --- a/inputmethods/jumpx/keyboard.h +++ b/inputmethods/jumpx/keyboard.h | |||
@@ -1,71 +1,76 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | #include <qframe.h> | 12 | #include <qframe.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | #include <qtimer.h> | 14 | #include <qtimer.h> |
15 | 15 | ||
16 | namespace JumpX | ||
17 | { | ||
18 | |||
16 | class Keyboard : public QFrame | 19 | class Keyboard : public QFrame |
17 | { | 20 | { |
18 | Q_OBJECT | 21 | Q_OBJECT |
19 | public: | 22 | public: |
20 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 23 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
21 | 24 | ||
22 | void resetState(); | 25 | void resetState(); |
23 | 26 | ||
24 | void mousePressEvent(QMouseEvent*); | 27 | void mousePressEvent(QMouseEvent*); |
25 | void mouseReleaseEvent(QMouseEvent*); | 28 | void mouseReleaseEvent(QMouseEvent*); |
26 | void mouseMoveEvent(QMouseEvent*); | 29 | void mouseMoveEvent(QMouseEvent*); |
27 | void resizeEvent(QResizeEvent*); | 30 | void resizeEvent(QResizeEvent*); |
28 | void paintEvent(QPaintEvent* e); | 31 | void paintEvent(QPaintEvent* e); |
29 | //void timerEvent(QTimerEvent* e); | 32 | //void timerEvent(QTimerEvent* e); |
30 | 33 | ||
31 | QSize sizeHint() const; | 34 | QSize sizeHint() const; |
32 | 35 | ||
33 | signals: | 36 | signals: |
34 | void key( ushort unicode, ushort qcode, ushort modifiers, bool, bool ); | 37 | void key( ushort unicode, ushort qcode, ushort modifiers, bool, bool ); |
35 | 38 | ||
36 | private slots: | 39 | private slots: |
37 | void delayTimerDone(); | 40 | void delayTimerDone(); |
38 | void rateTimerDone(); | 41 | void rateTimerDone(); |
39 | 42 | ||
40 | private: | 43 | private: |
41 | int shift; // 0, 1, 2 | 44 | int shift; // 0, 1, 2 |
42 | int paren; // 0, 1, 2 | 45 | int paren; // 0, 1, 2 |
43 | int ctrl; // 0, 1 | 46 | int ctrl; // 0, 1 |
44 | int alt; // 0, 1 | 47 | int alt; // 0, 1 |
45 | 48 | ||
46 | int pressedKeyUnicode, pressedKeyQcode, pressedMod; | 49 | int pressedKeyUnicode, pressedKeyQcode, pressedMod; |
47 | int pressedx, pressedy, pressedw, pressedh; | 50 | int pressedx, pressedy, pressedw, pressedh; |
48 | bool isnoncont; | 51 | bool isnoncont; |
49 | int pressed2x, pressed2y, pressed2w, pressed2h; | 52 | int pressed2x, pressed2y, pressed2w, pressed2h; |
50 | 53 | ||
51 | int slideKeyUnicodeH, slideKeyQcodeH, slideKeyUnicodeV, slideKeyQcodeV; | 54 | int slideKeyUnicodeH, slideKeyQcodeH, slideKeyUnicodeV, slideKeyQcodeV; |
52 | bool enableMouseTracking; | 55 | bool enableMouseTracking; |
53 | QPixmap *slidePix, *slidePixH, *slidePixV; | 56 | QPixmap *slidePix, *slidePixH, *slidePixV; |
54 | 57 | ||
55 | QPixmap releasedPlain; | 58 | QPixmap releasedPlain; |
56 | QPixmap releasedShift; | 59 | QPixmap releasedShift; |
57 | QPixmap releasedParen; | 60 | QPixmap releasedParen; |
58 | 61 | ||
59 | QPixmap pressedPlain; | 62 | QPixmap pressedPlain; |
60 | QPixmap pressedShift; | 63 | QPixmap pressedShift; |
61 | QPixmap pressedParen; | 64 | QPixmap pressedParen; |
62 | QPixmap pressedDigit; | 65 | QPixmap pressedDigit; |
63 | 66 | ||
64 | QPixmap offscreen; | 67 | QPixmap offscreen; |
65 | 68 | ||
66 | QPixmap *releasedPix; | 69 | QPixmap *releasedPix; |
67 | QPixmap *pressedPix; | 70 | QPixmap *pressedPix; |
68 | 71 | ||
69 | QTimer *delayTimer; | 72 | QTimer *delayTimer; |
70 | QTimer *rateTimer; | 73 | QTimer *rateTimer; |
71 | }; | 74 | }; |
75 | |||
76 | } // namespace JumpX | ||
diff --git a/inputmethods/jumpx/keyboardimpl.cpp b/inputmethods/jumpx/keyboardimpl.cpp index 92abb09..34c227f 100644 --- a/inputmethods/jumpx/keyboardimpl.cpp +++ b/inputmethods/jumpx/keyboardimpl.cpp | |||
@@ -1,97 +1,97 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | #include "keyboard.h" | 14 | #include "keyboard.h" |
15 | #include "keyboardimpl.h" | 15 | #include "keyboardimpl.h" |
16 | 16 | ||
17 | /* XPM */ | 17 | /* XPM */ |
18 | static const char * icon_xpm[] = { | 18 | static const char * const icon_xpm[] = { |
19 | "26 13 2 1", | 19 | "26 13 2 1", |
20 | " c None", | 20 | " c None", |
21 | ".c #000000", | 21 | ".c #000000", |
22 | " ... ... ... ... ... ... ", | 22 | " ... ... ... ... ... ... ", |
23 | ". . . . . . . ", | 23 | ". . . . . . . ", |
24 | ". . . . . . . ", | 24 | ". . . . . . . ", |
25 | ". . . . . . . ", | 25 | ". . . . . . . ", |
26 | " ....... ... ... ....... ", | 26 | " ....... ... ... ....... ", |
27 | ". . . . . ", | 27 | ". . . . . ", |
28 | ". . . . . ", | 28 | ". . . . . ", |
29 | ". . . . . ", | 29 | ". . . . . ", |
30 | " ....... ... ... ....... ", | 30 | " ....... ... ... ....... ", |
31 | ". . . . . . . ", | 31 | ". . . . . . . ", |
32 | ". . . . . . . ", | 32 | ". . . . . . . ", |
33 | ". . . . . . . ", | 33 | ". . . . . . . ", |
34 | " ... ... ... ... ... ... "}; | 34 | " ... ... ... ... ... ... "}; |
35 | 35 | ||
36 | 36 | ||
37 | KeyboardImpl::KeyboardImpl() | 37 | KeyboardImpl::KeyboardImpl() |
38 | : input(0), icn(0), ref(0) | 38 | : input(0), icn(0), ref(0) |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | KeyboardImpl::~KeyboardImpl() | 42 | KeyboardImpl::~KeyboardImpl() |
43 | { | 43 | { |
44 | delete input; | 44 | delete input; |
45 | delete icn; | 45 | delete icn; |
46 | } | 46 | } |
47 | 47 | ||
48 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 48 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
49 | { | 49 | { |
50 | if ( !input ) | 50 | if ( !input ) |
51 | input = new Keyboard( parent, "Keyboard", f ); | 51 | input = new JumpX::Keyboard( parent, "Keyboard", f ); |
52 | return input; | 52 | return input; |
53 | } | 53 | } |
54 | 54 | ||
55 | void KeyboardImpl::resetState() | 55 | void KeyboardImpl::resetState() |
56 | { | 56 | { |
57 | if ( input ) | 57 | if ( input ) |
58 | input->resetState(); | 58 | input->resetState(); |
59 | } | 59 | } |
60 | 60 | ||
61 | QPixmap *KeyboardImpl::icon() | 61 | QPixmap *KeyboardImpl::icon() |
62 | { | 62 | { |
63 | if ( !icn ) | 63 | if ( !icn ) |
64 | icn = new QPixmap( (const char **)icon_xpm ); | 64 | icn = new QPixmap( (const char **)icon_xpm ); |
65 | return icn; | 65 | return icn; |
66 | } | 66 | } |
67 | 67 | ||
68 | QString KeyboardImpl::name() | 68 | QString KeyboardImpl::name() |
69 | { | 69 | { |
70 | return qApp->translate( "InputMethods", "JumpX" ); | 70 | return qApp->translate( "InputMethods", "JumpX" ); |
71 | } | 71 | } |
72 | 72 | ||
73 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 73 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
74 | { | 74 | { |
75 | if ( input ) | 75 | if ( input ) |
76 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 76 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
77 | } | 77 | } |
78 | 78 | ||
79 | #ifndef QT_NO_COMPONENT | 79 | #ifndef QT_NO_COMPONENT |
80 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 80 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
81 | { | 81 | { |
82 | *iface = 0; | 82 | *iface = 0; |
83 | if ( uuid == IID_QUnknown ) | 83 | if ( uuid == IID_QUnknown ) |
84 | *iface = this; | 84 | *iface = this; |
85 | else if ( uuid == IID_InputMethod ) | 85 | else if ( uuid == IID_InputMethod ) |
86 | *iface = this; | 86 | *iface = this; |
87 | 87 | ||
88 | if ( *iface ) | 88 | if ( *iface ) |
89 | (*iface)->addRef(); | 89 | (*iface)->addRef(); |
90 | return QS_OK; | 90 | return QS_OK; |
91 | } | 91 | } |
92 | 92 | ||
93 | Q_EXPORT_INTERFACE() | 93 | Q_EXPORT_INTERFACE() |
94 | { | 94 | { |
95 | Q_CREATE_INSTANCE( KeyboardImpl ) | 95 | Q_CREATE_INSTANCE( KeyboardImpl ) |
96 | } | 96 | } |
97 | #endif | 97 | #endif |
diff --git a/inputmethods/jumpx/keyboardimpl.h b/inputmethods/jumpx/keyboardimpl.h index a82ec4a..087781f 100644 --- a/inputmethods/jumpx/keyboardimpl.h +++ b/inputmethods/jumpx/keyboardimpl.h | |||
@@ -1,43 +1,51 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | #ifndef KEYBOARDIMPL_H | 12 | #ifndef KEYBOARDIMPL_H |
13 | #define KEYBOARDIMPL_H | 13 | #define KEYBOARDIMPL_H |
14 | 14 | ||
15 | #include <qpe/inputmethodinterface.h> | 15 | #include <qpe/inputmethodinterface.h> |
16 | 16 | ||
17 | class Keyboard; | 17 | namespace JumpX |
18 | { | ||
19 | class Keyboard; | ||
20 | }; | ||
18 | class QPixmap; | 21 | class QPixmap; |
19 | 22 | ||
23 | namespace | ||
24 | { | ||
25 | |||
20 | class KeyboardImpl : public InputMethodInterface | 26 | class KeyboardImpl : public InputMethodInterface |
21 | { | 27 | { |
22 | public: | 28 | public: |
23 | KeyboardImpl(); | 29 | KeyboardImpl(); |
24 | virtual ~KeyboardImpl(); | 30 | virtual ~KeyboardImpl(); |
25 | 31 | ||
26 | #ifndef QT_NO_COMPONENT | 32 | #ifndef QT_NO_COMPONENT |
27 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 33 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
28 | Q_REFCOUNT | 34 | Q_REFCOUNT |
29 | #endif | 35 | #endif |
30 | 36 | ||
31 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); | 37 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); |
32 | virtual void resetState(); | 38 | virtual void resetState(); |
33 | virtual QPixmap *icon(); | 39 | virtual QPixmap *icon(); |
34 | virtual QString name(); | 40 | virtual QString name(); |
35 | virtual void onKeyPress( QObject *receiver, const char *slot ); | 41 | virtual void onKeyPress( QObject *receiver, const char *slot ); |
36 | 42 | ||
37 | private: | 43 | private: |
38 | Keyboard *input; | 44 | JumpX::Keyboard *input; |
39 | QPixmap *icn; | 45 | QPixmap *icn; |
40 | ulong ref; | 46 | ulong ref; |
41 | }; | 47 | }; |
42 | 48 | ||
49 | } // anonymous namespace | ||
50 | |||
43 | #endif | 51 | #endif |
diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp index 0f0b188..a85a7b1 100644 --- a/inputmethods/keyboard/keyboard.cpp +++ b/inputmethods/keyboard/keyboard.cpp | |||
@@ -1,128 +1,129 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "keyboard.h" | 21 | #include "keyboard.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | 24 | ||
25 | #include <qwindowsystem_qws.h> | 25 | #include <qwindowsystem_qws.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | #include <sys/utsname.h> | 31 | #include <sys/utsname.h> |
32 | 32 | ||
33 | using namespace KeyboardInput; | ||
33 | 34 | ||
34 | #define USE_SMALL_BACKSPACE | 35 | #define USE_SMALL_BACKSPACE |
35 | 36 | ||
36 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
37 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
39 | unicode(-1), qkeycode(0), modifiers(0) | 40 | unicode(-1), qkeycode(0), modifiers(0) |
40 | { | 41 | { |
41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
42 | // setFont( QFont( "Helvetica", 8 ) ); | 43 | // setFont( QFont( "Helvetica", 8 ) ); |
43 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 44 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
44 | setPalette(QPalette(QColor(220,220,220))); // Gray | 45 | setPalette(QPalette(QColor(220,220,220))); // Gray |
45 | 46 | ||
46 | picks = new KeyboardPicks( this ); | 47 | picks = new KeyboardPicks( this ); |
47 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 48 | picks->setFont( QFont( "smallsmooth", 9 ) ); |
48 | setFont( QFont( "smallsmooth", 9 ) ); | 49 | setFont( QFont( "smallsmooth", 9 ) ); |
49 | picks->initialise(); | 50 | picks->initialise(); |
50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 51 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 52 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
52 | 53 | ||
53 | repeatTimer = new QTimer( this ); | 54 | repeatTimer = new QTimer( this ); |
54 | 55 | ||
55 | // temporary quick and dirty fix for the "sticky keyboard bug" | 56 | // temporary quick and dirty fix for the "sticky keyboard bug" |
56 | // on ipaq. | 57 | // on ipaq. |
57 | // struct utsname name; | 58 | // struct utsname name; |
58 | // if (uname(&name) != -1) | 59 | // if (uname(&name) != -1) |
59 | // { | 60 | // { |
60 | //QString release=name.release; | 61 | //QString release=name.release; |
61 | //qWarning("System release: %s\n", name.release); | 62 | //qWarning("System release: %s\n", name.release); |
62 | //if(release.find("embedix",0,TRUE) !=-1) | 63 | //if(release.find("embedix",0,TRUE) !=-1) |
63 | // { | 64 | // { |
64 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 65 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
65 | // } | 66 | // } |
66 | // } | 67 | // } |
67 | } | 68 | } |
68 | 69 | ||
69 | void Keyboard::resizeEvent(QResizeEvent*) | 70 | void Keyboard::resizeEvent(QResizeEvent*) |
70 | { | 71 | { |
71 | int ph = picks->sizeHint().height(); | 72 | int ph = picks->sizeHint().height(); |
72 | picks->setGeometry( 0, 0, width(), ph ); | 73 | picks->setGeometry( 0, 0, width(), ph ); |
73 | keyHeight = (height()-ph)/5; | 74 | keyHeight = (height()-ph)/5; |
74 | int nk; | 75 | int nk; |
75 | if ( useOptiKeys ) { | 76 | if ( useOptiKeys ) { |
76 | nk = 15; | 77 | nk = 15; |
77 | } else if ( useLargeKeys ) { | 78 | } else if ( useLargeKeys ) { |
78 | nk = 15; | 79 | nk = 15; |
79 | } else { | 80 | } else { |
80 | nk = 19; | 81 | nk = 19; |
81 | } | 82 | } |
82 | defaultKeyWidth = width()/nk; | 83 | defaultKeyWidth = width()/nk; |
83 | xoffs = (width()-defaultKeyWidth*nk)/2; | 84 | xoffs = (width()-defaultKeyWidth*nk)/2; |
84 | } | 85 | } |
85 | 86 | ||
86 | void KeyboardPicks::initialise() | 87 | void KeyboardPicks::initialise() |
87 | { | 88 | { |
88 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 89 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
89 | mode = 0; | 90 | mode = 0; |
90 | dc = new KeyboardConfig(this); | 91 | dc = new KeyboardConfig(this); |
91 | configs.append(dc); | 92 | configs.append(dc); |
92 | } | 93 | } |
93 | 94 | ||
94 | QSize KeyboardPicks::sizeHint() const | 95 | QSize KeyboardPicks::sizeHint() const |
95 | { | 96 | { |
96 | return QSize(240,fontMetrics().lineSpacing()); | 97 | return QSize(240,fontMetrics().lineSpacing()); |
97 | } | 98 | } |
98 | 99 | ||
99 | 100 | ||
100 | void KeyboardConfig::generateText(const QString &s) | 101 | void KeyboardConfig::generateText(const QString &s) |
101 | { | 102 | { |
102 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 103 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
103 | for (int i=0; i<(int)backspaces; i++) { | 104 | for (int i=0; i<(int)backspaces; i++) { |
104 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 105 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); |
105 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 106 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); |
106 | } | 107 | } |
107 | for (int i=0; i<(int)s.length(); i++) { | 108 | for (int i=0; i<(int)s.length(); i++) { |
108 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 109 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
109 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 110 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
110 | } | 111 | } |
111 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 112 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); |
112 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 113 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); |
113 | backspaces = 0; | 114 | backspaces = 0; |
114 | #endif | 115 | #endif |
115 | } | 116 | } |
116 | 117 | ||
117 | 118 | ||
118 | //PC keyboard layout and scancodes | 119 | //PC keyboard layout and scancodes |
119 | 120 | ||
120 | /* | 121 | /* |
121 | Format: length, code, length, code, ..., 0 | 122 | Format: length, code, length, code, ..., 0 |
122 | 123 | ||
123 | length is measured in half the width of a standard key. | 124 | length is measured in half the width of a standard key. |
124 | If code < 0x80 we have length/2 consecutive standard keys, | 125 | If code < 0x80 we have length/2 consecutive standard keys, |
125 | starting with scancode code. | 126 | starting with scancode code. |
126 | 127 | ||
127 | Special keys are hardcoded, one at a time, with length of key | 128 | Special keys are hardcoded, one at a time, with length of key |
128 | and code >= 0x80, these are NOT standard PC scancodes, but are looked | 129 | and code >= 0x80, these are NOT standard PC scancodes, but are looked |
diff --git a/inputmethods/keyboard/keyboard.h b/inputmethods/keyboard/keyboard.h index 38ae338..cc7f3f5 100644 --- a/inputmethods/keyboard/keyboard.h +++ b/inputmethods/keyboard/keyboard.h | |||
@@ -1,103 +1,108 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qframe.h> | 20 | #include <qframe.h> |
21 | #include "../pickboard/pickboardcfg.h" | 21 | #include "../pickboard/pickboardcfg.h" |
22 | #include "../pickboard/pickboardpicks.h" | 22 | #include "../pickboard/pickboardpicks.h" |
23 | 23 | ||
24 | class QTimer; | 24 | class QTimer; |
25 | 25 | ||
26 | namespace KeyboardInput | ||
27 | { | ||
28 | |||
26 | class KeyboardConfig : public DictFilterConfig | 29 | class KeyboardConfig : public DictFilterConfig |
27 | { | 30 | { |
28 | public: | 31 | public: |
29 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } | 32 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } |
30 | virtual void generateText(const QString &s); | 33 | virtual void generateText(const QString &s); |
31 | void decBackspaces() { if (backspaces) backspaces--; } | 34 | void decBackspaces() { if (backspaces) backspaces--; } |
32 | void incBackspaces() { backspaces++; } | 35 | void incBackspaces() { backspaces++; } |
33 | void resetBackspaces() { backspaces = 0; } | 36 | void resetBackspaces() { backspaces = 0; } |
34 | private: | 37 | private: |
35 | int backspaces; | 38 | int backspaces; |
36 | }; | 39 | }; |
37 | 40 | ||
38 | 41 | ||
39 | class KeyboardPicks : public PickboardPicks | 42 | class KeyboardPicks : public PickboardPicks |
40 | { | 43 | { |
41 | Q_OBJECT | 44 | Q_OBJECT |
42 | public: | 45 | public: |
43 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) | 46 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) |
44 | : PickboardPicks(parent, name, f) { } | 47 | : PickboardPicks(parent, name, f) { } |
45 | void initialise(); | 48 | void initialise(); |
46 | virtual QSize sizeHint() const; | 49 | virtual QSize sizeHint() const; |
47 | KeyboardConfig *dc; | 50 | KeyboardConfig *dc; |
48 | }; | 51 | }; |
49 | 52 | ||
50 | class Keyboard : public QFrame | 53 | class Keyboard : public QFrame |
51 | { | 54 | { |
52 | Q_OBJECT | 55 | Q_OBJECT |
53 | public: | 56 | public: |
54 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
55 | 58 | ||
56 | void resetState(); | 59 | void resetState(); |
57 | 60 | ||
58 | void mousePressEvent(QMouseEvent*); | 61 | void mousePressEvent(QMouseEvent*); |
59 | void mouseReleaseEvent(QMouseEvent*); | 62 | void mouseReleaseEvent(QMouseEvent*); |
60 | void resizeEvent(QResizeEvent*); | 63 | void resizeEvent(QResizeEvent*); |
61 | void paintEvent(QPaintEvent* e); | 64 | void paintEvent(QPaintEvent* e); |
62 | void timerEvent(QTimerEvent* e); | 65 | void timerEvent(QTimerEvent* e); |
63 | void drawKeyboard( QPainter &p, int key = -1 ); | 66 | void drawKeyboard( QPainter &p, int key = -1 ); |
64 | 67 | ||
65 | void setMode(int mode) { useOptiKeys = mode; } | 68 | void setMode(int mode) { useOptiKeys = mode; } |
66 | 69 | ||
67 | QSize sizeHint() const; | 70 | QSize sizeHint() const; |
68 | 71 | ||
69 | signals: | 72 | signals: |
70 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); | 73 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); |
71 | 74 | ||
72 | private slots: | 75 | private slots: |
73 | void repeat(); | 76 | void repeat(); |
74 | 77 | ||
75 | private: | 78 | private: |
76 | int getKey( int &w, int j = -1 ); | 79 | int getKey( int &w, int j = -1 ); |
77 | void clearHighlight(); | 80 | void clearHighlight(); |
78 | 81 | ||
79 | uint shift:1; | 82 | uint shift:1; |
80 | uint lock:1; | 83 | uint lock:1; |
81 | uint ctrl:1; | 84 | uint ctrl:1; |
82 | uint alt:1; | 85 | uint alt:1; |
83 | uint useLargeKeys:1; | 86 | uint useLargeKeys:1; |
84 | uint useOptiKeys:1; | 87 | uint useOptiKeys:1; |
85 | 88 | ||
86 | int pressedKey; | 89 | int pressedKey; |
87 | 90 | ||
88 | KeyboardPicks *picks; | 91 | KeyboardPicks *picks; |
89 | 92 | ||
90 | int keyHeight; | 93 | int keyHeight; |
91 | int defaultKeyWidth; | 94 | int defaultKeyWidth; |
92 | int xoffs; | 95 | int xoffs; |
93 | 96 | ||
94 | int unicode; | 97 | int unicode; |
95 | int qkeycode; | 98 | int qkeycode; |
96 | int modifiers; | 99 | int modifiers; |
97 | 100 | ||
98 | int pressTid; | 101 | int pressTid; |
99 | bool pressed; | 102 | bool pressed; |
100 | 103 | ||
101 | QTimer *repeatTimer; | 104 | QTimer *repeatTimer; |
102 | }; | 105 | }; |
103 | 106 | ||
107 | } // namespace KeyboardInput | ||
108 | |||
diff --git a/inputmethods/keyboard/keyboardimpl.cpp b/inputmethods/keyboard/keyboardimpl.cpp index bc96402..3c77fe6 100644 --- a/inputmethods/keyboard/keyboardimpl.cpp +++ b/inputmethods/keyboard/keyboardimpl.cpp | |||
@@ -1,130 +1,128 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include "keyboard.h" | 22 | #include "keyboard.h" |
23 | #include "keyboardimpl.h" | 23 | #include "keyboardimpl.h" |
24 | 24 | ||
25 | /* XPM */ | 25 | /* XPM */ |
26 | static const char * kb_xpm[] = { | 26 | static const char * const kb_xpm[] = { |
27 | "28 13 4 1", | 27 | "28 13 4 1", |
28 | " c None", | 28 | " c None", |
29 | ". c #4C4C4C", | 29 | ". c #4C4C4C", |
30 | "+ c #FFF7DD", | 30 | "+ c #FFF7DD", |
31 | "@ c #D6CFBA", | 31 | "@ c #D6CFBA", |
32 | " .......................... ", | 32 | " .......................... ", |
33 | " .+++.+++.+++.+++.+++.++++. ", | 33 | " .+++.+++.+++.+++.+++.++++. ", |
34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", | 34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", |
35 | " .......................... ", | 35 | " .......................... ", |
36 | " .+++++.+++.+++.+++.++++++. ", | 36 | " .+++++.+++.+++.+++.++++++. ", |
37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", | 37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", |
38 | " .......................... ", | 38 | " .......................... ", |
39 | " .++++++.+++.+++.+++.+++++. ", | 39 | " .++++++.+++.+++.+++.+++++. ", |
40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", | 40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", |
41 | " .......................... ", | 41 | " .......................... ", |
42 | " .++++.++++++++++++++.++++. ", | 42 | " .++++.++++++++++++++.++++. ", |
43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", | 43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", |
44 | " .......................... "}; | 44 | " .......................... "}; |
45 | 45 | ||
46 | 46 | ||
47 | /* XPM */ | 47 | /* XPM */ |
48 | static char * opti_xpm[] = { | 48 | static const char * const ipti_xpm[] = { |
49 | "28 13 4 1", | 49 | "28 13 4 1", |
50 | " c None", | 50 | " c None", |
51 | ". c #4C4C4C", | 51 | ". c #4C4C4C", |
52 | "+ c #FFF7DD", | 52 | "+ c #FFF7DD", |
53 | "@ c #D6CFBA", | 53 | "@ c #D6CFBA", |
54 | " ......................... ", | 54 | " ......................... ", |
55 | " .+++.+++.+++.+++.+++.+++. ", | 55 | " .+++.+++.+++.+++.+++.+++. ", |
56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
57 | " ......................... ", | 57 | " ......................... ", |
58 | " .+++.+++.+++.+++.+++.+++. ", | 58 | " .+++.+++.+++.+++.+++.+++. ", |
59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
60 | " ......................... ", | 60 | " ......................... ", |
61 | " .+++.+++.+++.+++.+++.+++. ", | 61 | " .+++.+++.+++.+++.+++.+++. ", |
62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
63 | " ......................... ", | 63 | " ......................... ", |
64 | " .+++.+++.+++.+++.+++.+++. ", | 64 | " .+++.+++.+++.+++.+++.+++. ", |
65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
66 | " ......................... "}; | 66 | " ......................... "}; |
67 | 67 | ||
68 | |||
69 | |||
70 | KeyboardImpl::KeyboardImpl() | 68 | KeyboardImpl::KeyboardImpl() |
71 | : input(0), icn(0), ref(0) | 69 | : input(0), icn(0), ref(0) |
72 | { | 70 | { |
73 | } | 71 | } |
74 | 72 | ||
75 | KeyboardImpl::~KeyboardImpl() | 73 | KeyboardImpl::~KeyboardImpl() |
76 | { | 74 | { |
77 | delete input; | 75 | delete input; |
78 | delete icn; | 76 | delete icn; |
79 | } | 77 | } |
80 | 78 | ||
81 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 79 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
82 | { | 80 | { |
83 | if ( !input ) | 81 | if ( !input ) |
84 | input = new Keyboard( parent, "Keyboard", f ); | 82 | input = new KeyboardInput::Keyboard( parent, "Keyboard", f ); |
85 | return input; | 83 | return input; |
86 | } | 84 | } |
87 | 85 | ||
88 | void KeyboardImpl::resetState() | 86 | void KeyboardImpl::resetState() |
89 | { | 87 | { |
90 | if ( input ) | 88 | if ( input ) |
91 | input->resetState(); | 89 | input->resetState(); |
92 | } | 90 | } |
93 | 91 | ||
94 | QPixmap *KeyboardImpl::icon() | 92 | QPixmap *KeyboardImpl::icon() |
95 | { | 93 | { |
96 | if ( !icn ) | 94 | if ( !icn ) |
97 | icn = new QPixmap( (const char **)kb_xpm ); | 95 | icn = new QPixmap( (const char **)kb_xpm ); |
98 | return icn; | 96 | return icn; |
99 | } | 97 | } |
100 | 98 | ||
101 | QString KeyboardImpl::name() | 99 | QString KeyboardImpl::name() |
102 | { | 100 | { |
103 | return qApp->translate( "InputMethods", "Keyboard" ); | 101 | return qApp->translate( "InputMethods", "Keyboard" ); |
104 | } | 102 | } |
105 | 103 | ||
106 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 104 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
107 | { | 105 | { |
108 | if ( input ) | 106 | if ( input ) |
109 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 107 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
110 | } | 108 | } |
111 | 109 | ||
112 | #ifndef QT_NO_COMPONENT | 110 | #ifndef QT_NO_COMPONENT |
113 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 111 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
114 | { | 112 | { |
115 | *iface = 0; | 113 | *iface = 0; |
116 | if ( uuid == IID_QUnknown ) | 114 | if ( uuid == IID_QUnknown ) |
117 | *iface = this; | 115 | *iface = this; |
118 | else if ( uuid == IID_InputMethod ) | 116 | else if ( uuid == IID_InputMethod ) |
119 | *iface = this; | 117 | *iface = this; |
120 | 118 | ||
121 | if ( *iface ) | 119 | if ( *iface ) |
122 | (*iface)->addRef(); | 120 | (*iface)->addRef(); |
123 | return QS_OK; | 121 | return QS_OK; |
124 | } | 122 | } |
125 | 123 | ||
126 | Q_EXPORT_INTERFACE() | 124 | Q_EXPORT_INTERFACE() |
127 | { | 125 | { |
128 | Q_CREATE_INSTANCE( KeyboardImpl ) | 126 | Q_CREATE_INSTANCE( KeyboardImpl ) |
129 | } | 127 | } |
130 | #endif | 128 | #endif |
diff --git a/inputmethods/keyboard/keyboardimpl.h b/inputmethods/keyboard/keyboardimpl.h index e756364..d33a822 100644 --- a/inputmethods/keyboard/keyboardimpl.h +++ b/inputmethods/keyboard/keyboardimpl.h | |||
@@ -1,51 +1,60 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef KEYBOARDIMPL_H | 20 | #ifndef KEYBOARDIMPL_H |
21 | #define KEYBOARDIMPL_H | 21 | #define KEYBOARDIMPL_H |
22 | 22 | ||
23 | #include <qpe/inputmethodinterface.h> | 23 | #include <qpe/inputmethodinterface.h> |
24 | 24 | ||
25 | class Keyboard; | 25 | namespace KeyboardInput |
26 | { | ||
27 | class Keyboard; | ||
28 | } | ||
29 | |||
26 | class QPixmap; | 30 | class QPixmap; |
27 | 31 | ||
32 | namespace | ||
33 | { | ||
34 | |||
28 | class KeyboardImpl : public InputMethodInterface | 35 | class KeyboardImpl : public InputMethodInterface |
29 | { | 36 | { |
30 | public: | 37 | public: |
31 | KeyboardImpl(); | 38 | KeyboardImpl(); |
32 | virtual ~KeyboardImpl(); | 39 | virtual ~KeyboardImpl(); |
33 | 40 | ||
34 | #ifndef QT_NO_COMPONENT | 41 | #ifndef QT_NO_COMPONENT |
35 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 42 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
36 | Q_REFCOUNT | 43 | Q_REFCOUNT |
37 | #endif | 44 | #endif |
38 | 45 | ||
39 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); | 46 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); |
40 | virtual void resetState(); | 47 | virtual void resetState(); |
41 | virtual QPixmap *icon(); | 48 | virtual QPixmap *icon(); |
42 | virtual QString name(); | 49 | virtual QString name(); |
43 | virtual void onKeyPress( QObject *receiver, const char *slot ); | 50 | virtual void onKeyPress( QObject *receiver, const char *slot ); |
44 | 51 | ||
45 | private: | 52 | private: |
46 | Keyboard *input; | 53 | KeyboardInput::Keyboard *input; |
47 | QPixmap *icn; | 54 | QPixmap *icn; |
48 | ulong ref; | 55 | ulong ref; |
49 | }; | 56 | }; |
50 | 57 | ||
58 | } // anonymous namespace | ||
59 | |||
51 | #endif | 60 | #endif |
diff --git a/inputmethods/kjumpx/keyboard.cpp b/inputmethods/kjumpx/keyboard.cpp index 3af6a78..dc44805 100644 --- a/inputmethods/kjumpx/keyboard.cpp +++ b/inputmethods/kjumpx/keyboard.cpp | |||
@@ -47,192 +47,193 @@ static const int mod2w = mod2x2 - mod2x1; | |||
47 | static const int cursorx1 = 207; | 47 | static const int cursorx1 = 207; |
48 | static const int cursorw = 16; | 48 | static const int cursorw = 16; |
49 | 49 | ||
50 | static const int myParenID = -10; | 50 | static const int myParenID = -10; |
51 | 51 | ||
52 | 52 | ||
53 | typedef struct mapElement | 53 | typedef struct mapElement |
54 | { | 54 | { |
55 | int qcode; | 55 | int qcode; |
56 | ushort unicode; | 56 | ushort unicode; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static const mapElement mod1Map[] = { | 59 | static const mapElement mod1Map[] = { |
60 | { Qt::Key_Escape, 27 }, | 60 | { Qt::Key_Escape, 27 }, |
61 | { Qt::Key_Tab, 9 }, | 61 | { Qt::Key_Tab, 9 }, |
62 | { Qt::Key_Return, 13 }, | 62 | { Qt::Key_Return, 13 }, |
63 | { Qt::Key_Alt, 0 }, | 63 | { Qt::Key_Alt, 0 }, |
64 | { Qt::Key_Control, 0 }, | 64 | { Qt::Key_Control, 0 }, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static const uchar *const letterMap[] = { | 67 | static const uchar *const letterMap[] = { |
68 | (const uchar *const)"zvchwk", | 68 | (const uchar *const)"zvchwk", |
69 | (const uchar *const)"fitaly", | 69 | (const uchar *const)"fitaly", |
70 | (const uchar *const)" ne ", | 70 | (const uchar *const)" ne ", |
71 | (const uchar *const)"gdorsb", | 71 | (const uchar *const)"gdorsb", |
72 | (const uchar *const)"qjumpx", | 72 | (const uchar *const)"qjumpx", |
73 | }; | 73 | }; |
74 | 74 | ||
75 | static const ushort kletterMap[][6] = { | 75 | static const ushort kletterMap[][6] = { |
76 | { 0x110c, 0x1112, 0x1109, 0x116d, 0x1167, 0x1163 }, | 76 | { 0x110c, 0x1112, 0x1109, 0x116d, 0x1167, 0x1163 }, |
77 | { 0x110f, 0x1105, 0x1100, 0x1161, 0x1175, 0x1162 }, | 77 | { 0x110f, 0x1105, 0x1100, 0x1161, 0x1175, 0x1162 }, |
78 | { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, | 78 | { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, |
79 | { 0x1110, 0x1103, 0x1102, 0x1169, 0x1173, 0x1166 }, | 79 | { 0x1110, 0x1103, 0x1102, 0x1169, 0x1173, 0x1166 }, |
80 | { 0x110e, 0x1107, 0x1106, 0x1111, 0x116e, 0x1172 }, | 80 | { 0x110e, 0x1107, 0x1106, 0x1111, 0x116e, 0x1172 }, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static const uchar *const letterMapShift[] = { | 83 | static const uchar *const letterMapShift[] = { |
84 | (const uchar *const)"ZVCHWK", | 84 | (const uchar *const)"ZVCHWK", |
85 | (const uchar *const)"FITALY", | 85 | (const uchar *const)"FITALY", |
86 | (const uchar *const)" NE ", | 86 | (const uchar *const)" NE ", |
87 | (const uchar *const)"GDORSB", | 87 | (const uchar *const)"GDORSB", |
88 | (const uchar *const)"QJUMPX", | 88 | (const uchar *const)"QJUMPX", |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static const ushort kletterMapShift[][6] = { | 91 | static const ushort kletterMapShift[][6] = { |
92 | { 0x110d, 0x1112, 0x110a, 0x116d, 0x1167, 0x1163 }, | 92 | { 0x110d, 0x1112, 0x110a, 0x116d, 0x1167, 0x1163 }, |
93 | { 0x110f, 0x1105, 0x1101, 0x1161, 0x1175, 0x1164 }, | 93 | { 0x110f, 0x1105, 0x1101, 0x1161, 0x1175, 0x1164 }, |
94 | { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, | 94 | { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, |
95 | { 0x1110, 0x1104, 0x1102, 0x1169, 0x1173, 0x1168 }, | 95 | { 0x1110, 0x1104, 0x1102, 0x1169, 0x1173, 0x1168 }, |
96 | { 0x110e, 0x1108, 0x1106, 0x1111, 0x116e, 0x1172 }, | 96 | { 0x110e, 0x1108, 0x1106, 0x1111, 0x116e, 0x1172 }, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static const uchar *const num1Map = (const uchar *const)"12345"; | 99 | static const uchar *const num1Map = (const uchar *const)"12345"; |
100 | 100 | ||
101 | static const uchar *const specialMap[] = { | 101 | static const uchar *const specialMap[] = { |
102 | (const uchar *const)"-+", | 102 | (const uchar *const)"-+", |
103 | (const uchar *const)"*!", | 103 | (const uchar *const)"*!", |
104 | (const uchar *const)",'", | 104 | (const uchar *const)",'", |
105 | (const uchar *const)".%", | 105 | (const uchar *const)".%", |
106 | (const uchar *const)"/$", | 106 | (const uchar *const)"/$", |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static const uchar *const specialMapShift[] = { | 109 | static const uchar *const specialMapShift[] = { |
110 | (const uchar *const)"_=", | 110 | (const uchar *const)"_=", |
111 | (const uchar *const)"#?", | 111 | (const uchar *const)"#?", |
112 | (const uchar *const)";\"", | 112 | (const uchar *const)";\"", |
113 | (const uchar *const)":|", | 113 | (const uchar *const)":|", |
114 | (const uchar *const)"\\&", | 114 | (const uchar *const)"\\&", |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static const uchar *const specialMapParen[] = { | 117 | static const uchar *const specialMapParen[] = { |
118 | (const uchar *const)"()", | 118 | (const uchar *const)"()", |
119 | (const uchar *const)"[]", | 119 | (const uchar *const)"[]", |
120 | (const uchar *const)"{}", | 120 | (const uchar *const)"{}", |
121 | (const uchar *const)"<>", | 121 | (const uchar *const)"<>", |
122 | (const uchar *const)"@~", | 122 | (const uchar *const)"@~", |
123 | }; | 123 | }; |
124 | 124 | ||
125 | static const uchar *const num2Map = (const uchar *const)"67890"; | 125 | static const uchar *const num2Map = (const uchar *const)"67890"; |
126 | 126 | ||
127 | static const mapElement mod2Map[] = { | 127 | static const mapElement mod2Map[] = { |
128 | { Qt::Key_Backspace, 8 }, | 128 | { Qt::Key_Backspace, 8 }, |
129 | { Qt::Key_Delete, 0 }, | 129 | { Qt::Key_Delete, 0 }, |
130 | { Qt::Key_Return, 13 }, | 130 | { Qt::Key_Return, 13 }, |
131 | { Qt::Key_Shift, 0 }, | 131 | { Qt::Key_Shift, 0 }, |
132 | { myParenID, 0 }, | 132 | { myParenID, 0 }, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static const int cursorMap[][2] = { | 135 | static const int cursorMap[][2] = { |
136 | { Qt::Key_Home, Qt::Key_PageUp }, | 136 | { Qt::Key_Home, Qt::Key_PageUp }, |
137 | { Qt::Key_End, Qt::Key_PageDown }, | 137 | { Qt::Key_End, Qt::Key_PageDown }, |
138 | { Qt::Key_Up, Qt::Key_Up }, | 138 | { Qt::Key_Up, Qt::Key_Up }, |
139 | { Qt::Key_Left, Qt::Key_Right }, | 139 | { Qt::Key_Left, Qt::Key_Right }, |
140 | { Qt::Key_Down, Qt::Key_Down }, | 140 | { Qt::Key_Down, Qt::Key_Down }, |
141 | }; | 141 | }; |
142 | 142 | ||
143 | using namespace KJumpX; | ||
143 | 144 | ||
144 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : | 145 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : |
145 | QFrame(parent, name, f), | 146 | QFrame(parent, name, f), |
146 | shift(0), paren(0), ctrl(0), alt(0), lang(1), lastKey(0), | 147 | shift(0), paren(0), ctrl(0), alt(0), lang(1), lastKey(0), |
147 | pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), | 148 | pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), |
148 | isnoncont(false), | 149 | isnoncont(false), |
149 | slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), | 150 | slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), |
150 | enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), | 151 | enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), |
151 | releasedPix(NULL), pressedPix(NULL) | 152 | releasedPix(NULL), pressedPix(NULL) |
152 | { | 153 | { |
153 | //setPalette(QPalette(QColor(240,240,230))); // Beige! | 154 | //setPalette(QPalette(QColor(240,240,230))); // Beige! |
154 | 155 | ||
155 | releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("kjumpx/released"); | 156 | releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("kjumpx/released"); |
156 | pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("kjumpx/pressed"); | 157 | pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("kjumpx/pressed"); |
157 | pressedDigit = Resource::loadPixmap("kjumpx/pressed"); | 158 | pressedDigit = Resource::loadPixmap("kjumpx/pressed"); |
158 | 159 | ||
159 | QPixmap tmp; | 160 | QPixmap tmp; |
160 | 161 | ||
161 | tmp = Resource::loadPixmap("kjumpx/releasedShift"); | 162 | tmp = Resource::loadPixmap("kjumpx/releasedShift"); |
162 | bitBlt(&releasedShift, letterx1, 0, &tmp); | 163 | bitBlt(&releasedShift, letterx1, 0, &tmp); |
163 | 164 | ||
164 | tmp = Resource::loadPixmap("kjumpx/releasedParen"); | 165 | tmp = Resource::loadPixmap("kjumpx/releasedParen"); |
165 | bitBlt(&releasedParen, specialx1, 0, &tmp); | 166 | bitBlt(&releasedParen, specialx1, 0, &tmp); |
166 | 167 | ||
167 | tmp = Resource::loadPixmap("kjumpx/pressedShift"); | 168 | tmp = Resource::loadPixmap("kjumpx/pressedShift"); |
168 | bitBlt(&pressedShift, letterx1, 0, &tmp); | 169 | bitBlt(&pressedShift, letterx1, 0, &tmp); |
169 | 170 | ||
170 | tmp = Resource::loadPixmap("kjumpx/pressedParen"); | 171 | tmp = Resource::loadPixmap("kjumpx/pressedParen"); |
171 | bitBlt(&pressedParen, specialx1, 0, &tmp); | 172 | bitBlt(&pressedParen, specialx1, 0, &tmp); |
172 | 173 | ||
173 | tmp = Resource::loadPixmap("kjumpx/pressedDigit"); | 174 | tmp = Resource::loadPixmap("kjumpx/pressedDigit"); |
174 | bitBlt(&pressedDigit, specialx1, 0, &tmp); | 175 | bitBlt(&pressedDigit, specialx1, 0, &tmp); |
175 | 176 | ||
176 | offscreen = QPixmap( releasedPlain ); | 177 | offscreen = QPixmap( releasedPlain ); |
177 | 178 | ||
178 | releasedPix = &releasedPlain; | 179 | releasedPix = &releasedPlain; |
179 | pressedPix = &pressedPlain; | 180 | pressedPix = &pressedPlain; |
180 | slidePix = &pressedPlain; | 181 | slidePix = &pressedPlain; |
181 | 182 | ||
182 | delayTimer = new QTimer(this); | 183 | delayTimer = new QTimer(this); |
183 | rateTimer = new QTimer(this); | 184 | rateTimer = new QTimer(this); |
184 | connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); | 185 | connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); |
185 | connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); | 186 | connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); |
186 | } | 187 | } |
187 | 188 | ||
188 | void Keyboard::resizeEvent(QResizeEvent*) | 189 | void Keyboard::resizeEvent(QResizeEvent*) |
189 | { | 190 | { |
190 | //cout << "resizeEvent()" << endl; | 191 | //cout << "resizeEvent()" << endl; |
191 | } | 192 | } |
192 | 193 | ||
193 | void Keyboard::paintEvent(QPaintEvent*) | 194 | void Keyboard::paintEvent(QPaintEvent*) |
194 | { | 195 | { |
195 | bitBlt(this, 0, 0, &offscreen); | 196 | bitBlt(this, 0, 0, &offscreen); |
196 | } | 197 | } |
197 | 198 | ||
198 | void Keyboard::mousePressEvent(QMouseEvent *e) | 199 | void Keyboard::mousePressEvent(QMouseEvent *e) |
199 | { | 200 | { |
200 | pressedx = -1; | 201 | pressedx = -1; |
201 | pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; | 202 | pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; |
202 | 203 | ||
203 | int x = e->x(); | 204 | int x = e->x(); |
204 | int y = e->y(); | 205 | int y = e->y(); |
205 | 206 | ||
206 | int row = (y - 1) / letterh; | 207 | int row = (y - 1) / letterh; |
207 | 208 | ||
208 | if ( x <= mod1x2 ) // mod1 | 209 | if ( x <= mod1x2 ) // mod1 |
209 | { | 210 | { |
210 | pressedx = mod1x1; | 211 | pressedx = mod1x1; |
211 | pressedy = row * letterh; | 212 | pressedy = row * letterh; |
212 | pressedw = mod1w + 1; | 213 | pressedw = mod1w + 1; |
213 | pressedh = letterh + 1; | 214 | pressedh = letterh + 1; |
214 | if ( row == 2 ) // return | 215 | if ( row == 2 ) // return |
215 | { | 216 | { |
216 | pressed2x = mod2x1; | 217 | pressed2x = mod2x1; |
217 | pressed2y = 2 * letterh; | 218 | pressed2y = 2 * letterh; |
218 | pressed2w = mod2w + 1; | 219 | pressed2w = mod2w + 1; |
219 | pressed2h = letterh + 1; | 220 | pressed2h = letterh + 1; |
220 | isnoncont = true; | 221 | isnoncont = true; |
221 | } | 222 | } |
222 | else if ( row == 3 ) // alt | 223 | else if ( row == 3 ) // alt |
223 | alt = 1; | 224 | alt = 1; |
224 | else if ( row == 4 ) // ctrl | 225 | else if ( row == 4 ) // ctrl |
225 | ctrl = 1; | 226 | ctrl = 1; |
226 | pressedKeyUnicode = mod1Map[row].unicode; | 227 | pressedKeyUnicode = mod1Map[row].unicode; |
227 | pressedKeyQcode = mod1Map[row].qcode; | 228 | pressedKeyQcode = mod1Map[row].qcode; |
228 | } | 229 | } |
229 | else if ( x >= letterx1 && x <= letterx2 ) // letter | 230 | else if ( x >= letterx1 && x <= letterx2 ) // letter |
230 | { | 231 | { |
231 | int column = (x - letterx1 - 1) / letterw; | 232 | int column = (x - letterx1 - 1) / letterw; |
232 | QChar temp; | 233 | QChar temp; |
233 | if (lang == 0) // english | 234 | if (lang == 0) // english |
234 | if ( shift ) | 235 | if ( shift ) |
235 | temp = QChar( letterMapShift[row][column] ); | 236 | temp = QChar( letterMapShift[row][column] ); |
236 | else | 237 | else |
237 | temp = QChar( letterMap[row][column] ); | 238 | temp = QChar( letterMap[row][column] ); |
238 | else if (lang == 1) // korean | 239 | else if (lang == 1) // korean |
diff --git a/inputmethods/kjumpx/keyboard.h b/inputmethods/kjumpx/keyboard.h index 148cb72..ca83915 100644 --- a/inputmethods/kjumpx/keyboard.h +++ b/inputmethods/kjumpx/keyboard.h | |||
@@ -1,79 +1,84 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | #include <qframe.h> | 12 | #include <qframe.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | #include <qtimer.h> | 14 | #include <qtimer.h> |
15 | 15 | ||
16 | namespace KJumpX | ||
17 | { | ||
18 | |||
16 | class Keyboard : public QFrame | 19 | class Keyboard : public QFrame |
17 | { | 20 | { |
18 | Q_OBJECT | 21 | Q_OBJECT |
19 | public: | 22 | public: |
20 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 23 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
21 | 24 | ||
22 | void resetState(); | 25 | void resetState(); |
23 | 26 | ||
24 | void mousePressEvent(QMouseEvent*); | 27 | void mousePressEvent(QMouseEvent*); |
25 | void mouseReleaseEvent(QMouseEvent*); | 28 | void mouseReleaseEvent(QMouseEvent*); |
26 | void mouseMoveEvent(QMouseEvent*); | 29 | void mouseMoveEvent(QMouseEvent*); |
27 | void resizeEvent(QResizeEvent*); | 30 | void resizeEvent(QResizeEvent*); |
28 | void paintEvent(QPaintEvent* e); | 31 | void paintEvent(QPaintEvent* e); |
29 | //void timerEvent(QTimerEvent* e); | 32 | //void timerEvent(QTimerEvent* e); |
30 | 33 | ||
31 | QSize sizeHint() const; | 34 | QSize sizeHint() const; |
32 | 35 | ||
33 | QChar parseKoreanInput(ushort); | 36 | QChar parseKoreanInput(ushort); |
34 | ushort combineKoreanChars(const ushort, const ushort, const ushort); | 37 | ushort combineKoreanChars(const ushort, const ushort, const ushort); |
35 | ushort constoe(const ushort); | 38 | ushort constoe(const ushort); |
36 | 39 | ||
37 | 40 | ||
38 | signals: | 41 | signals: |
39 | void key( ushort unicode, ushort qcode, ushort modifiers, bool, bool ); | 42 | void key( ushort unicode, ushort qcode, ushort modifiers, bool, bool ); |
40 | 43 | ||
41 | private slots: | 44 | private slots: |
42 | void delayTimerDone(); | 45 | void delayTimerDone(); |
43 | void rateTimerDone(); | 46 | void rateTimerDone(); |
44 | 47 | ||
45 | private: | 48 | private: |
46 | int shift; // 0, 1, 2 | 49 | int shift; // 0, 1, 2 |
47 | int paren; // 0, 1, 2 | 50 | int paren; // 0, 1, 2 |
48 | int ctrl; // 0, 1 | 51 | int ctrl; // 0, 1 |
49 | int alt; // 0, 1 | 52 | int alt; // 0, 1 |
50 | bool lang; // 0 -> english, 1 -> korean | 53 | bool lang; // 0 -> english, 1 -> korean |
51 | 54 | ||
52 | int lastKey; | 55 | int lastKey; |
53 | 56 | ||
54 | int pressedKeyUnicode, pressedKeyQcode, pressedMod; | 57 | int pressedKeyUnicode, pressedKeyQcode, pressedMod; |
55 | int pressedx, pressedy, pressedw, pressedh; | 58 | int pressedx, pressedy, pressedw, pressedh; |
56 | bool isnoncont; | 59 | bool isnoncont; |
57 | int pressed2x, pressed2y, pressed2w, pressed2h; | 60 | int pressed2x, pressed2y, pressed2w, pressed2h; |
58 | 61 | ||
59 | int slideKeyUnicodeH, slideKeyQcodeH, slideKeyUnicodeV, slideKeyQcodeV; | 62 | int slideKeyUnicodeH, slideKeyQcodeH, slideKeyUnicodeV, slideKeyQcodeV; |
60 | bool enableMouseTracking; | 63 | bool enableMouseTracking; |
61 | QPixmap *slidePix, *slidePixH, *slidePixV; | 64 | QPixmap *slidePix, *slidePixH, *slidePixV; |
62 | 65 | ||
63 | QPixmap releasedPlain; | 66 | QPixmap releasedPlain; |
64 | QPixmap releasedShift; | 67 | QPixmap releasedShift; |
65 | QPixmap releasedParen; | 68 | QPixmap releasedParen; |
66 | 69 | ||
67 | QPixmap pressedPlain; | 70 | QPixmap pressedPlain; |
68 | QPixmap pressedShift; | 71 | QPixmap pressedShift; |
69 | QPixmap pressedParen; | 72 | QPixmap pressedParen; |
70 | QPixmap pressedDigit; | 73 | QPixmap pressedDigit; |
71 | 74 | ||
72 | QPixmap offscreen; | 75 | QPixmap offscreen; |
73 | 76 | ||
74 | QPixmap *releasedPix; | 77 | QPixmap *releasedPix; |
75 | QPixmap *pressedPix; | 78 | QPixmap *pressedPix; |
76 | 79 | ||
77 | QTimer *delayTimer; | 80 | QTimer *delayTimer; |
78 | QTimer *rateTimer; | 81 | QTimer *rateTimer; |
79 | }; | 82 | }; |
83 | |||
84 | } // namespace KJumpX | ||
diff --git a/inputmethods/kjumpx/keyboardimpl.cpp b/inputmethods/kjumpx/keyboardimpl.cpp index 5d8e0d3..976d816 100644 --- a/inputmethods/kjumpx/keyboardimpl.cpp +++ b/inputmethods/kjumpx/keyboardimpl.cpp | |||
@@ -1,97 +1,97 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | #include "keyboard.h" | 14 | #include "keyboard.h" |
15 | #include "keyboardimpl.h" | 15 | #include "keyboardimpl.h" |
16 | 16 | ||
17 | /* XPM */ | 17 | /* XPM */ |
18 | static char * icon_xpm[] = { | 18 | static const char * const icon_xpm[] = { |
19 | "26 13 2 1", | 19 | "26 13 2 1", |
20 | " c None", | 20 | " c None", |
21 | ".c #000000", | 21 | ".c #000000", |
22 | " ... ... ... ... ... ... ", | 22 | " ... ... ... ... ... ... ", |
23 | ". . . . . ", | 23 | ". . . . . ", |
24 | ". . ... .. . . ", | 24 | ". . ... .. . . ", |
25 | ". . .. . . ", | 25 | ". . .. . . ", |
26 | " ...... ...... ... .... ", | 26 | " ...... ...... ... .... ", |
27 | ". .. .. .. . ", | 27 | ". .. .. .. . ", |
28 | ". .. .. .. . ", | 28 | ". .. .. .. . ", |
29 | ". ... .. . ", | 29 | ". ... .. . ", |
30 | " ...... .. ...... ", | 30 | " ...... .. ...... ", |
31 | ". . .. . . ", | 31 | ". . .. . . ", |
32 | ". . ....... . . ", | 32 | ". . ....... . . ", |
33 | ". . . . . ", | 33 | ". . . . . ", |
34 | " ... ... ... ... ... ... "}; | 34 | " ... ... ... ... ... ... "}; |
35 | 35 | ||
36 | 36 | ||
37 | KeyboardImpl::KeyboardImpl() | 37 | KeyboardImpl::KeyboardImpl() |
38 | : input(0), icn(0), ref(0) | 38 | : input(0), icn(0), ref(0) |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | KeyboardImpl::~KeyboardImpl() | 42 | KeyboardImpl::~KeyboardImpl() |
43 | { | 43 | { |
44 | delete input; | 44 | delete input; |
45 | delete icn; | 45 | delete icn; |
46 | } | 46 | } |
47 | 47 | ||
48 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 48 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
49 | { | 49 | { |
50 | if ( !input ) | 50 | if ( !input ) |
51 | input = new Keyboard( parent, "Keyboard", f ); | 51 | input = new KJumpX::Keyboard( parent, "Keyboard", f ); |
52 | return input; | 52 | return input; |
53 | } | 53 | } |
54 | 54 | ||
55 | void KeyboardImpl::resetState() | 55 | void KeyboardImpl::resetState() |
56 | { | 56 | { |
57 | if ( input ) | 57 | if ( input ) |
58 | input->resetState(); | 58 | input->resetState(); |
59 | } | 59 | } |
60 | 60 | ||
61 | QPixmap *KeyboardImpl::icon() | 61 | QPixmap *KeyboardImpl::icon() |
62 | { | 62 | { |
63 | if ( !icn ) | 63 | if ( !icn ) |
64 | icn = new QPixmap( (const char **)icon_xpm ); | 64 | icn = new QPixmap( (const char **)icon_xpm ); |
65 | return icn; | 65 | return icn; |
66 | } | 66 | } |
67 | 67 | ||
68 | QString KeyboardImpl::name() | 68 | QString KeyboardImpl::name() |
69 | { | 69 | { |
70 | return qApp->translate( "InputMethods", "KJumpX" ); | 70 | return qApp->translate( "InputMethods", "KJumpX" ); |
71 | } | 71 | } |
72 | 72 | ||
73 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 73 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
74 | { | 74 | { |
75 | if ( input ) | 75 | if ( input ) |
76 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 76 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
77 | } | 77 | } |
78 | 78 | ||
79 | #ifndef QT_NO_COMPONENT | 79 | #ifndef QT_NO_COMPONENT |
80 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 80 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
81 | { | 81 | { |
82 | *iface = 0; | 82 | *iface = 0; |
83 | if ( uuid == IID_QUnknown ) | 83 | if ( uuid == IID_QUnknown ) |
84 | *iface = this; | 84 | *iface = this; |
85 | else if ( uuid == IID_InputMethod ) | 85 | else if ( uuid == IID_InputMethod ) |
86 | *iface = this; | 86 | *iface = this; |
87 | 87 | ||
88 | if ( *iface ) | 88 | if ( *iface ) |
89 | (*iface)->addRef(); | 89 | (*iface)->addRef(); |
90 | return QS_OK; | 90 | return QS_OK; |
91 | } | 91 | } |
92 | 92 | ||
93 | Q_EXPORT_INTERFACE() | 93 | Q_EXPORT_INTERFACE() |
94 | { | 94 | { |
95 | Q_CREATE_INSTANCE( KeyboardImpl ) | 95 | Q_CREATE_INSTANCE( KeyboardImpl ) |
96 | } | 96 | } |
97 | #endif | 97 | #endif |
diff --git a/inputmethods/kjumpx/keyboardimpl.h b/inputmethods/kjumpx/keyboardimpl.h index a82ec4a..1ff1034 100644 --- a/inputmethods/kjumpx/keyboardimpl.h +++ b/inputmethods/kjumpx/keyboardimpl.h | |||
@@ -1,43 +1,51 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | #ifndef KEYBOARDIMPL_H | 12 | #ifndef KEYBOARDIMPL_H |
13 | #define KEYBOARDIMPL_H | 13 | #define KEYBOARDIMPL_H |
14 | 14 | ||
15 | #include <qpe/inputmethodinterface.h> | 15 | #include <qpe/inputmethodinterface.h> |
16 | 16 | ||
17 | class Keyboard; | 17 | namespace KJumpX |
18 | { | ||
19 | class Keyboard; | ||
20 | } | ||
18 | class QPixmap; | 21 | class QPixmap; |
19 | 22 | ||
23 | namespace | ||
24 | { | ||
25 | |||
20 | class KeyboardImpl : public InputMethodInterface | 26 | class KeyboardImpl : public InputMethodInterface |
21 | { | 27 | { |
22 | public: | 28 | public: |
23 | KeyboardImpl(); | 29 | KeyboardImpl(); |
24 | virtual ~KeyboardImpl(); | 30 | virtual ~KeyboardImpl(); |
25 | 31 | ||
26 | #ifndef QT_NO_COMPONENT | 32 | #ifndef QT_NO_COMPONENT |
27 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 33 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
28 | Q_REFCOUNT | 34 | Q_REFCOUNT |
29 | #endif | 35 | #endif |
30 | 36 | ||
31 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); | 37 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); |
32 | virtual void resetState(); | 38 | virtual void resetState(); |
33 | virtual QPixmap *icon(); | 39 | virtual QPixmap *icon(); |
34 | virtual QString name(); | 40 | virtual QString name(); |
35 | virtual void onKeyPress( QObject *receiver, const char *slot ); | 41 | virtual void onKeyPress( QObject *receiver, const char *slot ); |
36 | 42 | ||
37 | private: | 43 | private: |
38 | Keyboard *input; | 44 | KJumpX::Keyboard *input; |
39 | QPixmap *icn; | 45 | QPixmap *icn; |
40 | ulong ref; | 46 | ulong ref; |
41 | }; | 47 | }; |
42 | 48 | ||
49 | } // anonymous namespace | ||
50 | |||
43 | #endif | 51 | #endif |
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 84c0c74..c22fbb1 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -1,135 +1,136 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "keyboard.h" | 21 | #include "keyboard.h" |
22 | #include "configdlg.h" | 22 | #include "configdlg.h" |
23 | 23 | ||
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | 26 | ||
27 | #include <qwindowsystem_qws.h> | 27 | #include <qwindowsystem_qws.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qfontmetrics.h> | 29 | #include <qfontmetrics.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <ctype.h> | 33 | #include <ctype.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | 37 | ||
38 | #include <sys/utsname.h> | 38 | #include <sys/utsname.h> |
39 | 39 | ||
40 | using namespace MultiKey; | ||
40 | 41 | ||
41 | /* Keyboard::Keyboard {{{1 */ | 42 | /* Keyboard::Keyboard {{{1 */ |
42 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 43 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
43 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), | 44 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), |
44 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), | 45 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), |
45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), | 46 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), |
46 | pressedKeyRow(-1), pressedKeyCol(-1), | 47 | pressedKeyRow(-1), pressedKeyCol(-1), |
47 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 48 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
48 | configdlg(0) | 49 | configdlg(0) |
49 | 50 | ||
50 | { | 51 | { |
51 | 52 | ||
52 | // get the default font | 53 | // get the default font |
53 | Config *config = new Config( "qpe" ); | 54 | Config *config = new Config( "qpe" ); |
54 | config->setGroup( "Appearance" ); | 55 | config->setGroup( "Appearance" ); |
55 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); | 56 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); |
56 | delete config; | 57 | delete config; |
57 | 58 | ||
58 | config = new Config("multikey"); | 59 | config = new Config("multikey"); |
59 | config->setGroup ("general"); | 60 | config->setGroup ("general"); |
60 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed | 61 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed |
61 | useRepeat = config->readBoolEntry ("useRepeat", 1); | 62 | useRepeat = config->readBoolEntry ("useRepeat", 1); |
62 | delete config; | 63 | delete config; |
63 | 64 | ||
64 | 65 | ||
65 | setFont( QFont( familyStr, 10 ) ); | 66 | setFont( QFont( familyStr, 10 ) ); |
66 | 67 | ||
67 | picks = new KeyboardPicks( this ); | 68 | picks = new KeyboardPicks( this ); |
68 | picks->setFont( QFont( familyStr, 10 ) ); | 69 | picks->setFont( QFont( familyStr, 10 ) ); |
69 | picks->initialise(); | 70 | picks->initialise(); |
70 | if (usePicks) { | 71 | if (usePicks) { |
71 | 72 | ||
72 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 73 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
73 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 74 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
74 | 75 | ||
75 | } else picks->hide(); | 76 | } else picks->hide(); |
76 | 77 | ||
77 | loadKeyboardColors(); | 78 | loadKeyboardColors(); |
78 | 79 | ||
79 | keys = new Keys(); | 80 | keys = new Keys(); |
80 | 81 | ||
81 | repeatTimer = new QTimer( this ); | 82 | repeatTimer = new QTimer( this ); |
82 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 83 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
83 | 84 | ||
84 | } | 85 | } |
85 | 86 | ||
86 | Keyboard::~Keyboard() { | 87 | Keyboard::~Keyboard() { |
87 | 88 | ||
88 | if ( configdlg ) { | 89 | if ( configdlg ) { |
89 | delete (ConfigDlg *) configdlg; | 90 | delete (ConfigDlg *) configdlg; |
90 | configdlg = 0; | 91 | configdlg = 0; |
91 | } | 92 | } |
92 | 93 | ||
93 | } | 94 | } |
94 | 95 | ||
95 | /* Keyboard::resizeEvent {{{1 */ | 96 | /* Keyboard::resizeEvent {{{1 */ |
96 | void Keyboard::resizeEvent(QResizeEvent*) | 97 | void Keyboard::resizeEvent(QResizeEvent*) |
97 | { | 98 | { |
98 | int ph = picks->sizeHint().height(); | 99 | int ph = picks->sizeHint().height(); |
99 | picks->setGeometry( 0, 0, width(), ph ); | 100 | picks->setGeometry( 0, 0, width(), ph ); |
100 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); | 101 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); |
101 | 102 | ||
102 | int nk; // number of keys? | 103 | int nk; // number of keys? |
103 | if ( useLargeKeys ) { | 104 | if ( useLargeKeys ) { |
104 | nk = 15; | 105 | nk = 15; |
105 | } else { | 106 | } else { |
106 | nk = 19; | 107 | nk = 19; |
107 | } | 108 | } |
108 | defaultKeyWidth = (width()/nk)/2; | 109 | defaultKeyWidth = (width()/nk)/2; |
109 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? | 110 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? |
110 | 111 | ||
111 | } | 112 | } |
112 | 113 | ||
113 | /* KeyboardPicks::initialize {{{1 */ | 114 | /* KeyboardPicks::initialize {{{1 */ |
114 | void KeyboardPicks::initialise() | 115 | void KeyboardPicks::initialise() |
115 | { | 116 | { |
116 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 117 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
117 | mode = 0; | 118 | mode = 0; |
118 | dc = new KeyboardConfig(this); | 119 | dc = new KeyboardConfig(this); |
119 | configs.append(dc); | 120 | configs.append(dc); |
120 | } | 121 | } |
121 | 122 | ||
122 | /* KeyboardPicks::sizeHint {{{1 */ | 123 | /* KeyboardPicks::sizeHint {{{1 */ |
123 | QSize KeyboardPicks::sizeHint() const | 124 | QSize KeyboardPicks::sizeHint() const |
124 | { | 125 | { |
125 | return QSize(240,fontMetrics().lineSpacing()); | 126 | return QSize(240,fontMetrics().lineSpacing()); |
126 | } | 127 | } |
127 | 128 | ||
128 | 129 | ||
129 | /* KeyboardConfig::generateText {{{1 */ | 130 | /* KeyboardConfig::generateText {{{1 */ |
130 | void KeyboardConfig::generateText(const QString &s) | 131 | void KeyboardConfig::generateText(const QString &s) |
131 | { | 132 | { |
132 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 133 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
133 | for (int i=0; i<(int)backspaces; i++) { | 134 | for (int i=0; i<(int)backspaces; i++) { |
134 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 135 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); |
135 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 136 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); |
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index bc74e71..20c5cee 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -1,188 +1,191 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qframe.h> | 20 | #include <qframe.h> |
21 | #include <qmap.h> | 21 | #include <qmap.h> |
22 | #include "../pickboard/pickboardcfg.h" | 22 | #include "../pickboard/pickboardcfg.h" |
23 | #include "../pickboard/pickboardpicks.h" | 23 | #include "../pickboard/pickboardpicks.h" |
24 | #include "configdlg.h" | 24 | #include "configdlg.h" |
25 | 25 | ||
26 | class QTimer; | 26 | class QTimer; |
27 | 27 | ||
28 | namespace MultiKey | ||
29 | { | ||
30 | |||
28 | class KeyboardConfig : public DictFilterConfig | 31 | class KeyboardConfig : public DictFilterConfig |
29 | { | 32 | { |
30 | public: | 33 | public: |
31 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } | 34 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } |
32 | virtual void generateText(const QString &s); | 35 | virtual void generateText(const QString &s); |
33 | void decBackspaces() { if (backspaces) backspaces--; } | 36 | void decBackspaces() { if (backspaces) backspaces--; } |
34 | void incBackspaces() { backspaces++; } | 37 | void incBackspaces() { backspaces++; } |
35 | void resetBackspaces() { backspaces = 0; } | 38 | void resetBackspaces() { backspaces = 0; } |
36 | private: | 39 | private: |
37 | int backspaces; | 40 | int backspaces; |
38 | }; | 41 | }; |
39 | 42 | ||
40 | 43 | ||
41 | class KeyboardPicks : public PickboardPicks | 44 | class KeyboardPicks : public PickboardPicks |
42 | { | 45 | { |
43 | Q_OBJECT | 46 | Q_OBJECT |
44 | public: | 47 | public: |
45 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) | 48 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) |
46 | : PickboardPicks(parent, name, f) { } | 49 | : PickboardPicks(parent, name, f) { } |
47 | void initialise(); | 50 | void initialise(); |
48 | virtual QSize sizeHint() const; | 51 | virtual QSize sizeHint() const; |
49 | KeyboardConfig *dc; | 52 | KeyboardConfig *dc; |
50 | }; | 53 | }; |
51 | 54 | ||
52 | 55 | ||
53 | class Keys { | 56 | class Keys { |
54 | public: | 57 | public: |
55 | 58 | ||
56 | Keys(); | 59 | Keys(); |
57 | Keys(const char * filename); | 60 | Keys(const char * filename); |
58 | ~Keys(); | 61 | ~Keys(); |
59 | int width(const int row, const int col); | 62 | int width(const int row, const int col); |
60 | int rows(); | 63 | int rows(); |
61 | ushort uni(const int row, const int col); | 64 | ushort uni(const int row, const int col); |
62 | int qcode(const int row, const int col); | 65 | int qcode(const int row, const int col); |
63 | bool pressed(const int row, const int col); | 66 | bool pressed(const int row, const int col); |
64 | bool *pressedPtr(const int row, const int col); | 67 | bool *pressedPtr(const int row, const int col); |
65 | ushort shift(const ushort); | 68 | ushort shift(const ushort); |
66 | ushort meta(const ushort); | 69 | ushort meta(const ushort); |
67 | ushort circumflex(const ushort); | 70 | ushort circumflex(const ushort); |
68 | ushort diaeresis(const ushort); | 71 | ushort diaeresis(const ushort); |
69 | ushort baccent(const ushort); | 72 | ushort baccent(const ushort); |
70 | ushort accent(const ushort); | 73 | ushort accent(const ushort); |
71 | QImage *pix(const int row, const int col); | 74 | QImage *pix(const int row, const int col); |
72 | int numKeys(const int row); | 75 | int numKeys(const int row); |
73 | void setKeysFromFile(const char *filename); | 76 | void setKeysFromFile(const char *filename); |
74 | void setKey(const int row, const int qcode, const ushort unicode, | 77 | void setKey(const int row, const int qcode, const ushort unicode, |
75 | const int width, QImage *pix); | 78 | const int width, QImage *pix); |
76 | void setPressed(const int row, const int col, const bool pressed); | 79 | void setPressed(const int row, const int col, const bool pressed); |
77 | QString lang; | 80 | QString lang; |
78 | QString label; | 81 | QString label; |
79 | 82 | ||
80 | private: | 83 | private: |
81 | 84 | ||
82 | typedef struct Key { | 85 | typedef struct Key { |
83 | int qcode; // are qt key codes just unicode values? | 86 | int qcode; // are qt key codes just unicode values? |
84 | ushort unicode; | 87 | ushort unicode; |
85 | int width; // not pixels but relative key width. normal key is 2 | 88 | int width; // not pixels but relative key width. normal key is 2 |
86 | 89 | ||
87 | // only needed for keys like ctrl that can have multiple keys pressed at once | 90 | // only needed for keys like ctrl that can have multiple keys pressed at once |
88 | bool *pressed; | 91 | bool *pressed; |
89 | QImage *pix; | 92 | QImage *pix; |
90 | }; | 93 | }; |
91 | 94 | ||
92 | QList<Key> keys[6]; | 95 | QList<Key> keys[6]; |
93 | QMap<ushort,ushort> shiftMap; | 96 | QMap<ushort,ushort> shiftMap; |
94 | QMap<ushort,ushort> metaMap; | 97 | QMap<ushort,ushort> metaMap; |
95 | QMap<ushort,ushort> circumflexMap; | 98 | QMap<ushort,ushort> circumflexMap; |
96 | QMap<ushort,ushort> diaeresisMap; | 99 | QMap<ushort,ushort> diaeresisMap; |
97 | QMap<ushort,ushort> baccentMap; | 100 | QMap<ushort,ushort> baccentMap; |
98 | QMap<ushort,ushort> accentMap; | 101 | QMap<ushort,ushort> accentMap; |
99 | 102 | ||
100 | }; | 103 | }; |
101 | 104 | ||
102 | class Keyboard : public QFrame | 105 | class Keyboard : public QFrame |
103 | { | 106 | { |
104 | Q_OBJECT | 107 | Q_OBJECT |
105 | public: | 108 | public: |
106 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 109 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
107 | ~Keyboard(); | 110 | ~Keyboard(); |
108 | 111 | ||
109 | void resetState(); | 112 | void resetState(); |
110 | 113 | ||
111 | void mousePressEvent(QMouseEvent*); | 114 | void mousePressEvent(QMouseEvent*); |
112 | void mouseReleaseEvent(QMouseEvent*); | 115 | void mouseReleaseEvent(QMouseEvent*); |
113 | void resizeEvent(QResizeEvent*); | 116 | void resizeEvent(QResizeEvent*); |
114 | void paintEvent(QPaintEvent* e); | 117 | void paintEvent(QPaintEvent* e); |
115 | //void timerEvent(QTimerEvent* e); | 118 | //void timerEvent(QTimerEvent* e); |
116 | void drawKeyboard( QPainter &p, int row = -1, int col = -1); | 119 | void drawKeyboard( QPainter &p, int row = -1, int col = -1); |
117 | 120 | ||
118 | QSize sizeHint() const; | 121 | QSize sizeHint() const; |
119 | 122 | ||
120 | signals: | 123 | signals: |
121 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); | 124 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); |
122 | 125 | ||
123 | private slots: | 126 | private slots: |
124 | void repeat(); | 127 | void repeat(); |
125 | void togglePickboard(bool on_off); | 128 | void togglePickboard(bool on_off); |
126 | void toggleRepeat(bool on_off); | 129 | void toggleRepeat(bool on_off); |
127 | void setMapToDefault(); | 130 | void setMapToDefault(); |
128 | void setMapToFile(QString map); | 131 | void setMapToFile(QString map); |
129 | void cleanupConfigDlg(); | 132 | void cleanupConfigDlg(); |
130 | 133 | ||
131 | // used to redraw keyboard after edited colors | 134 | // used to redraw keyboard after edited colors |
132 | void reloadKeyboard(); | 135 | void reloadKeyboard(); |
133 | 136 | ||
134 | private: | 137 | private: |
135 | int getKey( int &w, int j = -1 ); | 138 | int getKey( int &w, int j = -1 ); |
136 | void clearHighlight(); | 139 | void clearHighlight(); |
137 | 140 | ||
138 | bool *shift; | 141 | bool *shift; |
139 | bool *lock; | 142 | bool *lock; |
140 | bool *ctrl; | 143 | bool *ctrl; |
141 | bool *alt; | 144 | bool *alt; |
142 | bool *meta; | 145 | bool *meta; |
143 | bool *circumflex; | 146 | bool *circumflex; |
144 | bool *diaeresis; | 147 | bool *diaeresis; |
145 | bool *baccent; | 148 | bool *baccent; |
146 | bool *accent; | 149 | bool *accent; |
147 | 150 | ||
148 | uint useLargeKeys:1; | 151 | uint useLargeKeys:1; |
149 | uint usePicks:1; | 152 | uint usePicks:1; |
150 | uint useRepeat:1; | 153 | uint useRepeat:1; |
151 | 154 | ||
152 | int pressedKeyRow; | 155 | int pressedKeyRow; |
153 | int pressedKeyCol; | 156 | int pressedKeyCol; |
154 | 157 | ||
155 | KeyboardPicks *picks; | 158 | KeyboardPicks *picks; |
156 | 159 | ||
157 | int keyHeight; | 160 | int keyHeight; |
158 | int defaultKeyWidth; | 161 | int defaultKeyWidth; |
159 | int xoffs; | 162 | int xoffs; |
160 | 163 | ||
161 | int unicode; | 164 | int unicode; |
162 | int qkeycode; | 165 | int qkeycode; |
163 | int modifiers; | 166 | int modifiers; |
164 | 167 | ||
165 | int pressTid; | 168 | int pressTid; |
166 | bool pressed; | 169 | bool pressed; |
167 | 170 | ||
168 | Keys *keys; | 171 | Keys *keys; |
169 | 172 | ||
170 | /* for korean input */ | 173 | /* for korean input */ |
171 | ushort schar, mchar, echar; | 174 | ushort schar, mchar, echar; |
172 | ushort parseKoreanInput(ushort c); | 175 | ushort parseKoreanInput(ushort c); |
173 | ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); | 176 | ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); |
174 | ushort constoe(const ushort c); | 177 | ushort constoe(const ushort c); |
175 | 178 | ||
176 | QTimer *repeatTimer; | 179 | QTimer *repeatTimer; |
177 | 180 | ||
178 | /* colors */ | 181 | /* colors */ |
179 | void loadKeyboardColors(); | 182 | void loadKeyboardColors(); |
180 | QColor keycolor; | 183 | QColor keycolor; |
181 | QColor keycolor_pressed; | 184 | QColor keycolor_pressed; |
182 | QColor keycolor_lines; | 185 | QColor keycolor_lines; |
183 | QColor textcolor; | 186 | QColor textcolor; |
184 | 187 | ||
185 | ConfigDlg *configdlg; | 188 | ConfigDlg *configdlg; |
186 | }; | 189 | }; |
187 | 190 | ||
188 | 191 | } // namespace MultiKey | |
diff --git a/inputmethods/multikey/keyboardimpl.cpp b/inputmethods/multikey/keyboardimpl.cpp index cebd43d..4cfbcd5 100644 --- a/inputmethods/multikey/keyboardimpl.cpp +++ b/inputmethods/multikey/keyboardimpl.cpp | |||
@@ -1,107 +1,107 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include "keyboard.h" | 22 | #include "keyboard.h" |
23 | #include "keyboardimpl.h" | 23 | #include "keyboardimpl.h" |
24 | 24 | ||
25 | /* XPM */ | 25 | /* XPM */ |
26 | static const char * kb_xpm[] = { | 26 | static const char * const kb_xpm[] = { |
27 | "28 13 4 1", | 27 | "28 13 4 1", |
28 | " c None", | 28 | " c None", |
29 | ". c #4C4C4C", | 29 | ". c #4C4C4C", |
30 | "+ c #FFF7DD", | 30 | "+ c #FFF7DD", |
31 | "@ c #D6CFBA", | 31 | "@ c #D6CFBA", |
32 | " .......................... ", | 32 | " .......................... ", |
33 | " .+++.+++.+++.+++.+++.++++. ", | 33 | " .+++.+++.+++.+++.+++.++++. ", |
34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", | 34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", |
35 | " .......................... ", | 35 | " .......................... ", |
36 | " .+++++.+++.+++.+++.++++++. ", | 36 | " .+++++.+++.+++.+++.++++++. ", |
37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", | 37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", |
38 | " .......................... ", | 38 | " .......................... ", |
39 | " .++++++.+++.+++.+++.+++++. ", | 39 | " .++++++.+++.+++.+++.+++++. ", |
40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", | 40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", |
41 | " .......................... ", | 41 | " .......................... ", |
42 | " .++++.++++++++++++++.++++. ", | 42 | " .++++.++++++++++++++.++++. ", |
43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", | 43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", |
44 | " .......................... "}; | 44 | " .......................... "}; |
45 | 45 | ||
46 | 46 | ||
47 | KeyboardImpl::KeyboardImpl() | 47 | KeyboardImpl::KeyboardImpl() |
48 | : input(0), icn(0), ref(0) | 48 | : input(0), icn(0), ref(0) |
49 | { | 49 | { |
50 | } | 50 | } |
51 | 51 | ||
52 | KeyboardImpl::~KeyboardImpl() | 52 | KeyboardImpl::~KeyboardImpl() |
53 | { | 53 | { |
54 | delete input; | 54 | delete input; |
55 | delete icn; | 55 | delete icn; |
56 | } | 56 | } |
57 | 57 | ||
58 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 58 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
59 | { | 59 | { |
60 | if ( !input ) | 60 | if ( !input ) |
61 | input = new Keyboard( parent, "Keyboard", f ); | 61 | input = new MultiKey::Keyboard( parent, "Keyboard", f ); |
62 | return input; | 62 | return input; |
63 | } | 63 | } |
64 | 64 | ||
65 | void KeyboardImpl::resetState() | 65 | void KeyboardImpl::resetState() |
66 | { | 66 | { |
67 | if ( input ) | 67 | if ( input ) |
68 | input->resetState(); | 68 | input->resetState(); |
69 | } | 69 | } |
70 | 70 | ||
71 | QPixmap *KeyboardImpl::icon() | 71 | QPixmap *KeyboardImpl::icon() |
72 | { | 72 | { |
73 | if ( !icn ) | 73 | if ( !icn ) |
74 | icn = new QPixmap( (const char **)kb_xpm ); | 74 | icn = new QPixmap( (const char **)kb_xpm ); |
75 | return icn; | 75 | return icn; |
76 | } | 76 | } |
77 | 77 | ||
78 | QString KeyboardImpl::name() | 78 | QString KeyboardImpl::name() |
79 | { | 79 | { |
80 | return qApp->translate( "InputMethods", "Multikey" ); | 80 | return qApp->translate( "InputMethods", "Multikey" ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 83 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
84 | { | 84 | { |
85 | if ( input ) | 85 | if ( input ) |
86 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 86 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
87 | } | 87 | } |
88 | 88 | ||
89 | #ifndef QT_NO_COMPONENT | 89 | #ifndef QT_NO_COMPONENT |
90 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 90 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
91 | { | 91 | { |
92 | *iface = 0; | 92 | *iface = 0; |
93 | if ( uuid == IID_QUnknown ) | 93 | if ( uuid == IID_QUnknown ) |
94 | *iface = this; | 94 | *iface = this; |
95 | else if ( uuid == IID_InputMethod ) | 95 | else if ( uuid == IID_InputMethod ) |
96 | *iface = this; | 96 | *iface = this; |
97 | 97 | ||
98 | if ( *iface ) | 98 | if ( *iface ) |
99 | (*iface)->addRef(); | 99 | (*iface)->addRef(); |
100 | return QS_OK; | 100 | return QS_OK; |
101 | } | 101 | } |
102 | 102 | ||
103 | Q_EXPORT_INTERFACE() | 103 | Q_EXPORT_INTERFACE() |
104 | { | 104 | { |
105 | Q_CREATE_INSTANCE( KeyboardImpl ) | 105 | Q_CREATE_INSTANCE( KeyboardImpl ) |
106 | } | 106 | } |
107 | #endif | 107 | #endif |
diff --git a/inputmethods/multikey/keyboardimpl.h b/inputmethods/multikey/keyboardimpl.h index e756364..76a2955 100644 --- a/inputmethods/multikey/keyboardimpl.h +++ b/inputmethods/multikey/keyboardimpl.h | |||
@@ -1,51 +1,60 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef KEYBOARDIMPL_H | 20 | #ifndef KEYBOARDIMPL_H |
21 | #define KEYBOARDIMPL_H | 21 | #define KEYBOARDIMPL_H |
22 | 22 | ||
23 | #include <qpe/inputmethodinterface.h> | 23 | #include <qpe/inputmethodinterface.h> |
24 | 24 | ||
25 | class Keyboard; | 25 | namespace MultiKey |
26 | { | ||
27 | class Keyboard; | ||
28 | } | ||
29 | |||
26 | class QPixmap; | 30 | class QPixmap; |
27 | 31 | ||
32 | namespace | ||
33 | { | ||
34 | |||
28 | class KeyboardImpl : public InputMethodInterface | 35 | class KeyboardImpl : public InputMethodInterface |
29 | { | 36 | { |
30 | public: | 37 | public: |
31 | KeyboardImpl(); | 38 | KeyboardImpl(); |
32 | virtual ~KeyboardImpl(); | 39 | virtual ~KeyboardImpl(); |
33 | 40 | ||
34 | #ifndef QT_NO_COMPONENT | 41 | #ifndef QT_NO_COMPONENT |
35 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 42 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
36 | Q_REFCOUNT | 43 | Q_REFCOUNT |
37 | #endif | 44 | #endif |
38 | 45 | ||
39 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); | 46 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); |
40 | virtual void resetState(); | 47 | virtual void resetState(); |
41 | virtual QPixmap *icon(); | 48 | virtual QPixmap *icon(); |
42 | virtual QString name(); | 49 | virtual QString name(); |
43 | virtual void onKeyPress( QObject *receiver, const char *slot ); | 50 | virtual void onKeyPress( QObject *receiver, const char *slot ); |
44 | 51 | ||
45 | private: | 52 | private: |
46 | Keyboard *input; | 53 | MultiKey::Keyboard *input; |
47 | QPixmap *icn; | 54 | QPixmap *icn; |
48 | ulong ref; | 55 | ulong ref; |
49 | }; | 56 | }; |
50 | 57 | ||
58 | } // anonymous namespace | ||
59 | |||
51 | #endif | 60 | #endif |