Merge tag 'upstream/0.1.6'
Upstream version 0.1.6
# gpg: Signature made Mon 30 Nov 2015 00:32:24 GMT using RSA key ID F1C09EFB
# gpg: Good signature from "Alejandro Garrido Mota (mogaal) <garridomota@gmail.com>"
# gpg: aka "Alejandro Garrido Mota (mogaal) <mogaal@cpan.org>"
# gpg: aka "Alejandro Garrido Mota <alejandro@debian.org>"
Alejandro Garrido Mota
8 years ago
0 | #!/usr/bin/env xdg-open | |
1 | [Desktop Entry] | |
2 | Name=2048-Qt | |
3 | GenericName=2048-Qt | |
4 | Comment=The 2048 number game implemented in Qt | |
5 | Exec=2048-qt | |
6 | Icon=2048-qt | |
7 | Terminal=false | |
8 | Type=Application | |
9 | Categories=Game;Math;Qt; |
1 | 1 | |
2 | 2 | QT += qml quick widgets |
3 | 3 | |
4 | SOURCES += main.cpp \ | |
5 | myclass.cpp \ | |
6 | settings.cpp | |
4 | SOURCES += \ | |
5 | src/main.cpp \ | |
6 | src/myclass.cpp \ | |
7 | src/settings.cpp | |
7 | 8 | |
8 | 9 | lupdate_only { |
9 | 10 | SOURCES += qml/main.qml \ |
21 | 22 | include(deployment.pri) |
22 | 23 | |
23 | 24 | # Setting the application icon |
24 | win32: RC_ICONS = icons/2048-qt.ico # On Windows | |
25 | macx: ICON = icons/2048-qt.ico # On Mac OSX | |
25 | win32: RC_ICONS = res/icons/2048-qt.ico # On Windows | |
26 | macx: ICON = res/icons/2048-qt.ico # On Mac OSX | |
26 | 27 | |
27 | 28 | HEADERS += \ |
28 | myclass.h \ | |
29 | settings.h | |
29 | src/settings.h \ | |
30 | src/myclass.h | |
30 | 31 | |
31 | TRANSLATIONS = ts/2048-qt_zh_CN.ts ts/2048-qt_ru_RU.ts | |
32 | TRANSLATIONS = ts/2048-qt_de_DE.ts ts/2048-qt_fr_FR.ts ts/2048-qt_pl_PL.ts ts/2048-qt_ru_RU.ts ts/2048-qt_zh_CN.ts | |
32 | 33 | |
33 | VERSION = 0.1.5 | |
34 | VERSION = 0.1.6 | |
34 | 35 | |
35 | 36 | DEFINES += APP_VERSION=\\\"$${VERSION}\\\" |
0 | 0 | # Changelog |
1 | ||
2 | ## 2015-09-19 0.1.6 | |
3 | * added French, German, Polish translation | |
4 | * put config file in `~/.config/2048-qt/` instead of `~/.config/xiaoyong/` | |
1 | 5 | |
2 | 6 | ## 2014-05-29 0.1.5 |
3 | 7 | * fixed the VERSION issue for Visual Studio |
0 | 0 | The MIT License (MIT) |
1 | 1 | |
2 | Copyright (c) 2014 Qiaoyong Zhong | |
2 | Copyright (c) 2015 Qiaoyong Zhong | |
3 | 3 | |
4 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | 5 | of this software and associated documentation files (the "Software"), to deal |
17 | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18 | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
19 | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
20 | SOFTWARE.⏎ | |
20 | SOFTWARE. |
12 | 12 | - PRC (天朝) |
13 | 13 | - Multi-language support, currently |
14 | 14 | - English |
15 | - French (by [Rémi Verschelde](https://github.com/akien-mga)) | |
16 | - German (by [Jens John](https://github.com/2ion)) | |
17 | - Polish (by [Michał Radwański](https://github.com/enedil)) | |
15 | 18 | - Russian (by [Sergey Basalaev](https://github.com/SBasalaev)) |
16 | 19 | - Simplified Chinese |
17 | 20 | |
50 | 53 | sudo apt-get install 2048-qt |
51 | 54 | ``` |
52 | 55 | |
56 | ### Gentoo | |
57 | 2048-Qt is available from the overlay maintained by [Jorge Pizarro Callejas](https://github.com/jorgicio): | |
58 | ``` | |
59 | layman -a jorgicio | |
60 | emerge 2048-qt | |
61 | ``` | |
62 | ||
53 | 63 | ### Ubuntu |
54 | 64 | |
55 | 65 | From Ubuntu 14.10 on, install it through: |
0 | windeployqt.exe --release --qmldir qml/ --no-translations --compiler-runtime release/2048-qt.exe |
0 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
1 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | |
2 | ||
3 | <svg | |
4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | |
5 | xmlns:cc="http://creativecommons.org/ns#" | |
6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
7 | xmlns:svg="http://www.w3.org/2000/svg" | |
8 | xmlns="http://www.w3.org/2000/svg" | |
9 | version="1.1" | |
10 | width="106.25" | |
11 | height="106.25" | |
12 | id="svg2"> | |
13 | <defs | |
14 | id="defs4"> | |
15 | <linearGradient | |
16 | id="linearGradient5199"> | |
17 | <stop | |
18 | id="stop5201" | |
19 | style="stop-color:#0000ff;stop-opacity:1" | |
20 | offset="0" /> | |
21 | </linearGradient> | |
22 | </defs> | |
23 | <metadata | |
24 | id="metadata7"> | |
25 | <rdf:RDF> | |
26 | <cc:Work | |
27 | rdf:about=""> | |
28 | <dc:format>image/svg+xml</dc:format> | |
29 | <dc:type | |
30 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |
31 | <dc:title></dc:title> | |
32 | </cc:Work> | |
33 | </rdf:RDF> | |
34 | </metadata> | |
35 | <g | |
36 | transform="translate(-158.13869,-381.36248)" | |
37 | id="layer1"> | |
38 | <g | |
39 | id="g5261"> | |
40 | <text | |
41 | x="35.018265" | |
42 | y="70.595039" | |
43 | transform="translate(157.78125,258.81531)" | |
44 | id="text2990" | |
45 | xml:space="preserve" | |
46 | style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;font-family:Helvetica;-inkscape-font-specification:Helvetica"><tspan | |
47 | x="35.018265" | |
48 | y="70.595039" | |
49 | id="tspan2992"></tspan></text> | |
50 | <g | |
51 | transform="translate(0.67578802,-1.2119579)" | |
52 | id="g3786"> | |
53 | <rect | |
54 | width="106.25" | |
55 | height="53.125" | |
56 | rx="3" | |
57 | ry="3" | |
58 | x="-0.31834787" | |
59 | y="123.75913" | |
60 | transform="translate(157.78125,258.81531)" | |
61 | id="rect3766" | |
62 | style="fill:#edc22d;fill-opacity:1;stroke:none" /> | |
63 | <text | |
64 | x="210.65822" | |
65 | y="422.07443" | |
66 | id="text5205" | |
67 | xml:space="preserve" | |
68 | style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#f9f6f2;fill-opacity:1;stroke:none;font-family:Droid Sans Fallback;-inkscape-font-specification:Droid Sans Fallback"><tspan | |
69 | x="210.65822" | |
70 | y="422.07443" | |
71 | id="tspan5207">2048</tspan><tspan | |
72 | x="210.65822" | |
73 | y="458.07443" | |
74 | id="tspan5227" /></text> | |
75 | </g> | |
76 | <g | |
77 | transform="translate(0.31834702,-4.2948979)" | |
78 | id="g3792"> | |
79 | <rect | |
80 | width="106.25" | |
81 | height="53.125" | |
82 | rx="3" | |
83 | ry="3" | |
84 | x="157.82034" | |
85 | y="438.78238" | |
86 | id="rect3766-1" | |
87 | style="fill:#80c342;fill-opacity:1;stroke:none" /> | |
88 | <text | |
89 | x="190.69534" | |
90 | y="474.76675" | |
91 | id="text2994" | |
92 | xml:space="preserve" | |
93 | style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Droid Sans Fallback;-inkscape-font-specification:Droid Sans Fallback"><tspan | |
94 | x="190.69534" | |
95 | y="474.76675" | |
96 | id="tspan2996">Qt</tspan></text> | |
97 | </g> | |
98 | </g> | |
99 | </g> | |
100 | </svg> |
0 | #!/bin/bash | |
1 | ||
2 | sizes=(16 32 48 256) | |
3 | ||
4 | for size in ${sizes[@]}; do | |
5 | inkscape -z -e 2048-qt_${size}x${size}.png -w $size -h $size scalable/apps/2048-qt.svg | |
6 | mkdir -p ${size}x${size}/apps | |
7 | mv 2048-qt_${size}x${size}.png ${size}x${size}/apps/2048-qt.png | |
8 | done |
0 | #include <QApplication> | |
1 | #include <QQmlApplicationEngine> | |
2 | #include <QQmlContext> | |
3 | #include <QTranslator> | |
4 | #include <QDebug> | |
5 | #include "myclass.h" | |
6 | #include "settings.h" | |
7 | ||
8 | int main(int argc, char *argv[]) | |
9 | { | |
10 | QApplication app(argc, argv); | |
11 | Settings settings(0, "xiaoyong", "2048-Qt"); | |
12 | settings.setVersion(QString(APP_VERSION)); | |
13 | ||
14 | // Localization | |
15 | QString locale; | |
16 | if (settings.contains("language")) { | |
17 | locale = settings.value("language").toString(); | |
18 | } else { | |
19 | locale = QLocale::system().name(); | |
20 | settings.setValue("language", locale); | |
21 | } | |
22 | ||
23 | QTranslator translator; | |
24 | if (! locale.startsWith("en")) { | |
25 | QString tsFile = "2048-qt_" + locale; | |
26 | ||
27 | if (translator.load(tsFile, ":/ts")) { | |
28 | qDebug() << "Successfully loaded " + tsFile; | |
29 | app.installTranslator(&translator); | |
30 | } else { | |
31 | qDebug() << "Failed to load " + tsFile; | |
32 | } | |
33 | } | |
34 | ||
35 | QQmlApplicationEngine engine; | |
36 | ||
37 | // Access C++ object "myClass" from QML as "myClass" | |
38 | MyClass myClass; | |
39 | engine.rootContext()->setContextProperty("myClass", &myClass); | |
40 | ||
41 | // Access C++ object "settings" from QML as "settings" | |
42 | engine.rootContext()->setContextProperty("settings", &settings); | |
43 | ||
44 | engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); | |
45 | ||
46 | return app.exec(); | |
47 | } |
0 | .TH 2048-QT 6 2014-05-03 | |
1 | .SH NAME | |
2 | 2048-qt \- the 2048 number game implemented in Qt | |
3 | .SH SYNOPSIS | |
4 | .B 2048-qt | |
5 | .SH DESCRIPTION | |
6 | Move the number tiles using arrow keys and merge the same numbers. Once a 2048 tile is achieved, you win. | |
7 | .SH OPTIONS | |
8 | 2048-QT is configured graphically and does not have any commandline options. | |
9 | .SH FILES | |
10 | ~/.config/xiaoyong/2048-Qt.conf | |
11 | .RS | |
12 | Per user configuration file. | |
13 | .RE | |
14 | .SH BUGS | |
15 | If you find a bug, please notify the author. | |
16 | .SH AUTHOR | |
17 | Qiaoyong Zhong <solary.sh@gmail.com> |
0 | #include "myclass.h" | |
1 | #include <QApplication> | |
2 | ||
3 | MyClass::MyClass(QObject *parent) : | |
4 | QObject(parent) | |
5 | { | |
6 | } | |
7 | ||
8 | void MyClass::aboutQt() { | |
9 | QApplication::aboutQt(); | |
10 | } |
0 | #ifndef MYCLASS_H | |
1 | #define MYCLASS_H | |
2 | ||
3 | #include <QObject> | |
4 | ||
5 | class MyClass : public QObject | |
6 | { | |
7 | Q_OBJECT | |
8 | public: | |
9 | explicit MyClass(QObject *parent = 0); | |
10 | ||
11 | signals: | |
12 | ||
13 | public slots: | |
14 | void aboutQt(); | |
15 | }; | |
16 | ||
17 | #endif // MYCLASS_H |
13 | 13 | property bool runNewTileAnim: false |
14 | 14 | property bool destroyFlag: false |
15 | 15 | |
16 | FontLoader { id: localFont; source: "qrc:///fonts/DroidSansFallback.ttf" } | |
16 | FontLoader { id: localFont; source: "qrc:///res/fonts/DroidSansFallback.ttf" } | |
17 | 17 | |
18 | 18 | Text { |
19 | 19 | id: tileLabel |
101 | 101 | } |
102 | 102 | } |
103 | 103 | MenuItem { |
104 | text: "Français" | |
105 | checkable: true | |
106 | exclusiveGroup: languageSettingsGroup | |
107 | checked: settings.value("language") === "fr_FR" ? true : false | |
108 | onTriggered: { | |
109 | if (settings.value("language") !== "fr_FR") { | |
110 | settings.setValue("language", "fr_FR"); | |
111 | changeLanguageDialog.open(); | |
112 | } | |
113 | } | |
114 | } | |
115 | MenuItem { | |
104 | 116 | text: "简体中文" |
105 | 117 | checkable: true |
106 | 118 | exclusiveGroup: languageSettingsGroup |
113 | 125 | } |
114 | 126 | } |
115 | 127 | MenuItem { |
128 | text: "Polski" | |
129 | checkable: true | |
130 | exclusiveGroup: languageSettingsGroup | |
131 | checked: settings.value("language") === "pl_PL" ? true : false | |
132 | onTriggered: { | |
133 | if (settings.value("language") !== "pl_PL") { | |
134 | settings.setValue("language", "pl_PL"); | |
135 | changeLanguageDialog.open(); | |
136 | } | |
137 | } | |
138 | } | |
139 | ||
140 | MenuItem { | |
116 | 141 | text: "Русский" |
117 | 142 | checkable: true |
118 | 143 | exclusiveGroup: languageSettingsGroup |
120 | 145 | onTriggered: { |
121 | 146 | if (settings.value("language") !== "ru_RU") { |
122 | 147 | settings.setValue("language", "ru_RU"); |
148 | changeLanguageDialog.open(); | |
149 | } | |
150 | } | |
151 | } | |
152 | MenuItem { | |
153 | text: "German" | |
154 | checkable: true | |
155 | exclusiveGroup: languageSettingsGroup | |
156 | checked: settings.value("language") == "de_DE" ? true : false | |
157 | onTriggered: { | |
158 | if (settings.value("language") != "de_DE") { | |
159 | settings.setValue("language", "de_DE"); | |
123 | 160 | changeLanguageDialog.open(); |
124 | 161 | } |
125 | 162 | } |
169 | 206 | onClicked: parent.forceActiveFocus() |
170 | 207 | } |
171 | 208 | |
172 | FontLoader { id: localFont; source: "qrc:///fonts/DroidSansFallback.ttf" } | |
209 | FontLoader { id: localFont; source: "qrc:///res/fonts/DroidSansFallback.ttf" } | |
173 | 210 | |
174 | 211 | Text { |
175 | 212 | id: gameName |
318 | 355 | MessageDialog { |
319 | 356 | id: aboutDialog |
320 | 357 | title: qsTr("About 2048-Qt") |
321 | text: qsTr("<p style='font-weight: bold; font-size: 24px'>2048-Qt</p><p>Version " + settings.getVersion() + "</p><p>2014 Qiaoyong Zhong <solary.sh@gmail.com></p>") | |
358 | text: qsTr("<p style='font-weight: bold; font-size: 24px'>2048-Qt</p><p>Version " + settings.getVersion() + "</p><p>2015 Qiaoyong Zhong <solary.sh@gmail.com></p>") | |
322 | 359 | standardButtons: StandardButton.Ok |
323 | 360 | } |
324 | 361 |
0 | #!/usr/bin/env xdg-open | |
1 | [Desktop Entry] | |
2 | Name=2048-Qt | |
3 | GenericName=2048-Qt | |
4 | Comment=The 2048 number game implemented in Qt | |
5 | Comment[fr]=Jeu de réflexion et de mathématique | |
6 | Exec=2048-qt | |
7 | Icon=2048-qt | |
8 | Terminal=false | |
9 | Type=Application | |
10 | Categories=Game;Math;Qt; |
Binary diff not shown
0 | Copyright (C) 2008 The Android Open Source Project | |
1 | ||
2 | Licensed under the Apache License, Version 2.0 (the "License"); | |
3 | you may not use this file except in compliance with the License. | |
4 | You may obtain a copy of the License at | |
5 | ||
6 | http://www.apache.org/licenses/LICENSE-2.0 | |
7 | ||
8 | Unless required by applicable law or agreed to in writing, software | |
9 | distributed under the License is distributed on an "AS IS" BASIS, | |
10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | See the License for the specific language governing permissions and | |
12 | limitations under the License. | |
13 | ||
14 | ########## | |
15 | ||
16 | This directory contains the fonts for the platform. They are licensed | |
17 | under the Apache 2 license. |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
1 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | |
2 | ||
3 | <svg | |
4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | |
5 | xmlns:cc="http://creativecommons.org/ns#" | |
6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
7 | xmlns:svg="http://www.w3.org/2000/svg" | |
8 | xmlns="http://www.w3.org/2000/svg" | |
9 | version="1.1" | |
10 | width="106.25" | |
11 | height="106.25" | |
12 | id="svg2"> | |
13 | <defs | |
14 | id="defs4"> | |
15 | <linearGradient | |
16 | id="linearGradient5199"> | |
17 | <stop | |
18 | id="stop5201" | |
19 | style="stop-color:#0000ff;stop-opacity:1" | |
20 | offset="0" /> | |
21 | </linearGradient> | |
22 | </defs> | |
23 | <metadata | |
24 | id="metadata7"> | |
25 | <rdf:RDF> | |
26 | <cc:Work | |
27 | rdf:about=""> | |
28 | <dc:format>image/svg+xml</dc:format> | |
29 | <dc:type | |
30 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |
31 | <dc:title></dc:title> | |
32 | </cc:Work> | |
33 | </rdf:RDF> | |
34 | </metadata> | |
35 | <g | |
36 | transform="translate(-158.13869,-381.36248)" | |
37 | id="layer1"> | |
38 | <g | |
39 | id="g5261"> | |
40 | <text | |
41 | x="35.018265" | |
42 | y="70.595039" | |
43 | transform="translate(157.78125,258.81531)" | |
44 | id="text2990" | |
45 | xml:space="preserve" | |
46 | style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;font-family:Helvetica;-inkscape-font-specification:Helvetica"><tspan | |
47 | x="35.018265" | |
48 | y="70.595039" | |
49 | id="tspan2992"></tspan></text> | |
50 | <g | |
51 | transform="translate(0.67578802,-1.2119579)" | |
52 | id="g3786"> | |
53 | <rect | |
54 | width="106.25" | |
55 | height="53.125" | |
56 | rx="3" | |
57 | ry="3" | |
58 | x="-0.31834787" | |
59 | y="123.75913" | |
60 | transform="translate(157.78125,258.81531)" | |
61 | id="rect3766" | |
62 | style="fill:#edc22d;fill-opacity:1;stroke:none" /> | |
63 | <text | |
64 | x="210.65822" | |
65 | y="422.07443" | |
66 | id="text5205" | |
67 | xml:space="preserve" | |
68 | style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#f9f6f2;fill-opacity:1;stroke:none;font-family:Droid Sans Fallback;-inkscape-font-specification:Droid Sans Fallback"><tspan | |
69 | x="210.65822" | |
70 | y="422.07443" | |
71 | id="tspan5207">2048</tspan><tspan | |
72 | x="210.65822" | |
73 | y="458.07443" | |
74 | id="tspan5227" /></text> | |
75 | </g> | |
76 | <g | |
77 | transform="translate(0.31834702,-4.2948979)" | |
78 | id="g3792"> | |
79 | <rect | |
80 | width="106.25" | |
81 | height="53.125" | |
82 | rx="3" | |
83 | ry="3" | |
84 | x="157.82034" | |
85 | y="438.78238" | |
86 | id="rect3766-1" | |
87 | style="fill:#80c342;fill-opacity:1;stroke:none" /> | |
88 | <text | |
89 | x="190.69534" | |
90 | y="474.76675" | |
91 | id="text2994" | |
92 | xml:space="preserve" | |
93 | style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Droid Sans Fallback;-inkscape-font-specification:Droid Sans Fallback"><tspan | |
94 | x="190.69534" | |
95 | y="474.76675" | |
96 | id="tspan2996">Qt</tspan></text> | |
97 | </g> | |
98 | </g> | |
99 | </g> | |
100 | </svg> |
0 | .TH 2048-QT 6 2015-09-13 | |
1 | .SH NAME | |
2 | 2048-qt \- the 2048 number game implemented in Qt | |
3 | .SH SYNOPSIS | |
4 | .B 2048-qt | |
5 | .SH DESCRIPTION | |
6 | Move the number tiles using arrow keys and merge the same numbers. Once a 2048 tile is achieved, you win. | |
7 | .SH OPTIONS | |
8 | 2048-QT is configured graphically and does not have any commandline options. | |
9 | .SH FILES | |
10 | ~/.config/2048-qt/2048-Qt.conf | |
11 | .RS | |
12 | Per user configuration file. | |
13 | .RE | |
14 | .SH BUGS | |
15 | If you find a bug, please notify the author. | |
16 | .SH AUTHOR | |
17 | Qiaoyong Zhong <solary.sh@gmail.com> |
0 | 0 | <RCC> |
1 | 1 | <qresource prefix="/"> |
2 | <file>ts/2048-qt_de_DE.qm</file> | |
3 | <file>ts/2048-qt_fr_FR.qm</file> | |
4 | <file>ts/2048-qt_pl_PL.qm</file> | |
5 | <file>ts/2048-qt_ru_RU.qm</file> | |
2 | 6 | <file>ts/2048-qt_zh_CN.qm</file> |
3 | <file>ts/2048-qt_ru_RU.qm</file> | |
4 | 7 | <file>qml/main.qml</file> |
5 | 8 | <file>qml/2048.js</file> |
6 | 9 | <file>qml/Tile.qml</file> |
7 | <file>fonts/DroidSansFallback.ttf</file> | |
10 | <file>res/fonts/DroidSansFallback.ttf</file> | |
8 | 11 | </qresource> |
9 | 12 | </RCC> |
0 | windeployqt.exe --release --qmldir qml/ --no-translations --compiler-runtime release/2048-qt.exe |
0 | #!/bin/bash | |
1 | ||
2 | sizes=(16 32 48 256) | |
3 | ||
4 | for size in ${sizes[@]}; do | |
5 | inkscape -z -e 2048-qt_${size}x${size}.png -w $size -h $size scalable/apps/2048-qt.svg | |
6 | mkdir -p ${size}x${size}/apps | |
7 | mv 2048-qt_${size}x${size}.png ${size}x${size}/apps/2048-qt.png | |
8 | done |
0 | #include "settings.h" | |
1 | ||
2 | Settings::Settings(QObject *parent, const QString &organization, const QString &application) : | |
3 | QObject(parent), settings_(new QSettings(organization, application)) { | |
4 | } | |
5 | ||
6 | Settings::~Settings() { | |
7 | delete settings_; | |
8 | } | |
9 | ||
10 | bool Settings::contains(const QString & key) const { | |
11 | return settings_->contains(key); | |
12 | } | |
13 | ||
14 | void Settings::setValue(const QString &key, const QVariant &value) { | |
15 | settings_->setValue(key, value); | |
16 | } | |
17 | ||
18 | QVariant Settings::value(const QString &key, const QVariant &defaultValue) const { | |
19 | return settings_->value(key, defaultValue); | |
20 | } | |
21 | ||
22 | void Settings::setVersion(QString version) { | |
23 | appVersion = version; | |
24 | } | |
25 | ||
26 | QString Settings::getVersion() { | |
27 | return appVersion; | |
28 | } |
0 | #ifndef SETTINGS_H | |
1 | #define SETTINGS_H | |
2 | ||
3 | #include <QObject> | |
4 | #include <QSettings> | |
5 | ||
6 | class Settings : public QObject | |
7 | { | |
8 | Q_OBJECT | |
9 | public: | |
10 | explicit Settings(QObject *parent = 0, const QString &organization = QString(), const QString &application = QString()); | |
11 | ~Settings(); | |
12 | ||
13 | Q_INVOKABLE void setValue(const QString &key, const QVariant &value); | |
14 | Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; | |
15 | Q_INVOKABLE QString getVersion(); | |
16 | ||
17 | void setVersion(const QString version); | |
18 | bool contains(const QString & key) const; | |
19 | ||
20 | signals: | |
21 | ||
22 | public slots: | |
23 | ||
24 | private: | |
25 | QSettings *settings_; | |
26 | QString appVersion; | |
27 | }; | |
28 | ||
29 | #endif // SETTINGS_H |
0 | #include <QApplication> | |
1 | #include <QQmlApplicationEngine> | |
2 | #include <QQmlContext> | |
3 | #include <QTranslator> | |
4 | #include <QDebug> | |
5 | #include "myclass.h" | |
6 | #include "settings.h" | |
7 | ||
8 | int main(int argc, char *argv[]) | |
9 | { | |
10 | QApplication app(argc, argv); | |
11 | Settings settings(0, "2048-qt", "2048-Qt"); | |
12 | settings.setVersion(QString(APP_VERSION)); | |
13 | ||
14 | // Localization | |
15 | QString locale; | |
16 | if (settings.contains("language")) { | |
17 | locale = settings.value("language").toString(); | |
18 | } else { | |
19 | locale = QLocale::system().name(); | |
20 | settings.setValue("language", locale); | |
21 | } | |
22 | ||
23 | QTranslator translator; | |
24 | if (! locale.startsWith("en")) { | |
25 | QString tsFile = "2048-qt_" + locale; | |
26 | ||
27 | if (translator.load(tsFile, ":/ts")) { | |
28 | qDebug() << "Successfully loaded " + tsFile; | |
29 | app.installTranslator(&translator); | |
30 | } else { | |
31 | qDebug() << "Failed to load " + tsFile; | |
32 | } | |
33 | } | |
34 | ||
35 | QQmlApplicationEngine engine; | |
36 | ||
37 | // Access C++ object "myClass" from QML as "myClass" | |
38 | MyClass myClass; | |
39 | engine.rootContext()->setContextProperty("myClass", &myClass); | |
40 | ||
41 | // Access C++ object "settings" from QML as "settings" | |
42 | engine.rootContext()->setContextProperty("settings", &settings); | |
43 | ||
44 | engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); | |
45 | ||
46 | return app.exec(); | |
47 | } |
0 | #include "myclass.h" | |
1 | #include <QApplication> | |
2 | ||
3 | MyClass::MyClass(QObject *parent) : | |
4 | QObject(parent) | |
5 | { | |
6 | } | |
7 | ||
8 | void MyClass::aboutQt() { | |
9 | QApplication::aboutQt(); | |
10 | } |
0 | #ifndef MYCLASS_H | |
1 | #define MYCLASS_H | |
2 | ||
3 | #include <QObject> | |
4 | ||
5 | class MyClass : public QObject | |
6 | { | |
7 | Q_OBJECT | |
8 | public: | |
9 | explicit MyClass(QObject *parent = 0); | |
10 | ||
11 | signals: | |
12 | ||
13 | public slots: | |
14 | void aboutQt(); | |
15 | }; | |
16 | ||
17 | #endif // MYCLASS_H |
0 | #include "settings.h" | |
1 | ||
2 | Settings::Settings(QObject *parent, const QString &organization, const QString &application) : | |
3 | QObject(parent), settings_(new QSettings(organization, application)) { | |
4 | } | |
5 | ||
6 | Settings::~Settings() { | |
7 | delete settings_; | |
8 | } | |
9 | ||
10 | bool Settings::contains(const QString & key) const { | |
11 | return settings_->contains(key); | |
12 | } | |
13 | ||
14 | void Settings::setValue(const QString &key, const QVariant &value) { | |
15 | settings_->setValue(key, value); | |
16 | } | |
17 | ||
18 | QVariant Settings::value(const QString &key, const QVariant &defaultValue) const { | |
19 | return settings_->value(key, defaultValue); | |
20 | } | |
21 | ||
22 | void Settings::setVersion(QString version) { | |
23 | appVersion = version; | |
24 | } | |
25 | ||
26 | QString Settings::getVersion() { | |
27 | return appVersion; | |
28 | } |
0 | #ifndef SETTINGS_H | |
1 | #define SETTINGS_H | |
2 | ||
3 | #include <QObject> | |
4 | #include <QSettings> | |
5 | ||
6 | class Settings : public QObject | |
7 | { | |
8 | Q_OBJECT | |
9 | public: | |
10 | explicit Settings(QObject *parent = 0, const QString &organization = QString(), const QString &application = QString()); | |
11 | ~Settings(); | |
12 | ||
13 | Q_INVOKABLE void setValue(const QString &key, const QVariant &value); | |
14 | Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; | |
15 | Q_INVOKABLE QString getVersion(); | |
16 | ||
17 | void setVersion(const QString version); | |
18 | bool contains(const QString & key) const; | |
19 | ||
20 | signals: | |
21 | ||
22 | public slots: | |
23 | ||
24 | private: | |
25 | QSettings *settings_; | |
26 | QString appVersion; | |
27 | }; | |
28 | ||
29 | #endif // SETTINGS_H |
Binary diff not shown
0 | <?xml version="1.0" encoding="utf-8"?> | |
1 | <!DOCTYPE TS> | |
2 | <TS version="2.0" language="de_DE"> | |
3 | <context> | |
4 | <name>main</name> | |
5 | <message> | |
6 | <location filename="../qml/main.qml" line="13"/> | |
7 | <source>2048 Game</source> | |
8 | <translation>2048</translation> | |
9 | </message> | |
10 | <message> | |
11 | <location filename="../qml/main.qml" line="24"/> | |
12 | <source>File</source> | |
13 | <translation>&Datei</translation> | |
14 | </message> | |
15 | <message> | |
16 | <location filename="../qml/main.qml" line="26"/> | |
17 | <location filename="../qml/main.qml" line="276"/> | |
18 | <source>New Game</source> | |
19 | <translation>Neues Spiel</translation> | |
20 | </message> | |
21 | <message> | |
22 | <location filename="../qml/main.qml" line="31"/> | |
23 | <source>Exit</source> | |
24 | <translation>&Beenden</translation> | |
25 | </message> | |
26 | <message> | |
27 | <location filename="../qml/main.qml" line="38"/> | |
28 | <source>Settings</source> | |
29 | <translation>&Einstellungen</translation> | |
30 | </message> | |
31 | <message> | |
32 | <location filename="../qml/main.qml" line="40"/> | |
33 | <source>Labeling</source> | |
34 | <translation>&Beschriftung</translation> | |
35 | </message> | |
36 | <message> | |
37 | <location filename="../qml/main.qml" line="42"/> | |
38 | <source>2048</source> | |
39 | <translation>2048</translation> | |
40 | </message> | |
41 | <message> | |
42 | <location filename="../qml/main.qml" line="54"/> | |
43 | <source>Degree</source> | |
44 | <translation>Grad</translation> | |
45 | </message> | |
46 | <message> | |
47 | <location filename="../qml/main.qml" line="66"/> | |
48 | <source>Military Rank</source> | |
49 | <translation>Militärsränge</translation> | |
50 | </message> | |
51 | <message> | |
52 | <location filename="../qml/main.qml" line="78"/> | |
53 | <source>PRC</source> | |
54 | <translation>PRC</translation> | |
55 | </message> | |
56 | <message> | |
57 | <location filename="../qml/main.qml" line="91"/> | |
58 | <source>Language</source> | |
59 | <translation>&Sprache</translation> | |
60 | </message> | |
61 | <message> | |
62 | <source>English</source> | |
63 | <translation>Englisch</translation> | |
64 | </message> | |
65 | <message> | |
66 | <source>Simplified Chinese</source> | |
67 | <translation>Vereinfachtes Chinesisch</translation> | |
68 | </message> | |
69 | <message> | |
70 | <location filename="../qml/main.qml" line="133"/> | |
71 | <source>Help</source> | |
72 | <translation>&Hilfe</translation> | |
73 | </message> | |
74 | <message> | |
75 | <location filename="../qml/main.qml" line="135"/> | |
76 | <source>About</source> | |
77 | <translation>Über</translation> | |
78 | </message> | |
79 | <message> | |
80 | <location filename="../qml/main.qml" line="139"/> | |
81 | <source>About Qt</source> | |
82 | <translation>Über &Qt</translation> | |
83 | </message> | |
84 | <message> | |
85 | <location filename="../qml/main.qml" line="197"/> | |
86 | <source>SCORE</source> | |
87 | <translation>Punkte</translation> | |
88 | </message> | |
89 | <message> | |
90 | <location filename="../qml/main.qml" line="197"/> | |
91 | <source>BEST</source> | |
92 | <translation>Rekord</translation> | |
93 | </message> | |
94 | <message> | |
95 | <location filename="../qml/main.qml" line="257"/> | |
96 | <source>Join the numbers and get to the <b>2048 tile</b>!</source> | |
97 | <translation>Kombiniere bis zu einer Summe von <b>2048</b>!</translation> | |
98 | </message> | |
99 | <message> | |
100 | <location filename="../qml/main.qml" line="314"/> | |
101 | <source>Language Setting Hint</source> | |
102 | <translation>Hinweis zur Spracheinstellung</translation> | |
103 | </message> | |
104 | <message> | |
105 | <location filename="../qml/main.qml" line="315"/> | |
106 | <source>Please restart the program to make the language setting take effect.</source> | |
107 | <translation>Starten Sie das Programm erneut, um die geänderten Spracheinstellungen zu übernehmen.</translation> | |
108 | </message> | |
109 | <message> | |
110 | <location filename="../qml/main.qml" line="321"/> | |
111 | <source>About 2048-Qt</source> | |
112 | <translation>Über &2048-Qt</translation> | |
113 | </message> | |
114 | <message> | |
115 | <location filename="../qml/main.qml" line="328"/> | |
116 | <source>Game Over</source> | |
117 | <translation>Game Over</translation> | |
118 | </message> | |
119 | <message> | |
120 | <location filename="../qml/main.qml" line="329"/> | |
121 | <source>Game Over!</source> | |
122 | <translation>Game Over!</translation> | |
123 | </message> | |
124 | <message> | |
125 | <location filename="../qml/main.qml" line="339"/> | |
126 | <source>You Win</source> | |
127 | <translation>Sie gewinnen!</translation> | |
128 | </message> | |
129 | <message> | |
130 | <location filename="../qml/main.qml" line="340"/> | |
131 | <source>You win! Continue playing?</source> | |
132 | <translation>Sie haben gewonnen! Weiterspielen?</translation> | |
133 | </message> | |
134 | </context> | |
135 | </TS> |
Binary diff not shown
0 | <?xml version="1.0" encoding="utf-8"?> | |
1 | <!DOCTYPE TS> | |
2 | <TS version="2.0" language="fr_FR"> | |
3 | <context> | |
4 | <name>main</name> | |
5 | <message> | |
6 | <location filename="../qml/main.qml" line="13"/> | |
7 | <source>2048 Game</source> | |
8 | <translation>2048</translation> | |
9 | </message> | |
10 | <message> | |
11 | <location filename="../qml/main.qml" line="24"/> | |
12 | <source>File</source> | |
13 | <translation>Fichier</translation> | |
14 | </message> | |
15 | <message> | |
16 | <location filename="../qml/main.qml" line="26"/> | |
17 | <location filename="../qml/main.qml" line="276"/> | |
18 | <source>New Game</source> | |
19 | <translation>Nouvelle partie</translation> | |
20 | </message> | |
21 | <message> | |
22 | <location filename="../qml/main.qml" line="31"/> | |
23 | <source>Exit</source> | |
24 | <translation>Quitter</translation> | |
25 | </message> | |
26 | <message> | |
27 | <location filename="../qml/main.qml" line="38"/> | |
28 | <source>Settings</source> | |
29 | <translation>Paramètres</translation> | |
30 | </message> | |
31 | <message> | |
32 | <location filename="../qml/main.qml" line="40"/> | |
33 | <source>Labeling</source> | |
34 | <translation>Variante</translation> | |
35 | </message> | |
36 | <message> | |
37 | <location filename="../qml/main.qml" line="42"/> | |
38 | <source>2048</source> | |
39 | <translation>2048</translation> | |
40 | </message> | |
41 | <message> | |
42 | <location filename="../qml/main.qml" line="54"/> | |
43 | <source>Degree</source> | |
44 | <translation>Diplôme (chinois)</translation> | |
45 | </message> | |
46 | <message> | |
47 | <location filename="../qml/main.qml" line="66"/> | |
48 | <source>Military Rank</source> | |
49 | <translation>Rang militaire (chinois)</translation> | |
50 | </message> | |
51 | <message> | |
52 | <location filename="../qml/main.qml" line="78"/> | |
53 | <source>PRC</source> | |
54 | <translation>RPC (chinois)</translation> | |
55 | </message> | |
56 | <message> | |
57 | <location filename="../qml/main.qml" line="91"/> | |
58 | <source>Language</source> | |
59 | <translation>Langue</translation> | |
60 | </message> | |
61 | <message> | |
62 | <location filename="../qml/main.qml" line="133"/> | |
63 | <source>Help</source> | |
64 | <translation>Aide</translation> | |
65 | </message> | |
66 | <message> | |
67 | <location filename="../qml/main.qml" line="135"/> | |
68 | <source>About</source> | |
69 | <translation>À propos</translation> | |
70 | </message> | |
71 | <message> | |
72 | <location filename="../qml/main.qml" line="139"/> | |
73 | <source>About Qt</source> | |
74 | <translation>À propos de Qt</translation> | |
75 | </message> | |
76 | <message> | |
77 | <location filename="../qml/main.qml" line="197"/> | |
78 | <source>SCORE</source> | |
79 | <translation>SCORE</translation> | |
80 | </message> | |
81 | <message> | |
82 | <location filename="../qml/main.qml" line="197"/> | |
83 | <source>BEST</source> | |
84 | <translation>RECORD</translation> | |
85 | </message> | |
86 | <message> | |
87 | <location filename="../qml/main.qml" line="257"/> | |
88 | <source>Join the numbers and get to the <b>2048 tile</b>!</source> | |
89 | <translation>Combinez les nombres pour atteindre <b>2048</b> !</translation> | |
90 | </message> | |
91 | <message> | |
92 | <location filename="../qml/main.qml" line="314"/> | |
93 | <source>Language Setting Hint</source> | |
94 | <translation>Information sur le paramétrage de la langue</translation> | |
95 | </message> | |
96 | <message> | |
97 | <location filename="../qml/main.qml" line="315"/> | |
98 | <source>Please restart the program to make the language setting take effect.</source> | |
99 | <translation>Veuillez redémarrer le programme pour que le changement de langue soit pris en compte.</translation> | |
100 | </message> | |
101 | <message> | |
102 | <location filename="../qml/main.qml" line="321"/> | |
103 | <source>About 2048-Qt</source> | |
104 | <translation>À propos de 2048-Qt</translation> | |
105 | </message> | |
106 | <message> | |
107 | <location filename="../qml/main.qml" line="328"/> | |
108 | <source>Game Over</source> | |
109 | <translation>Fin de la partie</translation> | |
110 | </message> | |
111 | <message> | |
112 | <location filename="../qml/main.qml" line="329"/> | |
113 | <source>Game Over!</source> | |
114 | <translation>Vous avez perdu !</translation> | |
115 | </message> | |
116 | <message> | |
117 | <location filename="../qml/main.qml" line="339"/> | |
118 | <source>You Win</source> | |
119 | <translation>Vous avez gagné</translation> | |
120 | </message> | |
121 | <message> | |
122 | <location filename="../qml/main.qml" line="340"/> | |
123 | <source>You win! Continue playing?</source> | |
124 | <translation>Vous avez atteint l'objectif ! Voulez-vous continuer ?</translation> | |
125 | </message> | |
126 | </context> | |
127 | </TS> |
Binary diff not shown
0 | <?xml version="1.0" encoding="utf-8"?> | |
1 | <!DOCTYPE TS> | |
2 | <TS version="2.1" language="pl_PL"> | |
3 | <context> | |
4 | <name>main</name> | |
5 | <message> | |
6 | <location filename="../qml/main.qml" line="13"/> | |
7 | <source>2048 Game</source> | |
8 | <translation>Gra 2048</translation> | |
9 | </message> | |
10 | <message> | |
11 | <location filename="../qml/main.qml" line="24"/> | |
12 | <source>File</source> | |
13 | <translation>Plik</translation> | |
14 | </message> | |
15 | <message> | |
16 | <location filename="../qml/main.qml" line="26"/> | |
17 | <location filename="../qml/main.qml" line="276"/> | |
18 | <source>New Game</source> | |
19 | <translation>Nowa gra</translation> | |
20 | </message> | |
21 | <message> | |
22 | <location filename="../qml/main.qml" line="31"/> | |
23 | <source>Exit</source> | |
24 | <translation>Wyjdź</translation> | |
25 | </message> | |
26 | <message> | |
27 | <location filename="../qml/main.qml" line="38"/> | |
28 | <source>Settings</source> | |
29 | <translation>Ustawienia</translation> | |
30 | </message> | |
31 | <message> | |
32 | <location filename="../qml/main.qml" line="40"/> | |
33 | <source>Labeling</source> | |
34 | <translation>Etykiety</translation> | |
35 | </message> | |
36 | <message> | |
37 | <location filename="../qml/main.qml" line="42"/> | |
38 | <source>2048</source> | |
39 | <translation>2048</translation> | |
40 | </message> | |
41 | <message> | |
42 | <location filename="../qml/main.qml" line="54"/> | |
43 | <source>Degree</source> | |
44 | <translation>Stopień</translation> | |
45 | </message> | |
46 | <message> | |
47 | <location filename="../qml/main.qml" line="66"/> | |
48 | <source>Military Rank</source> | |
49 | <translation>Ranga wojskowa</translation> | |
50 | </message> | |
51 | <message> | |
52 | <location filename="../qml/main.qml" line="78"/> | |
53 | <source>PRC</source> | |
54 | <translation>PRC</translation> | |
55 | </message> | |
56 | <message> | |
57 | <location filename="../qml/main.qml" line="91"/> | |
58 | <source>Language</source> | |
59 | <translation>Język</translation> | |
60 | </message> | |
61 | <message> | |
62 | <source>English</source> | |
63 | <translation type="vanished">Angielski</translation> | |
64 | </message> | |
65 | <message> | |
66 | <source>Polish</source> | |
67 | <translation type="vanished">Polski</translation> | |
68 | </message> | |
69 | <message> | |
70 | <source>Russian</source> | |
71 | <translation type="vanished">Rosyjski</translation> | |
72 | </message> | |
73 | <message> | |
74 | <source>Simplified Chinese</source> | |
75 | <translation type="vanished">Chiński uproszczony</translation> | |
76 | </message> | |
77 | ||
78 | <message> | |
79 | <location filename="../qml/main.qml" line="133"/> | |
80 | <source>Help</source> | |
81 | <translation>Pomoc</translation> | |
82 | </message> | |
83 | <message> | |
84 | <location filename="../qml/main.qml" line="135"/> | |
85 | <source>About</source> | |
86 | <translation>O programie</translation> | |
87 | </message> | |
88 | <message> | |
89 | <location filename="../qml/main.qml" line="139"/> | |
90 | <source>About Qt</source> | |
91 | <translation>O Qt</translation> | |
92 | </message> | |
93 | <message> | |
94 | <location filename="../qml/main.qml" line="197"/> | |
95 | <source>SCORE</source> | |
96 | <translation>WYNIK</translation> | |
97 | </message> | |
98 | <message> | |
99 | <location filename="../qml/main.qml" line="197"/> | |
100 | <source>BEST</source> | |
101 | <translation>NAJLEPSZY</translation> | |
102 | </message> | |
103 | <message> | |
104 | <location filename="../qml/main.qml" line="257"/> | |
105 | <source>Join the numbers and get to the <b>2048 tile</b>!</source> | |
106 | <translation>Łącz liczby i dotrzyj do <b>kafelka 2048</b>!</translation> | |
107 | </message> | |
108 | <message> | |
109 | <location filename="../qml/main.qml" line="314"/> | |
110 | <source>Language Setting Hint</source> | |
111 | <translation>Wskazówka odnośnie ustawiania języka</translation> | |
112 | </message> | |
113 | <message> | |
114 | <location filename="../qml/main.qml" line="315"/> | |
115 | <source>Please restart the program to make the language setting take effect.</source> | |
116 | <translation>Aby zmiana języka była widoczna, proszę uruchomić ponownie program.</translation> | |
117 | </message> | |
118 | <message> | |
119 | <location filename="../qml/main.qml" line="321"/> | |
120 | <source>About 2048-Qt</source> | |
121 | <translation>O programie 2048-Qt</translation> | |
122 | </message> | |
123 | <message> | |
124 | <location filename="../qml/main.qml" line="328"/> | |
125 | <source>Game Over</source> | |
126 | <translation>Игра окончена</translation> | |
127 | </message> | |
128 | <message> | |
129 | <location filename="../qml/main.qml" line="329"/> | |
130 | <source>Game Over!</source> | |
131 | <translation>Gra skończona!</translation> | |
132 | </message> | |
133 | <message> | |
134 | <location filename="../qml/main.qml" line="339"/> | |
135 | <source>You Win</source> | |
136 | <translation>Wygrałeś</translation> | |
137 | </message> | |
138 | <message> | |
139 | <location filename="../qml/main.qml" line="340"/> | |
140 | <source>You win! Continue playing?</source> | |
141 | <translation>Wygrałeś! Kontynuować grę?</translation> | |
142 | </message> | |
143 | </context> | |
144 | </TS> |