summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Unidiff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 92ea896..4747f59 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -10,98 +10,98 @@
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "keyboard.h" 21#include "keyboard.h"
22#include "configdlg.h" 22#include "configdlg.h"
23 23
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26 26
27#include <qwindowsystem_qws.h> 27#include <qwindowsystem_qws.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qfontmetrics.h> 29#include <qfontmetrics.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <ctype.h> 33#include <ctype.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qstringlist.h> 36#include <qstringlist.h>
37 37
38#include <sys/utsname.h> 38#include <sys/utsname.h>
39 39
40 40
41/* Keyboard::Keyboard {{{1 */ 41/* Keyboard::Keyboard {{{1 */
42Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 42Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
43 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), 43 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0),
44 useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), 44 useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1),
45 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), 45 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
46 configdlg(0) 46 configdlg(0)
47 47
48{ 48{
49 49
50 // get the default font 50 // get the default font
51 Config *config = new Config( "qpe" ); 51 Config *config = new Config( "qpe" );
52 config->setGroup( "Appearance" ); 52 config->setGroup( "Appearance" );
53 QString familyStr = config->readEntry( "FontFamily", "fixed" ); 53 QString familyStr = config->readEntry( "FontFamily", "fixed" );
54 delete config; 54 delete config;
55 55
56 config = new Config("multikey"); 56 config = new Config("multikey");
57 config->setGroup ("general"); 57 config->setGroup ("general");
58 usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed 58 usePicks = config->readBoolEntry ("usePickboard", 0); // default closed
59 useRepeat = config->readBoolEntry ("useRepeat", "1"); 59 useRepeat = config->readBoolEntry ("useRepeat", 1);
60 delete config; 60 delete config;
61 61
62 62
63 setFont( QFont( familyStr, 10 ) ); 63 setFont( QFont( familyStr, 10 ) );
64 64
65 picks = new KeyboardPicks( this ); 65 picks = new KeyboardPicks( this );
66 picks->setFont( QFont( familyStr, 10 ) ); 66 picks->setFont( QFont( familyStr, 10 ) );
67 picks->initialise(); 67 picks->initialise();
68 if (usePicks) { 68 if (usePicks) {
69 69
70 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 70 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
71 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 71 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
72 72
73 } else picks->hide(); 73 } else picks->hide();
74 74
75 loadKeyboardColors(); 75 loadKeyboardColors();
76 76
77 keys = new Keys(); 77 keys = new Keys();
78 78
79 repeatTimer = new QTimer( this ); 79 repeatTimer = new QTimer( this );
80 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 80 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
81 81
82} 82}
83 83
84Keyboard::~Keyboard() { 84Keyboard::~Keyboard() {
85 85
86 if ( configdlg ) { 86 if ( configdlg ) {
87 delete (ConfigDlg *) configdlg; 87 delete (ConfigDlg *) configdlg;
88 configdlg = 0; 88 configdlg = 0;
89 } 89 }
90 90
91} 91}
92 92
93/* Keyboard::resizeEvent {{{1 */ 93/* Keyboard::resizeEvent {{{1 */
94void Keyboard::resizeEvent(QResizeEvent*) 94void Keyboard::resizeEvent(QResizeEvent*)
95{ 95{
96 int ph = picks->sizeHint().height(); 96 int ph = picks->sizeHint().height();
97 picks->setGeometry( 0, 0, width(), ph ); 97 picks->setGeometry( 0, 0, width(), ph );
98 keyHeight = (height()-(usePicks ? ph : 0))/5; 98 keyHeight = (height()-(usePicks ? ph : 0))/5;
99 99
100 int nk; // number of keys? 100 int nk; // number of keys?
101 if ( useLargeKeys ) { 101 if ( useLargeKeys ) {
102 nk = 15; 102 nk = 15;
103 } else { 103 } else {
104 nk = 19; 104 nk = 19;
105 } 105 }
106 defaultKeyWidth = (width()/nk)/2; 106 defaultKeyWidth = (width()/nk)/2;
107 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 107 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?