summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/dasher/SettingsStore.cpp5
-rw-r--r--inputmethods/dasher/SettingsStore.h1
-rw-r--r--inputmethods/dvorak/dvorak.cpp8
-rw-r--r--inputmethods/keyboard/keyboard.cpp8
-rw-r--r--inputmethods/multikey/keyboard.cpp8
5 files changed, 18 insertions, 12 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,114 +1,119 @@
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
14using namespace std; 14using 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
19CSettingsStore::~CSettingsStore()
20{
21}
22
23
19bool CSettingsStore::GetBoolOption(const string& Key) 24bool 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
31long CSettingsStore::GetLongOption(const string& Key) 36long 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
43string& CSettingsStore::GetStringOption(const string& Key) 48string& 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
55void CSettingsStore::SetBoolOption(const string& Key, bool Value) 60void 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
62void CSettingsStore::SetLongOption(const string& Key, long Value) 67void 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
69void CSettingsStore::SetStringOption(const string& Key, const string& Value) 74void 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
76void CSettingsStore::SetBoolDefault(const string& Key, bool Value) 81void 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
84void CSettingsStore::SetLongDefault(const string& Key, long Value) 89void 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
92void CSettingsStore::SetStringDefault(const string& Key, const string& Value) 97void 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
101functions are over-ridden. 106functions are over-ridden.
102--------------------------------------------------------------------------*/ 107--------------------------------------------------------------------------*/
103 108
104 109
105bool CSettingsStore::LoadSetting(const string& , bool* ) 110bool CSettingsStore::LoadSetting(const string& , bool* )
106{ 111{
107 return false; 112 return false;
108} 113}
109 114
110 115
111bool CSettingsStore::LoadSetting(const string& , long* ) 116bool CSettingsStore::LoadSetting(const string& , long* )
112{ 117{
113 return false; 118 return false;
114} 119}
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
27class CSettingsStore 27class CSettingsStore
28{ 28{
29public: 29public:
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);
41private: 42private:
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,196 +1,196 @@
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
34using namespace Dvorak; 34using namespace Dvorak;
35 35
36Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : 36Keyboard::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
57void Keyboard::resizeEvent(QResizeEvent*) 57void 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
74void KeyboardPicks::initialise() 74void 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
82QSize KeyboardPicks::sizeHint() const 82QSize KeyboardPicks::sizeHint() const
83{ 83{
84 return QSize(240,fontMetrics().lineSpacing()); 84 return QSize(240,fontMetrics().lineSpacing());
85} 85}
86 86
87 87
88void KeyboardConfig::generateText(const QString &s) 88void 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
121static const uchar * const keyboard_opti[5] = { 121static 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
129static const uchar * const keyboard_standard[5] = { 129static 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
153struct ShiftMap { 153struct ShiftMap {
154 char normal; 154 char normal;
155 char shifted; 155 char shifted;
156}; 156};
157 157
158 158
159static const ShiftMap shiftMap[] = { 159static 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 */
185static const char * const uparrow_xpm[]={ 185static 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....",
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
@@ -9,201 +9,201 @@
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
33using namespace KeyboardInput; 33using namespace KeyboardInput;
34 34
35#define USE_SMALL_BACKSPACE 35#define USE_SMALL_BACKSPACE
36 36
37Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 37Keyboard::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
70void Keyboard::resizeEvent(QResizeEvent*) 70void 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
87void KeyboardPicks::initialise() 87void 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
95QSize KeyboardPicks::sizeHint() const 95QSize KeyboardPicks::sizeHint() const
96{ 96{
97 return QSize(240,fontMetrics().lineSpacing()); 97 return QSize(240,fontMetrics().lineSpacing());
98} 98}
99 99
100 100
101void KeyboardConfig::generateText(const QString &s) 101void 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
134static const uchar * const keyboard_opti[5] = { 134static 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
143static const uchar * const keyboard_standard[5] = { 143static 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
167struct ShiftMap { 167struct ShiftMap {
168 char normal; 168 char normal;
169 char shifted; 169 char shifted;
170}; 170};
171 171
172 172
173static const ShiftMap shiftMap[] = { 173static 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 */
199static const char * const uparrow_xpm[]={ 199static 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....",
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
@@ -54,201 +54,201 @@ static const char * const kb_config_xpm[] = {
54/* Keyboard::Keyboard {{{1 */ 54/* Keyboard::Keyboard {{{1 */
55Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 55Keyboard::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
102Keyboard::~Keyboard() { 102Keyboard::~Keyboard() {
103 103
104 if ( configdlg ) { 104 if ( configdlg ) {
105 delete configdlg; 105 delete configdlg;
106 configdlg = 0; 106 configdlg = 0;
107 } 107 }
108 108
109} 109}
110 110
111/* Keyboard::resizeEvent {{{1 */ 111/* Keyboard::resizeEvent {{{1 */
112void Keyboard::resizeEvent(QResizeEvent*) 112void Keyboard::resizeEvent(QResizeEvent*)
113{ 113{
114 int ph = picks->sizeHint().height(); 114 int ph = picks->sizeHint().height();
115 picks->setGeometry( 0, 0, width(), ph ); 115 picks->setGeometry( 0, 0, width(), ph );
116 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); 116 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1);
117 117
118 int nk; // number of keys? 118 int nk; // number of keys?
119 if ( useLargeKeys ) { 119 if ( useLargeKeys ) {
120 nk = 15; 120 nk = 15;
121 } else { 121 } else {
122 nk = 19; 122 nk = 19;
123 } 123 }
124 defaultKeyWidth = (width()/nk)/2; 124 defaultKeyWidth = (width()/nk)/2;
125 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 125 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
126 126
127} 127}
128 128
129/* KeyboardPicks::initialize {{{1 */ 129/* KeyboardPicks::initialize {{{1 */
130void KeyboardPicks::initialise() 130void KeyboardPicks::initialise()
131{ 131{
132 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 132 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
133 mode = 0; 133 mode = 0;
134 dc = new KeyboardConfig(this); 134 dc = new KeyboardConfig(this);
135 configs.append(dc); 135 configs.append(dc);
136} 136}
137 137
138/* KeyboardPicks::sizeHint {{{1 */ 138/* KeyboardPicks::sizeHint {{{1 */
139QSize KeyboardPicks::sizeHint() const 139QSize KeyboardPicks::sizeHint() const
140{ 140{
141 return QSize(240,fontMetrics().lineSpacing()); 141 return QSize(240,fontMetrics().lineSpacing());
142} 142}
143 143
144 144
145/* KeyboardConfig::generateText {{{1 */ 145/* KeyboardConfig::generateText {{{1 */
146void KeyboardConfig::generateText(const QString &s) 146void KeyboardConfig::generateText(const QString &s)
147{ 147{
148#if defined(Q_WS_QWS) || defined(_WS_QWS_) 148#if defined(Q_WS_QWS) || defined(_WS_QWS_)
149 for (int i=0; i<(int)backspaces; i++) { 149 for (int i=0; i<(int)backspaces; i++) {
150 parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); 150 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false );
151 parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); 151 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false );
152 } 152 }
153 for (int i=0; i<(int)s.length(); i++) { 153 for (int i=0; i<(int)s.length(); i++) {
154 parent->emitKey( s[i].unicode(), 0, 0, true, false ); 154 parent->emitKey( s[i].unicode(), 0, 0, true, false );
155 parent->emitKey( s[i].unicode(), 0, 0, false, false ); 155 parent->emitKey( s[i].unicode(), 0, 0, false, false );
156 } 156 }
157 parent->emitKey( 0, Qt::Key_Space, 0, true, false ); 157 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false );
158 parent->emitKey( 0, Qt::Key_Space, 0, false, false ); 158 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false );
159 backspaces = 0; 159 backspaces = 0;
160#endif 160#endif
161} 161}
162 162
163 163
164 164
165 165
166/* Keyboard::paintEvent {{{1 */ 166/* Keyboard::paintEvent {{{1 */
167void Keyboard::paintEvent(QPaintEvent* e) 167void Keyboard::paintEvent(QPaintEvent* e)
168{ 168{
169 QPainter painter(this); 169 QPainter painter(this);
170 painter.setClipRect(e->rect()); 170 painter.setClipRect(e->rect());
171 drawKeyboard( painter ); 171 drawKeyboard( painter );
172 picks->dc->draw( &painter ); 172 picks->dc->draw( &painter );
173} 173}
174 174
175 175
176/* Keyboard::drawKeyboard {{{1 */ 176/* Keyboard::drawKeyboard {{{1 */
177 177
178void Keyboard::drawKeyboard(QPainter &p, int row, int col) 178void Keyboard::drawKeyboard(QPainter &p, int row, int col)
179{ 179{
180 180
181 181
182 if (row != -1 && col != -1) { //just redraw one key 182 if (row != -1 && col != -1) { //just redraw one key
183 183
184 int x = 0; 184 int x = 0;
185 for (int i = 0; i < col; i++) { 185 for (int i = 0; i < col; i++) {
186 186
187 x += keys->width(row, i) * defaultKeyWidth; 187 x += keys->width(row, i) * defaultKeyWidth;
188 } 188 }
189 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 189 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
190 190
191 int keyWidth = keys->width(row, col); 191 int keyWidth = keys->width(row, col);
192 192
193 p.fillRect(x + 1, y + 1, 193 p.fillRect(x + 1, y + 1,
194 keyWidth * defaultKeyWidth - 1, keyHeight - 1, 194 keyWidth * defaultKeyWidth - 1, keyHeight - 1,
195 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); 195 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor);
196 196
197 QImage *pix = keys->pix(row,col); 197 QImage *pix = keys->pix(row,col);
198 198
199 ushort c = keys->uni(row, col); 199 ushort c = keys->uni(row, col);
200 200
201 p.setPen(textcolor); 201 p.setPen(textcolor);
202 if (!pix) { 202 if (!pix) {
203 if ((shift || lock) && keys->shift(c)) 203 if ((shift || lock) && keys->shift(c))
204 204
205 if (circumflex && keys->circumflex(keys->shift(c))) 205 if (circumflex && keys->circumflex(keys->shift(c)))
206 c = keys->circumflex(keys->shift(c)); 206 c = keys->circumflex(keys->shift(c));
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