author | mickeyl <mickeyl> | 2004-04-24 15:51:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-24 15:51:18 (UTC) |
commit | 629ced22fc26892442be433403a9cfa9f662f08a (patch) (unidiff) | |
tree | 830973cb7ba701b0a897220e1307ad3f1243384b | |
parent | f7b5905d990f374dd6cb177b7a03628cc593b7cf (diff) | |
download | opie-629ced22fc26892442be433403a9cfa9f662f08a.zip opie-629ced22fc26892442be433403a9cfa9f662f08a.tar.gz opie-629ced22fc26892442be433403a9cfa9f662f08a.tar.bz2 |
gcc 3.4 fixes
-rw-r--r-- | inputmethods/dasher/SettingsStore.cpp | 5 | ||||
-rw-r--r-- | inputmethods/dasher/SettingsStore.h | 1 | ||||
-rw-r--r-- | inputmethods/dvorak/dvorak.cpp | 8 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboard.cpp | 10 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 10 |
5 files changed, 20 insertions, 14 deletions
diff --git a/inputmethods/dasher/SettingsStore.cpp b/inputmethods/dasher/SettingsStore.cpp index f7661bd..7e0fa58 100644 --- a/inputmethods/dasher/SettingsStore.cpp +++ b/inputmethods/dasher/SettingsStore.cpp | |||
@@ -1,135 +1,140 @@ | |||
1 | // SettingsStore.cpp | 1 | // SettingsStore.cpp |
2 | // | 2 | // |
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 2002 Iain Murray | 5 | // Copyright (c) 2002 Iain Murray |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | #include "SettingsStore.h" | 12 | #include "SettingsStore.h" |
13 | 13 | ||
14 | using namespace std; | 14 | using namespace std; |
15 | 15 | ||
16 | /* TODO: Consider using Template functions to make this neater. */ | 16 | /* TODO: Consider using Template functions to make this neater. */ |
17 | 17 | ||
18 | 18 | ||
19 | CSettingsStore::~CSettingsStore() | ||
20 | { | ||
21 | } | ||
22 | |||
23 | |||
19 | bool CSettingsStore::GetBoolOption(const string& Key) | 24 | bool CSettingsStore::GetBoolOption(const string& Key) |
20 | { | 25 | { |
21 | if (BoolMap.find(Key)==BoolMap.end()) { | 26 | if (BoolMap.find(Key)==BoolMap.end()) { |
22 | bool Value = false; | 27 | bool Value = false; |
23 | LoadSetting(Key, &Value); | 28 | LoadSetting(Key, &Value); |
24 | BoolMap[Key] = Value; | 29 | BoolMap[Key] = Value; |
25 | } | 30 | } |
26 | 31 | ||
27 | return BoolMap[Key]; | 32 | return BoolMap[Key]; |
28 | } | 33 | } |
29 | 34 | ||
30 | 35 | ||
31 | long CSettingsStore::GetLongOption(const string& Key) | 36 | long CSettingsStore::GetLongOption(const string& Key) |
32 | { | 37 | { |
33 | if (LongMap.find(Key)==LongMap.end()) { | 38 | if (LongMap.find(Key)==LongMap.end()) { |
34 | long Value = 0l; | 39 | long Value = 0l; |
35 | LoadSetting(Key, &Value); | 40 | LoadSetting(Key, &Value); |
36 | LongMap[Key] = Value; | 41 | LongMap[Key] = Value; |
37 | } | 42 | } |
38 | 43 | ||
39 | return LongMap[Key]; | 44 | return LongMap[Key]; |
40 | } | 45 | } |
41 | 46 | ||
42 | 47 | ||
43 | string& CSettingsStore::GetStringOption(const string& Key) | 48 | string& CSettingsStore::GetStringOption(const string& Key) |
44 | { | 49 | { |
45 | if (StringMap.find(Key)==StringMap.end()) { | 50 | if (StringMap.find(Key)==StringMap.end()) { |
46 | string Value = ""; | 51 | string Value = ""; |
47 | LoadSetting(Key, &Value); | 52 | LoadSetting(Key, &Value); |
48 | StringMap[Key] = Value; | 53 | StringMap[Key] = Value; |
49 | } | 54 | } |
50 | 55 | ||
51 | return StringMap[Key]; | 56 | return StringMap[Key]; |
52 | } | 57 | } |
53 | 58 | ||
54 | 59 | ||
55 | void CSettingsStore::SetBoolOption(const string& Key, bool Value) | 60 | void CSettingsStore::SetBoolOption(const string& Key, bool Value) |
56 | { | 61 | { |
57 | BoolMap[Key] = Value; | 62 | BoolMap[Key] = Value; |
58 | SaveSetting(Key, Value); | 63 | SaveSetting(Key, Value); |
59 | } | 64 | } |
60 | 65 | ||
61 | 66 | ||
62 | void CSettingsStore::SetLongOption(const string& Key, long Value) | 67 | void CSettingsStore::SetLongOption(const string& Key, long Value) |
63 | { | 68 | { |
64 | LongMap[Key] = Value; | 69 | LongMap[Key] = Value; |
65 | SaveSetting(Key, Value); | 70 | SaveSetting(Key, Value); |
66 | } | 71 | } |
67 | 72 | ||
68 | 73 | ||
69 | void CSettingsStore::SetStringOption(const string& Key, const string& Value) | 74 | void CSettingsStore::SetStringOption(const string& Key, const string& Value) |
70 | { | 75 | { |
71 | StringMap[Key] = Value; | 76 | StringMap[Key] = Value; |
72 | SaveSetting(Key, Value); | 77 | SaveSetting(Key, Value); |
73 | } | 78 | } |
74 | 79 | ||
75 | 80 | ||
76 | void CSettingsStore::SetBoolDefault(const string& Key, bool Value) | 81 | void CSettingsStore::SetBoolDefault(const string& Key, bool Value) |
77 | { | 82 | { |
78 | bool TmpValue; | 83 | bool TmpValue; |
79 | if ( (BoolMap.find(Key)==BoolMap.end()) && (!LoadSetting(Key, &TmpValue)) ) | 84 | if ( (BoolMap.find(Key)==BoolMap.end()) && (!LoadSetting(Key, &TmpValue)) ) |
80 | SetBoolOption(Key, Value); | 85 | SetBoolOption(Key, Value); |
81 | } | 86 | } |
82 | 87 | ||
83 | 88 | ||
84 | void CSettingsStore::SetLongDefault(const string& Key, long Value) | 89 | void CSettingsStore::SetLongDefault(const string& Key, long Value) |
85 | { | 90 | { |
86 | long TmpValue; | 91 | long TmpValue; |
87 | if ( (LongMap.find(Key)==LongMap.end()) && (!LoadSetting(Key, &TmpValue)) ) | 92 | if ( (LongMap.find(Key)==LongMap.end()) && (!LoadSetting(Key, &TmpValue)) ) |
88 | SetLongOption(Key, Value); | 93 | SetLongOption(Key, Value); |
89 | } | 94 | } |
90 | 95 | ||
91 | 96 | ||
92 | void CSettingsStore::SetStringDefault(const string& Key, const string& Value) | 97 | void CSettingsStore::SetStringDefault(const string& Key, const string& Value) |
93 | { | 98 | { |
94 | string TmpValue; | 99 | string TmpValue; |
95 | if ( (StringMap.find(Key)==StringMap.end()) && (!LoadSetting(Key, &TmpValue)) ) | 100 | if ( (StringMap.find(Key)==StringMap.end()) && (!LoadSetting(Key, &TmpValue)) ) |
96 | SetStringOption(Key, Value); | 101 | SetStringOption(Key, Value); |
97 | } | 102 | } |
98 | 103 | ||
99 | 104 | ||
100 | /* Private functions -- Settings are not saved between sessions unless these | 105 | /* Private functions -- Settings are not saved between sessions unless these |
101 | functions are over-ridden. | 106 | functions are over-ridden. |
102 | --------------------------------------------------------------------------*/ | 107 | --------------------------------------------------------------------------*/ |
103 | 108 | ||
104 | 109 | ||
105 | bool CSettingsStore::LoadSetting(const string& , bool* ) | 110 | bool CSettingsStore::LoadSetting(const string& , bool* ) |
106 | { | 111 | { |
107 | return false; | 112 | return false; |
108 | } | 113 | } |
109 | 114 | ||
110 | 115 | ||
111 | bool CSettingsStore::LoadSetting(const string& , long* ) | 116 | bool CSettingsStore::LoadSetting(const string& , long* ) |
112 | { | 117 | { |
113 | return false; | 118 | return false; |
114 | } | 119 | } |
115 | 120 | ||
116 | 121 | ||
117 | bool CSettingsStore::LoadSetting(const string& , string* ) | 122 | bool CSettingsStore::LoadSetting(const string& , string* ) |
118 | { | 123 | { |
119 | return false; | 124 | return false; |
120 | } | 125 | } |
121 | 126 | ||
122 | 127 | ||
123 | void CSettingsStore::SaveSetting(const string& , bool ) | 128 | void CSettingsStore::SaveSetting(const string& , bool ) |
124 | { | 129 | { |
125 | } | 130 | } |
126 | 131 | ||
127 | 132 | ||
128 | void CSettingsStore::SaveSetting(const string& , long ) | 133 | void CSettingsStore::SaveSetting(const string& , long ) |
129 | { | 134 | { |
130 | } | 135 | } |
131 | 136 | ||
132 | 137 | ||
133 | void CSettingsStore::SaveSetting(const string& , const string& ) | 138 | void CSettingsStore::SaveSetting(const string& , const string& ) |
134 | { | 139 | { |
135 | } | 140 | } |
diff --git a/inputmethods/dasher/SettingsStore.h b/inputmethods/dasher/SettingsStore.h index 8ef9fcf..2ddf152 100644 --- a/inputmethods/dasher/SettingsStore.h +++ b/inputmethods/dasher/SettingsStore.h | |||
@@ -1,92 +1,93 @@ | |||
1 | // SettingsStore.h | 1 | // SettingsStore.h |
2 | // | 2 | // |
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 2002 Iain Murray | 5 | // Copyright (c) 2002 Iain Murray |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | #ifndef __SettingsStore_h__ | 11 | #ifndef __SettingsStore_h__ |
12 | #define __SettingsStore_h__ | 12 | #define __SettingsStore_h__ |
13 | 13 | ||
14 | 14 | ||
15 | #include "MSVC_Unannoy.h" | 15 | #include "MSVC_Unannoy.h" |
16 | #include <string> | 16 | #include <string> |
17 | #include <map> | 17 | #include <map> |
18 | 18 | ||
19 | 19 | ||
20 | /* | 20 | /* |
21 | The public interface uses UTF-8 strings. All Keys should be | 21 | The public interface uses UTF-8 strings. All Keys should be |
22 | in American English and encodable in ASCII. However, | 22 | in American English and encodable in ASCII. However, |
23 | string Values may contain special characters where appropriate. | 23 | string Values may contain special characters where appropriate. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | 26 | ||
27 | class CSettingsStore | 27 | class CSettingsStore |
28 | { | 28 | { |
29 | public: | 29 | public: |
30 | virtual ~CSettingsStore(); | ||
30 | bool GetBoolOption(const std::string& Key); | 31 | bool GetBoolOption(const std::string& Key); |
31 | long GetLongOption(const std::string& Key); | 32 | long GetLongOption(const std::string& Key); |
32 | std::string& GetStringOption(const std::string& Key); | 33 | std::string& GetStringOption(const std::string& Key); |
33 | 34 | ||
34 | void SetBoolOption(const std::string& Key, bool Value); | 35 | void SetBoolOption(const std::string& Key, bool Value); |
35 | void SetLongOption(const std::string& Key, long Value); | 36 | void SetLongOption(const std::string& Key, long Value); |
36 | void SetStringOption(const std::string& Key, const std::string& Value); | 37 | void SetStringOption(const std::string& Key, const std::string& Value); |
37 | 38 | ||
38 | void SetBoolDefault(const std::string& Key, bool Value); | 39 | void SetBoolDefault(const std::string& Key, bool Value); |
39 | void SetLongDefault(const std::string& Key, long Value); | 40 | void SetLongDefault(const std::string& Key, long Value); |
40 | void SetStringDefault(const std::string& Key, const std::string& Value); | 41 | void SetStringDefault(const std::string& Key, const std::string& Value); |
41 | private: | 42 | private: |
42 | // Platform Specific settings file management | 43 | // Platform Specific settings file management |
43 | 44 | ||
44 | // LoadSetting changes Value only if it succeeds in loading the setting, | 45 | // LoadSetting changes Value only if it succeeds in loading the setting, |
45 | // in which case it also returns true. Failure is indicated by returning false. | 46 | // in which case it also returns true. Failure is indicated by returning false. |
46 | //! Load a setting with a boolean value | 47 | //! Load a setting with a boolean value |
47 | // | 48 | // |
48 | //! Load a setting with a boolean value. Return true if successful | 49 | //! Load a setting with a boolean value. Return true if successful |
49 | //! \param Key Name of the setting | 50 | //! \param Key Name of the setting |
50 | //! \param Value Value of the setting | 51 | //! \param Value Value of the setting |
51 | virtual bool LoadSetting(const std::string& Key, bool* Value); | 52 | virtual bool LoadSetting(const std::string& Key, bool* Value); |
52 | 53 | ||
53 | //! Load a setting with a long value | 54 | //! Load a setting with a long value |
54 | // | 55 | // |
55 | //! Load a setting with a long value. Return true if successful | 56 | //! Load a setting with a long value. Return true if successful |
56 | //! \param Key Name of the setting | 57 | //! \param Key Name of the setting |
57 | //! \param Value Value of the setting | 58 | //! \param Value Value of the setting |
58 | virtual bool LoadSetting(const std::string& Key, long* Value); | 59 | virtual bool LoadSetting(const std::string& Key, long* Value); |
59 | 60 | ||
60 | //! Load a setting with a string value | 61 | //! Load a setting with a string value |
61 | // | 62 | // |
62 | //! Load a setting with a string value. Return true if successful | 63 | //! Load a setting with a string value. Return true if successful |
63 | //! \param Key Name of the setting | 64 | //! \param Key Name of the setting |
64 | //! \param Value Value of the setting, UTF8 encoded | 65 | //! \param Value Value of the setting, UTF8 encoded |
65 | virtual bool LoadSetting(const std::string& Key, std::string* Value); | 66 | virtual bool LoadSetting(const std::string& Key, std::string* Value); |
66 | 67 | ||
67 | //! Save a setting with a boolean value | 68 | //! Save a setting with a boolean value |
68 | // | 69 | // |
69 | //! \param Key Name of the setting | 70 | //! \param Key Name of the setting |
70 | //! \param Value Value of the setting | 71 | //! \param Value Value of the setting |
71 | virtual void SaveSetting(const std::string& Key, bool Value); | 72 | virtual void SaveSetting(const std::string& Key, bool Value); |
72 | 73 | ||
73 | //! Save a setting with a long value | 74 | //! Save a setting with a long value |
74 | // | 75 | // |
75 | //! \param Key Name of the setting | 76 | //! \param Key Name of the setting |
76 | //! \param Value Value of the setting | 77 | //! \param Value Value of the setting |
77 | virtual void SaveSetting(const std::string& Key, long Value); | 78 | virtual void SaveSetting(const std::string& Key, long Value); |
78 | 79 | ||
79 | //! Save a setting with a string value | 80 | //! Save a setting with a string value |
80 | // | 81 | // |
81 | //! \param Key Name of the setting | 82 | //! \param Key Name of the setting |
82 | //! \param Value Value of the setting, UTF8 encoded | 83 | //! \param Value Value of the setting, UTF8 encoded |
83 | virtual void SaveSetting(const std::string& Key, const std::string& Value); | 84 | virtual void SaveSetting(const std::string& Key, const std::string& Value); |
84 | 85 | ||
85 | // Used to store settings in memory | 86 | // Used to store settings in memory |
86 | std::map<std::string, bool> BoolMap; | 87 | std::map<std::string, bool> BoolMap; |
87 | std::map<std::string, long> LongMap; | 88 | std::map<std::string, long> LongMap; |
88 | std::map<std::string, std::string> StringMap; | 89 | std::map<std::string, std::string> StringMap; |
89 | }; | 90 | }; |
90 | 91 | ||
91 | 92 | ||
92 | #endif /* #ifndef __SettingsStore_h__ */ | 93 | #endif /* #ifndef __SettingsStore_h__ */ |
diff --git a/inputmethods/dvorak/dvorak.cpp b/inputmethods/dvorak/dvorak.cpp index 97afa0a..2137f22 100644 --- a/inputmethods/dvorak/dvorak.cpp +++ b/inputmethods/dvorak/dvorak.cpp | |||
@@ -1,228 +1,228 @@ | |||
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; | 34 | using namespace Dvorak; |
35 | 35 | ||
36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : | 36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : |
37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
39 | unicode(-1), qkeycode(0), modifiers(0) | 39 | unicode(-1), qkeycode(0), modifiers(0) |
40 | { | 40 | { |
41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
42 | // setFont( QFont( "Helvetica", 8 ) ); | 42 | // setFont( QFont( "Helvetica", 8 ) ); |
43 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 43 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
44 | setPalette(QPalette(QColor(220,220,220))); // Gray | 44 | setPalette(QPalette(QColor(220,220,220))); // Gray |
45 | 45 | ||
46 | picks = new KeyboardPicks( this ); | 46 | picks = new KeyboardPicks( this ); |
47 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 47 | picks->setFont( QFont( "smallsmooth", 9 ) ); |
48 | setFont( QFont( "smallsmooth", 9 ) ); | 48 | setFont( QFont( "smallsmooth", 9 ) ); |
49 | picks->initialise(); | 49 | picks->initialise(); |
50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
52 | 52 | ||
53 | repeatTimer = new QTimer( this ); | 53 | repeatTimer = new QTimer( this ); |
54 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 54 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
55 | } | 55 | } |
56 | 56 | ||
57 | void Keyboard::resizeEvent(QResizeEvent*) | 57 | void Keyboard::resizeEvent(QResizeEvent*) |
58 | { | 58 | { |
59 | int ph = picks->sizeHint().height(); | 59 | int ph = picks->sizeHint().height(); |
60 | picks->setGeometry( 0, 0, width(), ph ); | 60 | picks->setGeometry( 0, 0, width(), ph ); |
61 | keyHeight = (height()-ph)/5; | 61 | keyHeight = (height()-ph)/5; |
62 | int nk; | 62 | int nk; |
63 | if ( useOptiKeys ) { | 63 | if ( useOptiKeys ) { |
64 | nk = 15; | 64 | nk = 15; |
65 | } else if ( useLargeKeys ) { | 65 | } else if ( useLargeKeys ) { |
66 | nk = 15; | 66 | nk = 15; |
67 | } else { | 67 | } else { |
68 | nk = 19; | 68 | nk = 19; |
69 | } | 69 | } |
70 | defaultKeyWidth = width()/nk; | 70 | defaultKeyWidth = width()/nk; |
71 | xoffs = (width()-defaultKeyWidth*nk)/2; | 71 | xoffs = (width()-defaultKeyWidth*nk)/2; |
72 | } | 72 | } |
73 | 73 | ||
74 | void KeyboardPicks::initialise() | 74 | void KeyboardPicks::initialise() |
75 | { | 75 | { |
76 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 76 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
77 | mode = 0; | 77 | mode = 0; |
78 | dc = new KeyboardConfig(this); | 78 | dc = new KeyboardConfig(this); |
79 | configs.append(dc); | 79 | configs.append(dc); |
80 | } | 80 | } |
81 | 81 | ||
82 | QSize KeyboardPicks::sizeHint() const | 82 | QSize KeyboardPicks::sizeHint() const |
83 | { | 83 | { |
84 | return QSize(240,fontMetrics().lineSpacing()); | 84 | return QSize(240,fontMetrics().lineSpacing()); |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | void KeyboardConfig::generateText(const QString &s) | 88 | void KeyboardConfig::generateText(const QString &s) |
89 | { | 89 | { |
90 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 90 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
91 | for (int i=0; i<(int)backspaces; i++) { | 91 | for (int i=0; i<(int)backspaces; i++) { |
92 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 92 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
93 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 93 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
94 | } | 94 | } |
95 | for (int i=0; i<(int)s.length(); i++) { | 95 | for (int i=0; i<(int)s.length(); i++) { |
96 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 96 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
97 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 97 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
98 | } | 98 | } |
99 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 99 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
100 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 100 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
101 | backspaces = 0; | 101 | backspaces = 0; |
102 | #endif | 102 | #endif |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | //PC keyboard layout and scancodes | 106 | //PC keyboard layout and scancodes |
107 | 107 | ||
108 | /* | 108 | /* |
109 | Format: length, code, length, code, ..., 0 | 109 | Format: length, code, length, code, ..., 0 |
110 | 110 | ||
111 | length is measured in half the width of a standard key. | 111 | length is measured in half the width of a standard key. |
112 | If code < 0x80 we have length/2 consecutive standard keys, | 112 | If code < 0x80 we have length/2 consecutive standard keys, |
113 | starting with scancode code. | 113 | starting with scancode code. |
114 | 114 | ||
115 | 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 |
116 | 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 |
117 | up in specialM[]. (The special keys are not keymappable.) | 117 | up in specialM[]. (The special keys are not keymappable.) |
118 | 118 | ||
119 | */ | 119 | */ |
120 | 120 | ||
121 | static const uchar * const keyboard_opti[5] = { | 121 | static const uchar * const keyboard_opti[5] = { |
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", | 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", |
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", | 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", |
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", | 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", |
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", | 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", |
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" | 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" |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static const uchar * const keyboard_standard[5] = { | 129 | static const uchar * const keyboard_standard[5] = { |
130 | 130 | ||
131 | #ifdef USE_SMALL_BACKSPACE | 131 | #ifdef USE_SMALL_BACKSPACE |
132 | (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\002\200\002\223\002\215\002\216\002\217", | 132 | (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\002\200\002\223\002\215\002\216\002\217", |
133 | #else | 133 | #else |
134 | (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\004\200\002\223\002\215\002\216\002\217", | 134 | (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\004\200\002\223\002\215\002\216\002\217", |
135 | #endif | 135 | #endif |
136 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP | 136 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP |
137 | 137 | ||
138 | (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222", | 138 | (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222", |
139 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN | 139 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN |
140 | 140 | ||
141 | (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", | 141 | (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", |
142 | //CAPS + asdf.. + RETURN | 142 | //CAPS + asdf.. + RETURN |
143 | 143 | ||
144 | (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", | 144 | (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", |
145 | //SHIFT + zxcv... //+ UP | 145 | //SHIFT + zxcv... //+ UP |
146 | 146 | ||
147 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" | 147 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" |
148 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT | 148 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT |
149 | 149 | ||
150 | }; | 150 | }; |
151 | 151 | ||
152 | 152 | ||
153 | struct ShiftMap { | 153 | struct ShiftMap { |
154 | char normal; | 154 | char normal; |
155 | char shifted; | 155 | char shifted; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | 158 | ||
159 | static const ShiftMap shiftMap[] = { | 159 | static const ShiftMap shiftMap[] = { |
160 | { '`', '~' }, | 160 | { '`', '~' }, |
161 | { '1', '!' }, | 161 | { '1', '!' }, |
162 | { '2', '@' }, | 162 | { '2', '@' }, |
163 | { '3', '#' }, | 163 | { '3', '#' }, |
164 | { '4', '$' }, | 164 | { '4', '$' }, |
165 | { '5', '%' }, | 165 | { '5', '%' }, |
166 | { '6', '^' }, | 166 | { '6', '^' }, |
167 | { '7', '&' }, | 167 | { '7', '&' }, |
168 | { '8', '*' }, | 168 | { '8', '*' }, |
169 | { '9', '(' }, | 169 | { '9', '(' }, |
170 | { '0', ')' }, | 170 | { '0', ')' }, |
171 | { '-', '_' }, | 171 | { '-', '_' }, |
172 | { '=', '+' }, | 172 | { '=', '+' }, |
173 | { '\\', '|' }, | 173 | { '\\', '|' }, |
174 | { '[', '{' }, | 174 | { '[', '{' }, |
175 | { ']', '}' }, | 175 | { ']', '}' }, |
176 | { ';', ':' }, | 176 | { ';', ':' }, |
177 | { '\'', '"' }, | 177 | { '\'', '"' }, |
178 | { ',', '<' }, | 178 | { ',', '<' }, |
179 | { '.', '>' }, | 179 | { '.', '>' }, |
180 | { '/', '?' } | 180 | { '/', '?' } |
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
184 | /* XPM */ | 184 | /* XPM */ |
185 | static const char * const uparrow_xpm[]={ | 185 | static const char * const uparrow_xpm[]={ |
186 | "9 9 2 1", | 186 | "9 9 2 1", |
187 | "a c #000000", | 187 | "a c #000000", |
188 | ". c None", | 188 | ". c None", |
189 | ".........", | 189 | ".........", |
190 | "....a....", | 190 | "....a....", |
191 | "...aaa...", | 191 | "...aaa...", |
192 | "..aaaaa..", | 192 | "..aaaaa..", |
193 | "....a....", | 193 | "....a....", |
194 | "....a....", | 194 | "....a....", |
195 | "....a....", | 195 | "....a....", |
196 | "....a....", | 196 | "....a....", |
197 | "........."}; | 197 | "........."}; |
198 | /* XPM */ | 198 | /* XPM */ |
199 | static const char * const leftarrow_xpm[]={ | 199 | static const char * const leftarrow_xpm[]={ |
200 | "9 9 2 1", | 200 | "9 9 2 1", |
201 | "a c #000000", | 201 | "a c #000000", |
202 | ". c None", | 202 | ". c None", |
203 | ".........", | 203 | ".........", |
204 | ".........", | 204 | ".........", |
205 | "...a.....", | 205 | "...a.....", |
206 | "..aa.....", | 206 | "..aa.....", |
207 | ".aaaaaaa.", | 207 | ".aaaaaaa.", |
208 | "..aa.....", | 208 | "..aa.....", |
209 | "...a.....", | 209 | "...a.....", |
210 | ".........", | 210 | ".........", |
211 | "........."}; | 211 | "........."}; |
212 | /* XPM */ | 212 | /* XPM */ |
213 | static const char * const downarrow_xpm[]={ | 213 | static const char * const downarrow_xpm[]={ |
214 | "9 9 2 1", | 214 | "9 9 2 1", |
215 | "a c #000000", | 215 | "a c #000000", |
216 | ". c None", | 216 | ". c None", |
217 | ".........", | 217 | ".........", |
218 | "....a....", | 218 | "....a....", |
219 | "....a....", | 219 | "....a....", |
220 | "....a....", | 220 | "....a....", |
221 | "....a....", | 221 | "....a....", |
222 | "..aaaaa..", | 222 | "..aaaaa..", |
223 | "...aaa...", | 223 | "...aaa...", |
224 | "....a....", | 224 | "....a....", |
225 | "........."}; | 225 | "........."}; |
226 | /* XPM */ | 226 | /* XPM */ |
227 | static const char * const rightarrow_xpm[]={ | 227 | static const char * const rightarrow_xpm[]={ |
228 | "9 9 2 1", | 228 | "9 9 2 1", |
diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp index a85a7b1..fb88f2a 100644 --- a/inputmethods/keyboard/keyboard.cpp +++ b/inputmethods/keyboard/keyboard.cpp | |||
@@ -1,241 +1,241 @@ | |||
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 | using namespace KeyboardInput; |
34 | 34 | ||
35 | #define USE_SMALL_BACKSPACE | 35 | #define USE_SMALL_BACKSPACE |
36 | 36 | ||
37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
40 | unicode(-1), qkeycode(0), modifiers(0) | 40 | unicode(-1), qkeycode(0), modifiers(0) |
41 | { | 41 | { |
42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
43 | // setFont( QFont( "Helvetica", 8 ) ); | 43 | // setFont( QFont( "Helvetica", 8 ) ); |
44 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 44 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
45 | setPalette(QPalette(QColor(220,220,220))); // Gray | 45 | setPalette(QPalette(QColor(220,220,220))); // Gray |
46 | 46 | ||
47 | picks = new KeyboardPicks( this ); | 47 | picks = new KeyboardPicks( this ); |
48 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 48 | picks->setFont( QFont( "smallsmooth", 9 ) ); |
49 | setFont( QFont( "smallsmooth", 9 ) ); | 49 | setFont( QFont( "smallsmooth", 9 ) ); |
50 | picks->initialise(); | 50 | picks->initialise(); |
51 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 51 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
52 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 52 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
53 | 53 | ||
54 | repeatTimer = new QTimer( this ); | 54 | repeatTimer = new QTimer( this ); |
55 | 55 | ||
56 | // temporary quick and dirty fix for the "sticky keyboard bug" | 56 | // temporary quick and dirty fix for the "sticky keyboard bug" |
57 | // on ipaq. | 57 | // on ipaq. |
58 | // struct utsname name; | 58 | // struct utsname name; |
59 | // if (uname(&name) != -1) | 59 | // if (uname(&name) != -1) |
60 | // { | 60 | // { |
61 | //QString release=name.release; | 61 | //QString release=name.release; |
62 | //qWarning("System release: %s\n", name.release); | 62 | //qWarning("System release: %s\n", name.release); |
63 | //if(release.find("embedix",0,TRUE) !=-1) | 63 | //if(release.find("embedix",0,TRUE) !=-1) |
64 | // { | 64 | // { |
65 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 65 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
66 | // } | 66 | // } |
67 | // } | 67 | // } |
68 | } | 68 | } |
69 | 69 | ||
70 | void Keyboard::resizeEvent(QResizeEvent*) | 70 | void Keyboard::resizeEvent(QResizeEvent*) |
71 | { | 71 | { |
72 | int ph = picks->sizeHint().height(); | 72 | int ph = picks->sizeHint().height(); |
73 | picks->setGeometry( 0, 0, width(), ph ); | 73 | picks->setGeometry( 0, 0, width(), ph ); |
74 | keyHeight = (height()-ph)/5; | 74 | keyHeight = (height()-ph)/5; |
75 | int nk; | 75 | int nk; |
76 | if ( useOptiKeys ) { | 76 | if ( useOptiKeys ) { |
77 | nk = 15; | 77 | nk = 15; |
78 | } else if ( useLargeKeys ) { | 78 | } else if ( useLargeKeys ) { |
79 | nk = 15; | 79 | nk = 15; |
80 | } else { | 80 | } else { |
81 | nk = 19; | 81 | nk = 19; |
82 | } | 82 | } |
83 | defaultKeyWidth = width()/nk; | 83 | defaultKeyWidth = width()/nk; |
84 | xoffs = (width()-defaultKeyWidth*nk)/2; | 84 | xoffs = (width()-defaultKeyWidth*nk)/2; |
85 | } | 85 | } |
86 | 86 | ||
87 | void KeyboardPicks::initialise() | 87 | void KeyboardPicks::initialise() |
88 | { | 88 | { |
89 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 89 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
90 | mode = 0; | 90 | mode = 0; |
91 | dc = new KeyboardConfig(this); | 91 | dc = new KeyboardConfig(this); |
92 | configs.append(dc); | 92 | configs.append(dc); |
93 | } | 93 | } |
94 | 94 | ||
95 | QSize KeyboardPicks::sizeHint() const | 95 | QSize KeyboardPicks::sizeHint() const |
96 | { | 96 | { |
97 | return QSize(240,fontMetrics().lineSpacing()); | 97 | return QSize(240,fontMetrics().lineSpacing()); |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | void KeyboardConfig::generateText(const QString &s) | 101 | void KeyboardConfig::generateText(const QString &s) |
102 | { | 102 | { |
103 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 103 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
104 | for (int i=0; i<(int)backspaces; i++) { | 104 | for (int i=0; i<(int)backspaces; i++) { |
105 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 105 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
106 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 106 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
107 | } | 107 | } |
108 | for (int i=0; i<(int)s.length(); i++) { | 108 | for (int i=0; i<(int)s.length(); i++) { |
109 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 109 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
110 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 110 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
111 | } | 111 | } |
112 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 112 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
113 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 113 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
114 | backspaces = 0; | 114 | backspaces = 0; |
115 | #endif | 115 | #endif |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | //PC keyboard layout and scancodes | 119 | //PC keyboard layout and scancodes |
120 | 120 | ||
121 | /* | 121 | /* |
122 | Format: length, code, length, code, ..., 0 | 122 | Format: length, code, length, code, ..., 0 |
123 | 123 | ||
124 | length is measured in half the width of a standard key. | 124 | length is measured in half the width of a standard key. |
125 | If code < 0x80 we have length/2 consecutive standard keys, | 125 | If code < 0x80 we have length/2 consecutive standard keys, |
126 | starting with scancode code. | 126 | starting with scancode code. |
127 | 127 | ||
128 | 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 |
129 | 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 |
130 | up in specialM[]. (The special keys are not keymappable.) | 130 | up in specialM[]. (The special keys are not keymappable.) |
131 | 131 | ||
132 | */ | 132 | */ |
133 | 133 | ||
134 | static const uchar * const keyboard_opti[5] = { | 134 | static const uchar * const keyboard_opti[5] = { |
135 | (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", | 135 | (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", |
136 | (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", | 136 | (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", |
137 | (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", | 137 | (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", |
138 | (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", | 138 | (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", |
139 | (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" | 139 | (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" |
140 | }; | 140 | }; |
141 | 141 | ||
142 | 142 | ||
143 | static const uchar * const keyboard_standard[5] = { | 143 | static const uchar * const keyboard_standard[5] = { |
144 | 144 | ||
145 | #ifdef USE_SMALL_BACKSPACE | 145 | #ifdef USE_SMALL_BACKSPACE |
146 | (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217", | 146 | (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217", |
147 | #else | 147 | #else |
148 | (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217", | 148 | (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217", |
149 | #endif | 149 | #endif |
150 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP | 150 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP |
151 | 151 | ||
152 | (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222", | 152 | (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222", |
153 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN | 153 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN |
154 | 154 | ||
155 | (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", | 155 | (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", |
156 | //CAPS + asdf.. + RETURN | 156 | //CAPS + asdf.. + RETURN |
157 | 157 | ||
158 | (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", | 158 | (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", |
159 | //SHIFT + zxcv... //+ UP | 159 | //SHIFT + zxcv... //+ UP |
160 | 160 | ||
161 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" | 161 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" |
162 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT | 162 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT |
163 | 163 | ||
164 | }; | 164 | }; |
165 | 165 | ||
166 | 166 | ||
167 | struct ShiftMap { | 167 | struct ShiftMap { |
168 | char normal; | 168 | char normal; |
169 | char shifted; | 169 | char shifted; |
170 | }; | 170 | }; |
171 | 171 | ||
172 | 172 | ||
173 | static const ShiftMap shiftMap[] = { | 173 | static const ShiftMap shiftMap[] = { |
174 | { '`', '~' }, | 174 | { '`', '~' }, |
175 | { '1', '!' }, | 175 | { '1', '!' }, |
176 | { '2', '@' }, | 176 | { '2', '@' }, |
177 | { '3', '#' }, | 177 | { '3', '#' }, |
178 | { '4', '$' }, | 178 | { '4', '$' }, |
179 | { '5', '%' }, | 179 | { '5', '%' }, |
180 | { '6', '^' }, | 180 | { '6', '^' }, |
181 | { '7', '&' }, | 181 | { '7', '&' }, |
182 | { '8', '*' }, | 182 | { '8', '*' }, |
183 | { '9', '(' }, | 183 | { '9', '(' }, |
184 | { '0', ')' }, | 184 | { '0', ')' }, |
185 | { '-', '_' }, | 185 | { '-', '_' }, |
186 | { '=', '+' }, | 186 | { '=', '+' }, |
187 | { '\\', '|' }, | 187 | { '\\', '|' }, |
188 | { '[', '{' }, | 188 | { '[', '{' }, |
189 | { ']', '}' }, | 189 | { ']', '}' }, |
190 | { ';', ':' }, | 190 | { ';', ':' }, |
191 | { '\'', '"' }, | 191 | { '\'', '"' }, |
192 | { ',', '<' }, | 192 | { ',', '<' }, |
193 | { '.', '>' }, | 193 | { '.', '>' }, |
194 | { '/', '?' } | 194 | { '/', '?' } |
195 | }; | 195 | }; |
196 | 196 | ||
197 | 197 | ||
198 | /* XPM */ | 198 | /* XPM */ |
199 | static const char * const uparrow_xpm[]={ | 199 | static const char * const uparrow_xpm[]={ |
200 | "9 9 2 1", | 200 | "9 9 2 1", |
201 | "a c #000000", | 201 | "a c #000000", |
202 | ". c None", | 202 | ". c None", |
203 | ".........", | 203 | ".........", |
204 | "....a....", | 204 | "....a....", |
205 | "...aaa...", | 205 | "...aaa...", |
206 | "..aaaaa..", | 206 | "..aaaaa..", |
207 | "....a....", | 207 | "....a....", |
208 | "....a....", | 208 | "....a....", |
209 | "....a....", | 209 | "....a....", |
210 | "....a....", | 210 | "....a....", |
211 | "........."}; | 211 | "........."}; |
212 | /* XPM */ | 212 | /* XPM */ |
213 | static const char * const leftarrow_xpm[]={ | 213 | static const char * const leftarrow_xpm[]={ |
214 | "9 9 2 1", | 214 | "9 9 2 1", |
215 | "a c #000000", | 215 | "a c #000000", |
216 | ". c None", | 216 | ". c None", |
217 | ".........", | 217 | ".........", |
218 | ".........", | 218 | ".........", |
219 | "...a.....", | 219 | "...a.....", |
220 | "..aa.....", | 220 | "..aa.....", |
221 | ".aaaaaaa.", | 221 | ".aaaaaaa.", |
222 | "..aa.....", | 222 | "..aa.....", |
223 | "...a.....", | 223 | "...a.....", |
224 | ".........", | 224 | ".........", |
225 | "........."}; | 225 | "........."}; |
226 | /* XPM */ | 226 | /* XPM */ |
227 | static const char * const downarrow_xpm[]={ | 227 | static const char * const downarrow_xpm[]={ |
228 | "9 9 2 1", | 228 | "9 9 2 1", |
229 | "a c #000000", | 229 | "a c #000000", |
230 | ". c None", | 230 | ". c None", |
231 | ".........", | 231 | ".........", |
232 | "....a....", | 232 | "....a....", |
233 | "....a....", | 233 | "....a....", |
234 | "....a....", | 234 | "....a....", |
235 | "....a....", | 235 | "....a....", |
236 | "..aaaaa..", | 236 | "..aaaaa..", |
237 | "...aaa...", | 237 | "...aaa...", |
238 | "....a....", | 238 | "....a....", |
239 | "........."}; | 239 | "........."}; |
240 | /* XPM */ | 240 | /* XPM */ |
241 | static const char * const rightarrow_xpm[]={ | 241 | static const char * const rightarrow_xpm[]={ |
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 4f4f25f..7ddfd3e 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -18,269 +18,269 @@ | |||
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 <qdir.h> | 34 | #include <qdir.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 | using namespace MultiKey; |
41 | 41 | ||
42 | static const char * const kb_config_xpm[] = { | 42 | static const char * const kb_config_xpm[] = { |
43 | "13 7 2 1", | 43 | "13 7 2 1", |
44 | " c None", | 44 | " c None", |
45 | ". c #000000", | 45 | ". c #000000", |
46 | " ", | 46 | " ", |
47 | " . ", | 47 | " . ", |
48 | " ... ", | 48 | " ... ", |
49 | " ..... ", | 49 | " ..... ", |
50 | " . ", | 50 | " . ", |
51 | " . ", | 51 | " . ", |
52 | " "}; | 52 | " "}; |
53 | 53 | ||
54 | /* Keyboard::Keyboard {{{1 */ | 54 | /* Keyboard::Keyboard {{{1 */ |
55 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 55 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
56 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), | 56 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), |
57 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), | 57 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), |
58 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), | 58 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), |
59 | pressedKeyRow(-1), pressedKeyCol(-1), | 59 | pressedKeyRow(-1), pressedKeyCol(-1), |
60 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 60 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
61 | configdlg(0) | 61 | configdlg(0) |
62 | 62 | ||
63 | { | 63 | { |
64 | 64 | ||
65 | // get the default font | 65 | // get the default font |
66 | Config *config = new Config( "qpe" ); | 66 | Config *config = new Config( "qpe" ); |
67 | config->setGroup( "Appearance" ); | 67 | config->setGroup( "Appearance" ); |
68 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | 68 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); |
69 | delete config; | 69 | delete config; |
70 | 70 | ||
71 | config = new Config("multikey"); | 71 | config = new Config("multikey"); |
72 | config->setGroup ("general"); | 72 | config->setGroup ("general"); |
73 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed | 73 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed |
74 | useRepeat = config->readBoolEntry ("useRepeat", 1); | 74 | useRepeat = config->readBoolEntry ("useRepeat", 1); |
75 | delete config; | 75 | delete config; |
76 | 76 | ||
77 | 77 | ||
78 | setFont( QFont( familyStr, 10 ) ); | 78 | setFont( QFont( familyStr, 10 ) ); |
79 | 79 | ||
80 | picks = new KeyboardPicks( this ); | 80 | picks = new KeyboardPicks( this ); |
81 | picks->setFont( QFont( familyStr, 10 ) ); | 81 | picks->setFont( QFont( familyStr, 10 ) ); |
82 | picks->initialise(); | 82 | picks->initialise(); |
83 | if (usePicks) { | 83 | if (usePicks) { |
84 | 84 | ||
85 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 85 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
86 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 86 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
87 | 87 | ||
88 | } else picks->hide(); | 88 | } else picks->hide(); |
89 | 89 | ||
90 | loadKeyboardColors(); | 90 | loadKeyboardColors(); |
91 | 91 | ||
92 | keys = new Keys(); | 92 | keys = new Keys(); |
93 | 93 | ||
94 | repeatTimer = new QTimer( this ); | 94 | repeatTimer = new QTimer( this ); |
95 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 95 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
96 | 96 | ||
97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); | 97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); |
98 | connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 98 | connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(receive(const QCString&,const QByteArray&))); | 99 | this, SLOT(receive(const QCString&,const QByteArray&))); |
100 | } | 100 | } |
101 | 101 | ||
102 | Keyboard::~Keyboard() { | 102 | Keyboard::~Keyboard() { |
103 | 103 | ||
104 | if ( configdlg ) { | 104 | if ( configdlg ) { |
105 | delete configdlg; | 105 | delete configdlg; |
106 | configdlg = 0; | 106 | configdlg = 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | /* Keyboard::resizeEvent {{{1 */ | 111 | /* Keyboard::resizeEvent {{{1 */ |
112 | void Keyboard::resizeEvent(QResizeEvent*) | 112 | void Keyboard::resizeEvent(QResizeEvent*) |
113 | { | 113 | { |
114 | int ph = picks->sizeHint().height(); | 114 | int ph = picks->sizeHint().height(); |
115 | picks->setGeometry( 0, 0, width(), ph ); | 115 | picks->setGeometry( 0, 0, width(), ph ); |
116 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); | 116 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); |
117 | 117 | ||
118 | int nk; // number of keys? | 118 | int nk; // number of keys? |
119 | if ( useLargeKeys ) { | 119 | if ( useLargeKeys ) { |
120 | nk = 15; | 120 | nk = 15; |
121 | } else { | 121 | } else { |
122 | nk = 19; | 122 | nk = 19; |
123 | } | 123 | } |
124 | defaultKeyWidth = (width()/nk)/2; | 124 | defaultKeyWidth = (width()/nk)/2; |
125 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? | 125 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | /* KeyboardPicks::initialize {{{1 */ | 129 | /* KeyboardPicks::initialize {{{1 */ |
130 | void KeyboardPicks::initialise() | 130 | void KeyboardPicks::initialise() |
131 | { | 131 | { |
132 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 132 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
133 | mode = 0; | 133 | mode = 0; |
134 | dc = new KeyboardConfig(this); | 134 | dc = new KeyboardConfig(this); |
135 | configs.append(dc); | 135 | configs.append(dc); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* KeyboardPicks::sizeHint {{{1 */ | 138 | /* KeyboardPicks::sizeHint {{{1 */ |
139 | QSize KeyboardPicks::sizeHint() const | 139 | QSize KeyboardPicks::sizeHint() const |
140 | { | 140 | { |
141 | return QSize(240,fontMetrics().lineSpacing()); | 141 | return QSize(240,fontMetrics().lineSpacing()); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | /* KeyboardConfig::generateText {{{1 */ | 145 | /* KeyboardConfig::generateText {{{1 */ |
146 | void KeyboardConfig::generateText(const QString &s) | 146 | void KeyboardConfig::generateText(const QString &s) |
147 | { | 147 | { |
148 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 148 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
149 | for (int i=0; i<(int)backspaces; i++) { | 149 | for (int i=0; i<(int)backspaces; i++) { |
150 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 150 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
151 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 151 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
152 | } | 152 | } |
153 | for (int i=0; i<(int)s.length(); i++) { | 153 | for (int i=0; i<(int)s.length(); i++) { |
154 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 154 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
155 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 155 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
156 | } | 156 | } |
157 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 157 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
158 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 158 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
159 | backspaces = 0; | 159 | backspaces = 0; |
160 | #endif | 160 | #endif |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | /* Keyboard::paintEvent {{{1 */ | 166 | /* Keyboard::paintEvent {{{1 */ |
167 | void Keyboard::paintEvent(QPaintEvent* e) | 167 | void Keyboard::paintEvent(QPaintEvent* e) |
168 | { | 168 | { |
169 | QPainter painter(this); | 169 | QPainter painter(this); |
170 | painter.setClipRect(e->rect()); | 170 | painter.setClipRect(e->rect()); |
171 | drawKeyboard( painter ); | 171 | drawKeyboard( painter ); |
172 | picks->dc->draw( &painter ); | 172 | picks->dc->draw( &painter ); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
176 | /* Keyboard::drawKeyboard {{{1 */ | 176 | /* Keyboard::drawKeyboard {{{1 */ |
177 | 177 | ||
178 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) | 178 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) |
179 | { | 179 | { |
180 | 180 | ||
181 | 181 | ||
182 | if (row != -1 && col != -1) { //just redraw one key | 182 | if (row != -1 && col != -1) { //just redraw one key |
183 | 183 | ||
184 | int x = 0; | 184 | int x = 0; |
185 | for (int i = 0; i < col; i++) { | 185 | for (int i = 0; i < col; i++) { |
186 | 186 | ||
187 | x += keys->width(row, i) * defaultKeyWidth; | 187 | x += keys->width(row, i) * defaultKeyWidth; |
188 | } | 188 | } |
189 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 189 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
190 | 190 | ||
191 | int keyWidth = keys->width(row, col); | 191 | int keyWidth = keys->width(row, col); |
192 | 192 | ||
193 | p.fillRect(x + 1, y + 1, | 193 | p.fillRect(x + 1, y + 1, |
194 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, | 194 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, |
195 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); | 195 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); |
196 | 196 | ||
197 | QImage *pix = keys->pix(row,col); | 197 | QImage *pix = keys->pix(row,col); |
198 | 198 | ||
199 | ushort c = keys->uni(row, col); | 199 | ushort c = keys->uni(row, col); |
200 | 200 | ||
201 | p.setPen(textcolor); | 201 | p.setPen(textcolor); |
202 | if (!pix) { | 202 | if (!pix) { |
203 | if ((shift || lock) && keys->shift(c)) | 203 | if ((shift || lock) && keys->shift(c)) |
204 | 204 | ||
205 | if (circumflex && keys->circumflex(keys->shift(c))) | 205 | if (circumflex && keys->circumflex(keys->shift(c))) |
206 | c = keys->circumflex(keys->shift(c)); | 206 | c = keys->circumflex(keys->shift(c)); |
207 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | 207 | else if (diaeresis && keys->diaeresis(keys->shift(c))) |
208 | c = keys->diaeresis(keys->shift(c)); | 208 | c = keys->diaeresis(keys->shift(c)); |
209 | else if (baccent && keys->baccent(keys->shift(c))) | 209 | else if (baccent && keys->baccent(keys->shift(c))) |
210 | c = keys->baccent(keys->shift(c)); | 210 | c = keys->baccent(keys->shift(c)); |
211 | else if (accent && keys->accent(keys->shift(c))) | 211 | else if (accent && keys->accent(keys->shift(c))) |
212 | c = keys->accent(keys->shift(c)); | 212 | c = keys->accent(keys->shift(c)); |
213 | else if (meta && keys->meta(keys->shift(c))) | 213 | else if (meta && keys->meta(keys->shift(c))) |
214 | c = keys->meta(keys->shift(c)); | 214 | c = keys->meta(keys->shift(c)); |
215 | else | 215 | else |
216 | c = keys->shift(c); | 216 | c = keys->shift(c); |
217 | 217 | ||
218 | else if (meta && keys->meta(c)) | 218 | else if (meta && keys->meta(c)) |
219 | c = keys->meta(c); | 219 | c = keys->meta(c); |
220 | else if (circumflex && keys->circumflex(c)) | 220 | else if (circumflex && keys->circumflex(c)) |
221 | c = keys->circumflex(c); | 221 | c = keys->circumflex(c); |
222 | else if (baccent && keys->baccent(c)) | 222 | else if (baccent && keys->baccent(c)) |
223 | c = keys->baccent(c); | 223 | c = keys->baccent(c); |
224 | else if (accent && keys->accent(c)) | 224 | else if (accent && keys->accent(c)) |
225 | c = keys->accent(c); | 225 | c = keys->accent(c); |
226 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | 226 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { |
227 | 227 | ||
228 | // the diaeresis key itself has to be in the diaeresisMap, | 228 | // the diaeresis key itself has to be in the diaeresisMap, |
229 | // or just do this to make it display the diaeresis char. | 229 | // or just do this to make it display the diaeresis char. |
230 | 230 | ||
231 | if (c == 0x2c6) | 231 | if (c == 0x2c6) |
232 | c = 0xa8; | 232 | c = 0xa8; |
233 | else | 233 | else |
234 | c = keys->diaeresis(c); | 234 | c = keys->diaeresis(c); |
235 | } | 235 | } |
236 | 236 | ||
237 | p.drawText(x, y, | 237 | p.drawText(x, y, |
238 | defaultKeyWidth * keyWidth + 3, keyHeight, | 238 | defaultKeyWidth * keyWidth + 3, keyHeight, |
239 | AlignCenter, (QChar)c); | 239 | AlignCenter, (QChar)c); |
240 | } | 240 | } |
241 | else | 241 | else |
242 | // center the image in the middle of the key | 242 | // center the image in the middle of the key |
243 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, | 243 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, |
244 | y + (keyHeight - pix->height())/2 + 1, | 244 | y + (keyHeight - pix->height())/2 + 1, |
245 | *pix ); | 245 | *pix ); |
246 | 246 | ||
247 | // this fixes the problem that the very right end of the board's vertical line | 247 | // this fixes the problem that the very right end of the board's vertical line |
248 | // gets painted over, because it's one pixel shorter than all other keys | 248 | // gets painted over, because it's one pixel shorter than all other keys |
249 | p.setPen(keycolor_lines); | 249 | p.setPen(keycolor_lines); |
250 | p.drawLine(width() - 1, 0, width() - 1, height()); | 250 | p.drawLine(width() - 1, 0, width() - 1, height()); |
251 | 251 | ||
252 | } else { | 252 | } else { |
253 | 253 | ||
254 | 254 | ||
255 | p.fillRect(0, 0, width(), height(), keycolor); | 255 | p.fillRect(0, 0, width(), height(), keycolor); |
256 | 256 | ||
257 | for (row = 1; row <= keys->rows(); row++) { | 257 | for (row = 1; row <= keys->rows(); row++) { |
258 | 258 | ||
259 | int x = 0; | 259 | int x = 0; |
260 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 260 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
261 | 261 | ||
262 | p.setPen(keycolor_lines); | 262 | p.setPen(keycolor_lines); |
263 | p.drawLine(x, y, x + width(), y); | 263 | p.drawLine(x, y, x + width(), y); |
264 | 264 | ||
265 | for (int col = 0; col < keys->numKeys(row); col++) { | 265 | for (int col = 0; col < keys->numKeys(row); col++) { |
266 | 266 | ||
267 | QImage *pix = keys->pix(row, col); | 267 | QImage *pix = keys->pix(row, col); |
268 | int keyWidth = keys->width(row, col); | 268 | int keyWidth = keys->width(row, col); |
269 | 269 | ||
270 | 270 | ||
271 | int keyWidthPix = defaultKeyWidth * keyWidth; | 271 | int keyWidthPix = defaultKeyWidth * keyWidth; |
272 | 272 | ||
273 | if (keys->pressed(row, col)) | 273 | if (keys->pressed(row, col)) |
274 | p.fillRect(x+1, y+1, keyWidthPix - 1, | 274 | p.fillRect(x+1, y+1, keyWidthPix - 1, |
275 | keyHeight - 1, keycolor_pressed); | 275 | keyHeight - 1, keycolor_pressed); |
276 | 276 | ||
277 | ushort c = keys->uni(row, col); | 277 | ushort c = keys->uni(row, col); |
278 | 278 | ||
279 | p.setPen(textcolor); | 279 | p.setPen(textcolor); |
280 | if (!pix) { | 280 | if (!pix) { |
281 | if ((shift || lock) && keys->shift(c)) | 281 | if ((shift || lock) && keys->shift(c)) |
282 | 282 | ||
283 | if (circumflex && keys->circumflex(keys->shift(c))) | 283 | if (circumflex && keys->circumflex(keys->shift(c))) |
284 | c = keys->circumflex(keys->shift(c)); | 284 | c = keys->circumflex(keys->shift(c)); |
285 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | 285 | else if (diaeresis && keys->diaeresis(keys->shift(c))) |
286 | c = keys->diaeresis(keys->shift(c)); | 286 | c = keys->diaeresis(keys->shift(c)); |