author | simon <simon> | 2002-11-22 10:56:30 (UTC) |
---|---|---|
committer | simon <simon> | 2002-11-22 10:56:30 (UTC) |
commit | 480284c491e26427c630131a25e56f9ed1d129b2 (patch) (unidiff) | |
tree | 3bdd60afe34e8c466fbea92dcf89fcab381b110d /inputmethods/multikey | |
parent | 772c1321e4e95a415b9de700c3474f81f98b5482 (diff) | |
download | opie-480284c491e26427c630131a25e56f9ed1d129b2.zip opie-480284c491e26427c630131a25e56f9ed1d129b2.tar.gz opie-480284c491e26427c630131a25e56f9ed1d129b2.tar.bz2 |
- properly namespace the input methods. fixes symbols clashes at run-time
with names like 'Keyboard' or 'KeyboardConfig' . the qcom interface
objects are in an anonymous namespace now and the actual keyboard
implementations are in Dvorak, JumpX, etc. namespaces.
What's left is to solve the symbol clashes of the multiply compiled
pickboard classes. I'll leave that one (as part of the patch posted
yesterday) for another day for review. This part (namespacing) sounds like
a safe bet to me though, so comitting now. (got no comments anyway)
-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 |
4 files changed, 18 insertions, 5 deletions
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 | |||
@@ -24,32 +24,33 @@ | |||
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" ); |
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 | |||
@@ -12,32 +12,35 @@ | |||
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 |
@@ -172,17 +175,17 @@ private: | |||
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 | |||
@@ -10,33 +10,33 @@ | |||
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 | " .++++.++++++++++++++.++++. ", |
@@ -45,33 +45,33 @@ static const char * kb_xpm[] = { | |||
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 | ||
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 | |||
@@ -9,43 +9,52 @@ | |||
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 |