author | hash <hash> | 2002-08-14 05:39:42 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-14 05:39:42 (UTC) |
commit | 13a1334cca686bf512c4a8f94a648ba969b38d22 (patch) (side-by-side diff) | |
tree | 13e46c6b4157b0348f38d952ddc70f6e0fda619b /inputmethods | |
parent | 29ffa9119abaf753b165c5c241b22938eeaef301 (diff) | |
download | opie-13a1334cca686bf512c4a8f94a648ba969b38d22.zip opie-13a1334cca686bf512c4a8f94a648ba969b38d22.tar.gz opie-13a1334cca686bf512c4a8f94a648ba969b38d22.tar.bz2 |
added config dialog. only open/closing pickboard works
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 67 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.h | 4 | ||||
-rw-r--r-- | inputmethods/multikey/multikey.pro | 2 |
3 files changed, 53 insertions, 20 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 8f4d562..a19f07a 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp @@ -10,53 +10,61 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "keyboard.h" +#include "configdlg.h" #include <qpe/global.h> +#include <qpe/qcopenvelope_qws.h> #include <qwindowsystem_qws.h> #include <qpainter.h> #include <qfontmetrics.h> #include <qtimer.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <ctype.h> #include <qfile.h> #include <qtextstream.h> #include <sys/utsname.h> #define USE_SMALL_BACKSPACE /* Keyboard::Keyboard {{{1 */ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), - unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0) + unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0), + configdlg(0) + { // get the default font Config qpeConfig( "qpe" ); qpeConfig.setGroup( "Appearance" ); QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" ); + Config multiConfig ("multikey"); + multiConfig.setGroup ("pickboard"); + usePicks = multiConfig.readBoolEntry ("open", "0"); // default closed + setFont( QFont( familyStr, 8 ) ); picks = new KeyboardPicks( this ); picks->setFont( QFont( familyStr, 8 ) ); picks->initialise(); if (usePicks) { QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); } else picks->hide(); @@ -253,45 +261,37 @@ void Keyboard::mousePressEvent(QMouseEvent *e) qkeycode = keys.qcode(row, col); unicode = keys.uni(row, col); // might need to repaint if two or more of the same keys. // should be faster if just paint one key even though multiple keys exist. bool need_repaint = FALSE; if (unicode == 0) { // either Qt char, or nothing if (qkeycode == Qt::Key_F1) { // toggle the pickboard - usePicks = !usePicks; - if (usePicks) { - picks->show(); - move(x(), y() - picks->height()); - adjustSize(); - QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), - this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); - } else { - - picks->hide(); - picks->resetState(); - move(x(), y() + picks->height()); - adjustSize(); - QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), - this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); - + if ( configdlg ) { + delete (ConfigDlg *) configdlg; + configdlg = 0; + } + else { + configdlg = new ConfigDlg (); + connect(configdlg, SIGNAL(pickboardToggled(bool)), + this, SLOT(togglePickboard(bool))); + configdlg->showMaximized(); + configdlg->show(); + configdlg->raise(); } - keys.setPressed(row, col, usePicks); - need_repaint = TRUE; - qkeycode = 0; // don't need to emit Key_F1 } else if (qkeycode == Qt::Key_Control) { ctrl = keys.pressedPtr(row, col); need_repaint = TRUE; *ctrl = !keys.pressed(row, col); } else if (qkeycode == Qt::Key_Alt) { alt = keys.pressedPtr(row, col); need_repaint = TRUE; *alt = !keys.pressed(row, col); } else if (qkeycode == Qt::Key_Shift) { need_repaint = TRUE; @@ -453,24 +453,51 @@ QSize Keyboard::sizeHint() const int keyHeight = fm.lineSpacing(); return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); } void Keyboard::resetState() { schar = mchar = echar = 0; picks->resetState(); } +/* Keyboard::togglePickboard {{{1 */ +void Keyboard::togglePickboard(bool on_off) +{ + usePicks = on_off; + if (usePicks) { + picks->show(); + //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send + //adjustSize(); + QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), + this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); + } else { + + picks->hide(); + picks->resetState(); + //move(x(), y() + picks->height()); + //adjustSize(); + QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), + this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); + + } + /* + * this closes && opens the input method + */ + QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); + QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); +} + /* korean input functions {{{1 * * TODO * one major problem with this implementation is that you can't move the * cursor after inputing korean chars, otherwise it will eat up and replace * the char before the cursor you move to. fix that * * make backspace delete one single char, not the whole thing if still * editing. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index b524195..e61b76c 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h @@ -12,24 +12,25 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qframe.h> #include <qmap.h> #include "../pickboard/pickboardcfg.h" #include "../pickboard/pickboardpicks.h" +#include "configdlg.h" class QTimer; class KeyboardConfig : public DictFilterConfig { public: KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } virtual void generateText(const QString &s); void decBackspaces() { if (backspaces) backspaces--; } void incBackspaces() { backspaces++; } void resetBackspaces() { backspaces = 0; } private: @@ -97,24 +98,25 @@ public: void resizeEvent(QResizeEvent*); void paintEvent(QPaintEvent* e); //void timerEvent(QTimerEvent* e); void drawKeyboard( QPainter &p, int row = -1, int col = -1); QSize sizeHint() const; signals: void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); private slots: void repeat(); + void togglePickboard(bool on_off); private: int getKey( int &w, int j = -1 ); void clearHighlight(); bool *shift; bool *lock; bool *ctrl; bool *alt; uint useLargeKeys:1; uint usePicks:1; @@ -134,15 +136,17 @@ private: int pressTid; bool pressed; Keys keys; QString LANG; /* for korean input */ ushort schar, mchar, echar; ushort parseKoreanInput(ushort c); ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); ushort constoe(const ushort c); QTimer *repeatTimer; + + ConfigDlg *configdlg; }; diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro index 2e92e06..9d76a3d 100644 --- a/inputmethods/multikey/multikey.pro +++ b/inputmethods/multikey/multikey.pro @@ -1,19 +1,21 @@ TEMPLATE = lib CONFIG += qt warn_on release HEADERS = keyboard.h \ + configdlg.h \ ../pickboard/pickboardcfg.h \ ../pickboard/pickboardpicks.h \ keyboardimpl.h SOURCES = keyboard.cpp \ + configdlg.cpp \ ../pickboard/pickboardcfg.cpp \ ../pickboard/pickboardpicks.cpp \ keyboardimpl.cpp TARGET = qmultikey DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts TRANSLATIONS += ../../i18n/de/libqmultikey.ts |