summaryrefslogtreecommitdiff
path: root/inputmethods/keyboard
authorsimon <simon>2002-11-22 10:56:30 (UTC)
committer simon <simon>2002-11-22 10:56:30 (UTC)
commit480284c491e26427c630131a25e56f9ed1d129b2 (patch) (unidiff)
tree3bdd60afe34e8c466fbea92dcf89fcab381b110d /inputmethods/keyboard
parent772c1321e4e95a415b9de700c3474f81f98b5482 (diff)
downloadopie-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)
Diffstat (limited to 'inputmethods/keyboard') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/keyboard/keyboard.cpp1
-rw-r--r--inputmethods/keyboard/keyboard.h5
-rw-r--r--inputmethods/keyboard/keyboardimpl.cpp8
-rw-r--r--inputmethods/keyboard/keyboardimpl.h13
4 files changed, 20 insertions, 7 deletions
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
@@ -27,12 +27,13 @@
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
33using namespace KeyboardInput;
33 34
34#define USE_SMALL_BACKSPACE 35#define USE_SMALL_BACKSPACE
35 36
36Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 37Keyboard::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),
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
@@ -20,12 +20,15 @@
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
24class QTimer; 24class QTimer;
25 25
26namespace KeyboardInput
27{
28
26class KeyboardConfig : public DictFilterConfig 29class KeyboardConfig : public DictFilterConfig
27{ 30{
28public: 31public:
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--; }
@@ -98,6 +101,8 @@ private:
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
@@ -20,13 +20,13 @@
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 */
26static const char * kb_xpm[] = { 26static 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" .......................... ",
@@ -42,13 +42,13 @@ static const char * kb_xpm[] = {
42" .++++.++++++++++++++.++++. ", 42" .++++.++++++++++++++.++++. ",
43" .+@@@.+@@@@@@@@@@@@@.+@@@. ", 43" .+@@@.+@@@@@@@@@@@@@.+@@@. ",
44" .......................... "}; 44" .......................... "};
45 45
46 46
47/* XPM */ 47/* XPM */
48static char * opti_xpm[] = { 48static 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" ......................... ",
@@ -62,14 +62,12 @@ static char * opti_xpm[] = {
62" .+@@.+@@.+@@.+@@.+@@.+@@. ", 62" .+@@.+@@.+@@.+@@.+@@.+@@. ",
63" ......................... ", 63" ......................... ",
64" .+++.+++.+++.+++.+++.+++. ", 64" .+++.+++.+++.+++.+++.+++. ",
65" .+@@.+@@.+@@.+@@.+@@.+@@. ", 65" .+@@.+@@.+@@.+@@.+@@.+@@. ",
66" ......................... "}; 66" ......................... "};
67 67
68
69
70KeyboardImpl::KeyboardImpl() 68KeyboardImpl::KeyboardImpl()
71 : input(0), icn(0), ref(0) 69 : input(0), icn(0), ref(0)
72{ 70{
73} 71}
74 72
75KeyboardImpl::~KeyboardImpl() 73KeyboardImpl::~KeyboardImpl()
@@ -78,13 +76,13 @@ KeyboardImpl::~KeyboardImpl()
78 delete icn; 76 delete icn;
79} 77}
80 78
81QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) 79QWidget *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
88void KeyboardImpl::resetState() 86void KeyboardImpl::resetState()
89{ 87{
90 if ( input ) 88 if ( input )
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
@@ -19,15 +19,22 @@
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
25class Keyboard; 25namespace KeyboardInput
26{
27 class Keyboard;
28}
29
26class QPixmap; 30class QPixmap;
27 31
32namespace
33{
34
28class KeyboardImpl : public InputMethodInterface 35class KeyboardImpl : public InputMethodInterface
29{ 36{
30public: 37public:
31 KeyboardImpl(); 38 KeyboardImpl();
32 virtual ~KeyboardImpl(); 39 virtual ~KeyboardImpl();
33 40
@@ -40,12 +47,14 @@ public:
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
45private: 52private:
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