summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--development/keyview/keyboardimpl.cpp189
-rw-r--r--development/keyview/keyboardimpl.h51
-rw-r--r--development/keyview/keyview.cpp69
-rw-r--r--development/keyview/keyview.h43
-rw-r--r--development/keyview/keyview.pro26
-rw-r--r--development/keyview/main.cpp12
6 files changed, 390 insertions, 0 deletions
diff --git a/development/keyview/keyboardimpl.cpp b/development/keyview/keyboardimpl.cpp
new file mode 100644
index 0000000..673eaa5
--- a/dev/null
+++ b/development/keyview/keyboardimpl.cpp
@@ -0,0 +1,189 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include <qapplication.h>
21#include <qpixmap.h>
22#include "keyview.h"
23#include "keyboardimpl.h"
24
25/* XPM */
26static const char * kb_xpm[] = {
27"28 13 81 1",
28 " c None",
29 ".c #000000",
30 "+c #E5E1D5",
31 "@c #FFFFFF",
32 "#c #DBDBDB",
33 "$c #132B07",
34 "%c #426362",
35 "&c #558384",
36 "*c #6E6D67",
37 "=c #DCD8CD",
38 "-c #929292",
39 ";c #446463",
40 ">c #558585",
41 ",c #466565",
42 "'c #558685",
43 ")c #B7B7B7",
44 "!c #A2A2A2",
45 "~c #9A9A9A",
46 "{c #959595",
47 "]c #939393",
48 "^c #486767",
49 "/c #383838",
50 "(c #303030",
51 "_c #2C2C2C",
52 ":c #2A2A2A",
53 "<c #292929",
54 "[c #333333",
55 "}c #FFFFE9",
56 "|c #FEFFDD",
57 "1c #E4E5AD",
58 "2c #202020",
59 "3c #466665",
60 "4c #2F2F2F",
61 "5c #FEFFC1",
62 "6c #575742",
63 "7c #191919",
64 "8c #2D2D2D",
65 "9c #29291F",
66 "0c #141414",
67 "ac #122207",
68 "bc #548584",
69 "cc #111111",
70 "dc #131313",
71 "ec #1B2514",
72 "fc #112106",
73 "gc #416160",
74 "hc #538484",
75 "ic #2B2B2B",
76 "jc #0F0F0F",
77 "kc #14190F",
78 "lc #192312",
79 "mc #0F1F06",
80 "nc #40605F",
81 "oc #518483",
82 "pc #9D9D9D",
83 "qc #747474",
84 "rc #2B2C2B",
85 "sc #060704",
86 "tc #0B0E09",
87 "uc #12180D",
88 "vc #17210F",
89 "wc #0E1E04",
90 "xc #3D5E5D",
91 "yc #508382",
92 "zc #898989",
93 "Ac #9C9C9C",
94 "Bc #050704",
95 "Cc #0A0D08",
96 "Dc #10170B",
97 "Ec #141E0C",
98 "Fc #0C1B04",
99 "Gc #395C5A",
100 "Hc #4F8181",
101 "Ic #242424",
102 "Jc #050604",
103 "Kc #090C06",
104 "Lc #0E1509",
105 "Mc #121C0A",
106 "Nc #0B1A03",
107 "Oc #375A58",
108 "Pc #4D807F",
109"...........+..@.@@@@@@@#.$%&",
110"..........*=.@.@.@@@@@##.-;>",
111"..............@.@.@@@###.-,'",
112")!~{{]]]{]]].@.@.@@#.##-.-^'",
113"/(_::<<<:<<<..@.@@#..#--.-^'",
114"[}|12}|12}|12.#.@#.-.---.-3'",
115"4|567|567|567..@@...---.--,'",
116"81690169016901.@#.----.--a;b",
117"82700ccc0cccd.@@......--efgh",
118"i}|1c}|1c}|1j.@#.------klmno",
119"i|56c|56c|56.@#.--pqrstuvwxy",
120"i169c169c16.@#.--zAqrBCDEFGH",
121"82700ccc0cj...--IzAqrJKLMNOP"};
122
123
124
125
126KeyboardImpl::KeyboardImpl()
127 : input(0), icn(0), ref(0)
128{
129}
130
131KeyboardImpl::~KeyboardImpl()
132{
133 delete input;
134 delete icn;
135}
136
137QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
138{
139 if ( !input )
140 input = new Keyview( parent, "Keyview", f );
141 return input;
142}
143
144void KeyboardImpl::resetState()
145{
146 /*
147 if ( input )
148 input->resetState();
149 */
150}
151
152QPixmap *KeyboardImpl::icon()
153{
154 if ( !icn )
155 icn = new QPixmap( (const char **)kb_xpm );
156 return icn;
157}
158
159QString KeyboardImpl::name()
160{
161 // return qApp->translate( "InputMethods", "Keyboard" );
162 return "Keyview";
163}
164
165void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot )
166{
167 //if ( input )
168 //QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
169}
170
171#ifndef QT_NO_COMPONENT
172QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
173{
174 *iface = 0;
175 if ( uuid == IID_QUnknown )
176 *iface = this;
177 else if ( uuid == IID_InputMethod )
178 *iface = this;
179
180 if ( *iface )
181 (*iface)->addRef();
182 return QS_OK;
183}
184
185Q_EXPORT_INTERFACE()
186{
187 Q_CREATE_INSTANCE( KeyboardImpl )
188}
189#endif
diff --git a/development/keyview/keyboardimpl.h b/development/keyview/keyboardimpl.h
new file mode 100644
index 0000000..09a1abb
--- a/dev/null
+++ b/development/keyview/keyboardimpl.h
@@ -0,0 +1,51 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef KEYBOARDIMPL_H
21#define KEYBOARDIMPL_H
22
23#include <qpe/inputmethodinterface.h>
24
25class Keyview;
26class QPixmap;
27
28class KeyboardImpl : public InputMethodInterface
29{
30public:
31 KeyboardImpl();
32 virtual ~KeyboardImpl();
33
34#ifndef QT_NO_COMPONENT
35 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
36 Q_REFCOUNT
37#endif
38
39 virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f );
40 virtual void resetState();
41 virtual QPixmap *icon();
42 virtual QString name();
43 virtual void onKeyPress( QObject *receiver, const char *slot );
44
45private:
46 Keyview *input;
47 QPixmap *icn;
48 ulong ref;
49};
50
51#endif
diff --git a/development/keyview/keyview.cpp b/development/keyview/keyview.cpp
new file mode 100644
index 0000000..15d9f51
--- a/dev/null
+++ b/development/keyview/keyview.cpp
@@ -0,0 +1,69 @@
1#include "keyview.h"
2#include <qgrid.h>
3#include <iostream.h>
4#include <qlineedit.h>
5#include <qlabel.h>
6
7Keyview::Keyview( QWidget* parent, const char* name, WFlags fl )
8 : QGrid ( 2, parent, name, fl )
9{
10 setCaption( tr("Keyview") );
11 setSpacing(3);
12 setMargin(4);
13
14 QLabel *l;
15
16 l = new QLabel(QString("unicode:"), this);
17 unicode = new QLineEdit(this);
18 unicode->setReadOnly(1);
19
20 l = new QLabel(QString("keycode:"), this);
21 keycode = new QLineEdit(this);
22 keycode->setReadOnly(1);
23
24 l = new QLabel(QString("modifiers:"), this);
25 modifiers = new QLineEdit(this);
26 modifiers->setReadOnly(1);
27
28 l = new QLabel(QString("isPress:"), this);
29 isPress = new QLineEdit(this);
30 isPress->setReadOnly(1);
31
32 l = new QLabel(QString("autoRepeat:"), this);
33 autoRepeat = new QLineEdit(this);
34 autoRepeat->setReadOnly(1);
35
36 // spacer
37 l = new QLabel(QString(""), this);
38 l->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
39
40
41 KeyFilter *filter = new KeyFilter(this);
42 QWSServer::setKeyboardFilter(filter);
43
44 connect(filter, SIGNAL(keyPressed(int, int, int, bool, bool)),
45 this, SLOT(updateItems(int, int, int, bool, bool)));
46}
47
48Keyview::~Keyview() { }
49
50void Keyview::updateItems(int u, int k, int m, bool p, bool a) {
51
52 unicode->setText("0x" + QString::number(u, 16));
53 keycode->setText("0x" + QString::number(k, 16));
54 modifiers->setText("0x" + QString::number(m, 16));
55 isPress->setText("0x" + QString::number(p, 16));
56 autoRepeat->setText("0x" + QString::number(a, 16));
57}
58
59KeyFilter::KeyFilter(QObject * parent, const char *name) : QObject( parent, name ) {
60
61}
62
63bool KeyFilter::filter(int unicode, int keycode, int modifiers, bool isPress,
64 bool autoRepeat) {
65
66 emit keyPressed(unicode, keycode, modifiers, isPress, autoRepeat);
67 return 0; // return 1 to stop key emiting
68
69}
diff --git a/development/keyview/keyview.h b/development/keyview/keyview.h
new file mode 100644
index 0000000..ab4ae60
--- a/dev/null
+++ b/development/keyview/keyview.h
@@ -0,0 +1,43 @@
1#ifndef KEYVIEW_H
2#define KEYVIEW_H
3#include <qgrid.h>
4#include <qlineedit.h>
5#include <qwindowsystem_qws.h>
6
7
8class Keyview : public QGrid
9{
10 Q_OBJECT
11
12public:
13 Keyview( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
14 ~Keyview();
15
16private slots:
17 void updateItems(int, int, int, bool, bool);
18
19private:
20
21 QLineEdit *unicode;
22 QLineEdit *keycode;
23 QLineEdit *modifiers;
24 QLineEdit *isPress;
25 QLineEdit *autoRepeat;
26
27};
28
29class KeyFilter : public QObject, public QWSServer::KeyboardFilter
30{
31 Q_OBJECT
32
33public:
34 KeyFilter( QObject* parent, const char* name = 0);
35 virtual bool filter(int unicode, int keycode, int modifiers, bool isPress,
36 bool autoRepeat);
37
38signals:
39 void keyPressed(int, int, int, bool, bool);
40
41};
42
43#endif
diff --git a/development/keyview/keyview.pro b/development/keyview/keyview.pro
new file mode 100644
index 0000000..b4694c9
--- a/dev/null
+++ b/development/keyview/keyview.pro
@@ -0,0 +1,26 @@
1 TEMPLATE= lib
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4 HEADERS = keyview.h keyboardimpl.h
5 SOURCES = keyview.cpp keyboardimpl.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include ../../launcher
8LIBS += -lqpe
9 INTERFACES=
10 TARGET = keyview
11DESTDIR = $(OPIEDIR)/plugins/inputmethods
12
13TRANSLATIONS = ../i18n/de/keyview.ts \
14 ../i18n/en/keyview.ts \
15 ../i18n/es/keyview.ts \
16 ../i18n/fr/keyview.ts \
17 ../i18n/hu/keyview.ts \
18 ../i18n/ja/keyview.ts \
19 ../i18n/ko/keyview.ts \
20 ../i18n/no/keyview.ts \
21 ../i18n/pl/keyview.ts \
22 ../i18n/pt/keyview.ts \
23 ../i18n/pt_BR/keyview.ts \
24 ../i18n/sl/keyview.ts \
25 ../i18n/zh_CN/keyview.ts \
26 ../i18n/zh_TW/keyview.ts
diff --git a/development/keyview/main.cpp b/development/keyview/main.cpp
new file mode 100644
index 0000000..811e581
--- a/dev/null
+++ b/development/keyview/main.cpp
@@ -0,0 +1,12 @@
1#include "keyview.h"
2#include <qpe/qpeapplication.h>
3
4int main( int argc, char ** argv )
5{
6 QPEApplication a( argc, argv );
7
8 Keyview kv;
9 a.showMainWidget( &kv );
10
11 return a.exec();
12}