-rw-r--r-- | inputmethods/jumpx/config.in | 2 | ||||
-rw-r--r-- | inputmethods/jumpx/jumpx.pro | 2 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboard.cpp | 18 | ||||
-rw-r--r-- | inputmethods/jumpx/opie-jumpx.control | 2 | ||||
-rw-r--r-- | inputmethods/kjumpx/config.in | 2 | ||||
-rw-r--r-- | inputmethods/kjumpx/keyboard.cpp | 60 | ||||
-rw-r--r-- | inputmethods/kjumpx/kjumpx.pro | 2 | ||||
-rw-r--r-- | inputmethods/kjumpx/opie-kjumpx.control | 2 | ||||
-rw-r--r-- | inputmethods/multikey/config.in | 2 | ||||
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 13 | ||||
-rw-r--r-- | inputmethods/multikey/multikey.pro | 2 | ||||
-rw-r--r-- | inputmethods/multikey/opie-multikey.control | 2 |
12 files changed, 56 insertions, 53 deletions
diff --git a/inputmethods/jumpx/config.in b/inputmethods/jumpx/config.in index f2779f8..33645d9 100644 --- a/inputmethods/jumpx/config.in +++ b/inputmethods/jumpx/config.in @@ -1,4 +1,4 @@ config JUMPX boolean "opie-jumpx (keyboard optimized for single finger/stylus input)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/inputmethods/jumpx/jumpx.pro b/inputmethods/jumpx/jumpx.pro index c8b2185..e13deb9 100644 --- a/inputmethods/jumpx/jumpx.pro +++ b/inputmethods/jumpx/jumpx.pro @@ -1,15 +1,15 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ keyboardimpl.h SOURCES = keyboard.cpp \ keyboardimpl.cpp TARGET = qjumpx DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 VERSION = 1.0.0 include( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/jumpx/keyboard.cpp b/inputmethods/jumpx/keyboard.cpp index 0cfb4be..79f0d5d 100644 --- a/inputmethods/jumpx/keyboard.cpp +++ b/inputmethods/jumpx/keyboard.cpp @@ -1,525 +1,525 @@ /**************************************************************************************94x78** ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** *********************************************************************************************/ #include "keyboard.h" -#include <qpe/resource.h> +#include <opie2/oresource.h> //#include <iostream.h> static const int autorepeatDelaytime = 500; // ms static const int autorepeatRate = 20; // chars per second static const int mod1x1 = 0; static const int mod1x2 = 23; static const int mod1w = mod1x2 - mod1x1; static const int letterx1 = 27; static const int letterx2 = 129; static const int letterw = 17; static const int letterh = 14; static const int num1x1 = 130; static const int num1x2 = 137; static const int num1w = num1x2 - num1x1; static const int specialx1 = 138; static const int specialx2 = 170; static const int specialw = 16; static const int num2x1 = 171; static const int num2x2 = 178; static const int num2w = num2x2 - num2x1; static const int mod2x1 = 179; static const int mod2x2 = 203; static const int mod2w = mod2x2 - mod2x1; static const int cursorx1 = 207; static const int cursorw = 16; static const int myParenID = -10; typedef struct mapElement { int qcode; ushort unicode; }; static const mapElement mod1Map[] = { { Qt::Key_Escape, 27 }, { Qt::Key_Tab, 9 }, { Qt::Key_Return, 13 }, { Qt::Key_Alt, 0 }, { Qt::Key_Control, 0 }, }; static const uchar *const letterMap[] = { (const uchar *const)"zvchwk", (const uchar *const)"fitaly", (const uchar *const)" ne ", (const uchar *const)"gdorsb", (const uchar *const)"qjumpx", }; static const uchar *const letterMapShift[] = { (const uchar *const)"ZVCHWK", (const uchar *const)"FITALY", (const uchar *const)" NE ", (const uchar *const)"GDORSB", (const uchar *const)"QJUMPX", }; static const uchar *const num1Map = (const uchar *const)"12345"; static const uchar *const specialMap[] = { (const uchar *const)"-+", (const uchar *const)"*!", (const uchar *const)",'", (const uchar *const)".%", (const uchar *const)"/$", }; static const uchar *const specialMapShift[] = { (const uchar *const)"_=", (const uchar *const)"#?", (const uchar *const)";\"", (const uchar *const)":|", (const uchar *const)"\\&", }; static const uchar *const specialMapParen[] = { (const uchar *const)"()", (const uchar *const)"[]", (const uchar *const)"{}", (const uchar *const)"<>", (const uchar *const)"@~", }; static const uchar *const num2Map = (const uchar *const)"67890"; static const mapElement mod2Map[] = { { Qt::Key_Backspace, 8 }, { Qt::Key_Delete, 0 }, { Qt::Key_Return, 13 }, { Qt::Key_Shift, 0 }, { myParenID, 0 }, }; static const int cursorMap[][2] = { { Qt::Key_Home, Qt::Key_PageUp }, { Qt::Key_End, Qt::Key_PageDown }, { Qt::Key_Up, Qt::Key_Up }, { Qt::Key_Left, Qt::Key_Right }, { Qt::Key_Down, Qt::Key_Down }, }; using namespace JumpX; Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : QFrame(parent, name, f), shift(0), paren(0), ctrl(0), alt(0), pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), isnoncont(false), slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), releasedPix(NULL), pressedPix(NULL) { //setPalette(QPalette(QColor(240,240,230))); // Beige! - releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("jumpx/released"); - pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("jumpx/pressed"); - pressedDigit = Resource::loadPixmap("jumpx/pressed"); + releasedPlain = releasedShift = releasedParen = Opie::Core::OResource::loadPixmap("jumpx/released"); + pressedPlain = pressedShift = pressedParen = Opie::Core::OResource::loadPixmap("jumpx/pressed"); + pressedDigit = Opie::Core::OResource::loadPixmap("jumpx/pressed"); QPixmap tmp; - tmp = Resource::loadPixmap("jumpx/releasedShift"); + tmp = Opie::Core::OResource::loadPixmap("jumpx/releasedShift"); bitBlt(&releasedShift, letterx1, 0, &tmp); - tmp = Resource::loadPixmap("jumpx/releasedParen"); + tmp = Opie::Core::OResource::loadPixmap("jumpx/releasedParen"); bitBlt(&releasedParen, specialx1, 0, &tmp); - tmp = Resource::loadPixmap("jumpx/pressedShift"); + tmp = Opie::Core::OResource::loadPixmap("jumpx/pressedShift"); bitBlt(&pressedShift, letterx1, 0, &tmp); - tmp = Resource::loadPixmap("jumpx/pressedParen"); + tmp = Opie::Core::OResource::loadPixmap("jumpx/pressedParen"); bitBlt(&pressedParen, specialx1, 0, &tmp); - tmp = Resource::loadPixmap("jumpx/pressedDigit"); + tmp = Opie::Core::OResource::loadPixmap("jumpx/pressedDigit"); bitBlt(&pressedDigit, specialx1, 0, &tmp); offscreen = QPixmap( releasedPlain ); releasedPix = &releasedPlain; pressedPix = &pressedPlain; slidePix = &pressedPlain; delayTimer = new QTimer(this); rateTimer = new QTimer(this); connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); } void Keyboard::resizeEvent(QResizeEvent*) { //cout << "resizeEvent()" << endl; } void Keyboard::paintEvent(QPaintEvent*) { bitBlt(this, 0, 0, &offscreen); } void Keyboard::mousePressEvent(QMouseEvent *e) { pressedx = -1; pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; int x = e->x(); int y = e->y(); int row = (y - 1) / letterh; if ( x <= mod1x2 ) // mod1 { pressedx = mod1x1; pressedy = row * letterh; pressedw = mod1w + 1; pressedh = letterh + 1; if ( row == 2 ) // return { pressed2x = mod2x1; pressed2y = 2 * letterh; pressed2w = mod2w + 1; pressed2h = letterh + 1; isnoncont = true; } else if ( row == 3 ) // alt alt = 1; else if ( row == 4 ) // ctrl ctrl = 1; pressedKeyUnicode = mod1Map[row].unicode; pressedKeyQcode = mod1Map[row].qcode; } else if ( x >= letterx1 && x <= letterx2 ) // letter { int column = (x - letterx1 - 1) / letterw; QChar temp; if ( shift ) temp = QChar( letterMapShift[row][column] ); else temp = QChar( letterMap[row][column] ); if ( temp == ' ' ) // space { if ( column < 3 ) { pressedx = letterx1; pressed2x = letterx1 + letterw * 4; } else { pressedx = letterx1 + letterw * 4; pressed2x = letterx1; } pressedy = pressed2y = row * letterh; pressedw = pressed2w = letterw * 2 + 1; pressedh = pressed2h = letterh + 1; isnoncont = true; } else { pressedx = letterx1 + column * letterw; pressedy = row * letterh; pressedw = letterw + 1; pressedh = letterh + 1; } pressedKeyUnicode = temp.unicode(); pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode(); if ( temp == ' ' ) { slideKeyUnicodeH = slideKeyUnicodeV = 8; slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace; } else if ( temp == temp.lower() ) { slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode(); slidePixH = slidePixV = &pressedShift; } else { slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode(); slidePixH = slidePixV = &pressedPlain; } enableMouseTracking = true; } else if ( x >= num1x1 && x <= num1x2 ) // num1 { pressedx = num1x1; pressedy = row * letterh; pressedw = num1w + 1; pressedh = letterh + 1; QChar temp = QChar( num1Map[row] ); pressedKeyUnicode = pressedKeyQcode = temp.unicode(); } else if ( x >= specialx1 && x <= specialx2 ) // special { int column = (x - specialx1 - 1) / specialw; pressedx = specialx1 + column * specialw; pressedy = row * letterh; pressedw = specialw + 1; pressedh = letterh + 1; QChar temp; if ( shift ) temp = QChar( specialMapShift[row][column] ); else if ( paren ) temp = QChar( specialMapParen[row][column] ); else temp = QChar( specialMap[row][column] ); pressedKeyUnicode = pressedKeyQcode = temp.unicode(); slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV = QChar('0').unicode() + ( 5 * column + row + 1 ) % 10; slidePixH = slidePixV = &pressedDigit; if ( shift ) { slideKeyUnicodeV = slideKeyQcodeV = QChar( specialMap[row][column] ).unicode(); slidePixV = &pressedPlain; } else if ( !(shift || paren) ) { slideKeyUnicodeV = slideKeyQcodeV = QChar( specialMapShift[row][column] ).unicode(); slidePixV = &pressedShift; } enableMouseTracking = true; } else if ( x >= num2x1 && x <= num2x2 ) // num2 { pressedx = num2x1; pressedy = row * letterh; pressedw = num2w + 1; pressedh = letterh + 1; QChar temp = QChar( num2Map[row] ); pressedKeyUnicode = pressedKeyQcode = temp.unicode(); } else if ( x >= mod2x1 && x <= mod2x2 ) // mod2 { pressedx = mod2x1; pressedy = row * letterh; pressedw = mod2w + 1; pressedh = letterh + 1; if ( row == 2 ) // return { pressed2x = mod1x1; pressed2y = 2 * letterh; pressed2w = mod2w + 1; pressed2h = letterh + 1; isnoncont = true; } pressedKeyUnicode = mod2Map[row].unicode; pressedKeyQcode = mod2Map[row].qcode; if ( row == 3 ) // shift { paren = 0; switch ( shift ) { case 0: { shift = 1; releasedPix = &releasedShift; pressedPix = &pressedShift; bitBlt( &offscreen, 0, 0, releasedPix ); break; } case 1: { shift = 2; break; } case 2: { shift = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); break; } } } else if ( row == 4 ) // parenthesis { shift = 0; switch ( paren ) { case 0: { paren = 1; releasedPix = &releasedParen; pressedPix = &pressedParen; bitBlt( &offscreen, 0, 0, releasedPix ); break; } case 1: { paren = 2; break; } case 2: { paren = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); break; } } } } else if ( x >= cursorx1 ) // cursor { int column = (x - cursorx1 - 1) / cursorw; if ( row == 2 || row == 4 ) pressedx = cursorx1 + cursorw / 2; else pressedx = cursorx1 + column * cursorw; pressedy = row * letterh; pressedw = cursorw + 1; pressedh = letterh + 1; pressedKeyQcode = cursorMap[row][column]; } pressedMod = ( shift ? Qt::ShiftButton : 0 ) | ( ctrl ? Qt::ControlButton : 0 ) | ( alt ? Qt::AltButton : 0 ); emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); delayTimer->start( autorepeatDelaytime, true ); if ( pressedx == -1 ) return; bitBlt( &offscreen, pressedx, pressedy, pressedPix, pressedx, pressedy, pressedw, pressedh ); if ( isnoncont ) bitBlt( &offscreen, pressed2x, pressed2y, pressedPix, pressed2x, pressed2y, pressed2w, pressed2h ); repaint( false ); } void Keyboard::mouseReleaseEvent(QMouseEvent*) { //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl; delayTimer->stop(); rateTimer->stop(); enableMouseTracking = false; if ( pressedx == -1 ) return; if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift ) return; if ( paren == 2 && pressedKeyQcode == myParenID ) return; if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift ) { shift = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); } if ( paren == 1 && pressedKeyQcode != myParenID ) { paren = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); } if ( alt && pressedKeyQcode != Qt::Key_Alt ) alt = 0; if ( ctrl && pressedKeyQcode != Qt::Key_Control ) ctrl = 0; bitBlt( &offscreen, pressedx, pressedy, releasedPix, pressedx, pressedy, pressedw, pressedh ); if ( isnoncont ) { isnoncont = false; bitBlt( &offscreen, pressed2x, pressed2y, releasedPix, pressed2x, pressed2y, pressed2w, pressed2h ); } repaint( false ); } void Keyboard::mouseMoveEvent(QMouseEvent *e) { if ( !enableMouseTracking ) return; if ( e->x() < pressedx || e->x() >= pressedx + pressedw ) { pressedKeyUnicode = slideKeyUnicodeH; pressedKeyQcode = slideKeyQcodeH; slidePix = slidePixH; } else if ( e->y() < pressedy || e->y() >= pressedy + pressedh ) { pressedKeyUnicode = slideKeyUnicodeV; pressedKeyQcode = slideKeyQcodeV; slidePix = slidePixV; } else return; enableMouseTracking = false; delayTimer->stop(); rateTimer->stop(); bitBlt( &offscreen, pressedx, pressedy, slidePix, pressedx, pressedy, pressedw, pressedh ); emit key( 8, Qt::Key_Backspace, pressedMod, true, false ); emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); delayTimer->start( autorepeatDelaytime, true ); repaint( false ); } void Keyboard::delayTimerDone() { emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); rateTimer->start( 1000/autorepeatRate, false ); } void Keyboard::rateTimerDone() { emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); } QSize Keyboard::sizeHint() const { return offscreen.size(); } void Keyboard::resetState() { //cout << "resetState()" << endl; } diff --git a/inputmethods/jumpx/opie-jumpx.control b/inputmethods/jumpx/opie-jumpx.control index b8664cc..30771b1 100644 --- a/inputmethods/jumpx/opie-jumpx.control +++ b/inputmethods/jumpx/opie-jumpx.control @@ -1,11 +1,11 @@ Package: opie-jumpx Files: plugins/inputmethods/libqjumpx.so* pics/jumpx Priority: optional Section: opie/inputmethods Maintainer: Markus Gritsch <gritsch@iue.tuwien.ac.at> Architecture: arm -Depends: task-opie-minimal +Depends: task-opie-minimal, libopiecore2 License: GPL Description: JumpX input method Keyboard-like input method for the Opie environment. Version: $QPE_VERSION$EXTRAVERSION diff --git a/inputmethods/kjumpx/config.in b/inputmethods/kjumpx/config.in index 8ccef5b..0c4e9d4 100644 --- a/inputmethods/kjumpx/config.in +++ b/inputmethods/kjumpx/config.in @@ -1,4 +1,4 @@ config KJUMPX boolean "opie-kjumpx (korean keyboard optimized for single finger/stylus input)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/inputmethods/kjumpx/keyboard.cpp b/inputmethods/kjumpx/keyboard.cpp index dc44805..4e99f40 100644 --- a/inputmethods/kjumpx/keyboard.cpp +++ b/inputmethods/kjumpx/keyboard.cpp @@ -1,856 +1,856 @@ /**************************************************************************************94x78** ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** *********************************************************************************************/ #include "keyboard.h" -#include <qpe/resource.h> +#include <opie2/oresource.h> //#include <iostream.h> static const int autorepeatDelaytime = 500; // ms static const int autorepeatRate = 20; // chars per second static const int mod1x1 = 0; static const int mod1x2 = 23; static const int mod1w = mod1x2 - mod1x1; static const int letterx1 = 27; static const int letterx2 = 129; static const int letterw = 17; static const int letterh = 14; static const int num1x1 = 130; static const int num1x2 = 137; static const int num1w = num1x2 - num1x1; static const int specialx1 = 138; static const int specialx2 = 170; static const int specialw = 16; static const int num2x1 = 171; static const int num2x2 = 178; static const int num2w = num2x2 - num2x1; static const int mod2x1 = 179; static const int mod2x2 = 203; static const int mod2w = mod2x2 - mod2x1; static const int cursorx1 = 207; static const int cursorw = 16; static const int myParenID = -10; typedef struct mapElement { int qcode; ushort unicode; }; static const mapElement mod1Map[] = { { Qt::Key_Escape, 27 }, { Qt::Key_Tab, 9 }, { Qt::Key_Return, 13 }, { Qt::Key_Alt, 0 }, { Qt::Key_Control, 0 }, }; static const uchar *const letterMap[] = { (const uchar *const)"zvchwk", (const uchar *const)"fitaly", (const uchar *const)" ne ", (const uchar *const)"gdorsb", (const uchar *const)"qjumpx", }; static const ushort kletterMap[][6] = { { 0x110c, 0x1112, 0x1109, 0x116d, 0x1167, 0x1163 }, { 0x110f, 0x1105, 0x1100, 0x1161, 0x1175, 0x1162 }, { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, { 0x1110, 0x1103, 0x1102, 0x1169, 0x1173, 0x1166 }, { 0x110e, 0x1107, 0x1106, 0x1111, 0x116e, 0x1172 }, }; static const uchar *const letterMapShift[] = { (const uchar *const)"ZVCHWK", (const uchar *const)"FITALY", (const uchar *const)" NE ", (const uchar *const)"GDORSB", (const uchar *const)"QJUMPX", }; static const ushort kletterMapShift[][6] = { { 0x110d, 0x1112, 0x110a, 0x116d, 0x1167, 0x1163 }, { 0x110f, 0x1105, 0x1101, 0x1161, 0x1175, 0x1164 }, { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, { 0x1110, 0x1104, 0x1102, 0x1169, 0x1173, 0x1168 }, { 0x110e, 0x1108, 0x1106, 0x1111, 0x116e, 0x1172 }, }; static const uchar *const num1Map = (const uchar *const)"12345"; static const uchar *const specialMap[] = { (const uchar *const)"-+", (const uchar *const)"*!", (const uchar *const)",'", (const uchar *const)".%", (const uchar *const)"/$", }; static const uchar *const specialMapShift[] = { (const uchar *const)"_=", (const uchar *const)"#?", (const uchar *const)";\"", (const uchar *const)":|", (const uchar *const)"\\&", }; static const uchar *const specialMapParen[] = { (const uchar *const)"()", (const uchar *const)"[]", (const uchar *const)"{}", (const uchar *const)"<>", (const uchar *const)"@~", }; static const uchar *const num2Map = (const uchar *const)"67890"; static const mapElement mod2Map[] = { { Qt::Key_Backspace, 8 }, { Qt::Key_Delete, 0 }, { Qt::Key_Return, 13 }, { Qt::Key_Shift, 0 }, { myParenID, 0 }, }; static const int cursorMap[][2] = { { Qt::Key_Home, Qt::Key_PageUp }, { Qt::Key_End, Qt::Key_PageDown }, { Qt::Key_Up, Qt::Key_Up }, { Qt::Key_Left, Qt::Key_Right }, { Qt::Key_Down, Qt::Key_Down }, }; using namespace KJumpX; Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : QFrame(parent, name, f), shift(0), paren(0), ctrl(0), alt(0), lang(1), lastKey(0), pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), isnoncont(false), slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), releasedPix(NULL), pressedPix(NULL) { //setPalette(QPalette(QColor(240,240,230))); // Beige! - releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("kjumpx/released"); - pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("kjumpx/pressed"); - pressedDigit = Resource::loadPixmap("kjumpx/pressed"); + releasedPlain = releasedShift = releasedParen = Opie::Core::OResource::loadPixmap("kjumpx/released"); + pressedPlain = pressedShift = pressedParen = Opie::Core::OResource::loadPixmap("kjumpx/pressed"); + pressedDigit = Opie::Core::OResource::loadPixmap("kjumpx/pressed"); QPixmap tmp; - tmp = Resource::loadPixmap("kjumpx/releasedShift"); + tmp = Opie::Core::OResource::loadPixmap("kjumpx/releasedShift"); bitBlt(&releasedShift, letterx1, 0, &tmp); - tmp = Resource::loadPixmap("kjumpx/releasedParen"); + tmp = Opie::Core::OResource::loadPixmap("kjumpx/releasedParen"); bitBlt(&releasedParen, specialx1, 0, &tmp); - tmp = Resource::loadPixmap("kjumpx/pressedShift"); + tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedShift"); bitBlt(&pressedShift, letterx1, 0, &tmp); - tmp = Resource::loadPixmap("kjumpx/pressedParen"); + tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedParen"); bitBlt(&pressedParen, specialx1, 0, &tmp); - tmp = Resource::loadPixmap("kjumpx/pressedDigit"); + tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedDigit"); bitBlt(&pressedDigit, specialx1, 0, &tmp); offscreen = QPixmap( releasedPlain ); releasedPix = &releasedPlain; pressedPix = &pressedPlain; slidePix = &pressedPlain; delayTimer = new QTimer(this); rateTimer = new QTimer(this); connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); } void Keyboard::resizeEvent(QResizeEvent*) { //cout << "resizeEvent()" << endl; } void Keyboard::paintEvent(QPaintEvent*) { bitBlt(this, 0, 0, &offscreen); } void Keyboard::mousePressEvent(QMouseEvent *e) { pressedx = -1; pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; int x = e->x(); int y = e->y(); int row = (y - 1) / letterh; if ( x <= mod1x2 ) // mod1 { pressedx = mod1x1; pressedy = row * letterh; pressedw = mod1w + 1; pressedh = letterh + 1; if ( row == 2 ) // return { pressed2x = mod2x1; pressed2y = 2 * letterh; pressed2w = mod2w + 1; pressed2h = letterh + 1; isnoncont = true; } else if ( row == 3 ) // alt alt = 1; else if ( row == 4 ) // ctrl ctrl = 1; pressedKeyUnicode = mod1Map[row].unicode; pressedKeyQcode = mod1Map[row].qcode; } else if ( x >= letterx1 && x <= letterx2 ) // letter { int column = (x - letterx1 - 1) / letterw; QChar temp; if (lang == 0) // english if ( shift ) temp = QChar( letterMapShift[row][column] ); else temp = QChar( letterMap[row][column] ); else if (lang == 1) // korean if ( shift ) temp = parseKoreanInput( kletterMapShift[row][column] ); else temp = parseKoreanInput( kletterMap[row][column] ); if ( temp == ' ' ) // space { if ( column < 3 ) { pressedx = letterx1; pressed2x = letterx1 + letterw * 4; } else { pressedx = letterx1 + letterw * 4; pressed2x = letterx1; } pressedy = pressed2y = row * letterh; pressedw = pressed2w = letterw * 2 + 1; pressedh = pressed2h = letterh + 1; isnoncont = true; } else { pressedx = letterx1 + column * letterw; pressedy = row * letterh; pressedw = letterw + 1; pressedh = letterh + 1; } pressedKeyUnicode = temp.unicode(); pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode(); if ( temp == ' ' ) { slideKeyUnicodeH = slideKeyUnicodeV = 8; slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace; } else if ( temp == temp.lower() ) { slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode(); slidePixH = slidePixV = &pressedShift; } else { slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode(); slidePixH = slidePixV = &pressedPlain; } enableMouseTracking = true; } else if ( x >= num1x1 && x <= num1x2 ) // num1 { pressedx = num1x1; pressedy = row * letterh; pressedw = num1w + 1; pressedh = letterh + 1; QChar temp = QChar( num1Map[row] ); pressedKeyUnicode = pressedKeyQcode = temp.unicode(); } else if ( x >= specialx1 && x <= specialx2 ) // special { int column = (x - specialx1 - 1) / specialw; pressedx = specialx1 + column * specialw; pressedy = row * letterh; pressedw = specialw + 1; pressedh = letterh + 1; QChar temp; if ( shift ) temp = QChar( specialMapShift[row][column] ); else if ( paren ) temp = QChar( specialMapParen[row][column] ); else temp = QChar( specialMap[row][column] ); pressedKeyUnicode = pressedKeyQcode = temp.unicode(); slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV = QChar('0').unicode() + ( 5 * column + row + 1 ) % 10; slidePixH = slidePixV = &pressedDigit; if ( shift ) { slideKeyUnicodeV = slideKeyQcodeV = QChar( specialMap[row][column] ).unicode(); slidePixV = &pressedPlain; } else if ( !(shift || paren) ) { slideKeyUnicodeV = slideKeyQcodeV = QChar( specialMapShift[row][column] ).unicode(); slidePixV = &pressedShift; } enableMouseTracking = true; } else if ( x >= num2x1 && x <= num2x2 ) // num2 { pressedx = num2x1; pressedy = row * letterh; pressedw = num2w + 1; pressedh = letterh + 1; QChar temp = QChar( num2Map[row] ); pressedKeyUnicode = pressedKeyQcode = temp.unicode(); } else if ( x >= mod2x1 && x <= mod2x2 ) // mod2 { pressedx = mod2x1; pressedy = row * letterh; pressedw = mod2w + 1; pressedh = letterh + 1; if ( row == 2 ) // return { pressed2x = mod1x1; pressed2y = 2 * letterh; pressed2w = mod2w + 1; pressed2h = letterh + 1; isnoncont = true; } pressedKeyUnicode = mod2Map[row].unicode; pressedKeyQcode = mod2Map[row].qcode; if ( row == 3 ) // shift { paren = 0; switch ( shift ) { case 0: { shift = 1; releasedPix = &releasedShift; pressedPix = &pressedShift; bitBlt( &offscreen, 0, 0, releasedPix ); break; } case 1: { shift = 2; break; } case 2: { shift = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); break; } } } else if ( row == 4 ) // parenthesis { shift = 0; switch ( paren ) { case 0: { paren = 1; releasedPix = &releasedParen; pressedPix = &pressedParen; bitBlt( &offscreen, 0, 0, releasedPix ); break; } case 1: { paren = 2; break; } case 2: { paren = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); break; } } } } else if ( x >= cursorx1 ) // cursor { int column = (x - cursorx1 - 1) / cursorw; if ( row == 2 || row == 4 ) pressedx = cursorx1 + cursorw / 2; else pressedx = cursorx1 + column * cursorw; pressedy = row * letterh; pressedw = cursorw + 1; pressedh = letterh + 1; pressedKeyQcode = cursorMap[row][column]; } pressedMod = ( shift ? Qt::ShiftButton : 0 ) | ( ctrl ? Qt::ControlButton : 0 ) | ( alt ? Qt::AltButton : 0 ); lastKey = pressedKeyUnicode; emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); delayTimer->start( autorepeatDelaytime, true ); if ( pressedx == -1 ) return; bitBlt( &offscreen, pressedx, pressedy, pressedPix, pressedx, pressedy, pressedw, pressedh ); if ( isnoncont ) bitBlt( &offscreen, pressed2x, pressed2y, pressedPix, pressed2x, pressed2y, pressed2w, pressed2h ); repaint( false ); } void Keyboard::mouseReleaseEvent(QMouseEvent*) { //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl; delayTimer->stop(); rateTimer->stop(); enableMouseTracking = false; if ( pressedx == -1 ) return; if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift ) return; if ( paren == 2 && pressedKeyQcode == myParenID ) return; if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift ) { shift = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); } if ( paren == 1 && pressedKeyQcode != myParenID ) { paren = 0; releasedPix = &releasedPlain; pressedPix = &pressedPlain; bitBlt( &offscreen, 0, 0, releasedPix ); } if ( alt && pressedKeyQcode != Qt::Key_Alt ) alt = 0; if ( ctrl && pressedKeyQcode != Qt::Key_Control ) ctrl = 0; bitBlt( &offscreen, pressedx, pressedy, releasedPix, pressedx, pressedy, pressedw, pressedh ); if ( isnoncont ) { isnoncont = false; bitBlt( &offscreen, pressed2x, pressed2y, releasedPix, pressed2x, pressed2y, pressed2w, pressed2h ); } repaint( false ); } void Keyboard::mouseMoveEvent(QMouseEvent *e) { if ( !enableMouseTracking ) return; if ( e->x() < pressedx || e->x() >= pressedx + pressedw ) { pressedKeyUnicode = slideKeyUnicodeH; pressedKeyQcode = slideKeyQcodeH; slidePix = slidePixH; } else if ( e->y() < pressedy || e->y() >= pressedy + pressedh ) { pressedKeyUnicode = slideKeyUnicodeV; pressedKeyQcode = slideKeyQcodeV; slidePix = slidePixV; } else return; enableMouseTracking = false; delayTimer->stop(); rateTimer->stop(); bitBlt( &offscreen, pressedx, pressedy, slidePix, pressedx, pressedy, pressedw, pressedh ); emit key( 8, Qt::Key_Backspace, pressedMod, true, false ); emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); delayTimer->start( autorepeatDelaytime, true ); repaint( false ); } void Keyboard::delayTimerDone() { emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); rateTimer->start( 1000/autorepeatRate, false ); } void Keyboard::rateTimerDone() { emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); } QSize Keyboard::sizeHint() const { return offscreen.size(); } void Keyboard::resetState() { //cout << "resetState()" << endl; } /* * * 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 a kor/eng swaping key * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * how korean input works * * all following chars means unicode char value and are in hex * - * ÃÊÀ½ = schar (start char) - * ÁßÀ½ = mchar (middle char) - * ³¡À½ = echar (end char) + * �= = schar (start char) + * �= = mchar (middle char) + * = = echar (end char) * * there are 19 schars. unicode position is at 1100 - 1112 * there are 21 mchars. unicode position is at 1161 - 1175 * there are 27 echars. unicode position is at 11a8 - 11c2 * * the map with everything combined is at ac00 - d7a3 * * to find a combination of schar + mchar in the map, lookup * ((schar - 0x1100) * 587) + ((mchar - 0x1161) * 27) + (echar - 0x11a8) + 0xac00) * */ QChar Keyboard::parseKoreanInput (ushort c) { static ushort schar, mchar, echar; if ((lastKey < 0x1100 || 0x11c2 < lastKey) && (lastKey < 0xac00 || 0xd7a3 < lastKey) && !(lastKey == 0 && (shift || paren || ctrl || alt))) { //printf ("reset...\n"); schar = 0, mchar = 0, echar = 0; } //printf ("in %x %x %x %x %x\n", schar, mchar, echar, c, lastKey); if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input if (schar == 0 || (schar != 0 && mchar == 0)) { schar = c; mchar = 0; echar = 0; return QChar(c); } else if (mchar != 0) { if (echar == 0) { if (!(echar = constoe(c))) { schar = c; mchar = 0; echar = 0; return QChar(c); } } else { // must figure out what the echar is - if (echar == 0x11a8) { // ¤¡ + if (echar == 0x11a8) { // - if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡ - else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ + if (c == 0x1100) echar = 0x11a9; // + + else if (c == 0x1109) echar = 0x11aa; // + else { schar = c; mchar = 0; echar = 0; return QChar(c); } - } else if (echar == 0x11ab) { // ¤¤ + } else if (echar == 0x11ab) { // - if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸ - else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾ + if (c == 0x110c) echar = 0x11ac; // + + else if (c == 0x1112) echar = 0x11ad; // + else { schar = c; mchar = 0; echar = 0; return QChar(c); } - } else if (echar == 0x11af) { // ¤© + } else if (echar == 0x11af) { // - if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡ - else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤± - else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤² - else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ - else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼ - else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½ - else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾ + if (c == 0x1100) echar = 0x11b0; // + + else if (c == 0x1106) echar = 0x11b1; // + + else if (c == 0x1107) echar = 0x11b2; // + + else if (c == 0x1109) echar = 0x11b3; // + + else if (c == 0x1110) echar = 0x11b4; // + + else if (c == 0x1111) echar = 0x11b5; // + + else if (c == 0x1112) echar = 0x11b6; // + else { schar = c; mchar = 0; echar = 0; return QChar(c); } - } else if (echar == 0x11b8) { // ¤² + } else if (echar == 0x11b8) { // - if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ + if (c == 0x1109) echar = 0x11b9; // + else { schar = c; mchar = 0; echar = 0; return QChar(c); } - } else if (echar == 0x11ba) { // ¤µ + } else if (echar == 0x11ba) { // - if (c == 0x1109) echar = 0x11bb; // ¤µ + ¤µ + if (c == 0x1109) echar = 0x11bb; // + else { schar = c; mchar = 0; echar = 0; return QChar(c); } } else { // if any other char, cannot combine chars schar = c; mchar = 0; echar = 0; return QChar(c); } lastKey = echar; } } } else if (0x1161 <= c && c <= 0x1175) { // mchar was input if (schar != 0 && mchar == 0) { mchar = c; } else if (schar != 0 && mchar != 0 && echar == 0) { switch (mchar) { case 0x1169: if (c == 0x1161) mchar = 0x116a; else if (c == 0x1162) mchar = 0x116b; else if (c == 0x1175) mchar = 0x116c; else { schar = 0; mchar = 0; echar = 0; return QChar(c); } break; case 0x116e: if (c == 0x1165) mchar = 0x116f; else if (c == 0x1166) mchar = 0x1170; else if (c == 0x1175) mchar = 0x1171; else { schar = 0; mchar = 0; echar = 0; return QChar(c); } break; case 0x1173: if (c == 0x1175) mchar = 0x1174; else { schar = 0; mchar = 0; echar = 0; return QChar(c); } break; default: schar = 0; mchar = 0; echar = 0; return QChar(c); } } else if (schar != 0 && mchar != 0 && echar != 0) { emit key( 8, Qt::Key_Backspace, 0, true, false ); ushort prev = 0; switch (echar) { /* case 0x11a9: prev = combineKoreanChars(schar, mchar, 0x11a8); schar = 0x1100; break; */ case 0x11aa: prev = combineKoreanChars(schar, mchar, 0x11a8); schar = 0x1109; break; case 0x11ac: prev = combineKoreanChars(schar, mchar, 0x11ab); schar = 0x110c; break; case 0x11ad: prev = combineKoreanChars(schar, mchar, 0x11ab); schar = 0x1112; break; case 0x11b0: prev = combineKoreanChars(schar, mchar, 0x11af); schar = 0x1100; break; case 0x11b1: prev = combineKoreanChars(schar, mchar, 0x11af); schar = 0x1106; break; case 0x11b2: prev = combineKoreanChars(schar, mchar, 0x11af); schar = 0x1107; break; case 0x11b3: prev = combineKoreanChars(schar, mchar, 0x11af); schar = 0x1109; break; case 0x11b4: prev = combineKoreanChars(schar, mchar, 0x11af); schar = 0x1110; break; case 0x11b9: prev = combineKoreanChars(schar, mchar, 0x11b8); schar = 0x1109; break; /* case 0x11bb: prev = combineKoreanChars(schar, mchar, 0x11ba); schar = 0x1109; break; */ default: if (constoe(echar)) { prev = combineKoreanChars(schar, mchar, 0); schar = constoe(echar); } break; } emit key( prev, prev, 0, true, false ); mchar = c; echar = 0; return QChar(combineKoreanChars(schar, mchar, 0)); } else { schar = 0; mchar = 0; echar = 0; return QChar(c); } } else if (c == ' ') return QChar(c); // and now... finally delete previous char, and return new char emit key( 8, Qt::Key_Backspace, 0, true, false ); //printf ("out %x %x %x %x\n", schar, mchar, echar, c); return QChar (combineKoreanChars( schar, mchar, echar)); } ushort Keyboard::combineKoreanChars(const ushort s, const ushort m, const ushort e) { return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00; } ushort Keyboard::constoe(const ushort c) { // converts schars to echars if possible if (0x1100 <= c && c <= 0x1112) { // schar to echar switch (c) { case 0x1100: return 0x11a8; case 0x1101: return 0x11a9; case 0x1102: return 0x11ab; case 0x1103: return 0x11ae; case 0x1105: return 0x11af; case 0x1106: return 0x11b7; case 0x1107: return 0x11b8; case 0x1109: return 0x11ba; case 0x110a: return 0x11bb; case 0x110b: return 0x11bc; case 0x110c: return 0x11bd; case 0x110e: return 0x11be; case 0x110f: return 0x11bf; case 0x1110: return 0x11c0; case 0x1111: return 0x11c1; case 0x1112: return 0x11c2; default: return 0; } } else { //echar to schar switch (c) { case 0x11a8: return 0x1100; case 0x11a9: return 0x1101; case 0x11ab: return 0x1102; case 0x11ae: return 0x1103; case 0x11af: return 0x1105; case 0x11b7: return 0x1106; case 0x11b8: return 0x1107; case 0x11ba: return 0x1109; case 0x11bb: return 0x110a; case 0x11bc: return 0x110b; case 0x11bd: return 0x110c; case 0x11be: return 0x110e; case 0x11bf: return 0x110f; case 0x11c0: return 0x1110; case 0x11c1: return 0x1111; case 0x11c2: return 0x1112; default: return 0; } } } diff --git a/inputmethods/kjumpx/kjumpx.pro b/inputmethods/kjumpx/kjumpx.pro index 09e9bf1..0f708fd 100644 --- a/inputmethods/kjumpx/kjumpx.pro +++ b/inputmethods/kjumpx/kjumpx.pro @@ -1,15 +1,15 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ keyboardimpl.h SOURCES = keyboard.cpp \ keyboardimpl.cpp TARGET = qkjumpx DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 VERSION = 1.0.0 include( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/kjumpx/opie-kjumpx.control b/inputmethods/kjumpx/opie-kjumpx.control index 3650812..a9d004e 100644 --- a/inputmethods/kjumpx/opie-kjumpx.control +++ b/inputmethods/kjumpx/opie-kjumpx.control @@ -1,11 +1,11 @@ Package: opie-kjumpx Files: plugins/inputmethods/libqkjumpx.so* pics/kjumpx/* Priority: optional Section: opie/inputmethods Maintainer: Jake Richardson <jake@asdfnews.org> Architecture: arm -Depends: task-opie-minimal +Depends: task-opie-minimal, libopiecore2 License: GPL Description: Koreanized JumpX input method Keyboard-like input method for the Opie environment. Version: $QPE_VERSION$EXTRAVERSION diff --git a/inputmethods/multikey/config.in b/inputmethods/multikey/config.in index 4eeb326..dd3192b 100644 --- a/inputmethods/multikey/config.in +++ b/inputmethods/multikey/config.in @@ -1,4 +1,4 @@ config MULTIKEY boolean "opie-multikey (OnScreen keyboard for multiple languages)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && PICKBOARD && LIBQTAUX && LIBOPIE2UI + depends ( LIBQPE || LIBQPE-X11 ) && PICKBOARD && LIBQTAUX && LIBOPIE2CORE && LIBOPIE2UI diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index fe5051d..52c498b 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp @@ -1,508 +1,511 @@ /* * TODO * make a font selection thing (size too) * make a keymap editor * make keys translucent * make vertical keys possible * * */ +#include <opie2/ofiledialog.h> +#include <opie2/qcolordialog.h> +#include <opie2/oresource.h> + #include <qpe/qpeapplication.h> #include <qpe/config.h> -#include <qpe/resource.h> #include <qlayout.h> #include <qwidget.h> #include <qdialog.h> #include <qtabwidget.h> #include <qvbox.h> #include <qgrid.h> #include <qgroupbox.h> #include <qlabel.h> #include <qcheckbox.h> #include <qsizepolicy.h> #include <qpushbutton.h> #include <qlistbox.h> #include <qstringlist.h> #include <qtoolbutton.h> -#include <opie2/ofiledialog.h> -#include <opie2/qcolordialog.h> #include <qdir.h> #include <qfileinfo.h> #include "configdlg.h" #include "keyboard.h" using namespace Opie; using namespace Opie::Ui; // ConfigDlg::ConfigDlg() {{{1 ConfigDlg::ConfigDlg () : QDialog () { setCaption( tr("Multikey Configuration") ); Config config ("multikey"); config.setGroup("keymaps"); QString current_map = config.readEntry("current", 0); /* * 'general config' tab */ QVBoxLayout *base_lay = new QVBoxLayout(this); QTabWidget *tabs = new QTabWidget(this, "tabs"); QWidget *gen_box = new QWidget(tabs, "gen_tab"); QVBoxLayout *gen_lay = new QVBoxLayout(gen_box); gen_lay->setMargin(3); QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); QHBox *hbox1 = new QHBox(map_group); keymaps = new QListBox(hbox1); keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); QVBox *vbox1 = new QVBox(hbox1); QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up")); - tb1->setPixmap(Resource::loadPixmap("up")); + tb1->setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); + tb1->setPixmap(Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon)); tb1->setAutoRaise(TRUE); tb1->setFocusPolicy(QWidget::NoFocus); tb1->setToggleButton(FALSE); connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down")); - tb2->setPixmap(Resource::loadPixmap("down")); + tb2->setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); + tb2->setPixmap(Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon)); tb2->setAutoRaise(TRUE); tb2->setFocusPolicy(QWidget::NoFocus); tb2->setToggleButton(FALSE); connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); QString cur(tr("Current Language")); keymaps->insertItem(cur); keymaps->setSelected(0, true); QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); default_maps = map_dir.entryList(); // so i can access it in other places custom_maps = config.readListEntry("maps", QChar('|')); sw_maps = ConfigDlg::loadSw(); QStringList sw_copy(sw_maps); for (uint i = 0; i < sw_copy.count(); i++) { QString keymap_map; if (sw_copy[i][0] != '/') { /* share/multikey */ keymap_map = map_dir.absPath() + "/" + sw_copy[i]; } else { if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false) || !QFile::exists(sw_copy[i])) { custom_maps.remove(sw_copy[i]); sw_maps.remove(sw_copy[i]); // remove it from the list too config.writeEntry("maps", custom_maps.join("|")); continue; } keymap_map = sw_copy[i]; } QFile map(keymap_map); if (map.open(IO_ReadOnly)) { QString line; bool found = 0; map.readLine(line, 1024); while (!map.atEnd()) { if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); found = 1; break; } map.readLine(line, 1024); } if (!found) keymaps->insertItem(keymap_map); map.close(); } if (keymap_map == current_map) { keymaps->setSelected(i + 1, true); } } // have to "+1" because the "current language" listItem... remember? connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); QGrid *add_remove_grid = new QGrid(2, map_group); add_remove_grid->setMargin(3); add_remove_grid->setSpacing(3); add_button = new QPushButton(tr("Add"), add_remove_grid); add_button->setFlat(TRUE); connect(add_button, SIGNAL(clicked()), SLOT(addMap())); remove_button = new QPushButton(tr("Remove"), add_remove_grid); remove_button->setFlat(TRUE); if (keymaps->currentItem() == 0 || default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end()) remove_button->setDisabled(true); connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); gen_lay->addWidget(map_group); // make a box that will contain the buttons on the bottom QGrid *other_grid = new QGrid(2, gen_box); pick_button = new QCheckBox(tr("Pickboard"), other_grid); config.setGroup ("general"); bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed if (pick_open) { pick_button->setChecked(true); } repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); bool repeat_on = config.readBoolEntry ("useRepeat", TRUE); if (repeat_on) { repeat_button->setChecked(true); } gen_lay->addWidget(other_grid); tabs->addTab(gen_box, tr("General Settings")); /* * 'color' tab */ QWidget *color_box = new QWidget(tabs, "color_tab"); QGridLayout *color_lay = new QGridLayout(color_box); QGrid *color_grid = new QGrid(2, color_box); color_lay->setAlignment(Qt::AlignTop); color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); color_grid->layout()->setAlignment(Qt::AlignTop); color_grid->setMargin(3); color_grid->setSpacing(3); QLabel *label; QStringList color; config.setGroup("colors"); label = new QLabel(tr("Key Color"), color_grid); keycolor_button = new QPushButton(color_grid); connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); keycolor_button->setFlat(TRUE); color = config.readListEntry("keycolor", QChar(',')); /* * hopefully not required if (color.isEmpty()) { color = QStringList::split(",", "240,240,240"); config.writeEntry("keycolor", color.join(",")); } */ keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); label = new QLabel(tr("Key Pressed Color"), color_grid); keycolor_pressed_button = new QPushButton(color_grid); connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); keycolor_pressed_button->setFlat(TRUE); color = config.readListEntry("keycolor_pressed", QChar(',')); keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); label = new QLabel(tr("Line Color"), color_grid); keycolor_lines_button = new QPushButton(color_grid); connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); keycolor_lines_button->setFlat(TRUE); color = config.readListEntry("keycolor_lines", QChar(',')); keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); label = new QLabel(tr("Text Color"), color_grid); textcolor_button = new QPushButton(color_grid); connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); textcolor_button->setFlat(TRUE); color = config.readListEntry("textcolor", QChar(',')); textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); label = new QLabel("", color_grid); // a spacer so the above buttons dont expand label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); /* FIXME: hacked spacer height */ QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); color_lay->addWidget(color_grid, 0, 0); color_lay->addItem(spacer); tabs->addTab(color_box, tr("Colors")); base_lay->addWidget(tabs); } QStringList ConfigDlg::loadSw() { Config *config = new Config("multikey"); config->setGroup("keymaps"); QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); QStringList d_maps = map_dir.entryList(); // so i can access it in other places QStringList c_maps = config->readListEntry("maps", QChar('|')); QStringList s_maps = config->readListEntry("sw", QChar('|')); delete config; if (!s_maps.count()) { s_maps = d_maps+c_maps; } else { /* Clear non existents entries */ QStringList s_copy(s_maps); for (uint i = 0; i < s_copy.count(); ++i) { if (d_maps.find(s_copy[i]) == d_maps.end() && c_maps.find(s_copy[i]) == c_maps.end()) { s_maps.remove(s_copy[i]); } } /* Update sw_maps from default_maps */ for (uint i = 0; i < d_maps.count(); ++i) { if (s_maps.find(d_maps[i]) == s_maps.end()) { s_maps.append(d_maps[i]); } } /* Update sw_maps from custom_maps */ for (uint i = 0; i < c_maps.count(); ++i) { if (s_maps.find(c_maps[i]) == s_maps.end()) { s_maps.append(c_maps[i]); } } } return s_maps; } void ConfigDlg::accept() { /* Writing all stuffs to config */ Config *config = new Config("multikey"); config->setGroup("general"); config->writeEntry("usePickboard", pick_button->isChecked()); // default closed config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed config->setGroup("keymaps"); config->writeEntry("sw", sw_maps, QChar('|')); config->writeEntry("maps", custom_maps, QChar('|')); delete config; int index = keymaps->currentItem(); if (index == 0) { remove_button->setDisabled(true); emit setMapToDefault(); } else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { remove_button->setDisabled(true); emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]); } else { remove_button->setEnabled(true); emit setMapToFile(sw_maps[index - 1]); } emit pickboardToggled(pick_button->isChecked()); emit repeatToggled(repeat_button->isChecked()); emit reloadSw(); QDialog::accept(); emit configDlgClosed(); } void ConfigDlg::moveSelectedUp() { int i = keymaps->currentItem(); /* Ignore Current Language */ if (i > 1) { QString t = sw_maps[i-1]; sw_maps[i-1] = sw_maps[i-2]; sw_maps[i-2] = t; QString item = keymaps->currentText(); keymaps->removeItem(i); keymaps->insertItem(item, i-1); keymaps->setCurrentItem(i-1); } } void ConfigDlg::moveSelectedDown() { int i = keymaps->currentItem(); /* Ignore Current Language */ if (i > 0 && i < (int)keymaps->count() - 1) { QString t = sw_maps[i-1]; sw_maps[i-1] = sw_maps[i]; sw_maps[i] = t; QString item = keymaps->currentText(); keymaps->removeItem(i); keymaps->insertItem(item, i+1); keymaps->setCurrentItem(i+1); } } void ConfigDlg::closeEvent(QCloseEvent *) { // tell the parent it was closed, so delete me emit configDlgClosed(); } void ConfigDlg::setMap(int index) { if (index == 0 || default_maps.find(sw_maps[index-1]) != default_maps.end()) { remove_button->setDisabled(true); } else { remove_button->setEnabled(true); } } // ConfigDlg::addMap() {{{1 void ConfigDlg::addMap() { QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); if (map.isNull()) return; Config config ("multikey"); config.setGroup("keymaps"); QStringList maps = config.readListEntry("maps", QChar('|')); maps.append(map); custom_maps.append(map); if (sw_maps.find(map) == sw_maps.end()) sw_maps.append(map); QFile map_file (map); if (map_file.open(IO_ReadOnly)) { QString line; bool found = 0; map_file.readLine(line, 1024); while (!map_file.atEnd()) { if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); found = 1; break; } map_file.readLine(line, 1024); } if (!found) keymaps->insertItem(map); map_file.close(); } keymaps->setSelected(keymaps->count() - 1, true); } // ConfigDlg::removeMap() {{{1 void ConfigDlg::removeMap() { // move selection up one keymaps->setSelected(keymaps->currentItem() - 1, true); // delete the next selected item cus you just moved it up keymaps->removeItem(keymaps->currentItem() + 1); custom_maps.remove(sw_maps[keymaps->currentItem()]); sw_maps.remove(sw_maps.at(keymaps->currentItem())); } /* ConfigDlg::slots for the color buttons {{{1 * * these four slots are almost the same, except for the names. i was thinking * of making a map with pointers to the buttons and names of the configEntry * so it could be one slot, but then there would be no way of telling which * of the buttons was clicked if they all connect to the same slot. * */ void ConfigDlg::keyColorClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("keycolor", QChar(',')); QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("keycolor", color, QChar(',')); config.write(); keycolor_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } void ConfigDlg::keyColorPressedClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("keycolor_pressed", color, QChar(',')); config.write(); keycolor_pressed_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } void ConfigDlg::keyColorLinesClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("keycolor_lines", QChar(',')); QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("keycolor_lines", color, QChar(',')); config.write(); keycolor_lines_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } void ConfigDlg::textColorClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("textcolor", QChar(',')); QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("textcolor", color, QChar(',')); config.write(); textcolor_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro index 3fd621f..4ad1923 100644 --- a/inputmethods/multikey/multikey.pro +++ b/inputmethods/multikey/multikey.pro @@ -1,18 +1,18 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ configdlg.h \ keyboardimpl.h SOURCES = keyboard.cpp \ configdlg.cpp \ keyboardimpl.cpp TARGET = qmultikey DESTDIR = $(OPIEDIR)/plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../../launcher -LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopieui2 +LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopiecore2 -lopieui2 QMAKE_LFLAGS += -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods VERSION = 1.0.0 include( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/multikey/opie-multikey.control b/inputmethods/multikey/opie-multikey.control index 5a5ce77..fc7d56c 100644 --- a/inputmethods/multikey/opie-multikey.control +++ b/inputmethods/multikey/opie-multikey.control @@ -1,10 +1,10 @@ Package: opie-multikey Files: plugins/inputmethods/libqmultikey.so* share/multikey/* Priority: optional Section: opie/inputmethods Maintainer: Jake Richardson (jake@asdfnews.org) Architecture: arm -Depends: task-opie-minimal, opie-pickboard, libqtaux2 +Depends: task-opie-minimal, opie-pickboard, libqtaux2, libopiecore2, libopieui2 Description: Multiple language keyboard Keyboard for inputing multiple languages in the Opie environment. Version: $QPE_VERSION$EXTRAVERSION |