-rw-r--r-- | inputmethods/handwriting/qimpenchar.h | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenprofile.cpp | 3 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.cpp | 17 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.h | 1 |
4 files changed, 19 insertions, 4 deletions
diff --git a/inputmethods/handwriting/qimpenchar.h b/inputmethods/handwriting/qimpenchar.h index e4e7645..92ee2c1 100644 --- a/inputmethods/handwriting/qimpenchar.h +++ b/inputmethods/handwriting/qimpenchar.h | |||
@@ -1,160 +1,160 @@ | |||
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 | #ifndef QIMPENCHAR_H_ | 21 | #ifndef QIMPENCHAR_H_ |
22 | #define QIMPENCHAR_H_ | 22 | #define QIMPENCHAR_H_ |
23 | 23 | ||
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qvaluelist.h> | 25 | #include <qvaluelist.h> |
26 | #include <qcstring.h> | 26 | #include <qcstring.h> |
27 | #include "qimpenstroke.h" | 27 | #include "qimpenstroke.h" |
28 | 28 | ||
29 | struct QIMPenSpecialKeys { | 29 | struct QIMPenSpecialKeys { |
30 | int code; | 30 | int code; |
31 | char *name; | 31 | char *name; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | extern const QIMPenSpecialKeys qimpen_specialKeys[]; | 34 | extern const QIMPenSpecialKeys qimpen_specialKeys[]; |
35 | 35 | ||
36 | 36 | ||
37 | class QIMPenChar | 37 | class QIMPenChar |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | QIMPenChar(); | 40 | QIMPenChar(); |
41 | QIMPenChar( const QIMPenChar & ); | 41 | QIMPenChar( const QIMPenChar & ); |
42 | 42 | ||
43 | unsigned int character() const { return ch; } | 43 | unsigned int character() const { return ch; } |
44 | void setCharacter( unsigned int c ) { ch = c; } | 44 | void setCharacter( unsigned int c ) { ch = c; } |
45 | 45 | ||
46 | const QString &data() const { return d; } | 46 | const QString &data() const { return d; } |
47 | void setData( const QString &ba ) { d = ba; } | 47 | void setData( const QString &ba ) { d = ba; } |
48 | 48 | ||
49 | QString name() const; | 49 | QString name() const; |
50 | bool isEmpty() const { return strokes.isEmpty(); } | 50 | bool isEmpty() const { return strokes.isEmpty(); } |
51 | unsigned int strokeCount() const { return strokes.count(); } | 51 | unsigned int strokeCount() const { return strokes.count(); } |
52 | unsigned int strokeLength( int s ) const; | 52 | unsigned int strokeLength( int s ) const; |
53 | void clear(); | 53 | void clear(); |
54 | int match( QIMPenChar *ch ); | 54 | int match( QIMPenChar *ch ); |
55 | const QIMPenStrokeList &penStrokes() { return strokes; } | 55 | const QIMPenStrokeList &penStrokes() { return strokes; } |
56 | QPoint startingPoint() const { return strokes.getFirst()->startingPoint(); } | 56 | QPoint startingPoint() const { return strokes.getFirst()->startingPoint(); } |
57 | QRect boundingRect(); | 57 | QRect boundingRect(); |
58 | 58 | ||
59 | void setFlag( int f ) { flags |= f; } | 59 | void setFlag( int f ) { flags |= f; } |
60 | void clearFlag( int f ) { flags &= ~f; } | 60 | void clearFlag( int f ) { flags &= ~f; } |
61 | bool testFlag( int f ) { return flags & f; } | 61 | bool testFlag( int f ) { return flags & f; } |
62 | 62 | ||
63 | enum Flags { System=0x01, Deleted=0x02, CombineRight=0x04, Data=0x08, Combined=0x10 }; | 63 | enum Flags { System=0x01, Deleted=0x02, CombineRight=0x04, Data=0x08, Combined=0x10 }; |
64 | // Correspond to codes in template files. Do not change values. | 64 | // Correspond to codes in template files. Do not change values. |
65 | enum Mode { ModeBase=0x4000, Caps=0x4001, Shortcut=0x4002, CapsLock=0x4003, | 65 | enum Mode { ModeBase=0x4000, Caps=0x4001, Shortcut=0x4002, CapsLock=0x4003, |
66 | Punctuation=0x4004, Symbol=0x4005, Extended=0x4006 }; | 66 | Punctuation=0x4004, Symbol=0x4005, Extended=0x4006 }; |
67 | 67 | ||
68 | QIMPenChar &operator=( const QIMPenChar &s ); | 68 | QIMPenChar &operator=( const QIMPenChar &s ); |
69 | 69 | ||
70 | void addStroke( QIMPenStroke * ); | 70 | void addStroke( QIMPenStroke * ); |
71 | 71 | ||
72 | protected: | 72 | protected: |
73 | unsigned int ch; | 73 | unsigned int ch; |
74 | QString d; | 74 | QString d; |
75 | Q_UINT8 flags; | 75 | Q_UINT8 flags; |
76 | QIMPenStrokeList strokes; | 76 | QIMPenStrokeList strokes; |
77 | 77 | ||
78 | friend QDataStream &operator<< (QDataStream &, const QIMPenChar &); | 78 | friend QDataStream &operator<< (QDataStream &, const QIMPenChar &); |
79 | friend QDataStream &operator>> (QDataStream &, QIMPenChar &); | 79 | friend QDataStream &operator>> (QDataStream &, QIMPenChar &); |
80 | }; | 80 | }; |
81 | 81 | ||
82 | typedef QList<QIMPenChar> QIMPenCharList; | 82 | typedef QList<QIMPenChar> QIMPenCharList; |
83 | typedef QListIterator<QIMPenChar> QIMPenCharIterator; | 83 | typedef QListIterator<QIMPenChar> QIMPenCharIterator; |
84 | 84 | ||
85 | QDataStream & operator<< (QDataStream & s, const QIMPenChar &ws); | 85 | QDataStream & operator<< (QDataStream & s, const QIMPenChar &ws); |
86 | QDataStream & operator>> (QDataStream & s, QIMPenChar &ws); | 86 | QDataStream & operator>> (QDataStream & s, QIMPenChar &ws); |
87 | 87 | ||
88 | struct QIMPenCharMatch | 88 | struct QIMPenCharMatch |
89 | { | 89 | { |
90 | int error; | 90 | int error; |
91 | QIMPenChar *penChar; | 91 | QIMPenChar *penChar; |
92 | 92 | ||
93 | bool operator>( const QIMPenCharMatch &m ); | 93 | bool operator>( const QIMPenCharMatch &m ); |
94 | bool operator<( const QIMPenCharMatch &m ); | 94 | bool operator<( const QIMPenCharMatch &m ); |
95 | bool operator<=( const QIMPenCharMatch &m ); | 95 | bool operator<=( const QIMPenCharMatch &m ); |
96 | }; | 96 | }; |
97 | 97 | ||
98 | typedef QValueList<QIMPenCharMatch> QIMPenCharMatchList; | 98 | typedef QValueList<QIMPenCharMatch> QIMPenCharMatchList; |
99 | 99 | ||
100 | 100 | ||
101 | class QIMPenCharSet | 101 | class QIMPenCharSet |
102 | { | 102 | { |
103 | public: | 103 | public: |
104 | QIMPenCharSet(); | 104 | QIMPenCharSet(); |
105 | QIMPenCharSet( const QString &fn ); | 105 | QIMPenCharSet( const QString &fn ); |
106 | 106 | ||
107 | bool isEmpty() const { return chars.isEmpty(); } | 107 | bool isEmpty() const { return chars.isEmpty(); } |
108 | unsigned int count() const { return chars.count(); } | 108 | unsigned int count() const { return chars.count(); } |
109 | void clear() { chars.clear(); } | 109 | void clear() { chars.clear(); } |
110 | 110 | ||
111 | void setDescription( const QString &d ) { desc = d; } | 111 | void setDescription( const QString &d ) { desc = d; } |
112 | QString description() const { return desc; } | 112 | QString description() const { return desc; } |
113 | void setTitle( const QString &t ) { csTitle = t; } | 113 | void setTitle( const QString &t ) { csTitle = t; } |
114 | QString title() const { return csTitle; } | 114 | QString title() const { return csTitle; } |
115 | 115 | ||
116 | QIMPenCharMatchList match( QIMPenChar *ch ); | 116 | QIMPenCharMatchList match( QIMPenChar *ch ); |
117 | void addChar( QIMPenChar *ch ); | 117 | void addChar( QIMPenChar *ch ); |
118 | void removeChar( QIMPenChar *ch ); | 118 | void removeChar( QIMPenChar *ch ); |
119 | QIMPenChar *at( int i ); | 119 | QIMPenChar *at( int i ); |
120 | void setHidden ( const bool &b ) { phidden = &b; } | 120 | void setHidden ( const bool &b ) { phidden = b; } |
121 | bool hidden() const { return phidden; } | 121 | bool hidden() const { return phidden; } |
122 | 122 | ||
123 | unsigned maximumStrokes() const { return maxStrokes; } | 123 | unsigned maximumStrokes() const { return maxStrokes; } |
124 | 124 | ||
125 | void up( QIMPenChar *ch ); | 125 | void up( QIMPenChar *ch ); |
126 | void down( QIMPenChar *ch ); | 126 | void down( QIMPenChar *ch ); |
127 | 127 | ||
128 | enum Domain { System, User }; | 128 | enum Domain { System, User }; |
129 | enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, | 129 | enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, |
130 | Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 }; | 130 | Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 }; |
131 | 131 | ||
132 | const QIMPenCharList &characters() const { return chars; } | 132 | const QIMPenCharList &characters() const { return chars; } |
133 | 133 | ||
134 | void setType( Type t ) { csType = t; } | 134 | void setType( Type t ) { csType = t; } |
135 | Type type() const { return csType; } | 135 | Type type() const { return csType; } |
136 | 136 | ||
137 | const QString &filename( Domain d ) const; | 137 | const QString &filename( Domain d ) const; |
138 | void setFilename( const QString &fn, Domain d=System ); | 138 | void setFilename( const QString &fn, Domain d=System ); |
139 | bool load( const QString &fn, Domain d=System ); | 139 | bool load( const QString &fn, Domain d=System ); |
140 | bool save( Domain d=System ); | 140 | bool save( Domain d=System ); |
141 | 141 | ||
142 | protected: | 142 | protected: |
143 | void markDeleted( uint ch ); | 143 | void markDeleted( uint ch ); |
144 | 144 | ||
145 | protected: | 145 | protected: |
146 | QString csTitle; | 146 | QString csTitle; |
147 | QString desc; | 147 | QString desc; |
148 | QString sysFilename; | 148 | QString sysFilename; |
149 | QString userFilename; | 149 | QString userFilename; |
150 | Type csType; | 150 | Type csType; |
151 | unsigned maxStrokes; | 151 | unsigned maxStrokes; |
152 | QIMPenCharList chars; | 152 | QIMPenCharList chars; |
153 | QIMPenCharMatchList matches; | 153 | QIMPenCharMatchList matches; |
154 | bool phidden : 1; | 154 | bool phidden : 1; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | typedef QList<QIMPenCharSet> QIMPenCharSetList; | 157 | typedef QList<QIMPenCharSet> QIMPenCharSetList; |
158 | typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator; | 158 | typedef QListIterator<QIMPenCharSet> QIMPenCharSetIterator; |
159 | 159 | ||
160 | #endif | 160 | #endif |
diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp index b1a6592..67343c3 100644 --- a/inputmethods/handwriting/qimpenprofile.cpp +++ b/inputmethods/handwriting/qimpenprofile.cpp | |||
@@ -17,252 +17,255 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "qimpencombining.h" | 21 | #include "qimpencombining.h" |
22 | #include "qimpenprofile.h" | 22 | #include "qimpenprofile.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/global.h> | 26 | #include <qpe/global.h> |
27 | 27 | ||
28 | 28 | ||
29 | QIMPenProfile::QIMPenProfile( const QString &fn ) | 29 | QIMPenProfile::QIMPenProfile( const QString &fn ) |
30 | : filename( fn ) | 30 | : filename( fn ) |
31 | { | 31 | { |
32 | sets.setAutoDelete( true ); | 32 | sets.setAutoDelete( true ); |
33 | 33 | ||
34 | Config config( filename, Config::File ); | 34 | Config config( filename, Config::File ); |
35 | config.setGroup( "Handwriting" ); | 35 | config.setGroup( "Handwriting" ); |
36 | 36 | ||
37 | pname = config.readEntry( "Name" ); | 37 | pname = config.readEntry( "Name" ); |
38 | pdesc = config.readEntry( "Description" ); | 38 | pdesc = config.readEntry( "Description" ); |
39 | 39 | ||
40 | tstyle = config.readBoolEntry( "CanSelectStyle", false ); | 40 | tstyle = config.readBoolEntry( "CanSelectStyle", false ); |
41 | 41 | ||
42 | wordMatch = config.readBoolEntry( "MatchWords", true ); | 42 | wordMatch = config.readBoolEntry( "MatchWords", true ); |
43 | 43 | ||
44 | config.setGroup( "Settings" ); | 44 | config.setGroup( "Settings" ); |
45 | 45 | ||
46 | pstyle = BothCases; | 46 | pstyle = BothCases; |
47 | QString s = config.readEntry( "Style", "BothCases" ); | 47 | QString s = config.readEntry( "Style", "BothCases" ); |
48 | if ( s == "ToggleCases" ) | 48 | if ( s == "ToggleCases" ) |
49 | pstyle = ToggleCases; | 49 | pstyle = ToggleCases; |
50 | 50 | ||
51 | QString t = config.readEntry( "Mono", "Dual" ); | 51 | QString t = config.readEntry( "Mono", "Dual" ); |
52 | pmono = (QString::fromLatin1("Mono") == t ); | 52 | pmono = (QString::fromLatin1("Mono") == t ); |
53 | 53 | ||
54 | msTimeout = config.readNumEntry( "MultiTimeout", 500 ); | 54 | msTimeout = config.readNumEntry( "MultiTimeout", 500 ); |
55 | 55 | ||
56 | // Read user configuration | 56 | // Read user configuration |
57 | Config usrConfig( userConfig() ); | 57 | Config usrConfig( userConfig() ); |
58 | usrConfig.setGroup( "Settings" ); | 58 | usrConfig.setGroup( "Settings" ); |
59 | msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); | 59 | msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); |
60 | 60 | ||
61 | if ( tstyle && usrConfig.hasKey( "Style" ) ) { | 61 | if ( tstyle && usrConfig.hasKey( "Style" ) ) { |
62 | pstyle = BothCases; | 62 | pstyle = BothCases; |
63 | QString s = usrConfig.readEntry( "Style", "BothCases" ); | 63 | QString s = usrConfig.readEntry( "Style", "BothCases" ); |
64 | if ( s == "ToggleCases" ) | 64 | if ( s == "ToggleCases" ) |
65 | pstyle = ToggleCases; | 65 | pstyle = ToggleCases; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | void QIMPenProfile::setStyle( Style s ) | 69 | void QIMPenProfile::setStyle( Style s ) |
70 | { | 70 | { |
71 | if ( tstyle && s != pstyle ) { | 71 | if ( tstyle && s != pstyle ) { |
72 | pstyle = s; | 72 | pstyle = s; |
73 | Config config( userConfig() ); | 73 | Config config( userConfig() ); |
74 | config.setGroup( "Settings" ); | 74 | config.setGroup( "Settings" ); |
75 | QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases"; | 75 | QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases"; |
76 | config.writeEntry( "Style", s ); | 76 | config.writeEntry( "Style", s ); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | void QIMPenProfile::setMultiStrokeTimeout( int t ) | 80 | void QIMPenProfile::setMultiStrokeTimeout( int t ) |
81 | { | 81 | { |
82 | if ( t != msTimeout ) { | 82 | if ( t != msTimeout ) { |
83 | msTimeout = t; | 83 | msTimeout = t; |
84 | Config config( userConfig() ); | 84 | Config config( userConfig() ); |
85 | config.setGroup( "Settings" ); | 85 | config.setGroup( "Settings" ); |
86 | config.writeEntry( "MultiTimeout", msTimeout ); | 86 | config.writeEntry( "MultiTimeout", msTimeout ); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | QString QIMPenProfile::userConfig() | 90 | QString QIMPenProfile::userConfig() |
91 | { | 91 | { |
92 | QString un = filename; | 92 | QString un = filename; |
93 | int pos = un.findRev( '/' ); | 93 | int pos = un.findRev( '/' ); |
94 | if ( pos >= 0 ) | 94 | if ( pos >= 0 ) |
95 | un = un.mid( pos + 1 ); | 95 | un = un.mid( pos + 1 ); |
96 | pos = un.find( '.' ); | 96 | pos = un.find( '.' ); |
97 | if ( pos > 0 ) | 97 | if ( pos > 0 ) |
98 | un.truncate( pos ); | 98 | un.truncate( pos ); |
99 | 99 | ||
100 | un = "handwriting-" + un; // No tr | 100 | un = "handwriting-" + un; // No tr |
101 | 101 | ||
102 | return un; | 102 | return un; |
103 | } | 103 | } |
104 | 104 | ||
105 | void QIMPenProfile::loadData() | 105 | void QIMPenProfile::loadData() |
106 | { | 106 | { |
107 | Config config( filename, Config::File ); | 107 | Config config( filename, Config::File ); |
108 | config.setGroup( "CharSets" ); | 108 | config.setGroup( "CharSets" ); |
109 | 109 | ||
110 | QString baseDir = QPEApplication::qpeDir(); | 110 | QString baseDir = QPEApplication::qpeDir(); |
111 | baseDir += "/etc/"; | 111 | baseDir += "/etc/"; |
112 | // accents | 112 | // accents |
113 | QIMPenCombining *combining = 0; | 113 | QIMPenCombining *combining = 0; |
114 | QString s = config.readEntry( "Combining" ); | 114 | QString s = config.readEntry( "Combining" ); |
115 | if ( !s.isEmpty() ) { | 115 | if ( !s.isEmpty() ) { |
116 | combining = new QIMPenCombining( baseDir + "qimpen/" + s ); | 116 | combining = new QIMPenCombining( baseDir + "qimpen/" + s ); |
117 | if ( combining->isEmpty() ) { | 117 | if ( combining->isEmpty() ) { |
118 | delete combining; | 118 | delete combining; |
119 | combining = 0; | 119 | combining = 0; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | // uppercase latin1 | 122 | // uppercase latin1 |
123 | QIMPenCharSet *cs = 0; | 123 | QIMPenCharSet *cs = 0; |
124 | s = config.readEntry( "Uppercase" ); | 124 | s = config.readEntry( "Uppercase" ); |
125 | if ( !s.isEmpty() && !mono() ) { | 125 | if ( !s.isEmpty() && !mono() ) { |
126 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 126 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
127 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 127 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
128 | if ( !cs->isEmpty() ) { | 128 | if ( !cs->isEmpty() ) { |
129 | if ( combining ) | 129 | if ( combining ) |
130 | combining->addCombined( cs ); | 130 | combining->addCombined( cs ); |
131 | sets.append( cs ); | 131 | sets.append( cs ); |
132 | } else { | 132 | } else { |
133 | delete cs; | 133 | delete cs; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | // lowercase latin1 | 136 | // lowercase latin1 |
137 | s = config.readEntry( "Lowercase" ); | 137 | s = config.readEntry( "Lowercase" ); |
138 | if ( !s.isEmpty() ) { | 138 | if ( !s.isEmpty() ) { |
139 | if ( mono() ) { | 139 | if ( mono() ) { |
140 | cs = new QIMPenCharSet ( baseDir + "qimpen/" + s ); | 140 | cs = new QIMPenCharSet ( baseDir + "qimpen/" + s ); |
141 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 141 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
142 | if ( !cs->isEmpty() ) { | 142 | if ( !cs->isEmpty() ) { |
143 | cs->setTitle( cs->title().upper() ); | 143 | cs->setTitle( cs->title().upper() ); |
144 | cs->setType( QIMPenCharSet::Upper ); | 144 | cs->setType( QIMPenCharSet::Upper ); |
145 | cs->setDescription( "Hidden uppercase" ); | ||
145 | cs->setHidden ( true ); | 146 | cs->setHidden ( true ); |
146 | QIMPenCharIterator it( cs->characters() ); | 147 | QIMPenCharIterator it( cs->characters() ); |
147 | for ( ; it.current(); ++it ) { | 148 | for ( ; it.current(); ++it ) { |
148 | uint ch = it.current()->character(); | 149 | uint ch = it.current()->character(); |
149 | if ( ch >= 'a' && ch <= 'z' ) | 150 | if ( ch >= 'a' && ch <= 'z' ) |
150 | it.current()->setCharacter( QChar(ch).upper() ); | 151 | it.current()->setCharacter( QChar(ch).upper() ); |
151 | } | 152 | } |
152 | if ( combining ) | 153 | if ( combining ) |
153 | combining->addCombined( cs ); | 154 | combining->addCombined( cs ); |
154 | sets.append( cs ); | 155 | sets.append( cs ); |
155 | } else { | 156 | } else { |
156 | delete cs; | 157 | delete cs; |
157 | } | 158 | } |
158 | } | 159 | } |
159 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 160 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
160 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 161 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
161 | if ( !cs->isEmpty() ) { | 162 | if ( !cs->isEmpty() ) { |
163 | if ( mono () ) | ||
164 | cs->setDescription( "Latin Characters" ); | ||
162 | if ( combining ) | 165 | if ( combining ) |
163 | combining->addCombined( cs ); | 166 | combining->addCombined( cs ); |
164 | sets.append( cs ); | 167 | sets.append( cs ); |
165 | } else { | 168 | } else { |
166 | delete cs; | 169 | delete cs; |
167 | } | 170 | } |
168 | } | 171 | } |
169 | // numeric (may comtain punctuation and symbols) | 172 | // numeric (may comtain punctuation and symbols) |
170 | s = config.readEntry( "Numeric" ); | 173 | s = config.readEntry( "Numeric" ); |
171 | if ( !s.isEmpty() ) { | 174 | if ( !s.isEmpty() ) { |
172 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 175 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
173 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 176 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
174 | if ( !cs->isEmpty() ) { | 177 | if ( !cs->isEmpty() ) { |
175 | sets.append( cs ); | 178 | sets.append( cs ); |
176 | } else { | 179 | } else { |
177 | delete cs; | 180 | delete cs; |
178 | } | 181 | } |
179 | } | 182 | } |
180 | // punctuation | 183 | // punctuation |
181 | s = config.readEntry( "Punctuation" ); | 184 | s = config.readEntry( "Punctuation" ); |
182 | if ( !s.isEmpty() ) { | 185 | if ( !s.isEmpty() ) { |
183 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 186 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
184 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 187 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
185 | if ( !cs->isEmpty() ) { | 188 | if ( !cs->isEmpty() ) { |
186 | sets.append( cs ); | 189 | sets.append( cs ); |
187 | } else { | 190 | } else { |
188 | delete cs; | 191 | delete cs; |
189 | } | 192 | } |
190 | } | 193 | } |
191 | // symbol | 194 | // symbol |
192 | s = config.readEntry( "Symbol" ); | 195 | s = config.readEntry( "Symbol" ); |
193 | if ( !s.isEmpty() ) { | 196 | if ( !s.isEmpty() ) { |
194 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 197 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
195 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 198 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
196 | if ( !cs->isEmpty() ) { | 199 | if ( !cs->isEmpty() ) { |
197 | sets.append( cs ); | 200 | sets.append( cs ); |
198 | } else { | 201 | } else { |
199 | delete cs; | 202 | delete cs; |
200 | } | 203 | } |
201 | } | 204 | } |
202 | // shortcut | 205 | // shortcut |
203 | s = config.readEntry( "Shortcut" ); | 206 | s = config.readEntry( "Shortcut" ); |
204 | if ( !s.isEmpty() ) { | 207 | if ( !s.isEmpty() ) { |
205 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); | 208 | cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); |
206 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); | 209 | cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |
207 | if ( !cs->isEmpty() ) { | 210 | if ( !cs->isEmpty() ) { |
208 | sets.append( cs ); | 211 | sets.append( cs ); |
209 | } else { | 212 | } else { |
210 | delete cs; | 213 | delete cs; |
211 | } | 214 | } |
212 | } | 215 | } |
213 | 216 | ||
214 | if ( combining ) | 217 | if ( combining ) |
215 | delete combining; | 218 | delete combining; |
216 | } | 219 | } |
217 | 220 | ||
218 | QIMPenCharSet *QIMPenProfile::uppercase() | 221 | QIMPenCharSet *QIMPenProfile::uppercase() |
219 | { | 222 | { |
220 | return find( QIMPenCharSet::Upper ); | 223 | return find( QIMPenCharSet::Upper ); |
221 | } | 224 | } |
222 | 225 | ||
223 | QIMPenCharSet *QIMPenProfile::lowercase() | 226 | QIMPenCharSet *QIMPenProfile::lowercase() |
224 | { | 227 | { |
225 | return find( QIMPenCharSet::Lower ); | 228 | return find( QIMPenCharSet::Lower ); |
226 | } | 229 | } |
227 | 230 | ||
228 | QIMPenCharSet *QIMPenProfile::numeric() | 231 | QIMPenCharSet *QIMPenProfile::numeric() |
229 | { | 232 | { |
230 | return find( QIMPenCharSet::Numeric ); | 233 | return find( QIMPenCharSet::Numeric ); |
231 | } | 234 | } |
232 | 235 | ||
233 | QIMPenCharSet *QIMPenProfile::punctuation() | 236 | QIMPenCharSet *QIMPenProfile::punctuation() |
234 | { | 237 | { |
235 | return find( QIMPenCharSet::Punctuation ); | 238 | return find( QIMPenCharSet::Punctuation ); |
236 | } | 239 | } |
237 | 240 | ||
238 | QIMPenCharSet *QIMPenProfile::symbol() | 241 | QIMPenCharSet *QIMPenProfile::symbol() |
239 | { | 242 | { |
240 | return find( QIMPenCharSet::Symbol ); | 243 | return find( QIMPenCharSet::Symbol ); |
241 | } | 244 | } |
242 | 245 | ||
243 | QIMPenCharSet *QIMPenProfile::shortcut() | 246 | QIMPenCharSet *QIMPenProfile::shortcut() |
244 | { | 247 | { |
245 | return find( QIMPenCharSet::Shortcut ); | 248 | return find( QIMPenCharSet::Shortcut ); |
246 | } | 249 | } |
247 | 250 | ||
248 | QIMPenCharSetList &QIMPenProfile::charSets() | 251 | QIMPenCharSetList &QIMPenProfile::charSets() |
249 | { | 252 | { |
250 | if ( sets.isEmpty() ) | 253 | if ( sets.isEmpty() ) |
251 | loadData(); | 254 | loadData(); |
252 | return sets; | 255 | return sets; |
253 | } | 256 | } |
254 | 257 | ||
255 | QIMPenCharSet *QIMPenProfile::find( QIMPenCharSet::Type t ) | 258 | QIMPenCharSet *QIMPenProfile::find( QIMPenCharSet::Type t ) |
256 | { | 259 | { |
257 | if ( sets.isEmpty() ) | 260 | if ( sets.isEmpty() ) |
258 | loadData(); | 261 | loadData(); |
259 | QIMPenCharSetIterator it( sets ); | 262 | QIMPenCharSetIterator it( sets ); |
260 | for ( ; it.current(); ++it ) { | 263 | for ( ; it.current(); ++it ) { |
261 | if ( it.current()->type() == t ) | 264 | if ( it.current()->type() == t ) |
262 | return it.current(); | 265 | return it.current(); |
263 | } | 266 | } |
264 | 267 | ||
265 | return 0; | 268 | return 0; |
266 | } | 269 | } |
267 | 270 | ||
268 | 271 | ||
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp index d1297a9..3f4841d 100644 --- a/inputmethods/handwriting/qimpensetup.cpp +++ b/inputmethods/handwriting/qimpensetup.cpp | |||
@@ -201,465 +201,476 @@ void QIMPenSetup::accept() | |||
201 | config.writeEntry( "Profile", profileCombo->currentText() ); | 201 | config.writeEntry( "Profile", profileCombo->currentText() ); |
202 | } | 202 | } |
203 | // Save charsets | 203 | // Save charsets |
204 | bool ok = TRUE; | 204 | bool ok = TRUE; |
205 | for ( int i = 0; i < (int)profileList.count(); i++ ) { | 205 | for ( int i = 0; i < (int)profileList.count(); i++ ) { |
206 | QIMPenProfile *prof = profileList.at(i); | 206 | QIMPenProfile *prof = profileList.at(i); |
207 | QIMPenCharSetIterator it(prof->charSets()); | 207 | QIMPenCharSetIterator it(prof->charSets()); |
208 | for ( ; it.current(); ++it ) { | 208 | for ( ; it.current(); ++it ) { |
209 | if ( !(it.current()->save( QIMPenCharSet::User )) ) { | 209 | if ( !(it.current()->save( QIMPenCharSet::User )) ) { |
210 | ok = FALSE; | 210 | ok = FALSE; |
211 | break; | 211 | break; |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } | 214 | } |
215 | if ( !ok ) { | 215 | if ( !ok ) { |
216 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 216 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
217 | tr("Unable to save information.\n" | 217 | tr("Unable to save information.\n" |
218 | "Free up some space\n" | 218 | "Free up some space\n" |
219 | "and try again.\n" | 219 | "and try again.\n" |
220 | "\nQuit anyway?"), | 220 | "\nQuit anyway?"), |
221 | QMessageBox::Yes|QMessageBox::Escape, | 221 | QMessageBox::Yes|QMessageBox::Escape, |
222 | QMessageBox::No|QMessageBox::Default ) | 222 | QMessageBox::No|QMessageBox::Default ) |
223 | != QMessageBox::No ) { | 223 | != QMessageBox::No ) { |
224 | QDialog::accept(); | 224 | QDialog::accept(); |
225 | } | 225 | } |
226 | } else { | 226 | } else { |
227 | QDialog::accept(); | 227 | QDialog::accept(); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | //--------------------------------------------------------------------------- | 231 | //--------------------------------------------------------------------------- |
232 | 232 | ||
233 | QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name, | 233 | QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name, |
234 | bool modal, int WFlags) | 234 | bool modal, int WFlags) |
235 | : QDialog( parent, name, modal, WFlags ) | 235 | : QDialog( parent, name, modal, WFlags ) |
236 | { | 236 | { |
237 | setCaption( tr("Enter new character") ); | 237 | setCaption( tr("Enter new character") ); |
238 | uni = 0; | 238 | uni = 0; |
239 | 239 | ||
240 | QVBoxLayout *vb = new QVBoxLayout( this, 10 ); | 240 | QVBoxLayout *vb = new QVBoxLayout( this, 10 ); |
241 | 241 | ||
242 | QHBoxLayout *hb = new QHBoxLayout(); | 242 | QHBoxLayout *hb = new QHBoxLayout(); |
243 | vb->addLayout( hb ); | 243 | vb->addLayout( hb ); |
244 | 244 | ||
245 | QLabel *label = new QLabel( tr("Character:"), this ); | 245 | QLabel *label = new QLabel( tr("Character:"), this ); |
246 | hb->addWidget( label ); | 246 | hb->addWidget( label ); |
247 | 247 | ||
248 | QComboBox *cb = new QComboBox( TRUE, this ); | 248 | QComboBox *cb = new QComboBox( TRUE, this ); |
249 | connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) ); | 249 | connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) ); |
250 | connect( cb, SIGNAL(textChanged(const QString&)), | 250 | connect( cb, SIGNAL(textChanged(const QString&)), |
251 | SLOT(setCharacter(const QString&)) ); | 251 | SLOT(setCharacter(const QString&)) ); |
252 | addSpecial( cb ); | 252 | addSpecial( cb ); |
253 | cb->setEditText( "" ); | 253 | cb->setEditText( "" ); |
254 | hb->addWidget( cb ); | 254 | hb->addWidget( cb ); |
255 | 255 | ||
256 | hb = new QHBoxLayout(); | 256 | hb = new QHBoxLayout(); |
257 | vb->addLayout( hb ); | 257 | vb->addLayout( hb ); |
258 | 258 | ||
259 | QPushButton *pb = new QPushButton( "OK", this ); | 259 | QPushButton *pb = new QPushButton( "OK", this ); |
260 | connect( pb, SIGNAL(clicked()), SLOT(accept())); | 260 | connect( pb, SIGNAL(clicked()), SLOT(accept())); |
261 | hb->addWidget( pb ); | 261 | hb->addWidget( pb ); |
262 | pb = new QPushButton( "Cancel", this ); | 262 | pb = new QPushButton( "Cancel", this ); |
263 | connect( pb, SIGNAL(clicked()), SLOT(reject())); | 263 | connect( pb, SIGNAL(clicked()), SLOT(reject())); |
264 | hb->addWidget( pb ); | 264 | hb->addWidget( pb ); |
265 | 265 | ||
266 | cb->setFocus(); | 266 | cb->setFocus(); |
267 | } | 267 | } |
268 | 268 | ||
269 | void QIMPenInputCharDlg::addSpecial( QComboBox *cb ) | 269 | void QIMPenInputCharDlg::addSpecial( QComboBox *cb ) |
270 | { | 270 | { |
271 | int i = 0; | 271 | int i = 0; |
272 | while ( qimpen_specialKeys[i].code != Key_unknown ) { | 272 | while ( qimpen_specialKeys[i].code != Key_unknown ) { |
273 | cb->insertItem( qimpen_specialKeys[i].name ); | 273 | cb->insertItem( qimpen_specialKeys[i].name ); |
274 | i++; | 274 | i++; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | void QIMPenInputCharDlg::setSpecial( int sp ) | 278 | void QIMPenInputCharDlg::setSpecial( int sp ) |
279 | { | 279 | { |
280 | uni = qimpen_specialKeys[sp].code << 16; | 280 | uni = qimpen_specialKeys[sp].code << 16; |
281 | } | 281 | } |
282 | 282 | ||
283 | void QIMPenInputCharDlg::setCharacter( const QString &string ) | 283 | void QIMPenInputCharDlg::setCharacter( const QString &string ) |
284 | { | 284 | { |
285 | uni = string[0].unicode(); | 285 | uni = string[0].unicode(); |
286 | } | 286 | } |
287 | 287 | ||
288 | //--------------------------------------------------------------------------- | 288 | //--------------------------------------------------------------------------- |
289 | 289 | ||
290 | class CharListItem : public QListBoxText | 290 | class CharListItem : public QListBoxText |
291 | { | 291 | { |
292 | public: | 292 | public: |
293 | CharListItem( const QString &text, uint c ) | 293 | CharListItem( const QString &text, uint c ) |
294 | : QListBoxText( text ) | 294 | : QListBoxText( text ) |
295 | { | 295 | { |
296 | _code = c; | 296 | _code = c; |
297 | } | 297 | } |
298 | 298 | ||
299 | uint code() const { return _code; } | 299 | uint code() const { return _code; } |
300 | 300 | ||
301 | protected: | 301 | protected: |
302 | uint _code; | 302 | uint _code; |
303 | }; | 303 | }; |
304 | 304 | ||
305 | /*! | 305 | /*! |
306 | \class QIMPenEdit qimpensetup.h | 306 | \class QIMPenEdit qimpensetup.h |
307 | 307 | ||
308 | Class to allow users to input totally useless character definitions | 308 | Class to allow users to input totally useless character definitions |
309 | which could match any number of the default set. | 309 | which could match any number of the default set. |
310 | */ | 310 | */ |
311 | 311 | ||
312 | QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, | 312 | QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, |
313 | const char *name ) | 313 | const char *name ) |
314 | : QWidget( parent, name ), profile(p) | 314 | : QWidget( parent, name ), profile(p) |
315 | { | 315 | { |
316 | currentChar = 0; | 316 | currentChar = 0; |
317 | currentCode = 0; | 317 | currentCode = 0; |
318 | inputChar = new QIMPenChar(); | 318 | inputChar = new QIMPenChar(); |
319 | 319 | ||
320 | QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); | 320 | QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); |
321 | 321 | ||
322 | QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); | 322 | QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); |
323 | gl->setRowStretch( 1, 1 ); | 323 | gl->setRowStretch( 1, 1 ); |
324 | gl->addRowSpacing( 2, 35 ); | 324 | gl->addRowSpacing( 2, 35 ); |
325 | gl->addRowSpacing( 3, 35 ); | 325 | gl->addRowSpacing( 3, 35 ); |
326 | 326 | ||
327 | charSetCombo = new QComboBox( this ); | 327 | charSetCombo = new QComboBox( this ); |
328 | gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); | 328 | gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); |
329 | connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); | 329 | connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSetVisible(int))); |
330 | QIMPenCharSetIterator it( profile->charSets() ); | 330 | QIMPenCharSetIterator it( profile->charSets() ); |
331 | for ( ; it.current(); ++it ) { | 331 | for ( ; it.current(); ++it ) { |
332 | charSetCombo->insertItem( it.current()->description() ); | 332 | charSetCombo->insertItem( it.current()->description() ); |
333 | } | 333 | } |
334 | 334 | ||
335 | charList = new QListBox( this ); | 335 | charList = new QListBox( this ); |
336 | charList->setMinimumHeight( charList->sizeHint().height() ); | 336 | charList->setMinimumHeight( charList->sizeHint().height() ); |
337 | connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); | 337 | connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); |
338 | gl->addWidget( charList, 1, 0 ); | 338 | gl->addWidget( charList, 1, 0 ); |
339 | 339 | ||
340 | pw = new QIMPenWidget( this ); | 340 | pw = new QIMPenWidget( this ); |
341 | pw->setFixedHeight( 75 ); | 341 | pw->setFixedHeight( 75 ); |
342 | gl->addMultiCellWidget( pw, 2, 3, 0, 0 ); | 342 | gl->addMultiCellWidget( pw, 2, 3, 0, 0 ); |
343 | connect( pw, SIGNAL(stroke(QIMPenStroke*)), | 343 | connect( pw, SIGNAL(stroke(QIMPenStroke*)), |
344 | SLOT(newStroke(QIMPenStroke*)) ); | 344 | SLOT(newStroke(QIMPenStroke*)) ); |
345 | 345 | ||
346 | QVBoxLayout *vb = new QVBoxLayout(); | 346 | QVBoxLayout *vb = new QVBoxLayout(); |
347 | gl->addLayout( vb, 1, 1 ); | 347 | gl->addLayout( vb, 1, 1 ); |
348 | newBtn = new QPushButton( tr("New..."), this ); | 348 | newBtn = new QPushButton( tr("New..."), this ); |
349 | connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) ); | 349 | connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) ); |
350 | vb->addWidget( newBtn ); | 350 | vb->addWidget( newBtn ); |
351 | 351 | ||
352 | addBtn = new QPushButton( tr("Add"), this ); | 352 | addBtn = new QPushButton( tr("Add"), this ); |
353 | connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) ); | 353 | connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) ); |
354 | vb->addWidget( addBtn ); | 354 | vb->addWidget( addBtn ); |
355 | 355 | ||
356 | removeBtn = new QPushButton( tr("Remove"), this ); | 356 | removeBtn = new QPushButton( tr("Remove"), this ); |
357 | connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) ); | 357 | connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) ); |
358 | vb->addWidget( removeBtn ); | 358 | vb->addWidget( removeBtn ); |
359 | 359 | ||
360 | QPushButton *pb = new QPushButton( tr("Default"), this ); | 360 | QPushButton *pb = new QPushButton( tr("Default"), this ); |
361 | connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) ); | 361 | connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) ); |
362 | vb->addWidget( pb ); | 362 | vb->addWidget( pb ); |
363 | 363 | ||
364 | QHBoxLayout *hb = new QHBoxLayout(); | 364 | QHBoxLayout *hb = new QHBoxLayout(); |
365 | gl->addLayout( hb, 2, 1 ); | 365 | gl->addLayout( hb, 2, 1 ); |
366 | prevBtn = new QPushButton( this ); | 366 | prevBtn = new QPushButton( this ); |
367 | prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); | 367 | prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); |
368 | connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); | 368 | connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); |
369 | hb->addWidget( prevBtn ); | 369 | hb->addWidget( prevBtn ); |
370 | 370 | ||
371 | nextBtn = new QPushButton( this ); | 371 | nextBtn = new QPushButton( this ); |
372 | nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); | 372 | nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); |
373 | connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); | 373 | connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); |
374 | hb->addWidget( nextBtn ); | 374 | hb->addWidget( nextBtn ); |
375 | 375 | ||
376 | pb = new QPushButton( tr("Clear"), this ); | 376 | pb = new QPushButton( tr("Clear"), this ); |
377 | connect( pb, SIGNAL(clicked()), SLOT(clearChar()) ); | 377 | connect( pb, SIGNAL(clicked()), SLOT(clearChar()) ); |
378 | gl->addWidget( pb, 3, 1 ); | 378 | gl->addWidget( pb, 3, 1 ); |
379 | 379 | ||
380 | //-- | 380 | //-- |
381 | #if !defined(Q_WS_QWS) | 381 | #if !defined(Q_WS_QWS) |
382 | hb = new QHBoxLayout( tvb ); | 382 | hb = new QHBoxLayout( tvb ); |
383 | pb = new QPushButton( tr("OK"), this ); | 383 | pb = new QPushButton( tr("OK"), this ); |
384 | connect( pb, SIGNAL(clicked()), SLOT(accept()) ); | 384 | connect( pb, SIGNAL(clicked()), SLOT(accept()) ); |
385 | hb->addWidget( pb ); | 385 | hb->addWidget( pb ); |
386 | 386 | ||
387 | pb = new QPushButton( tr("Cancel"), this ); | 387 | pb = new QPushButton( tr("Cancel"), this ); |
388 | connect( pb, SIGNAL(clicked()), SLOT(reject()) ); | 388 | connect( pb, SIGNAL(clicked()), SLOT(reject()) ); |
389 | hb->addWidget( pb ); | 389 | hb->addWidget( pb ); |
390 | #endif | 390 | #endif |
391 | selectCharSet( 0 ); | 391 | selectCharSetVisible( 0 ); |
392 | charList->setFocus(); | 392 | charList->setFocus(); |
393 | 393 | ||
394 | resize( minimumSize() ); | 394 | resize( minimumSize() ); |
395 | enableButtons(); | 395 | enableButtons(); |
396 | } | 396 | } |
397 | 397 | ||
398 | void QIMPenEdit::setProfile( QIMPenProfile *p ) | 398 | void QIMPenEdit::setProfile( QIMPenProfile *p ) |
399 | { | 399 | { |
400 | profile = p; | 400 | profile = p; |
401 | charSetCombo->clear(); | 401 | charSetCombo->clear(); |
402 | QIMPenCharSetIterator it( profile->charSets() ); | 402 | QIMPenCharSetIterator it( profile->charSets() ); |
403 | for ( ; it.current(); ++it ) { | 403 | for ( ; it.current(); ++it ) { |
404 | if ( ! it.current()->hidden() ) | 404 | if ( ! it.current()->hidden() ) |
405 | charSetCombo->insertItem( it.current()->description() ); | 405 | charSetCombo->insertItem( it.current()->description() ); |
406 | } | 406 | } |
407 | selectCharSet( 0 ); | 407 | selectCharSetVisible( 0 ); |
408 | charList->setFocus(); | 408 | charList->setFocus(); |
409 | enableButtons(); | 409 | enableButtons(); |
410 | } | 410 | } |
411 | 411 | ||
412 | void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) | 412 | void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) |
413 | { | 413 | { |
414 | int i = 0; | 414 | int i = 0; |
415 | QIMPenCharSetIterator it( profile->charSets() ); | 415 | QIMPenCharSetIterator it( profile->charSets() ); |
416 | for ( ; it.current(); ++it, i++ ) { | 416 | for ( ; it.current(); ++it, i++ ) { |
417 | if ( it.current() == c ) { | 417 | if ( it.current() == c ) { |
418 | charSetCombo->setCurrentItem( i ); | 418 | charSetCombo->setCurrentItem( i ); |
419 | selectCharSet( i ); | 419 | selectCharSet( i ); |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | /*! | 425 | /*! |
426 | Fill the character list box with the characters. Duplicates are not | 426 | Fill the character list box with the characters. Duplicates are not |
427 | inserted. | 427 | inserted. |
428 | */ | 428 | */ |
429 | void QIMPenEdit::fillCharList() | 429 | void QIMPenEdit::fillCharList() |
430 | { | 430 | { |
431 | charList->clear(); | 431 | charList->clear(); |
432 | QIMPenCharIterator it( currentSet->characters() ); | 432 | QIMPenCharIterator it( currentSet->characters() ); |
433 | CharListItem *li = 0; | 433 | CharListItem *li = 0; |
434 | for ( ; it.current(); ++it ) { | 434 | for ( ; it.current(); ++it ) { |
435 | uint ch = it.current()->character(); | 435 | uint ch = it.current()->character(); |
436 | QString n = it.current()->name(); | 436 | QString n = it.current()->name(); |
437 | if ( !n.isEmpty() ) | 437 | if ( !n.isEmpty() ) |
438 | li = new CharListItem( n, ch ); | 438 | li = new CharListItem( n, ch ); |
439 | if ( li ) { | 439 | if ( li ) { |
440 | CharListItem *i = (CharListItem *)charList->findItem( li->text() ); | 440 | CharListItem *i = (CharListItem *)charList->findItem( li->text() ); |
441 | if ( !i || i->code() != ch ) { | 441 | if ( !i || i->code() != ch ) { |
442 | charList->insertItem( li ); | 442 | charList->insertItem( li ); |
443 | } else { | 443 | } else { |
444 | delete li; | 444 | delete li; |
445 | li = 0; | 445 | li = 0; |
446 | } | 446 | } |
447 | } | 447 | } |
448 | } | 448 | } |
449 | currentChar = 0; | 449 | currentChar = 0; |
450 | } | 450 | } |
451 | 451 | ||
452 | void QIMPenEdit::enableButtons() | 452 | void QIMPenEdit::enableButtons() |
453 | { | 453 | { |
454 | bool add = !inputChar->isEmpty(); | 454 | bool add = !inputChar->isEmpty(); |
455 | newBtn->setEnabled( add ); | 455 | newBtn->setEnabled( add ); |
456 | addBtn->setEnabled( add ); | 456 | addBtn->setEnabled( add ); |
457 | removeBtn->setEnabled( currentChar ); | 457 | removeBtn->setEnabled( currentChar ); |
458 | } | 458 | } |
459 | 459 | ||
460 | /*! | 460 | /*! |
461 | Find the previous character with the same code as the current one. | 461 | Find the previous character with the same code as the current one. |
462 | returns 0 if there is no previous character. | 462 | returns 0 if there is no previous character. |
463 | */ | 463 | */ |
464 | QIMPenChar *QIMPenEdit::findPrev() | 464 | QIMPenChar *QIMPenEdit::findPrev() |
465 | { | 465 | { |
466 | if ( !currentChar ) | 466 | if ( !currentChar ) |
467 | return 0; | 467 | return 0; |
468 | QIMPenCharIterator it( currentSet->characters() ); | 468 | QIMPenCharIterator it( currentSet->characters() ); |
469 | bool found = FALSE; | 469 | bool found = FALSE; |
470 | for ( it.toLast(); it.current(); --it ) { | 470 | for ( it.toLast(); it.current(); --it ) { |
471 | if ( !found && it.current() == currentChar ) | 471 | if ( !found && it.current() == currentChar ) |
472 | found = TRUE; | 472 | found = TRUE; |
473 | else if ( found && it.current()->character() == currentCode && | 473 | else if ( found && it.current()->character() == currentCode && |
474 | !it.current()->testFlag( QIMPenChar::Deleted ) ) { | 474 | !it.current()->testFlag( QIMPenChar::Deleted ) ) { |
475 | return it.current(); | 475 | return it.current(); |
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 | ||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | 481 | ||
482 | /*! | 482 | /*! |
483 | Find the next character with the same code as the current one. | 483 | Find the next character with the same code as the current one. |
484 | returns 0 if there is no next character. | 484 | returns 0 if there is no next character. |
485 | */ | 485 | */ |
486 | QIMPenChar *QIMPenEdit::findNext() | 486 | QIMPenChar *QIMPenEdit::findNext() |
487 | { | 487 | { |
488 | if ( !currentChar ) | 488 | if ( !currentChar ) |
489 | return 0; | 489 | return 0; |
490 | QIMPenCharIterator it( currentSet->characters() ); | 490 | QIMPenCharIterator it( currentSet->characters() ); |
491 | bool found = FALSE; | 491 | bool found = FALSE; |
492 | for ( ; it.current(); ++it ) { | 492 | for ( ; it.current(); ++it ) { |
493 | if ( !found && it.current() == currentChar ) | 493 | if ( !found && it.current() == currentChar ) |
494 | found = TRUE; | 494 | found = TRUE; |
495 | else if ( found && it.current()->character() == currentCode && | 495 | else if ( found && it.current()->character() == currentCode && |
496 | !it.current()->testFlag( QIMPenChar::Deleted ) ) { | 496 | !it.current()->testFlag( QIMPenChar::Deleted ) ) { |
497 | return it.current(); | 497 | return it.current(); |
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | 503 | ||
504 | void QIMPenEdit::setCurrentChar( QIMPenChar *pc ) | 504 | void QIMPenEdit::setCurrentChar( QIMPenChar *pc ) |
505 | { | 505 | { |
506 | currentChar = pc; | 506 | currentChar = pc; |
507 | pw->showCharacter( currentChar ); | 507 | pw->showCharacter( currentChar ); |
508 | if ( currentChar ) { | 508 | if ( currentChar ) { |
509 | prevBtn->setEnabled( findPrev() != 0 ); | 509 | prevBtn->setEnabled( findPrev() != 0 ); |
510 | nextBtn->setEnabled( findNext() != 0 ); | 510 | nextBtn->setEnabled( findNext() != 0 ); |
511 | } | 511 | } |
512 | } | 512 | } |
513 | 513 | ||
514 | void QIMPenEdit::prevChar() | 514 | void QIMPenEdit::prevChar() |
515 | { | 515 | { |
516 | QIMPenChar *pc = findPrev(); | 516 | QIMPenChar *pc = findPrev(); |
517 | if ( pc ) | 517 | if ( pc ) |
518 | setCurrentChar( pc ); | 518 | setCurrentChar( pc ); |
519 | } | 519 | } |
520 | 520 | ||
521 | void QIMPenEdit::nextChar() | 521 | void QIMPenEdit::nextChar() |
522 | { | 522 | { |
523 | QIMPenChar *pc = findNext(); | 523 | QIMPenChar *pc = findNext(); |
524 | if ( pc ) | 524 | if ( pc ) |
525 | setCurrentChar( pc ); | 525 | setCurrentChar( pc ); |
526 | } | 526 | } |
527 | 527 | ||
528 | void QIMPenEdit::clearChar() | 528 | void QIMPenEdit::clearChar() |
529 | { | 529 | { |
530 | inputChar->clear(); | 530 | inputChar->clear(); |
531 | pw->clear(); | 531 | pw->clear(); |
532 | enableButtons(); | 532 | enableButtons(); |
533 | } | 533 | } |
534 | 534 | ||
535 | void QIMPenEdit::selectChar( int i ) | 535 | void QIMPenEdit::selectChar( int i ) |
536 | { | 536 | { |
537 | currentChar = 0; | 537 | currentChar = 0; |
538 | currentCode = ((CharListItem *)charList->item(i))->code(); | 538 | currentCode = ((CharListItem *)charList->item(i))->code(); |
539 | QIMPenCharIterator it(currentSet->characters() ); | 539 | QIMPenCharIterator it(currentSet->characters() ); |
540 | for ( ; it.current(); ++it ) { | 540 | for ( ; it.current(); ++it ) { |
541 | if ( it.current()->character() == currentCode && | 541 | if ( it.current()->character() == currentCode && |
542 | !it.current()->testFlag( QIMPenChar::Deleted ) ) { | 542 | !it.current()->testFlag( QIMPenChar::Deleted ) ) { |
543 | setCurrentChar( it.current() ); | 543 | setCurrentChar( it.current() ); |
544 | break; | 544 | break; |
545 | } | 545 | } |
546 | } | 546 | } |
547 | if ( !it.current() ) | 547 | if ( !it.current() ) |
548 | setCurrentChar( 0 ); | 548 | setCurrentChar( 0 ); |
549 | inputChar->clear(); | 549 | inputChar->clear(); |
550 | } | 550 | } |
551 | 551 | ||
552 | void QIMPenEdit::selectCharSetVisible( int c ) | ||
553 | { | ||
554 | int i = 0; | ||
555 | QIMPenCharSetIterator it( profile->charSets() ); | ||
556 | for ( ; it.current(); ++it, i++ ) { | ||
557 | if ( charSetCombo->text( c ) == it.current()->description() ) { | ||
558 | selectCharSet( i ); | ||
559 | } | ||
560 | } | ||
561 | } | ||
562 | |||
552 | void QIMPenEdit::selectCharSet( int i ) | 563 | void QIMPenEdit::selectCharSet( int i ) |
553 | { | 564 | { |
554 | if ( currentSet ) | 565 | if ( currentSet ) |
555 | pw->removeCharSet( 0 ); | 566 | pw->removeCharSet( 0 ); |
556 | currentSet = profile->charSets().at( i ); | 567 | currentSet = profile->charSets().at( i ); |
557 | fillCharList(); | 568 | fillCharList(); |
558 | pw->insertCharSet( currentSet ); | 569 | pw->insertCharSet( currentSet ); |
559 | inputChar->clear(); | 570 | inputChar->clear(); |
560 | if ( charList->count() ) { | 571 | if ( charList->count() ) { |
561 | charList->setSelected( 0, TRUE ); | 572 | charList->setSelected( 0, TRUE ); |
562 | selectChar(0); | 573 | selectChar(0); |
563 | } | 574 | } |
564 | } | 575 | } |
565 | 576 | ||
566 | void QIMPenEdit::addChar() | 577 | void QIMPenEdit::addChar() |
567 | { | 578 | { |
568 | if ( !inputChar->isEmpty() ) { | 579 | if ( !inputChar->isEmpty() ) { |
569 | QIMPenChar *pc = new QIMPenChar( *inputChar ); | 580 | QIMPenChar *pc = new QIMPenChar( *inputChar ); |
570 | pc->setCharacter( currentCode ); | 581 | pc->setCharacter( currentCode ); |
571 | 582 | ||
572 | // User characters override all matching system characters. | 583 | // User characters override all matching system characters. |
573 | // Copy and mark deleted identical system characters. | 584 | // Copy and mark deleted identical system characters. |
574 | 585 | ||
575 | QIMPenCharIterator it(currentSet->characters() ); | 586 | QIMPenCharIterator it(currentSet->characters() ); |
576 | QIMPenChar *sc = 0; | 587 | QIMPenChar *sc = 0; |
577 | while ( (sc = it.current()) != 0 ) { | 588 | while ( (sc = it.current()) != 0 ) { |
578 | ++it; | 589 | ++it; |
579 | if ( sc->character() == currentCode && | 590 | if ( sc->character() == currentCode && |
580 | sc->testFlag( QIMPenChar::System ) && | 591 | sc->testFlag( QIMPenChar::System ) && |
581 | !sc->testFlag( QIMPenChar::Deleted ) ) { | 592 | !sc->testFlag( QIMPenChar::Deleted ) ) { |
582 | QIMPenChar *cc = new QIMPenChar( *sc ); | 593 | QIMPenChar *cc = new QIMPenChar( *sc ); |
583 | cc->clearFlag( QIMPenChar::System ); | 594 | cc->clearFlag( QIMPenChar::System ); |
584 | currentSet->addChar( cc ); | 595 | currentSet->addChar( cc ); |
585 | sc->setFlag( QIMPenChar::Deleted ); | 596 | sc->setFlag( QIMPenChar::Deleted ); |
586 | } | 597 | } |
587 | } | 598 | } |
588 | 599 | ||
589 | currentSet->addChar( pc ); | 600 | currentSet->addChar( pc ); |
590 | setCurrentChar( pc ); | 601 | setCurrentChar( pc ); |
591 | inputChar->clear(); | 602 | inputChar->clear(); |
592 | } | 603 | } |
593 | } | 604 | } |
594 | 605 | ||
595 | void QIMPenEdit::addNewChar() | 606 | void QIMPenEdit::addNewChar() |
596 | { | 607 | { |
597 | if ( !inputChar->isEmpty() ) { | 608 | if ( !inputChar->isEmpty() ) { |
598 | QIMPenInputCharDlg dlg( 0, 0, TRUE ); | 609 | QIMPenInputCharDlg dlg( 0, 0, TRUE ); |
599 | if ( dlg.exec() ) { | 610 | if ( dlg.exec() ) { |
600 | currentCode = dlg.unicode(); | 611 | currentCode = dlg.unicode(); |
601 | addChar(); | 612 | addChar(); |
602 | fillCharList(); | 613 | fillCharList(); |
603 | for ( unsigned int i = 0; i < charList->count(); i++ ) { | 614 | for ( unsigned int i = 0; i < charList->count(); i++ ) { |
604 | CharListItem *li = (CharListItem *)charList->item(i); | 615 | CharListItem *li = (CharListItem *)charList->item(i); |
605 | if ( li->code() == dlg.unicode() ) { | 616 | if ( li->code() == dlg.unicode() ) { |
606 | charList->setSelected( i, TRUE ); | 617 | charList->setSelected( i, TRUE ); |
607 | break; | 618 | break; |
608 | } | 619 | } |
609 | } | 620 | } |
610 | } | 621 | } |
611 | } | 622 | } |
612 | } | 623 | } |
613 | 624 | ||
614 | void QIMPenEdit::removeChar() | 625 | void QIMPenEdit::removeChar() |
615 | { | 626 | { |
616 | if ( currentChar ) { | 627 | if ( currentChar ) { |
617 | QIMPenChar *pc = findPrev(); | 628 | QIMPenChar *pc = findPrev(); |
618 | if ( !pc ) pc = findNext(); | 629 | if ( !pc ) pc = findNext(); |
619 | if ( currentChar->testFlag( QIMPenChar::System ) ) | 630 | if ( currentChar->testFlag( QIMPenChar::System ) ) |
620 | currentChar->setFlag( QIMPenChar::Deleted ); | 631 | currentChar->setFlag( QIMPenChar::Deleted ); |
621 | else | 632 | else |
622 | currentSet->removeChar( currentChar ); | 633 | currentSet->removeChar( currentChar ); |
623 | setCurrentChar( pc ); | 634 | setCurrentChar( pc ); |
624 | } | 635 | } |
625 | } | 636 | } |
626 | 637 | ||
627 | void QIMPenEdit::defaultChars() | 638 | void QIMPenEdit::defaultChars() |
628 | { | 639 | { |
629 | if ( currentCode ) { | 640 | if ( currentCode ) { |
630 | currentChar = 0; | 641 | currentChar = 0; |
631 | bool haveSystem = FALSE; | 642 | bool haveSystem = FALSE; |
632 | QIMPenCharIterator it(currentSet->characters() ); | 643 | QIMPenCharIterator it(currentSet->characters() ); |
633 | for ( ; it.current(); ++it ) { | 644 | for ( ; it.current(); ++it ) { |
634 | if ( it.current()->character() == currentCode && | 645 | if ( it.current()->character() == currentCode && |
635 | it.current()->testFlag( QIMPenChar::System ) ) { | 646 | it.current()->testFlag( QIMPenChar::System ) ) { |
636 | haveSystem = TRUE; | 647 | haveSystem = TRUE; |
637 | break; | 648 | break; |
638 | } | 649 | } |
639 | } | 650 | } |
640 | if ( haveSystem ) { | 651 | if ( haveSystem ) { |
641 | it.toFirst(); | 652 | it.toFirst(); |
642 | while ( it.current() ) { | 653 | while ( it.current() ) { |
643 | QIMPenChar *pc = it.current(); | 654 | QIMPenChar *pc = it.current(); |
644 | ++it; | 655 | ++it; |
645 | if ( pc->character() == currentCode ) { | 656 | if ( pc->character() == currentCode ) { |
646 | if ( pc->testFlag( QIMPenChar::System ) ) { | 657 | if ( pc->testFlag( QIMPenChar::System ) ) { |
647 | pc->clearFlag( QIMPenChar::Deleted ); | 658 | pc->clearFlag( QIMPenChar::Deleted ); |
648 | if ( !currentChar ) | 659 | if ( !currentChar ) |
649 | currentChar = pc; | 660 | currentChar = pc; |
650 | } else { | 661 | } else { |
651 | currentSet->removeChar( pc ); | 662 | currentSet->removeChar( pc ); |
652 | } | 663 | } |
653 | } | 664 | } |
654 | } | 665 | } |
655 | setCurrentChar( currentChar ); | 666 | setCurrentChar( currentChar ); |
656 | } | 667 | } |
657 | } | 668 | } |
658 | } | 669 | } |
659 | 670 | ||
660 | void QIMPenEdit::newStroke( QIMPenStroke *st ) | 671 | void QIMPenEdit::newStroke( QIMPenStroke *st ) |
661 | { | 672 | { |
662 | inputChar->addStroke( st ); | 673 | inputChar->addStroke( st ); |
663 | enableButtons(); | 674 | enableButtons(); |
664 | } | 675 | } |
665 | 676 | ||
diff --git a/inputmethods/handwriting/qimpensetup.h b/inputmethods/handwriting/qimpensetup.h index 5d3064b..93b981b 100644 --- a/inputmethods/handwriting/qimpensetup.h +++ b/inputmethods/handwriting/qimpensetup.h | |||
@@ -1,124 +1,125 @@ | |||
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 <qdialog.h> | 21 | #include <qdialog.h> |
22 | #include <qlist.h> | 22 | #include <qlist.h> |
23 | #include "qimpenprofile.h" | 23 | #include "qimpenprofile.h" |
24 | 24 | ||
25 | class QListBox; | 25 | class QListBox; |
26 | class QPushButton; | 26 | class QPushButton; |
27 | class QComboBox; | 27 | class QComboBox; |
28 | class QIMPenWidget; | 28 | class QIMPenWidget; |
29 | class QIMPenEdit; | 29 | class QIMPenEdit; |
30 | class QIMPenPrefBase; | 30 | class QIMPenPrefBase; |
31 | 31 | ||
32 | class QIMPenSetup : public QDialog | 32 | class QIMPenSetup : public QDialog |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | QIMPenSetup( QIMPenProfile *p, QWidget *parent=0, | 36 | QIMPenSetup( QIMPenProfile *p, QWidget *parent=0, |
37 | const char *name=0, bool modal=FALSE, int WFlags=0 ); | 37 | const char *name=0, bool modal=FALSE, int WFlags=0 ); |
38 | 38 | ||
39 | QIMPenEdit *editor() { return edit; } | 39 | QIMPenEdit *editor() { return edit; } |
40 | 40 | ||
41 | protected: | 41 | protected: |
42 | void loadProfiles(); | 42 | void loadProfiles(); |
43 | virtual void accept(); | 43 | virtual void accept(); |
44 | 44 | ||
45 | private slots: | 45 | private slots: |
46 | void styleClicked( int ); | 46 | void styleClicked( int ); |
47 | void multiTimeoutChanged( int ); | 47 | void multiTimeoutChanged( int ); |
48 | void selectProfile( const QString &p ); | 48 | void selectProfile( const QString &p ); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | QComboBox *profileCombo; | 51 | QComboBox *profileCombo; |
52 | QIMPenEdit *edit; | 52 | QIMPenEdit *edit; |
53 | QIMPenPrefBase *pref; | 53 | QIMPenPrefBase *pref; |
54 | int style; | 54 | int style; |
55 | int multiTimeout; | 55 | int multiTimeout; |
56 | QIMPenProfile *profile; | 56 | QIMPenProfile *profile; |
57 | QList<QIMPenProfile> profileList; | 57 | QList<QIMPenProfile> profileList; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | class QIMPenInputCharDlg : public QDialog | 60 | class QIMPenInputCharDlg : public QDialog |
61 | { | 61 | { |
62 | Q_OBJECT | 62 | Q_OBJECT |
63 | public: | 63 | public: |
64 | QIMPenInputCharDlg( QWidget *parent = 0, const char *name = 0, | 64 | QIMPenInputCharDlg( QWidget *parent = 0, const char *name = 0, |
65 | bool modal = FALSE, int WFlags = 0 ); | 65 | bool modal = FALSE, int WFlags = 0 ); |
66 | 66 | ||
67 | unsigned int unicode() const { return uni; } | 67 | unsigned int unicode() const { return uni; } |
68 | 68 | ||
69 | protected: | 69 | protected: |
70 | void addSpecial( QComboBox *cb ); | 70 | void addSpecial( QComboBox *cb ); |
71 | 71 | ||
72 | protected slots: | 72 | protected slots: |
73 | void setSpecial( int sp ); | 73 | void setSpecial( int sp ); |
74 | void setCharacter( const QString &string ); | 74 | void setCharacter( const QString &string ); |
75 | 75 | ||
76 | protected: | 76 | protected: |
77 | uint uni; | 77 | uint uni; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | class QIMPenEdit : public QWidget | 80 | class QIMPenEdit : public QWidget |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | QIMPenEdit( QIMPenProfile *p, QWidget *parent=0, | 84 | QIMPenEdit( QIMPenProfile *p, QWidget *parent=0, |
85 | const char *name=0 ); | 85 | const char *name=0 ); |
86 | 86 | ||
87 | void setProfile( QIMPenProfile *p ); | 87 | void setProfile( QIMPenProfile *p ); |
88 | void selectCharSet( QIMPenCharSet *c ); | 88 | void selectCharSet( QIMPenCharSet *c ); |
89 | 89 | ||
90 | protected: | 90 | protected: |
91 | void fillCharList(); | 91 | void fillCharList(); |
92 | void enableButtons(); | 92 | void enableButtons(); |
93 | QIMPenChar *findPrev(); | 93 | QIMPenChar *findPrev(); |
94 | QIMPenChar *findNext(); | 94 | QIMPenChar *findNext(); |
95 | void setCurrentChar( QIMPenChar * ); | 95 | void setCurrentChar( QIMPenChar * ); |
96 | 96 | ||
97 | protected slots: | 97 | protected slots: |
98 | void prevChar(); | 98 | void prevChar(); |
99 | void nextChar(); | 99 | void nextChar(); |
100 | void clearChar(); | 100 | void clearChar(); |
101 | void selectChar( int ); | 101 | void selectChar( int ); |
102 | void selectCharSet( int ); | 102 | void selectCharSet( int ); |
103 | void selectCharSetVisible( int ); | ||
103 | void addChar(); | 104 | void addChar(); |
104 | void addNewChar(); | 105 | void addNewChar(); |
105 | void removeChar(); | 106 | void removeChar(); |
106 | void defaultChars(); | 107 | void defaultChars(); |
107 | void newStroke( QIMPenStroke * ); | 108 | void newStroke( QIMPenStroke * ); |
108 | 109 | ||
109 | protected: | 110 | protected: |
110 | QIMPenWidget *pw; | 111 | QIMPenWidget *pw; |
111 | QComboBox *charSetCombo; | 112 | QComboBox *charSetCombo; |
112 | QListBox *charList; | 113 | QListBox *charList; |
113 | QPushButton *newBtn; | 114 | QPushButton *newBtn; |
114 | QPushButton *addBtn; | 115 | QPushButton *addBtn; |
115 | QPushButton *removeBtn; | 116 | QPushButton *removeBtn; |
116 | QPushButton *prevBtn; | 117 | QPushButton *prevBtn; |
117 | QPushButton *nextBtn; | 118 | QPushButton *nextBtn; |
118 | uint currentCode; | 119 | uint currentCode; |
119 | QIMPenChar *currentChar; | 120 | QIMPenChar *currentChar; |
120 | QIMPenChar *inputChar; | 121 | QIMPenChar *inputChar; |
121 | QIMPenCharSet *currentSet; | 122 | QIMPenCharSet *currentSet; |
122 | QIMPenProfile *profile; | 123 | QIMPenProfile *profile; |
123 | }; | 124 | }; |
124 | 125 | ||