-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 5 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index f6507b4..26c9233 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -1,54 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing (size too) | 3 | * make a font selection thing (size too) |
4 | * make a cursor thing | 4 | * make vertical keys possible |
5 | * add meta key support for german, etc | 5 | * make a keymap editor |
6 | * | ||
7 | * | 6 | * |
8 | * | 7 | * |
9 | */ | 8 | */ |
10 | 9 | ||
11 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
12 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
13 | 12 | ||
14 | #include <qwidget.h> | 13 | #include <qwidget.h> |
15 | #include <qdialog.h> | 14 | #include <qdialog.h> |
16 | #include <qtabwidget.h> | 15 | #include <qtabwidget.h> |
17 | #include <qvbox.h> | 16 | #include <qvbox.h> |
18 | #include <qgrid.h> | 17 | #include <qgrid.h> |
19 | #include <qgroupbox.h> | 18 | #include <qgroupbox.h> |
20 | #include <qlabel.h> | 19 | #include <qlabel.h> |
21 | #include <qcheckbox.h> | 20 | #include <qcheckbox.h> |
22 | #include <qsizepolicy.h> | 21 | #include <qsizepolicy.h> |
23 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
24 | #include <qlistbox.h> | 23 | #include <qlistbox.h> |
25 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
26 | #include <opie/ofiledialog.h> | 25 | #include <opie/ofiledialog.h> |
27 | #include <opie/colordialog.h> | 26 | #include <opie/colordialog.h> |
28 | #include <qdir.h> | 27 | #include <qdir.h> |
29 | #include <qfileinfo.h> | 28 | #include <qfileinfo.h> |
30 | #include "configdlg.h" | 29 | #include "configdlg.h" |
31 | #include "keyboard.h" | 30 | #include "keyboard.h" |
32 | 31 | ||
33 | // ConfigDlg::ConfigDlg() {{{1 | 32 | // ConfigDlg::ConfigDlg() {{{1 |
34 | ConfigDlg::ConfigDlg () : QTabWidget () | 33 | ConfigDlg::ConfigDlg () : QTabWidget () |
35 | { | 34 | { |
36 | setCaption( tr("Multikey Configuration") ); | 35 | setCaption( tr("Multikey Configuration") ); |
37 | Config config ("multikey"); | 36 | Config config ("multikey"); |
38 | config.setGroup("keymaps"); | 37 | config.setGroup("keymaps"); |
39 | QString current_map = config.readEntry("current", 0); | 38 | QString current_map = config.readEntry("current", 0); |
40 | 39 | ||
41 | /* | 40 | /* |
42 | * 'general config' tab | 41 | * 'general config' tab |
43 | */ | 42 | */ |
44 | 43 | ||
45 | QVBox *gen_box = new QVBox (this); | 44 | QVBox *gen_box = new QVBox (this); |
46 | gen_box->setMargin(3); | 45 | gen_box->setMargin(3); |
47 | addTab(gen_box, tr("General Settings")); | 46 | addTab(gen_box, tr("General Settings")); |
48 | 47 | ||
49 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); | 48 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
50 | 49 | ||
51 | keymaps = new QListBox (map_group); | 50 | keymaps = new QListBox (map_group); |
52 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 51 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
53 | 52 | ||
54 | QString cur(tr("Current Language")); | 53 | QString cur(tr("Current Language")); |
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 */ |
42 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 42 | Keyboard::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 | ||
84 | Keyboard::~Keyboard() { | 84 | Keyboard::~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 */ |
94 | void Keyboard::resizeEvent(QResizeEvent*) | 94 | void 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? |