-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | inputmethods/dvorak/dvorak.cpp | 13 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboard.cpp | 13 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 6 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboard.cpp | 15 | ||||
-rw-r--r-- | inputmethods/unikeyboard/unikeyboard.cpp | 12 |
6 files changed, 45 insertions, 17 deletions
@@ -1,184 +1,185 @@ 2005-??-?? Opie 1.2.0 New Features ------------ Fixed Bugs ---------- - * #1501 - Fixing bug in todo sql backend (eilers) + * #1501 - Fixed bug in todo sql backend (eilers) + * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) Internal -------- * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 2004-11-26 Opie 1.1.8 New Features ------------ * PackageManager supports installation of local ipkg files (drw) * PackageManager supports linking of applications to root (drw) * PackageManager supports src/gz feeds (drw,wimpie) * Added a syslog information tab to sysinfo (mickeyl) * Added new, more consistent, PIM icons + a GIMP teplate (ar) Fixed Bugs ---------- * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) * #1269 - VCards were imported into personal area if it was activated (eilers) * #1464 - Packagemanager dont set active filter after install a package (drw) * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) * #1493 - Fixed one column layout bug of the launcher (hrw) * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) Internal -------- * Moved libopie1 to unsupported (mickeyl) * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) 2004-11-14 Opie 1.1.7 New Features ------------ * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) * Backup now uses the busy indicator when backing up and restore (ar) * OpiePlayer2 gained adding of Directories to the playlist (zecke) * OpiePlayer2 better error handling (zecke) * OpiePlayer2 progress indication while streaming (zecke) * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) * Ported brightnessapplet from Qtopia 1.7 (mickeyl) * Opie-Eye got a Digital Camera File Backend (alwin,zecke) * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) * Opie-Console use Custom Font and Size in a Profile (harlekin) * Opie-Console transparently log the Output and Input to a file (harlekin) * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) * Opie-Security gained a 'test authentication' button (clem) * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults * Opie-Mail improve the handling of POP mail boxes (alwin) * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) * Opie IRC - backports of the 'NeIRC fork' (zecke) Fixed Bugs ---------- * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) * #608 - Make Opie usable for left handed users (zecke) * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) * #1245 - Opie-Go 'paused' (zecke) * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) * #1395 - Build VNC Backend with gcc3.4 * #1440 - The icon of opie-mobilemsg is missing (CoreDump) * #1426 - Add missing opie-bartender Icon (CoreDump) * #1445 - Opie-Sheet Has No Icon (CoreDump) * #1448 - Brightness Applet added (mickeyl) * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) * #1482 - Fix OFileSelector to be able to sort by size (zecke) * n.a. - Opie-mail: fixed some crasher, some layout-problems * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) Internal -------- * Opie-Qashmoney has been moved to unsupported (mickeyl) * Opie-Ubrowser has been moved to unsupported (mickeyl) 2004-09-17 Opie 1.1.6 New Features ------------ * Fifteen gained configurable number of items (zecke) * Fifteen can have custom background images (zecke) * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) * Integrated the new security framework into libopie2 (zecke,clem) * Converted the launcher to use the new security framework (zecke) * Backup can now handle custom locations for backup and restore (ar) * Implemented right-on-hold feedback (wimpie,zecke) * Lots of new features in opie-reader (tim,pohly) * Build system cleanups (schurig) Fixed Bugs -------- * #1005 - Fixed backup to CompactFlash (ar) * #1167 - Fixed Opie write crashing on more text than one page (ar) * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) * #1359 - Fixed bookmarks in Gutenbrowser (ljp) * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) * #1370 - Pimconverter now reacts on cancel key (eilers) * #1376 - Bring back the capslock/numlock display (zecke) * #1383 - Language settings now warns about losing open apps (Markus Litz) * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) * #1394 - Fixed oversized headline in opie-login (coredump) * #1396 - Opie-console captures the escape key and vim is working (zecke) * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) 2004-07-06 Opie 1.1.4 New Features ------------ * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) * Added Conversion tool for pim-data (eilers) * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) * Modified the PIM API for providing generic use of OPimRecords (eilers) * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) Fixed Bugs -------- * #1068 - Country Drop Down Box Off Screen * #1291 - Opie tinykate does not open .desktop files (ar) * #1291 - Opie sheet not saving correctly (ar) * #1294 - Opie does not know about British Summer Time * #1314 - Drawpad initialization (mickeyl) * #1317 - Packagemanager crashes on hold-down or install (chicken) * #1321 - Batteryapplet graphic glitch (harlekin) * #1324 - ZSafe not starting up (mickeyl) * #1328 - Personal Home Address fields is trimmed to 1char (eilers) * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) * #1348 - Datebook dependency on libopiedb2 (chicken) * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) 2004-04-25 Opie 1.1.3 * Introduced first implementation of SQL-Support using SQLite (eilers) * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) * Added a real system graffiti character set (brad) * Added Generic Keyconfig Widget (zecke) * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) * Added new Bible reader app - opie-dagger (drw) * Added a new Image Viewer. Work is ongoing (zecke,alwin) * Added namespace usage in libopie2 and everywhere (zecke,alwin) * Enabled the possibility to pass command line arguments to applications (mickeyl) * Added an about applet showing some credits and information about Opie (mickeyl) * Added benchmarking functionality to sysinfo (mickeyl) * Added applet and configuration application for switching hardware keyboard layouts (alwin) * Ported applications from libopie1 to libopie2* (drw,ar,alwin) * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) * Clean-up of package information in control files (drw) * Repaired mediummount which was broken since integrating the quicklauncher (alwin) * Improved big-screen support (zecke,ar) * Improved multikeyboard support, added keyboard layout switching applet (mouse) * Added a new mail client based on libetpan (harlekin,alwin,jgf) * Added new package manager - opie-packagemanager (drw) * Improved light-n-power for C7x0 (mickeyl) * Added automatic rotation support for C7x0 (treke) * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 2003-11-29 Opie 1.0.3 * Released as Version 1.0.3 * Improved i18n (various contributors) * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) * Made the Documents Tab optional (mickeyl) * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 2003-08-04 Opie 1.0.0 * Released as Version 1.0.0 * Including a PPP module for easy dial up (tille,harlekin,zecke) diff --git a/inputmethods/dvorak/dvorak.cpp b/inputmethods/dvorak/dvorak.cpp index 2137f22..3781e38 100644 --- a/inputmethods/dvorak/dvorak.cpp +++ b/inputmethods/dvorak/dvorak.cpp @@ -1,432 +1,439 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** 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 "dvorak.h" #include <qpe/global.h> - +#include <qpe/config.h> #include <qwindowsystem_qws.h> #include <qpainter.h> #include <qfontmetrics.h> #include <qtimer.h> #include <ctype.h> #define USE_SMALL_BACKSPACE using namespace Dvorak; Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), unicode(-1), qkeycode(0), modifiers(0) { // setPalette(QPalette(QColor(240,240,230))); // Beige! // setFont( QFont( "Helvetica", 8 ) ); // setPalette(QPalette(QColor(200,200,200))); // Gray setPalette(QPalette(QColor(220,220,220))); // Gray + // get the default font + Config *config = new Config( "qpe" ); + config->setGroup( "Appearance" ); + QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); + int fontSize = config->readNumEntry( "FontSize", 10 ); + delete config; + picks = new KeyboardPicks( this ); - picks->setFont( QFont( "smallsmooth", 9 ) ); - setFont( QFont( "smallsmooth", 9 ) ); + picks->setFont( QFont( familyStr, fontSize ) ); + setFont( QFont( familyStr, fontSize ) ); picks->initialise(); QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); repeatTimer = new QTimer( this ); connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); } void Keyboard::resizeEvent(QResizeEvent*) { int ph = picks->sizeHint().height(); picks->setGeometry( 0, 0, width(), ph ); keyHeight = (height()-ph)/5; int nk; if ( useOptiKeys ) { nk = 15; } else if ( useLargeKeys ) { nk = 15; } else { nk = 19; } defaultKeyWidth = width()/nk; xoffs = (width()-defaultKeyWidth*nk)/2; } void KeyboardPicks::initialise() { setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); mode = 0; dc = new KeyboardConfig(this); configs.append(dc); } QSize KeyboardPicks::sizeHint() const { return QSize(240,fontMetrics().lineSpacing()); } void KeyboardConfig::generateText(const QString &s) { #if defined(Q_WS_QWS) || defined(_WS_QWS_) for (int i=0; i<(int)backspaces; i++) { parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); } for (int i=0; i<(int)s.length(); i++) { parent->emitKey( s[i].unicode(), 0, 0, true, false ); parent->emitKey( s[i].unicode(), 0, 0, false, false ); } parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); backspaces = 0; #endif } //PC keyboard layout and scancodes /* Format: length, code, length, code, ..., 0 length is measured in half the width of a standard key. If code < 0x80 we have length/2 consecutive standard keys, starting with scancode code. Special keys are hardcoded, one at a time, with length of key and code >= 0x80, these are NOT standard PC scancodes, but are looked up in specialM[]. (The special keys are not keymappable.) */ static const uchar * const keyboard_opti[5] = { (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" }; static const uchar * const keyboard_standard[5] = { #ifdef USE_SMALL_BACKSPACE (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\002\200\002\223\002\215\002\216\002\217", #else (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\004\200\002\223\002\215\002\216\002\217", #endif //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222", //TAB + qwerty.. + backslash //+ DEL + END + PGDN (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", //CAPS + asdf.. + RETURN (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", //SHIFT + zxcv... //+ UP (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT }; struct ShiftMap { char normal; char shifted; }; static const ShiftMap shiftMap[] = { { '`', '~' }, { '1', '!' }, { '2', '@' }, { '3', '#' }, { '4', '$' }, { '5', '%' }, { '6', '^' }, { '7', '&' }, { '8', '*' }, { '9', '(' }, { '0', ')' }, { '-', '_' }, { '=', '+' }, { '\\', '|' }, { '[', '{' }, { ']', '}' }, { ';', ':' }, { '\'', '"' }, { ',', '<' }, { '.', '>' }, { '/', '?' } }; /* XPM */ static const char * const uparrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "....a....", "...aaa...", "..aaaaa..", "....a....", "....a....", "....a....", "....a....", "........."}; /* XPM */ static const char * const leftarrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", "...a.....", "..aa.....", ".aaaaaaa.", "..aa.....", "...a.....", ".........", "........."}; /* XPM */ static const char * const downarrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "....a....", "....a....", "....a....", "....a....", "..aaaaa..", "...aaa...", "....a....", "........."}; /* XPM */ static const char * const rightarrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".....a...", ".....aa..", ".aaaaaaa.", ".....aa..", ".....a...", ".........", "........."}; /* XPM */ static const char * const insert_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "a........", "a.aaa.aaa", "a.a.a.a..", "a.a.a..a.", "a.a.a...a", "a.a.a.aaa", ".........", "........."}; /* XPM */ static const char * const delete_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "aa......a", "a.a.aaa.a", "a.a.a.a.a", "a.a.aaa.a.", "a.a.a...a", "aaa.aaa.a", ".........", "........."}; /* XPM */ static const char * const home_xpm[]={ "9 9 2 1", "a c #000000", ". c None", "....a....", "...a.a...", "..a...a..", ".a.....a.", "aa.aaa.aa", ".a.a.a.a.", ".a.a.a.a.", ".aaaaaaa.", "........."}; /* XPM */ static const char * const end_xpm[]={ "10 9 2 1", "a c #000000", ". c None", "..........", "aa.......a", "a..aaa.aaa", "aa.a.a.a.a", "a..a.a.a.a", "a..a.a.a.a", "aa.a.a.aaa", "..........", ".........."}; /* XPM */ static const char * const pageup_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".aaa.aaa.", ".a.a.a.a.", ".aaa..aa.", ".a...aaa.", ".........", ".a.a.aaa.", ".a.a.a.a.", ".aaa.aaa.", ".....a..."}; /* XPM */ static const char * const pagedown_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".aaa.aaa.", ".a.a.a.a.", ".aaa..aa.", ".a...aaa.", ".........", "...a.....", ".aaa.aaa.", ".a.a.a.a.", ".aaa.a.a."}; /* XPM */ static const char * const expand_xpm[]={ "4 9 2 1", "a c #408040", ". c None", "a...", "aa..", "aaa.", "aaaa", "aaaa", "aaaa", "aaa.", "aa..", "a..."}; /* XPM */ #ifdef USE_SMALL_BACKSPACE static const char * const backspace_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", "...a.....", "..aa.....", ".aaaaaaaa", "..aa.....", "...a.....", ".........", "........."}; #else static const char * const backspace_xpm[]={ "21 9 2 1", "a c #000000", ". c None", ".....................", ".....................", ".....aaa..a..........", ".a...a..a.a.a.aaa.aaa", "aaaa.aaa..aa..aa..a.a", ".a...a..a.aaa..aa.a.a", ".....aaaa.a.a.aaa.aa.", "..................a..", "....................."}; #endif /* XPM */ static const char * const escape_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".aa.aa.aa", ".a..a..a.", ".aa.aa.a.", ".a...a.a.", ".aa.aa.aa", ".........", "........."}; enum { BSCode = 0x80, TabCode, CapsCode, RetCode, ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash, UpCode, LeftCode, DownCode, RightCode, Blank, Expand, Opti, ResetDict, Divide, Multiply, Add, Subtract, Decimal, Equal, Percent, Sqrt, Inverse, Escape }; typedef struct SpecialMap { int qcode; ushort unicode; const char * label; const char * const * xpm; }; static const SpecialMap specialM[] = { { Qt::Key_Backspace, 8, "<", backspace_xpm }, { Qt::Key_Tab, 9, "Tab", NULL }, { Qt::Key_CapsLock, 0, "Caps", NULL }, { Qt::Key_Return, 13, "Ret", NULL }, { Qt::Key_Shift, 0, "Shift", NULL }, { Qt::Key_Control, 0, "Ctrl", NULL }, { Qt::Key_Alt, 0, "Alt", NULL }, { Qt::Key_Space, ' ', "", NULL }, { BackSlash, 43, "\\", NULL }, // Need images? { Qt::Key_Up, 0, "^", uparrow_xpm }, { Qt::Key_Left, 0, "<", leftarrow_xpm }, { Qt::Key_Down, 0, "v", downarrow_xpm }, { Qt::Key_Right, 0, ">", rightarrow_xpm }, { Qt::Key_Insert, 0, "I", insert_xpm }, { Qt::Key_Home, 0, "H", home_xpm }, { Qt::Key_PageUp, 0, "U", pageup_xpm }, { Qt::Key_End, 0, "E", end_xpm }, { Qt::Key_Delete, 0, "X", delete_xpm }, { Qt::Key_PageDown, 0, "D", pagedown_xpm }, { Blank, 0, " ", NULL }, { Expand, 0, "->", expand_xpm }, { Opti, 0, "#", NULL }, { ResetDict, 0, "R", NULL }, // number pad stuff { Divide, 0, "/", NULL }, { Multiply, 0, "*", NULL }, { Add, 0, "+", NULL }, { Subtract, 0, "-", NULL }, { Decimal, 0, ".", NULL }, { Equal, 0, "=", NULL }, diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp index fb88f2a..39d44cd 100644 --- a/inputmethods/keyboard/keyboard.cpp +++ b/inputmethods/keyboard/keyboard.cpp @@ -1,433 +1,440 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** 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 <qpe/global.h> - +#include <qpe/config.h> #include <qwindowsystem_qws.h> #include <qpainter.h> #include <qfontmetrics.h> #include <qtimer.h> #include <ctype.h> #include <sys/utsname.h> using namespace KeyboardInput; #define USE_SMALL_BACKSPACE Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), unicode(-1), qkeycode(0), modifiers(0) { // setPalette(QPalette(QColor(240,240,230))); // Beige! // setFont( QFont( "Helvetica", 8 ) ); // setPalette(QPalette(QColor(200,200,200))); // Gray setPalette(QPalette(QColor(220,220,220))); // Gray + // get the default font + Config *config = new Config( "qpe" ); + config->setGroup( "Appearance" ); + QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); + int fontSize = config->readNumEntry( "FontSize", 10 ); + delete config; + picks = new KeyboardPicks( this ); - picks->setFont( QFont( "smallsmooth", 9 ) ); - setFont( QFont( "smallsmooth", 9 ) ); + picks->setFont( QFont( familyStr, fontSize ) ); + setFont( QFont( familyStr, fontSize ) ); picks->initialise(); QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); repeatTimer = new QTimer( this ); // temporary quick and dirty fix for the "sticky keyboard bug" // on ipaq. // struct utsname name; // if (uname(&name) != -1) // { // QString release=name.release; // qWarning("System release: %s\n", name.release); // if(release.find("embedix",0,TRUE) !=-1) // { connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); // } // } } void Keyboard::resizeEvent(QResizeEvent*) { int ph = picks->sizeHint().height(); picks->setGeometry( 0, 0, width(), ph ); keyHeight = (height()-ph)/5; int nk; if ( useOptiKeys ) { nk = 15; } else if ( useLargeKeys ) { nk = 15; } else { nk = 19; } defaultKeyWidth = width()/nk; xoffs = (width()-defaultKeyWidth*nk)/2; } void KeyboardPicks::initialise() { setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); mode = 0; dc = new KeyboardConfig(this); configs.append(dc); } QSize KeyboardPicks::sizeHint() const { return QSize(240,fontMetrics().lineSpacing()); } void KeyboardConfig::generateText(const QString &s) { #if defined(Q_WS_QWS) || defined(_WS_QWS_) for (int i=0; i<(int)backspaces; i++) { parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); } for (int i=0; i<(int)s.length(); i++) { parent->emitKey( s[i].unicode(), 0, 0, true, false ); parent->emitKey( s[i].unicode(), 0, 0, false, false ); } parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); backspaces = 0; #endif } //PC keyboard layout and scancodes /* Format: length, code, length, code, ..., 0 length is measured in half the width of a standard key. If code < 0x80 we have length/2 consecutive standard keys, starting with scancode code. Special keys are hardcoded, one at a time, with length of key and code >= 0x80, these are NOT standard PC scancodes, but are looked up in specialM[]. (The special keys are not keymappable.) */ static const uchar * const keyboard_opti[5] = { (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" }; static const uchar * const keyboard_standard[5] = { #ifdef USE_SMALL_BACKSPACE (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217", #else (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217", #endif //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222", //TAB + qwerty.. + backslash //+ DEL + END + PGDN (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", //CAPS + asdf.. + RETURN (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", //SHIFT + zxcv... //+ UP (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT }; struct ShiftMap { char normal; char shifted; }; static const ShiftMap shiftMap[] = { { '`', '~' }, { '1', '!' }, { '2', '@' }, { '3', '#' }, { '4', '$' }, { '5', '%' }, { '6', '^' }, { '7', '&' }, { '8', '*' }, { '9', '(' }, { '0', ')' }, { '-', '_' }, { '=', '+' }, { '\\', '|' }, { '[', '{' }, { ']', '}' }, { ';', ':' }, { '\'', '"' }, { ',', '<' }, { '.', '>' }, { '/', '?' } }; /* XPM */ static const char * const uparrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "....a....", "...aaa...", "..aaaaa..", "....a....", "....a....", "....a....", "....a....", "........."}; /* XPM */ static const char * const leftarrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", "...a.....", "..aa.....", ".aaaaaaa.", "..aa.....", "...a.....", ".........", "........."}; /* XPM */ static const char * const downarrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "....a....", "....a....", "....a....", "....a....", "..aaaaa..", "...aaa...", "....a....", "........."}; /* XPM */ static const char * const rightarrow_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".....a...", ".....aa..", ".aaaaaaa.", ".....aa..", ".....a...", ".........", "........."}; /* XPM */ static const char * const insert_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "a........", "a.aaa.aaa", "a.a.a.a..", "a.a.a..a.", "a.a.a...a", "a.a.a.aaa", ".........", "........."}; /* XPM */ static const char * const delete_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", "aa......a", "a.a.aaa.a", "a.a.a.a.a", "a.a.aaa.a.", "a.a.a...a", "aaa.aaa.a", ".........", "........."}; /* XPM */ static const char * const home_xpm[]={ "9 9 2 1", "a c #000000", ". c None", "....a....", "...a.a...", "..a...a..", ".a.....a.", "aa.aaa.aa", ".a.a.a.a.", ".a.a.a.a.", ".aaaaaaa.", "........."}; /* XPM */ static const char * const end_xpm[]={ "10 9 2 1", "a c #000000", ". c None", "..........", "aa.......a", "a..aaa.aaa", "aa.a.a.a.a", "a..a.a.a.a", "a..a.a.a.a", "aa.a.a.aaa", "..........", ".........."}; /* XPM */ static const char * const pageup_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".aaa.aaa.", ".a.a.a.a.", ".aaa..aa.", ".a...aaa.", ".........", ".a.a.aaa.", ".a.a.a.a.", ".aaa.aaa.", ".....a..."}; /* XPM */ static const char * const pagedown_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".aaa.aaa.", ".a.a.a.a.", ".aaa..aa.", ".a...aaa.", ".........", "...a.....", ".aaa.aaa.", ".a.a.a.a.", ".aaa.a.a."}; /* XPM */ static const char * const expand_xpm[]={ "4 9 2 1", "a c #408040", ". c None", "a...", "aa..", "aaa.", "aaaa", "aaaa", "aaaa", "aaa.", "aa..", "a..."}; /* XPM */ #ifdef USE_SMALL_BACKSPACE static const char * const backspace_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", "...a.....", "..aa.....", ".aaaaaaaa", "..aa.....", "...a.....", ".........", "........."}; #else static const char * const backspace_xpm[]={ "21 9 2 1", "a c #000000", ". c None", ".....................", ".....................", ".....aaa..a..........", ".a...a..a.a.a.aaa.aaa", "aaaa.aaa..aa..aa..a.a", ".a...a..a.aaa..aa.a.a", ".....aaaa.a.a.aaa.aa.", "..................a..", "....................."}; #endif /* XPM */ static const char * const escape_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".aa.aa.aa", ".a..a..a.", ".aa.aa.a.", ".a...a.a.", ".aa.aa.aa", ".........", "........."}; enum { BSCode = 0x80, TabCode, CapsCode, RetCode, ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash, UpCode, LeftCode, DownCode, RightCode, Blank, Expand, Opti, ResetDict, Divide, Multiply, Add, Subtract, Decimal, Equal, Percent, Sqrt, Inverse, Escape }; typedef struct SpecialMap { int qcode; ushort unicode; const char * label; const char * const * xpm; }; static const SpecialMap specialM[] = { { Qt::Key_Backspace, 8, "<", backspace_xpm }, { Qt::Key_Tab, 9, "Tab", NULL }, { Qt::Key_CapsLock, 0, "Caps", NULL }, { Qt::Key_Return, 13, "Ret", NULL }, { Qt::Key_Shift, 0, "Shift", NULL }, { Qt::Key_Control, 0, "Ctrl", NULL }, { Qt::Key_Alt, 0, "Alt", NULL }, { Qt::Key_Space, ' ', "", NULL }, { BackSlash, 43, "\\", NULL }, // Need images? { Qt::Key_Up, 0, "^", uparrow_xpm }, { Qt::Key_Left, 0, "<", leftarrow_xpm }, { Qt::Key_Down, 0, "v", downarrow_xpm }, { Qt::Key_Right, 0, ">", rightarrow_xpm }, { Qt::Key_Insert, 0, "I", insert_xpm }, { Qt::Key_Home, 0, "H", home_xpm }, { Qt::Key_PageUp, 0, "U", pageup_xpm }, { Qt::Key_End, 0, "E", end_xpm }, { Qt::Key_Delete, 0, "X", delete_xpm }, diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index f8cafd5..96fb484 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp @@ -1,465 +1,465 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** 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 <qdir.h> #include <qtextstream.h> #include <qstringlist.h> #include <sys/utsname.h> using namespace MultiKey; static const char * const kb_config_xpm[] = { "13 7 2 1", " c None", ". c #000000", " ", " . ", " ... ", " ..... ", " . ", " . ", " "}; /* Keyboard::Keyboard {{{1 */ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), configdlg(0) { // get the default font Config *config = new Config( "qpe" ); config->setGroup( "Appearance" ); QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); + int fontSize = config->readNumEntry( "FontSize", 10 ); delete config; config = new Config("multikey"); config->setGroup ("general"); usePicks = config->readBoolEntry ("usePickboard", 0); // default closed useRepeat = config->readBoolEntry ("useRepeat", 1); delete config; - - setFont( QFont( familyStr, 10 ) ); + setFont( QFont( familyStr, fontSize ) ); picks = new KeyboardPicks( this ); - picks->setFont( QFont( familyStr, 10 ) ); + picks->setFont( QFont( familyStr, fontSize ) ); 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(); loadKeyboardColors(); keys = new Keys(); repeatTimer = new QTimer( this ); connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&))); } Keyboard::~Keyboard() { if ( configdlg ) { delete configdlg; configdlg = 0; } } /* Keyboard::resizeEvent {{{1 */ void Keyboard::resizeEvent(QResizeEvent*) { int ph = picks->sizeHint().height(); picks->setGeometry( 0, 0, width(), ph ); keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); int nk; // number of keys? if ( useLargeKeys ) { nk = 15; } else { nk = 19; } defaultKeyWidth = (width()/nk)/2; xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? } /* KeyboardPicks::initialize {{{1 */ void KeyboardPicks::initialise() { setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); mode = 0; dc = new KeyboardConfig(this); configs.append(dc); } /* KeyboardPicks::sizeHint {{{1 */ QSize KeyboardPicks::sizeHint() const { return QSize(240,fontMetrics().lineSpacing()); } /* KeyboardConfig::generateText {{{1 */ void KeyboardConfig::generateText(const QString &s) { #if defined(Q_WS_QWS) || defined(_WS_QWS_) for (int i=0; i<(int)backspaces; i++) { parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); } for (int i=0; i<(int)s.length(); i++) { parent->emitKey( s[i].unicode(), 0, 0, true, false ); parent->emitKey( s[i].unicode(), 0, 0, false, false ); } parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); backspaces = 0; #endif } /* Keyboard::paintEvent {{{1 */ void Keyboard::paintEvent(QPaintEvent* e) { QPainter painter(this); painter.setClipRect(e->rect()); drawKeyboard( painter ); picks->dc->draw( &painter ); } /* Keyboard::drawKeyboard {{{1 */ void Keyboard::drawKeyboard(QPainter &p, int row, int col) { if (row != -1 && col != -1) { //just redraw one key int x = 0; for (int i = 0; i < col; i++) { x += keys->width(row, i) * defaultKeyWidth; } int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); int keyWidth = keys->width(row, col); p.fillRect(x + 1, y + 1, keyWidth * defaultKeyWidth - 1, keyHeight - 1, pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); QImage *pix = keys->pix(row,col); ushort c = keys->uni(row, col); p.setPen(textcolor); if (!pix) { if ((shift || lock) && keys->shift(c)) if (circumflex && keys->circumflex(keys->shift(c))) c = keys->circumflex(keys->shift(c)); else if (diaeresis && keys->diaeresis(keys->shift(c))) c = keys->diaeresis(keys->shift(c)); else if (baccent && keys->baccent(keys->shift(c))) c = keys->baccent(keys->shift(c)); else if (accent && keys->accent(keys->shift(c))) c = keys->accent(keys->shift(c)); else if (meta && keys->meta(keys->shift(c))) c = keys->meta(keys->shift(c)); else c = keys->shift(c); else if (meta && keys->meta(c)) c = keys->meta(c); else if (circumflex && keys->circumflex(c)) c = keys->circumflex(c); else if (baccent && keys->baccent(c)) c = keys->baccent(c); else if (accent && keys->accent(c)) c = keys->accent(c); else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { // the diaeresis key itself has to be in the diaeresisMap, // or just do this to make it display the diaeresis char. if (c == 0x2c6) c = 0xa8; else c = keys->diaeresis(c); } p.drawText(x, y, defaultKeyWidth * keyWidth + 3, keyHeight, AlignCenter, (QChar)c); } else // center the image in the middle of the key p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, y + (keyHeight - pix->height())/2 + 1, *pix ); // this fixes the problem that the very right end of the board's vertical line // gets painted over, because it's one pixel shorter than all other keys p.setPen(keycolor_lines); p.drawLine(width() - 1, 0, width() - 1, height()); } else { p.fillRect(0, 0, width(), height(), keycolor); for (row = 1; row <= keys->rows(); row++) { int x = 0; int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); p.setPen(keycolor_lines); p.drawLine(x, y, x + width(), y); for (int col = 0; col < keys->numKeys(row); col++) { QImage *pix = keys->pix(row, col); int keyWidth = keys->width(row, col); int keyWidthPix = defaultKeyWidth * keyWidth; if (keys->pressed(row, col)) p.fillRect(x+1, y+1, keyWidthPix - 1, keyHeight - 1, keycolor_pressed); ushort c = keys->uni(row, col); p.setPen(textcolor); if (!pix) { if ((shift || lock) && keys->shift(c)) if (circumflex && keys->circumflex(keys->shift(c))) c = keys->circumflex(keys->shift(c)); else if (diaeresis && keys->diaeresis(keys->shift(c))) c = keys->diaeresis(keys->shift(c)); else if (baccent && keys->baccent(keys->shift(c))) c = keys->baccent(keys->shift(c)); else if (accent && keys->accent(keys->shift(c))) c = keys->accent(keys->shift(c)); else if (meta && keys->meta(keys->shift(c))) c = keys->meta(keys->shift(c)); else c = keys->shift(c); else if (meta && keys->meta(c)) c = keys->meta(c); else if (circumflex && keys->circumflex(c)) c = keys->circumflex(c); else if (baccent && keys->baccent(c)) c = keys->baccent(c); else if (accent && keys->accent(c)) c = keys->accent(c); else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { if (c == 0x2c6) c = 0xa8; else c = keys->diaeresis(c); } p.drawText(x, y, keyWidthPix + 3, keyHeight, AlignCenter, (QChar)c); } else { // center the image in the middle of the key pix->setColor(1, textcolor.rgb()); p.drawImage( x + (keyWidthPix - pix->width())/2 + 1, y + (keyHeight - pix->height())/2 + 1, QImage(*pix) ); } p.setPen(keycolor_lines); p.drawLine(x, y, x, y + keyHeight); x += keyWidthPix; } } p.setPen(keycolor_lines); p.drawLine(0, height() - 1, width(), height() - 1); p.drawLine(width() - 1, 0, width() - 1, height()); } } /* Keyboard::mousePressEvent {{{1 */ void Keyboard::mousePressEvent(QMouseEvent *e) { int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; if (row > 5) row = 5; // figure out the column int col = 0; for (int w = 0; e->x() >= w; col++) if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys w += keys->width(row,col) * defaultKeyWidth; else break; if (col <= 0) return; col --; // rewind one... 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; // circumflex and diaeresis support // messy to have this here, but too hard to implement any other method if (unicode == 0x2c6) { unicode = 0; if (shift || lock) { // diaeresis qkeycode = 0x2001; } else { // circumflex qkeycode = 0x2000; } } // Back accent character support // the keys from 2c6 ~ 2cf should be used instead of the ascii one if (unicode == 0x2cb) { unicode = 0; if (shift || lock) { // circumblex qkeycode = 0x2000; } else { // back accent qkeycode = 0x2002; } } // Accent character support if (unicode == 0x2ca) { unicode = 0; if (shift || lock) { // diaeresis qkeycode = 0x2001; } else { // accent qkeycode = 0x2003; } } if (unicode == 0) { // either Qt char, or nothing if (qkeycode == Qt::Key_F1) { // toggle the pickboard if ( configdlg ) { delete configdlg; configdlg = 0; } else { configdlg = new ConfigDlg (); connect(configdlg, SIGNAL(setMapToDefault()), this, SLOT(setMapToDefault())); connect(configdlg, SIGNAL(setMapToFile(QString)), this, SLOT(setMapToFile(QString))); connect(configdlg, SIGNAL(pickboardToggled(bool)), this, SLOT(togglePickboard(bool))); connect(configdlg, SIGNAL(repeatToggled(bool)), this, SLOT(toggleRepeat(bool))); connect(configdlg, SIGNAL(reloadKeyboard()), this, SLOT(reloadKeyboard())); connect(configdlg, SIGNAL(configDlgClosed()), this, SLOT(cleanupConfigDlg())); connect(configdlg, SIGNAL(reloadSw()), this, SLOT(reloadSw())); configdlg->showMaximized(); configdlg->show(); configdlg->raise(); } } else if (qkeycode == Qt::Key_Control) { need_repaint = TRUE; if (ctrl) { *ctrl = 0; ctrl = 0; } else { ctrl = keys->pressedPtr(row, col); need_repaint = TRUE; *ctrl = !keys->pressed(row, col); } } else if (qkeycode == Qt::Key_Alt) { need_repaint = TRUE; diff --git a/inputmethods/pickboard/pickboard.cpp b/inputmethods/pickboard/pickboard.cpp index 1611cb0..e5365ba 100644 --- a/inputmethods/pickboard/pickboard.cpp +++ b/inputmethods/pickboard/pickboard.cpp @@ -1,110 +1,115 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** 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. ** ** 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 "pickboard.h" #include "pickboardpicks.h" #include "pickboardcfg.h" #include <qpe/global.h> - +#include <qpe/config.h> #include <qpainter.h> #include <qlist.h> #include <qbitmap.h> #include <qlayout.h> #include <qvbox.h> #include <qdialog.h> #include <qscrollview.h> #include <qpopupmenu.h> #include <qhbuttongroup.h> #include <qpushbutton.h> #include <qmessagebox.h> #ifdef QWS #include <qwindowsystem_qws.h> #endif /*! \class Pickboard \brief The Pickboard class provides an input method based on a virtual keyboard combined with word-completion. This version of Pickboard is Dual Licensed Software. However, for you to be able to license the technology to others, you may require a T9(R) Text Input license from Tegic Communications Corporation. More information can be found at http://www.t9.com/. \legalese This version of Pickboard is Dual Licensed Software. However, for you to be able to license the technology to others, you may require a T9(R) Text Input license from Tegic Communications Corporation. More information can be found at http://www.t9.com/. */ /* XPM */ static const char * const menu_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".........", "....a....", "...aaa...", "..aaaaa..", ".aaaaaaa.", ".........", "........."}; class PickboardPrivate { public: PickboardPrivate(Pickboard* parent) { picks = new PickboardPicks(parent); picks->initialise(); menu = new QPushButton(parent); menu->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding)); menu->setPixmap(QPixmap((const char **)menu_xpm)); QObject::connect(menu,SIGNAL(clicked()),picks,SLOT(doMenu())); QObject::connect(picks,SIGNAL(key(ushort,ushort,ushort,bool,bool)), parent,SIGNAL(key(ushort,ushort,ushort,bool,bool))); } PickboardPicks* picks; QPushButton* menu; }; Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) : QFrame(parent,name,f) { (new QHBoxLayout(this))->setAutoAdd(TRUE); d = new PickboardPrivate(this); -// under Win32 we may not have smallsmooth font -#ifndef Q_OS_WIN32 - setFont( QFont( "smallsmooth", 9 ) ); -#endif + + // get the default font + Config *config = new Config( "qpe" ); + config->setGroup( "Appearance" ); + QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); + int fontSize = config->readNumEntry( "FontSize", 10 ); + delete config; + + setFont( QFont( familyStr, fontSize ) ); } Pickboard::~Pickboard() { delete d; } void Pickboard::resetState() { d->picks->resetState(); } diff --git a/inputmethods/unikeyboard/unikeyboard.cpp b/inputmethods/unikeyboard/unikeyboard.cpp index aa74c66..23d96ad 100644 --- a/inputmethods/unikeyboard/unikeyboard.cpp +++ b/inputmethods/unikeyboard/unikeyboard.cpp @@ -1,278 +1,286 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** 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 "unikeyboard.h" #include <qpe/fontmanager.h> - +#include <qpe/config.h> #include <qpainter.h> #include <qfontmetrics.h> #include <qcombobox.h> #if defined(Q_WS_QWS) || defined(_WS_QWS_) #include <qwindowsystem_qws.h> #endif static const int nw = 8; typedef struct BlockMap { ushort start; ushort stop; const char *name; }; //# Start Code; Block Name static const BlockMap blockMap[] = { {0x0000, 0x007F, "Basic Latin"}, {0x0080, 0x00FF, "Latin-1 Supplement"}, {0x0100, 0x017F, "Latin Extended-A"}, {0x0180, 0x024F, "Latin Extended-B"}, {0x0250, 0x02AF, "IPA Extensions"}, {0x02B0, 0x02FF, "Spacing Modifier Letters"}, {0x0300, 0x036F, "Combining Diacritical Marks"}, {0x0370, 0x03FF, "Greek"}, {0x0400, 0x04FF, "Cyrillic"}, {0x0530, 0x058F, "Armenian"}, {0x0590, 0x05FF, "Hebrew"}, {0x0600, 0x06FF, "Arabic"}, {0x0700, 0x074F, "Syriac "}, {0x0780, 0x07BF, "Thaana"}, {0x0900, 0x097F, "Devanagari"}, {0x0980, 0x09FF, "Bengali"}, {0x0A00, 0x0A7F, "Gurmukhi"}, {0x0A80, 0x0AFF, "Gujarati"}, {0x0B00, 0x0B7F, "Oriya"}, {0x0B80, 0x0BFF, "Tamil"}, {0x0C00, 0x0C7F, "Telugu"}, {0x0C80, 0x0CFF, "Kannada"}, {0x0D00, 0x0D7F, "Malayalam"}, {0x0D80, 0x0DFF, "Sinhala"}, {0x0E00, 0x0E7F, "Thai"}, {0x0E80, 0x0EFF, "Lao"}, {0x0F00, 0x0FFF, "Tibetan"}, {0x1000, 0x109F, "Myanmar "}, {0x10A0, 0x10FF, "Georgian"}, {0x1100, 0x11FF, "Hangul Jamo"}, {0x1200, 0x137F, "Ethiopic"}, {0x13A0, 0x13FF, "Cherokee"}, {0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics"}, {0x1680, 0x169F, "Ogham"}, {0x16A0, 0x16FF, "Runic"}, {0x1780, 0x17FF, "Khmer"}, {0x1800, 0x18AF, "Mongolian"}, {0x1E00, 0x1EFF, "Latin Extended Additional"}, {0x1F00, 0x1FFF, "Greek Extended"}, {0x2000, 0x206F, "General Punctuation"}, {0x2070, 0x209F, "Superscripts and Subscripts"}, {0x20A0, 0x20CF, "Currency Symbols"}, {0x20D0, 0x20FF, "Combining Marks for Symbols"}, {0x2100, 0x214F, "Letterlike Symbols"}, {0x2150, 0x218F, "Number Forms"}, {0x2190, 0x21FF, "Arrows"}, {0x2200, 0x22FF, "Mathematical Operators"}, {0x2300, 0x23FF, "Miscellaneous Technical"}, {0x2400, 0x243F, "Control Pictures"}, {0x2440, 0x245F, "Optical Character Recognition"}, {0x2460, 0x24FF, "Enclosed Alphanumerics"}, {0x2500, 0x257F, "Box Drawing"}, {0x2580, 0x259F, "Block Elements"}, {0x25A0, 0x25FF, "Geometric Shapes"}, {0x2600, 0x26FF, "Miscellaneous Symbols"}, {0x2700, 0x27BF, "Dingbats"}, {0x2800, 0x28FF, "Braille Patterns"}, {0x2E80, 0x2EFF, "CJK Radicals Supplement"}, {0x2F00, 0x2FDF, "Kangxi Radicals"}, {0x2FF0, 0x2FFF, "Ideographic Description Characters"}, {0x3000, 0x303F, "CJK Symbols and Punctuation"}, {0x3040, 0x309F, "Hiragana"}, {0x30A0, 0x30FF, "Katakana"}, {0x3100, 0x312F, "Bopomofo"}, {0x3130, 0x318F, "Hangul Compatibility Jamo"}, {0x3190, 0x319F, "Kanbun"}, {0x31A0, 0x31BF, "Bopomofo Extended"}, {0x3200, 0x32FF, "Enclosed CJK Letters and Months"}, {0x3300, 0x33FF, "CJK Compatibility"}, {0x3400, 0x4DB5, "CJK Unified Ideographs Extension A"}, {0x4E00, 0x9FFF, "CJK Unified Ideographs"}, {0xA000, 0xA48F, "Yi Syllables"}, {0xA490, 0xA4CF, "Yi Radicals"}, {0xAC00, 0xD7A3, "Hangul Syllables"}, {0xD800, 0xDB7F, "High Surrogates"}, {0xDB80, 0xDBFF, "High Private Use Surrogates"}, {0xDC00, 0xDFFF, "Low Surrogates"}, {0xE000, 0xF8FF, "Private Use"}, {0xF900, 0xFAFF, "CJK Compatibility Ideographs"}, {0xFB00, 0xFB4F, "Alphabetic Presentation Forms"}, {0xFB50, 0xFDFF, "Arabic Presentation Forms-A"}, {0xFE20, 0xFE2F, "Combining Half Marks"}, {0xFE30, 0xFE4F, "CJK Compatibility Forms"}, {0xFE50, 0xFE6F, "Small Form Variants"}, {0xFE70, 0xFEFE, "Arabic Presentation Forms-B"}, {0xFF00, 0xFEFF, "Halfwidth and Fullwidth Forms"}, {0xFFF0, 0xFFEF, "Specials"}, {0xFFFF, 0xFFFF, 0} }; UniScrollview::UniScrollview(QWidget* parent, const char* name, int f) : QScrollView(parent, name, f) { // smallFont.setRawName( "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1" ); //###### - smallFont = QFont( "Helvetica", 8 ); + + // get the default font + Config *config = new Config( "qpe" ); + config->setGroup( "Appearance" ); + QString familyStr = config->readEntry( "FontFamily", "Helvetica" ); + int fontSize = config->readNumEntry( "FontSize", 8 ) - 2; + delete config; + + smallFont = QFont( familyStr, fontSize ); QFontMetrics sfm( smallFont ); xoff = sfm.width( "AAA" ); setFont( FontManager::unicodeFont( FontManager::Fixed ) ); QFontMetrics fm( font() ); cellsize = fm.lineSpacing() + 2; resizeContents( cellsize*nw, cellsize*65536/nw ); verticalScrollBar()->setLineStep(cellsize); viewport()->setBackgroundMode( QWidget::PaletteBase ); } void UniScrollview::contentsMousePressEvent(QMouseEvent* e) { if ( e->x() < xoff || e->x() > xoff + nw*cellsize ) return; int row = e->y()/cellsize; int col = (e->x()-xoff)/cellsize; int u = row*nw+col; #if defined(Q_WS_QWS) || defined(_WS_QWS_) emit key( u, 0, 0, true, false ); emit key( u, 0, 0, false, false ); #endif } void UniScrollview::contentsMouseReleaseEvent(QMouseEvent*) { } void UniScrollview::scrollTo( int unicode ) { int row = unicode / nw; setContentsPos( 0, row*cellsize ); } void UniScrollview::drawContents( QPainter *p, int /*cx*/, int cy, int /*cw*/, int ch ) { QFontMetrics fm = fontMetrics(); int row = cy / cellsize; int y = row*cellsize; while ( y < cy+ch ) { p->drawLine( xoff, y, xoff+nw*cellsize, y ); if ( row*nw%16 == 0 ) { p->setFont( smallFont ); QString s; s.sprintf( "%03X", row*nw/16 ); p->drawText( 0, y, xoff, cellsize, AlignLeft, s ); p->setFont( font() ); } for ( int i = 0; i < nw; i++ ) { p->drawLine( xoff+i*cellsize, y, xoff+i*cellsize, y+cellsize ); QChar u = row*nw + i; if ( fm.inFont( u ) ) p->drawText( xoff+i*cellsize, y, cellsize, cellsize, AlignCenter, u ); } p->drawLine( xoff+nw*cellsize, y, xoff+nw*cellsize, y+cellsize ); row++; y += cellsize; } } UniKeyboard::UniKeyboard(QWidget* parent, const char* name, int f ) : QFrame( parent, name, f ) { setFrameStyle( NoFrame ); sv = new UniScrollview( this ); cb = new QComboBox( FALSE, this ); currentBlock = 0; QFontMetrics fm = sv->fontMetrics(); cbmap = new int[sizeof(blockMap)/sizeof(blockMap[0])]; for ( int i = 0; blockMap[i].name; i++ ) { bool any=FALSE; for ( int c=blockMap[i].start; !any && c<=blockMap[i].stop; c++ ) any = fm.inFont(QChar(c)); if ( any ) { cbmap[cb->count()]=i; cb->insertItem( blockMap[i].name ); } } connect( cb, SIGNAL( activated(int)), this, SLOT( handleCombo(int)) ); connect( sv, SIGNAL( contentsMoving(int,int)), this, SLOT( svMove(int,int)) ); connect( sv, SIGNAL( key(ushort,ushort,ushort,bool,bool)), this, SIGNAL( key(ushort,ushort,ushort,bool,bool)) ); } UniKeyboard::~UniKeyboard() { delete [] cbmap; } void UniKeyboard::resizeEvent(QResizeEvent *) { int d = frameWidth(); cb->setGeometry( d, d, width()-2*d, cb->sizeHint().height() ); sv->setGeometry( d, cb->height()+d, width()-2*d, height()-cb->height()-2*d ); } void UniKeyboard::svMove( int /*x*/, int y ) { int cs = sv->cellSize(); int u = ((y+cs-1)/cs) * nw; int i = currentBlock; while ( i > 0 && blockMap[i].start > u ) { i--; } while ( blockMap[i+1].name && blockMap[i+1].start < u ) { i++; } if ( i != currentBlock ) { currentBlock = i; for (int ind=0; ind<cb->count(); ind++) { if ( cbmap[ind] == i ) { cb->setCurrentItem( ind ); break; } } } } void UniKeyboard::handleCombo( int i ) { currentBlock = cbmap[i]; sv->scrollTo( blockMap[currentBlock].start ); } void UniKeyboard::resetState() { } QSize UniKeyboard::sizeHint() const { return QSize( 240, 2+sv->cellSize()*4+cb->sizeHint().height() ); } |