introvoyz041
commited on
Migrated from GitHub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- data/.vscode/c_cpp_properties.json +26 -0
- data/.vscode/settings.json +84 -0
- data/LICENSE +674 -0
- data/backend/common.js +16 -0
- data/backend/download.js +101 -0
- data/backend/info.js +56 -0
- data/backend/list.js +109 -0
- data/backend/metadata.js +60 -0
- data/backend/package-lock.json +136 -0
- data/backend/package.json +16 -0
- data/backend/server.js +45 -0
- data/config.json +14 -0
- data/dist.sh +18 -0
- data/fonts/MaisonNeue-Bold.ttf +0 -0
- data/fonts/MaisonNeue-Demi.ttf +0 -0
- data/fonts/MaisonNeue-Medium.ttf +0 -0
- data/grayImage.h +71 -0
- data/main.cpp +44 -0
- data/qml.qrc +30 -0
- data/qml/BookPopup.qml +208 -0
- data/qml/DownloadPopup.qml +132 -0
- data/qml/Filter.qml +102 -0
- data/qml/FlatButton.qml +36 -0
- data/qml/Main.qml +462 -0
- data/qml/Query.qml +355 -0
- data/qml/book.png +3 -0
- data/qml/bookmark.png +3 -0
- data/qml/loading.png +3 -0
- data/qml/search.png +3 -0
- data/qml/searchblack.png +3 -0
- data/qml/title.svg +13 -0
- data/quickvirtualkeyboard/AUTHORS +1 -0
- data/quickvirtualkeyboard/ButtonItem.cpp +100 -0
- data/quickvirtualkeyboard/ButtonItem.h +81 -0
- data/quickvirtualkeyboard/COPYING +27 -0
- data/quickvirtualkeyboard/Dispatcher.cpp +69 -0
- data/quickvirtualkeyboard/Dispatcher.h +30 -0
- data/quickvirtualkeyboard/GridLayoutItem.cpp +275 -0
- data/quickvirtualkeyboard/GridLayoutItem.h +102 -0
- data/quickvirtualkeyboard/KeyboardItem.cpp +54 -0
- data/quickvirtualkeyboard/KeyboardItem.h +39 -0
- data/quickvirtualkeyboard/LayoutItem.cpp +32 -0
- data/quickvirtualkeyboard/LayoutItem.h +32 -0
- data/quickvirtualkeyboard/ModeItem.cpp +115 -0
- data/quickvirtualkeyboard/ModeItem.h +56 -0
- data/quickvirtualkeyboard/components.pri +15 -0
- data/quickvirtualkeyboard/png/backspaceblack.png +3 -0
- data/quickvirtualkeyboard/png/backspacewhite.png +3 -0
- data/quickvirtualkeyboard/png/shiftblack.png +3 -0
- data/quickvirtualkeyboard/png/shiftwhite.png +3 -0
data/.vscode/c_cpp_properties.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"configurations": [
|
3 |
+
{
|
4 |
+
"name": "Linux",
|
5 |
+
"includePath": [
|
6 |
+
"${workspaceFolder}/**",
|
7 |
+
"/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi/usr/include/**",
|
8 |
+
"/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi/usr/include/c++/7.3.0/**",
|
9 |
+
"/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi/usr/include/c++/7.3.0/backward/**",
|
10 |
+
"/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi/usr/include/c++/7.3.0/arm-oe-linux-gnueabi/**",
|
11 |
+
"/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi/usr/lib/gcc/arm-oe-linux-gnueabi/7.3.0/include/**",
|
12 |
+
"/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/lib/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/7.3.0/include/**",
|
13 |
+
"/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/lib/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/7.3.0/include-fixed/**"
|
14 |
+
],
|
15 |
+
"defines": [
|
16 |
+
"__ARM_PCS_VFP",
|
17 |
+
"_MIPS_SIM"
|
18 |
+
],
|
19 |
+
"compilerPath": "/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++",
|
20 |
+
"cStandard": "c11",
|
21 |
+
"cppStandard": "c++11",
|
22 |
+
"intelliSenseMode": "linux-gcc-arm64"
|
23 |
+
}
|
24 |
+
],
|
25 |
+
"version": 4
|
26 |
+
}
|
data/.vscode/settings.json
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"files.associations": {
|
3 |
+
"cstdlib": "cpp",
|
4 |
+
"sstream": "cpp",
|
5 |
+
"array": "cpp",
|
6 |
+
"atomic": "cpp",
|
7 |
+
"bit": "cpp",
|
8 |
+
"*.tcc": "cpp",
|
9 |
+
"cctype": "cpp",
|
10 |
+
"clocale": "cpp",
|
11 |
+
"cmath": "cpp",
|
12 |
+
"cstdarg": "cpp",
|
13 |
+
"cstddef": "cpp",
|
14 |
+
"cstdint": "cpp",
|
15 |
+
"cstdio": "cpp",
|
16 |
+
"cwchar": "cpp",
|
17 |
+
"cwctype": "cpp",
|
18 |
+
"deque": "cpp",
|
19 |
+
"unordered_map": "cpp",
|
20 |
+
"vector": "cpp",
|
21 |
+
"exception": "cpp",
|
22 |
+
"algorithm": "cpp",
|
23 |
+
"functional": "cpp",
|
24 |
+
"iterator": "cpp",
|
25 |
+
"memory": "cpp",
|
26 |
+
"memory_resource": "cpp",
|
27 |
+
"numeric": "cpp",
|
28 |
+
"optional": "cpp",
|
29 |
+
"random": "cpp",
|
30 |
+
"string": "cpp",
|
31 |
+
"string_view": "cpp",
|
32 |
+
"system_error": "cpp",
|
33 |
+
"tuple": "cpp",
|
34 |
+
"type_traits": "cpp",
|
35 |
+
"utility": "cpp",
|
36 |
+
"fstream": "cpp",
|
37 |
+
"initializer_list": "cpp",
|
38 |
+
"iosfwd": "cpp",
|
39 |
+
"iostream": "cpp",
|
40 |
+
"istream": "cpp",
|
41 |
+
"limits": "cpp",
|
42 |
+
"new": "cpp",
|
43 |
+
"ostream": "cpp",
|
44 |
+
"stdexcept": "cpp",
|
45 |
+
"streambuf": "cpp",
|
46 |
+
"typeinfo": "cpp",
|
47 |
+
"qtquick": "cpp",
|
48 |
+
"qtquickdepends": "cpp",
|
49 |
+
"qtcore": "cpp",
|
50 |
+
"qtcoredepends": "cpp",
|
51 |
+
"qguiapplication": "cpp",
|
52 |
+
"qdebug": "cpp",
|
53 |
+
"qjsonarray": "cpp",
|
54 |
+
"qjsonvalue": "cpp",
|
55 |
+
"hash_map": "cpp",
|
56 |
+
"hash_set": "cpp",
|
57 |
+
"unordered_set": "cpp",
|
58 |
+
"qtplugin": "cpp",
|
59 |
+
"qtgui": "cpp",
|
60 |
+
"qprocess": "cpp",
|
61 |
+
"list": "cpp",
|
62 |
+
"cassert": "cpp",
|
63 |
+
"cerrno": "cpp",
|
64 |
+
"cfloat": "cpp",
|
65 |
+
"chrono": "cpp",
|
66 |
+
"climits": "cpp",
|
67 |
+
"complex": "cpp",
|
68 |
+
"condition_variable": "cpp",
|
69 |
+
"cstring": "cpp",
|
70 |
+
"ctime": "cpp",
|
71 |
+
"map": "cpp",
|
72 |
+
"set": "cpp",
|
73 |
+
"ratio": "cpp",
|
74 |
+
"future": "cpp",
|
75 |
+
"iomanip": "cpp",
|
76 |
+
"ios": "cpp",
|
77 |
+
"locale": "cpp",
|
78 |
+
"mutex": "cpp",
|
79 |
+
"queue": "cpp",
|
80 |
+
"thread": "cpp",
|
81 |
+
"cinttypes": "cpp",
|
82 |
+
"variant": "cpp"
|
83 |
+
}
|
84 |
+
}
|
data/LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<https://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
data/backend/common.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const config = JSON.parse(require("fs").readFileSync(__dirname + "/../config.json"));
|
2 |
+
|
3 |
+
module.exports.fetchOptions = {
|
4 |
+
headers: {
|
5 |
+
"Upgrade-Insecure-Requests": "1",
|
6 |
+
"Sec-GPC": "1",
|
7 |
+
"Cookie": config.cookie,
|
8 |
+
},
|
9 |
+
method: "GET",
|
10 |
+
compress: true,
|
11 |
+
redirect: "follow",
|
12 |
+
};
|
13 |
+
|
14 |
+
module.exports.domain = config.domain;
|
15 |
+
module.exports.listURL = config.listURL;
|
16 |
+
module.exports.additionalBookLocation = config.additionalBookLocation;
|
data/backend/download.js
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const { writeFileSync, copyFileSync, existsSync, mkdirSync, createWriteStream, constants } = require("fs");
|
2 |
+
const { join: pathJoin, extname, basename } = require("path");
|
3 |
+
const { v4 } = require("uuid");
|
4 |
+
const { domain, fetchOptions, additionalBookLocation } = require("./common");
|
5 |
+
const fetch = require("node-fetch");
|
6 |
+
|
7 |
+
module.exports = function (args, socket) {
|
8 |
+
if (args.length < 1) {
|
9 |
+
socket.write("ERR: No download link\n");
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
|
13 |
+
const xochitlFolder = "/home/root/.local/share/remarkable/xochitl/";
|
14 |
+
const downloadURL = domain + args[0];
|
15 |
+
console.log(downloadURL);
|
16 |
+
|
17 |
+
fetch(downloadURL, fetchOptions).then((response) => {
|
18 |
+
console.log("Redirected to:", response.url);
|
19 |
+
|
20 |
+
let fileName;
|
21 |
+
let fileExt;
|
22 |
+
|
23 |
+
const disposition = response.headers.get('content-disposition');
|
24 |
+
if (disposition) {
|
25 |
+
const nameMatch = disposition.match(/filename="(.+)"/);
|
26 |
+
if (nameMatch) {
|
27 |
+
let name = nameMatch[1].replace(" (z-lib.org)", "");
|
28 |
+
// Convert multi-byte chars to their true representation
|
29 |
+
name = Buffer.from(name, "binary").toString("utf8");
|
30 |
+
|
31 |
+
fileExt = extname(name);
|
32 |
+
fileName = basename(name, fileExt);
|
33 |
+
console.log(fileName, fileExt);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
if (!fileName || !fileExt) {
|
38 |
+
socket.write("ERR: 2 No file\n");
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
|
42 |
+
const fileLength = parseInt(response.headers.get('content-length'));
|
43 |
+
|
44 |
+
const uuid = v4();
|
45 |
+
const tempFilePath = "/tmp/" + uuid;
|
46 |
+
console.log(tempFilePath, fileLength);
|
47 |
+
|
48 |
+
const fileStream = createWriteStream(tempFilePath);
|
49 |
+
|
50 |
+
response.body.on("data", (chunk) => {
|
51 |
+
fileStream.write(chunk, () => {
|
52 |
+
socket.write("PROG:" + Math.floor(fileStream.bytesWritten / fileLength * 95).toString() + "\n");
|
53 |
+
if (fileStream.bytesWritten == fileLength) {
|
54 |
+
fileStream.close();
|
55 |
+
}
|
56 |
+
});
|
57 |
+
});
|
58 |
+
|
59 |
+
response.body.on("error", (error) => {
|
60 |
+
socket.write("ERR: 2 " + error + "\n");
|
61 |
+
socket.end();
|
62 |
+
});
|
63 |
+
|
64 |
+
fileStream.on('close', () => {
|
65 |
+
socket.write("DOWNLOAD DONE\n");
|
66 |
+
|
67 |
+
if (fileExt == ".epub" || fileExt == ".pdf") {
|
68 |
+
writeFileSync(xochitlFolder + uuid + ".metadata", JSON.stringify({
|
69 |
+
"deleted": false,
|
70 |
+
"lastModified": "1",
|
71 |
+
"lastOpenedPage": 0,
|
72 |
+
"metadatamodified": false,
|
73 |
+
"modified": false,
|
74 |
+
"parent": "",
|
75 |
+
"pinned": false,
|
76 |
+
"synced": false,
|
77 |
+
"type": "DocumentType",
|
78 |
+
"version": 1,
|
79 |
+
"visibleName": fileName
|
80 |
+
}));
|
81 |
+
|
82 |
+
copyFileSync(tempFilePath, pathJoin(xochitlFolder, uuid + fileExt), constants.COPYFILE_FICLONE);
|
83 |
+
socket.write("COPIED XOCHITL\n");
|
84 |
+
}
|
85 |
+
|
86 |
+
if (additionalBookLocation) {
|
87 |
+
if (!existsSync(additionalBookLocation)) {
|
88 |
+
mkdirSync(additionalBookLocation, { recursive: true });
|
89 |
+
}
|
90 |
+
copyFileSync(tempFilePath, pathJoin(additionalBookLocation, fileName + fileExt), constants.COPYFILE_FICLONE);
|
91 |
+
socket.write("COPIED LOCAL\n");
|
92 |
+
}
|
93 |
+
socket.write("PROG:100\n");
|
94 |
+
socket.end();
|
95 |
+
});
|
96 |
+
})
|
97 |
+
.catch(err => {
|
98 |
+
socket.write("ERR: 1 " + err + "\n");
|
99 |
+
socket.end();
|
100 |
+
});
|
101 |
+
}
|
data/backend/info.js
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const cheerio = require("cheerio");
|
2 |
+
const { domain, fetchOptions } = require("./common");
|
3 |
+
const fetch = require("node-fetch");
|
4 |
+
|
5 |
+
module.exports = function (args, socket) {
|
6 |
+
const profile = fetch(domain + "/papi/user/dstats", fetchOptions).then(res => res.json()).then(json => {
|
7 |
+
if (!json) return;
|
8 |
+
|
9 |
+
return ({
|
10 |
+
today_download: json.dailyDownloads + "/" + json.dailyDownloadsLimit
|
11 |
+
});
|
12 |
+
})
|
13 |
+
.catch(err => {
|
14 |
+
socket.write("ERR: 1 " + err + "\n");
|
15 |
+
socket.end();
|
16 |
+
});
|
17 |
+
|
18 |
+
const history = fetch(domain + "/users/dstats.php?today", fetchOptions).then(res => res.text()).then(html => {
|
19 |
+
const $ = cheerio.load(html);
|
20 |
+
const rows = $(".dstats-row");
|
21 |
+
if (!rows.length) return;
|
22 |
+
|
23 |
+
return rows.get().map(row => {
|
24 |
+
const a = $(row).find("a");
|
25 |
+
if (!a) return undefined;
|
26 |
+
|
27 |
+
let url = a.attr("href");
|
28 |
+
let name = a.text().trim();
|
29 |
+
if (!url || !name) return undefined;
|
30 |
+
|
31 |
+
if (url[0] !== "/") url = "/" + url;
|
32 |
+
|
33 |
+
return ({ url, name });
|
34 |
+
})
|
35 |
+
.filter(a => a);
|
36 |
+
})
|
37 |
+
.catch(err => {
|
38 |
+
socket.write("ERR: 1 " + err + "\n");
|
39 |
+
socket.end();
|
40 |
+
});
|
41 |
+
|
42 |
+
Promise.all([profile, history]).then(results => {
|
43 |
+
if (!results || results.length < 2) return;
|
44 |
+
|
45 |
+
const final = results[0];
|
46 |
+
final.today_list = results[1];
|
47 |
+
socket.write(JSON.stringify(final));
|
48 |
+
socket.write("\n");
|
49 |
+
socket.end();
|
50 |
+
})
|
51 |
+
.catch(err => {
|
52 |
+
socket.write("ERR: 1 " + err + "\n");
|
53 |
+
socket.end();
|
54 |
+
})
|
55 |
+
|
56 |
+
}
|
data/backend/list.js
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
const cheerio = require("cheerio");
|
3 |
+
const { domain, fetchOptions } = require("./common");
|
4 |
+
const fetch = require("node-fetch");
|
5 |
+
|
6 |
+
module.exports.getList = function (args, socket) {
|
7 |
+
let [isExact, fromYear, toYear, lang, ext, order, query, page] = args;
|
8 |
+
|
9 |
+
let listURL = [domain + "/s/?"];
|
10 |
+
if (isExact && isExact === "1") listURL.push("e=1");
|
11 |
+
if (fromYear && fromYear !== "Any") listURL.push("yearFrom=" + fromYear);
|
12 |
+
if (toYear && toYear !== "Any") listURL.push("yearTo=" + toYear);
|
13 |
+
if (lang && lang !== "Any") listURL.push("language=" + lang);
|
14 |
+
if (ext && ext !== "Any") listURL.push("extensiont=" + ext);
|
15 |
+
|
16 |
+
if (order) {
|
17 |
+
order = ({
|
18 |
+
"Best Match": "bestmatch",
|
19 |
+
"By Title (A-Z)": "titleA",
|
20 |
+
"By Title (Z-A)": "title",
|
21 |
+
"By Year": "year",
|
22 |
+
"File Size Asc.": "filesizeA",
|
23 |
+
"File Size Des.": "filesize",
|
24 |
+
"Most Popular": "popular",
|
25 |
+
"Recently added": "date",
|
26 |
+
})[order];
|
27 |
+
|
28 |
+
if (!order) order = "popular";
|
29 |
+
listURL.push("order=" + order);
|
30 |
+
}
|
31 |
+
|
32 |
+
if (query) listURL.push("q=" + encodeURI(query));
|
33 |
+
|
34 |
+
if (listURL.length < 2) {
|
35 |
+
// socket.write("[]");
|
36 |
+
socket.write("ERR: Not enough query parameter\n");
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
if (page) listURL.push("page=" + page);
|
41 |
+
|
42 |
+
listURL = listURL.join("&");
|
43 |
+
fetchList(listURL, socket);
|
44 |
+
}
|
45 |
+
|
46 |
+
module.exports.getSaved = function(_, socket) {
|
47 |
+
fetchList(domain + "/users/saved_books.php", socket);
|
48 |
+
}
|
49 |
+
|
50 |
+
function fetchList(listURL, socket) {
|
51 |
+
fetch(listURL, fetchOptions).then(res => {
|
52 |
+
const fileLength = parseInt(res.headers.get('content-length'));
|
53 |
+
|
54 |
+
let raw = "";
|
55 |
+
|
56 |
+
res.body.on("data", (chunk) => {
|
57 |
+
raw += chunk;
|
58 |
+
socket.write("PROG:" + Math.round(res.body.bytesWritten / fileLength * 100).toString() + "\n");
|
59 |
+
});
|
60 |
+
|
61 |
+
res.body.on('end', () => {
|
62 |
+
socket.write("PROG:100\n");
|
63 |
+
sendResult(raw);
|
64 |
+
});
|
65 |
+
|
66 |
+
res.body.on("error", (err) => {
|
67 |
+
socket.write("ERR: 2 " + err + "\n");
|
68 |
+
socket.end();
|
69 |
+
});
|
70 |
+
})
|
71 |
+
.catch(err => {
|
72 |
+
socket.write("ERR: 1 " + err + "\n");
|
73 |
+
socket.end();
|
74 |
+
});
|
75 |
+
|
76 |
+
function sendResult(html) {
|
77 |
+
const $ = cheerio.load(html);
|
78 |
+
|
79 |
+
let totalItems = $(".totalCounter")
|
80 |
+
if (totalItems) {
|
81 |
+
totalItems = parseInt(totalItems.text().replace(/[()+]/g, ""));
|
82 |
+
socket.write("TOTAL:" + totalItems.toString() + "\n");
|
83 |
+
}
|
84 |
+
|
85 |
+
const books = $(".resItemBoxBooks").get().map(ele => {
|
86 |
+
const image = $(ele).find('img');
|
87 |
+
let imageUrl;
|
88 |
+
let imgSources = image.attr('data-srcset');
|
89 |
+
if (imgSources) {
|
90 |
+
imgSources = imgSources.split(", ");
|
91 |
+
imageUrl = imgSources[imgSources.length - 1]
|
92 |
+
.split(" ")[0];
|
93 |
+
} else {
|
94 |
+
imageUrl = image.attr('data-src');
|
95 |
+
}
|
96 |
+
if (!imageUrl || imageUrl[0] === "/") imageUrl = "";
|
97 |
+
|
98 |
+
return {
|
99 |
+
url: $(ele).find('h3 a').attr('href'),
|
100 |
+
img: imageUrl,
|
101 |
+
name: $(ele).find('h3').text().trim(),
|
102 |
+
author: $(ele).find('div.authors').text().trim(),
|
103 |
+
}
|
104 |
+
});
|
105 |
+
socket.write(JSON.stringify(books));
|
106 |
+
socket.write("\n");
|
107 |
+
socket.end();
|
108 |
+
}
|
109 |
+
}
|
data/backend/metadata.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const cheerio = require("cheerio");
|
2 |
+
const { domain, fetchOptions } = require("./common");
|
3 |
+
const fetch = require("node-fetch");
|
4 |
+
|
5 |
+
module.exports = function (args, socket) {
|
6 |
+
if (args.length < 1) {
|
7 |
+
console.log("ERR: No link");
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
|
11 |
+
fetch(domain + args[0], fetchOptions).then(a => a.text()).then(html => {
|
12 |
+
const $ = cheerio.load(html);
|
13 |
+
|
14 |
+
const author = $(`[itemprop="author"]`)
|
15 |
+
.toArray()
|
16 |
+
.map(e => $(e).text().trim())
|
17 |
+
.join(", ");
|
18 |
+
|
19 |
+
let description = $("#bookDescriptionBox").html();
|
20 |
+
|
21 |
+
let detail = $(".bookDetailsBox");
|
22 |
+
if (detail) {
|
23 |
+
detail = $(detail[0]).find(".bookProperty")
|
24 |
+
.toArray()
|
25 |
+
.map(e => `<b>${$(e).find(".property_label").text().trim()}</b> ${$(e).find(".property_value").text().trim()}`)
|
26 |
+
.join(" | ");
|
27 |
+
}
|
28 |
+
|
29 |
+
if (description) {
|
30 |
+
description = detail + "<hr>" + description.trim();
|
31 |
+
} else {
|
32 |
+
description = detail;
|
33 |
+
}
|
34 |
+
|
35 |
+
let dlUrl = $(".dlButton").attr("href");
|
36 |
+
if (dlUrl === "#") {
|
37 |
+
dlUrl = "";
|
38 |
+
}
|
39 |
+
|
40 |
+
const similars = $("#bMosaicBox .brick").get().map(a => ({
|
41 |
+
url: $(a).find("a").attr("href"),
|
42 |
+
img: $(a).find("img").attr("src"),
|
43 |
+
}));
|
44 |
+
|
45 |
+
socket.write(JSON.stringify({
|
46 |
+
name: $("h1").text().trim(),
|
47 |
+
author,
|
48 |
+
img: $(".details-book-cover").attr("href"),
|
49 |
+
description,
|
50 |
+
dlUrl,
|
51 |
+
similars,
|
52 |
+
}));
|
53 |
+
socket.write("\n");
|
54 |
+
socket.end();
|
55 |
+
})
|
56 |
+
.catch(err => {
|
57 |
+
socket.write("ERR: 1 " + err + "\n");
|
58 |
+
socket.end();
|
59 |
+
});
|
60 |
+
}
|
data/backend/package-lock.json
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "zshelf-backend",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"lockfileVersion": 1,
|
5 |
+
"requires": true,
|
6 |
+
"dependencies": {
|
7 |
+
"boolbase": {
|
8 |
+
"version": "1.0.0",
|
9 |
+
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
10 |
+
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
|
11 |
+
},
|
12 |
+
"cheerio": {
|
13 |
+
"version": "1.0.0-rc.5",
|
14 |
+
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.5.tgz",
|
15 |
+
"integrity": "sha512-yoqps/VCaZgN4pfXtenwHROTp8NG6/Hlt4Jpz2FEP0ZJQ+ZUkVDd0hAPDNKhj3nakpfPt/CNs57yEtxD1bXQiw==",
|
16 |
+
"requires": {
|
17 |
+
"cheerio-select-tmp": "^0.1.0",
|
18 |
+
"dom-serializer": "~1.2.0",
|
19 |
+
"domhandler": "^4.0.0",
|
20 |
+
"entities": "~2.1.0",
|
21 |
+
"htmlparser2": "^6.0.0",
|
22 |
+
"parse5": "^6.0.0",
|
23 |
+
"parse5-htmlparser2-tree-adapter": "^6.0.0"
|
24 |
+
}
|
25 |
+
},
|
26 |
+
"cheerio-select-tmp": {
|
27 |
+
"version": "0.1.1",
|
28 |
+
"resolved": "https://registry.npmjs.org/cheerio-select-tmp/-/cheerio-select-tmp-0.1.1.tgz",
|
29 |
+
"integrity": "sha512-YYs5JvbpU19VYJyj+F7oYrIE2BOll1/hRU7rEy/5+v9BzkSo3bK81iAeeQEMI92vRIxz677m72UmJUiVwwgjfQ==",
|
30 |
+
"requires": {
|
31 |
+
"css-select": "^3.1.2",
|
32 |
+
"css-what": "^4.0.0",
|
33 |
+
"domelementtype": "^2.1.0",
|
34 |
+
"domhandler": "^4.0.0",
|
35 |
+
"domutils": "^2.4.4"
|
36 |
+
}
|
37 |
+
},
|
38 |
+
"css-select": {
|
39 |
+
"version": "3.1.2",
|
40 |
+
"resolved": "https://registry.npmjs.org/css-select/-/css-select-3.1.2.tgz",
|
41 |
+
"integrity": "sha512-qmss1EihSuBNWNNhHjxzxSfJoFBM/lERB/Q4EnsJQQC62R2evJDW481091oAdOr9uh46/0n4nrg0It5cAnj1RA==",
|
42 |
+
"requires": {
|
43 |
+
"boolbase": "^1.0.0",
|
44 |
+
"css-what": "^4.0.0",
|
45 |
+
"domhandler": "^4.0.0",
|
46 |
+
"domutils": "^2.4.3",
|
47 |
+
"nth-check": "^2.0.0"
|
48 |
+
}
|
49 |
+
},
|
50 |
+
"css-what": {
|
51 |
+
"version": "4.0.0",
|
52 |
+
"resolved": "https://registry.npmjs.org/css-what/-/css-what-4.0.0.tgz",
|
53 |
+
"integrity": "sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A=="
|
54 |
+
},
|
55 |
+
"dom-serializer": {
|
56 |
+
"version": "1.2.0",
|
57 |
+
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz",
|
58 |
+
"integrity": "sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==",
|
59 |
+
"requires": {
|
60 |
+
"domelementtype": "^2.0.1",
|
61 |
+
"domhandler": "^4.0.0",
|
62 |
+
"entities": "^2.0.0"
|
63 |
+
}
|
64 |
+
},
|
65 |
+
"domelementtype": {
|
66 |
+
"version": "2.1.0",
|
67 |
+
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz",
|
68 |
+
"integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w=="
|
69 |
+
},
|
70 |
+
"domhandler": {
|
71 |
+
"version": "4.0.0",
|
72 |
+
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz",
|
73 |
+
"integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==",
|
74 |
+
"requires": {
|
75 |
+
"domelementtype": "^2.1.0"
|
76 |
+
}
|
77 |
+
},
|
78 |
+
"domutils": {
|
79 |
+
"version": "2.4.4",
|
80 |
+
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.4.4.tgz",
|
81 |
+
"integrity": "sha512-jBC0vOsECI4OMdD0GC9mGn7NXPLb+Qt6KW1YDQzeQYRUFKmNG8lh7mO5HiELfr+lLQE7loDVI4QcAxV80HS+RA==",
|
82 |
+
"requires": {
|
83 |
+
"dom-serializer": "^1.0.1",
|
84 |
+
"domelementtype": "^2.0.1",
|
85 |
+
"domhandler": "^4.0.0"
|
86 |
+
}
|
87 |
+
},
|
88 |
+
"entities": {
|
89 |
+
"version": "2.1.0",
|
90 |
+
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
|
91 |
+
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
|
92 |
+
},
|
93 |
+
"htmlparser2": {
|
94 |
+
"version": "6.0.0",
|
95 |
+
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.0.0.tgz",
|
96 |
+
"integrity": "sha512-numTQtDZMoh78zJpaNdJ9MXb2cv5G3jwUoe3dMQODubZvLoGvTE/Ofp6sHvH8OGKcN/8A47pGLi/k58xHP/Tfw==",
|
97 |
+
"requires": {
|
98 |
+
"domelementtype": "^2.0.1",
|
99 |
+
"domhandler": "^4.0.0",
|
100 |
+
"domutils": "^2.4.4",
|
101 |
+
"entities": "^2.0.0"
|
102 |
+
}
|
103 |
+
},
|
104 |
+
"node-fetch": {
|
105 |
+
"version": "2.6.1",
|
106 |
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
107 |
+
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
108 |
+
},
|
109 |
+
"nth-check": {
|
110 |
+
"version": "2.0.0",
|
111 |
+
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz",
|
112 |
+
"integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==",
|
113 |
+
"requires": {
|
114 |
+
"boolbase": "^1.0.0"
|
115 |
+
}
|
116 |
+
},
|
117 |
+
"parse5": {
|
118 |
+
"version": "6.0.1",
|
119 |
+
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
|
120 |
+
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
|
121 |
+
},
|
122 |
+
"parse5-htmlparser2-tree-adapter": {
|
123 |
+
"version": "6.0.1",
|
124 |
+
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",
|
125 |
+
"integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",
|
126 |
+
"requires": {
|
127 |
+
"parse5": "^6.0.1"
|
128 |
+
}
|
129 |
+
},
|
130 |
+
"uuid": {
|
131 |
+
"version": "8.3.2",
|
132 |
+
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
133 |
+
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
data/backend/package.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "zshelf-backend",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"description": "",
|
5 |
+
"main": "index.js",
|
6 |
+
"scripts": {
|
7 |
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8 |
+
},
|
9 |
+
"author": "khanhas",
|
10 |
+
"license": "MIT",
|
11 |
+
"dependencies": {
|
12 |
+
"cheerio": "^1.0.0-rc.5",
|
13 |
+
"node-fetch": "^2.6.1",
|
14 |
+
"uuid": "^8.3.2"
|
15 |
+
}
|
16 |
+
}
|
data/backend/server.js
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const { execSync } = require("child_process");
|
2 |
+
const net = require("net");
|
3 |
+
const { getList, getSaved } = require("./list");
|
4 |
+
const getInfo = require("./info");
|
5 |
+
const getMeta = require("./metadata");
|
6 |
+
const download = require("./download");
|
7 |
+
|
8 |
+
const socketLocation = "/tmp/zshelf_socket";
|
9 |
+
execSync("rm -f " + socketLocation);
|
10 |
+
|
11 |
+
const server = net.createServer();
|
12 |
+
server.listen(socketLocation, () => {
|
13 |
+
console.log('[SERVER] Ready');
|
14 |
+
|
15 |
+
setInterval(() => {
|
16 |
+
// Exit when zshelf dies
|
17 |
+
try { execSync("pidof zshelf"); }
|
18 |
+
catch { process.exit(0); }
|
19 |
+
}, 10000);
|
20 |
+
});
|
21 |
+
|
22 |
+
server.on("connection", (client) => {
|
23 |
+
console.log('[SERVER] New client');
|
24 |
+
client.on("data", (data) => {
|
25 |
+
try {
|
26 |
+
console.log(data.toString());
|
27 |
+
const raw = data.toString().split("\n");
|
28 |
+
const cmd = raw[0];
|
29 |
+
const arg = raw.splice(1);
|
30 |
+
switch (cmd) {
|
31 |
+
case "LIST": getList(arg, client); break;
|
32 |
+
case "INFO": getInfo(arg, client); break;
|
33 |
+
case "META": getMeta(arg, client); break;
|
34 |
+
case "DOWN": download(arg, client); break;
|
35 |
+
case "SAVE": getSaved(arg, client); break;
|
36 |
+
}
|
37 |
+
} catch (err) {
|
38 |
+
client.write("ERR: 0 " + err + "\n");
|
39 |
+
client.end();
|
40 |
+
}
|
41 |
+
});
|
42 |
+
});
|
43 |
+
|
44 |
+
server.on("error", (err) => console.log("ERR: " + err));
|
45 |
+
server.on("close", () => process.exit(0));
|
data/config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"domain": "https://b-ok.global",
|
3 |
+
"cookie": "",
|
4 |
+
"additionalBookLocation": "/home/root/Books/",
|
5 |
+
"defaultQuery": {
|
6 |
+
"exactMatch": "0",
|
7 |
+
"fromYear": "2020",
|
8 |
+
"toYear": "2021",
|
9 |
+
"language": "English",
|
10 |
+
"extension": "epub",
|
11 |
+
"order": "Most Popular",
|
12 |
+
"query": ""
|
13 |
+
}
|
14 |
+
}
|
data/dist.sh
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ver=${1:?Must provide version string}
|
2 |
+
|
3 |
+
make -j8
|
4 |
+
|
5 |
+
if test -d dist; then
|
6 |
+
rm -r dist
|
7 |
+
fi
|
8 |
+
|
9 |
+
mkdir dist
|
10 |
+
mkdir dist/zshelf
|
11 |
+
|
12 |
+
cp -r backend dist/zshelf
|
13 |
+
cp zshelf dist/zshelf
|
14 |
+
cp config.json dist/zshelf
|
15 |
+
cp README.md dist/zshelf
|
16 |
+
|
17 |
+
cd dist
|
18 |
+
zip -r "zshelf-reMarkable-${ver}.zip" ./zshelf/
|
data/fonts/MaisonNeue-Bold.ttf
ADDED
Binary file (62.6 kB). View file
|
|
data/fonts/MaisonNeue-Demi.ttf
ADDED
Binary file (62.4 kB). View file
|
|
data/fonts/MaisonNeue-Medium.ttf
ADDED
Binary file (62.7 kB). View file
|
|
data/grayImage.h
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef GRAYIMAGE_H
|
2 |
+
#define GRAYIMAGE_H
|
3 |
+
|
4 |
+
#include <QQuickImageProvider>
|
5 |
+
#include <QNetworkAccessManager>
|
6 |
+
#include <QNetworkRequest>
|
7 |
+
#include <QNetworkReply>
|
8 |
+
#include <QPainter>
|
9 |
+
|
10 |
+
class AsyncImageResponse : public QQuickImageResponse
|
11 |
+
{
|
12 |
+
public:
|
13 |
+
AsyncImageResponse(const QString &id, const QSize &requestedSize)
|
14 |
+
: m_id(id), m_requestedSize(requestedSize)
|
15 |
+
{
|
16 |
+
connect(&netManager, &QNetworkAccessManager::finished, this, [this](QNetworkReply *rep) {
|
17 |
+
rep->deleteLater();
|
18 |
+
if (rep->error() != QNetworkReply::NoError)
|
19 |
+
{
|
20 |
+
qDebug() << "[NET] ERR: " << rep->errorString();
|
21 |
+
emit finished();
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
QByteArray bytes = rep->readAll();
|
26 |
+
QImage img = QImage::fromData(bytes).convertToFormat(QImage::Format_Grayscale8);
|
27 |
+
|
28 |
+
_img = QImage(img.size(), QImage::Format_ARGB32);
|
29 |
+
_img.fill(Qt::transparent);
|
30 |
+
QPainter p(&_img);
|
31 |
+
p.setBrush(QBrush(img));
|
32 |
+
p.setPen(Qt::NoPen);
|
33 |
+
qreal radius = 8.0;
|
34 |
+
if (img.width() > 200) {
|
35 |
+
p.setRenderHint(QPainter::Antialiasing, true);
|
36 |
+
radius = 16.0;
|
37 |
+
}
|
38 |
+
p.drawRoundedRect(1, 1, img.width() - 2, img.height() - 2, radius, radius);
|
39 |
+
p.end();
|
40 |
+
|
41 |
+
emit finished();
|
42 |
+
});
|
43 |
+
|
44 |
+
netManager.get(QNetworkRequest(m_id));
|
45 |
+
}
|
46 |
+
|
47 |
+
QQuickTextureFactory *textureFactory() const
|
48 |
+
{
|
49 |
+
return QQuickTextureFactory::textureFactoryForImage(_img);
|
50 |
+
}
|
51 |
+
|
52 |
+
private:
|
53 |
+
QImage _img;
|
54 |
+
QString m_id;
|
55 |
+
QSize m_requestedSize;
|
56 |
+
QNetworkAccessManager netManager;
|
57 |
+
};
|
58 |
+
|
59 |
+
class GrayImageProvider : public QQuickAsyncImageProvider
|
60 |
+
{
|
61 |
+
public:
|
62 |
+
GrayImageProvider() {}
|
63 |
+
|
64 |
+
QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override
|
65 |
+
{
|
66 |
+
AsyncImageResponse *response = new AsyncImageResponse(id, requestedSize);
|
67 |
+
return response;
|
68 |
+
}
|
69 |
+
};
|
70 |
+
|
71 |
+
#endif /* GRAYIMAGE_H */
|
data/main.cpp
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <QtQuick>
|
2 |
+
#include <QtGui>
|
3 |
+
#include <QtPlugin>
|
4 |
+
#include "store.h"
|
5 |
+
#include "quickvirtualkeyboard/register.h"
|
6 |
+
#include "grayImage.h"
|
7 |
+
|
8 |
+
Q_IMPORT_PLUGIN(QsgEpaperPlugin)
|
9 |
+
|
10 |
+
int main(int argc, char *argv[])
|
11 |
+
{
|
12 |
+
qputenv("QMLSCENE_DEVICE", "epaper");
|
13 |
+
qputenv("QT_QPA_PLATFORM", "epaper:enable_fonts");
|
14 |
+
qputenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS", "rotate=180");
|
15 |
+
|
16 |
+
QGuiApplication app(argc, argv);
|
17 |
+
|
18 |
+
Store view;
|
19 |
+
qmlRegisterType<Store>();
|
20 |
+
|
21 |
+
auto context = view.rootContext();
|
22 |
+
context->setContextProperty("screenGeometry", app.primaryScreen()->geometry());
|
23 |
+
context->setContextProperty("store", &view);
|
24 |
+
context->setContextProperty("storeProg", QVariant(0));
|
25 |
+
context->setContextProperty("storeError", QVariant(""));
|
26 |
+
context->setContextProperty("titleVisible", QVariant(true));
|
27 |
+
|
28 |
+
QFontDatabase::addApplicationFont(":/fonts/MaisonNeue-Bold");
|
29 |
+
QFontDatabase::addApplicationFont(":/fonts/MaisonNeue-Demi");
|
30 |
+
QFontDatabase::addApplicationFont(":/fonts/MaisonNeue-Medium");
|
31 |
+
|
32 |
+
view.engine()->addImportPath(QStringLiteral(DEPLOYMENT_PATH));
|
33 |
+
view.engine()->addImageProvider(QLatin1String("gray"), new GrayImageProvider);
|
34 |
+
registerQmlTypes();
|
35 |
+
view.setSource(QUrl(QStringLiteral("qrc:/Main.qml")));
|
36 |
+
|
37 |
+
QObject::connect(view.engine(), &QQmlEngine::quit, &QGuiApplication::quit);
|
38 |
+
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&view]() { delete &view; });
|
39 |
+
|
40 |
+
view.show();
|
41 |
+
view.open();
|
42 |
+
|
43 |
+
return app.exec();
|
44 |
+
}
|
data/qml.qrc
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<RCC>
|
2 |
+
<qresource prefix="/">
|
3 |
+
<file alias="Main.qml">qml/Main.qml</file>
|
4 |
+
<file alias="BookPopup.qml">qml/BookPopup.qml</file>
|
5 |
+
<file alias="Query.qml">qml/Query.qml</file>
|
6 |
+
<file alias="Filter.qml">qml/Filter.qml</file>
|
7 |
+
<file alias="FlatButton.qml">qml/FlatButton.qml</file>
|
8 |
+
<file alias="DownloadPopup.qml">qml/DownloadPopup.qml</file>
|
9 |
+
<file alias="png/loading">qml/loading.png</file>
|
10 |
+
<file alias="png/search">qml/search.png</file>
|
11 |
+
<file alias="png/searchblack">qml/searchblack.png</file>
|
12 |
+
<file alias="png/book">qml/book.png</file>
|
13 |
+
<file alias="png/bookmark">qml/bookmark.png</file>
|
14 |
+
<file alias="svg/title">qml/title.svg</file>
|
15 |
+
<file alias="fonts/MaisonNeue-Bold">fonts/MaisonNeue-Bold.ttf</file>
|
16 |
+
<file alias="fonts/MaisonNeue-Demi">fonts/MaisonNeue-Demi.ttf</file>
|
17 |
+
<file alias="fonts/MaisonNeue-Medium">fonts/MaisonNeue-Medium.ttf</file>
|
18 |
+
|
19 |
+
<file alias="Btn.qml">quickvirtualkeyboard/qml/Btn.qml</file>
|
20 |
+
<file alias="BtnPreview.qml">quickvirtualkeyboard/qml/BtnPreview.qml</file>
|
21 |
+
<file alias="modes/Standard.qml">quickvirtualkeyboard/qml/modes/Standard.qml</file>
|
22 |
+
<file alias="modes/Symbols.qml">quickvirtualkeyboard/qml/modes/Symbols.qml</file>
|
23 |
+
<file alias="modes/Symbols2.qml">quickvirtualkeyboard/qml/modes/Symbols2.qml</file>
|
24 |
+
|
25 |
+
<file alias="png/shiftblack">quickvirtualkeyboard/png/shiftblack.png</file>
|
26 |
+
<file alias="png/shiftwhite">quickvirtualkeyboard/png/shiftwhite.png</file>
|
27 |
+
<file alias="png/backspaceblack">quickvirtualkeyboard/png/backspaceblack.png</file>
|
28 |
+
<file alias="png/backspacewhite">quickvirtualkeyboard/png/backspacewhite.png</file>
|
29 |
+
</qresource>
|
30 |
+
</RCC>
|
data/qml/BookPopup.qml
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import QtQuick 2.11
|
2 |
+
import QtQuick.Controls 2.4
|
3 |
+
import QtQuick.Layouts 1.11
|
4 |
+
|
5 |
+
Popup {
|
6 |
+
property var model;
|
7 |
+
property bool isBusy;
|
8 |
+
|
9 |
+
id: bookPopup
|
10 |
+
|
11 |
+
width: 1000
|
12 |
+
height: 1300
|
13 |
+
x: (parent.width / 2) - (width / 2)
|
14 |
+
y: (parent.height / 2) - (height / 2) + 150
|
15 |
+
closePolicy: Popup.CloseOnPressOutside
|
16 |
+
dim: true
|
17 |
+
padding: 40
|
18 |
+
|
19 |
+
Overlay.modeless: Rectangle {
|
20 |
+
color: "#90ffffff"
|
21 |
+
MouseArea {
|
22 |
+
anchors.fill: parent
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
background: Rectangle {
|
27 |
+
border.width: 2
|
28 |
+
border.color: "black"
|
29 |
+
radius: 5
|
30 |
+
}
|
31 |
+
|
32 |
+
onOpened: bar.currentIndex = 0;
|
33 |
+
|
34 |
+
contentChildren: [
|
35 |
+
Image {
|
36 |
+
id: bookImage
|
37 |
+
fillMode: Image.PreserveAspectFit
|
38 |
+
smooth: true
|
39 |
+
source: model ? model.imgFile : ""
|
40 |
+
width: 400
|
41 |
+
height: 400 * 1.5
|
42 |
+
anchors.horizontalCenter: parent.horizontalCenter
|
43 |
+
y: -(parent.height / 2 - height / 2)
|
44 |
+
ProgressBar {
|
45 |
+
visible: parent.progress < 1.0
|
46 |
+
value: parent.progress
|
47 |
+
anchors {
|
48 |
+
horizontalCenter: parent.horizontalCenter
|
49 |
+
bottom: parent.bottom
|
50 |
+
bottomMargin: 80
|
51 |
+
}
|
52 |
+
}
|
53 |
+
},
|
54 |
+
Text {
|
55 |
+
id: bookName
|
56 |
+
text: model ? model.name : ""
|
57 |
+
anchors {
|
58 |
+
left: parent.left; right: parent.right
|
59 |
+
top: bookImage.bottom
|
60 |
+
topMargin: 30
|
61 |
+
}
|
62 |
+
font.family:"Maison Neue"
|
63 |
+
font.styleName: "Bold"
|
64 |
+
font.pixelSize: 40
|
65 |
+
wrapMode: Text.Wrap
|
66 |
+
horizontalAlignment: Text.AlignHCenter
|
67 |
+
},
|
68 |
+
Text {
|
69 |
+
id: bookAuthor
|
70 |
+
text: model ? model.author : ""
|
71 |
+
anchors {
|
72 |
+
left: parent.left; right: parent.right
|
73 |
+
top: bookName.bottom
|
74 |
+
topMargin: 20
|
75 |
+
}
|
76 |
+
font.family:"Maison Neue"
|
77 |
+
font.styleName: "Medium"
|
78 |
+
font.pixelSize: 35
|
79 |
+
wrapMode: Text.Wrap
|
80 |
+
horizontalAlignment: Text.AlignHCenter
|
81 |
+
},
|
82 |
+
TabBar {
|
83 |
+
id: bar
|
84 |
+
visible: !isBusy
|
85 |
+
anchors {
|
86 |
+
left: parent.left; right: parent.right
|
87 |
+
top: bookAuthor.bottom
|
88 |
+
topMargin: 30
|
89 |
+
}
|
90 |
+
font.pixelSize: 25
|
91 |
+
TabButton {
|
92 |
+
contentItem: Label {
|
93 |
+
text: "Details"
|
94 |
+
color: bar.currentIndex == 0 ? "black" : "gray"
|
95 |
+
font.underline: bar.currentIndex == 0
|
96 |
+
horizontalAlignment: Text.AlignHCenter
|
97 |
+
}
|
98 |
+
background: Rectangle {}
|
99 |
+
}
|
100 |
+
TabButton {
|
101 |
+
contentItem: Label {
|
102 |
+
text: "Similar books"
|
103 |
+
color: bar.currentIndex == 1 ? "black" : "gray"
|
104 |
+
font.underline: bar.currentIndex == 1
|
105 |
+
horizontalAlignment: Text.AlignHCenter
|
106 |
+
}
|
107 |
+
background: Rectangle {}
|
108 |
+
}
|
109 |
+
},
|
110 |
+
StackLayout {
|
111 |
+
id: stack
|
112 |
+
anchors {
|
113 |
+
left: parent.left; right: parent.right
|
114 |
+
top: bar.bottom
|
115 |
+
topMargin: 30
|
116 |
+
bottom: parent.bottom
|
117 |
+
bottomMargin: 30
|
118 |
+
}
|
119 |
+
currentIndex: bar.currentIndex
|
120 |
+
Item {
|
121 |
+
Flickable {
|
122 |
+
anchors.fill: parent
|
123 |
+
contentHeight: bookDesc.height
|
124 |
+
clip: true
|
125 |
+
flickableDirection: Flickable.VerticalFlick
|
126 |
+
boundsBehavior: Flickable.StopAtBounds
|
127 |
+
|
128 |
+
Text {
|
129 |
+
id: bookDesc
|
130 |
+
textFormat: Text.RichText
|
131 |
+
text: model ? model.desc : ""
|
132 |
+
font.family:"EB Garamond"
|
133 |
+
font.styleName: "Medium"
|
134 |
+
font.pixelSize: 30
|
135 |
+
width: parent.width
|
136 |
+
wrapMode: Text.Wrap
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
Item {
|
141 |
+
GridView {
|
142 |
+
id: recGrid
|
143 |
+
anchors.fill: parent
|
144 |
+
boundsBehavior: Flickable.StopAtBounds
|
145 |
+
cellHeight: stack.height / 2
|
146 |
+
cellWidth: cellHeight / 1.5
|
147 |
+
model: bookPopup.model ? bookPopup.model.similars : []
|
148 |
+
flickableDirection: Flickable.HorizontalFlick
|
149 |
+
flow: GridView.TopToBottom
|
150 |
+
clip: true
|
151 |
+
snapMode: GridView.SnapToRow
|
152 |
+
flickDeceleration: 0
|
153 |
+
delegate: Item {
|
154 |
+
id: itemRoot
|
155 |
+
width: recGrid.cellWidth
|
156 |
+
height: recGrid.cellHeight
|
157 |
+
Image {
|
158 |
+
id: image
|
159 |
+
fillMode: Image.PreserveAspectCrop
|
160 |
+
source: model.modelData.imgFile || "png/book"
|
161 |
+
anchors.fill: itemRoot
|
162 |
+
anchors.margins: 10
|
163 |
+
Image {
|
164 |
+
visible: image.status === Image.Error
|
165 |
+
source: "png/book"
|
166 |
+
width: 52; height: 52
|
167 |
+
anchors.centerIn: parent
|
168 |
+
}
|
169 |
+
}
|
170 |
+
MouseArea {
|
171 |
+
anchors.fill: itemRoot
|
172 |
+
onClicked: {
|
173 |
+
model.modelData.getDetail(bookPopup);
|
174 |
+
bar.currentIndex = 0;
|
175 |
+
bookPopup.model = model.modelData;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
},
|
182 |
+
Image {
|
183 |
+
z: 1
|
184 |
+
source: "png/loading"
|
185 |
+
visible: isBusy
|
186 |
+
width: 60
|
187 |
+
height: 60
|
188 |
+
anchors.centerIn: parent
|
189 |
+
}
|
190 |
+
]
|
191 |
+
|
192 |
+
FlatButton {
|
193 |
+
id: download
|
194 |
+
visible: !isBusy
|
195 |
+
width: 300
|
196 |
+
x: parent.width - 220
|
197 |
+
y: parent.height - 5
|
198 |
+
bgColor: "black"
|
199 |
+
fgColor: "white"
|
200 |
+
text: !model || !model.dlUrl ? "Unavailable" : model.status
|
201 |
+
onTapped: {
|
202 |
+
if(!model || !model.dlUrl || model.status !== "Download") {
|
203 |
+
return
|
204 |
+
}
|
205 |
+
store.download(model);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
data/qml/DownloadPopup.qml
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import QtQuick 2.11
|
2 |
+
import QtQuick.Controls 2.4
|
3 |
+
import QtQuick.Layouts 1.11
|
4 |
+
|
5 |
+
Popup {
|
6 |
+
id: downloadPopup
|
7 |
+
width: 500
|
8 |
+
height: store.downloadList.length ? Math.min(listView.contentHeight + 10, 1000) : 130
|
9 |
+
x: accountStatus.x + accountStatus.width - 500 + screenMargin
|
10 |
+
y: accountStatus.y + accountStatus.height + 60
|
11 |
+
|
12 |
+
leftPadding: 20; rightPadding: 20
|
13 |
+
topPadding: 5; bottomPadding: 5
|
14 |
+
|
15 |
+
closePolicy: Popup.CloseOnPressOutside
|
16 |
+
dim: true
|
17 |
+
Overlay.modeless: Rectangle {
|
18 |
+
color: "transparent"
|
19 |
+
MouseArea {
|
20 |
+
anchors.fill: parent
|
21 |
+
}
|
22 |
+
}
|
23 |
+
background: Rectangle {
|
24 |
+
anchors.fill: parent
|
25 |
+
color: "white"
|
26 |
+
border.width: 3
|
27 |
+
border.color: "black"
|
28 |
+
radius: 5
|
29 |
+
}
|
30 |
+
|
31 |
+
Rectangle {
|
32 |
+
visible: store.downloadList.length == 0
|
33 |
+
width: parent.width
|
34 |
+
height: 120
|
35 |
+
Text {
|
36 |
+
id: quote
|
37 |
+
text: "“ A room without books is like\na body without a soul.”"
|
38 |
+
font.family: "Maison Neue"
|
39 |
+
font.styleName: "Medium"
|
40 |
+
font.italic: true
|
41 |
+
font.pixelSize: 22
|
42 |
+
horizontalAlignment: Text.AlignRight
|
43 |
+
anchors {
|
44 |
+
top: parent.top
|
45 |
+
right: parent.right
|
46 |
+
topMargin: 25
|
47 |
+
rightMargin: 80
|
48 |
+
}
|
49 |
+
}
|
50 |
+
Text {
|
51 |
+
text: "— Cicero"
|
52 |
+
font.family: "Maison Neue"
|
53 |
+
font.styleName: "Bold"
|
54 |
+
font.pixelSize: 22
|
55 |
+
anchors.top: quote.bottom
|
56 |
+
anchors.topMargin: 10
|
57 |
+
anchors.right: quote.right
|
58 |
+
horizontalAlignment: Text.AlignRight
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
ListView {
|
63 |
+
id: listView
|
64 |
+
width: 500 - parent.padding * 2
|
65 |
+
anchors.fill: parent
|
66 |
+
model: store.downloadList
|
67 |
+
clip: true
|
68 |
+
boundsBehavior: Flickable.StopAtBounds
|
69 |
+
flickableDirection: Flickable.VerticalFlick
|
70 |
+
flickDeceleration: 0
|
71 |
+
|
72 |
+
delegate: Item {
|
73 |
+
id: root
|
74 |
+
width: parent.width
|
75 |
+
height: 120
|
76 |
+
Rectangle {
|
77 |
+
id: wrapper
|
78 |
+
width: parent.width
|
79 |
+
height: parent.height
|
80 |
+
anchors {
|
81 |
+
left: parent.left
|
82 |
+
right: parent.right
|
83 |
+
verticalCenter: parent.verticalCenter
|
84 |
+
}
|
85 |
+
Text {
|
86 |
+
id: name
|
87 |
+
text: model.modelData.name
|
88 |
+
font.family: "Maison Neue"
|
89 |
+
font.styleName: "Medium"
|
90 |
+
font.pixelSize: 22
|
91 |
+
width: 350
|
92 |
+
maximumLineCount: 2
|
93 |
+
wrapMode: Text.Wrap
|
94 |
+
anchors.verticalCenter: parent.verticalCenter
|
95 |
+
verticalAlignment: Text.AlignVCenter
|
96 |
+
}
|
97 |
+
Text {
|
98 |
+
id: downloadStatusText
|
99 |
+
visible: model.modelData.status === "Downloaded" ||
|
100 |
+
model.modelData.status.endsWith("%")
|
101 |
+
text: model.modelData.status === "Downloaded" ? "↓ " : model.modelData.status
|
102 |
+
color: "black"
|
103 |
+
anchors.right: parent.right
|
104 |
+
anchors.verticalCenter: parent.verticalCenter
|
105 |
+
horizontalAlignment: Text.AlignRight
|
106 |
+
verticalAlignment: Text.AlignVCenter
|
107 |
+
font.family:"Maison Neue"
|
108 |
+
font.styleName: "Bold"
|
109 |
+
font.pixelSize: 30
|
110 |
+
}
|
111 |
+
Rectangle {
|
112 |
+
color: "gray"
|
113 |
+
width: parent.width
|
114 |
+
height: 1
|
115 |
+
anchors.bottom: parent.bottom
|
116 |
+
}
|
117 |
+
MouseArea {
|
118 |
+
anchors.fill: parent
|
119 |
+
onClicked: {
|
120 |
+
model.modelData.getDetail(itemInfo);
|
121 |
+
itemInfo.model = model.modelData;
|
122 |
+
downloadPopup.close();
|
123 |
+
itemInfo.open();
|
124 |
+
}
|
125 |
+
onPressAndHold: {
|
126 |
+
return;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
data/qml/Filter.qml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import QtQuick 2.5
|
2 |
+
import QtQuick.Controls 2.4
|
3 |
+
|
4 |
+
Item {
|
5 |
+
id: root
|
6 |
+
signal activated(int index);
|
7 |
+
property alias model: combo.model
|
8 |
+
property alias text: name.text
|
9 |
+
property alias curIndex: combo.currentIndex
|
10 |
+
|
11 |
+
function setDefault(value) {
|
12 |
+
const id = combo.find(value, Qt.MatchExactly);
|
13 |
+
if (id !== -1) combo.currentIndex = id;
|
14 |
+
else combo.currentIndex = 0;
|
15 |
+
}
|
16 |
+
|
17 |
+
function reset() {
|
18 |
+
combo.currentIndex = 0;
|
19 |
+
}
|
20 |
+
|
21 |
+
function value() {
|
22 |
+
return combo.currentText;
|
23 |
+
}
|
24 |
+
|
25 |
+
height: 100
|
26 |
+
|
27 |
+
Text {
|
28 |
+
id: name
|
29 |
+
font.pixelSize: 35
|
30 |
+
font.family: "Maison Neue"
|
31 |
+
font.styleName: "Bold"
|
32 |
+
}
|
33 |
+
ComboBox {
|
34 |
+
id: combo
|
35 |
+
anchors {
|
36 |
+
top: name.bottom
|
37 |
+
topMargin: 20
|
38 |
+
}
|
39 |
+
width: parent.width
|
40 |
+
height: 60
|
41 |
+
|
42 |
+
font.family: "Maison Neue"
|
43 |
+
font.styleName: "light"
|
44 |
+
|
45 |
+
background: Rectangle {
|
46 |
+
border.width: 2
|
47 |
+
border.color: "black"
|
48 |
+
color: "white"
|
49 |
+
radius: 2
|
50 |
+
}
|
51 |
+
contentItem: Label {
|
52 |
+
text: parent.currentText
|
53 |
+
anchors {
|
54 |
+
left: parent.left
|
55 |
+
leftMargin: 15
|
56 |
+
verticalCenter: parent.verticalCenter
|
57 |
+
verticalCenterOffset: 2
|
58 |
+
}
|
59 |
+
verticalAlignment: Text.AlignVCenter
|
60 |
+
color: "black"
|
61 |
+
}
|
62 |
+
|
63 |
+
delegate: ItemDelegate {
|
64 |
+
width: root.width - 25
|
65 |
+
contentItem: Text {
|
66 |
+
text: modelData
|
67 |
+
color: "black"
|
68 |
+
font.family: "Maison Neue"
|
69 |
+
font.styleName: "light"
|
70 |
+
font.bold: combo.highlightedIndex === index
|
71 |
+
verticalAlignment: Text.AlignVCenter
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
popup: Popup {
|
76 |
+
readonly property int columns: combo.model.length > 12 ? 2 : 1
|
77 |
+
y: combo.height + 20
|
78 |
+
width: root.width * columns
|
79 |
+
implicitHeight: Math.min(contentItem.contentHeight + 20, 800)
|
80 |
+
clip: true
|
81 |
+
|
82 |
+
contentItem: GridView {
|
83 |
+
id: grid
|
84 |
+
flow: GridView.FlowLeftToRight
|
85 |
+
model: combo.popup.visible ? combo.delegateModel : null
|
86 |
+
currentIndex: combo.highlightedIndex
|
87 |
+
cellWidth: root.width - 15
|
88 |
+
cellHeight: combo.height
|
89 |
+
|
90 |
+
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
91 |
+
}
|
92 |
+
|
93 |
+
background: Rectangle {
|
94 |
+
border.color: "black"
|
95 |
+
border.width: 2
|
96 |
+
radius: 3
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
onActivated: parent.activated(index);
|
101 |
+
}
|
102 |
+
}
|
data/qml/FlatButton.qml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import QtQuick 2.5
|
2 |
+
import QtQuick.Controls 2.4
|
3 |
+
|
4 |
+
Item {
|
5 |
+
signal tapped;
|
6 |
+
property alias bgColor: button.color
|
7 |
+
property alias fgColor: name.color
|
8 |
+
property alias text: name.text
|
9 |
+
property int borderWidth: 0
|
10 |
+
|
11 |
+
Rectangle {
|
12 |
+
id: button
|
13 |
+
width: parent.width
|
14 |
+
height: 80
|
15 |
+
radius: 3
|
16 |
+
border.color: name.color
|
17 |
+
border.width: borderWidth
|
18 |
+
|
19 |
+
MouseArea {
|
20 |
+
id: click
|
21 |
+
anchors.fill: parent
|
22 |
+
onClicked: tapped()
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
Text {
|
27 |
+
id: name
|
28 |
+
anchors.centerIn: button
|
29 |
+
anchors.verticalCenterOffset: 2
|
30 |
+
horizontalAlignment: Text.AlignHCenter
|
31 |
+
verticalAlignment: Text.AlignVCenter
|
32 |
+
font.family: "Maison Neue"
|
33 |
+
font.styleName: "Bold"
|
34 |
+
font.pixelSize: 30
|
35 |
+
}
|
36 |
+
}
|
data/qml/Main.qml
ADDED
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import QtQuick 2.11
|
2 |
+
import QtQuick.Controls 2.4
|
3 |
+
import QtQuick.Layouts 1.11
|
4 |
+
|
5 |
+
Rectangle {
|
6 |
+
id: canvas
|
7 |
+
width: screenGeometry.width
|
8 |
+
height: screenGeometry.height
|
9 |
+
readonly property int screenMargin: 40
|
10 |
+
readonly property int columns: 4
|
11 |
+
readonly property int rows: 3
|
12 |
+
readonly property int itemPerPage: rows * columns
|
13 |
+
readonly property int bookWidth: (width - screenMargin * 2) / columns
|
14 |
+
readonly property int itemContentWidth: bookWidth - 20
|
15 |
+
|
16 |
+
Rectangle {
|
17 |
+
id: title
|
18 |
+
visible: titleVisible
|
19 |
+
z: 3
|
20 |
+
anchors.fill: parent
|
21 |
+
color: "white"
|
22 |
+
Image {
|
23 |
+
id: titleImg
|
24 |
+
source: "svg/title"
|
25 |
+
anchors.centerIn: parent
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
Rectangle {
|
30 |
+
id: closeApp
|
31 |
+
anchors.top: parent.top
|
32 |
+
anchors.right: parent.right
|
33 |
+
anchors.margins: screenMargin
|
34 |
+
width: 80
|
35 |
+
height: 80
|
36 |
+
radius: 40
|
37 |
+
z: 1
|
38 |
+
color: "black"
|
39 |
+
Text {
|
40 |
+
text: "x"
|
41 |
+
font.family: "Maison Neue"
|
42 |
+
font.bold: true
|
43 |
+
font.pixelSize:40
|
44 |
+
color: "white"
|
45 |
+
anchors.centerIn: parent
|
46 |
+
anchors.topMargin: 10
|
47 |
+
}
|
48 |
+
MouseArea {
|
49 |
+
anchors.fill: parent
|
50 |
+
onClicked: Qt.quit()
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
Rectangle {
|
56 |
+
anchors.left: parent.left
|
57 |
+
anchors.right: parent.right
|
58 |
+
anchors.top: parent.top
|
59 |
+
anchors.margins: 40
|
60 |
+
height: 100
|
61 |
+
|
62 |
+
Rectangle {
|
63 |
+
width: 150
|
64 |
+
height: 80
|
65 |
+
|
66 |
+
Image {
|
67 |
+
source: "png/searchblack"
|
68 |
+
width: 80
|
69 |
+
height: 80
|
70 |
+
}
|
71 |
+
MouseArea {
|
72 |
+
anchors.fill: parent
|
73 |
+
onClicked: queryUI.openSearch(true);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
Rectangle {
|
77 |
+
id: savedList
|
78 |
+
width: 60
|
79 |
+
height: 60
|
80 |
+
border.color: "black"
|
81 |
+
border.width: 2
|
82 |
+
radius: 30
|
83 |
+
color: "white"
|
84 |
+
anchors {
|
85 |
+
right: parent.right
|
86 |
+
rightMargin: 120
|
87 |
+
top: parent.top
|
88 |
+
topMargin: 10
|
89 |
+
}
|
90 |
+
Image {
|
91 |
+
source: "png/bookmark"
|
92 |
+
anchors.centerIn: parent
|
93 |
+
}
|
94 |
+
MouseArea {
|
95 |
+
anchors.fill: parent
|
96 |
+
onClicked: store.openSavedList(0)
|
97 |
+
}
|
98 |
+
}
|
99 |
+
Rectangle {
|
100 |
+
id: accountStatus
|
101 |
+
width: accountStatusText.contentWidth + 60
|
102 |
+
height: 60
|
103 |
+
visible: store.accountStatus.length > 0
|
104 |
+
border.color: "black"
|
105 |
+
border.width: 2
|
106 |
+
radius: 30
|
107 |
+
color: "white"
|
108 |
+
anchors {
|
109 |
+
right: savedList.left
|
110 |
+
rightMargin: 30
|
111 |
+
top: parent.top
|
112 |
+
topMargin: 10
|
113 |
+
}
|
114 |
+
Text {
|
115 |
+
id: accountStatusText
|
116 |
+
text: store.accountStatus
|
117 |
+
color: "black"
|
118 |
+
font.pixelSize: 25
|
119 |
+
font.family:"Maison Neue"
|
120 |
+
font.styleName: "Medium"
|
121 |
+
anchors.centerIn: parent
|
122 |
+
anchors.verticalCenterOffset: 2
|
123 |
+
}
|
124 |
+
MouseArea {
|
125 |
+
anchors.fill: parent
|
126 |
+
onClicked: downloadList.open()
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
GridView {
|
132 |
+
id: libView
|
133 |
+
objectName: "libView"
|
134 |
+
anchors.fill: parent
|
135 |
+
anchors.margins: screenMargin
|
136 |
+
anchors.topMargin: 140
|
137 |
+
|
138 |
+
boundsBehavior: Flickable.StopAtBounds
|
139 |
+
cellWidth: bookWidth
|
140 |
+
cellHeight: bookWidth * 1.5 + 30
|
141 |
+
model: store.books
|
142 |
+
flickableDirection: Flickable.HorizontalFlick
|
143 |
+
flow: GridView.TopToBottom
|
144 |
+
clip: true
|
145 |
+
snapMode: GridView.SnapToRow
|
146 |
+
flickDeceleration: 0
|
147 |
+
onMovementEnded: currentIndex = indexAt(contentX, 0)
|
148 |
+
|
149 |
+
delegate: Item {
|
150 |
+
id: root
|
151 |
+
width: libView.cellWidth
|
152 |
+
height: libView.cellHeight
|
153 |
+
|
154 |
+
Rectangle {
|
155 |
+
id: background
|
156 |
+
color: "white"
|
157 |
+
anchors.fill: parent
|
158 |
+
}
|
159 |
+
Text {
|
160 |
+
id: author
|
161 |
+
text: model.modelData.author
|
162 |
+
font.family:"Maison Neue"
|
163 |
+
font.styleName: "Demi"
|
164 |
+
font.pixelSize:25
|
165 |
+
width: itemContentWidth
|
166 |
+
anchors.bottom: parent.bottom
|
167 |
+
anchors.bottomMargin: 50
|
168 |
+
anchors.horizontalCenter: parent.horizontalCenter
|
169 |
+
horizontalAlignment: Text.AlignHCenter
|
170 |
+
maximumLineCount: 1
|
171 |
+
wrapMode: Text.Wrap
|
172 |
+
}
|
173 |
+
Text {
|
174 |
+
id: name
|
175 |
+
text: model.modelData.name
|
176 |
+
font.family:"Maison Neue"
|
177 |
+
font.styleName: "Bold"
|
178 |
+
font.pixelSize:25
|
179 |
+
width: itemContentWidth
|
180 |
+
anchors.horizontalCenter: parent.horizontalCenter
|
181 |
+
anchors.bottom: author.top
|
182 |
+
anchors.bottomMargin: 5
|
183 |
+
horizontalAlignment: Text.AlignHCenter
|
184 |
+
maximumLineCount: 2
|
185 |
+
wrapMode: Text.Wrap
|
186 |
+
}
|
187 |
+
Image {
|
188 |
+
id: image
|
189 |
+
fillMode: Image.PreserveAspectFit
|
190 |
+
width: 200
|
191 |
+
source: model.modelData.imgFile || "png/book"
|
192 |
+
anchors.centerIn: parent
|
193 |
+
anchors.verticalCenterOffset: -60
|
194 |
+
Image {
|
195 |
+
visible: image.status === Image.Error
|
196 |
+
source: "png/book"
|
197 |
+
width: 52; height: 52
|
198 |
+
anchors.centerIn: parent
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
Rectangle {
|
203 |
+
id: downloadStatus
|
204 |
+
visible: model.modelData.status === "Downloaded" ||
|
205 |
+
model.modelData.status.endsWith("%")
|
206 |
+
anchors.top: parent.top
|
207 |
+
anchors.right: parent.right
|
208 |
+
width: Math.max(40, downloadStatusText.contentWidth + 20)
|
209 |
+
height: 40
|
210 |
+
color: "black"
|
211 |
+
|
212 |
+
Text {
|
213 |
+
id: downloadStatusText
|
214 |
+
text: model.modelData.status === "Downloaded" ? "↓" : model.modelData.status
|
215 |
+
color: "white"
|
216 |
+
anchors.centerIn: parent
|
217 |
+
anchors.verticalCenterOffset: 2
|
218 |
+
horizontalAlignment: Text.AlignHCenter
|
219 |
+
verticalAlignment: Text.AlignVCenter
|
220 |
+
font.family:"Maison Neue"
|
221 |
+
font.styleName: "Medium"
|
222 |
+
font.pixelSize:25
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
MouseArea {
|
227 |
+
anchors.fill: root
|
228 |
+
onPressed: {
|
229 |
+
background.color = "black"
|
230 |
+
name.color = "white"
|
231 |
+
author.color = "white"
|
232 |
+
}
|
233 |
+
onReleased: {
|
234 |
+
background.color = "white"
|
235 |
+
name.color = "black"
|
236 |
+
author.color = "black"
|
237 |
+
}
|
238 |
+
onCanceled: {
|
239 |
+
background.color = "white"
|
240 |
+
name.color = "black"
|
241 |
+
author.color = "black"
|
242 |
+
}
|
243 |
+
onClicked: {
|
244 |
+
model.modelData.getDetail(itemInfo);
|
245 |
+
itemInfo.model = model.modelData;
|
246 |
+
itemInfo.open();
|
247 |
+
}
|
248 |
+
onPressAndHold: {
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
Row {
|
256 |
+
anchors.bottom: parent.bottom
|
257 |
+
anchors.left: parent.left
|
258 |
+
anchors.leftMargin: screenMargin
|
259 |
+
anchors.bottomMargin: screenMargin + 10
|
260 |
+
Repeater {
|
261 |
+
model: store.pages
|
262 |
+
Rectangle {
|
263 |
+
width: 100; height: 60
|
264 |
+
Rectangle {
|
265 |
+
id: bg
|
266 |
+
width: 80; height: 60
|
267 |
+
border.width: store.currentPage == index ? 2 : 0
|
268 |
+
border.color: "black"
|
269 |
+
radius: 30
|
270 |
+
color: "white"
|
271 |
+
}
|
272 |
+
Text {
|
273 |
+
text: modelData
|
274 |
+
anchors.centerIn: bg
|
275 |
+
anchors.verticalCenterOffset: 2
|
276 |
+
horizontalAlignment: Text.AlignHCenter
|
277 |
+
verticalAlignment: Text.AlignVCenter
|
278 |
+
font.family: "Maison Neue"
|
279 |
+
font.styleName: "Medium"
|
280 |
+
font.pixelSize: 20
|
281 |
+
}
|
282 |
+
MouseArea {
|
283 |
+
anchors.fill: parent
|
284 |
+
onClicked: {
|
285 |
+
if (store.currentPage == index) {
|
286 |
+
return;
|
287 |
+
}
|
288 |
+
store.newQuery(index);
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
Rectangle {
|
296 |
+
property bool isClickable: (libView.currentIndex + itemPerPage) < libView.count
|
297 |
+
id: goRight
|
298 |
+
anchors.bottom: parent.bottom
|
299 |
+
anchors.right: parent.right
|
300 |
+
anchors.margins: screenMargin
|
301 |
+
width: 80; height: 80; radius: 40
|
302 |
+
color: isClickable ? "black" : "gray"
|
303 |
+
Text {
|
304 |
+
text: "v"
|
305 |
+
font.family: "Maison Neue"
|
306 |
+
font.bold: true
|
307 |
+
font.pixelSize:40
|
308 |
+
color: "white"
|
309 |
+
anchors.centerIn: parent
|
310 |
+
}
|
311 |
+
transform: Rotation {
|
312 |
+
origin.x: 40;
|
313 |
+
origin.y: 40;
|
314 |
+
angle: 270
|
315 |
+
}
|
316 |
+
MouseArea {
|
317 |
+
anchors.fill: parent
|
318 |
+
onClicked: {
|
319 |
+
if (parent.isClickable) {
|
320 |
+
libView.currentIndex += itemPerPage;
|
321 |
+
} else {
|
322 |
+
return;
|
323 |
+
}
|
324 |
+
|
325 |
+
if (libView.currentIndex >= libView.count) {
|
326 |
+
libView.currentIndex = libView.count - itemPerPage + libView.count % itemPerPage;
|
327 |
+
}
|
328 |
+
libView.positionViewAtIndex(libView.currentIndex, GridView.Beginning);
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
|
334 |
+
Rectangle {
|
335 |
+
property bool isClickable: (libView.currentIndex - itemPerPage) >= 0 ||
|
336 |
+
(libView.currentIndex - rows) >= 0
|
337 |
+
id: goLeft
|
338 |
+
anchors.bottom: parent.bottom
|
339 |
+
anchors.right: goRight.left
|
340 |
+
anchors.margins: screenMargin
|
341 |
+
width: 80; height: 80; radius: 40
|
342 |
+
color: isClickable ? "black" : "gray"
|
343 |
+
Text {
|
344 |
+
text: "v"
|
345 |
+
font.family: "Maison Neue"
|
346 |
+
font.bold: true
|
347 |
+
font.pixelSize:40
|
348 |
+
color: "white"
|
349 |
+
anchors.centerIn: parent
|
350 |
+
}
|
351 |
+
transform: Rotation {
|
352 |
+
origin.x: 40;
|
353 |
+
origin.y: 40;
|
354 |
+
angle: 90
|
355 |
+
}
|
356 |
+
MouseArea {
|
357 |
+
anchors.fill: parent
|
358 |
+
onClicked: {
|
359 |
+
if (parent.isClickable) {
|
360 |
+
libView.currentIndex -= itemPerPage;
|
361 |
+
} else {
|
362 |
+
return;
|
363 |
+
}
|
364 |
+
|
365 |
+
if (libView.currentIndex < 0) {
|
366 |
+
libView.currentIndex = 0
|
367 |
+
}
|
368 |
+
libView.positionViewAtIndex(libView.currentIndex, GridView.Beginning);
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
BookPopup {
|
374 |
+
id: itemInfo
|
375 |
+
// anchors.fill: parent
|
376 |
+
}
|
377 |
+
|
378 |
+
Query {
|
379 |
+
id: queryUI
|
380 |
+
anchors.fill: parent
|
381 |
+
z: 2
|
382 |
+
storeFront: store
|
383 |
+
}
|
384 |
+
|
385 |
+
DownloadPopup {
|
386 |
+
id: downloadList
|
387 |
+
}
|
388 |
+
|
389 |
+
Text {
|
390 |
+
id: errorMessage
|
391 |
+
text: storeError
|
392 |
+
font.family: "Maison Neue"
|
393 |
+
font.styleName: "Medium"
|
394 |
+
font.pixelSize: 40
|
395 |
+
width: 800
|
396 |
+
anchors.centerIn: parent
|
397 |
+
horizontalAlignment: Text.AlignHCenter
|
398 |
+
wrapMode: Text.Wrap
|
399 |
+
}
|
400 |
+
|
401 |
+
Rectangle {
|
402 |
+
z: 4
|
403 |
+
visible: store.isBusy
|
404 |
+
color: "white"
|
405 |
+
width: 400; height: 200
|
406 |
+
anchors.centerIn: parent
|
407 |
+
anchors.verticalCenterOffset: 160
|
408 |
+
|
409 |
+
Rectangle {
|
410 |
+
id: progBarBase
|
411 |
+
color: "black";
|
412 |
+
width: 344
|
413 |
+
height: 2
|
414 |
+
anchors.top: parent.top
|
415 |
+
anchors.topMargin: 60
|
416 |
+
anchors.horizontalCenter: parent.horizontalCenter
|
417 |
+
}
|
418 |
+
|
419 |
+
Rectangle {
|
420 |
+
color: "black";
|
421 |
+
width: storeProg * 344
|
422 |
+
height: 15
|
423 |
+
anchors.bottom: progBarBase.bottom
|
424 |
+
anchors.left: progBarBase.left
|
425 |
+
}
|
426 |
+
|
427 |
+
onVisibleChanged: {
|
428 |
+
if (!visible && queryUI.visible) {
|
429 |
+
queryUI.visible = false;
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
Rectangle {
|
434 |
+
id: cancleButton
|
435 |
+
visible: !titleVisible
|
436 |
+
color: "black"
|
437 |
+
width: 200
|
438 |
+
height: 70
|
439 |
+
radius: 3
|
440 |
+
anchors {
|
441 |
+
bottom: parent.bottom
|
442 |
+
bottomMargin: 30
|
443 |
+
horizontalCenter: parent.horizontalCenter
|
444 |
+
}
|
445 |
+
Text {
|
446 |
+
text: "Cancel"
|
447 |
+
color: "white"
|
448 |
+
anchors.fill: parent
|
449 |
+
anchors.centerIn: parent
|
450 |
+
horizontalAlignment: Text.AlignHCenter
|
451 |
+
verticalAlignment: Text.AlignVCenter
|
452 |
+
font.family:"Maison Neue"
|
453 |
+
font.styleName: "Bold"
|
454 |
+
font.pixelSize: 30
|
455 |
+
}
|
456 |
+
MouseArea {
|
457 |
+
anchors.fill: parent
|
458 |
+
onClicked: store.stopQuery()
|
459 |
+
}
|
460 |
+
}
|
461 |
+
}
|
462 |
+
}
|
data/qml/Query.qml
ADDED
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import QtQuick 2.5
|
2 |
+
import QtQuick.Controls 2.4
|
3 |
+
import QtQuick.Layouts 1.0
|
4 |
+
import QuickKeyboard 1.0
|
5 |
+
import "modes"
|
6 |
+
|
7 |
+
Item {
|
8 |
+
property variant storeFront;
|
9 |
+
property bool firstOpen: true;
|
10 |
+
|
11 |
+
id: searchUI
|
12 |
+
visible: false
|
13 |
+
|
14 |
+
function openSearch(open) {
|
15 |
+
if (open) {
|
16 |
+
searchUI.visible = true
|
17 |
+
keyboard.dispatcher.setFocusObject(textInput);
|
18 |
+
if (firstOpen) {
|
19 |
+
firstOpen = false;
|
20 |
+
fromYear.setDefault(storeFront.fromYear);
|
21 |
+
toYear.setDefault(storeFront.toYear);
|
22 |
+
fromYear.activated(fromYear.curIndex);
|
23 |
+
|
24 |
+
language.setDefault(storeFront.language);
|
25 |
+
extension.setDefault(storeFront.extension);
|
26 |
+
order.setDefault(storeFront.order);
|
27 |
+
storeFront.exactMatch == "1" && exactMatch.toggle();
|
28 |
+
storeFront.query.length && (textInput.text = storeFront.query);
|
29 |
+
}
|
30 |
+
} else {
|
31 |
+
searchUI.visible = false;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
function getParams() {
|
36 |
+
storeFront.exactMatch = exactMatch.position;
|
37 |
+
storeFront.fromYear = fromYear.value();
|
38 |
+
storeFront.toYear = toYear.value();
|
39 |
+
storeFront.language = language.value();
|
40 |
+
storeFront.extension = extension.value();
|
41 |
+
storeFront.order = order.value();
|
42 |
+
storeFront.query = textInput.text;
|
43 |
+
}
|
44 |
+
|
45 |
+
function sendQuery() {
|
46 |
+
getParams();
|
47 |
+
storeFront.newQuery(0);
|
48 |
+
}
|
49 |
+
|
50 |
+
Rectangle {
|
51 |
+
id: background
|
52 |
+
anchors.fill: parent
|
53 |
+
|
54 |
+
MouseArea {
|
55 |
+
anchors.fill: parent
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
Rectangle {
|
60 |
+
id: searchBox
|
61 |
+
color: "black"
|
62 |
+
height: 110
|
63 |
+
anchors {
|
64 |
+
left: parent.left
|
65 |
+
right: parent.right
|
66 |
+
top: parent.top
|
67 |
+
}
|
68 |
+
|
69 |
+
Image {
|
70 |
+
source: "png/search"
|
71 |
+
anchors.verticalCenter: parent.verticalCenter
|
72 |
+
anchors.left: parent.left
|
73 |
+
anchors.leftMargin: 40
|
74 |
+
width: 50
|
75 |
+
height: 50
|
76 |
+
}
|
77 |
+
|
78 |
+
TextField {
|
79 |
+
id: textInput
|
80 |
+
font.pixelSize: 35
|
81 |
+
color: "white"
|
82 |
+
font.family: "Maison Neue"
|
83 |
+
anchors { fill: parent; verticalCenter: parent.verticalCenter; topMargin: 10 }
|
84 |
+
clip: true
|
85 |
+
verticalAlignment: Text.AlignVCenter
|
86 |
+
anchors.leftMargin: 120
|
87 |
+
anchors.rightMargin: 40 + 150
|
88 |
+
placeholderText: "Search for title, author, ISBN, publisher, md5..."
|
89 |
+
background: Rectangle {
|
90 |
+
anchors.fill: parent
|
91 |
+
color: "black"
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
Rectangle {
|
96 |
+
visible: textInput.text.length > 0
|
97 |
+
color: "black"
|
98 |
+
border.color: "white"
|
99 |
+
border.width: 3
|
100 |
+
width: 130
|
101 |
+
height: 50
|
102 |
+
radius: 4
|
103 |
+
anchors {
|
104 |
+
right: parent.right
|
105 |
+
verticalCenter: parent.verticalCenter
|
106 |
+
rightMargin: 40
|
107 |
+
}
|
108 |
+
Text {
|
109 |
+
text: "Clear"
|
110 |
+
font.pixelSize: 25
|
111 |
+
color: "white"
|
112 |
+
font.family: "Maison Neue"
|
113 |
+
font.bold: true
|
114 |
+
anchors.centerIn: parent
|
115 |
+
anchors.verticalCenterOffset: 2
|
116 |
+
}
|
117 |
+
MouseArea {
|
118 |
+
anchors.fill: parent
|
119 |
+
onClicked: textInput.text = ""
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
Row {
|
125 |
+
anchors {
|
126 |
+
left: parent.left
|
127 |
+
leftMargin: screenMargin
|
128 |
+
top: searchBox.bottom
|
129 |
+
topMargin: 30
|
130 |
+
}
|
131 |
+
spacing: 33
|
132 |
+
|
133 |
+
Filter {
|
134 |
+
id: fromYear
|
135 |
+
model: {
|
136 |
+
let a = ["Any"];
|
137 |
+
let thisYear = (new Date).getFullYear();
|
138 |
+
while (thisYear >= 1800) {
|
139 |
+
a.push(thisYear);
|
140 |
+
thisYear--;
|
141 |
+
}
|
142 |
+
return a;
|
143 |
+
}
|
144 |
+
width: 150
|
145 |
+
text: "From"
|
146 |
+
onActivated: {
|
147 |
+
let oldIndex = toYear.curIndex;
|
148 |
+
toYear.model = index > 0 ? fromYear.model.slice(0, index + 1) : fromYear.model;
|
149 |
+
if (oldIndex <= index) {
|
150 |
+
toYear.curIndex = oldIndex;
|
151 |
+
} else {
|
152 |
+
toYear.curIndex = index;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
Filter {
|
158 |
+
id: toYear
|
159 |
+
model: fromYear.model
|
160 |
+
text: "To"
|
161 |
+
width: 150
|
162 |
+
}
|
163 |
+
|
164 |
+
Filter {
|
165 |
+
id: language
|
166 |
+
model: ["Any","Afrikaans","Albanian","Arabic","Armenian","Azerbaijani","Bashkir","Belarusian","Bengali","Berber","Bulgarian","Catalan","Chinese","Crimean Tatar","Croatian","Czech","Danish","Dutch","English","Esperanto","Finnish","French","Georgian","German","Greek","Gujarati","Hebrew","Hindi","Hungarian","Icelandic","Indigenous","Indonesian","Italian","Japanese","Kannada","Kazakh","Kirghiz","Korean","Latin","Latvian","Lithuanian","Malayalam","Marathi","Mongolian","Nepali","Norwegian","Odia","Persian","Polish","Portuguese","Romanian","Russian","Sanskrit","Serbian","Sinhala","Slovak","Slovenian","Somali","Spanish","Swahili","Swedish","Tajik","Tamil","Tatar","Telugu","Turkish","Ukrainian","Urdu","Uzbek","Vietnamese"]
|
167 |
+
text: "Language"
|
168 |
+
width: 350
|
169 |
+
}
|
170 |
+
|
171 |
+
Filter {
|
172 |
+
id: extension
|
173 |
+
model: ["Any","pdf","epub","djvu","fb2","txt","rar","mobi","lit","doc","rtf","azw3"]
|
174 |
+
text: "Extension"
|
175 |
+
width: 200
|
176 |
+
}
|
177 |
+
|
178 |
+
Filter {
|
179 |
+
id: order
|
180 |
+
model: [ "Most Popular", "Best Match", "Recently added", "By Title (A-Z)", "By Title (Z-A)", "By Year", "File Size Asc.", "File Size Des." ]
|
181 |
+
text: "Sort by"
|
182 |
+
width: 350
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
Switch {
|
187 |
+
id : exactMatch
|
188 |
+
x: screenMargin
|
189 |
+
y: 280
|
190 |
+
|
191 |
+
indicator: Rectangle {
|
192 |
+
width: 80
|
193 |
+
height: 40
|
194 |
+
y: parent.height / 2 - height / 2
|
195 |
+
radius: 20
|
196 |
+
color: exactMatch.checked ? "black" : "white"
|
197 |
+
border.color: "black"
|
198 |
+
border.width: 1
|
199 |
+
|
200 |
+
Rectangle {
|
201 |
+
x: exactMatch.checked ? parent.width - width : 0
|
202 |
+
width: 40
|
203 |
+
height: 40
|
204 |
+
radius: 20
|
205 |
+
color: "white"
|
206 |
+
border.color: "black"
|
207 |
+
border.width: 1
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
contentItem: Text {
|
212 |
+
text: " Exact match"
|
213 |
+
font.family: "Maison Neue"
|
214 |
+
font.bold: true
|
215 |
+
font.pixelSize: 35
|
216 |
+
color: "black"
|
217 |
+
height: 40
|
218 |
+
verticalAlignment: Text.AlignVCenter
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
FlatButton {
|
223 |
+
id: startQuery
|
224 |
+
width: 200
|
225 |
+
bgColor: "black"
|
226 |
+
fgColor: "white"
|
227 |
+
text: "Search"
|
228 |
+
y: 400
|
229 |
+
anchors {
|
230 |
+
right: parent.right
|
231 |
+
rightMargin: 40
|
232 |
+
}
|
233 |
+
onTapped: sendQuery()
|
234 |
+
}
|
235 |
+
|
236 |
+
FlatButton {
|
237 |
+
id: setDefaultQuery
|
238 |
+
width: 350
|
239 |
+
bgColor: "white"
|
240 |
+
fgColor: "black"
|
241 |
+
text: "Set as default query"
|
242 |
+
borderWidth: 3
|
243 |
+
y: 400
|
244 |
+
anchors {
|
245 |
+
left: parent.left
|
246 |
+
leftMargin: 40
|
247 |
+
}
|
248 |
+
onTapped: {
|
249 |
+
getParams();
|
250 |
+
storeFront.setConfig();
|
251 |
+
|
252 |
+
setDefaultQuery.text = "✔";
|
253 |
+
resetButtonText.start();
|
254 |
+
}
|
255 |
+
Timer {
|
256 |
+
id: resetButtonText
|
257 |
+
interval: 3000; running: false; repeat: false
|
258 |
+
onTriggered: setDefaultQuery.text = "Set as default query";
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
FlatButton {
|
263 |
+
id: resetFilter
|
264 |
+
width: 250
|
265 |
+
bgColor: "white"
|
266 |
+
fgColor: "black"
|
267 |
+
text: "Reset query"
|
268 |
+
borderWidth: 3
|
269 |
+
y: 400
|
270 |
+
anchors {
|
271 |
+
left: setDefaultQuery.right
|
272 |
+
leftMargin: 30
|
273 |
+
}
|
274 |
+
onTapped: {
|
275 |
+
if (exactMatch.position == 1.0)
|
276 |
+
exactMatch.toggle();
|
277 |
+
|
278 |
+
fromYear.reset();
|
279 |
+
toYear.reset();
|
280 |
+
language.reset();
|
281 |
+
extension.reset();
|
282 |
+
order.reset();
|
283 |
+
textInput.text = "";
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
Keyboard {
|
288 |
+
id: keyboard
|
289 |
+
anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
|
290 |
+
height: 626
|
291 |
+
|
292 |
+
Rectangle {
|
293 |
+
anchors.fill: parent
|
294 |
+
color: "black"
|
295 |
+
}
|
296 |
+
|
297 |
+
mode: standard
|
298 |
+
|
299 |
+
Standard {
|
300 |
+
id: standard
|
301 |
+
anchors.fill: parent
|
302 |
+
anchors.topMargin: 93
|
303 |
+
onSymbolsModeSwitched: keyboard.mode = symbols
|
304 |
+
onEnter: sendQuery()
|
305 |
+
}
|
306 |
+
|
307 |
+
Symbols {
|
308 |
+
id: symbols
|
309 |
+
anchors.fill: parent
|
310 |
+
anchors.topMargin: 93
|
311 |
+
onStandardModeSwitched: keyboard.mode = standard
|
312 |
+
onSymbolsModeSwitched: keyboard.mode = symbols2
|
313 |
+
onEnter: sendQuery()
|
314 |
+
}
|
315 |
+
|
316 |
+
Symbols2 {
|
317 |
+
id: symbols2
|
318 |
+
anchors.fill: parent
|
319 |
+
anchors.topMargin: 93
|
320 |
+
onStandardModeSwitched: keyboard.mode = standard
|
321 |
+
onSymbolsModeSwitched: keyboard.mode = symbols
|
322 |
+
onEnter: sendQuery()
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
Rectangle {
|
327 |
+
id: closeSearchUI
|
328 |
+
width: 80
|
329 |
+
height: 80
|
330 |
+
radius: 40
|
331 |
+
color: "black"
|
332 |
+
anchors {
|
333 |
+
right: parent.right
|
334 |
+
bottom: keyboard.top
|
335 |
+
margins: 40
|
336 |
+
}
|
337 |
+
Text {
|
338 |
+
text: "v"
|
339 |
+
font.family: "Maison Neue"
|
340 |
+
font.bold: true
|
341 |
+
color: "white"
|
342 |
+
anchors.centerIn: parent
|
343 |
+
font.pixelSize:40
|
344 |
+
}
|
345 |
+
MouseArea {
|
346 |
+
anchors.fill: parent
|
347 |
+
onClicked: openSearch(false)
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
Item {
|
352 |
+
id: keyboardOverlay
|
353 |
+
anchors.fill: keyboard
|
354 |
+
}
|
355 |
+
}
|
data/qml/book.png
ADDED
Git LFS Details
|
data/qml/bookmark.png
ADDED
Git LFS Details
|
data/qml/loading.png
ADDED
Git LFS Details
|
data/qml/search.png
ADDED
Git LFS Details
|
data/qml/searchblack.png
ADDED
Git LFS Details
|
data/qml/title.svg
ADDED
data/quickvirtualkeyboard/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Miroslav Bendík <[email protected]>
|
data/quickvirtualkeyboard/ButtonItem.cpp
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include "ButtonItem.h"
|
2 |
+
|
3 |
+
namespace QuickKeyboard
|
4 |
+
{
|
5 |
+
|
6 |
+
ButtonItem::ButtonItem(QQuickItem *parent):
|
7 |
+
QQuickItem(parent),
|
8 |
+
m_active(false),
|
9 |
+
m_mouseDown(false),
|
10 |
+
m_modifier(false),
|
11 |
+
m_col(0),
|
12 |
+
m_row(0),
|
13 |
+
m_colSpan(1),
|
14 |
+
m_rowSpan(1),
|
15 |
+
m_currentSymbolIndex(-1)
|
16 |
+
{
|
17 |
+
connect(this, SIGNAL(symbolsChanged(const QStringList &)), SLOT(onSymbolsChanged()));
|
18 |
+
connect(this, SIGNAL(triggered()), SLOT(onTriggered()));
|
19 |
+
connect(this, SIGNAL(released()), SLOT(onReleased()));
|
20 |
+
}
|
21 |
+
|
22 |
+
ButtonItem::~ButtonItem()
|
23 |
+
{
|
24 |
+
}
|
25 |
+
|
26 |
+
void ButtonItem::setActive(bool active)
|
27 |
+
{
|
28 |
+
if (m_active == active) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
m_active = active;
|
33 |
+
emit activeChanged(active);
|
34 |
+
emit pressedChanged(m_active || m_mouseDown);
|
35 |
+
setCurrentSymbolIndex(0);
|
36 |
+
}
|
37 |
+
|
38 |
+
void ButtonItem::setMouseDown(bool mouseDown)
|
39 |
+
{
|
40 |
+
if (m_mouseDown == mouseDown) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
m_mouseDown = mouseDown;
|
45 |
+
emit mouseDownChanged(mouseDown);
|
46 |
+
emit pressedChanged(m_active || m_mouseDown);
|
47 |
+
setCurrentSymbolIndex(0);
|
48 |
+
}
|
49 |
+
|
50 |
+
void ButtonItem::setCurrentSymbolIndex(int currentSymbolIndex)
|
51 |
+
{
|
52 |
+
if (m_symbols.length() == 0) {
|
53 |
+
currentSymbolIndex = -1;
|
54 |
+
}
|
55 |
+
if (currentSymbolIndex == -1 && m_symbols.length() > 0) {
|
56 |
+
currentSymbolIndex = 0;
|
57 |
+
}
|
58 |
+
|
59 |
+
if (currentSymbolIndex == m_currentSymbolIndex) {
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
m_currentSymbolIndex = currentSymbolIndex;
|
64 |
+
emit currentSymbolIndexChanged(currentSymbolIndex);
|
65 |
+
}
|
66 |
+
|
67 |
+
void ButtonItem::onSymbolsChanged()
|
68 |
+
{
|
69 |
+
if (m_symbols.length() == 0) {
|
70 |
+
setCurrentSymbolIndex(-1);
|
71 |
+
}
|
72 |
+
else {
|
73 |
+
if (m_currentSymbolIndex < 0 || m_currentSymbolIndex >= m_symbols.length()) {
|
74 |
+
setCurrentSymbolIndex(0);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
void ButtonItem::onTriggered()
|
80 |
+
{
|
81 |
+
if (m_currentSymbolIndex < 0 || m_currentSymbolIndex >= m_symbols.length()) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
emit symbolTriggered(m_symbols[m_currentSymbolIndex]);
|
86 |
+
}
|
87 |
+
|
88 |
+
void ButtonItem::onReleased()
|
89 |
+
{
|
90 |
+
bool active = m_active;
|
91 |
+
if (m_modifier) {
|
92 |
+
setActive(!active);
|
93 |
+
}
|
94 |
+
if (isStandard() || active) {
|
95 |
+
emit triggered();
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
} /* QuickKeyboard */
|
100 |
+
|
data/quickvirtualkeyboard/ButtonItem.h
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef BUTTONITEM_H_VNF1QLCU
|
2 |
+
#define BUTTONITEM_H_VNF1QLCU
|
3 |
+
|
4 |
+
#include <QQuickItem>
|
5 |
+
#include <QStringList>
|
6 |
+
|
7 |
+
namespace QuickKeyboard
|
8 |
+
{
|
9 |
+
|
10 |
+
class ButtonItem: public QQuickItem
|
11 |
+
{
|
12 |
+
Q_OBJECT
|
13 |
+
Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged DESIGNABLE false)
|
14 |
+
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged DESIGNABLE false)
|
15 |
+
Q_PROPERTY(bool mouseDown READ isMouseDown WRITE setMouseDown NOTIFY mouseDownChanged DESIGNABLE false)
|
16 |
+
Q_PROPERTY(bool modifier MEMBER m_modifier READ isModifier NOTIFY modifierChanged DESIGNABLE false)
|
17 |
+
Q_PROPERTY(QString label MEMBER m_label READ label NOTIFY labelChanged)
|
18 |
+
Q_PROPERTY(QStringList symbols MEMBER m_symbols READ symbols NOTIFY symbolsChanged)
|
19 |
+
Q_PROPERTY(int currentSymbolIndex MEMBER m_currentSymbolIndex WRITE setCurrentSymbolIndex NOTIFY currentSymbolIndexChanged)
|
20 |
+
|
21 |
+
// position
|
22 |
+
Q_PROPERTY(int col MEMBER m_col NOTIFY colChanged)
|
23 |
+
Q_PROPERTY(int row MEMBER m_row NOTIFY rowChanged)
|
24 |
+
Q_PROPERTY(int colSpan MEMBER m_colSpan NOTIFY colSpanChanged)
|
25 |
+
Q_PROPERTY(int rowSpan MEMBER m_rowSpan NOTIFY rowSpanChanged)
|
26 |
+
public:
|
27 |
+
explicit ButtonItem(QQuickItem *parent = 0);
|
28 |
+
~ButtonItem();
|
29 |
+
|
30 |
+
bool isPressed() const { return m_active || m_mouseDown; };
|
31 |
+
bool isActive() const { return m_active; };
|
32 |
+
bool isMouseDown() const { return m_mouseDown; };
|
33 |
+
bool isModifier() const { return m_modifier; };
|
34 |
+
bool isStandard() const { return !m_modifier; };
|
35 |
+
QString label() const { return m_label; };
|
36 |
+
QStringList symbols() const { return m_symbols; };
|
37 |
+
|
38 |
+
void setActive(bool active);
|
39 |
+
void setMouseDown(bool mouseDown);
|
40 |
+
void setCurrentSymbolIndex(int currentSymbolIndex);
|
41 |
+
|
42 |
+
signals:
|
43 |
+
void pressedChanged(bool is_pressed);
|
44 |
+
void activeChanged(bool is_active);
|
45 |
+
void mouseDownChanged(bool mouseDown);
|
46 |
+
void modifierChanged(bool is_modifier);
|
47 |
+
void labelChanged(const QString &label);
|
48 |
+
void symbolsChanged(const QStringList &symbols);
|
49 |
+
|
50 |
+
void colChanged(int col);
|
51 |
+
void rowChanged(int row);
|
52 |
+
void colSpanChanged(int colSpan);
|
53 |
+
void rowSpanChanged(int rowSpan);
|
54 |
+
|
55 |
+
void currentSymbolIndexChanged(int index);
|
56 |
+
void triggered();
|
57 |
+
void released();
|
58 |
+
void symbolTriggered(const QString &symbol);
|
59 |
+
|
60 |
+
private slots:
|
61 |
+
void onSymbolsChanged();
|
62 |
+
void onTriggered();
|
63 |
+
void onReleased();
|
64 |
+
|
65 |
+
private:
|
66 |
+
bool m_active;
|
67 |
+
bool m_mouseDown;
|
68 |
+
bool m_modifier;
|
69 |
+
QString m_label;
|
70 |
+
QStringList m_symbols;
|
71 |
+
int m_col;
|
72 |
+
int m_row;
|
73 |
+
int m_colSpan;
|
74 |
+
int m_rowSpan;
|
75 |
+
int m_currentSymbolIndex;
|
76 |
+
}; /* ----- end of class ButtonItem ----- */
|
77 |
+
|
78 |
+
} /* QuickKeyboard */
|
79 |
+
|
80 |
+
#endif /* end of include guard: BUTTONITEM_H_VNF1QLCU */
|
81 |
+
|
data/quickvirtualkeyboard/COPYING
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2014, Miroslav Bendík and various contributors (see AUTHORS)
|
2 |
+
All rights reserved.
|
3 |
+
|
4 |
+
Redistribution and use in source and binary forms, with or without
|
5 |
+
modification, are permitted provided that the following conditions are met:
|
6 |
+
|
7 |
+
1. Redistributions of source code must retain the above copyright notice, this
|
8 |
+
list of conditions and the following disclaimer.
|
9 |
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10 |
+
this list of conditions and the following disclaimer in the documentation
|
11 |
+
and/or other materials provided with the distribution.
|
12 |
+
|
13 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
17 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
18 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
19 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
20 |
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
21 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
22 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23 |
+
|
24 |
+
The views and conclusions contained in the software and documentation are those
|
25 |
+
of the authors and should not be interpreted as representing official policies,
|
26 |
+
either expressed or implied, of the FreeBSD Project.
|
27 |
+
|
data/quickvirtualkeyboard/Dispatcher.cpp
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <QGuiApplication>
|
2 |
+
#include <QInputMethodEvent>
|
3 |
+
#include <QKeyEvent>
|
4 |
+
#include <QQuickItem>
|
5 |
+
#include <QQuickWindow>
|
6 |
+
#include <QWindow>
|
7 |
+
#include "Dispatcher.h"
|
8 |
+
|
9 |
+
namespace QuickKeyboard
|
10 |
+
{
|
11 |
+
|
12 |
+
Dispatcher::Dispatcher(QObject *parent):
|
13 |
+
QObject(parent),
|
14 |
+
m_focusObject(0),
|
15 |
+
m_sendReturnKey(false)
|
16 |
+
{
|
17 |
+
}
|
18 |
+
|
19 |
+
Dispatcher::~Dispatcher()
|
20 |
+
{
|
21 |
+
}
|
22 |
+
|
23 |
+
QObject *Dispatcher::focusObject() const
|
24 |
+
{
|
25 |
+
return m_focusObject;
|
26 |
+
}
|
27 |
+
|
28 |
+
void Dispatcher::setFocusObject(QObject *focusObject)
|
29 |
+
{
|
30 |
+
m_focusObject = focusObject;
|
31 |
+
}
|
32 |
+
|
33 |
+
void Dispatcher::sendSymbol(const QString &symbol)
|
34 |
+
{
|
35 |
+
if (!m_focusObject) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
QInputMethodEvent ev;
|
40 |
+
if (symbol == QString("\x7f")) { // backspace
|
41 |
+
ev.setCommitString("", -1, 1);
|
42 |
+
}
|
43 |
+
else if (m_sendReturnKey && symbol == QString("\n")) {
|
44 |
+
QWindow *window = 0;
|
45 |
+
|
46 |
+
QQuickItem *quickItem = qobject_cast<QQuickItem *>(m_focusObject);
|
47 |
+
if (quickItem) {
|
48 |
+
window = quickItem->window();
|
49 |
+
}
|
50 |
+
|
51 |
+
if (window) {
|
52 |
+
QKeyEvent *press = new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
|
53 |
+
QGuiApplication::postEvent(window, press);
|
54 |
+
QKeyEvent *release = new QKeyEvent(QKeyEvent::KeyRelease, Qt::Key_Return, Qt::NoModifier);
|
55 |
+
QGuiApplication::postEvent(window, release);
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
else {
|
59 |
+
ev.setCommitString(symbol);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
else {
|
63 |
+
ev.setCommitString(symbol);
|
64 |
+
}
|
65 |
+
QCoreApplication::sendEvent(m_focusObject, &ev);
|
66 |
+
}
|
67 |
+
|
68 |
+
} /* QuickKeyboard */
|
69 |
+
|
data/quickvirtualkeyboard/Dispatcher.h
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef DISPATCHER_H_4JJ7SBUO
|
2 |
+
#define DISPATCHER_H_4JJ7SBUO
|
3 |
+
|
4 |
+
#include <QObject>
|
5 |
+
|
6 |
+
namespace QuickKeyboard
|
7 |
+
{
|
8 |
+
|
9 |
+
class Dispatcher: public QObject
|
10 |
+
{
|
11 |
+
Q_OBJECT
|
12 |
+
Q_PROPERTY(bool sendReturnKey MEMBER m_sendReturnKey)
|
13 |
+
public:
|
14 |
+
explicit Dispatcher(QObject *parent = 0);
|
15 |
+
~Dispatcher();
|
16 |
+
QObject *focusObject() const;
|
17 |
+
|
18 |
+
public slots:
|
19 |
+
void setFocusObject(QObject *focusObject);
|
20 |
+
virtual void sendSymbol(const QString &symbol);
|
21 |
+
|
22 |
+
private:
|
23 |
+
QObject *m_focusObject;
|
24 |
+
bool m_sendReturnKey;
|
25 |
+
}; /* ----- end of class Dispatcher ----- */
|
26 |
+
|
27 |
+
} /* QuickKeyboard */
|
28 |
+
|
29 |
+
#endif /* end of include guard: DISPATCHER_H_4JJ7SBUO */
|
30 |
+
|
data/quickvirtualkeyboard/GridLayoutItem.cpp
ADDED
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <QtGlobal>
|
2 |
+
#include <QQuickWindow>
|
3 |
+
#include "ButtonItem.h"
|
4 |
+
#include "ModeItem.h"
|
5 |
+
#include "GridLayoutItem.h"
|
6 |
+
|
7 |
+
namespace QuickKeyboard
|
8 |
+
{
|
9 |
+
|
10 |
+
GridLayoutItemAttached::GridLayoutItemAttached(QObject *parent):
|
11 |
+
QObject(parent),
|
12 |
+
m_col(0),
|
13 |
+
m_row(0),
|
14 |
+
m_colSpan(1),
|
15 |
+
m_rowSpan(1)
|
16 |
+
{
|
17 |
+
}
|
18 |
+
|
19 |
+
GridLayoutItemAttached::~GridLayoutItemAttached()
|
20 |
+
{
|
21 |
+
}
|
22 |
+
|
23 |
+
GridLayoutItem *GridLayoutItemAttached::layout() const
|
24 |
+
{
|
25 |
+
QObject *predecessor = parent();
|
26 |
+
ModeItem *mode = 0;
|
27 |
+
while (predecessor != 0) {
|
28 |
+
predecessor = predecessor->parent();
|
29 |
+
mode = qobject_cast<ModeItem *>(predecessor);
|
30 |
+
if (mode) {
|
31 |
+
return qobject_cast<GridLayoutItem *>(mode->layout());
|
32 |
+
}
|
33 |
+
}
|
34 |
+
return 0;
|
35 |
+
}
|
36 |
+
|
37 |
+
GridLayoutItem::GridLayoutItem(QQuickItem *parent):
|
38 |
+
LayoutItem(parent),
|
39 |
+
m_autoSize(true)
|
40 |
+
{
|
41 |
+
setFlag(QQuickItem::ItemHasContents);
|
42 |
+
setAcceptedMouseButtons(Qt::LeftButton);
|
43 |
+
setZ(1);
|
44 |
+
m_touchPositions << QPointF();
|
45 |
+
}
|
46 |
+
|
47 |
+
GridLayoutItem::~GridLayoutItem()
|
48 |
+
{
|
49 |
+
}
|
50 |
+
|
51 |
+
void GridLayoutItem::addButton(ButtonItem *button)
|
52 |
+
{
|
53 |
+
LayoutItem::addButton(button);
|
54 |
+
connect(button, SIGNAL(triggered()), this, SLOT(synchronizeMouseDownPoints()));
|
55 |
+
}
|
56 |
+
|
57 |
+
void GridLayoutItem::clearButtons()
|
58 |
+
{
|
59 |
+
for (const ButtonItem *button : buttons()) {
|
60 |
+
QObject *layoutAttached = qmlAttachedPropertiesObject<GridLayoutItem>(button);
|
61 |
+
if (layoutAttached) {
|
62 |
+
disconnect(button, SIGNAL(triggered()), this, SLOT(synchronizeMouseDownPoints()));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
LayoutItem::clearButtons();
|
66 |
+
}
|
67 |
+
|
68 |
+
void GridLayoutItem::setRowLength(QList<int> rows)
|
69 |
+
{
|
70 |
+
m_autoSize = false;
|
71 |
+
m_rowLengths = rows;
|
72 |
+
}
|
73 |
+
|
74 |
+
GridLayoutItemAttached *GridLayoutItem::qmlAttachedProperties(QObject *object)
|
75 |
+
{
|
76 |
+
return new GridLayoutItemAttached(object);
|
77 |
+
}
|
78 |
+
|
79 |
+
void GridLayoutItem::redirectEventsToItem(QQuickItem *item)
|
80 |
+
{
|
81 |
+
if (!item) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
if (!m_touchPositions[0].isNull()) {
|
86 |
+
ungrabMouse();
|
87 |
+
QMouseEvent pressEvent(QMouseEvent::MouseButtonPress, QPointF(0, 0), Qt::LeftButton, Qt::LeftButton, 0);
|
88 |
+
QCoreApplication::sendEvent(item, &pressEvent);
|
89 |
+
item->grabMouse();
|
90 |
+
}
|
91 |
+
if (!m_touchPoints.isEmpty()) {
|
92 |
+
ungrabTouchPoints();
|
93 |
+
|
94 |
+
QVector<int> ids;
|
95 |
+
for (const QTouchEvent::TouchPoint &point : m_touchPoints) {
|
96 |
+
ids << point.id();
|
97 |
+
}
|
98 |
+
|
99 |
+
QTouchEvent touchEvent(
|
100 |
+
QEvent::TouchBegin,
|
101 |
+
(QTouchDevice *)QTouchDevice::devices().first(),
|
102 |
+
Qt::NoModifier,
|
103 |
+
Qt::TouchPointPressed,
|
104 |
+
m_touchPoints
|
105 |
+
);
|
106 |
+
|
107 |
+
QCoreApplication::sendEvent(item, &touchEvent);
|
108 |
+
item->grabTouchPoints(ids);
|
109 |
+
}
|
110 |
+
|
111 |
+
m_touchPositions.clear();
|
112 |
+
m_touchPositions << QPointF();
|
113 |
+
m_touchPoints.clear();
|
114 |
+
}
|
115 |
+
|
116 |
+
void GridLayoutItem::triggerOnPosition(const QPointF &point)
|
117 |
+
{
|
118 |
+
for (ButtonItem *button : buttons()) {
|
119 |
+
if (checkButtonAtPoint(button, point)) {
|
120 |
+
emit button->released();
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
void GridLayoutItem::setMousePosition(const QPointF &position)
|
126 |
+
{
|
127 |
+
m_touchPositions[0] = position;
|
128 |
+
synchronizeMouseDownPoints();
|
129 |
+
}
|
130 |
+
|
131 |
+
void GridLayoutItem::setTouchPositions(const QList<QPointF> &positions)
|
132 |
+
{
|
133 |
+
m_touchPositions = QList<QPointF>() << m_touchPositions[0];
|
134 |
+
m_touchPositions += positions;
|
135 |
+
synchronizeMouseDownPoints();
|
136 |
+
}
|
137 |
+
|
138 |
+
bool GridLayoutItem::checkMouseDown(const ButtonItem *button) const
|
139 |
+
{
|
140 |
+
for (const QPointF &point : m_touchPositions) {
|
141 |
+
if (!point.isNull()) {
|
142 |
+
if (checkButtonAtPoint(button, point)) {
|
143 |
+
return true;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
inline bool GridLayoutItem::checkButtonAtPoint(const ButtonItem *button, const QPointF &point)
|
151 |
+
{
|
152 |
+
QPointF mapped = point - QPointF(button->x(), button->y());
|
153 |
+
if (mapped.x() >= 0.0f && mapped.y() >= 0.0f && mapped.x() < button->width() && mapped.y() < button->height()) {
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
|
159 |
+
void GridLayoutItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
|
160 |
+
{
|
161 |
+
LayoutItem::geometryChanged(newGeometry, oldGeometry);
|
162 |
+
int width = property("width").toInt();
|
163 |
+
int height = property("height").toInt();
|
164 |
+
|
165 |
+
if (!width || !height) return;
|
166 |
+
|
167 |
+
hCenter = width / 2;
|
168 |
+
vCenter = height / 2;
|
169 |
+
recalculatePositions();
|
170 |
+
}
|
171 |
+
|
172 |
+
void GridLayoutItem::touchEvent(QTouchEvent *event)
|
173 |
+
{
|
174 |
+
QVector<QPointF> points;
|
175 |
+
m_touchPoints = event->touchPoints();
|
176 |
+
points.reserve(m_touchPoints.length());
|
177 |
+
for (const QTouchEvent::TouchPoint &point : m_touchPoints) {
|
178 |
+
points << point.pos();
|
179 |
+
}
|
180 |
+
setTouchPositions(points.toList());
|
181 |
+
|
182 |
+
QVector<QPointF> pointsAfterRelease;
|
183 |
+
pointsAfterRelease.reserve(m_touchPoints.length());
|
184 |
+
|
185 |
+
for (const QTouchEvent::TouchPoint &point : m_touchPoints) {
|
186 |
+
if (point.state() == Qt::TouchPointReleased) {
|
187 |
+
pointsAfterRelease << QPointF();
|
188 |
+
triggerOnPosition(point.pos());
|
189 |
+
}
|
190 |
+
else {
|
191 |
+
pointsAfterRelease << point.pos().toPoint();
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
if (points != pointsAfterRelease) {
|
196 |
+
setTouchPositions(pointsAfterRelease.toList());
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
void GridLayoutItem::mouseMoveEvent(QMouseEvent *event)
|
201 |
+
{
|
202 |
+
QPointF scenePos = QPointF(event->x(), event->y());
|
203 |
+
setMousePosition(scenePos);
|
204 |
+
}
|
205 |
+
|
206 |
+
void GridLayoutItem::mousePressEvent(QMouseEvent *event)
|
207 |
+
{
|
208 |
+
QPointF scenePos = QPointF(event->x(), event->y());
|
209 |
+
setMousePosition(scenePos);
|
210 |
+
}
|
211 |
+
|
212 |
+
void GridLayoutItem::mouseReleaseEvent(QMouseEvent *event)
|
213 |
+
{
|
214 |
+
QPointF scenePos = QPointF(event->x(), event->y());
|
215 |
+
triggerOnPosition(scenePos);
|
216 |
+
setMousePosition(QPointF());
|
217 |
+
}
|
218 |
+
|
219 |
+
int GridLayoutItem::layoutProperty(const ButtonItem *button, const char *property, int fallback)
|
220 |
+
{
|
221 |
+
QObject *layoutAttached = qmlAttachedPropertiesObject<GridLayoutItem>(button);
|
222 |
+
if (!layoutAttached) {
|
223 |
+
return fallback;
|
224 |
+
}
|
225 |
+
return layoutAttached->property(property).toInt();
|
226 |
+
}
|
227 |
+
|
228 |
+
void GridLayoutItem::recalculatePositions()
|
229 |
+
{
|
230 |
+
int w = 52;
|
231 |
+
int h = 52;
|
232 |
+
int gap = 5;
|
233 |
+
|
234 |
+
QList<int> offsets = m_rowLengths;
|
235 |
+
for (int i = 0; i < offsets.size(); i++) {
|
236 |
+
if (offsets[i] == 0) continue;
|
237 |
+
|
238 |
+
offsets[i] = (1404 - (offsets[i] * w + (offsets[i] - 2) * gap )) / 2;
|
239 |
+
}
|
240 |
+
|
241 |
+
for (ButtonItem *button : buttons()) {
|
242 |
+
QObject *layoutAttached = qmlAttachedPropertiesObject<GridLayoutItem>(button);
|
243 |
+
if (!layoutAttached) {
|
244 |
+
continue;
|
245 |
+
}
|
246 |
+
|
247 |
+
int left = layoutAttached->property("col").toInt();
|
248 |
+
int top = layoutAttached->property("row").toInt();
|
249 |
+
int width = layoutAttached->property("colSpan").toInt() * w;
|
250 |
+
int height = layoutAttached->property("rowSpan").toInt() * h;
|
251 |
+
|
252 |
+
int x = left * (w + gap);
|
253 |
+
int y = top * (h + gap);
|
254 |
+
|
255 |
+
x += offsets[top];
|
256 |
+
|
257 |
+
button->setProperty("x", x);
|
258 |
+
button->setProperty("y", y);
|
259 |
+
button->setProperty("width", width);
|
260 |
+
button->setProperty("height", height);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
void GridLayoutItem::synchronizeMouseDownPoints()
|
265 |
+
{
|
266 |
+
for (auto button : buttons()) {
|
267 |
+
bool pointMouseDown = checkMouseDown(button);
|
268 |
+
if (button->isMouseDown() != pointMouseDown) {
|
269 |
+
button->setMouseDown(pointMouseDown);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
} /* QuickKeyboard */
|
275 |
+
|
data/quickvirtualkeyboard/GridLayoutItem.h
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef GRIDLAYOUTITEM_H_KEQWS1DN
|
2 |
+
#define GRIDLAYOUTITEM_H_KEQWS1DN
|
3 |
+
|
4 |
+
|
5 |
+
#include <QList>
|
6 |
+
#include "LayoutItem.h"
|
7 |
+
|
8 |
+
namespace QuickKeyboard
|
9 |
+
{
|
10 |
+
|
11 |
+
class GridLayoutItem;
|
12 |
+
|
13 |
+
class GridLayoutItemAttached: public QObject
|
14 |
+
{
|
15 |
+
Q_OBJECT
|
16 |
+
Q_PROPERTY(int col MEMBER m_col NOTIFY colChanged)
|
17 |
+
Q_PROPERTY(int row MEMBER m_row NOTIFY rowChanged)
|
18 |
+
Q_PROPERTY(int colSpan MEMBER m_colSpan NOTIFY colSpanChanged)
|
19 |
+
Q_PROPERTY(int rowSpan MEMBER m_rowSpan NOTIFY rowSpanChanged)
|
20 |
+
Q_PROPERTY(QuickKeyboard::GridLayoutItem *layout READ layout)
|
21 |
+
public:
|
22 |
+
explicit GridLayoutItemAttached(QObject *parent = 0);
|
23 |
+
~GridLayoutItemAttached();
|
24 |
+
GridLayoutItem *layout() const;
|
25 |
+
|
26 |
+
signals:
|
27 |
+
void colChanged(int col);
|
28 |
+
void rowChanged(int row);
|
29 |
+
void colSpanChanged(int colSpan);
|
30 |
+
void rowSpanChanged(int rowSpan);
|
31 |
+
|
32 |
+
private:
|
33 |
+
int m_col;
|
34 |
+
int m_row;
|
35 |
+
int m_colSpan;
|
36 |
+
int m_rowSpan;
|
37 |
+
}; /* ----- end of class GridLayoutItemAttached ----- */
|
38 |
+
|
39 |
+
|
40 |
+
class GridLayoutItem: public LayoutItem
|
41 |
+
{
|
42 |
+
Q_OBJECT
|
43 |
+
Q_PROPERTY(QList<int> rowLengths MEMBER m_rowLengths WRITE setRowLength NOTIFY rowLengthChanged)
|
44 |
+
public:
|
45 |
+
explicit GridLayoutItem(QQuickItem *parent = 0);
|
46 |
+
~GridLayoutItem();
|
47 |
+
|
48 |
+
void addButton(ButtonItem *button);
|
49 |
+
void clearButtons();
|
50 |
+
|
51 |
+
void setRowLength(QList<int> rows);
|
52 |
+
|
53 |
+
static GridLayoutItemAttached *qmlAttachedProperties(QObject *object);
|
54 |
+
|
55 |
+
public slots:
|
56 |
+
void redirectEventsToItem(QQuickItem *item);
|
57 |
+
|
58 |
+
private:
|
59 |
+
void triggerOnPosition(const QPointF &point);
|
60 |
+
|
61 |
+
void setMousePosition(const QPointF &position);
|
62 |
+
void setTouchPositions(const QList<QPointF> &positions);
|
63 |
+
|
64 |
+
bool checkMouseDown(const ButtonItem *button) const;
|
65 |
+
|
66 |
+
static bool checkButtonAtPoint(const ButtonItem *button, const QPointF &point);
|
67 |
+
|
68 |
+
signals:
|
69 |
+
void colsChanged(int cols);
|
70 |
+
void rowsChanged(int rows);
|
71 |
+
void rowLengthChanged(QList<int> lengths);
|
72 |
+
|
73 |
+
protected:
|
74 |
+
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
75 |
+
virtual void touchEvent(QTouchEvent *event);
|
76 |
+
virtual void mouseMoveEvent(QMouseEvent *event);
|
77 |
+
virtual void mousePressEvent(QMouseEvent *event);
|
78 |
+
virtual void mouseReleaseEvent(QMouseEvent *event);
|
79 |
+
|
80 |
+
private:
|
81 |
+
static int layoutProperty(const ButtonItem *button, const char *property, int fallback);
|
82 |
+
|
83 |
+
private slots:
|
84 |
+
void recalculatePositions();
|
85 |
+
void synchronizeMouseDownPoints();
|
86 |
+
|
87 |
+
private:
|
88 |
+
bool m_autoSize;
|
89 |
+
QList<int> m_rowLengths;
|
90 |
+
int hCenter;
|
91 |
+
int vCenter;
|
92 |
+
|
93 |
+
QList<QPointF> m_touchPositions;
|
94 |
+
QList<QTouchEvent::TouchPoint> m_touchPoints;
|
95 |
+
}; /* ----- end of class GridLayoutItem ----- */
|
96 |
+
|
97 |
+
} /* QuickKeyboard */
|
98 |
+
|
99 |
+
QML_DECLARE_TYPEINFO(QuickKeyboard::GridLayoutItem, QML_HAS_ATTACHED_PROPERTIES)
|
100 |
+
|
101 |
+
#endif /* end of include guard: GRIDLAYOUTITEM_H_KEQWS1DN */
|
102 |
+
|
data/quickvirtualkeyboard/KeyboardItem.cpp
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include "Dispatcher.h"
|
2 |
+
#include "ModeItem.h"
|
3 |
+
#include "KeyboardItem.h"
|
4 |
+
|
5 |
+
namespace QuickKeyboard
|
6 |
+
{
|
7 |
+
|
8 |
+
KeyboardItem::KeyboardItem(QQuickItem *parent):
|
9 |
+
QQuickItem(parent),
|
10 |
+
m_mode(0),
|
11 |
+
m_dispatcher(new Dispatcher(this))
|
12 |
+
{
|
13 |
+
setObjectName("QuickKeyboard");
|
14 |
+
}
|
15 |
+
|
16 |
+
KeyboardItem::~KeyboardItem()
|
17 |
+
{
|
18 |
+
}
|
19 |
+
|
20 |
+
void KeyboardItem::setMode(ModeItem *mode)
|
21 |
+
{
|
22 |
+
if (m_mode == mode) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
|
26 |
+
if (m_mode) {
|
27 |
+
m_mode->setVisible(false);
|
28 |
+
disconnect(m_mode, SIGNAL(symbolTriggered(const QString &)), this, SLOT(onSymbolTriggered(const QString &)));
|
29 |
+
}
|
30 |
+
|
31 |
+
m_mode = mode;
|
32 |
+
if (mode) {
|
33 |
+
mode->setVisible(true);
|
34 |
+
connect(mode, SIGNAL(symbolTriggered(const QString &)), this, SLOT(onSymbolTriggered(const QString &)));
|
35 |
+
}
|
36 |
+
emit modeChanged(m_mode);
|
37 |
+
}
|
38 |
+
|
39 |
+
Dispatcher *KeyboardItem::dispatcher() const
|
40 |
+
{
|
41 |
+
return m_dispatcher;
|
42 |
+
}
|
43 |
+
|
44 |
+
void KeyboardItem::onSymbolTriggered(const QString &symbol)
|
45 |
+
{
|
46 |
+
if (!m_dispatcher) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
m_dispatcher->sendSymbol(symbol);
|
51 |
+
}
|
52 |
+
|
53 |
+
} /* QuickKeyboard */
|
54 |
+
|
data/quickvirtualkeyboard/KeyboardItem.h
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef KEYBOARDITEM_H_PT4SCIAV
|
2 |
+
#define KEYBOARDITEM_H_PT4SCIAV
|
3 |
+
|
4 |
+
#include <QQuickItem>
|
5 |
+
#include <QList>
|
6 |
+
|
7 |
+
namespace QuickKeyboard
|
8 |
+
{
|
9 |
+
|
10 |
+
class ModeItem;
|
11 |
+
class Dispatcher;
|
12 |
+
|
13 |
+
class KeyboardItem: public QQuickItem
|
14 |
+
{
|
15 |
+
Q_OBJECT
|
16 |
+
Q_PROPERTY(QuickKeyboard::ModeItem* mode MEMBER m_mode WRITE setMode NOTIFY modeChanged DESIGNABLE false)
|
17 |
+
Q_PROPERTY(QuickKeyboard::Dispatcher* dispatcher READ dispatcher MEMBER m_dispatcher)
|
18 |
+
public:
|
19 |
+
explicit KeyboardItem(QQuickItem *parent = 0);
|
20 |
+
~KeyboardItem();
|
21 |
+
|
22 |
+
void setMode(ModeItem *mode);
|
23 |
+
Dispatcher *dispatcher() const;
|
24 |
+
|
25 |
+
signals:
|
26 |
+
void modeChanged(ModeItem *mode);
|
27 |
+
|
28 |
+
private slots:
|
29 |
+
void onSymbolTriggered(const QString &symbol);
|
30 |
+
|
31 |
+
private:
|
32 |
+
ModeItem *m_mode;
|
33 |
+
Dispatcher *m_dispatcher;
|
34 |
+
}; /* ----- end of class KeyboardItem ----- */
|
35 |
+
|
36 |
+
} /* QuickKeyboard */
|
37 |
+
|
38 |
+
#endif /* end of include guard: KEYBOARDITEM_H_PT4SCIAV */
|
39 |
+
|
data/quickvirtualkeyboard/LayoutItem.cpp
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include "ButtonItem.h"
|
2 |
+
#include "LayoutItem.h"
|
3 |
+
|
4 |
+
namespace QuickKeyboard
|
5 |
+
{
|
6 |
+
|
7 |
+
LayoutItem::LayoutItem(QQuickItem *parent):
|
8 |
+
QQuickItem(parent)
|
9 |
+
{
|
10 |
+
}
|
11 |
+
|
12 |
+
LayoutItem::~LayoutItem()
|
13 |
+
{
|
14 |
+
}
|
15 |
+
|
16 |
+
void LayoutItem::addButton(ButtonItem *button)
|
17 |
+
{
|
18 |
+
m_buttons.append(button);
|
19 |
+
}
|
20 |
+
|
21 |
+
void LayoutItem::clearButtons()
|
22 |
+
{
|
23 |
+
m_buttons.clear();
|
24 |
+
}
|
25 |
+
|
26 |
+
const QList<ButtonItem *> &LayoutItem::buttons() const
|
27 |
+
{
|
28 |
+
return m_buttons;
|
29 |
+
}
|
30 |
+
|
31 |
+
} /* QuickKeyboard */
|
32 |
+
|
data/quickvirtualkeyboard/LayoutItem.h
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef LAYOUTITEM_H_ZHXO0UI7
|
2 |
+
#define LAYOUTITEM_H_ZHXO0UI7
|
3 |
+
|
4 |
+
#include <QQuickItem>
|
5 |
+
#include <QList>
|
6 |
+
|
7 |
+
namespace QuickKeyboard
|
8 |
+
{
|
9 |
+
|
10 |
+
class ButtonItem;
|
11 |
+
|
12 |
+
class LayoutItem: public QQuickItem
|
13 |
+
{
|
14 |
+
Q_OBJECT
|
15 |
+
public:
|
16 |
+
explicit LayoutItem(QQuickItem *parent = 0);
|
17 |
+
~LayoutItem();
|
18 |
+
|
19 |
+
virtual void addButton(ButtonItem *button);
|
20 |
+
virtual void clearButtons();
|
21 |
+
|
22 |
+
protected:
|
23 |
+
const QList<ButtonItem *> &buttons() const;
|
24 |
+
|
25 |
+
private:
|
26 |
+
QList<ButtonItem *> m_buttons;
|
27 |
+
}; /* ----- end of class LayoutItem ----- */
|
28 |
+
|
29 |
+
} /* QuickKeyboard */
|
30 |
+
|
31 |
+
#endif /* end of include guard: LAYOUTITEM_H_ZHXO0UI7 */
|
32 |
+
|
data/quickvirtualkeyboard/ModeItem.cpp
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <QChildEvent>
|
2 |
+
#include "ButtonItem.h"
|
3 |
+
#include "GridLayoutItem.h"
|
4 |
+
#include "ModeItem.h"
|
5 |
+
|
6 |
+
namespace QuickKeyboard
|
7 |
+
{
|
8 |
+
|
9 |
+
ModeItem::ModeItem(QQuickItem *parent):
|
10 |
+
QQuickItem(parent),
|
11 |
+
m_layout(0)
|
12 |
+
{
|
13 |
+
setVisible(false);
|
14 |
+
setLayout(new GridLayoutItem());
|
15 |
+
}
|
16 |
+
|
17 |
+
ModeItem::~ModeItem()
|
18 |
+
{
|
19 |
+
}
|
20 |
+
|
21 |
+
LayoutItem *ModeItem::layout() const
|
22 |
+
{
|
23 |
+
return m_layout;
|
24 |
+
}
|
25 |
+
|
26 |
+
void ModeItem::setLayout(LayoutItem *layout)
|
27 |
+
{
|
28 |
+
if (m_layout == layout) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
if (m_layout) {
|
33 |
+
m_layout->setParentItem(0);
|
34 |
+
delete m_layout;
|
35 |
+
}
|
36 |
+
|
37 |
+
if (layout) {
|
38 |
+
layout->setParentItem(this);
|
39 |
+
for (ButtonItem *button : m_buttons) {
|
40 |
+
m_layout->addButton(button);
|
41 |
+
}
|
42 |
+
layout->property("anchors").value<QObject *>()->setProperty("fill", QVariant::fromValue<QQuickItem *>(this));
|
43 |
+
}
|
44 |
+
m_layout = layout;
|
45 |
+
}
|
46 |
+
|
47 |
+
QQmlListProperty<ButtonItem> ModeItem::buttons()
|
48 |
+
{
|
49 |
+
return QQmlListProperty<ButtonItem>(
|
50 |
+
this,
|
51 |
+
&m_buttons,
|
52 |
+
&ModeItem::buttons_append,
|
53 |
+
&ModeItem::buttons_count,
|
54 |
+
&ModeItem::buttons_at,
|
55 |
+
&ModeItem::buttons_clear
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
void ModeItem::buttons_append(QQmlListProperty<ButtonItem> *property, ButtonItem *button)
|
60 |
+
{
|
61 |
+
ModeItem *that = static_cast<ModeItem *>(property->object);
|
62 |
+
button->setParentItem(that);
|
63 |
+
that->m_buttons.append(button);
|
64 |
+
if (that->m_layout) {
|
65 |
+
that->m_layout->addButton(button);
|
66 |
+
}
|
67 |
+
QObject::connect(button, SIGNAL(symbolTriggered(const QString &)), that, SIGNAL(symbolTriggered(const QString &)));
|
68 |
+
QObject::connect(button, SIGNAL(triggered()), that, SLOT(setModifiersInactive()));
|
69 |
+
}
|
70 |
+
|
71 |
+
int ModeItem::buttons_count(QQmlListProperty<ButtonItem> *property)
|
72 |
+
{
|
73 |
+
ModeItem *that = static_cast<ModeItem *>(property->object);
|
74 |
+
return that->m_buttons.count();
|
75 |
+
}
|
76 |
+
|
77 |
+
ButtonItem *ModeItem::buttons_at(QQmlListProperty<ButtonItem> *property, int idx)
|
78 |
+
{
|
79 |
+
ModeItem *that = static_cast<ModeItem *>(property->object);
|
80 |
+
return that->m_buttons.value(idx, 0);
|
81 |
+
}
|
82 |
+
|
83 |
+
void ModeItem::buttons_clear(QQmlListProperty<ButtonItem> *property)
|
84 |
+
{
|
85 |
+
ModeItem *that = static_cast<ModeItem *>(property->object);
|
86 |
+
if (that->m_layout) {
|
87 |
+
that->m_layout->clearButtons();
|
88 |
+
}
|
89 |
+
for (ButtonItem *button : that->m_buttons) {
|
90 |
+
QObject::disconnect(button, SIGNAL(symbolTriggered(const QString &)), that, SIGNAL(symbolTriggered(const QString &)));
|
91 |
+
QObject::disconnect(button, SIGNAL(triggered()), that, SLOT(setModifiersInactive()));
|
92 |
+
button->setParentItem(0);
|
93 |
+
}
|
94 |
+
that->m_buttons.clear();
|
95 |
+
}
|
96 |
+
|
97 |
+
void ModeItem::itemChange(ItemChange change, const ItemChangeData &value)
|
98 |
+
{
|
99 |
+
QQuickItem::itemChange(change, value);
|
100 |
+
if (change == QQuickItem::ItemVisibleHasChanged && !isVisible()) {
|
101 |
+
setModifiersInactive();
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
void ModeItem::setModifiersInactive()
|
106 |
+
{
|
107 |
+
for (ButtonItem *button : m_buttons) {
|
108 |
+
if (button->isModifier()) {
|
109 |
+
button->setActive(false);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
} /* QuickKeyboard */
|
115 |
+
|
data/quickvirtualkeyboard/ModeItem.h
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ifndef MODEITEM_H_6ZH81LSX
|
2 |
+
#define MODEITEM_H_6ZH81LSX
|
3 |
+
|
4 |
+
#include <QQuickItem>
|
5 |
+
#include <QList>
|
6 |
+
|
7 |
+
namespace QuickKeyboard
|
8 |
+
{
|
9 |
+
|
10 |
+
class ButtonItem;
|
11 |
+
class LayoutItem;
|
12 |
+
|
13 |
+
class ModeItem: public QQuickItem
|
14 |
+
{
|
15 |
+
Q_OBJECT
|
16 |
+
Q_PROPERTY(QuickKeyboard::LayoutItem* layout READ layout WRITE setLayout NOTIFY layoutChanged)
|
17 |
+
Q_PROPERTY(QQmlListProperty<QuickKeyboard::ButtonItem> buttons READ buttons DESIGNABLE false)
|
18 |
+
Q_CLASSINFO("DefaultProperty", "buttons")
|
19 |
+
public:
|
20 |
+
explicit ModeItem(QQuickItem *parent = 0);
|
21 |
+
~ModeItem();
|
22 |
+
|
23 |
+
// layout property
|
24 |
+
LayoutItem *layout() const;
|
25 |
+
void setLayout(LayoutItem *layout);
|
26 |
+
|
27 |
+
// buttons property
|
28 |
+
QQmlListProperty<ButtonItem> buttons();
|
29 |
+
static void buttons_append(QQmlListProperty<ButtonItem> *property, ButtonItem *mode);
|
30 |
+
static int buttons_count(QQmlListProperty<ButtonItem> *property);
|
31 |
+
static ButtonItem *buttons_at(QQmlListProperty<ButtonItem> *property, int idx);
|
32 |
+
static void buttons_clear(QQmlListProperty<ButtonItem> *property);
|
33 |
+
|
34 |
+
signals:
|
35 |
+
void layoutChanged(LayoutItem *layout);
|
36 |
+
void colsChanged(int cols);
|
37 |
+
void rowsChanged(int rows);
|
38 |
+
void symbolTriggered(const QString &symbol);
|
39 |
+
|
40 |
+
protected:
|
41 |
+
virtual void itemChange(ItemChange change, const ItemChangeData &value);
|
42 |
+
|
43 |
+
private slots:
|
44 |
+
void setModifiersInactive();
|
45 |
+
|
46 |
+
private:
|
47 |
+
LayoutItem *m_layout;
|
48 |
+
QList<ButtonItem *> m_buttons;
|
49 |
+
int m_cols;
|
50 |
+
int m_rows;
|
51 |
+
}; /* ----- end of class ModeItem ----- */
|
52 |
+
|
53 |
+
} /* QuickKeyboard */
|
54 |
+
|
55 |
+
#endif /* end of include guard: MODEITEM_H_6ZH81LSX */
|
56 |
+
|
data/quickvirtualkeyboard/components.pri
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
HEADERS += \
|
2 |
+
$$PWD/ButtonItem.h \
|
3 |
+
$$PWD/Dispatcher.h \
|
4 |
+
$$PWD/GridLayoutItem.h \
|
5 |
+
$$PWD/KeyboardItem.h \
|
6 |
+
$$PWD/LayoutItem.h \
|
7 |
+
$$PWD/ModeItem.h \
|
8 |
+
$$PWD/register.h
|
9 |
+
SOURCES += \
|
10 |
+
$$PWD/ButtonItem.cpp \
|
11 |
+
$$PWD/Dispatcher.cpp \
|
12 |
+
$$PWD/GridLayoutItem.cpp \
|
13 |
+
$$PWD/KeyboardItem.cpp \
|
14 |
+
$$PWD/LayoutItem.cpp \
|
15 |
+
$$PWD/ModeItem.cpp
|
data/quickvirtualkeyboard/png/backspaceblack.png
ADDED
Git LFS Details
|
data/quickvirtualkeyboard/png/backspacewhite.png
ADDED
Git LFS Details
|
data/quickvirtualkeyboard/png/shiftblack.png
ADDED
Git LFS Details
|
data/quickvirtualkeyboard/png/shiftwhite.png
ADDED
Git LFS Details
|