author | mickeyl <mickeyl> | 2005-01-05 15:22:09 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-05 15:22:09 (UTC) |
commit | 34ae22499b91f483f1cf505e515047ea11e8eaf0 (patch) (unidiff) | |
tree | 555ad0f77c87d445f1ca688f96a78fe903211190 | |
parent | 80823d4cbd234a54a15d6b439bd37a8ea42e7904 (diff) | |
download | opie-34ae22499b91f483f1cf505e515047ea11e8eaf0.zip opie-34ae22499b91f483f1cf505e515047ea11e8eaf0.tar.gz opie-34ae22499b91f483f1cf505e515047ea11e8eaf0.tar.bz2 |
remove hard coded fonts for dvorak, keyboard, multikey, pickboard, and unikeyboard
-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 @@ | |||
1 | 2005-??-??Opie 1.2.0 | 1 | 2005-??-??Opie 1.2.0 |
2 | 2 | ||
3 | New Features | 3 | New Features |
4 | ------------ | 4 | ------------ |
5 | 5 | ||
6 | Fixed Bugs | 6 | Fixed Bugs |
7 | ---------- | 7 | ---------- |
8 | * #1501 - Fixing bug in todo sql backend (eilers) | 8 | * #1501 - Fixed bug in todo sql backend (eilers) |
9 | * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) | ||
9 | 10 | ||
10 | Internal | 11 | Internal |
11 | -------- | 12 | -------- |
12 | * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) | 13 | * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) |
13 | 14 | ||
14 | 2004-11-26Opie 1.1.8 | 15 | 2004-11-26Opie 1.1.8 |
15 | 16 | ||
16 | New Features | 17 | New Features |
17 | ------------ | 18 | ------------ |
18 | * PackageManager supports installation of local ipkg files (drw) | 19 | * PackageManager supports installation of local ipkg files (drw) |
19 | * PackageManager supports linking of applications to root (drw) | 20 | * PackageManager supports linking of applications to root (drw) |
20 | * PackageManager supports src/gz feeds (drw,wimpie) | 21 | * PackageManager supports src/gz feeds (drw,wimpie) |
21 | * Added a syslog information tab to sysinfo (mickeyl) | 22 | * Added a syslog information tab to sysinfo (mickeyl) |
22 | * Added new, more consistent, PIM icons + a GIMP teplate (ar) | 23 | * Added new, more consistent, PIM icons + a GIMP teplate (ar) |
23 | 24 | ||
24 | Fixed Bugs | 25 | Fixed Bugs |
25 | ---------- | 26 | ---------- |
26 | * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) | 27 | * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) |
27 | * #1269 - VCards were imported into personal area if it was activated (eilers) | 28 | * #1269 - VCards were imported into personal area if it was activated (eilers) |
28 | * #1464 - Packagemanager dont set active filter after install a package (drw) | 29 | * #1464 - Packagemanager dont set active filter after install a package (drw) |
29 | * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) | 30 | * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) |
30 | * #1493 - Fixed one column layout bug of the launcher (hrw) | 31 | * #1493 - Fixed one column layout bug of the launcher (hrw) |
31 | * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) | 32 | * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) |
32 | * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) | 33 | * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) |
33 | * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) | 34 | * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) |
34 | 35 | ||
35 | Internal | 36 | Internal |
36 | -------- | 37 | -------- |
37 | * Moved libopie1 to unsupported (mickeyl) | 38 | * Moved libopie1 to unsupported (mickeyl) |
38 | * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) | 39 | * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) |
39 | * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) | 40 | * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) |
40 | 41 | ||
41 | 2004-11-14Opie 1.1.7 | 42 | 2004-11-14Opie 1.1.7 |
42 | 43 | ||
43 | New Features | 44 | New Features |
44 | ------------ | 45 | ------------ |
45 | * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) | 46 | * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) |
46 | * Backup now uses the busy indicator when backing up and restore (ar) | 47 | * Backup now uses the busy indicator when backing up and restore (ar) |
47 | * OpiePlayer2 gained adding of Directories to the playlist (zecke) | 48 | * OpiePlayer2 gained adding of Directories to the playlist (zecke) |
48 | * OpiePlayer2 better error handling (zecke) | 49 | * OpiePlayer2 better error handling (zecke) |
49 | * OpiePlayer2 progress indication while streaming (zecke) | 50 | * OpiePlayer2 progress indication while streaming (zecke) |
50 | * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) | 51 | * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) |
51 | * Ported brightnessapplet from Qtopia 1.7 (mickeyl) | 52 | * Ported brightnessapplet from Qtopia 1.7 (mickeyl) |
52 | * Opie-Eye got a Digital Camera File Backend (alwin,zecke) | 53 | * Opie-Eye got a Digital Camera File Backend (alwin,zecke) |
53 | * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) | 54 | * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) |
54 | * Opie-Console use Custom Font and Size in a Profile (harlekin) | 55 | * Opie-Console use Custom Font and Size in a Profile (harlekin) |
55 | * Opie-Console transparently log the Output and Input to a file (harlekin) | 56 | * Opie-Console transparently log the Output and Input to a file (harlekin) |
56 | * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) | 57 | * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) |
57 | * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) | 58 | * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) |
58 | * Opie-Security gained a 'test authentication' button (clem) | 59 | * Opie-Security gained a 'test authentication' button (clem) |
59 | * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults | 60 | * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults |
60 | * Opie-Mail improve the handling of POP mail boxes (alwin) | 61 | * Opie-Mail improve the handling of POP mail boxes (alwin) |
61 | * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) | 62 | * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) |
62 | * Opie IRC - backports of the 'NeIRC fork' (zecke) | 63 | * Opie IRC - backports of the 'NeIRC fork' (zecke) |
63 | 64 | ||
64 | Fixed Bugs | 65 | Fixed Bugs |
65 | ---------- | 66 | ---------- |
66 | * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) | 67 | * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) |
67 | * #608 - Make Opie usable for left handed users (zecke) | 68 | * #608 - Make Opie usable for left handed users (zecke) |
68 | * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) | 69 | * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) |
69 | * #1245 - Opie-Go 'paused' (zecke) | 70 | * #1245 - Opie-Go 'paused' (zecke) |
70 | * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) | 71 | * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) |
71 | * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) | 72 | * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) |
72 | * #1395 - Build VNC Backend with gcc3.4 | 73 | * #1395 - Build VNC Backend with gcc3.4 |
73 | * #1440 - The icon of opie-mobilemsg is missing (CoreDump) | 74 | * #1440 - The icon of opie-mobilemsg is missing (CoreDump) |
74 | * #1426 - Add missing opie-bartender Icon (CoreDump) | 75 | * #1426 - Add missing opie-bartender Icon (CoreDump) |
75 | * #1445 - Opie-Sheet Has No Icon (CoreDump) | 76 | * #1445 - Opie-Sheet Has No Icon (CoreDump) |
76 | * #1448 - Brightness Applet added (mickeyl) | 77 | * #1448 - Brightness Applet added (mickeyl) |
77 | * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) | 78 | * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) |
78 | * #1482 - Fix OFileSelector to be able to sort by size (zecke) | 79 | * #1482 - Fix OFileSelector to be able to sort by size (zecke) |
79 | * n.a. - Opie-mail: fixed some crasher, some layout-problems | 80 | * n.a. - Opie-mail: fixed some crasher, some layout-problems |
80 | * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) | 81 | * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) |
81 | * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) | 82 | * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) |
82 | * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) | 83 | * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) |
83 | * 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) | 84 | * 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) |
84 | * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) | 85 | * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) |
85 | 86 | ||
86 | Internal | 87 | Internal |
87 | -------- | 88 | -------- |
88 | * Opie-Qashmoney has been moved to unsupported (mickeyl) | 89 | * Opie-Qashmoney has been moved to unsupported (mickeyl) |
89 | * Opie-Ubrowser has been moved to unsupported (mickeyl) | 90 | * Opie-Ubrowser has been moved to unsupported (mickeyl) |
90 | 91 | ||
91 | 2004-09-17Opie 1.1.6 | 92 | 2004-09-17Opie 1.1.6 |
92 | 93 | ||
93 | New Features | 94 | New Features |
94 | ------------ | 95 | ------------ |
95 | * Fifteen gained configurable number of items (zecke) | 96 | * Fifteen gained configurable number of items (zecke) |
96 | * Fifteen can have custom background images (zecke) | 97 | * Fifteen can have custom background images (zecke) |
97 | * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) | 98 | * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) |
98 | * Integrated the new security framework into libopie2 (zecke,clem) | 99 | * Integrated the new security framework into libopie2 (zecke,clem) |
99 | * Converted the launcher to use the new security framework (zecke) | 100 | * Converted the launcher to use the new security framework (zecke) |
100 | * Backup can now handle custom locations for backup and restore (ar) | 101 | * Backup can now handle custom locations for backup and restore (ar) |
101 | * Implemented right-on-hold feedback (wimpie,zecke) | 102 | * Implemented right-on-hold feedback (wimpie,zecke) |
102 | * Lots of new features in opie-reader (tim,pohly) | 103 | * Lots of new features in opie-reader (tim,pohly) |
103 | * Build system cleanups (schurig) | 104 | * Build system cleanups (schurig) |
104 | 105 | ||
105 | Fixed Bugs | 106 | Fixed Bugs |
106 | -------- | 107 | -------- |
107 | * #1005 - Fixed backup to CompactFlash (ar) | 108 | * #1005 - Fixed backup to CompactFlash (ar) |
108 | * #1167 - Fixed Opie write crashing on more text than one page (ar) | 109 | * #1167 - Fixed Opie write crashing on more text than one page (ar) |
109 | * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) | 110 | * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) |
110 | * #1359 - Fixed bookmarks in Gutenbrowser (ljp) | 111 | * #1359 - Fixed bookmarks in Gutenbrowser (ljp) |
111 | * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) | 112 | * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) |
112 | * #1370 - Pimconverter now reacts on cancel key (eilers) | 113 | * #1370 - Pimconverter now reacts on cancel key (eilers) |
113 | * #1376 - Bring back the capslock/numlock display (zecke) | 114 | * #1376 - Bring back the capslock/numlock display (zecke) |
114 | * #1383 - Language settings now warns about losing open apps (Markus Litz) | 115 | * #1383 - Language settings now warns about losing open apps (Markus Litz) |
115 | * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) | 116 | * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) |
116 | * #1394 - Fixed oversized headline in opie-login (coredump) | 117 | * #1394 - Fixed oversized headline in opie-login (coredump) |
117 | * #1396 - Opie-console captures the escape key and vim is working (zecke) | 118 | * #1396 - Opie-console captures the escape key and vim is working (zecke) |
118 | * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) | 119 | * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) |
119 | 120 | ||
120 | 2004-07-06Opie 1.1.4 | 121 | 2004-07-06Opie 1.1.4 |
121 | 122 | ||
122 | New Features | 123 | New Features |
123 | ------------ | 124 | ------------ |
124 | * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) | 125 | * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) |
125 | * Added Conversion tool for pim-data (eilers) | 126 | * Added Conversion tool for pim-data (eilers) |
126 | * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) | 127 | * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) |
127 | * Modified the PIM API for providing generic use of OPimRecords (eilers) | 128 | * Modified the PIM API for providing generic use of OPimRecords (eilers) |
128 | * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) | 129 | * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) |
129 | 130 | ||
130 | Fixed Bugs | 131 | Fixed Bugs |
131 | -------- | 132 | -------- |
132 | * #1068 - Country Drop Down Box Off Screen | 133 | * #1068 - Country Drop Down Box Off Screen |
133 | * #1291 - Opie tinykate does not open .desktop files (ar) | 134 | * #1291 - Opie tinykate does not open .desktop files (ar) |
134 | * #1291 - Opie sheet not saving correctly (ar) | 135 | * #1291 - Opie sheet not saving correctly (ar) |
135 | * #1294 - Opie does not know about British Summer Time | 136 | * #1294 - Opie does not know about British Summer Time |
136 | * #1314 - Drawpad initialization (mickeyl) | 137 | * #1314 - Drawpad initialization (mickeyl) |
137 | * #1317 - Packagemanager crashes on hold-down or install (chicken) | 138 | * #1317 - Packagemanager crashes on hold-down or install (chicken) |
138 | * #1321 - Batteryapplet graphic glitch (harlekin) | 139 | * #1321 - Batteryapplet graphic glitch (harlekin) |
139 | * #1324 - ZSafe not starting up (mickeyl) | 140 | * #1324 - ZSafe not starting up (mickeyl) |
140 | * #1328 - Personal Home Address fields is trimmed to 1char (eilers) | 141 | * #1328 - Personal Home Address fields is trimmed to 1char (eilers) |
141 | * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) | 142 | * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) |
142 | * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) | 143 | * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) |
143 | * #1348 - Datebook dependency on libopiedb2 (chicken) | 144 | * #1348 - Datebook dependency on libopiedb2 (chicken) |
144 | * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) | 145 | * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) |
145 | 146 | ||
146 | 2004-04-25Opie 1.1.3 | 147 | 2004-04-25Opie 1.1.3 |
147 | 148 | ||
148 | * Introduced first implementation of SQL-Support using SQLite (eilers) | 149 | * Introduced first implementation of SQL-Support using SQLite (eilers) |
149 | * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) | 150 | * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) |
150 | * Added a real system graffiti character set (brad) | 151 | * Added a real system graffiti character set (brad) |
151 | * Added Generic Keyconfig Widget (zecke) | 152 | * Added Generic Keyconfig Widget (zecke) |
152 | * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) | 153 | * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) |
153 | * Added new Bible reader app - opie-dagger (drw) | 154 | * Added new Bible reader app - opie-dagger (drw) |
154 | * Added a new Image Viewer. Work is ongoing (zecke,alwin) | 155 | * Added a new Image Viewer. Work is ongoing (zecke,alwin) |
155 | * Added namespace usage in libopie2 and everywhere (zecke,alwin) | 156 | * Added namespace usage in libopie2 and everywhere (zecke,alwin) |
156 | * Enabled the possibility to pass command line arguments to applications (mickeyl) | 157 | * Enabled the possibility to pass command line arguments to applications (mickeyl) |
157 | * Added an about applet showing some credits and information about Opie (mickeyl) | 158 | * Added an about applet showing some credits and information about Opie (mickeyl) |
158 | * Added benchmarking functionality to sysinfo (mickeyl) | 159 | * Added benchmarking functionality to sysinfo (mickeyl) |
159 | * Added applet and configuration application for switching hardware keyboard layouts (alwin) | 160 | * Added applet and configuration application for switching hardware keyboard layouts (alwin) |
160 | * Ported applications from libopie1 to libopie2* (drw,ar,alwin) | 161 | * Ported applications from libopie1 to libopie2* (drw,ar,alwin) |
161 | * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) | 162 | * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) |
162 | * Clean-up of package information in control files (drw) | 163 | * Clean-up of package information in control files (drw) |
163 | * Repaired mediummount which was broken since integrating the quicklauncher (alwin) | 164 | * Repaired mediummount which was broken since integrating the quicklauncher (alwin) |
164 | * Improved big-screen support (zecke,ar) | 165 | * Improved big-screen support (zecke,ar) |
165 | * Improved multikeyboard support, added keyboard layout switching applet (mouse) | 166 | * Improved multikeyboard support, added keyboard layout switching applet (mouse) |
166 | * Added a new mail client based on libetpan (harlekin,alwin,jgf) | 167 | * Added a new mail client based on libetpan (harlekin,alwin,jgf) |
167 | * Added new package manager - opie-packagemanager (drw) | 168 | * Added new package manager - opie-packagemanager (drw) |
168 | * Improved light-n-power for C7x0 (mickeyl) | 169 | * Improved light-n-power for C7x0 (mickeyl) |
169 | * Added automatic rotation support for C7x0 (treke) | 170 | * Added automatic rotation support for C7x0 (treke) |
170 | * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) | 171 | * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) |
171 | * Added scanning the wireless network neighbourhood to networksettings (mickeyl) | 172 | * Added scanning the wireless network neighbourhood to networksettings (mickeyl) |
172 | 173 | ||
173 | 2003-11-29Opie 1.0.3 | 174 | 2003-11-29Opie 1.0.3 |
174 | 175 | ||
175 | * Released as Version 1.0.3 | 176 | * Released as Version 1.0.3 |
176 | * Improved i18n (various contributors) | 177 | * Improved i18n (various contributors) |
177 | * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) | 178 | * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) |
178 | * Made the Documents Tab optional (mickeyl) | 179 | * Made the Documents Tab optional (mickeyl) |
179 | * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) | 180 | * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) |
180 | 181 | ||
181 | 2003-08-04Opie 1.0.0 | 182 | 2003-08-04Opie 1.0.0 |
182 | 183 | ||
183 | * Released as Version 1.0.0 | 184 | * Released as Version 1.0.0 |
184 | * Including a PPP module for easy dial up (tille,harlekin,zecke) | 185 | * 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,240 +1,247 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "dvorak.h" | 21 | #include "dvorak.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | 24 | #include <qpe/config.h> | |
25 | #include <qwindowsystem_qws.h> | 25 | #include <qwindowsystem_qws.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | 31 | ||
32 | #define USE_SMALL_BACKSPACE | 32 | #define USE_SMALL_BACKSPACE |
33 | 33 | ||
34 | using namespace Dvorak; | 34 | using namespace Dvorak; |
35 | 35 | ||
36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : | 36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : |
37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
39 | unicode(-1), qkeycode(0), modifiers(0) | 39 | unicode(-1), qkeycode(0), modifiers(0) |
40 | { | 40 | { |
41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
42 | // setFont( QFont( "Helvetica", 8 ) ); | 42 | // setFont( QFont( "Helvetica", 8 ) ); |
43 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 43 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
44 | setPalette(QPalette(QColor(220,220,220))); // Gray | 44 | setPalette(QPalette(QColor(220,220,220))); // Gray |
45 | 45 | ||
46 | // get the default font | ||
47 | Config *config = new Config( "qpe" ); | ||
48 | config->setGroup( "Appearance" ); | ||
49 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | ||
50 | int fontSize = config->readNumEntry( "FontSize", 10 ); | ||
51 | delete config; | ||
52 | |||
46 | picks = new KeyboardPicks( this ); | 53 | picks = new KeyboardPicks( this ); |
47 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 54 | picks->setFont( QFont( familyStr, fontSize ) ); |
48 | setFont( QFont( "smallsmooth", 9 ) ); | 55 | setFont( QFont( familyStr, fontSize ) ); |
49 | picks->initialise(); | 56 | picks->initialise(); |
50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 57 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 58 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
52 | 59 | ||
53 | repeatTimer = new QTimer( this ); | 60 | repeatTimer = new QTimer( this ); |
54 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 61 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
55 | } | 62 | } |
56 | 63 | ||
57 | void Keyboard::resizeEvent(QResizeEvent*) | 64 | void Keyboard::resizeEvent(QResizeEvent*) |
58 | { | 65 | { |
59 | int ph = picks->sizeHint().height(); | 66 | int ph = picks->sizeHint().height(); |
60 | picks->setGeometry( 0, 0, width(), ph ); | 67 | picks->setGeometry( 0, 0, width(), ph ); |
61 | keyHeight = (height()-ph)/5; | 68 | keyHeight = (height()-ph)/5; |
62 | int nk; | 69 | int nk; |
63 | if ( useOptiKeys ) { | 70 | if ( useOptiKeys ) { |
64 | nk = 15; | 71 | nk = 15; |
65 | } else if ( useLargeKeys ) { | 72 | } else if ( useLargeKeys ) { |
66 | nk = 15; | 73 | nk = 15; |
67 | } else { | 74 | } else { |
68 | nk = 19; | 75 | nk = 19; |
69 | } | 76 | } |
70 | defaultKeyWidth = width()/nk; | 77 | defaultKeyWidth = width()/nk; |
71 | xoffs = (width()-defaultKeyWidth*nk)/2; | 78 | xoffs = (width()-defaultKeyWidth*nk)/2; |
72 | } | 79 | } |
73 | 80 | ||
74 | void KeyboardPicks::initialise() | 81 | void KeyboardPicks::initialise() |
75 | { | 82 | { |
76 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 83 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
77 | mode = 0; | 84 | mode = 0; |
78 | dc = new KeyboardConfig(this); | 85 | dc = new KeyboardConfig(this); |
79 | configs.append(dc); | 86 | configs.append(dc); |
80 | } | 87 | } |
81 | 88 | ||
82 | QSize KeyboardPicks::sizeHint() const | 89 | QSize KeyboardPicks::sizeHint() const |
83 | { | 90 | { |
84 | return QSize(240,fontMetrics().lineSpacing()); | 91 | return QSize(240,fontMetrics().lineSpacing()); |
85 | } | 92 | } |
86 | 93 | ||
87 | 94 | ||
88 | void KeyboardConfig::generateText(const QString &s) | 95 | void KeyboardConfig::generateText(const QString &s) |
89 | { | 96 | { |
90 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 97 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
91 | for (int i=0; i<(int)backspaces; i++) { | 98 | for (int i=0; i<(int)backspaces; i++) { |
92 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); | 99 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
93 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); | 100 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
94 | } | 101 | } |
95 | for (int i=0; i<(int)s.length(); i++) { | 102 | for (int i=0; i<(int)s.length(); i++) { |
96 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 103 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
97 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 104 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
98 | } | 105 | } |
99 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); | 106 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
100 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); | 107 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
101 | backspaces = 0; | 108 | backspaces = 0; |
102 | #endif | 109 | #endif |
103 | } | 110 | } |
104 | 111 | ||
105 | 112 | ||
106 | //PC keyboard layout and scancodes | 113 | //PC keyboard layout and scancodes |
107 | 114 | ||
108 | /* | 115 | /* |
109 | Format: length, code, length, code, ..., 0 | 116 | Format: length, code, length, code, ..., 0 |
110 | 117 | ||
111 | length is measured in half the width of a standard key. | 118 | length is measured in half the width of a standard key. |
112 | If code < 0x80 we have length/2 consecutive standard keys, | 119 | If code < 0x80 we have length/2 consecutive standard keys, |
113 | starting with scancode code. | 120 | starting with scancode code. |
114 | 121 | ||
115 | Special keys are hardcoded, one at a time, with length of key | 122 | Special keys are hardcoded, one at a time, with length of key |
116 | and code >= 0x80, these are NOT standard PC scancodes, but are looked | 123 | and code >= 0x80, these are NOT standard PC scancodes, but are looked |
117 | up in specialM[]. (The special keys are not keymappable.) | 124 | up in specialM[]. (The special keys are not keymappable.) |
118 | 125 | ||
119 | */ | 126 | */ |
120 | 127 | ||
121 | static const uchar * const keyboard_opti[5] = { | 128 | static const uchar * const keyboard_opti[5] = { |
122 | (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", | 129 | (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", |
123 | (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", | 130 | (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", |
124 | (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", | 131 | (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", |
125 | (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", | 132 | (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", |
126 | (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" | 133 | (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" |
127 | }; | 134 | }; |
128 | 135 | ||
129 | static const uchar * const keyboard_standard[5] = { | 136 | static const uchar * const keyboard_standard[5] = { |
130 | 137 | ||
131 | #ifdef USE_SMALL_BACKSPACE | 138 | #ifdef USE_SMALL_BACKSPACE |
132 | (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", | 139 | (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", |
133 | #else | 140 | #else |
134 | (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", | 141 | (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", |
135 | #endif | 142 | #endif |
136 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP | 143 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP |
137 | 144 | ||
138 | (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", | 145 | (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", |
139 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN | 146 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN |
140 | 147 | ||
141 | (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", | 148 | (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", |
142 | //CAPS + asdf.. + RETURN | 149 | //CAPS + asdf.. + RETURN |
143 | 150 | ||
144 | (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", | 151 | (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", |
145 | //SHIFT + zxcv... //+ UP | 152 | //SHIFT + zxcv... //+ UP |
146 | 153 | ||
147 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" | 154 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" |
148 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT | 155 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT |
149 | 156 | ||
150 | }; | 157 | }; |
151 | 158 | ||
152 | 159 | ||
153 | struct ShiftMap { | 160 | struct ShiftMap { |
154 | char normal; | 161 | char normal; |
155 | char shifted; | 162 | char shifted; |
156 | }; | 163 | }; |
157 | 164 | ||
158 | 165 | ||
159 | static const ShiftMap shiftMap[] = { | 166 | static const ShiftMap shiftMap[] = { |
160 | { '`', '~' }, | 167 | { '`', '~' }, |
161 | { '1', '!' }, | 168 | { '1', '!' }, |
162 | { '2', '@' }, | 169 | { '2', '@' }, |
163 | { '3', '#' }, | 170 | { '3', '#' }, |
164 | { '4', '$' }, | 171 | { '4', '$' }, |
165 | { '5', '%' }, | 172 | { '5', '%' }, |
166 | { '6', '^' }, | 173 | { '6', '^' }, |
167 | { '7', '&' }, | 174 | { '7', '&' }, |
168 | { '8', '*' }, | 175 | { '8', '*' }, |
169 | { '9', '(' }, | 176 | { '9', '(' }, |
170 | { '0', ')' }, | 177 | { '0', ')' }, |
171 | { '-', '_' }, | 178 | { '-', '_' }, |
172 | { '=', '+' }, | 179 | { '=', '+' }, |
173 | { '\\', '|' }, | 180 | { '\\', '|' }, |
174 | { '[', '{' }, | 181 | { '[', '{' }, |
175 | { ']', '}' }, | 182 | { ']', '}' }, |
176 | { ';', ':' }, | 183 | { ';', ':' }, |
177 | { '\'', '"' }, | 184 | { '\'', '"' }, |
178 | { ',', '<' }, | 185 | { ',', '<' }, |
179 | { '.', '>' }, | 186 | { '.', '>' }, |
180 | { '/', '?' } | 187 | { '/', '?' } |
181 | }; | 188 | }; |
182 | 189 | ||
183 | 190 | ||
184 | /* XPM */ | 191 | /* XPM */ |
185 | static const char * const uparrow_xpm[]={ | 192 | static const char * const uparrow_xpm[]={ |
186 | "9 9 2 1", | 193 | "9 9 2 1", |
187 | "a c #000000", | 194 | "a c #000000", |
188 | ". c None", | 195 | ". c None", |
189 | ".........", | 196 | ".........", |
190 | "....a....", | 197 | "....a....", |
191 | "...aaa...", | 198 | "...aaa...", |
192 | "..aaaaa..", | 199 | "..aaaaa..", |
193 | "....a....", | 200 | "....a....", |
194 | "....a....", | 201 | "....a....", |
195 | "....a....", | 202 | "....a....", |
196 | "....a....", | 203 | "....a....", |
197 | "........."}; | 204 | "........."}; |
198 | /* XPM */ | 205 | /* XPM */ |
199 | static const char * const leftarrow_xpm[]={ | 206 | static const char * const leftarrow_xpm[]={ |
200 | "9 9 2 1", | 207 | "9 9 2 1", |
201 | "a c #000000", | 208 | "a c #000000", |
202 | ". c None", | 209 | ". c None", |
203 | ".........", | 210 | ".........", |
204 | ".........", | 211 | ".........", |
205 | "...a.....", | 212 | "...a.....", |
206 | "..aa.....", | 213 | "..aa.....", |
207 | ".aaaaaaa.", | 214 | ".aaaaaaa.", |
208 | "..aa.....", | 215 | "..aa.....", |
209 | "...a.....", | 216 | "...a.....", |
210 | ".........", | 217 | ".........", |
211 | "........."}; | 218 | "........."}; |
212 | /* XPM */ | 219 | /* XPM */ |
213 | static const char * const downarrow_xpm[]={ | 220 | static const char * const downarrow_xpm[]={ |
214 | "9 9 2 1", | 221 | "9 9 2 1", |
215 | "a c #000000", | 222 | "a c #000000", |
216 | ". c None", | 223 | ". c None", |
217 | ".........", | 224 | ".........", |
218 | "....a....", | 225 | "....a....", |
219 | "....a....", | 226 | "....a....", |
220 | "....a....", | 227 | "....a....", |
221 | "....a....", | 228 | "....a....", |
222 | "..aaaaa..", | 229 | "..aaaaa..", |
223 | "...aaa...", | 230 | "...aaa...", |
224 | "....a....", | 231 | "....a....", |
225 | "........."}; | 232 | "........."}; |
226 | /* XPM */ | 233 | /* XPM */ |
227 | static const char * const rightarrow_xpm[]={ | 234 | static const char * const rightarrow_xpm[]={ |
228 | "9 9 2 1", | 235 | "9 9 2 1", |
229 | "a c #000000", | 236 | "a c #000000", |
230 | ". c None", | 237 | ". c None", |
231 | ".........", | 238 | ".........", |
232 | ".........", | 239 | ".........", |
233 | ".....a...", | 240 | ".....a...", |
234 | ".....aa..", | 241 | ".....aa..", |
235 | ".aaaaaaa.", | 242 | ".aaaaaaa.", |
236 | ".....aa..", | 243 | ".....aa..", |
237 | ".....a...", | 244 | ".....a...", |
238 | ".........", | 245 | ".........", |
239 | "........."}; | 246 | "........."}; |
240 | /* XPM */ | 247 | /* XPM */ |
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,241 +1,248 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "keyboard.h" | 21 | #include "keyboard.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | 24 | #include <qpe/config.h> | |
25 | #include <qwindowsystem_qws.h> | 25 | #include <qwindowsystem_qws.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | #include <sys/utsname.h> | 31 | #include <sys/utsname.h> |
32 | 32 | ||
33 | using namespace KeyboardInput; | 33 | using namespace KeyboardInput; |
34 | 34 | ||
35 | #define USE_SMALL_BACKSPACE | 35 | #define USE_SMALL_BACKSPACE |
36 | 36 | ||
37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
40 | unicode(-1), qkeycode(0), modifiers(0) | 40 | unicode(-1), qkeycode(0), modifiers(0) |
41 | { | 41 | { |
42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
43 | // setFont( QFont( "Helvetica", 8 ) ); | 43 | // setFont( QFont( "Helvetica", 8 ) ); |
44 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 44 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
45 | setPalette(QPalette(QColor(220,220,220))); // Gray | 45 | setPalette(QPalette(QColor(220,220,220))); // Gray |
46 | 46 | ||
47 | // get the default font | ||
48 | Config *config = new Config( "qpe" ); | ||
49 | config->setGroup( "Appearance" ); | ||
50 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | ||
51 | int fontSize = config->readNumEntry( "FontSize", 10 ); | ||
52 | delete config; | ||
53 | |||
47 | picks = new KeyboardPicks( this ); | 54 | picks = new KeyboardPicks( this ); |
48 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 55 | picks->setFont( QFont( familyStr, fontSize ) ); |
49 | setFont( QFont( "smallsmooth", 9 ) ); | 56 | setFont( QFont( familyStr, fontSize ) ); |
50 | picks->initialise(); | 57 | picks->initialise(); |
51 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 58 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
52 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 59 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
53 | 60 | ||
54 | repeatTimer = new QTimer( this ); | 61 | repeatTimer = new QTimer( this ); |
55 | 62 | ||
56 | // temporary quick and dirty fix for the "sticky keyboard bug" | 63 | // temporary quick and dirty fix for the "sticky keyboard bug" |
57 | // on ipaq. | 64 | // on ipaq. |
58 | // struct utsname name; | 65 | // struct utsname name; |
59 | // if (uname(&name) != -1) | 66 | // if (uname(&name) != -1) |
60 | // { | 67 | // { |
61 | //QString release=name.release; | 68 | //QString release=name.release; |
62 | //qWarning("System release: %s\n", name.release); | 69 | //qWarning("System release: %s\n", name.release); |
63 | //if(release.find("embedix",0,TRUE) !=-1) | 70 | //if(release.find("embedix",0,TRUE) !=-1) |
64 | // { | 71 | // { |
65 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 72 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
66 | // } | 73 | // } |
67 | // } | 74 | // } |
68 | } | 75 | } |
69 | 76 | ||
70 | void Keyboard::resizeEvent(QResizeEvent*) | 77 | void Keyboard::resizeEvent(QResizeEvent*) |
71 | { | 78 | { |
72 | int ph = picks->sizeHint().height(); | 79 | int ph = picks->sizeHint().height(); |
73 | picks->setGeometry( 0, 0, width(), ph ); | 80 | picks->setGeometry( 0, 0, width(), ph ); |
74 | keyHeight = (height()-ph)/5; | 81 | keyHeight = (height()-ph)/5; |
75 | int nk; | 82 | int nk; |
76 | if ( useOptiKeys ) { | 83 | if ( useOptiKeys ) { |
77 | nk = 15; | 84 | nk = 15; |
78 | } else if ( useLargeKeys ) { | 85 | } else if ( useLargeKeys ) { |
79 | nk = 15; | 86 | nk = 15; |
80 | } else { | 87 | } else { |
81 | nk = 19; | 88 | nk = 19; |
82 | } | 89 | } |
83 | defaultKeyWidth = width()/nk; | 90 | defaultKeyWidth = width()/nk; |
84 | xoffs = (width()-defaultKeyWidth*nk)/2; | 91 | xoffs = (width()-defaultKeyWidth*nk)/2; |
85 | } | 92 | } |
86 | 93 | ||
87 | void KeyboardPicks::initialise() | 94 | void KeyboardPicks::initialise() |
88 | { | 95 | { |
89 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 96 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
90 | mode = 0; | 97 | mode = 0; |
91 | dc = new KeyboardConfig(this); | 98 | dc = new KeyboardConfig(this); |
92 | configs.append(dc); | 99 | configs.append(dc); |
93 | } | 100 | } |
94 | 101 | ||
95 | QSize KeyboardPicks::sizeHint() const | 102 | QSize KeyboardPicks::sizeHint() const |
96 | { | 103 | { |
97 | return QSize(240,fontMetrics().lineSpacing()); | 104 | return QSize(240,fontMetrics().lineSpacing()); |
98 | } | 105 | } |
99 | 106 | ||
100 | 107 | ||
101 | void KeyboardConfig::generateText(const QString &s) | 108 | void KeyboardConfig::generateText(const QString &s) |
102 | { | 109 | { |
103 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 110 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
104 | for (int i=0; i<(int)backspaces; i++) { | 111 | for (int i=0; i<(int)backspaces; i++) { |
105 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); | 112 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
106 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); | 113 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
107 | } | 114 | } |
108 | for (int i=0; i<(int)s.length(); i++) { | 115 | for (int i=0; i<(int)s.length(); i++) { |
109 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 116 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
110 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 117 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
111 | } | 118 | } |
112 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); | 119 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
113 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); | 120 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
114 | backspaces = 0; | 121 | backspaces = 0; |
115 | #endif | 122 | #endif |
116 | } | 123 | } |
117 | 124 | ||
118 | 125 | ||
119 | //PC keyboard layout and scancodes | 126 | //PC keyboard layout and scancodes |
120 | 127 | ||
121 | /* | 128 | /* |
122 | Format: length, code, length, code, ..., 0 | 129 | Format: length, code, length, code, ..., 0 |
123 | 130 | ||
124 | length is measured in half the width of a standard key. | 131 | length is measured in half the width of a standard key. |
125 | If code < 0x80 we have length/2 consecutive standard keys, | 132 | If code < 0x80 we have length/2 consecutive standard keys, |
126 | starting with scancode code. | 133 | starting with scancode code. |
127 | 134 | ||
128 | Special keys are hardcoded, one at a time, with length of key | 135 | Special keys are hardcoded, one at a time, with length of key |
129 | and code >= 0x80, these are NOT standard PC scancodes, but are looked | 136 | and code >= 0x80, these are NOT standard PC scancodes, but are looked |
130 | up in specialM[]. (The special keys are not keymappable.) | 137 | up in specialM[]. (The special keys are not keymappable.) |
131 | 138 | ||
132 | */ | 139 | */ |
133 | 140 | ||
134 | static const uchar * const keyboard_opti[5] = { | 141 | static const uchar * const keyboard_opti[5] = { |
135 | (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", | 142 | (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", |
136 | (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", | 143 | (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", |
137 | (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", | 144 | (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", |
138 | (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", | 145 | (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", |
139 | (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" | 146 | (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" |
140 | }; | 147 | }; |
141 | 148 | ||
142 | 149 | ||
143 | static const uchar * const keyboard_standard[5] = { | 150 | static const uchar * const keyboard_standard[5] = { |
144 | 151 | ||
145 | #ifdef USE_SMALL_BACKSPACE | 152 | #ifdef USE_SMALL_BACKSPACE |
146 | (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", | 153 | (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", |
147 | #else | 154 | #else |
148 | (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", | 155 | (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", |
149 | #endif | 156 | #endif |
150 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP | 157 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP |
151 | 158 | ||
152 | (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", | 159 | (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", |
153 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN | 160 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN |
154 | 161 | ||
155 | (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", | 162 | (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", |
156 | //CAPS + asdf.. + RETURN | 163 | //CAPS + asdf.. + RETURN |
157 | 164 | ||
158 | (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", | 165 | (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", |
159 | //SHIFT + zxcv... //+ UP | 166 | //SHIFT + zxcv... //+ UP |
160 | 167 | ||
161 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" | 168 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" |
162 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT | 169 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT |
163 | 170 | ||
164 | }; | 171 | }; |
165 | 172 | ||
166 | 173 | ||
167 | struct ShiftMap { | 174 | struct ShiftMap { |
168 | char normal; | 175 | char normal; |
169 | char shifted; | 176 | char shifted; |
170 | }; | 177 | }; |
171 | 178 | ||
172 | 179 | ||
173 | static const ShiftMap shiftMap[] = { | 180 | static const ShiftMap shiftMap[] = { |
174 | { '`', '~' }, | 181 | { '`', '~' }, |
175 | { '1', '!' }, | 182 | { '1', '!' }, |
176 | { '2', '@' }, | 183 | { '2', '@' }, |
177 | { '3', '#' }, | 184 | { '3', '#' }, |
178 | { '4', '$' }, | 185 | { '4', '$' }, |
179 | { '5', '%' }, | 186 | { '5', '%' }, |
180 | { '6', '^' }, | 187 | { '6', '^' }, |
181 | { '7', '&' }, | 188 | { '7', '&' }, |
182 | { '8', '*' }, | 189 | { '8', '*' }, |
183 | { '9', '(' }, | 190 | { '9', '(' }, |
184 | { '0', ')' }, | 191 | { '0', ')' }, |
185 | { '-', '_' }, | 192 | { '-', '_' }, |
186 | { '=', '+' }, | 193 | { '=', '+' }, |
187 | { '\\', '|' }, | 194 | { '\\', '|' }, |
188 | { '[', '{' }, | 195 | { '[', '{' }, |
189 | { ']', '}' }, | 196 | { ']', '}' }, |
190 | { ';', ':' }, | 197 | { ';', ':' }, |
191 | { '\'', '"' }, | 198 | { '\'', '"' }, |
192 | { ',', '<' }, | 199 | { ',', '<' }, |
193 | { '.', '>' }, | 200 | { '.', '>' }, |
194 | { '/', '?' } | 201 | { '/', '?' } |
195 | }; | 202 | }; |
196 | 203 | ||
197 | 204 | ||
198 | /* XPM */ | 205 | /* XPM */ |
199 | static const char * const uparrow_xpm[]={ | 206 | static const char * const uparrow_xpm[]={ |
200 | "9 9 2 1", | 207 | "9 9 2 1", |
201 | "a c #000000", | 208 | "a c #000000", |
202 | ". c None", | 209 | ". c None", |
203 | ".........", | 210 | ".........", |
204 | "....a....", | 211 | "....a....", |
205 | "...aaa...", | 212 | "...aaa...", |
206 | "..aaaaa..", | 213 | "..aaaaa..", |
207 | "....a....", | 214 | "....a....", |
208 | "....a....", | 215 | "....a....", |
209 | "....a....", | 216 | "....a....", |
210 | "....a....", | 217 | "....a....", |
211 | "........."}; | 218 | "........."}; |
212 | /* XPM */ | 219 | /* XPM */ |
213 | static const char * const leftarrow_xpm[]={ | 220 | static const char * const leftarrow_xpm[]={ |
214 | "9 9 2 1", | 221 | "9 9 2 1", |
215 | "a c #000000", | 222 | "a c #000000", |
216 | ". c None", | 223 | ". c None", |
217 | ".........", | 224 | ".........", |
218 | ".........", | 225 | ".........", |
219 | "...a.....", | 226 | "...a.....", |
220 | "..aa.....", | 227 | "..aa.....", |
221 | ".aaaaaaa.", | 228 | ".aaaaaaa.", |
222 | "..aa.....", | 229 | "..aa.....", |
223 | "...a.....", | 230 | "...a.....", |
224 | ".........", | 231 | ".........", |
225 | "........."}; | 232 | "........."}; |
226 | /* XPM */ | 233 | /* XPM */ |
227 | static const char * const downarrow_xpm[]={ | 234 | static const char * const downarrow_xpm[]={ |
228 | "9 9 2 1", | 235 | "9 9 2 1", |
229 | "a c #000000", | 236 | "a c #000000", |
230 | ". c None", | 237 | ". c None", |
231 | ".........", | 238 | ".........", |
232 | "....a....", | 239 | "....a....", |
233 | "....a....", | 240 | "....a....", |
234 | "....a....", | 241 | "....a....", |
235 | "....a....", | 242 | "....a....", |
236 | "..aaaaa..", | 243 | "..aaaaa..", |
237 | "...aaa...", | 244 | "...aaa...", |
238 | "....a....", | 245 | "....a....", |
239 | "........."}; | 246 | "........."}; |
240 | /* XPM */ | 247 | /* XPM */ |
241 | static const char * const rightarrow_xpm[]={ | 248 | static const char * const rightarrow_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,273 +1,273 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "keyboard.h" | 21 | #include "keyboard.h" |
22 | #include "configdlg.h" | 22 | #include "configdlg.h" |
23 | 23 | ||
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | 26 | ||
27 | #include <qwindowsystem_qws.h> | 27 | #include <qwindowsystem_qws.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qfontmetrics.h> | 29 | #include <qfontmetrics.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <ctype.h> | 33 | #include <ctype.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | 37 | ||
38 | #include <sys/utsname.h> | 38 | #include <sys/utsname.h> |
39 | 39 | ||
40 | using namespace MultiKey; | 40 | using namespace MultiKey; |
41 | 41 | ||
42 | static const char * const kb_config_xpm[] = { | 42 | static const char * const kb_config_xpm[] = { |
43 | "13 7 2 1", | 43 | "13 7 2 1", |
44 | " c None", | 44 | " c None", |
45 | ". c #000000", | 45 | ". c #000000", |
46 | " ", | 46 | " ", |
47 | " . ", | 47 | " . ", |
48 | " ... ", | 48 | " ... ", |
49 | " ..... ", | 49 | " ..... ", |
50 | " . ", | 50 | " . ", |
51 | " . ", | 51 | " . ", |
52 | " "}; | 52 | " "}; |
53 | 53 | ||
54 | /* Keyboard::Keyboard {{{1 */ | 54 | /* Keyboard::Keyboard {{{1 */ |
55 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 55 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
56 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), | 56 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), |
57 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), | 57 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), |
58 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), | 58 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), |
59 | pressedKeyRow(-1), pressedKeyCol(-1), | 59 | pressedKeyRow(-1), pressedKeyCol(-1), |
60 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 60 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
61 | configdlg(0) | 61 | configdlg(0) |
62 | 62 | ||
63 | { | 63 | { |
64 | 64 | ||
65 | // get the default font | 65 | // get the default font |
66 | Config *config = new Config( "qpe" ); | 66 | Config *config = new Config( "qpe" ); |
67 | config->setGroup( "Appearance" ); | 67 | config->setGroup( "Appearance" ); |
68 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | 68 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); |
69 | int fontSize = config->readNumEntry( "FontSize", 10 ); | ||
69 | delete config; | 70 | delete config; |
70 | 71 | ||
71 | config = new Config("multikey"); | 72 | config = new Config("multikey"); |
72 | config->setGroup ("general"); | 73 | config->setGroup ("general"); |
73 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed | 74 | usePicks = config->readBoolEntry ("usePickboard", 0); // default closed |
74 | useRepeat = config->readBoolEntry ("useRepeat", 1); | 75 | useRepeat = config->readBoolEntry ("useRepeat", 1); |
75 | delete config; | 76 | delete config; |
76 | 77 | ||
77 | 78 | setFont( QFont( familyStr, fontSize ) ); | |
78 | setFont( QFont( familyStr, 10 ) ); | ||
79 | 79 | ||
80 | picks = new KeyboardPicks( this ); | 80 | picks = new KeyboardPicks( this ); |
81 | picks->setFont( QFont( familyStr, 10 ) ); | 81 | picks->setFont( QFont( familyStr, fontSize ) ); |
82 | picks->initialise(); | 82 | picks->initialise(); |
83 | if (usePicks) { | 83 | if (usePicks) { |
84 | 84 | ||
85 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 85 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
86 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 86 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
87 | 87 | ||
88 | } else picks->hide(); | 88 | } else picks->hide(); |
89 | 89 | ||
90 | loadKeyboardColors(); | 90 | loadKeyboardColors(); |
91 | 91 | ||
92 | keys = new Keys(); | 92 | keys = new Keys(); |
93 | 93 | ||
94 | repeatTimer = new QTimer( this ); | 94 | repeatTimer = new QTimer( this ); |
95 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 95 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
96 | 96 | ||
97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); | 97 | QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); |
98 | connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 98 | connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(receive(const QCString&,const QByteArray&))); | 99 | this, SLOT(receive(const QCString&,const QByteArray&))); |
100 | } | 100 | } |
101 | 101 | ||
102 | Keyboard::~Keyboard() { | 102 | Keyboard::~Keyboard() { |
103 | 103 | ||
104 | if ( configdlg ) { | 104 | if ( configdlg ) { |
105 | delete configdlg; | 105 | delete configdlg; |
106 | configdlg = 0; | 106 | configdlg = 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | /* Keyboard::resizeEvent {{{1 */ | 111 | /* Keyboard::resizeEvent {{{1 */ |
112 | void Keyboard::resizeEvent(QResizeEvent*) | 112 | void Keyboard::resizeEvent(QResizeEvent*) |
113 | { | 113 | { |
114 | int ph = picks->sizeHint().height(); | 114 | int ph = picks->sizeHint().height(); |
115 | picks->setGeometry( 0, 0, width(), ph ); | 115 | picks->setGeometry( 0, 0, width(), ph ); |
116 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); | 116 | keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); |
117 | 117 | ||
118 | int nk; // number of keys? | 118 | int nk; // number of keys? |
119 | if ( useLargeKeys ) { | 119 | if ( useLargeKeys ) { |
120 | nk = 15; | 120 | nk = 15; |
121 | } else { | 121 | } else { |
122 | nk = 19; | 122 | nk = 19; |
123 | } | 123 | } |
124 | defaultKeyWidth = (width()/nk)/2; | 124 | defaultKeyWidth = (width()/nk)/2; |
125 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? | 125 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | /* KeyboardPicks::initialize {{{1 */ | 129 | /* KeyboardPicks::initialize {{{1 */ |
130 | void KeyboardPicks::initialise() | 130 | void KeyboardPicks::initialise() |
131 | { | 131 | { |
132 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 132 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
133 | mode = 0; | 133 | mode = 0; |
134 | dc = new KeyboardConfig(this); | 134 | dc = new KeyboardConfig(this); |
135 | configs.append(dc); | 135 | configs.append(dc); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* KeyboardPicks::sizeHint {{{1 */ | 138 | /* KeyboardPicks::sizeHint {{{1 */ |
139 | QSize KeyboardPicks::sizeHint() const | 139 | QSize KeyboardPicks::sizeHint() const |
140 | { | 140 | { |
141 | return QSize(240,fontMetrics().lineSpacing()); | 141 | return QSize(240,fontMetrics().lineSpacing()); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | /* KeyboardConfig::generateText {{{1 */ | 145 | /* KeyboardConfig::generateText {{{1 */ |
146 | void KeyboardConfig::generateText(const QString &s) | 146 | void KeyboardConfig::generateText(const QString &s) |
147 | { | 147 | { |
148 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 148 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
149 | for (int i=0; i<(int)backspaces; i++) { | 149 | for (int i=0; i<(int)backspaces; i++) { |
150 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); | 150 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
151 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); | 151 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
152 | } | 152 | } |
153 | for (int i=0; i<(int)s.length(); i++) { | 153 | for (int i=0; i<(int)s.length(); i++) { |
154 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 154 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
155 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 155 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
156 | } | 156 | } |
157 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); | 157 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
158 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); | 158 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
159 | backspaces = 0; | 159 | backspaces = 0; |
160 | #endif | 160 | #endif |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | /* Keyboard::paintEvent {{{1 */ | 166 | /* Keyboard::paintEvent {{{1 */ |
167 | void Keyboard::paintEvent(QPaintEvent* e) | 167 | void Keyboard::paintEvent(QPaintEvent* e) |
168 | { | 168 | { |
169 | QPainter painter(this); | 169 | QPainter painter(this); |
170 | painter.setClipRect(e->rect()); | 170 | painter.setClipRect(e->rect()); |
171 | drawKeyboard( painter ); | 171 | drawKeyboard( painter ); |
172 | picks->dc->draw( &painter ); | 172 | picks->dc->draw( &painter ); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
176 | /* Keyboard::drawKeyboard {{{1 */ | 176 | /* Keyboard::drawKeyboard {{{1 */ |
177 | 177 | ||
178 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) | 178 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) |
179 | { | 179 | { |
180 | 180 | ||
181 | 181 | ||
182 | if (row != -1 && col != -1) { //just redraw one key | 182 | if (row != -1 && col != -1) { //just redraw one key |
183 | 183 | ||
184 | int x = 0; | 184 | int x = 0; |
185 | for (int i = 0; i < col; i++) { | 185 | for (int i = 0; i < col; i++) { |
186 | 186 | ||
187 | x += keys->width(row, i) * defaultKeyWidth; | 187 | x += keys->width(row, i) * defaultKeyWidth; |
188 | } | 188 | } |
189 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 189 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
190 | 190 | ||
191 | int keyWidth = keys->width(row, col); | 191 | int keyWidth = keys->width(row, col); |
192 | 192 | ||
193 | p.fillRect(x + 1, y + 1, | 193 | p.fillRect(x + 1, y + 1, |
194 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, | 194 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, |
195 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); | 195 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); |
196 | 196 | ||
197 | QImage *pix = keys->pix(row,col); | 197 | QImage *pix = keys->pix(row,col); |
198 | 198 | ||
199 | ushort c = keys->uni(row, col); | 199 | ushort c = keys->uni(row, col); |
200 | 200 | ||
201 | p.setPen(textcolor); | 201 | p.setPen(textcolor); |
202 | if (!pix) { | 202 | if (!pix) { |
203 | if ((shift || lock) && keys->shift(c)) | 203 | if ((shift || lock) && keys->shift(c)) |
204 | 204 | ||
205 | if (circumflex && keys->circumflex(keys->shift(c))) | 205 | if (circumflex && keys->circumflex(keys->shift(c))) |
206 | c = keys->circumflex(keys->shift(c)); | 206 | c = keys->circumflex(keys->shift(c)); |
207 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | 207 | else if (diaeresis && keys->diaeresis(keys->shift(c))) |
208 | c = keys->diaeresis(keys->shift(c)); | 208 | c = keys->diaeresis(keys->shift(c)); |
209 | else if (baccent && keys->baccent(keys->shift(c))) | 209 | else if (baccent && keys->baccent(keys->shift(c))) |
210 | c = keys->baccent(keys->shift(c)); | 210 | c = keys->baccent(keys->shift(c)); |
211 | else if (accent && keys->accent(keys->shift(c))) | 211 | else if (accent && keys->accent(keys->shift(c))) |
212 | c = keys->accent(keys->shift(c)); | 212 | c = keys->accent(keys->shift(c)); |
213 | else if (meta && keys->meta(keys->shift(c))) | 213 | else if (meta && keys->meta(keys->shift(c))) |
214 | c = keys->meta(keys->shift(c)); | 214 | c = keys->meta(keys->shift(c)); |
215 | else | 215 | else |
216 | c = keys->shift(c); | 216 | c = keys->shift(c); |
217 | 217 | ||
218 | else if (meta && keys->meta(c)) | 218 | else if (meta && keys->meta(c)) |
219 | c = keys->meta(c); | 219 | c = keys->meta(c); |
220 | else if (circumflex && keys->circumflex(c)) | 220 | else if (circumflex && keys->circumflex(c)) |
221 | c = keys->circumflex(c); | 221 | c = keys->circumflex(c); |
222 | else if (baccent && keys->baccent(c)) | 222 | else if (baccent && keys->baccent(c)) |
223 | c = keys->baccent(c); | 223 | c = keys->baccent(c); |
224 | else if (accent && keys->accent(c)) | 224 | else if (accent && keys->accent(c)) |
225 | c = keys->accent(c); | 225 | c = keys->accent(c); |
226 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | 226 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { |
227 | 227 | ||
228 | // the diaeresis key itself has to be in the diaeresisMap, | 228 | // the diaeresis key itself has to be in the diaeresisMap, |
229 | // or just do this to make it display the diaeresis char. | 229 | // or just do this to make it display the diaeresis char. |
230 | 230 | ||
231 | if (c == 0x2c6) | 231 | if (c == 0x2c6) |
232 | c = 0xa8; | 232 | c = 0xa8; |
233 | else | 233 | else |
234 | c = keys->diaeresis(c); | 234 | c = keys->diaeresis(c); |
235 | } | 235 | } |
236 | 236 | ||
237 | p.drawText(x, y, | 237 | p.drawText(x, y, |
238 | defaultKeyWidth * keyWidth + 3, keyHeight, | 238 | defaultKeyWidth * keyWidth + 3, keyHeight, |
239 | AlignCenter, (QChar)c); | 239 | AlignCenter, (QChar)c); |
240 | } | 240 | } |
241 | else | 241 | else |
242 | // center the image in the middle of the key | 242 | // center the image in the middle of the key |
243 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, | 243 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, |
244 | y + (keyHeight - pix->height())/2 + 1, | 244 | y + (keyHeight - pix->height())/2 + 1, |
245 | *pix ); | 245 | *pix ); |
246 | 246 | ||
247 | // this fixes the problem that the very right end of the board's vertical line | 247 | // this fixes the problem that the very right end of the board's vertical line |
248 | // gets painted over, because it's one pixel shorter than all other keys | 248 | // gets painted over, because it's one pixel shorter than all other keys |
249 | p.setPen(keycolor_lines); | 249 | p.setPen(keycolor_lines); |
250 | p.drawLine(width() - 1, 0, width() - 1, height()); | 250 | p.drawLine(width() - 1, 0, width() - 1, height()); |
251 | 251 | ||
252 | } else { | 252 | } else { |
253 | 253 | ||
254 | 254 | ||
255 | p.fillRect(0, 0, width(), height(), keycolor); | 255 | p.fillRect(0, 0, width(), height(), keycolor); |
256 | 256 | ||
257 | for (row = 1; row <= keys->rows(); row++) { | 257 | for (row = 1; row <= keys->rows(); row++) { |
258 | 258 | ||
259 | int x = 0; | 259 | int x = 0; |
260 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 260 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
261 | 261 | ||
262 | p.setPen(keycolor_lines); | 262 | p.setPen(keycolor_lines); |
263 | p.drawLine(x, y, x + width(), y); | 263 | p.drawLine(x, y, x + width(), y); |
264 | 264 | ||
265 | for (int col = 0; col < keys->numKeys(row); col++) { | 265 | for (int col = 0; col < keys->numKeys(row); col++) { |
266 | 266 | ||
267 | QImage *pix = keys->pix(row, col); | 267 | QImage *pix = keys->pix(row, col); |
268 | int keyWidth = keys->width(row, col); | 268 | int keyWidth = keys->width(row, col); |
269 | 269 | ||
270 | 270 | ||
271 | int keyWidthPix = defaultKeyWidth * keyWidth; | 271 | int keyWidthPix = defaultKeyWidth * keyWidth; |
272 | 272 | ||
273 | if (keys->pressed(row, col)) | 273 | if (keys->pressed(row, col)) |
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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "pickboard.h" | 20 | #include "pickboard.h" |
21 | #include "pickboardpicks.h" | 21 | #include "pickboardpicks.h" |
22 | #include "pickboardcfg.h" | 22 | #include "pickboardcfg.h" |
23 | 23 | ||
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | 25 | #include <qpe/config.h> | |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qlist.h> | 27 | #include <qlist.h> |
28 | #include <qbitmap.h> | 28 | #include <qbitmap.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | #include <qscrollview.h> | 32 | #include <qscrollview.h> |
33 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
34 | #include <qhbuttongroup.h> | 34 | #include <qhbuttongroup.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #ifdef QWS | 37 | #ifdef QWS |
38 | #include <qwindowsystem_qws.h> | 38 | #include <qwindowsystem_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | /*! \class Pickboard | 41 | /*! \class Pickboard |
42 | \brief The Pickboard class provides an input method | 42 | \brief The Pickboard class provides an input method |
43 | based on a virtual keyboard combined with word-completion. | 43 | based on a virtual keyboard combined with word-completion. |
44 | 44 | ||
45 | This version of Pickboard is Dual Licensed Software. However, for you to be | 45 | This version of Pickboard is Dual Licensed Software. However, for you to be |
46 | able to license the technology to others, you may require a T9(R) Text | 46 | able to license the technology to others, you may require a T9(R) Text |
47 | Input license from Tegic Communications Corporation. More information can | 47 | Input license from Tegic Communications Corporation. More information can |
48 | be found at http://www.t9.com/. | 48 | be found at http://www.t9.com/. |
49 | 49 | ||
50 | \legalese | 50 | \legalese |
51 | This version of Pickboard is Dual Licensed Software. However, for you to be | 51 | This version of Pickboard is Dual Licensed Software. However, for you to be |
52 | able to license the technology to others, you may require a T9(R) Text | 52 | able to license the technology to others, you may require a T9(R) Text |
53 | Input license from Tegic Communications Corporation. More information can | 53 | Input license from Tegic Communications Corporation. More information can |
54 | be found at http://www.t9.com/. | 54 | be found at http://www.t9.com/. |
55 | */ | 55 | */ |
56 | 56 | ||
57 | /* XPM */ | 57 | /* XPM */ |
58 | static const char * const menu_xpm[]={ | 58 | static const char * const menu_xpm[]={ |
59 | "9 9 2 1", | 59 | "9 9 2 1", |
60 | "a c #000000", | 60 | "a c #000000", |
61 | ". c None", | 61 | ". c None", |
62 | ".........", | 62 | ".........", |
63 | ".........", | 63 | ".........", |
64 | ".........", | 64 | ".........", |
65 | "....a....", | 65 | "....a....", |
66 | "...aaa...", | 66 | "...aaa...", |
67 | "..aaaaa..", | 67 | "..aaaaa..", |
68 | ".aaaaaaa.", | 68 | ".aaaaaaa.", |
69 | ".........", | 69 | ".........", |
70 | "........."}; | 70 | "........."}; |
71 | 71 | ||
72 | class PickboardPrivate { | 72 | class PickboardPrivate { |
73 | public: | 73 | public: |
74 | PickboardPrivate(Pickboard* parent) | 74 | PickboardPrivate(Pickboard* parent) |
75 | { | 75 | { |
76 | picks = new PickboardPicks(parent); | 76 | picks = new PickboardPicks(parent); |
77 | picks->initialise(); | 77 | picks->initialise(); |
78 | menu = new QPushButton(parent); | 78 | menu = new QPushButton(parent); |
79 | menu->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding)); | 79 | menu->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding)); |
80 | menu->setPixmap(QPixmap((const char **)menu_xpm)); | 80 | menu->setPixmap(QPixmap((const char **)menu_xpm)); |
81 | QObject::connect(menu,SIGNAL(clicked()),picks,SLOT(doMenu())); | 81 | QObject::connect(menu,SIGNAL(clicked()),picks,SLOT(doMenu())); |
82 | QObject::connect(picks,SIGNAL(key(ushort,ushort,ushort,bool,bool)), | 82 | QObject::connect(picks,SIGNAL(key(ushort,ushort,ushort,bool,bool)), |
83 | parent,SIGNAL(key(ushort,ushort,ushort,bool,bool))); | 83 | parent,SIGNAL(key(ushort,ushort,ushort,bool,bool))); |
84 | } | 84 | } |
85 | 85 | ||
86 | PickboardPicks* picks; | 86 | PickboardPicks* picks; |
87 | QPushButton* menu; | 87 | QPushButton* menu; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) : | 90 | Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) : |
91 | QFrame(parent,name,f) | 91 | QFrame(parent,name,f) |
92 | { | 92 | { |
93 | (new QHBoxLayout(this))->setAutoAdd(TRUE); | 93 | (new QHBoxLayout(this))->setAutoAdd(TRUE); |
94 | d = new PickboardPrivate(this); | 94 | d = new PickboardPrivate(this); |
95 | // under Win32 we may not have smallsmooth font | 95 | |
96 | #ifndef Q_OS_WIN32 | 96 | // get the default font |
97 | setFont( QFont( "smallsmooth", 9 ) ); | 97 | Config *config = new Config( "qpe" ); |
98 | #endif | 98 | config->setGroup( "Appearance" ); |
99 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | ||
100 | int fontSize = config->readNumEntry( "FontSize", 10 ); | ||
101 | delete config; | ||
102 | |||
103 | setFont( QFont( familyStr, fontSize ) ); | ||
99 | } | 104 | } |
100 | 105 | ||
101 | Pickboard::~Pickboard() | 106 | Pickboard::~Pickboard() |
102 | { | 107 | { |
103 | delete d; | 108 | delete d; |
104 | } | 109 | } |
105 | 110 | ||
106 | void Pickboard::resetState() | 111 | void Pickboard::resetState() |
107 | { | 112 | { |
108 | d->picks->resetState(); | 113 | d->picks->resetState(); |
109 | } | 114 | } |
110 | 115 | ||
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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "unikeyboard.h" | 21 | #include "unikeyboard.h" |
22 | 22 | ||
23 | #include <qpe/fontmanager.h> | 23 | #include <qpe/fontmanager.h> |
24 | 24 | #include <qpe/config.h> | |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qfontmetrics.h> | 26 | #include <qfontmetrics.h> |
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 28 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
29 | #include <qwindowsystem_qws.h> | 29 | #include <qwindowsystem_qws.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | static const int nw = 8; | 32 | static const int nw = 8; |
33 | 33 | ||
34 | typedef struct BlockMap { | 34 | typedef struct BlockMap { |
35 | ushort start; | 35 | ushort start; |
36 | ushort stop; | 36 | ushort stop; |
37 | const char *name; | 37 | const char *name; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | //# Start Code; Block Name | 40 | //# Start Code; Block Name |
41 | 41 | ||
42 | static const BlockMap blockMap[] = | 42 | static const BlockMap blockMap[] = |
43 | { | 43 | { |
44 | {0x0000, 0x007F, "Basic Latin"}, | 44 | {0x0000, 0x007F, "Basic Latin"}, |
45 | {0x0080, 0x00FF, "Latin-1 Supplement"}, | 45 | {0x0080, 0x00FF, "Latin-1 Supplement"}, |
46 | {0x0100, 0x017F, "Latin Extended-A"}, | 46 | {0x0100, 0x017F, "Latin Extended-A"}, |
47 | {0x0180, 0x024F, "Latin Extended-B"}, | 47 | {0x0180, 0x024F, "Latin Extended-B"}, |
48 | {0x0250, 0x02AF, "IPA Extensions"}, | 48 | {0x0250, 0x02AF, "IPA Extensions"}, |
49 | {0x02B0, 0x02FF, "Spacing Modifier Letters"}, | 49 | {0x02B0, 0x02FF, "Spacing Modifier Letters"}, |
50 | {0x0300, 0x036F, "Combining Diacritical Marks"}, | 50 | {0x0300, 0x036F, "Combining Diacritical Marks"}, |
51 | {0x0370, 0x03FF, "Greek"}, | 51 | {0x0370, 0x03FF, "Greek"}, |
52 | {0x0400, 0x04FF, "Cyrillic"}, | 52 | {0x0400, 0x04FF, "Cyrillic"}, |
53 | {0x0530, 0x058F, "Armenian"}, | 53 | {0x0530, 0x058F, "Armenian"}, |
54 | {0x0590, 0x05FF, "Hebrew"}, | 54 | {0x0590, 0x05FF, "Hebrew"}, |
55 | {0x0600, 0x06FF, "Arabic"}, | 55 | {0x0600, 0x06FF, "Arabic"}, |
56 | {0x0700, 0x074F, "Syriac "}, | 56 | {0x0700, 0x074F, "Syriac "}, |
57 | {0x0780, 0x07BF, "Thaana"}, | 57 | {0x0780, 0x07BF, "Thaana"}, |
58 | {0x0900, 0x097F, "Devanagari"}, | 58 | {0x0900, 0x097F, "Devanagari"}, |
59 | {0x0980, 0x09FF, "Bengali"}, | 59 | {0x0980, 0x09FF, "Bengali"}, |
60 | {0x0A00, 0x0A7F, "Gurmukhi"}, | 60 | {0x0A00, 0x0A7F, "Gurmukhi"}, |
61 | {0x0A80, 0x0AFF, "Gujarati"}, | 61 | {0x0A80, 0x0AFF, "Gujarati"}, |
62 | {0x0B00, 0x0B7F, "Oriya"}, | 62 | {0x0B00, 0x0B7F, "Oriya"}, |
63 | {0x0B80, 0x0BFF, "Tamil"}, | 63 | {0x0B80, 0x0BFF, "Tamil"}, |
64 | {0x0C00, 0x0C7F, "Telugu"}, | 64 | {0x0C00, 0x0C7F, "Telugu"}, |
65 | {0x0C80, 0x0CFF, "Kannada"}, | 65 | {0x0C80, 0x0CFF, "Kannada"}, |
66 | {0x0D00, 0x0D7F, "Malayalam"}, | 66 | {0x0D00, 0x0D7F, "Malayalam"}, |
67 | {0x0D80, 0x0DFF, "Sinhala"}, | 67 | {0x0D80, 0x0DFF, "Sinhala"}, |
68 | {0x0E00, 0x0E7F, "Thai"}, | 68 | {0x0E00, 0x0E7F, "Thai"}, |
69 | {0x0E80, 0x0EFF, "Lao"}, | 69 | {0x0E80, 0x0EFF, "Lao"}, |
70 | {0x0F00, 0x0FFF, "Tibetan"}, | 70 | {0x0F00, 0x0FFF, "Tibetan"}, |
71 | {0x1000, 0x109F, "Myanmar "}, | 71 | {0x1000, 0x109F, "Myanmar "}, |
72 | {0x10A0, 0x10FF, "Georgian"}, | 72 | {0x10A0, 0x10FF, "Georgian"}, |
73 | {0x1100, 0x11FF, "Hangul Jamo"}, | 73 | {0x1100, 0x11FF, "Hangul Jamo"}, |
74 | {0x1200, 0x137F, "Ethiopic"}, | 74 | {0x1200, 0x137F, "Ethiopic"}, |
75 | {0x13A0, 0x13FF, "Cherokee"}, | 75 | {0x13A0, 0x13FF, "Cherokee"}, |
76 | {0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics"}, | 76 | {0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics"}, |
77 | {0x1680, 0x169F, "Ogham"}, | 77 | {0x1680, 0x169F, "Ogham"}, |
78 | {0x16A0, 0x16FF, "Runic"}, | 78 | {0x16A0, 0x16FF, "Runic"}, |
79 | {0x1780, 0x17FF, "Khmer"}, | 79 | {0x1780, 0x17FF, "Khmer"}, |
80 | {0x1800, 0x18AF, "Mongolian"}, | 80 | {0x1800, 0x18AF, "Mongolian"}, |
81 | {0x1E00, 0x1EFF, "Latin Extended Additional"}, | 81 | {0x1E00, 0x1EFF, "Latin Extended Additional"}, |
82 | {0x1F00, 0x1FFF, "Greek Extended"}, | 82 | {0x1F00, 0x1FFF, "Greek Extended"}, |
83 | {0x2000, 0x206F, "General Punctuation"}, | 83 | {0x2000, 0x206F, "General Punctuation"}, |
84 | {0x2070, 0x209F, "Superscripts and Subscripts"}, | 84 | {0x2070, 0x209F, "Superscripts and Subscripts"}, |
85 | {0x20A0, 0x20CF, "Currency Symbols"}, | 85 | {0x20A0, 0x20CF, "Currency Symbols"}, |
86 | {0x20D0, 0x20FF, "Combining Marks for Symbols"}, | 86 | {0x20D0, 0x20FF, "Combining Marks for Symbols"}, |
87 | {0x2100, 0x214F, "Letterlike Symbols"}, | 87 | {0x2100, 0x214F, "Letterlike Symbols"}, |
88 | {0x2150, 0x218F, "Number Forms"}, | 88 | {0x2150, 0x218F, "Number Forms"}, |
89 | {0x2190, 0x21FF, "Arrows"}, | 89 | {0x2190, 0x21FF, "Arrows"}, |
90 | {0x2200, 0x22FF, "Mathematical Operators"}, | 90 | {0x2200, 0x22FF, "Mathematical Operators"}, |
91 | {0x2300, 0x23FF, "Miscellaneous Technical"}, | 91 | {0x2300, 0x23FF, "Miscellaneous Technical"}, |
92 | {0x2400, 0x243F, "Control Pictures"}, | 92 | {0x2400, 0x243F, "Control Pictures"}, |
93 | {0x2440, 0x245F, "Optical Character Recognition"}, | 93 | {0x2440, 0x245F, "Optical Character Recognition"}, |
94 | {0x2460, 0x24FF, "Enclosed Alphanumerics"}, | 94 | {0x2460, 0x24FF, "Enclosed Alphanumerics"}, |
95 | {0x2500, 0x257F, "Box Drawing"}, | 95 | {0x2500, 0x257F, "Box Drawing"}, |
96 | {0x2580, 0x259F, "Block Elements"}, | 96 | {0x2580, 0x259F, "Block Elements"}, |
97 | {0x25A0, 0x25FF, "Geometric Shapes"}, | 97 | {0x25A0, 0x25FF, "Geometric Shapes"}, |
98 | {0x2600, 0x26FF, "Miscellaneous Symbols"}, | 98 | {0x2600, 0x26FF, "Miscellaneous Symbols"}, |
99 | {0x2700, 0x27BF, "Dingbats"}, | 99 | {0x2700, 0x27BF, "Dingbats"}, |
100 | {0x2800, 0x28FF, "Braille Patterns"}, | 100 | {0x2800, 0x28FF, "Braille Patterns"}, |
101 | {0x2E80, 0x2EFF, "CJK Radicals Supplement"}, | 101 | {0x2E80, 0x2EFF, "CJK Radicals Supplement"}, |
102 | {0x2F00, 0x2FDF, "Kangxi Radicals"}, | 102 | {0x2F00, 0x2FDF, "Kangxi Radicals"}, |
103 | {0x2FF0, 0x2FFF, "Ideographic Description Characters"}, | 103 | {0x2FF0, 0x2FFF, "Ideographic Description Characters"}, |
104 | {0x3000, 0x303F, "CJK Symbols and Punctuation"}, | 104 | {0x3000, 0x303F, "CJK Symbols and Punctuation"}, |
105 | {0x3040, 0x309F, "Hiragana"}, | 105 | {0x3040, 0x309F, "Hiragana"}, |
106 | {0x30A0, 0x30FF, "Katakana"}, | 106 | {0x30A0, 0x30FF, "Katakana"}, |
107 | {0x3100, 0x312F, "Bopomofo"}, | 107 | {0x3100, 0x312F, "Bopomofo"}, |
108 | {0x3130, 0x318F, "Hangul Compatibility Jamo"}, | 108 | {0x3130, 0x318F, "Hangul Compatibility Jamo"}, |
109 | {0x3190, 0x319F, "Kanbun"}, | 109 | {0x3190, 0x319F, "Kanbun"}, |
110 | {0x31A0, 0x31BF, "Bopomofo Extended"}, | 110 | {0x31A0, 0x31BF, "Bopomofo Extended"}, |
111 | {0x3200, 0x32FF, "Enclosed CJK Letters and Months"}, | 111 | {0x3200, 0x32FF, "Enclosed CJK Letters and Months"}, |
112 | {0x3300, 0x33FF, "CJK Compatibility"}, | 112 | {0x3300, 0x33FF, "CJK Compatibility"}, |
113 | {0x3400, 0x4DB5, "CJK Unified Ideographs Extension A"}, | 113 | {0x3400, 0x4DB5, "CJK Unified Ideographs Extension A"}, |
114 | {0x4E00, 0x9FFF, "CJK Unified Ideographs"}, | 114 | {0x4E00, 0x9FFF, "CJK Unified Ideographs"}, |
115 | {0xA000, 0xA48F, "Yi Syllables"}, | 115 | {0xA000, 0xA48F, "Yi Syllables"}, |
116 | {0xA490, 0xA4CF, "Yi Radicals"}, | 116 | {0xA490, 0xA4CF, "Yi Radicals"}, |
117 | {0xAC00, 0xD7A3, "Hangul Syllables"}, | 117 | {0xAC00, 0xD7A3, "Hangul Syllables"}, |
118 | {0xD800, 0xDB7F, "High Surrogates"}, | 118 | {0xD800, 0xDB7F, "High Surrogates"}, |
119 | {0xDB80, 0xDBFF, "High Private Use Surrogates"}, | 119 | {0xDB80, 0xDBFF, "High Private Use Surrogates"}, |
120 | {0xDC00, 0xDFFF, "Low Surrogates"}, | 120 | {0xDC00, 0xDFFF, "Low Surrogates"}, |
121 | {0xE000, 0xF8FF, "Private Use"}, | 121 | {0xE000, 0xF8FF, "Private Use"}, |
122 | {0xF900, 0xFAFF, "CJK Compatibility Ideographs"}, | 122 | {0xF900, 0xFAFF, "CJK Compatibility Ideographs"}, |
123 | {0xFB00, 0xFB4F, "Alphabetic Presentation Forms"}, | 123 | {0xFB00, 0xFB4F, "Alphabetic Presentation Forms"}, |
124 | {0xFB50, 0xFDFF, "Arabic Presentation Forms-A"}, | 124 | {0xFB50, 0xFDFF, "Arabic Presentation Forms-A"}, |
125 | {0xFE20, 0xFE2F, "Combining Half Marks"}, | 125 | {0xFE20, 0xFE2F, "Combining Half Marks"}, |
126 | {0xFE30, 0xFE4F, "CJK Compatibility Forms"}, | 126 | {0xFE30, 0xFE4F, "CJK Compatibility Forms"}, |
127 | {0xFE50, 0xFE6F, "Small Form Variants"}, | 127 | {0xFE50, 0xFE6F, "Small Form Variants"}, |
128 | {0xFE70, 0xFEFE, "Arabic Presentation Forms-B"}, | 128 | {0xFE70, 0xFEFE, "Arabic Presentation Forms-B"}, |
129 | {0xFF00, 0xFEFF, "Halfwidth and Fullwidth Forms"}, | 129 | {0xFF00, 0xFEFF, "Halfwidth and Fullwidth Forms"}, |
130 | {0xFFF0, 0xFFEF, "Specials"}, | 130 | {0xFFF0, 0xFFEF, "Specials"}, |
131 | {0xFFFF, 0xFFFF, 0} }; | 131 | {0xFFFF, 0xFFFF, 0} }; |
132 | 132 | ||
133 | 133 | ||
134 | UniScrollview::UniScrollview(QWidget* parent, const char* name, int f) : | 134 | UniScrollview::UniScrollview(QWidget* parent, const char* name, int f) : |
135 | QScrollView(parent, name, f) | 135 | QScrollView(parent, name, f) |
136 | { | 136 | { |
137 | // smallFont.setRawName( "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1" ); //###### | 137 | // smallFont.setRawName( "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1" ); //###### |
138 | smallFont = QFont( "Helvetica", 8 ); | 138 | |
139 | // get the default font | ||
140 | Config *config = new Config( "qpe" ); | ||
141 | config->setGroup( "Appearance" ); | ||
142 | QString familyStr = config->readEntry( "FontFamily", "Helvetica" ); | ||
143 | int fontSize = config->readNumEntry( "FontSize", 8 ) - 2; | ||
144 | delete config; | ||
145 | |||
146 | smallFont = QFont( familyStr, fontSize ); | ||
139 | QFontMetrics sfm( smallFont ); | 147 | QFontMetrics sfm( smallFont ); |
140 | xoff = sfm.width( "AAA" ); | 148 | xoff = sfm.width( "AAA" ); |
141 | setFont( FontManager::unicodeFont( FontManager::Fixed ) ); | 149 | setFont( FontManager::unicodeFont( FontManager::Fixed ) ); |
142 | QFontMetrics fm( font() ); | 150 | QFontMetrics fm( font() ); |
143 | cellsize = fm.lineSpacing() + 2; | 151 | cellsize = fm.lineSpacing() + 2; |
144 | resizeContents( cellsize*nw, cellsize*65536/nw ); | 152 | resizeContents( cellsize*nw, cellsize*65536/nw ); |
145 | verticalScrollBar()->setLineStep(cellsize); | 153 | verticalScrollBar()->setLineStep(cellsize); |
146 | 154 | ||
147 | viewport()->setBackgroundMode( QWidget::PaletteBase ); | 155 | viewport()->setBackgroundMode( QWidget::PaletteBase ); |
148 | } | 156 | } |
149 | 157 | ||
150 | 158 | ||
151 | 159 | ||
152 | void UniScrollview::contentsMousePressEvent(QMouseEvent* e) | 160 | void UniScrollview::contentsMousePressEvent(QMouseEvent* e) |
153 | { | 161 | { |
154 | if ( e->x() < xoff || e->x() > xoff + nw*cellsize ) | 162 | if ( e->x() < xoff || e->x() > xoff + nw*cellsize ) |
155 | return; | 163 | return; |
156 | int row = e->y()/cellsize; | 164 | int row = e->y()/cellsize; |
157 | int col = (e->x()-xoff)/cellsize; | 165 | int col = (e->x()-xoff)/cellsize; |
158 | int u = row*nw+col; | 166 | int u = row*nw+col; |
159 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 167 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
160 | emit key( u, 0, 0, true, false ); | 168 | emit key( u, 0, 0, true, false ); |
161 | emit key( u, 0, 0, false, false ); | 169 | emit key( u, 0, 0, false, false ); |
162 | #endif | 170 | #endif |
163 | } | 171 | } |
164 | 172 | ||
165 | 173 | ||
166 | void UniScrollview::contentsMouseReleaseEvent(QMouseEvent*) | 174 | void UniScrollview::contentsMouseReleaseEvent(QMouseEvent*) |
167 | { | 175 | { |
168 | } | 176 | } |
169 | 177 | ||
170 | void UniScrollview::scrollTo( int unicode ) | 178 | void UniScrollview::scrollTo( int unicode ) |
171 | { | 179 | { |
172 | int row = unicode / nw; | 180 | int row = unicode / nw; |
173 | setContentsPos( 0, row*cellsize ); | 181 | setContentsPos( 0, row*cellsize ); |
174 | } | 182 | } |
175 | 183 | ||
176 | 184 | ||
177 | void UniScrollview::drawContents( QPainter *p, int /*cx*/, int cy, int /*cw*/, int ch ) | 185 | void UniScrollview::drawContents( QPainter *p, int /*cx*/, int cy, int /*cw*/, int ch ) |
178 | { | 186 | { |
179 | QFontMetrics fm = fontMetrics(); | 187 | QFontMetrics fm = fontMetrics(); |
180 | int row = cy / cellsize; | 188 | int row = cy / cellsize; |
181 | int y = row*cellsize; | 189 | int y = row*cellsize; |
182 | while ( y < cy+ch ) { | 190 | while ( y < cy+ch ) { |
183 | p->drawLine( xoff, y, xoff+nw*cellsize, y ); | 191 | p->drawLine( xoff, y, xoff+nw*cellsize, y ); |
184 | if ( row*nw%16 == 0 ) { | 192 | if ( row*nw%16 == 0 ) { |
185 | p->setFont( smallFont ); | 193 | p->setFont( smallFont ); |
186 | QString s; | 194 | QString s; |
187 | s.sprintf( "%03X", row*nw/16 ); | 195 | s.sprintf( "%03X", row*nw/16 ); |
188 | p->drawText( 0, y, xoff, cellsize, AlignLeft, s ); | 196 | p->drawText( 0, y, xoff, cellsize, AlignLeft, s ); |
189 | p->setFont( font() ); | 197 | p->setFont( font() ); |
190 | } | 198 | } |
191 | for ( int i = 0; i < nw; i++ ) { | 199 | for ( int i = 0; i < nw; i++ ) { |
192 | p->drawLine( xoff+i*cellsize, y, xoff+i*cellsize, y+cellsize ); | 200 | p->drawLine( xoff+i*cellsize, y, xoff+i*cellsize, y+cellsize ); |
193 | QChar u = row*nw + i; | 201 | QChar u = row*nw + i; |
194 | if ( fm.inFont( u ) ) | 202 | if ( fm.inFont( u ) ) |
195 | p->drawText( xoff+i*cellsize, y, cellsize, cellsize, AlignCenter, | 203 | p->drawText( xoff+i*cellsize, y, cellsize, cellsize, AlignCenter, |
196 | u ); | 204 | u ); |
197 | } | 205 | } |
198 | p->drawLine( xoff+nw*cellsize, y, xoff+nw*cellsize, y+cellsize ); | 206 | p->drawLine( xoff+nw*cellsize, y, xoff+nw*cellsize, y+cellsize ); |
199 | row++; | 207 | row++; |
200 | y += cellsize; | 208 | y += cellsize; |
201 | } | 209 | } |
202 | } | 210 | } |
203 | 211 | ||
204 | 212 | ||
205 | 213 | ||
206 | 214 | ||
207 | UniKeyboard::UniKeyboard(QWidget* parent, const char* name, int f ) | 215 | UniKeyboard::UniKeyboard(QWidget* parent, const char* name, int f ) |
208 | : QFrame( parent, name, f ) | 216 | : QFrame( parent, name, f ) |
209 | { | 217 | { |
210 | setFrameStyle( NoFrame ); | 218 | setFrameStyle( NoFrame ); |
211 | sv = new UniScrollview( this ); | 219 | sv = new UniScrollview( this ); |
212 | cb = new QComboBox( FALSE, this ); | 220 | cb = new QComboBox( FALSE, this ); |
213 | currentBlock = 0; | 221 | currentBlock = 0; |
214 | QFontMetrics fm = sv->fontMetrics(); | 222 | QFontMetrics fm = sv->fontMetrics(); |
215 | cbmap = new int[sizeof(blockMap)/sizeof(blockMap[0])]; | 223 | cbmap = new int[sizeof(blockMap)/sizeof(blockMap[0])]; |
216 | for ( int i = 0; blockMap[i].name; i++ ) { | 224 | for ( int i = 0; blockMap[i].name; i++ ) { |
217 | bool any=FALSE; | 225 | bool any=FALSE; |
218 | for ( int c=blockMap[i].start; !any && c<=blockMap[i].stop; c++ ) | 226 | for ( int c=blockMap[i].start; !any && c<=blockMap[i].stop; c++ ) |
219 | any = fm.inFont(QChar(c)); | 227 | any = fm.inFont(QChar(c)); |
220 | if ( any ) { | 228 | if ( any ) { |
221 | cbmap[cb->count()]=i; | 229 | cbmap[cb->count()]=i; |
222 | cb->insertItem( blockMap[i].name ); | 230 | cb->insertItem( blockMap[i].name ); |
223 | } | 231 | } |
224 | } | 232 | } |
225 | connect( cb, SIGNAL( activated(int)), this, SLOT( handleCombo(int)) ); | 233 | connect( cb, SIGNAL( activated(int)), this, SLOT( handleCombo(int)) ); |
226 | connect( sv, SIGNAL( contentsMoving(int,int)), this, SLOT( svMove(int,int)) ); | 234 | connect( sv, SIGNAL( contentsMoving(int,int)), this, SLOT( svMove(int,int)) ); |
227 | connect( sv, SIGNAL( key(ushort,ushort,ushort,bool,bool)), | 235 | connect( sv, SIGNAL( key(ushort,ushort,ushort,bool,bool)), |
228 | this, SIGNAL( key(ushort,ushort,ushort,bool,bool)) ); | 236 | this, SIGNAL( key(ushort,ushort,ushort,bool,bool)) ); |
229 | } | 237 | } |
230 | 238 | ||
231 | UniKeyboard::~UniKeyboard() | 239 | UniKeyboard::~UniKeyboard() |
232 | { | 240 | { |
233 | delete [] cbmap; | 241 | delete [] cbmap; |
234 | } | 242 | } |
235 | 243 | ||
236 | void UniKeyboard::resizeEvent(QResizeEvent *) | 244 | void UniKeyboard::resizeEvent(QResizeEvent *) |
237 | { | 245 | { |
238 | int d = frameWidth(); | 246 | int d = frameWidth(); |
239 | cb->setGeometry( d, d, width()-2*d, cb->sizeHint().height() ); | 247 | cb->setGeometry( d, d, width()-2*d, cb->sizeHint().height() ); |
240 | sv->setGeometry( d, cb->height()+d, width()-2*d, height()-cb->height()-2*d ); | 248 | sv->setGeometry( d, cb->height()+d, width()-2*d, height()-cb->height()-2*d ); |
241 | } | 249 | } |
242 | 250 | ||
243 | void UniKeyboard::svMove( int /*x*/, int y ) | 251 | void UniKeyboard::svMove( int /*x*/, int y ) |
244 | { | 252 | { |
245 | int cs = sv->cellSize(); | 253 | int cs = sv->cellSize(); |
246 | int u = ((y+cs-1)/cs) * nw; | 254 | int u = ((y+cs-1)/cs) * nw; |
247 | int i = currentBlock; | 255 | int i = currentBlock; |
248 | while ( i > 0 && blockMap[i].start > u ) { | 256 | while ( i > 0 && blockMap[i].start > u ) { |
249 | i--; | 257 | i--; |
250 | } | 258 | } |
251 | while ( blockMap[i+1].name && blockMap[i+1].start < u ) { | 259 | while ( blockMap[i+1].name && blockMap[i+1].start < u ) { |
252 | i++; | 260 | i++; |
253 | } | 261 | } |
254 | if ( i != currentBlock ) { | 262 | if ( i != currentBlock ) { |
255 | currentBlock = i; | 263 | currentBlock = i; |
256 | for (int ind=0; ind<cb->count(); ind++) { | 264 | for (int ind=0; ind<cb->count(); ind++) { |
257 | if ( cbmap[ind] == i ) { | 265 | if ( cbmap[ind] == i ) { |
258 | cb->setCurrentItem( ind ); | 266 | cb->setCurrentItem( ind ); |
259 | break; | 267 | break; |
260 | } | 268 | } |
261 | } | 269 | } |
262 | } | 270 | } |
263 | } | 271 | } |
264 | 272 | ||
265 | void UniKeyboard::handleCombo( int i ) | 273 | void UniKeyboard::handleCombo( int i ) |
266 | { | 274 | { |
267 | currentBlock = cbmap[i]; | 275 | currentBlock = cbmap[i]; |
268 | sv->scrollTo( blockMap[currentBlock].start ); | 276 | sv->scrollTo( blockMap[currentBlock].start ); |
269 | } | 277 | } |
270 | 278 | ||
271 | void UniKeyboard::resetState() | 279 | void UniKeyboard::resetState() |
272 | { | 280 | { |
273 | } | 281 | } |
274 | 282 | ||
275 | QSize UniKeyboard::sizeHint() const | 283 | QSize UniKeyboard::sizeHint() const |
276 | { | 284 | { |
277 | return QSize( 240, 2+sv->cellSize()*4+cb->sizeHint().height() ); | 285 | return QSize( 240, 2+sv->cellSize()*4+cb->sizeHint().height() ); |
278 | } | 286 | } |