-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathSelectCharacter.cpp
441 lines (411 loc) · 31.8 KB
/
SelectCharacter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
/************************************************************************
**
** Copyright (C) 2018-2024 Kevin B. Hendricks, Stratford, ON Canada
** Copyright (C) 2012 John Schember <john@nachtimwald.com>
** Copyright (C) 2012 Dave Heiland
**
** This file is part of PageEdit.
**
** PageEdit is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** PageEdit is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with PageEdit. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include <QCompleter>
#include <QLineEdit>
#include <QToolButton>
#include <QApplication>
#include <QSignalMapper>
#include <QScrollArea>
#include <QVBoxLayout>
#include "SelectCharacter.h"
static QString SETTINGS_GROUP = "select_character";
SelectCharacter::SelectCharacter(QWidget *parent)
:
QDialog(parent),
m_buttonMapper(new QSignalMapper(this))
{
ui.setupUi(this);
connectSignalsSlots();
ReadSettings();
SetList();
QWidget *viewport = new QWidget;
viewport->setLayout(ui.character_box);
QScrollArea * scrollArea = new QScrollArea;
scrollArea->setWidget(viewport);
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(scrollArea);
setLayout(vbox);
}
SelectCharacter::~SelectCharacter()
{
WriteSettings();
}
void SelectCharacter::show()
{
SettingsStore settings;
SettingsStore::SpecialCharacterAppearance appearance = settings.specialCharacterAppearance();
if ((m_SpecialCharacterAppearance.font_family != appearance.font_family) ||
(m_SpecialCharacterAppearance.font_size != appearance.font_size)) {
// We need to update the grid to reflect the new appearance
m_SpecialCharacterAppearance = appearance;
QFont font(m_SpecialCharacterAppearance.font_family, m_SpecialCharacterAppearance.font_size);
// Find all the buttons initialised on the grid and set their new font.
QList<QToolButton *> buttons = findChildren<QToolButton *>();
foreach(QToolButton * button, buttons) {
button->setFont(font);
}
}
QDialog::show();
}
void SelectCharacter::SetList()
{
// chars to insert, chars to display, tooltip entity, tooltip desc
// http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=0x&htmlent=1
QStringList spaces = QStringList()
<< QString::fromUtf8("\xc2\xa0") << "nbsp" << " " << tr("non-breaking space")
<< QString::fromUtf8("\xe2\x80\x82") << "ensp" << " " << tr("en space")
<< QString::fromUtf8("\xe2\x80\x83") << "emsp" << " " << tr("em space")
<< QString::fromUtf8("\xe2\x80\x89") << "thinsp" << " " << tr("thin space")
<< "­" << "shy" << "­" << tr("soft hyphen")
<< QString::fromUtf8("\xe2\x80\xaf") << "nnbsp" << " " << tr("narrow non-breaking space")
;
QStringList characters = QStringList()
<< QString::fromUtf8("\xe2\x80\x98") << "" << "‘" << tr("left single quote")
<< QString::fromUtf8("\xe2\x80\x99") << "" << "’" << tr("right single quote")
<< QString::fromUtf8("\xe2\x80\x9C") << "" << "“" << tr("left double quote")
<< QString::fromUtf8("\xe2\x80\x9D") << "" << "”" << tr("right double quote")
<< QString::fromUtf8("\xe2\x80\xB9") << "" << "‹" << tr("left-pointing single angle quote")
<< QString::fromUtf8("\xe2\x80\xBA") << "" << "›" << tr("right-pointing single angle quote")
<< QString::fromUtf8("\xc2\xab") << "" << "«" << tr("left-pointing double angle quote")
<< QString::fromUtf8("\xc2\xbb") << "" << "»" << tr("right-pointing double angle quote")
<< "'" << "" << "'" << tr("apostrophe")
<< "\"" << "" << """ << tr("double quote")
<< QString::fromUtf8("\xe2\x80\x9A") << "" << "‚" << tr("single low-9 quote")
<< QString::fromUtf8("\xe2\x80\x9E") << "" << "„" << tr("double low-9 quote")
<< QString::fromUtf8("\xe2\x80\x94") << "" << "—" << tr("em dash")
<< QString::fromUtf8("\xe2\x80\x93") << "" << "–" << tr("en dash")
<< QString::fromUtf8("\xc2\xa7") << "" << "§" << tr("section sign")
<< QString::fromUtf8("\xc2\xb6") << "" << "¶" << tr("pilcrow - paragraph sign")
<< QString::fromUtf8("\xe2\x80\xa0") << "" << "†" << tr("dagger")
<< QString::fromUtf8("\xe2\x80\xa1") << "" << "‡" << tr("double dagger")
<< "&" << "&&" << "&" << tr("ampersand")
<< "<" << "<" << "<" << tr("less-than sign")
<< ">" << ">" << ">" << tr("greater-than sign")
<< QString::fromUtf8("\xc2\xa9") << "" << "©" << tr("copyright")
<< QString::fromUtf8("\xc2\xae") << "" << "®" << tr("registered sign")
<< QString::fromUtf8("\xe2\x84\xa2") << "" << "™" << tr("trademark symbol")
<< QString::fromUtf8("\xe2\x86\x90") << "" << "←" << tr("left arrow")
<< QString::fromUtf8("\xe2\x86\x92") << "" << "→" << tr("right arrow")
<< QString::fromUtf8("\xe2\x80\xa2") << "" << "•" << tr("bullet")
<< QString::fromUtf8("\xc2\xb7") << "" << "·" << tr("middle dot")
<< QString::fromUtf8("\xc2\xb0") << "" << "°" << tr("degree sign")
<< QString::fromUtf8("\xc2\xb1") << "" << "±" << tr("plus minus sign")
<< QString::fromUtf8("\xe2\x88\x92") << "" << "−" << tr("minus sign")
<< QString::fromUtf8("\xc3\x97") << "" << "×" << tr("multiplication sign")
<< QString::fromUtf8("\xc3\xb7") << "" << "÷" << tr("division sign")
<< QString::fromUtf8("\xc2\xbc") << "" << "¼" << tr("fraction 1/4")
<< QString::fromUtf8("\xc2\xbd") << "" << "½" << tr("fraction 1/2")
<< QString::fromUtf8("\xc2\xbe") << "" << "¾" << tr("fraction 3/4")
<< QString::fromUtf8("\xe2\x85\x93") << "" << "⅓" << tr("fraction 1/3")
<< QString::fromUtf8("\xe2\x85\x94") << "" << "⅔" << tr("fraction 2/3")
<< QString::fromUtf8("\xe2\x85\x9b") << "" << "⅛" << tr("fraction 1/8")
<< QString::fromUtf8("\xe2\x85\x9c") << "" << "⅜" << tr("fraction 3/8")
<< QString::fromUtf8("\xe2\x85\x9d") << "" << "⅝" << tr("fraction 5/8")
<< QString::fromUtf8("\xe2\x85\x9e") << "" << "⅞" << tr("fraction 7/8")
<< QString::fromUtf8("\xe2\x80\xa6") << "" << "…" << tr("horizontal ellipsis")
<< QString::fromUtf8("\xc2\xb5") << "" << "µ" << tr("micron")
<< QString::fromUtf8("\xc2\xa2") << "" << "¢" << tr("cent sign")
<< QString::fromUtf8("\xc2\xa3") << "" << "£" << tr("pound sign")
<< QString::fromUtf8("\xe2\x82\xac") << "" << "€" << tr("euro sign")
<< QString::fromUtf8("\xc2\xbf") << "" << "¿" << tr("inverted question mark")
<< QString::fromUtf8("\xc2\xa1") << "" << "¡" << tr("inverted exclamation mark")
<< QString::fromUtf8("\xc2\xa8") << "" << "¨" << tr("diaeresis")
<< QString::fromUtf8("\xc2\xb4") << "" << "´" << tr("acute accent")
<< QString::fromUtf8("\xc2\xb8") << "" << "¸" << tr("cedilla")
<< QString::fromUtf8("\xcb\x86") << "" << "ˆ" << tr("circumflex accent")
<< QString::fromUtf8("\xcb\x9c") << "" << "˜" << tr("small tilde")
<< QString::fromUtf8("\xc3\x80") << "" << "À" << tr("capital A with grave")
<< QString::fromUtf8("\xc3\x81") << "" << "Á" << tr("capital A with acute")
<< QString::fromUtf8("\xc3\x82") << "" << "Â" << tr("capital A with circumflex")
<< QString::fromUtf8("\xc3\x83") << "" << "Ã" << tr("capital A with tilde")
<< QString::fromUtf8("\xc3\x84") << "" << "Ä" << tr("capital A with diaeresis")
<< QString::fromUtf8("\xc3\x85") << "" << "Å" << tr("capital A with ring above")
<< QString::fromUtf8("\xc3\x86") << "" << "Æ" << tr("capital AE")
<< QString::fromUtf8("\xc3\x87") << "" << "Ç" << tr("capital C with cedilla")
<< QString::fromUtf8("\xc3\x88") << "" << "È" << tr("capital E with grave")
<< QString::fromUtf8("\xc3\x89") << "" << "É" << tr("capital E with acute")
<< QString::fromUtf8("\xc3\x8a") << "" << "Ê" << tr("capital E with circumflex")
<< QString::fromUtf8("\xc3\x8b") << "" << "Ë" << tr("capital E with diaeresis")
<< QString::fromUtf8("\xc3\x8c") << "" << "Ì" << tr("capital I with grave")
<< QString::fromUtf8("\xc3\x8d") << "" << "Í" << tr("capital I with acute")
<< QString::fromUtf8("\xc3\x8e") << "" << "Î" << tr("capital I with circumflex")
<< QString::fromUtf8("\xc3\x8f") << "" << "Ï" << tr("capital I with diaeresis")
<< QString::fromUtf8("\xc3\x90") << "" << "Ð" << tr("capital eth")
<< QString::fromUtf8("\xc3\x91") << "" << "Ñ" << tr("capital N with tilde")
<< QString::fromUtf8("\xc3\x92") << "" << "Ò" << tr("capital O with grave")
<< QString::fromUtf8("\xc3\x93") << "" << "Ó" << tr("capital O with acute")
<< QString::fromUtf8("\xc3\x94") << "" << "Ô" << tr("capital O with circumflex")
<< QString::fromUtf8("\xc3\x95") << "" << "Õ" << tr("capital O with tilde")
<< QString::fromUtf8("\xc3\x96") << "" << "Ö" << tr("capital O with diaeresis")
<< QString::fromUtf8("\xc3\x98") << "" << "Ø" << tr("capital O with stroke")
<< QString::fromUtf8("\xc5\x92") << "" << "Œ" << tr("capital ligature OE")
<< QString::fromUtf8("\xc5\xa0") << "" << "Š" << tr("capital S with caron")
<< QString::fromUtf8("\xc3\x99") << "" << "Ù" << tr("capital U with grave")
<< QString::fromUtf8("\xc3\x9a") << "" << "Ú" << tr("capital U with acute")
<< QString::fromUtf8("\xc3\x9b") << "" << "Û" << tr("capital U with circumflex")
<< QString::fromUtf8("\xc3\x9c") << "" << "Ü" << tr("capital U with diaeresis")
<< QString::fromUtf8("\xc3\x9d") << "" << "Ý" << tr("capital Y with acute")
<< QString::fromUtf8("\xc5\xb8") << "" << "Ÿ" << tr("capital Y with diaeresis")
<< QString::fromUtf8("\xc3\x9e") << "" << "Þ" << tr("capital THORN")
<< QString::fromUtf8("\xc3\x9f") << "" << "ß" << tr("small sharp s")
<< QString::fromUtf8("\xc3\xa0") << "" << "à" << tr("small a with grave")
<< QString::fromUtf8("\xc3\xa1") << "" << "á" << tr("small a with acute")
<< QString::fromUtf8("\xc3\xa2") << "" << "â" << tr("small a with circumflex")
<< QString::fromUtf8("\xc3\xa3") << "" << "ã" << tr("small a with tilde")
<< QString::fromUtf8("\xc3\xa4") << "" << "ä" << tr("small a with diaeresis")
<< QString::fromUtf8("\xc3\xa5") << "" << "å" << tr("small a with ring above")
<< QString::fromUtf8("\xc3\xa6") << "" << "æ" << tr("small ae")
<< QString::fromUtf8("\xc3\xa7") << "" << "ç" << tr("small c with cedilia")
<< QString::fromUtf8("\xc3\xa8") << "" << "è" << tr("small e with grave")
<< QString::fromUtf8("\xc3\xa9") << "" << "é" << tr("small e with acute")
<< QString::fromUtf8("\xc3\xaa") << "" << "ê" << tr("small e with circumflex")
<< QString::fromUtf8("\xc3\xab") << "" << "ë" << tr("small e with diaeresis")
<< QString::fromUtf8("\xc3\xac") << "" << "ì" << tr("small i with grave")
<< QString::fromUtf8("\xc3\xad") << "" << "í" << tr("small i with acute")
<< QString::fromUtf8("\xc3\xae") << "" << "î" << tr("small i with circumflex")
<< QString::fromUtf8("\xc3\xaf") << "" << "ï" << tr("small i with diaeresis")
<< QString::fromUtf8("\xc3\xb0") << "" << "ð" << tr("small eth")
<< QString::fromUtf8("\xc3\xb1") << "" << "ñ" << tr("small n with tilde")
<< QString::fromUtf8("\xc3\xb2") << "" << "ò" << tr("small o with grave")
<< QString::fromUtf8("\xc3\xb3") << "" << "ó" << tr("small o with acute")
<< QString::fromUtf8("\xc3\xb4") << "" << "ô" << tr("small o with circumflex")
<< QString::fromUtf8("\xc3\xb5") << "" << "õ" << tr("small o with tilde")
<< QString::fromUtf8("\xc3\xb6") << "" << "ö" << tr("small o with diaeresis")
<< QString::fromUtf8("\xc3\xb8") << "" << "ø" << tr("small o with stroke")
<< QString::fromUtf8("\xc5\x93") << "" << "œ" << tr("small ligature oe")
<< QString::fromUtf8("\xc5\xa1") << "" << "š" << tr("small s with caron")
<< QString::fromUtf8("\xc3\xb9") << "" << "ù" << tr("small u with grave")
<< QString::fromUtf8("\xc3\xba") << "" << "ú" << tr("small u with acute")
<< QString::fromUtf8("\xc3\xbb") << "" << "û" << tr("small u with circumflex")
<< QString::fromUtf8("\xc3\xbc") << "" << "ü" << tr("small u with diaeresis")
<< QString::fromUtf8("\xc3\xbd") << "" << "ý" << tr("small y with acute")
<< QString::fromUtf8("\xc3\xbf") << "" << "ÿ" << tr("small y with diaeresis")
<< QString::fromUtf8("\xc3\xbe") << "" << "þ" << tr("small thorn")
<< QString::fromUtf8("\xc2\xaa") << "" << "ª" << tr("feminine ordinal indicator")
<< QString::fromUtf8("\xc2\xba") << "" << "º" << tr("masculine ordinal indicator")
<< QString::fromUtf8("\xe2\x88\x9e") << "" << "∞" << tr("infinity")
;
QStringList characters2 = QStringList()
<< QString::fromUtf8("\xce\x91") << "" << "Α" << tr("Greek capital letter Alpha")
<< QString::fromUtf8("\xce\xb1") << "" << "α" << tr("Greek lower letter alpha")
<< QString::fromUtf8("\xce\x92") << "" << "Β" << tr("Greek capital letter Beta")
<< QString::fromUtf8("\xce\xb2") << "" << "β" << tr("Greek lower letter beta")
<< QString::fromUtf8("\xce\xa7") << "" << "Χ" << tr("Greek capital letter Chi")
<< QString::fromUtf8("\xcf\x87") << "" << "χ" << tr("Greek lower letter chi")
<< QString::fromUtf8("\xce\x94") << "" << "Δ" << tr("Greek capital letter Delta")
<< QString::fromUtf8("\xce\xb4") << "" << "δ" << tr("Greek lower letter delta")
<< QString::fromUtf8("\xce\x95") << "" << "Ε" << tr("Greek capital letter Epsilon")
<< QString::fromUtf8("\xce\xb5") << "" << "ε" << tr("Greek lower letter epsilon")
<< QString::fromUtf8("\xce\x97") << "" << "Η" << tr("Greek capital letter Eta")
<< QString::fromUtf8("\xce\xb7") << "" << "η" << tr("Greek lower letter eta")
<< QString::fromUtf8("\xce\x93") << "" << "Γ" << tr("Greek capital letter Gamma")
<< QString::fromUtf8("\xce\xb3") << "" << "γ" << tr("Greek lower letter gamma")
<< QString::fromUtf8("\xce\x99") << "" << "Ι" << tr("Greek capital letter Iota")
<< QString::fromUtf8("\xce\xb9") << "" << "ι" << tr("Greek lower letter iota")
<< QString::fromUtf8("\xce\x9a") << "" << "Κ" << tr("Greek capital letter Kappa")
<< QString::fromUtf8("\xce\xba") << "" << "κ" << tr("Greek lower letter kappa")
<< QString::fromUtf8("\xce\x9b") << "" << "Λ" << tr("Greek capital letter Lambda")
<< QString::fromUtf8("\xce\xbb") << "" << "λ" << tr("Greek lower letter lambda")
<< QString::fromUtf8("\xce\x9c") << "" << "Μ" << tr("Greek capital letter Mu")
<< QString::fromUtf8("\xce\xbc") << "" << "μ" << tr("Greek lower letter mu")
<< QString::fromUtf8("\xce\x9d") << "" << "Ν" << tr("Greek capital letter Nu")
<< QString::fromUtf8("\xce\xbd") << "" << "ν" << tr("Greek lower letter nu")
<< QString::fromUtf8("\xce\xa9") << "" << "Ω" << tr("Greek capital letter Omega")
<< QString::fromUtf8("\xcf\x89") << "" << "ω" << tr("Greek lower letter omega")
<< QString::fromUtf8("\xce\x9f") << "" << "Ο" << tr("Greek capital letter Omicron")
<< QString::fromUtf8("\xce\xbf") << "" << "ο" << tr("Greek lower letter omicron")
<< QString::fromUtf8("\xce\xa6") << "" << "Φ" << tr("Greek capital letter Phi")
<< QString::fromUtf8("\xcf\x86") << "" << "φ" << tr("Greek lower letter phi")
<< QString::fromUtf8("\xce\xa0") << "" << "Π" << tr("Greek capital letter Pi")
<< QString::fromUtf8("\xcf\x80") << "" << "π" << tr("Greek lower letter pi")
<< QString::fromUtf8("\xe2\x80\xb3") << "" << "″" << tr("Greek double prime")
<< QString::fromUtf8("\xe2\x80\xb2") << "" << "′" << tr("Greek single prime")
<< QString::fromUtf8("\xce\xa8") << "" << "Ψ" << tr("Greek capital letter Psi")
<< QString::fromUtf8("\xcf\x88") << "" << "ψ" << tr("Greek lower letter psi")
<< QString::fromUtf8("\xce\xa1") << "" << "Ρ" << tr("Greek capital letter Rho")
<< QString::fromUtf8("\xcf\x81") << "" << "ρ" << tr("Greek lower letter rho")
<< QString::fromUtf8("\xce\xa3") << "" << "Σ" << tr("Greek capital letter Sigma")
<< QString::fromUtf8("\xcf\x83") << "" << "σ" << tr("Greek lower letter sigma")
<< QString::fromUtf8("\xce\xa4") << "" << "Τ" << tr("Greek capital letter Tau")
<< QString::fromUtf8("\xcf\x84") << "" << "τ" << tr("Greek lower letter tau")
<< QString::fromUtf8("\xce\x98") << "" << "Θ" << tr("Greek capital letter Theta")
<< QString::fromUtf8("\xce\xb8") << "" << "θ" << tr("Greek lower letter theta")
<< QString::fromUtf8("\xce\xa5") << "" << "Υ" << tr("Greek capital letter Upsilon")
<< QString::fromUtf8("\xcf\x85") << "" << "υ" << tr("Greek lower letter upsilon")
<< QString::fromUtf8("\xce\x9e") << "" << "Ξ" << tr("Greek capital letter Xi")
<< QString::fromUtf8("\xce\xbe") << "" << "ξ" << tr("Greek lower letter xi")
<< QString::fromUtf8("\xce\x96") << "" << "Ζ" << tr("Greek capital letter Zeta")
<< QString::fromUtf8("\xce\xb6") << "" << "ζ" << tr("Greek lower letter zeta")
;
QStringList characters3 = QStringList()
<< QString::fromUtf8("\xe2\x84\xb5") << "" << "ℵ" << tr("alef symbol")
<< QString::fromUtf8("\xe2\x88\xa7") << "" << "∧" << tr("logical and")
<< QString::fromUtf8("\xe2\x88\xa8") << "" << "∨" << tr("logical or")
<< QString::fromUtf8("\xe2\x88\xa9") << "" << "∩" << tr("intersection")
<< QString::fromUtf8("\xe2\x88\xaa") << "" << "∪" << tr("union")
<< QString::fromUtf8("\xe2\x89\x85") << "" << "≅" << tr("congruent to")
<< QString::fromUtf8("\xe2\x86\xb5") << "" << "↵" << tr("downwards arrow with corner leftwards")
<< QString::fromUtf8("\xc2\xa4") << "" << "¤" << tr("currency sign")
<< QString::fromUtf8("\xe2\x87\x93") << "" << "⇓" << tr("downwards double arrow")
<< QString::fromUtf8("\xe2\x87\x91") << "" << "⇑" << tr("upwards double arrow")
<< QString::fromUtf8("\xe2\x86\x93") << "" << "↓" << tr("downwards arrow")
<< QString::fromUtf8("\xe2\x86\x91") << "" << "↑" << tr("upwards arrow")
<< QString::fromUtf8("\xe2\x88\x85") << "" << "∅" << tr("empty set")
<< QString::fromUtf8("\xe2\x89\xa1") << "" << "≡" << tr("identical to")
<< QString::fromUtf8("\xe2\x88\x83") << "" << "∃" << tr("there exists")
<< QString::fromUtf8("\xc6\x92") << "" << "ƒ" << tr("Latin small letter f with hook")
<< QString::fromUtf8("\xe2\x88\x80") << "" << "∀" << tr("for all")
<< QString::fromUtf8("\xe2\x81\x84") << "" << "⁄" << tr("fraction slash")
<< QString::fromUtf8("\xe2\x87\x94") << "" << "⇔" << tr("left right double arrow")
<< QString::fromUtf8("\xe2\x86\x94") << "" << "↔" << tr("left right single arrow")
<< QString::fromUtf8("\xe2\x84\x91") << "" << "ℑ" << tr("black-letter capital I")
<< QString::fromUtf8("\xe2\x88\xab") << "" << "∫" << tr("integral")
<< QString::fromUtf8("\xe2\x88\x88") << "" << "∈" << tr("element of")
<< QString::fromUtf8("\xe2\x87\x90") << "" << "⇐" << tr("leftwards double arrow")
<< QString::fromUtf8("\xe2\x87\x92") << "" << "⇒" << tr("double right arrow")
<< QString::fromUtf8("\xe2\x8c\xa9") << "" << "⟨" << tr("left-pointing angle bracket")
<< QString::fromUtf8("\xe2\x8c\xaa") << "" << "⟩" << tr("right-pointing angle bracket")
<< QString::fromUtf8("\xe2\x8c\x88") << "" << "⌈" << tr("left ceiling")
<< QString::fromUtf8("\xe2\x8c\x89") << "" << "⌉" << tr("right ceiling")
<< QString::fromUtf8("\xe2\x89\xa4") << "" << "≤" << tr("less-than or equal to")
<< QString::fromUtf8("\xe2\x89\xa5") << "" << "≥" << tr("greater-than or equal to")
<< QString::fromUtf8("\xe2\x8c\x8a") << "" << "⌊" << tr("left floor")
<< QString::fromUtf8("\xe2\x8c\x8b") << "" << "⌋" << tr("right floor")
<< QString::fromUtf8("\xe2\x88\x97") << "" << "∗" << tr("asterisk operator")
<< QString::fromUtf8("\xe2\x97\x8a") << "" << "◊" << tr("lozenge")
<< QString::fromUtf8("\xc2\xaf") << "" << "¯" << tr("macron")
<< QString::fromUtf8("\xe2\x88\x87") << "" << "∇" << tr("nabla")
<< QString::fromUtf8("\xe2\x89\xa0") << "" << "≠" << tr("not equal to")
<< QString::fromUtf8("\xe2\x88\x8b") << "" << "∋" << tr("contains as member")
<< QString::fromUtf8("\xc2\xac") << "" << "¬" << tr("not sign")
<< QString::fromUtf8("\xe2\x88\x89") << "" << "∉" << tr("not an element of")
<< QString::fromUtf8("\xe2\x8a\x84") << "" << "⊄" << tr("not a subset of")
<< QString::fromUtf8("\xe2\x80\xbe") << "" << "‾" << tr("overline")
<< QString::fromUtf8("\xe2\x8a\x95") << "" << "⊕" << tr("circled plus")
<< QString::fromUtf8("\xe2\x8a\x97") << "" << "⊗" << tr("circled times")
<< QString::fromUtf8("\xe2\x88\x82") << "" << "∂" << tr("partial differential")
<< QString::fromUtf8("\xe2\x80\xb0") << "" << "‰" << tr("per mille sign")
<< QString::fromUtf8("\xe2\x8a\xa5") << "" << "⊥" << tr("up tack")
<< QString::fromUtf8("\xcf\x96") << "" << "ϖ" << tr("Greek pi symbol")
<< QString::fromUtf8("\xe2\x88\x8f") << "" << "∏" << tr("n-ary product")
<< QString::fromUtf8("\xe2\x88\x9d") << "" << "∝" << tr("proportional to")
<< QString::fromUtf8("\xe2\x88\x9a") << "" << "√" << tr("square root")
<< QString::fromUtf8("\xe2\x84\x9c") << "" << "ℜ" << tr("black-letter capital R")
<< QString::fromUtf8("\xe2\x8b\x85") << "" << "⋅" << tr("dot operator")
<< QString::fromUtf8("\xcf\x82") << "" << "ς" << tr("Greek small letter final sigma")
<< QString::fromUtf8("\xe2\x88\xbc") << "" << "∼" << tr("tilde operator")
<< QString::fromUtf8("\xe2\x8a\x82") << "" << "⊂" << tr("subset of")
<< QString::fromUtf8("\xe2\x8a\x83") << "" << "⊃" << tr("superset of")
<< QString::fromUtf8("\xe2\x8a\x86") << "" << "⊆" << tr("subset of or equal to")
<< QString::fromUtf8("\xe2\x8a\x87") << "" << "⊇" << tr("superset of or equal to")
<< QString::fromUtf8("\xe2\x88\x91") << "" << "∑" << tr("n-ary summation")
<< QString::fromUtf8("\xc2\xb9") << "" << "¹" << tr("superscript one")
<< QString::fromUtf8("\xc2\xb2") << "" << "²" << tr("superscript two")
<< QString::fromUtf8("\xc2\xb3") << "" << "³" << tr("superscript three")
<< QString::fromUtf8("\xe2\x88\xb4") << "" << "∴" << tr("therefore sign")
<< QString::fromUtf8("\xcf\x91") << "" << "ϑ" << tr("Greek theta symbol")
<< QString::fromUtf8("\xcf\x92") << "" << "ϒ" << tr("Greek Upsilon with hook symbol")
<< QString::fromUtf8("\xe2\x84\x98") << "" << "℘" << tr("script capital P")
<< QString::fromUtf8("\xc2\xa5") << "" << "¥" << tr("yen sign")
;
AddGrid(spaces, spaces.count());
AddGrid(characters, 12);
AddGrid(characters2, 10);
AddGrid(characters3, 12);
}
void SelectCharacter::AddGrid(const QStringList &characters, int width)
{
QToolButton *button;
QFont font(m_SpecialCharacterAppearance.font_family, m_SpecialCharacterAppearance.font_size);
QGridLayout *grid = new QGridLayout();
grid->setHorizontalSpacing(0);
grid->setVerticalSpacing(0);
int col = 0;
int row = 0;
int i = 0;
while (i < characters.count()) {
const QString &insert_text = characters.at(i);
QString display_text = characters.at(i + 1);
if (display_text.isEmpty()) {
display_text = insert_text;
}
const QString &entity = characters.at(i + 2);
const QString &description = characters.at(i + 3);
i += 4;
if (!insert_text.isEmpty()) {
button = new QToolButton(this);
button->setAutoRaise(true);
button->setToolTip(entity + " " + description);
button->setText(display_text);
button->setFont(font);
connect(button, SIGNAL(clicked()), m_buttonMapper, SLOT(map()));
m_buttonMapper->setMapping(button, insert_text);
grid->addWidget(button, row, col);
}
col++;
if (col == width) {
col = 0;
row++;
}
}
ui.character_box->addLayout(grid);
}
QString SelectCharacter::Selection()
{
return m_SelectedText;
}
void SelectCharacter::SetSelectedCharacter(const QString &text)
{
bool isCtrl = QApplication::keyboardModifiers() & Qt::ControlModifier;
emit SelectedCharacter(text);
if (isCtrl) {
accept();
}
// Return focus to last window to allow typing to continue
parentWidget()->activateWindow();
}
void SelectCharacter::ReadSettings()
{
SettingsStore settings;
settings.beginGroup(SETTINGS_GROUP);
// The size of the window and it's full screen status
QByteArray geometry = settings.value("geometry").toByteArray();
if (!geometry.isNull()) {
restoreGeometry(geometry);
}
settings.endGroup();
// Load our initial appearance settings
m_SpecialCharacterAppearance = settings.specialCharacterAppearance();
}
void SelectCharacter::WriteSettings()
{
SettingsStore settings;
settings.beginGroup(SETTINGS_GROUP);
// The size of the window and it's full screen status
settings.setValue("geometry", saveGeometry());
settings.endGroup();
}
void SelectCharacter::connectSignalsSlots()
{
connect(m_buttonMapper, SIGNAL(mappedString(const QString &)), this, SLOT(SetSelectedCharacter(const QString &)));
}