author | mickeyl <mickeyl> | 2003-09-27 11:29:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-09-27 11:29:26 (UTC) |
commit | 651b6c612db4e809c506973996f2580c4158ac3a (patch) (unidiff) | |
tree | 8c8edc86e4b206dd4542a6b556ad1a319d6698ab /inputmethods/dasher/QtDasherPlugin.cc | |
parent | d1a11b45e805fe7771ea05944757d767c3c4c8ea (diff) | |
download | opie-651b6c612db4e809c506973996f2580c4158ac3a.zip opie-651b6c612db4e809c506973996f2580c4158ac3a.tar.gz opie-651b6c612db4e809c506973996f2580c4158ac3a.tar.bz2 |
merge dasher which has been introduced in BRANCH first (wtf?) into HEAD
Diffstat (limited to 'inputmethods/dasher/QtDasherPlugin.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/dasher/QtDasherPlugin.cc | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/inputmethods/dasher/QtDasherPlugin.cc b/inputmethods/dasher/QtDasherPlugin.cc new file mode 100644 index 0000000..fe1712e --- a/dev/null +++ b/inputmethods/dasher/QtDasherPlugin.cc | |||
@@ -0,0 +1,79 @@ | |||
1 | #include "QtDasherPlugin.h" | ||
2 | |||
3 | #include <qpe/global.h> | ||
4 | |||
5 | #include <qpainter.h> | ||
6 | #include <qlist.h> | ||
7 | #include <qbitmap.h> | ||
8 | #include <qlayout.h> | ||
9 | #include <qvbox.h> | ||
10 | #include <qdialog.h> | ||
11 | #include <qscrollview.h> | ||
12 | #include <qpopupmenu.h> | ||
13 | #include <qhbuttongroup.h> | ||
14 | #include <qpushbutton.h> | ||
15 | #include <qmessagebox.h> | ||
16 | #include <qwindowsystem_qws.h> | ||
17 | |||
18 | QtDasherPlugin::QtDasherPlugin(QWidget* parent, const char* name, WFlags f) : QFrame(parent,name,f) | ||
19 | { | ||
20 | (new QHBoxLayout(this))->setAutoAdd(TRUE); | ||
21 | interface = new CDasherInterface; | ||
22 | interface->SetSystemLocation("/opt/QtPalmtop/share/dasher"); | ||
23 | interface->Unpause(0); | ||
24 | interface->Start(); | ||
25 | d = new QtDasherScreen(240,100,interface,this,this); | ||
26 | interface->ChangeMaxBitRate(2.5); | ||
27 | d->show(); | ||
28 | utf8_codec = new QUtf8Codec; | ||
29 | } | ||
30 | |||
31 | QSize QtDasherPlugin::sizeHint() const | ||
32 | { | ||
33 | return QSize(240,100); | ||
34 | } | ||
35 | |||
36 | QtDasherPlugin::~QtDasherPlugin() | ||
37 | { | ||
38 | delete d; | ||
39 | } | ||
40 | |||
41 | void QtDasherPlugin::resetState() | ||
42 | { | ||
43 | flushcount=0; | ||
44 | interface->Start(); | ||
45 | interface->Redraw(); | ||
46 | } | ||
47 | |||
48 | void QtDasherPlugin::unflush() | ||
49 | { | ||
50 | if (flushcount==0) | ||
51 | return; | ||
52 | for (flushcount; flushcount>0; flushcount--) { | ||
53 | deletetext(); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | void QtDasherPlugin::output(int Symbol) | ||
58 | { | ||
59 | std::string label = interface->GetEditText(Symbol); | ||
60 | QString unicodestring = utf8_codec->toUnicode(label.c_str()); | ||
61 | for (int i=0; i<int(unicodestring.length()); i++) { | ||
62 | emit key( unicodestring[i].unicode(), 0, 0, true, false ); | ||
63 | emit key( unicodestring[i].unicode(), 0, 0, false, false ); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | void QtDasherPlugin::deletetext() | ||
68 | { | ||
69 | emit key( 0, Qt::Key_Backspace, 0, true, false); | ||
70 | emit key( 0, Qt::Key_Backspace, 0, false, false); | ||
71 | } | ||
72 | |||
73 | void QtDasherPlugin::flush(int Symbol) | ||
74 | { | ||
75 | if (Symbol==0) | ||
76 | return; | ||
77 | output(Symbol); | ||
78 | flushcount++; | ||
79 | } | ||