├── .qmake.conf ├── .tag ├── LICENSE.GPLv3 ├── LICENSE.LGPLv3 ├── dependencies.yaml ├── dist ├── changes-5.10.0 ├── changes-5.10.1 ├── changes-5.11.0 ├── changes-5.11.1 ├── changes-5.11.2 ├── changes-5.11.3 ├── changes-5.12.0 ├── changes-5.12.1 ├── changes-5.12.2 ├── changes-5.12.3 ├── changes-5.12.4 ├── changes-5.12.5 ├── changes-5.13.0 ├── changes-5.13.1 ├── changes-5.13.2 ├── changes-5.14.0 ├── changes-5.14.1 ├── changes-5.14.2 ├── changes-5.15.0 ├── changes-5.15.1 ├── changes-5.15.2 ├── changes-5.7.0 ├── changes-5.7.1 ├── changes-5.8.0 ├── changes-5.9.0 ├── changes-5.9.1 ├── changes-5.9.2 ├── changes-5.9.3 ├── changes-5.9.4 ├── changes-5.9.5 └── changes-5.9.6 ├── examples ├── examples.pro └── purchasing │ ├── purchasing.pro │ └── qthangman │ ├── doc │ ├── images │ │ ├── qthangman-example.png │ │ └── qthangman-store-example.png │ └── src │ │ └── qthangman.qdoc │ ├── enable2.txt │ ├── hangmangame.cpp │ ├── hangmangame.h │ ├── main.cpp │ ├── qml │ └── qthangman │ │ ├── +windows │ │ └── Settings.qml │ │ ├── GameView.qml │ │ ├── GuessWordView.qml │ │ ├── Hangman.qml │ │ ├── HowToView.qml │ │ ├── Key.qml │ │ ├── Letter.qml │ │ ├── LetterSelector.qml │ │ ├── MainView.qml │ │ ├── PageHeader.qml │ │ ├── ScoreItem.qml │ │ ├── Settings.qml │ │ ├── SimpleButton.qml │ │ ├── SplashScreen.qml │ │ ├── StoreItem.qml │ │ ├── StoreView.qml │ │ ├── Word.qml │ │ ├── main.qml │ │ └── qmldir │ ├── qthangman.pro │ ├── resources.qrc │ └── winrt │ ├── QtStoreSimulation.xml │ └── winrt.qrc ├── qtpurchasing.pro ├── src ├── android │ ├── android.pro │ └── src │ │ ├── LICENSE-APACHE-2.0.txt │ │ ├── com │ │ └── android │ │ │ └── vending │ │ │ └── billing │ │ │ ├── IInAppBillingService.aidl │ │ │ └── qt_attribution.json │ │ └── org │ │ └── qtproject │ │ └── qt │ │ └── android │ │ └── purchasing │ │ ├── Base64.java │ │ ├── Base64DecoderException.java │ │ ├── QtInAppPurchase.java │ │ ├── Security.java │ │ └── qt_attribution.json ├── imports │ ├── imports.pro │ └── purchasing │ │ ├── inapppurchase.cpp │ │ ├── plugins.qmltypes │ │ ├── purchasing.pro │ │ ├── qinappproductqmltype.cpp │ │ ├── qinappproductqmltype_p.h │ │ ├── qinappstoreqmltype.cpp │ │ ├── qinappstoreqmltype_p.h │ │ └── qmldir ├── purchasing │ ├── doc │ │ ├── qtpurchasing-examples.qdoc │ │ ├── qtpurchasing.qdocconf │ │ └── src │ │ │ ├── appstore.qdoc │ │ │ ├── gettingstarted-cpp.qdoc │ │ │ ├── gettingstarted-qml.qdoc │ │ │ ├── googleplay.qdoc │ │ │ ├── qtpurchasing-cpp.qdoc │ │ │ ├── qtpurchasing-overview.qdoc │ │ │ ├── qtpurchasing-qmltypes.qdoc │ │ │ └── windowsstore.qdoc │ ├── inapppurchase │ │ ├── android │ │ │ ├── android.pri │ │ │ ├── qandroidinappproduct.cpp │ │ │ ├── qandroidinappproduct_p.h │ │ │ ├── qandroidinapppurchasebackend.cpp │ │ │ ├── qandroidinapppurchasebackend_p.h │ │ │ ├── qandroidinapptransaction.cpp │ │ │ ├── qandroidinapptransaction_p.h │ │ │ └── qandroidjni.cpp │ │ ├── inapppurchase.pri │ │ ├── mac │ │ │ ├── mac.pri │ │ │ ├── qmacinapppurchasebackend.mm │ │ │ ├── qmacinapppurchasebackend_p.h │ │ │ ├── qmacinapppurchaseproduct.mm │ │ │ ├── qmacinapppurchaseproduct_p.h │ │ │ ├── qmacinapppurchasetransaction.mm │ │ │ └── qmacinapppurchasetransaction_p.h │ │ ├── qinappproduct.cpp │ │ ├── qinappproduct.h │ │ ├── qinapppurchasebackend.cpp │ │ ├── qinapppurchasebackend_p.h │ │ ├── qinapppurchasebackendfactory.cpp │ │ ├── qinapppurchasebackendfactory_p.h │ │ ├── qinappstore.cpp │ │ ├── qinappstore.h │ │ ├── qinappstore_p.h │ │ ├── qinapptransaction.cpp │ │ ├── qinapptransaction.h │ │ └── winrt │ │ │ ├── qwinrtinappproduct.cpp │ │ │ ├── qwinrtinappproduct_p.h │ │ │ ├── qwinrtinapppurchasebackend.cpp │ │ │ ├── qwinrtinapppurchasebackend_p.h │ │ │ ├── qwinrtinapptransaction.cpp │ │ │ ├── qwinrtinapptransaction_p.h │ │ │ └── winrt.pri │ ├── purchasing.pro │ └── qtpurchasingglobal.h └── src.pro ├── sync.profile └── tests ├── auto ├── auto.pro └── purchasing │ ├── purchasing.pro │ └── qinappstore │ ├── qinappstore.pro │ └── tst_qinappstore.cpp ├── manual ├── manual.pro └── qinappstore │ ├── qinappstore.pro │ └── tst_qinappstore.cpp └── tests.pro /.qmake.conf: -------------------------------------------------------------------------------- 1 | load(qt_build_config) 2 | 3 | DEFINES += QT_NO_FOREACH 4 | 5 | MODULE_VERSION = 5.15.0 6 | 7 | CMAKE_MODULE_TESTS=- 8 | -------------------------------------------------------------------------------- /.tag: -------------------------------------------------------------------------------- 1 | 713e57e9f762a37d60d308e2911aa2ec61212ae1 2 | -------------------------------------------------------------------------------- /dependencies.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | ../qtandroidextras: 3 | ref: 1c906fab0d04341c8abed762c641231f44c6d8f3 4 | required: false 5 | ../qtbase: 6 | ref: f7f1a71ea41579c1ff86c08c16b82e4c84bc891f 7 | required: true 8 | ../qtdeclarative: 9 | ref: d16e62d81587e98b054af4f66c02959c5bb89ff6 10 | required: false 11 | -------------------------------------------------------------------------------- /dist/changes-5.10.0: -------------------------------------------------------------------------------- 1 | Qt 5.10 introduces many new features and improvements as well as bugfixes 2 | over the 5.9.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | http://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.10 series is binary compatible with the 5.9.x series. 8 | Applications compiled for 5.9 will continue to run with 5.10. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | **************************************************************************** 19 | * Qt 5.10.0 Changes * 20 | **************************************************************************** 21 | 22 | Android 23 | ------- 24 | 25 | - [QTBUG-57700] Added more informative error messages when the purchasing 26 | subsystem was unable to create the buy intent. 27 | -------------------------------------------------------------------------------- /dist/changes-5.10.1: -------------------------------------------------------------------------------- 1 | Qt 5.10.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.10.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.10 series is binary compatible with the 5.9.x series. 10 | Applications compiled for 5.9 will continue to run with 5.10. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | This release contains all fixes included in the Qt 5.9.4 release. 21 | 22 | **************************************************************************** 23 | * Qt 5.10.1 Changes * 24 | **************************************************************************** 25 | 26 | - This release contains only minor code improvements. 27 | -------------------------------------------------------------------------------- /dist/changes-5.11.0: -------------------------------------------------------------------------------- 1 | Qt 5.11 introduces many new features and improvements as well as bugfixes 2 | over the 5.10.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | http://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.11 series is binary compatible with the 5.10.x series. 8 | Applications compiled for 5.10 will continue to run with 5.11. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | **************************************************************************** 19 | * Qt 5.11.0 Changes * 20 | **************************************************************************** 21 | 22 | - This release contains only minor code improvements. 23 | -------------------------------------------------------------------------------- /dist/changes-5.11.1: -------------------------------------------------------------------------------- 1 | Qt 5.11.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.11.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.11 series is binary compatible with the 5.10.x series. 10 | Applications compiled for 5.10 will continue to run with 5.11. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.11.1 Changes * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /dist/changes-5.11.2: -------------------------------------------------------------------------------- 1 | Qt 5.11.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.11.0 through 5.11.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.11 series is binary compatible with the 5.10.x series. 10 | Applications compiled for 5.10 will continue to run with 5.11. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.11.2 Changes * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /dist/changes-5.11.3: -------------------------------------------------------------------------------- 1 | Qt 5.11.3 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.11.0 through 5.11.2. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.11 series is binary compatible with the 5.10.x series. 10 | Applications compiled for 5.10 will continue to run with 5.11. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.12.0: -------------------------------------------------------------------------------- 1 | Qt 5.12 introduces many new features and improvements as well as bugfixes 2 | over the 5.11.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 8 | Applications compiled for 5.11 will continue to run with 5.12. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | - This release contains only minor code improvements. 19 | -------------------------------------------------------------------------------- /dist/changes-5.12.1: -------------------------------------------------------------------------------- 1 | Qt 5.12.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.12.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 10 | Applications compiled for 5.11 will continue to run with 5.12. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.12.2: -------------------------------------------------------------------------------- 1 | Qt 5.12.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 10 | Applications compiled for 5.11 will continue to run with 5.12. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.12.3: -------------------------------------------------------------------------------- 1 | Qt 5.12.3 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.2. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 10 | Applications compiled for 5.11 will continue to run with 5.12. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.12.4: -------------------------------------------------------------------------------- 1 | Qt 5.12.4 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.3. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 10 | Applications compiled for 5.11 will continue to run with 5.12. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.12.5: -------------------------------------------------------------------------------- 1 | Qt 5.12.5 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.4. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 10 | Applications compiled for 5.11 will continue to run with 5.12. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.13.0: -------------------------------------------------------------------------------- 1 | Qt 5.13 introduces many new features and improvements as well as bugfixes 2 | over the 5.12.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.13 series is binary compatible with the 5.12.x series. 8 | Applications compiled for 5.12 will continue to run with 5.13. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | - This release contains only minor code improvements. 19 | -------------------------------------------------------------------------------- /dist/changes-5.13.1: -------------------------------------------------------------------------------- 1 | Qt 5.13.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.13.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.13 series is binary compatible with the 5.12.x series. 10 | Applications compiled for 5.12 will continue to run with 5.13. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.13.2: -------------------------------------------------------------------------------- 1 | Qt 5.13.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.13.0 through 5.13.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.13 series is binary compatible with the 5.12.x series. 10 | Applications compiled for 5.12 will continue to run with 5.13. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.14.0: -------------------------------------------------------------------------------- 1 | Qt 5.14 introduces many new features and improvements as well as bugfixes 2 | over the 5.13.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 8 | Applications compiled for 5.13 will continue to run with 5.14. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | - This release contains only minor code improvements. 19 | -------------------------------------------------------------------------------- /dist/changes-5.14.1: -------------------------------------------------------------------------------- 1 | Qt 5.14.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.14.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 10 | Applications compiled for 5.13 will continue to run with 5.14. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.14.2: -------------------------------------------------------------------------------- 1 | Qt 5.14.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.14.0 through 5.14.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 10 | Applications compiled for 5.13 will continue to run with 5.14. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.15.0: -------------------------------------------------------------------------------- 1 | Qt 5.15 introduces many new features and improvements as well as bugfixes 2 | over the 5.14.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 8 | Applications compiled for 5.14 will continue to run with 5.15. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | - This release contains only minor code improvements. 19 | -------------------------------------------------------------------------------- /dist/changes-5.15.1: -------------------------------------------------------------------------------- 1 | Qt 5.15.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.15.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 10 | Applications compiled for 5.14 will continue to run with 5.15. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.15.2: -------------------------------------------------------------------------------- 1 | Qt 5.15.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.15.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5.15/index.html 8 | 9 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 10 | Applications compiled for 5.14 will continue to run with 5.15. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Important Behavior Changes * 22 | **************************************************************************** 23 | 24 | **************************************************************************** 25 | * Library * 26 | **************************************************************************** 27 | 28 | 29 | -------------------------------------------------------------------------------- /dist/changes-5.7.0: -------------------------------------------------------------------------------- 1 | Qt 5.7 introduces many new features and improvements as well as bugfixes 2 | over the 5.6.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5.7 6 | 7 | The Qt version 5.7 series is binary compatible with the 5.6.x series. 8 | Applications compiled for 5.6 will continue to run with 5.7. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | **************************************************************************** 19 | * General * 20 | **************************************************************************** 21 | - Native error message now exposed on iOS and Mac OS X. 22 | - Fixed possible crash when querying products repeatedly on Android. 23 | -------------------------------------------------------------------------------- /dist/changes-5.7.1: -------------------------------------------------------------------------------- 1 | Qt 5.7.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.7.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.7 series is binary compatible with the 5.6.x series. 10 | Applications compiled for 5.6 will continue to run with 5.7. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | Android 21 | ------- 22 | 23 | - [QTBUG-54518] Fixed test purchases after changes in Google Play that 24 | removed the order ID for such transactions. 25 | -------------------------------------------------------------------------------- /dist/changes-5.8.0: -------------------------------------------------------------------------------- 1 | Qt 5.8 introduces many new features and improvements as well as bugfixes 2 | over the 5.7.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | http://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.8 series is binary compatible with the 5.7.x series. 8 | Applications compiled for 5.7 will continue to run with 5.8. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | Android 19 | ------- 20 | 21 | - [QTBUG-54518] Fixed test purchases after changes in Google Play that 22 | removed the order ID for such transactions. 23 | 24 | WinRT 25 | ----- 26 | 27 | - [QTBUG-50550] Added WinRT backend. 28 | -------------------------------------------------------------------------------- /dist/changes-5.9.0: -------------------------------------------------------------------------------- 1 | Qt 5.9 introduces many new features and improvements as well as bugfixes 2 | over the 5.8.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | http://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 8 | Applications compiled for 5.8 will continue to run with 5.9. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | Important changes: 19 | ------------------ 20 | - WinRT: 21 | * [QTBUG-59766] Fixed in-app purchases not working with live Windows Store. 22 | -------------------------------------------------------------------------------- /dist/changes-5.9.1: -------------------------------------------------------------------------------- 1 | Qt 5.9.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Library * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /dist/changes-5.9.2: -------------------------------------------------------------------------------- 1 | Qt 5.9.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.2 Changes * 22 | **************************************************************************** 23 | 24 | There were no changes in this module since previous release. 25 | -------------------------------------------------------------------------------- /dist/changes-5.9.3: -------------------------------------------------------------------------------- 1 | Qt 5.9.3 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.3 Changes * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /dist/changes-5.9.4: -------------------------------------------------------------------------------- 1 | Qt 5.9.4 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.4 Changes * 22 | **************************************************************************** 23 | 24 | - [QTBUG-64549] winrt: React on failure in LoadListingInformationAsync 25 | - [QTBUG-64531] Fix the build on tvOS 26 | -------------------------------------------------------------------------------- /dist/changes-5.9.5: -------------------------------------------------------------------------------- 1 | Qt 5.9.5 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.9 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.5 Changes * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /dist/changes-5.9.6: -------------------------------------------------------------------------------- 1 | Qt 5.9.6 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0 through 5.9.5. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.6 Changes * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += purchasing -------------------------------------------------------------------------------- /examples/purchasing/purchasing.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | qtHaveModule(quick): SUBDIRS += qthangman 4 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/doc/images/qthangman-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtpurchasing/713e57e9f762a37d60d308e2911aa2ec61212ae1/examples/purchasing/qthangman/doc/images/qthangman-example.png -------------------------------------------------------------------------------- /examples/purchasing/qthangman/doc/images/qthangman-store-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtpurchasing/713e57e9f762a37d60d308e2911aa2ec61212ae1/examples/purchasing/qthangman/doc/images/qthangman-store-example.png -------------------------------------------------------------------------------- /examples/purchasing/qthangman/doc/src/qthangman.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \title Qt Purchasing Examples - QtHangman 30 | \example qthangman 31 | \brief QtHangman is an example that demonstrates how to use the Qt Purchasing API with Qt Quick. 32 | \image qthangman-example.png 33 | \ingroup qtpurchasing-examples 34 | 35 | QtHangman is a complete mobile application that demonstrates how it is possible to offer in-app products inside a Qt application in a cross-platform manner. 36 | In order to test the in-app purchase functionality in the example, you must first register the application and its products in the external 37 | store. For an introduction on how to do this, see the guides for \l{Registering Products in Google Play}{Google Play} and 38 | \l{Registering Products in App Store}{App Store} respectively. 39 | 40 | In-app purchasing can be added to a Qt Mobile application by first adding a Store object. In QtHangman the Store object 41 | is created by the MainView component that is loaded on application startup. 42 | \snippet qthangman/qml/qthangman/MainView.qml 0 43 | 44 | QtHangman defines a component for displaying a store for purchasing in-app products made available. These products must be first 45 | registered with the store object we created above in MainView. There are two products available, the first being a consumable type. 46 | \snippet qthangman/qml/qthangman/StoreView.qml 0 47 | This consumable product provides 100 additional vowels to be used when guessing words in the game. When it is successfully 48 | purchased we update the state of the application to include 100 additional vowels. Then we call finalize on the transaction object to 49 | confirm to the platform store that the consumable product has been provided. 50 | 51 | The second product is a non-consumable type that will unlock vowels permanently in the future. In addition to updating the application 52 | state on purchase, we must make sure to provide a way to restore this purchase on other devices used by the end user. In this case 53 | we create a signal handler for onPurchaseRestored. 54 | \snippet qthangman/qml/qthangman/StoreView.qml 1 55 | 56 | \image qthangman-store-example.png 57 | In additon to registering the products, we also provide an interface to actually purchase the registered product. QtHangman defines a 58 | custom component called StoreItem to display and handle the purchasing interaction. 59 | \snippet qthangman/qml/qthangman/StoreView.qml 1 60 | The StoreItem component will display the product data that is queried from the platform's store, and will call the purchase() method on the 61 | product when it is clicked by the user. 62 | \snippet qthangman/qml/qthangman/StoreItem.qml 0 63 | */ 64 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include 52 | #include 53 | #include 54 | 55 | #include "hangmangame.h" 56 | 57 | int main(int argc, char *argv[]) 58 | { 59 | QGuiApplication app(argc, argv); 60 | 61 | qmlRegisterType("org.qtproject.qthangman", 1, 0, "HangmanGame"); 62 | 63 | QQmlApplicationEngine engine(QUrl("qrc:/qml/qthangman/main.qml")); 64 | 65 | return app.exec(); 66 | } 67 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/+windows/Settings.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | pragma Singleton 52 | import QtQml 2.0 53 | 54 | QtObject { 55 | property string fontFamily: "Arial" 56 | property string helpFontFamily: "Arial" 57 | } 58 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/GuessWordView.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | import QtQuick.Controls 1.1 53 | 54 | Item { 55 | id: dialog 56 | PageHeader { 57 | id: header 58 | title: "What is the word?" 59 | onClicked: { 60 | Qt.inputMethod.hide(); 61 | } 62 | } 63 | 64 | Word { 65 | id: word 66 | text: applicationData.word 67 | anchors.top: header.bottom 68 | anchors.bottomMargin: parent.height * 0.05 69 | anchors.horizontalCenter: parent.horizontalCenter 70 | width: parent.width * 0.8 71 | height: parent.height * 0.1 72 | } 73 | 74 | function guess() { 75 | applicationData.guessWord(input.text) 76 | input.text = "" 77 | Qt.inputMethod.hide(); 78 | pageStack.pop(); 79 | topLevel.forceActiveFocus() 80 | } 81 | 82 | TextField { 83 | id: input 84 | font.capitalization: Font.AllUppercase 85 | inputMethodHints: Qt.ImhLatinOnly | Qt.ImhUppercaseOnly | Qt.ImhNoPredictiveText 86 | verticalAlignment: Text.AlignVCenter 87 | horizontalAlignment: Text.AlignHCenter 88 | focus: true 89 | maximumLength: applicationData.word.length 90 | anchors.top: word.bottom 91 | anchors.right: word.right 92 | anchors.left: word.left 93 | height: word.height 94 | anchors.topMargin: topLevel.globalMargin * 2 95 | font.pixelSize: height * 0.75 96 | onAccepted: { 97 | dialog.guess(); 98 | } 99 | } 100 | 101 | Component.onCompleted: { 102 | Qt.inputMethod.show(); 103 | input.forceActiveFocus(); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/Key.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | 53 | SimpleButton { 54 | id: keyItem 55 | 56 | property bool purchasable: false 57 | 58 | signal keyActivated(string letter) 59 | 60 | onClicked: { 61 | if (available) { 62 | keyActivated(text); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/Letter.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | import "." 53 | 54 | Item { 55 | property alias text: label.text 56 | 57 | Text { 58 | anchors.top: parent.top 59 | anchors.horizontalCenter: parent.horizontalCenter 60 | id: label 61 | color: "white" 62 | font.pixelSize: parent.height * 0.75 63 | font.family: Settings.fontFamily 64 | 65 | opacity: applicationData.lettersOwned.indexOf(text) >= 0 ? 1.0 : 0.0 66 | visible: opacity > 0.0 67 | 68 | anchors.horizontalCenterOffset: visible ? 0 : -topLevel.width / 2 69 | 70 | Behavior on anchors.horizontalCenterOffset { 71 | NumberAnimation { 72 | duration: 500 73 | easing.type: Easing.OutQuad 74 | } 75 | } 76 | } 77 | 78 | Rectangle { 79 | color: "white" 80 | width: parent.width 81 | anchors.bottom: parent.bottom 82 | anchors.top: label.bottom 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/MainView.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | import QtQuick.Controls 1.1 53 | import org.qtproject.qthangman 1.0 54 | import QtPurchasing 1.0 55 | 56 | Item { 57 | id: topLevel 58 | 59 | height: 480 60 | width: 320 61 | property real buttonHeight: 0 62 | property real globalMargin: width * 0.025 63 | 64 | Component.onCompleted: forceActiveFocus() 65 | Keys.onBackPressed: { 66 | if (pageStack.depth === 1) { 67 | Qt.quit() 68 | } else { 69 | pageStack.pop() 70 | event.accepted = true 71 | forceActiveFocus() 72 | } 73 | } 74 | focus: true 75 | 76 | HangmanGame { 77 | id: applicationData 78 | onWordChanged: { 79 | if (word.length > 0) 80 | splashLoader.source = ""; 81 | } 82 | } 83 | 84 | StackView { 85 | id: pageStack 86 | anchors.fill: topLevel 87 | initialItem: Qt.resolvedUrl("GameView.qml") 88 | } 89 | // ![0] 90 | Store { 91 | id: iapStore 92 | } 93 | // ![0] 94 | } 95 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/PageHeader.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | 53 | Item { 54 | id: header 55 | 56 | property alias title: titleText.text 57 | property int buttonHeight: topLevel.buttonHeight 58 | signal clicked() 59 | 60 | 61 | anchors.top: parent.top 62 | anchors.left: parent.left 63 | anchors.right: parent.right 64 | height: buttonHeight + (topLevel.globalMargin * 2) 65 | SimpleButton { 66 | id: backButton 67 | anchors.top: parent.top 68 | anchors.left: parent.left 69 | anchors.margins: topLevel.globalMargin 70 | height: buttonHeight 71 | width: parent.width * 0.25 72 | text: "Back" 73 | onClicked: { 74 | pageStack.pop(); 75 | header.clicked(); 76 | } 77 | } 78 | Text { 79 | id: titleText 80 | anchors.left: backButton.right 81 | anchors.top: parent.top 82 | anchors.right: parent.right 83 | anchors.bottom: parent.bottom 84 | anchors.margins: topLevel.globalMargin 85 | font.family: Settings.helpFontFamily 86 | color: "white" 87 | font.pointSize: 64 88 | fontSizeMode: Text.Fit 89 | horizontalAlignment: Text.AlignHCenter 90 | verticalAlignment: Text.AlignVCenter 91 | minimumPointSize: 8 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/ScoreItem.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | import QtQuick.Controls 1.1 53 | import "." 54 | 55 | Rectangle { 56 | id: borderRect 57 | color: "transparent" 58 | border.color: "white" 59 | width: scoreText.contentWidth + (topLevel.globalMargin * 2) 60 | radius: 10 61 | Label { 62 | id: scoreText 63 | anchors.fill: parent 64 | anchors.topMargin: topLevel.globalMargin 65 | anchors.bottomMargin: topLevel.globalMargin 66 | anchors.rightMargin: topLevel.globalMargin 67 | anchors.leftMargin: topLevel.globalMargin 68 | horizontalAlignment: Text.AlignRight 69 | verticalAlignment: Text.AlignVCenter 70 | font.pixelSize: parent.height 71 | font.family: Settings.fontFamily 72 | font.weight: Font.Light 73 | text: applicationData.score 74 | color: "white" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/Settings.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | pragma Singleton 52 | import QtQml 2.0 53 | 54 | QtObject { 55 | property string fontFamily: "Helvetica Neue" 56 | property string helpFontFamily: ".Helvetica Neue Interface -M3" 57 | } 58 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/SimpleButton.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | import "." 53 | 54 | Item { 55 | id: button 56 | property string text: "" 57 | property color buttonColor: "white" 58 | property color textColor: "black" 59 | property bool available: true 60 | property alias fontPointSize: buttonText.font.pointSize 61 | 62 | signal clicked() 63 | 64 | state: "NORMAL" 65 | 66 | Rectangle { 67 | id: buttonRect 68 | anchors.fill: parent 69 | radius: 10 70 | color: buttonColor 71 | visible: button.available 72 | Text { 73 | id: buttonText 74 | anchors.fill: parent 75 | anchors.rightMargin: parent.width * 0.05 76 | anchors.leftMargin: parent.width * 0.05 77 | anchors.bottomMargin: parent.height * 0.20 78 | anchors.topMargin: parent.height * 0.20 79 | text: button.text 80 | color: textColor 81 | fontSizeMode: Text.Fit 82 | horizontalAlignment: Text.AlignHCenter 83 | verticalAlignment: Text.AlignVCenter 84 | minimumPointSize: 8 85 | font.pointSize: 64 86 | font.family: Settings.fontFamily 87 | font.weight: Font.Light 88 | } 89 | } 90 | 91 | MouseArea { 92 | anchors.fill: parent 93 | onClicked: { 94 | button.clicked(); 95 | } 96 | onPressed: { 97 | button.state = "PRESSED"; 98 | } 99 | onReleased: { 100 | button.state = "NORMAL"; 101 | } 102 | } 103 | 104 | states: [ 105 | State { 106 | name: "NORMAL" 107 | PropertyChanges { 108 | target: buttonRect 109 | color: button.buttonColor 110 | border.color: "transparent" 111 | } 112 | PropertyChanges { 113 | target: buttonText 114 | color: button.textColor 115 | } 116 | }, 117 | State { 118 | name: "PRESSED" 119 | PropertyChanges { 120 | target: buttonRect 121 | color: "transparent" 122 | border.color: button.buttonColor 123 | } 124 | PropertyChanges { 125 | target: buttonText 126 | color: button.buttonColor 127 | } 128 | } 129 | ] 130 | } 131 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/SplashScreen.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | 53 | Rectangle { 54 | id: topLevel 55 | gradient: Gradient { 56 | GradientStop { 57 | position: 0.0 58 | color: "#87E0FD" 59 | } 60 | GradientStop { 61 | position: 0.4 62 | color: "#53CBF1" 63 | } 64 | GradientStop { 65 | position: 1.0 66 | color: "#05ABE0" 67 | } 68 | } 69 | 70 | Hangman { 71 | id: logo 72 | anchors.centerIn: parent 73 | height: 268 74 | width: 268 75 | errorCount: 9 76 | } 77 | 78 | Text { 79 | anchors.horizontalCenter: parent.horizontalCenter 80 | anchors.top: logo.bottom 81 | anchors.topMargin: 10 82 | text: "Qt Hangman" 83 | font.family: Settings.helpFontFamily 84 | color: "white" 85 | font.pointSize: 24 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/Word.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.1 52 | import QtQuick.Controls 1.0 53 | 54 | Item { 55 | id: word 56 | property string text: "" 57 | 58 | Row { 59 | id: row 60 | spacing: topLevel.width / 100 61 | anchors.fill: parent 62 | Repeater { 63 | id: letters 64 | model: text.length 65 | 66 | Letter { 67 | id: letter 68 | text: word.text.charAt(index) 69 | width: (word.width / word.text.length) - row.spacing 70 | height: word.height 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/main.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.2 52 | import QtQuick.Controls 1.1 53 | 54 | ApplicationWindow { 55 | id: mainWindow 56 | height: 480 57 | width: 320 58 | visible: true; 59 | 60 | Rectangle { 61 | id: mainRect 62 | gradient: Gradient { 63 | GradientStop { 64 | position: 0.0 65 | color: "#87E0FD" 66 | } 67 | GradientStop { 68 | position: 0.4 69 | color: "#53CBF1" 70 | } 71 | GradientStop { 72 | position: 1.0 73 | color: "#05ABE0" 74 | } 75 | } 76 | anchors.fill: parent 77 | 78 | Loader { 79 | id: gameLoader 80 | asynchronous: true 81 | visible: status == Loader.Ready 82 | anchors.fill: parent 83 | } 84 | 85 | Loader { 86 | id: splashLoader 87 | anchors.fill: parent 88 | source: "SplashScreen.qml" 89 | onLoaded: gameLoader.source = "MainView.qml"; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qml/qthangman/qmldir: -------------------------------------------------------------------------------- 1 | GameView 1.0 GameView.qml 2 | GuessWordView 1.0 GuessWordView.qml 3 | Hangman 1.0 Hangman.qml 4 | HowToView 1.0 HowToView.qml 5 | Key 1.0 Key.qml 6 | Letter 1.0 Letter.qml 7 | LetterSelector 1.0 LetterSelector.qml 8 | main 1.0 main.qml 9 | MainView 1.0 MainView.qml 10 | PageHeader 1.0 PageHeader.qml 11 | ScoreItem 1.0 ScoreItem.qml 12 | singleton Settings 1.0 Settings.qml 13 | SimpleButton 1.0 SimpleButton.qml 14 | SplashScreen 1.0 SplashScreen.qml 15 | StoreItem 1.0 StoreItem.qml 16 | StoreView 1.0 StoreView.qml 17 | Word 1.0 Word.qml 18 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/qthangman.pro: -------------------------------------------------------------------------------- 1 | QT += quick qml 2 | !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets 3 | 4 | SOURCES += main.cpp \ 5 | hangmangame.cpp 6 | 7 | HEADERS += \ 8 | hangmangame.h 9 | 10 | RESOURCES += \ 11 | resources.qrc 12 | 13 | QT += purchasing 14 | 15 | target.path = $$[QT_INSTALL_EXAMPLES]/purchasing/qthangman 16 | INSTALLS += target 17 | 18 | OTHER_FILES += \ 19 | qml/qthangman/GameView.qml \ 20 | qml/qthangman/GuessWordView.qml \ 21 | qml/qthangman/Hangman.qml \ 22 | qml/qthangman/HowToView.qml \ 23 | qml/qthangman/Key.qml \ 24 | qml/qthangman/Letter.qml \ 25 | qml/qthangman/LetterSelector.qml \ 26 | qml/qthangman/main.qml \ 27 | qml/qthangman/MainView.qml \ 28 | qml/qthangman/PageHeader.qml \ 29 | qml/qthangman/ScoreItem.qml \ 30 | qml/qthangman/SimpleButton.qml \ 31 | qml/qthangman/SplashScreen.qml \ 32 | qml/qthangman/StoreItem.qml \ 33 | qml/qthangman/StoreView.qml \ 34 | qml/qthangman/Word.qml \ 35 | enable2.txt 36 | 37 | mac { 38 | #Change the following lines to match your unique App ID 39 | #to enable in-app purchases on OS X and iOS 40 | #For example if your App ID is org.qtproject.qt.iosteam.qthangman" 41 | #QMAKE_TARGET_BUNDLE_PREFIX = "org.qtproject.qt.iosteam" 42 | #TARGET = qthangman 43 | } 44 | 45 | winrt { 46 | # Add a StoreSimulation.xml file to the root resource folder 47 | # and Qt Purchasing will switch into simulation mode. 48 | # Remove the file in the publishing process. 49 | RESOURCES += \ 50 | winrt/winrt.qrc 51 | } 52 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | enable2.txt 4 | qml/qthangman/qmldir 5 | qml/qthangman/GameView.qml 6 | qml/qthangman/GuessWordView.qml 7 | qml/qthangman/Hangman.qml 8 | qml/qthangman/Key.qml 9 | qml/qthangman/Letter.qml 10 | qml/qthangman/LetterSelector.qml 11 | qml/qthangman/main.qml 12 | qml/qthangman/MainView.qml 13 | qml/qthangman/PageHeader.qml 14 | qml/qthangman/ScoreItem.qml 15 | qml/qthangman/Settings.qml 16 | qml/qthangman/SimpleButton.qml 17 | qml/qthangman/SplashScreen.qml 18 | qml/qthangman/StoreItem.qml 19 | qml/qthangman/StoreView.qml 20 | qml/qthangman/Word.qml 21 | qml/qthangman/HowToView.qml 22 | qml/qthangman/+windows/Settings.qml 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/purchasing/qthangman/winrt/QtStoreSimulation.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtpurchasing/713e57e9f762a37d60d308e2911aa2ec61212ae1/examples/purchasing/qthangman/winrt/QtStoreSimulation.xml -------------------------------------------------------------------------------- /examples/purchasing/qthangman/winrt/winrt.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | QtStoreSimulation.xml 4 | 5 | 6 | -------------------------------------------------------------------------------- /qtpurchasing.pro: -------------------------------------------------------------------------------- 1 | load(qt_parts) 2 | -------------------------------------------------------------------------------- /src/android/android.pro: -------------------------------------------------------------------------------- 1 | TARGET = Qt$${QT_MAJOR_VERSION}AndroidPurchasing 2 | 3 | CONFIG += java 4 | load(sdk) 5 | 6 | DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar 7 | 8 | PATHPREFIX = $$PWD/src/org/qtproject/qt/android/purchasing/ 9 | 10 | !build_pass { 11 | isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT) 12 | isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT 13 | 14 | isEmpty(BUILD_TOOLS_REVISION) { 15 | BUILD_TOOLS_REVISION = $$(ANDROID_BUILD_TOOLS_REVISION) 16 | isEmpty(BUILD_TOOLS_REVISION) { 17 | BUILD_TOOLS_REVISIONS = $$files($$SDK_ROOT/build-tools/*) 18 | for (REVISION, BUILD_TOOLS_REVISIONS) { 19 | BASENAME = $$basename(REVISION) 20 | greaterThan(BASENAME, $$BUILD_TOOLS_REVISION): BUILD_TOOLS_REVISION = $$BASENAME 21 | } 22 | } 23 | } 24 | 25 | FRAMEWORK_AIDL_FILE = $$SDK_ROOT/platforms/$$API_VERSION_TO_USE/framework.aidl 26 | !exists($$FRAMEWORK_AIDL_FILE) { 27 | error("The Path $$FRAMEWORK_AIDL_FILE does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.") 28 | } 29 | 30 | AIDL_CMD = $$SDK_ROOT/platform-tools/aidl 31 | contains(QMAKE_HOST.os, Windows): AIDL_CMD = $$AIDL_CMD".exe" 32 | !exists($$AIDL_CMD) { 33 | AIDL_CMD = $$SDK_ROOT/build-tools/$$BUILD_TOOLS_REVISION/aidl 34 | contains(QMAKE_HOST.os, Windows): AIDL_CMD = $$AIDL_CMD".exe" 35 | } 36 | !exists($$AIDL_CMD): error("The path $$AIDL_CMD does not exist. Please set the environment variable ANDROID_BUILD_TOOLS_REVISION to the revision of the build tools installed in your Android SDK.") 37 | 38 | mkpath($$OUT_PWD/src/com/android/vending/billing/) 39 | system($$AIDL_CMD -I$$PWD/src -p$$FRAMEWORK_AIDL_FILE $$PWD/src/com/android/vending/billing/IInAppBillingService.aidl $$OUT_PWD/src/com/android/vending/billing/IInAppBillingService.java) 40 | } 41 | 42 | JAVACLASSPATH += $$PWD/src/ 43 | JAVASOURCES += \ 44 | $$PATHPREFIX/QtInAppPurchase.java \ 45 | $$PATHPREFIX/Security.java \ 46 | $$PATHPREFIX/Base64.java \ 47 | $$PATHPREFIX/Base64DecoderException.java \ 48 | $$OUT_PWD/src/com/android/vending/billing/IInAppBillingService.java 49 | 50 | 51 | 52 | # install 53 | target.path = $$[QT_INSTALL_PREFIX]/jar 54 | INSTALLS += target 55 | 56 | OTHER_FILES += \ 57 | $$JAVASOURCES \ 58 | $$PWD/src/com/android/vending/billing/qt_attribution.json \ 59 | $$PWD/src/org/qtproject/qt/android/purchasing/qt_attribution.json \ 60 | $$PWD/src/LICENSE-APACHE-2.0.txt 61 | -------------------------------------------------------------------------------- /src/android/src/com/android/vending/billing/qt_attribution.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": "inappservice", 4 | "Name": "In-app billing service", 5 | "QDocModule": "qtpurchasing", 6 | "QtUsage": "Used on Android for connection to Google Play billing service.", 7 | "Files": "IInAppBillingService.aidl", 8 | 9 | "Description": "An interface definition for the interface to Google Play's In-app Billing Service Version 3.", 10 | "License": "Apache License 2.0", 11 | "LicenseId": "Apache-2.0", 12 | "LicenseFile": "../../../../LICENSE-APACHE-2.0.txt", 13 | "Copyright": "Copyright (C) 2012 The Android Open Source Project" 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /src/android/src/org/qtproject/qt/android/purchasing/Base64DecoderException.java: -------------------------------------------------------------------------------- 1 | // Copyright 2002, Google, Inc. 2 | // Copyright (c) 2015 The Qt Company Ltd. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package org.qtproject.qt.android.purchasing; 17 | 18 | /** 19 | * Exception thrown when encountering an invalid Base64 input character. 20 | * 21 | * @author nelson 22 | */ 23 | public class Base64DecoderException extends Exception { 24 | public Base64DecoderException() { 25 | super(); 26 | } 27 | 28 | public Base64DecoderException(String s) { 29 | super(s); 30 | } 31 | 32 | private static final long serialVersionUID = 1L; 33 | } 34 | -------------------------------------------------------------------------------- /src/android/src/org/qtproject/qt/android/purchasing/Security.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Google Inc. 2 | * Copyright (c) 2015 The Qt Company Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.qtproject.qt.android.purchasing; 18 | 19 | import android.text.TextUtils; 20 | import android.util.Log; 21 | 22 | import org.json.JSONException; 23 | import org.json.JSONObject; 24 | 25 | 26 | import java.security.InvalidKeyException; 27 | import java.security.KeyFactory; 28 | import java.security.NoSuchAlgorithmException; 29 | import java.security.PublicKey; 30 | import java.security.Signature; 31 | import java.security.SignatureException; 32 | import java.security.spec.InvalidKeySpecException; 33 | import java.security.spec.X509EncodedKeySpec; 34 | 35 | /** 36 | * Security-related methods. For a secure implementation, all of this code 37 | * should be implemented on a server that communicates with the 38 | * application on the device. For the sake of simplicity and clarity of this 39 | * example, this code is included here and is executed on the device. If you 40 | * must verify the purchases on the phone, you should obfuscate this code to 41 | * make it harder for an attacker to replace the code with stubs that treat all 42 | * purchases as verified. 43 | */ 44 | public class Security { 45 | private static final String TAG = "IABUtil/Security"; 46 | 47 | private static final String KEY_FACTORY_ALGORITHM = "RSA"; 48 | private static final String SIGNATURE_ALGORITHM = "SHA1withRSA"; 49 | 50 | /** 51 | * Verifies that the data was signed with the given signature, and returns 52 | * the verified purchase. The data is in JSON format and signed 53 | * with a private key. The data also contains the {@link PurchaseState} 54 | * and product ID of the purchase. 55 | * @param base64PublicKey the base64-encoded public key to use for verifying. 56 | * @param signedData the signed JSON string (signed, not encrypted) 57 | * @param signature the signature for the data, signed with the private key 58 | */ 59 | public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { 60 | if (signedData == null) { 61 | Log.e(TAG, "data is null"); 62 | return false; 63 | } 64 | 65 | boolean verified = false; 66 | if (!TextUtils.isEmpty(signature)) { 67 | PublicKey key = Security.generatePublicKey(base64PublicKey); 68 | verified = Security.verify(key, signedData, signature); 69 | if (!verified) { 70 | Log.w(TAG, "signature does not match data."); 71 | return false; 72 | } 73 | } 74 | return true; 75 | } 76 | 77 | /** 78 | * Generates a PublicKey instance from a string containing the 79 | * Base64-encoded public key. 80 | * 81 | * @param encodedPublicKey Base64-encoded public key 82 | * @throws IllegalArgumentException if encodedPublicKey is invalid 83 | */ 84 | public static PublicKey generatePublicKey(String encodedPublicKey) { 85 | try { 86 | byte[] decodedKey = Base64.decode(encodedPublicKey); 87 | KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM); 88 | return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey)); 89 | } catch (NoSuchAlgorithmException e) { 90 | throw new RuntimeException(e); 91 | } catch (InvalidKeySpecException e) { 92 | Log.e(TAG, "Invalid key specification."); 93 | throw new IllegalArgumentException(e); 94 | } catch (Base64DecoderException e) { 95 | Log.e(TAG, "Base64 decoding failed."); 96 | throw new IllegalArgumentException(e); 97 | } 98 | } 99 | 100 | /** 101 | * Verifies that the signature from the server matches the computed 102 | * signature on the data. Returns true if the data is correctly signed. 103 | * 104 | * @param publicKey public key associated with the developer account 105 | * @param signedData signed data from server 106 | * @param signature server signature 107 | * @return true if the data and signature match 108 | */ 109 | public static boolean verify(PublicKey publicKey, String signedData, String signature) { 110 | Signature sig; 111 | try { 112 | sig = Signature.getInstance(SIGNATURE_ALGORITHM); 113 | sig.initVerify(publicKey); 114 | sig.update(signedData.getBytes()); 115 | if (!sig.verify(Base64.decode(signature))) { 116 | Log.e(TAG, "Signature verification failed."); 117 | return false; 118 | } 119 | return true; 120 | } catch (NoSuchAlgorithmException e) { 121 | Log.e(TAG, "NoSuchAlgorithmException."); 122 | } catch (InvalidKeyException e) { 123 | Log.e(TAG, "Invalid key specification."); 124 | } catch (SignatureException e) { 125 | Log.e(TAG, "Signature exception."); 126 | } catch (Base64DecoderException e) { 127 | Log.e(TAG, "Base64 decoding failed."); 128 | } 129 | return false; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/android/src/org/qtproject/qt/android/purchasing/qt_attribution.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": "base64decoder", 4 | "Name": "Base64 Decoder", 5 | "QDocModule": "qtpurchasing", 6 | "QtUsage": "Used on Android in verification of purchases if a public key is set.", 7 | "Files": "Base64.java Base64DecoderException.java", 8 | 9 | "Description": "Converts between binary and base64.", 10 | "License": "Apache License 2.0", 11 | "LicenseId": "Apache-2.0", 12 | "LicenseFile": "../../../../../LICENSE-APACHE-2.0.txt", 13 | "Copyright": "Copyright 2002, Google, Inc." 14 | }, 15 | 16 | { 17 | "Id": "pkeyverify", 18 | "Name": "Public Key Verification", 19 | "QDocModule": "qtpurchasing", 20 | "QtUsage": "Used on Android in verification of purchases if a public key is set.", 21 | "Files": "Security.java", 22 | 23 | "Description": "Verifies a given signature on data.", 24 | "License": "Apache License 2.0", 25 | "LicenseId": "Apache-2.0", 26 | "LicenseFile": "../../../../../LICENSE-APACHE-2.0.txt", 27 | "Copyright": "Copyright (c) 2012 Google Inc." 28 | } 29 | ] 30 | -------------------------------------------------------------------------------- /src/imports/imports.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = purchasing 3 | 4 | -------------------------------------------------------------------------------- /src/imports/purchasing/inapppurchase.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qinappstoreqmltype_p.h" 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | QT_BEGIN_NAMESPACE 38 | 39 | class QInAppPurchaseModule : public QQmlExtensionPlugin 40 | { 41 | Q_OBJECT 42 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) 43 | public: 44 | QInAppPurchaseModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { } 45 | void registerTypes(const char *uri) override 46 | { 47 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtPurchasing")); 48 | 49 | qmlRegisterType(uri, 50 | 1, 0, 51 | "Store"); 52 | qmlRegisterType(uri, 53 | 1, 0, 54 | "Product"); 55 | qmlRegisterUncreatableType(uri, 56 | 1, 0, 57 | "Transaction", 58 | tr("Transaction is provided by InAppStore")); 59 | 60 | // Register the latest Qt version as QML type version 61 | qmlRegisterModule(uri, 1, QT_VERSION_MINOR); 62 | } 63 | 64 | void initializeEngine(QQmlEngine *engine, const char *uri) override 65 | { 66 | Q_UNUSED(uri); 67 | Q_UNUSED(engine); 68 | } 69 | }; 70 | 71 | QT_END_NAMESPACE 72 | 73 | #include "inapppurchase.moc" 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/imports/purchasing/plugins.qmltypes: -------------------------------------------------------------------------------- 1 | import QtQuick.tooling 1.2 2 | 3 | // This file describes the plugin-supplied types contained in the library. 4 | // It is used for QML tooling purposes only. 5 | // 6 | // This file was auto-generated by: 7 | // 'qmlplugindump -nonrelocatable QtPurchasing 1.15' 8 | 9 | Module { 10 | dependencies: ["QtQuick 2.0"] 11 | Component { 12 | name: "QInAppProductQmlType" 13 | prototype: "QObject" 14 | exports: ["QtPurchasing/Product 1.0"] 15 | exportMetaObjectRevisions: [0] 16 | Enum { 17 | name: "Status" 18 | values: { 19 | "Uninitialized": 0, 20 | "PendingRegistration": 1, 21 | "Registered": 2, 22 | "Unknown": 3 23 | } 24 | } 25 | Enum { 26 | name: "ProductType" 27 | values: { 28 | "Consumable": 0, 29 | "Unlockable": 1 30 | } 31 | } 32 | Property { name: "identifier"; type: "string" } 33 | Property { name: "type"; type: "ProductType" } 34 | Property { name: "price"; type: "string"; isReadonly: true } 35 | Property { name: "title"; type: "string"; isReadonly: true } 36 | Property { name: "description"; type: "string"; isReadonly: true } 37 | Property { name: "status"; type: "Status"; isReadonly: true } 38 | Property { name: "store"; type: "QInAppStoreQmlType"; isPointer: true } 39 | Signal { 40 | name: "purchaseSucceeded" 41 | Parameter { name: "transaction"; type: "QInAppTransaction"; isPointer: true } 42 | } 43 | Signal { 44 | name: "purchaseFailed" 45 | Parameter { name: "transaction"; type: "QInAppTransaction"; isPointer: true } 46 | } 47 | Signal { 48 | name: "purchaseRestored" 49 | Parameter { name: "transaction"; type: "QInAppTransaction"; isPointer: true } 50 | } 51 | Method { name: "purchase" } 52 | Method { name: "resetStatus" } 53 | } 54 | Component { 55 | name: "QInAppStoreQmlType" 56 | defaultProperty: "products" 57 | prototype: "QObject" 58 | exports: ["QtPurchasing/Store 1.0"] 59 | exportMetaObjectRevisions: [0] 60 | Property { name: "products"; type: "QInAppProductQmlType"; isList: true; isReadonly: true } 61 | Method { name: "restorePurchases" } 62 | } 63 | Component { 64 | name: "QInAppTransaction" 65 | prototype: "QObject" 66 | exports: ["QtPurchasing/Transaction 1.0"] 67 | isCreatable: false 68 | exportMetaObjectRevisions: [0] 69 | Enum { 70 | name: "TransactionStatus" 71 | values: { 72 | "Unknown": 0, 73 | "PurchaseApproved": 1, 74 | "PurchaseFailed": 2, 75 | "PurchaseRestored": 3 76 | } 77 | } 78 | Enum { 79 | name: "FailureReason" 80 | values: { 81 | "NoFailure": 0, 82 | "CanceledByUser": 1, 83 | "ErrorOccurred": 2 84 | } 85 | } 86 | Property { name: "status"; type: "TransactionStatus"; isReadonly: true } 87 | Property { name: "product"; type: "QInAppProduct"; isReadonly: true; isPointer: true } 88 | Property { name: "orderId"; type: "string"; isReadonly: true } 89 | Property { name: "failureReason"; type: "FailureReason"; isReadonly: true } 90 | Property { name: "errorString"; type: "string"; isReadonly: true } 91 | Property { name: "timestamp"; type: "QDateTime"; isReadonly: true } 92 | Method { name: "finalize" } 93 | Method { 94 | name: "platformProperty" 95 | type: "string" 96 | Parameter { name: "propertyName"; type: "string" } 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/imports/purchasing/purchasing.pro: -------------------------------------------------------------------------------- 1 | CXX_MODULE = purchasing 2 | TARGET = declarative_purchasing 3 | TARGETPATH = QtPurchasing 4 | IMPORT_VERSION = 1.$$QT_MINOR_VERSION 5 | 6 | QT += qml quick purchasing purchasing-private 7 | SOURCES += \ 8 | $$PWD/inapppurchase.cpp \ 9 | $$PWD/qinappproductqmltype.cpp \ 10 | $$PWD/qinappstoreqmltype.cpp 11 | 12 | win32 { 13 | CONFIG += skip_target_version_ext 14 | VERSION = $$MODULE_VERSION 15 | QMAKE_TARGET_PRODUCT = "Qt Purchasing (Qt $$QT_VERSION)" 16 | QMAKE_TARGET_DESCRIPTION = "Purchasing QML plugin for Qt." 17 | } 18 | 19 | HEADERS += \ 20 | $$PWD/qinappproductqmltype_p.h \ 21 | $$PWD/qinappstoreqmltype_p.h 22 | 23 | OTHER_FILES += qmldir 24 | 25 | load(qml_plugin) 26 | -------------------------------------------------------------------------------- /src/imports/purchasing/qinappproductqmltype_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPPRODUCTQMLTYPE_P_H 30 | #define QINAPPPRODUCTQMLTYPE_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | Q_MOC_INCLUDE("qinappstoreqmltype_p.h") 48 | 49 | QT_BEGIN_NAMESPACE 50 | 51 | class QInAppTransaction; 52 | class QInAppStoreQmlType; 53 | class QInAppProductQmlType : public QObject, public QQmlParserStatus 54 | { 55 | Q_OBJECT 56 | Q_INTERFACES(QQmlParserStatus) 57 | Q_ENUMS(Status ProductType) 58 | Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged) 59 | Q_PROPERTY(ProductType type READ type WRITE setType NOTIFY typeChanged) 60 | Q_PROPERTY(QString price READ price NOTIFY priceChanged) 61 | Q_PROPERTY(QString title READ title NOTIFY titleChanged) 62 | Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) 63 | Q_PROPERTY(Status status READ status NOTIFY statusChanged) 64 | Q_PROPERTY(QInAppStoreQmlType *store READ store WRITE setStore NOTIFY storeChanged) 65 | public: 66 | enum Status { 67 | Uninitialized, 68 | PendingRegistration, 69 | Registered, 70 | Unknown 71 | }; 72 | 73 | // Must match QInAppProduct::ProductType 74 | enum ProductType { 75 | Consumable, 76 | Unlockable 77 | }; 78 | 79 | explicit QInAppProductQmlType(QObject *parent = 0); 80 | 81 | Q_INVOKABLE void purchase(); 82 | Q_INVOKABLE void resetStatus(); 83 | 84 | void setIdentifier(const QString &identifier); 85 | QString identifier() const; 86 | 87 | Status status() const; 88 | QString price() const; 89 | QString title() const; 90 | QString description() const; 91 | 92 | void setStore(QInAppStoreQmlType *store); 93 | QInAppStoreQmlType *store() const; 94 | 95 | void setType(ProductType type); 96 | ProductType type() const; 97 | 98 | Q_SIGNALS: 99 | void purchaseSucceeded(QInAppTransaction *transaction); 100 | void purchaseFailed(QInAppTransaction *transaction); 101 | void purchaseRestored(QInAppTransaction *transaction); 102 | void identifierChanged(); 103 | void statusChanged(); 104 | void priceChanged(); 105 | void titleChanged(); 106 | void descriptionChanged(); 107 | void storeChanged(); 108 | void typeChanged(); 109 | 110 | protected: 111 | void componentComplete() override; 112 | void classBegin() override {} 113 | 114 | private Q_SLOTS: 115 | void handleTransaction(QInAppTransaction *transaction); 116 | void handleProductRegistered(QInAppProduct *product); 117 | void handleProductUnknown(QInAppProduct::ProductType, const QString &identifier); 118 | 119 | private: 120 | void setProduct(QInAppProduct *product); 121 | void updateProduct(); 122 | 123 | QString m_identifier; 124 | Status m_status; 125 | QInAppProductQmlType::ProductType m_type; 126 | bool m_componentComplete; 127 | 128 | QInAppStoreQmlType *m_store; 129 | QInAppProduct *m_product; 130 | }; 131 | 132 | QT_END_NAMESPACE 133 | 134 | #endif // QINAPPPRODUCTQMLTYPE_P_H 135 | -------------------------------------------------------------------------------- /src/imports/purchasing/qinappstoreqmltype.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qinappstoreqmltype_p.h" 30 | #include 31 | 32 | QT_BEGIN_NAMESPACE 33 | 34 | /*! 35 | \qmltype Store 36 | \inqmlmodule QtPurchasing 37 | \since QtPurchasing 1.0 38 | \ingroup qtpurchasing 39 | \brief Access point to the external market place for in-app purchases. 40 | 41 | When using the Qt Purchasing API in QML, the application should instantiate 42 | one Store and then instantiate products as children of this store. The products 43 | created as children of the Store object will automatically be queried from the 44 | external market place if one is available on the current platform. 45 | 46 | The following example registers a store with three products, two consumable 47 | products and one unlockable. 48 | \qml 49 | Store { 50 | Product { 51 | identifier: "myConsumableProduct1" 52 | type: Product.Consumable 53 | 54 | // ... 55 | } 56 | 57 | Product { 58 | identifier: "myConsumableProduct2" 59 | type: Product.Consumable 60 | 61 | // ... 62 | } 63 | 64 | Product { 65 | identifier: "myUnlockableProduct" 66 | type: Product.Unlockable 67 | 68 | // ... 69 | } 70 | 71 | // ... 72 | } 73 | \endqml 74 | */ 75 | 76 | static void addProduct(QQmlListProperty *property, QInAppProductQmlType *product) 77 | { 78 | QInAppStoreQmlType *store = qobject_cast(property->object); 79 | Q_ASSERT(store != 0); 80 | product->setStore(store); 81 | 82 | QList *products = reinterpret_cast *>(property->data); 83 | Q_ASSERT(products != 0); 84 | 85 | products->append(product); 86 | } 87 | 88 | static int productCount(QQmlListProperty *property) 89 | { 90 | QList *products = reinterpret_cast *>(property->data); 91 | Q_ASSERT(products != 0); 92 | 93 | return products->size(); 94 | } 95 | 96 | static void clearProducts(QQmlListProperty *property) 97 | { 98 | QList *products = reinterpret_cast *>(property->data); 99 | Q_ASSERT(products != 0); 100 | 101 | for (int i=0; isize(); ++i) { 102 | QInAppProductQmlType *product = products->at(i); 103 | product->setStore(0); 104 | } 105 | products->clear(); 106 | } 107 | 108 | static QInAppProductQmlType *productAt(QQmlListProperty *property, int index) 109 | { 110 | QList *m_products = reinterpret_cast *>(property->data); 111 | Q_ASSERT(m_products != 0); 112 | 113 | return m_products->at(index); 114 | } 115 | 116 | QInAppStoreQmlType::QInAppStoreQmlType(QObject *parent) 117 | : QObject(parent) 118 | , m_store(new QInAppStore(this)) 119 | { 120 | } 121 | 122 | QInAppStore *QInAppStoreQmlType::store() const 123 | { 124 | return m_store; 125 | } 126 | 127 | QQmlListProperty QInAppStoreQmlType::products() 128 | { 129 | return QQmlListProperty(this, &m_products, &addProduct, &productCount, &productAt, &clearProducts); 130 | } 131 | 132 | /*! 133 | \qmlmethod QtPurchasing::Store::restorePurchases() 134 | 135 | Calling this method will cause onPurchaseRestored handlers to be called 136 | asynchronously on previously purchased unlockable products. This can be 137 | used to restore purchases for unlockable products when the application is 138 | run by the same user on multiple devices, or for example if the application 139 | has been uninstalled and reinstalled on the device so that the purchase data 140 | has been lost. 141 | 142 | \note On some platforms, such as iOS, this will require the user to input their 143 | password to launch the restore process. On other platforms, such as Android, 144 | it is not typically needed, as the onPurchaseSucceeded handler will be called 145 | on any previously purchased unlockable product if the application data is 146 | removed. 147 | */ 148 | void QInAppStoreQmlType::restorePurchases() 149 | { 150 | m_store->restorePurchases(); 151 | } 152 | 153 | QT_END_NAMESPACE 154 | -------------------------------------------------------------------------------- /src/imports/purchasing/qinappstoreqmltype_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPSTOREQMLTYPE_P_H 30 | #define QINAPPSTOREQMLTYPE_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinappproductqmltype_p.h" 44 | #include 45 | 46 | #include 47 | #include 48 | 49 | QT_BEGIN_NAMESPACE 50 | 51 | class QInAppStore; 52 | class QInAppStoreQmlType : public QObject 53 | { 54 | Q_OBJECT 55 | Q_PROPERTY(QQmlListProperty products READ products DESIGNABLE false) 56 | Q_CLASSINFO("DefaultProperty", "products") 57 | public: 58 | explicit QInAppStoreQmlType(QObject *parent = 0); 59 | 60 | QInAppStore *store() const; 61 | QQmlListProperty products(); 62 | 63 | Q_INVOKABLE void restorePurchases(); 64 | 65 | private: 66 | QInAppStore *m_store; 67 | QList m_products; 68 | }; 69 | 70 | QT_END_NAMESPACE 71 | 72 | #endif // QINAPPSTOREQMLTYPE_P_H 73 | -------------------------------------------------------------------------------- /src/imports/purchasing/qmldir: -------------------------------------------------------------------------------- 1 | module QtPurchasing 2 | plugin declarative_purchasing 3 | typeinfo plugins.qmltypes 4 | classname QInAppPurchaseModule 5 | -------------------------------------------------------------------------------- /src/purchasing/doc/qtpurchasing-examples.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \group qtpurchasing-examples 30 | \title Qt Purchasing Examples 31 | \brief Examples for the Qt Purchasing module 32 | 33 | These are the Qt Purchasing examples. 34 | 35 | */ 36 | 37 | -------------------------------------------------------------------------------- /src/purchasing/doc/qtpurchasing.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) 2 | include($QT_INSTALL_DOCS/config/exampleurl-qtpurchasing.qdocconf) 3 | 4 | project = QtPurchasing 5 | description = Qt Purchasing Reference Documentation 6 | version = $QT_VERSION 7 | 8 | qhp.projects = QtPurchasing 9 | 10 | qhp.QtPurchasing.file = qtpurchasing.qhp 11 | qhp.QtPurchasing.namespace = org.qt-project.qtpurchasing.$QT_VERSION_TAG 12 | qhp.QtPurchasing.virtualFolder = qtpurchasing 13 | qhp.QtPurchasing.indexTitle = Qt Purchasing 14 | qhp.QtPurchasing.indexRoot = 15 | qhp.QtPurchasing.filterAttributes = qtpurchasing $QT_VERSION qtrefdoc 16 | qhp.QtPurchasing.customFilters.Qt.name = QtPurchasing $QT_VERSION 17 | qhp.QtPurchasing.customFilters.Qt.filterAttributes = qtpurchasing $QT_VERSION 18 | 19 | qhp.QtPurchasing.subprojects = qmltypes classes examples 20 | 21 | qhp.QtPurchasing.subprojects.qmltypes.title = QML Types 22 | qhp.QtPurchasing.subprojects.qmltypes.indexTitle = Qt Purchasing QML Types 23 | qhp.QtPurchasing.subprojects.qmltypes.selectors = qmlclass 24 | qhp.QtPurchasing.subprojects.qmltypes.sortPages = true 25 | 26 | qhp.QtPurchasing.subprojects.classes.title = C++ Classes 27 | qhp.QtPurchasing.subprojects.classes.indexTitle = Qt Purchasing C++ Classes 28 | qhp.QtPurchasing.subprojects.classes.selectors = class fake:headerfile 29 | qhp.QtPurchasing.subprojects.classes.sortPages = true 30 | 31 | qhp.QtPurchasing.subprojects.examples.title = Examples 32 | qhp.QtPurchasing.subprojects.examples.indexTitle = Qt Purchasing Examples 33 | qhp.QtPurchasing.subprojects.examples.selectors = fake:example 34 | qhp.QtPurchasing.subprojects.examples.sortPages = true 35 | 36 | depends += qtcore qtqml qtquick qtdoc qtquickcontrols qmake 37 | 38 | headerdirs += \ 39 | .. \ 40 | ../../imports/purchasing 41 | 42 | sourcedirs += \ 43 | .. \ 44 | ../../imports/purchasing 45 | 46 | exampledirs += \ 47 | ../../../examples/purchasing 48 | 49 | imagedirs += images 50 | 51 | examplesinstallpath = purchasing 52 | 53 | Cpp.ignoretokens += Q_PURCHASING_EXPORT 54 | 55 | navigation.landingpage = "Qt Purchasing" 56 | navigation.qmltypespage = "Qt Purchasing QML Types" 57 | navigation.cppclassespage = "Qt Purchasing C++ Classes" 58 | -------------------------------------------------------------------------------- /src/purchasing/doc/src/qtpurchasing-cpp.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \module QtPurchasing 30 | \title Qt Purchasing C++ Classes 31 | \ingroup modules 32 | 33 | \brief Provides C++ classes for in-app purchasing. 34 | 35 | To include the definitions of the module's classes, use the following directive: 36 | 37 | \code 38 | #include 39 | \endcode 40 | 41 | To link against the module, add this line to your \l qmake \c .pro file: 42 | 43 | \code 44 | QT += purchasing 45 | \endcode 46 | 47 | For more information about using these classes in your application, 48 | see the \l{Qt Purchasing} documentation. 49 | */ 50 | -------------------------------------------------------------------------------- /src/purchasing/doc/src/qtpurchasing-overview.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \page qtpurchasing-index.html 30 | \title Qt Purchasing 31 | \brief A cross-platform library to facilitate in-app purchases in Qt and Qt Quick application 32 | 33 | Qt Purchasing is an add-on library that enables Qt applications to support 34 | in-app purchases. It is a cross-platform library that currently supports 35 | purchases made to the Mac App Store on OS X, App Store on iOS, and Google Play on Android. 36 | 37 | \section1 In-App Purchases 38 | 39 | In-app purchases are a way to monetize an application. These purchases are 40 | made from inside the application and can include anything from unlocking 41 | content to virtual items. The Qt Purchasing API is built on the system APIs 42 | for in-app purchases, which means the purchase process is more familiar to 43 | the user, and the information already stored by the platform (such as credit 44 | card information) can be used to simplify the purchase process. 45 | 46 | \section1 Getting Started 47 | 48 | Qt Purchasing provides C++ classes and QML types to access information about 49 | in-app products registered in the external store on the current platform, as 50 | well as to request purchases for those products. 51 | 52 | \section2 The Store 53 | 54 | The in-app products must be registered in the target stores, before they 55 | can be queried or purchased in an application. We recommend using the same 56 | identifiers for the products in each store, as it simplifies the code to 57 | query and purchase the products. 58 | 59 | \list 60 | \li \l{Registering Products in Google Play} 61 | \li \l{Registering Products in App Store} 62 | \li \l{Registering Products in Windows Store} 63 | \endlist 64 | 65 | \section2 Writing the Code 66 | 67 | Depending on what fits best with the application, you can choose to use either C++ or 68 | QML to support in-app purchasing. If most of the user interface is written in QML, 69 | we recommend that you use the QML types, which provide a simple and declarative 70 | point of access for the products in the store. 71 | 72 | \list 73 | \li \l{Getting Started with Qt Purchasing in QML} 74 | \li \l{Getting started with Qt Purchasing in C++} 75 | \endlist 76 | 77 | \section1 Examples 78 | 79 | Take a look at the \l{Qt Purchasing Examples} for a demonstration on 80 | how the APIs can be used in applications. 81 | 82 | \section1 Licenses and Attributions 83 | 84 | Qt Purchasing is available under commercial licenses from \l{The Qt Company}. 85 | In addition, it is available under the \l{GNU Lesser General Public License, version 3}. 86 | See \l{Qt Licensing} for further details. 87 | 88 | Furthermore Qt Purchasing on Android contains third party modules under the following 89 | permissive licenses: 90 | 91 | \generatelist{groupsbymodule attributions-qtpurchasing} 92 | 93 | \section1 API Reference 94 | 95 | \list 96 | \li \l{Qt Purchasing QML Types} 97 | \li \l{Qt Purchasing C++ Classes} 98 | \endlist 99 | 100 | */ 101 | -------------------------------------------------------------------------------- /src/purchasing/doc/src/qtpurchasing-qmltypes.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \qmlmodule QtPurchasing 1.\QtMinorVersion 30 | \title Qt Purchasing QML Types 31 | \ingroup qmlmodules 32 | \brief Provides QML types for in-app purchasing. 33 | 34 | The Qt Purchasing module provides QML types that can be used to query 35 | and purchase products registered for the application in the external market 36 | place on the current platform. 37 | 38 | The QML types can be imported into your application using the following 39 | import statement: 40 | 41 | \qml \QtMinorVersion 42 | import QtPurchasing 1.\1 43 | \endqml 44 | 45 | To link against the module, add this line to your \l qmake \c .pro file: 46 | 47 | \code 48 | QT += purchasing 49 | \endcode 50 | 51 | For more information about using these types in your application, 52 | see the \l{Qt Purchasing} documentation. 53 | */ 54 | -------------------------------------------------------------------------------- /src/purchasing/doc/src/windowsstore.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | 30 | \page qtpurchasing-windowsstore.html 31 | \title Registering Products in Windows Store 32 | \brief A short guide to registering in-app products in Windows Store. 33 | 34 | This guide provides a brief introduction to registering an application 35 | and its in-app products on Windows Store. 36 | 37 | In-App purchasing for WinRT differentiates between two modes: 38 | \list 39 | \li \c{Simulation}: All Windows Store interaction is emulated and controlled 40 | via a configuration XML file. A project containing this file will fail 41 | certification and cannot be published. 42 | \li \c{Store interaction}: The application talks to the Windows Store 43 | directly without any layer in between. This binary can neither be side-loaded 44 | nor tested locally. The user has to retrieve the app through the Windows 45 | Store itself. 46 | \endlist 47 | 48 | \section1 Using the Simulation Mode 49 | 50 | During the development process it is not allowed to interact with the Windows 51 | Store directly. Instead, an XML file has to be used, describing the available 52 | in-app products and the license of the application itself. Go to the 53 | \l{https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.store.currentappsimulator.aspx}{MSDN documentation} 54 | for more information on the format of this XML file. 55 | 56 | This XML file has to be added to the root directory of the application 57 | resources and named \b{QtStoreSimulation.xml}. 58 | 59 | \section1 Using the Windows Store 60 | \section2 Adding In-App Products to Windows Store 61 | In order to access in-app products from your application, you must register 62 | them to the Windows Store. Go the the \uicontrol{IAPs} page and click 63 | \uicontrol{Create a new IAP}. 64 | 65 | Fill out the following information about your product: 66 | \list 67 | \li \uicontrol{Product type} – Choose either \uicontrol{Consumable} or 68 | \uicontrol{Durable} depending on the type of the in-app product. Note that 69 | you will \b{not} be able to change this later. 70 | \li \uicontrol{Product ID} – An identifier that is used to access the 71 | product from your code. 72 | \li \uicontrol{Pricing and Availability} – Price for the product and 73 | the geographical areas where it is available. 74 | \endlist 75 | 76 | In-app products will be available once you have published the application. 77 | 78 | \section2 Publishing Your Application 79 | 80 | In order to test in-app purchases in your application, you first have to 81 | publish it. To limit the users who can access the application before it is 82 | ready for production, it can be published as either alpha or beta. 83 | 84 | \section1 Platform Notes 85 | 86 | The Windows Store provides a way to set an application into trial mode and 87 | buy the application itself via in-app purchases. To reflect this 88 | functionality, the WinRT backend uses the \b{app} keyword as an 89 | \l{QInAppProduct::identifier}{identifier}. If a product query for \b{app} 90 | succeeds, the current license is valid. The 91 | \l{QInAppProduct::title()}{product name} itself will provide information on 92 | the license state of the app and can have the following content: 93 | 94 | \list 95 | \li \c{Trial period}: The app is in trial mode and can be purchased. 96 | \li \c{Fully licensed}: The app has been bought. 97 | \endlist 98 | 99 | If a product query for \b{app} fails, then either the trial has expired 100 | or the license is invalid. Your app should check for this product and react 101 | accordingly, for instance by showing a dialog to the user. 102 | 103 | */ 104 | 105 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/android/android.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | SOURCES += \ 3 | $$PWD/qandroidinapppurchasebackend.cpp \ 4 | $$PWD/qandroidjni.cpp \ 5 | $$PWD/qandroidinapptransaction.cpp \ 6 | $$PWD/qandroidinappproduct.cpp 7 | HEADERS += \ 8 | $$PWD/qandroidinapppurchasebackend_p.h \ 9 | $$PWD/qandroidinapptransaction_p.h \ 10 | $$PWD/qandroidinappproduct_p.h 11 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/android/qandroidinappproduct.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qandroidinappproduct_p.h" 30 | #include "qandroidinapppurchasebackend_p.h" 31 | 32 | QT_BEGIN_NAMESPACE 33 | 34 | QAndroidInAppProduct::QAndroidInAppProduct(QAndroidInAppPurchaseBackend *backend, 35 | const QString &price, 36 | const QString &title, 37 | const QString &description, 38 | ProductType productType, 39 | const QString &identifier, 40 | QObject *parent) 41 | : QInAppProduct(price, title, description, productType, identifier, parent) 42 | , m_backend(backend) 43 | { 44 | } 45 | 46 | 47 | void QAndroidInAppProduct::purchase() 48 | { 49 | m_backend->purchaseProduct(this); 50 | } 51 | 52 | QT_END_NAMESPACE 53 | 54 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/android/qandroidinappproduct_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QANDROIDINAPPPRODUCT_P_H 30 | #define QANDROIDINAPPPRODUCT_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinappproduct.h" 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QAndroidInAppPurchaseBackend; 48 | class QAndroidInAppProduct : public QInAppProduct 49 | { 50 | Q_OBJECT 51 | public: 52 | explicit QAndroidInAppProduct(QAndroidInAppPurchaseBackend *backend, 53 | const QString &price, 54 | const QString &title, 55 | const QString &description, 56 | ProductType productType, 57 | const QString &identifier, 58 | QObject *parent = 0); 59 | 60 | 61 | void purchase(); 62 | 63 | private: 64 | QAndroidInAppPurchaseBackend *m_backend; 65 | }; 66 | 67 | QT_END_NAMESPACE 68 | 69 | #endif // QANDROIDINAPPPRODUCT_P_H 70 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/android/qandroidinapptransaction.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qandroidinapptransaction_p.h" 30 | #include "qandroidinapppurchasebackend_p.h" 31 | #include "qinappproduct.h" 32 | 33 | QT_BEGIN_NAMESPACE 34 | 35 | QAndroidInAppTransaction::QAndroidInAppTransaction(const QString &signature, 36 | const QString &data, 37 | const QString &purchaseToken, 38 | const QString &orderId, 39 | TransactionStatus status, 40 | QInAppProduct *product, 41 | const QDateTime ×tamp, 42 | FailureReason failureReason, 43 | const QString &errorString, 44 | QObject *parent) 45 | : QInAppTransaction(status, product, parent) 46 | , m_signature(signature) 47 | , m_data(data) 48 | , m_purchaseToken(purchaseToken) 49 | , m_orderId(orderId) 50 | , m_timestamp(timestamp) 51 | , m_errorString(errorString) 52 | , m_failureReason(failureReason) 53 | { 54 | Q_ASSERT(qobject_cast(parent) != 0); 55 | } 56 | 57 | QString QAndroidInAppTransaction::orderId() const 58 | { 59 | return m_orderId; 60 | } 61 | 62 | QDateTime QAndroidInAppTransaction::timestamp() const 63 | { 64 | return m_timestamp; 65 | } 66 | 67 | QString QAndroidInAppTransaction::errorString() const 68 | { 69 | return m_errorString; 70 | } 71 | 72 | QInAppTransaction::FailureReason QAndroidInAppTransaction::failureReason() const 73 | { 74 | return m_failureReason; 75 | } 76 | 77 | QString QAndroidInAppTransaction::platformProperty(const QString &propertyName) const 78 | { 79 | if (propertyName.compare(QStringLiteral("AndroidSignature"), Qt::CaseInsensitive) == 0) 80 | return m_signature; 81 | else if (propertyName.compare(QStringLiteral("AndroidPurchaseData"), Qt::CaseInsensitive) == 0) 82 | return m_data; 83 | else 84 | return QInAppTransaction::platformProperty(propertyName); 85 | } 86 | 87 | void QAndroidInAppTransaction::finalize() 88 | { 89 | QAndroidInAppPurchaseBackend *backend = qobject_cast(parent()); 90 | if (status() == PurchaseApproved || status() == PurchaseRestored) { 91 | if (product()->productType() == QInAppProduct::Consumable) 92 | backend->consumeTransaction(m_purchaseToken); 93 | else 94 | backend->registerFinalizedUnlockable(product()->identifier()); 95 | } 96 | 97 | deleteLater(); 98 | } 99 | 100 | QT_END_NAMESPACE 101 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/android/qandroidinapptransaction_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QANDROIDINAPPTRANSACTION_P_H 30 | #define QANDROIDINAPPTRANSACTION_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include 44 | #include 45 | 46 | #include "qinapptransaction.h" 47 | 48 | QT_BEGIN_NAMESPACE 49 | 50 | class QAndroidInAppTransaction : public QInAppTransaction 51 | { 52 | Q_OBJECT 53 | public: 54 | explicit QAndroidInAppTransaction(const QString &signature, 55 | const QString &data, 56 | const QString &purchaseToken, 57 | const QString &orderId, 58 | TransactionStatus status, 59 | QInAppProduct *product, 60 | const QDateTime ×tamp, 61 | FailureReason failureReason, 62 | const QString &errorString, 63 | QObject *parent = 0); 64 | 65 | void finalize(); 66 | 67 | QString orderId() const; 68 | QString errorString() const; 69 | FailureReason failureReason() const; 70 | QDateTime timestamp() const; 71 | QString platformProperty(const QString &propertyName) const; 72 | 73 | private: 74 | QString m_signature; 75 | QString m_data; 76 | QString m_purchaseToken; 77 | QString m_orderId; 78 | QDateTime m_timestamp; 79 | QString m_errorString; 80 | FailureReason m_failureReason; 81 | }; 82 | 83 | QT_END_NAMESPACE 84 | 85 | #endif // QANDROIDINAPPTRANSACTION_P_H 86 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/inapppurchase.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | 3 | ANDROID_PERMISSIONS += \ 4 | com.android.vending.BILLING 5 | 6 | HEADERS += \ 7 | $$PWD/qinappstore.h \ 8 | $$PWD/qinappproduct.h \ 9 | $$PWD/qinapptransaction.h \ 10 | $$PWD/qinappstore_p.h \ 11 | $$PWD/qinapppurchasebackend_p.h \ 12 | $$PWD/qinapppurchasebackendfactory_p.h 13 | 14 | SOURCES += \ 15 | $$PWD/qinappproduct.cpp \ 16 | $$PWD/qinapptransaction.cpp \ 17 | $$PWD/qinappstore.cpp \ 18 | $$PWD/qinapppurchasebackend.cpp \ 19 | $$PWD/qinapppurchasebackendfactory.cpp 20 | 21 | android { 22 | QT += androidextras 23 | include ($$PWD/android/android.pri) 24 | } 25 | 26 | darwin:!watchos { 27 | include ($$PWD/mac/mac.pri) 28 | } 29 | 30 | winrt { 31 | include ($$PWD/winrt/winrt.pri) 32 | } 33 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/mac/mac.pri: -------------------------------------------------------------------------------- 1 | LIBS += -framework StoreKit -framework Foundation 2 | INCLUDEPATH += $$PWD 3 | HEADERS += \ 4 | $$PWD/qmacinapppurchasebackend_p.h \ 5 | $$PWD/qmacinapppurchasetransaction_p.h \ 6 | $$PWD/qmacinapppurchaseproduct_p.h 7 | 8 | OBJECTIVE_SOURCES += \ 9 | $$PWD/qmacinapppurchasebackend.mm \ 10 | $$PWD/qmacinapppurchaseproduct.mm \ 11 | $$PWD/qmacinapppurchasetransaction.mm 12 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/mac/qmacinapppurchasebackend_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QMACINAPPPURCHASEBACKEND_P_H 30 | #define QMACINAPPPURCHASEBACKEND_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinapppurchasebackend_p.h" 44 | #include "qinappproduct.h" 45 | #include "qinapptransaction.h" 46 | 47 | #include 48 | 49 | Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(InAppPurchaseManager)); 50 | 51 | QT_BEGIN_NAMESPACE 52 | 53 | class QMacInAppPurchaseProduct; 54 | class QMacInAppPurchaseTransaction; 55 | 56 | class QMacInAppPurchaseBackend : public QInAppPurchaseBackend 57 | { 58 | Q_OBJECT 59 | public: 60 | QMacInAppPurchaseBackend(QObject *parent = 0); 61 | ~QMacInAppPurchaseBackend(); 62 | 63 | void initialize(); 64 | bool isReady() const; 65 | void queryProduct(QInAppProduct::ProductType productType, const QString &identifier); 66 | void restorePurchases(); 67 | void setPlatformProperty(const QString &propertyName, const QString &value); 68 | 69 | //Called by InAppPurchaseManager 70 | Q_INVOKABLE void registerProduct(QMacInAppPurchaseProduct *product); 71 | Q_INVOKABLE void registerQueryFailure(const QString &productId); 72 | Q_INVOKABLE void registerTransaction(QMacInAppPurchaseTransaction *transaction); 73 | QInAppProduct::ProductType productTypeForProductId(const QString &productId); 74 | QMacInAppPurchaseProduct *registeredProductForProductId(const QString &productId); 75 | 76 | private: 77 | QT_MANGLE_NAMESPACE(InAppPurchaseManager) *m_iapManager; 78 | QHash m_productTypeForPendingId; 79 | QHash m_registeredProductForId; 80 | 81 | private slots: 82 | void setParentToBackend(QObject *object); 83 | }; 84 | 85 | QT_END_NAMESPACE 86 | 87 | #endif // QMACINAPPPURCHASEBACKEND_P_H 88 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/mac/qmacinapppurchaseproduct.mm: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qmacinapppurchaseproduct_p.h" 30 | #include "qmacinapppurchasebackend_p.h" 31 | 32 | #import 33 | 34 | QT_BEGIN_NAMESPACE 35 | 36 | static NSString *localizedPrice(SKProduct *product) 37 | { 38 | NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; 39 | [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; 40 | [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; 41 | [numberFormatter setLocale:product.priceLocale]; 42 | NSString *formattedString = [numberFormatter stringFromNumber:product.price]; 43 | [numberFormatter release]; 44 | return formattedString; 45 | } 46 | 47 | QMacInAppPurchaseProduct::QMacInAppPurchaseProduct(SKProduct *product, 48 | ProductType productType, 49 | QMacInAppPurchaseBackend *backend) 50 | : QInAppProduct(QString::fromNSString(localizedPrice(product)), 51 | QString::fromNSString([product localizedTitle]), 52 | QString::fromNSString([product localizedDescription]), 53 | productType, 54 | QString::fromNSString([product productIdentifier]), 55 | backend) 56 | , m_nativeProduct(product) 57 | { 58 | } 59 | 60 | void QMacInAppPurchaseProduct::purchase() 61 | { 62 | SKPayment *payment = [SKPayment paymentWithProduct:m_nativeProduct]; 63 | [[SKPaymentQueue defaultQueue] addPayment:payment]; 64 | } 65 | 66 | QT_END_NAMESPACE 67 | 68 | #include "moc_qmacinapppurchaseproduct_p.cpp" 69 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/mac/qmacinapppurchaseproduct_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QMACINAPPPURCHASEPRODUCT_P_H 30 | #define QMACINAPPPURCHASEPRODUCT_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinappproduct.h" 44 | 45 | @class SKProduct; 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class QMacInAppPurchaseBackend; 50 | 51 | class QMacInAppPurchaseProduct : public QInAppProduct 52 | { 53 | Q_OBJECT 54 | public: 55 | explicit QMacInAppPurchaseProduct(SKProduct *product, 56 | ProductType productType, 57 | QMacInAppPurchaseBackend *backend = 0); 58 | void purchase(); 59 | 60 | private: 61 | SKProduct *m_nativeProduct; 62 | }; 63 | 64 | QT_END_NAMESPACE 65 | 66 | Q_DECLARE_METATYPE(QMacInAppPurchaseProduct*) 67 | 68 | #endif // QMACINAPPPURCHASEPRODUCT_P_H 69 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/mac/qmacinapppurchasetransaction.mm: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qmacinapppurchasetransaction_p.h" 30 | #include "qmacinapppurchasebackend_p.h" 31 | 32 | #import 33 | 34 | QT_BEGIN_NAMESPACE 35 | 36 | QMacInAppPurchaseTransaction::QMacInAppPurchaseTransaction(SKPaymentTransaction *transaction, 37 | const TransactionStatus status, 38 | QInAppProduct *product, 39 | QMacInAppPurchaseBackend *backend) 40 | : QInAppTransaction(status, product, backend) 41 | , m_nativeTransaction(transaction) 42 | , m_failureReason(NoFailure) 43 | { 44 | if (status == PurchaseFailed) { 45 | m_failureReason = ErrorOccurred; 46 | switch (m_nativeTransaction.error.code) { 47 | case SKErrorClientInvalid: 48 | m_errorString = QStringLiteral("Client Invalid"); 49 | break; 50 | case SKErrorPaymentCancelled: 51 | m_errorString = QStringLiteral("Payment Cancelled"); 52 | m_failureReason = CanceledByUser; 53 | break; 54 | case SKErrorPaymentInvalid: 55 | m_errorString = QStringLiteral("Payment Invalid"); 56 | break; 57 | case SKErrorPaymentNotAllowed: 58 | m_errorString = QStringLiteral("Payment Not Allowed"); 59 | break; 60 | #if defined(Q_OS_IOS) || defined(Q_OS_TVOS) 61 | case SKErrorStoreProductNotAvailable: 62 | m_errorString = QStringLiteral("Store Product Not Available"); 63 | break; 64 | #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(90300) || QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(90200) 65 | case SKErrorCloudServicePermissionDenied: 66 | m_errorString = QStringLiteral("Cloud Service Permission Denied"); 67 | break; 68 | case SKErrorCloudServiceNetworkConnectionFailed: 69 | m_errorString = QStringLiteral("Cloud Service Network Connection Failed"); 70 | break; 71 | #endif 72 | // rdar://35589806 73 | #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(100300) // || QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(100200) 74 | case SKErrorCloudServiceRevoked: 75 | m_errorString = QStringLiteral("Cloud Service Revoked"); 76 | break; 77 | #endif 78 | #endif 79 | case SKErrorUnknown: 80 | default: 81 | m_errorString = QString::fromNSString([m_nativeTransaction.error localizedDescription]); 82 | } 83 | } 84 | } 85 | 86 | void QMacInAppPurchaseTransaction::finalize() 87 | { 88 | [[SKPaymentQueue defaultQueue] finishTransaction:m_nativeTransaction]; 89 | } 90 | 91 | QString QMacInAppPurchaseTransaction::orderId() const 92 | { 93 | return QString::fromNSString(m_nativeTransaction.transactionIdentifier); 94 | } 95 | 96 | QInAppTransaction::FailureReason QMacInAppPurchaseTransaction::failureReason() const 97 | { 98 | return m_failureReason; 99 | } 100 | 101 | QString QMacInAppPurchaseTransaction::errorString() const 102 | { 103 | return m_errorString; 104 | } 105 | 106 | QDateTime QMacInAppPurchaseTransaction::timestamp() const 107 | { 108 | return QDateTime::fromNSDate(m_nativeTransaction.transactionDate); 109 | } 110 | 111 | QT_END_NAMESPACE 112 | 113 | #include "moc_qmacinapppurchasetransaction_p.cpp" 114 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/mac/qmacinapppurchasetransaction_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QMACINAPPTRANSACTION_P_H 30 | #define QMACINAPPTRANSACTION_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinapptransaction.h" 44 | #include 45 | 46 | @class SKPaymentTransaction; 47 | 48 | QT_BEGIN_NAMESPACE 49 | 50 | class QMacInAppPurchaseBackend; 51 | 52 | class QMacInAppPurchaseTransaction : public QInAppTransaction 53 | { 54 | Q_OBJECT 55 | public: 56 | QMacInAppPurchaseTransaction(SKPaymentTransaction *transaction, 57 | const TransactionStatus status, 58 | QInAppProduct *product, 59 | QMacInAppPurchaseBackend *backend = 0); 60 | 61 | void finalize(); 62 | QString orderId() const; 63 | FailureReason failureReason() const; 64 | QString errorString() const; 65 | QDateTime timestamp() const; 66 | 67 | private: 68 | SKPaymentTransaction *m_nativeTransaction; 69 | QString m_errorString; 70 | FailureReason m_failureReason; 71 | }; 72 | 73 | QT_END_NAMESPACE 74 | 75 | Q_DECLARE_METATYPE(QMacInAppPurchaseTransaction*) 76 | 77 | #endif // QMACINAPPTRANSACTION_P_H 78 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinappproduct.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPPRODUCT_H 30 | #define QINAPPPRODUCT_H 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | QT_BEGIN_NAMESPACE 37 | 38 | class QInAppProductPrivate; 39 | class Q_PURCHASING_EXPORT QInAppProduct: public QObject 40 | { 41 | Q_OBJECT 42 | Q_ENUMS(ProductType) 43 | Q_PROPERTY(QString identifier READ identifier CONSTANT) 44 | Q_PROPERTY(ProductType productType READ productType CONSTANT) 45 | Q_PROPERTY(QString price READ price CONSTANT) 46 | Q_PROPERTY(QString title READ title CONSTANT) 47 | Q_PROPERTY(QString description READ description CONSTANT) 48 | 49 | public: 50 | enum ProductType 51 | { 52 | Consumable, 53 | Unlockable 54 | }; 55 | 56 | ~QInAppProduct(); 57 | 58 | QString identifier() const; 59 | ProductType productType() const; 60 | 61 | QString price() const; 62 | QString title() const; 63 | QString description() const; 64 | 65 | Q_INVOKABLE virtual void purchase() = 0; 66 | 67 | protected: 68 | explicit QInAppProduct(const QString &price, const QString &title, const QString &description, ProductType productType, const QString &identifier, QObject *parent = nullptr); 69 | 70 | private: 71 | friend class QInAppStore; 72 | Q_DISABLE_COPY(QInAppProduct) 73 | 74 | QSharedPointer d; 75 | }; 76 | 77 | QT_END_NAMESPACE 78 | 79 | #endif // QINAPPPRODUCT_H 80 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinapppurchasebackend.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qinapppurchasebackend_p.h" 30 | 31 | QT_BEGIN_NAMESPACE 32 | 33 | QInAppPurchaseBackend::QInAppPurchaseBackend(QObject *parent) 34 | : QObject(parent) 35 | , m_store(0) 36 | { 37 | } 38 | 39 | void QInAppPurchaseBackend::initialize() 40 | { 41 | emit ready(); 42 | } 43 | 44 | bool QInAppPurchaseBackend::isReady() const 45 | { 46 | return true; 47 | } 48 | 49 | void QInAppPurchaseBackend::queryProducts(const QList &products) 50 | { 51 | for (const Product &product : products) 52 | queryProduct(product.productType, product.identifier); 53 | } 54 | 55 | void QInAppPurchaseBackend::queryProduct(QInAppProduct::ProductType productType, 56 | const QString &identifier) 57 | { 58 | qWarning("QInAppPurchaseBackend not implemented on this platform!"); 59 | Q_UNUSED(productType); 60 | Q_UNUSED(identifier); 61 | } 62 | 63 | void QInAppPurchaseBackend::restorePurchases() 64 | { 65 | qWarning("QInAppPurchaseBackend not implemented on this platform!"); 66 | } 67 | 68 | void QInAppPurchaseBackend::setPlatformProperty(const QString &propertyName, const QString &value) 69 | { 70 | Q_UNUSED(propertyName); 71 | Q_UNUSED(value); 72 | } 73 | 74 | QT_END_NAMESPACE 75 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinapppurchasebackend_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPPURCHASEBACKEND_P_H 30 | #define QINAPPPURCHASEBACKEND_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinappproduct.h" 44 | #include 45 | 46 | QT_BEGIN_NAMESPACE 47 | 48 | class QInAppProduct; 49 | class QInAppTransaction; 50 | class QInAppStore; 51 | class QInAppPurchaseBackend : public QObject 52 | { 53 | Q_OBJECT 54 | public: 55 | struct Product 56 | { 57 | Product(QInAppProduct::ProductType type, const QString &id) 58 | : productType(type), identifier(id) 59 | { 60 | } 61 | 62 | QInAppProduct::ProductType productType; 63 | QString identifier; 64 | }; 65 | 66 | explicit QInAppPurchaseBackend(QObject *parent = 0); 67 | 68 | virtual void initialize(); 69 | virtual bool isReady() const; 70 | 71 | virtual void queryProducts(const QList &products); 72 | virtual void queryProduct(QInAppProduct::ProductType productType, const QString &identifier); 73 | virtual void restorePurchases(); 74 | 75 | virtual void setPlatformProperty(const QString &propertyName, const QString &value); 76 | 77 | void setStore(QInAppStore *store) { m_store = store; } 78 | QInAppStore *store() const { return m_store; } 79 | 80 | Q_SIGNALS: 81 | void ready(); 82 | void transactionReady(QInAppTransaction *transaction); 83 | void productQueryFailed(QInAppProduct::ProductType productType, const QString &identifier); 84 | void productQueryDone(QInAppProduct *product); 85 | 86 | private: 87 | QInAppStore *m_store; 88 | }; 89 | 90 | QT_END_NAMESPACE 91 | 92 | #endif // QINAPPPURCHASEBACKEND_P_H 93 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinapppurchasebackendfactory.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qinapppurchasebackendfactory_p.h" 30 | 31 | #if defined(Q_OS_ANDROID) 32 | # include "qandroidinapppurchasebackend_p.h" 33 | #elif defined(Q_OS_DARWIN) && !defined(Q_OS_WATCHOS) 34 | # include "qmacinapppurchasebackend_p.h" 35 | #elif defined(Q_OS_WINRT) 36 | # include "qwinrtinapppurchasebackend_p.h" 37 | #else 38 | # include "qinapppurchasebackend_p.h" 39 | #endif 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | QInAppPurchaseBackend *QInAppPurchaseBackendFactory::create() 44 | { 45 | #if defined(Q_OS_ANDROID) 46 | return new QAndroidInAppPurchaseBackend; 47 | #elif defined(Q_OS_DARWIN) && !defined(Q_OS_WATCHOS) 48 | return new QMacInAppPurchaseBackend; 49 | #elif defined (Q_OS_WINRT) 50 | return new QWinRTInAppPurchaseBackend; 51 | #else 52 | return new QInAppPurchaseBackend; 53 | #endif 54 | } 55 | 56 | QT_END_NAMESPACE 57 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinapppurchasebackendfactory_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPPURCHASEBACKENDFACTORY_P_H 30 | #define QINAPPPURCHASEBACKENDFACTORY_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QInAppPurchaseBackend; 48 | class QInAppPurchaseBackendFactory 49 | { 50 | public: 51 | static QInAppPurchaseBackend *create(); 52 | }; 53 | 54 | QT_END_NAMESPACE 55 | 56 | #endif // QINAPPPURCHASEBACKENDFACTORY_P_H 57 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinappstore.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPSTORE_H 30 | #define QINAPPSTORE_H 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | QT_BEGIN_NAMESPACE 37 | 38 | class QInAppStorePrivate; 39 | class QInAppProduct; 40 | class QInAppTransaction; 41 | class Q_PURCHASING_EXPORT QInAppStore: public QObject 42 | { 43 | Q_OBJECT 44 | public: 45 | explicit QInAppStore(QObject *parent = nullptr); 46 | ~QInAppStore(); 47 | 48 | Q_INVOKABLE void restorePurchases(); 49 | Q_INVOKABLE void registerProduct(QInAppProduct::ProductType productType, const QString &identifier); 50 | Q_INVOKABLE QInAppProduct *registeredProduct(const QString &identifier) const; 51 | Q_INVOKABLE void setPlatformProperty(const QString &propertyName, const QString &value); 52 | 53 | Q_SIGNALS: 54 | void productRegistered(QInAppProduct *product); 55 | void productUnknown(QInAppProduct::ProductType productType, const QString &identifier); 56 | void transactionReady(QInAppTransaction *transaction); 57 | 58 | private Q_SLOTS: 59 | void registerPendingProducts(); 60 | void registerProduct(QInAppProduct *); 61 | 62 | private: 63 | void setupBackend(); 64 | 65 | Q_DISABLE_COPY(QInAppStore) 66 | QSharedPointer d; 67 | }; 68 | 69 | QT_END_NAMESPACE 70 | 71 | #endif // QINAPPSTORE_H 72 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinappstore_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPSTORE_P_H 30 | #define QINAPPSTORE_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinappproduct.h" 44 | #include "qinapppurchasebackend_p.h" 45 | 46 | #include 47 | #include 48 | 49 | QT_BEGIN_NAMESPACE 50 | 51 | class QInAppProduct; 52 | class QInAppPurchaseBackend; 53 | 54 | class QInAppStorePrivate 55 | { 56 | public: 57 | QInAppStorePrivate() 58 | : backend(0) 59 | , hasCalledInitialize(false) 60 | , pendingRestorePurchases(false) 61 | { 62 | } 63 | 64 | ~QInAppStorePrivate() 65 | { 66 | delete backend; 67 | } 68 | 69 | QHash pendingProducts; 70 | QHash registeredProducts; 71 | QInAppPurchaseBackend *backend; 72 | bool hasCalledInitialize; 73 | bool pendingRestorePurchases; 74 | }; 75 | 76 | QT_END_NAMESPACE 77 | 78 | #endif // QINAPPSTORE_P_H 79 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/qinapptransaction.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QINAPPTRANSACTION_H 30 | #define QINAPPTRANSACTION_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | Q_MOC_INCLUDE("QtPurchasing/qinappproduct.h") 38 | 39 | QT_BEGIN_NAMESPACE 40 | 41 | class QInAppProduct; 42 | class QInAppTransactionPrivate; 43 | class Q_PURCHASING_EXPORT QInAppTransaction: public QObject 44 | { 45 | Q_OBJECT 46 | Q_ENUMS(TransactionStatus FailureReason) 47 | Q_PROPERTY(TransactionStatus status READ status CONSTANT) 48 | Q_PROPERTY(QInAppProduct* product READ product CONSTANT) 49 | Q_PROPERTY(QString orderId READ orderId CONSTANT) 50 | Q_PROPERTY(FailureReason failureReason READ failureReason CONSTANT) 51 | Q_PROPERTY(QString errorString READ errorString CONSTANT) 52 | Q_PROPERTY(QDateTime timestamp READ timestamp CONSTANT) 53 | public: 54 | enum TransactionStatus { 55 | Unknown, 56 | PurchaseApproved, 57 | PurchaseFailed, 58 | PurchaseRestored 59 | }; 60 | 61 | enum FailureReason { 62 | NoFailure, 63 | CanceledByUser, 64 | ErrorOccurred 65 | }; 66 | 67 | ~QInAppTransaction(); 68 | 69 | QInAppProduct *product() const; 70 | 71 | virtual QString orderId() const; 72 | virtual FailureReason failureReason() const; 73 | virtual QString errorString() const; 74 | virtual QDateTime timestamp() const; 75 | 76 | Q_INVOKABLE virtual void finalize() = 0; 77 | Q_INVOKABLE virtual QString platformProperty(const QString &propertyName) const; 78 | 79 | TransactionStatus status() const; 80 | 81 | protected: 82 | explicit QInAppTransaction(TransactionStatus status, 83 | QInAppProduct *product, 84 | QObject *parent = nullptr); 85 | 86 | private: 87 | Q_DISABLE_COPY(QInAppTransaction) 88 | QSharedPointer d; 89 | }; 90 | 91 | QT_END_NAMESPACE 92 | 93 | #endif // QINAPPTRANSACTION_H 94 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/winrt/qwinrtinappproduct.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qwinrtinappproduct_p.h" 30 | #include "qwinrtinapppurchasebackend_p.h" 31 | 32 | #include 33 | 34 | QT_BEGIN_NAMESPACE 35 | 36 | Q_LOGGING_CATEGORY(lcPurchasingProduct, "qt.purchasing.product") 37 | 38 | QWinRTInAppProduct::QWinRTInAppProduct(QWinRTInAppPurchaseBackend *backend, 39 | const QString &price, 40 | const QString &title, 41 | const QString &description, 42 | ProductType productType, 43 | const QString &identifier, 44 | QObject *parent) 45 | : QInAppProduct(price, title, description, productType, identifier, parent) 46 | , m_backend(backend) 47 | { 48 | qCDebug(lcPurchasingProduct) << __FUNCTION__; 49 | } 50 | 51 | 52 | void QWinRTInAppProduct::purchase() 53 | { 54 | qCDebug(lcPurchasingProduct) << __FUNCTION__; 55 | m_backend->purchaseProduct(this); 56 | } 57 | 58 | QT_END_NAMESPACE 59 | 60 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/winrt/qwinrtinappproduct_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QWINRTINAPPPRODUCT_P_H 30 | #define QWINRTINAPPPRODUCT_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinappproduct.h" 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QWinRTInAppPurchaseBackend; 48 | class QWinRTInAppProduct : public QInAppProduct 49 | { 50 | Q_OBJECT 51 | public: 52 | explicit QWinRTInAppProduct(QWinRTInAppPurchaseBackend *backend, 53 | const QString &price, 54 | const QString &title, 55 | const QString &description, 56 | ProductType productType, 57 | const QString &identifier, 58 | QObject *parent = 0); 59 | 60 | 61 | void purchase() override; 62 | 63 | private: 64 | QWinRTInAppPurchaseBackend *m_backend; 65 | }; 66 | 67 | QT_END_NAMESPACE 68 | 69 | #endif // QWINRTINAPPPRODUCT_P_H 70 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/winrt/qwinrtinapppurchasebackend_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QWINRTINAPPPURCHASEBACKEND_P_H 30 | #define QWINRTINAPPPURCHASEBACKEND_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinapppurchasebackend_p.h" 44 | #include "qinappproduct.h" 45 | #include "qinapptransaction.h" 46 | 47 | #include 48 | #include 49 | 50 | namespace ABI { 51 | namespace Windows { 52 | namespace Foundation { 53 | enum class AsyncStatus; 54 | } 55 | } 56 | } 57 | 58 | QT_BEGIN_NAMESPACE 59 | 60 | class QWinRTInAppProduct; 61 | class QWinRTInAppPurchaseBackendPrivate; 62 | class QWinRTInAppTransaction; 63 | class QWinRTInAppPurchaseBackend; 64 | 65 | struct qt_WinRTTransactionData 66 | { 67 | qt_WinRTTransactionData() { } 68 | explicit qt_WinRTTransactionData(ABI::Windows::Foundation::AsyncStatus s, 69 | QWinRTInAppProduct *p, 70 | const QString &r, 71 | Microsoft::WRL::ComPtr pRes = Microsoft::WRL::ComPtr()) 72 | : status(s) 73 | , product(p) 74 | , receipt(r) 75 | , purchaseResults(pRes) 76 | { } 77 | ABI::Windows::Foundation::AsyncStatus status; 78 | QWinRTInAppProduct *product; 79 | QString receipt; 80 | Microsoft::WRL::ComPtr purchaseResults; 81 | }; 82 | 83 | class QWinRTInAppPurchaseBackend : public QInAppPurchaseBackend 84 | { 85 | Q_OBJECT 86 | public: 87 | explicit QWinRTInAppPurchaseBackend(QObject *parent = 0); 88 | 89 | void initialize() override; 90 | bool isReady() const override; 91 | 92 | void queryProducts(const QList &products) override; 93 | void queryProduct(QInAppProduct::ProductType productType, const QString &identifier) override; 94 | void restorePurchases() override; 95 | 96 | void setPlatformProperty(const QString &propertyName, const QString &value) override; 97 | 98 | void purchaseProduct(QWinRTInAppProduct *product); 99 | 100 | void fulfillConsumable(QWinRTInAppTransaction *transaction); 101 | public slots: 102 | void createTransactionDelayed(qt_WinRTTransactionData data); 103 | private: 104 | QScopedPointer d_ptr; 105 | Q_DECLARE_PRIVATE(QWinRTInAppPurchaseBackend) 106 | }; 107 | 108 | QT_END_NAMESPACE 109 | 110 | #endif // QWINRTINAPPPURCHASEBACKEND_P_H 111 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/winrt/qwinrtinapptransaction.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include "qwinrtinapptransaction_p.h" 30 | #include "qwinrtinapppurchasebackend_p.h" 31 | #include "qinappproduct.h" 32 | 33 | #include 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | Q_LOGGING_CATEGORY(lcPurchasingTransaction, "qt.purchasing.transaction") 38 | 39 | QWinRTInAppTransaction::QWinRTInAppTransaction(TransactionStatus status, 40 | QInAppProduct *product, FailureReason reason, 41 | const QString &receipt, QObject *parent) 42 | : QInAppTransaction(status, product, parent) 43 | , m_receipt(receipt) 44 | , m_failureReason(reason) 45 | { 46 | qCDebug(lcPurchasingTransaction) << __FUNCTION__; 47 | m_backend = qobject_cast(parent); 48 | } 49 | 50 | void QWinRTInAppTransaction::finalize() 51 | { 52 | qCDebug(lcPurchasingTransaction) << __FUNCTION__; 53 | if (product()->productType() == QInAppProduct::Consumable && 54 | (status() == QInAppTransaction::PurchaseApproved || 55 | status() == QInAppTransaction::PurchaseRestored)) { 56 | m_backend->fulfillConsumable(this); 57 | } 58 | deleteLater(); 59 | } 60 | 61 | QString QWinRTInAppTransaction::platformProperty(const QString &propertyName) const 62 | { 63 | qCDebug(lcPurchasingTransaction) << __FUNCTION__ << propertyName; 64 | 65 | if (propertyName == QLatin1String("receipt")) 66 | return m_receipt; 67 | return QString(); 68 | } 69 | 70 | QT_END_NAMESPACE 71 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/winrt/qwinrtinapptransaction_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QWINRTINAPPTRANSACTION_P_H 30 | #define QWINRTINAPPTRANSACTION_P_H 31 | 32 | // 33 | // W A R N I N G 34 | // ------------- 35 | // 36 | // This file is not part of the Qt API. It exists purely as an 37 | // implementation detail. This header file may change from version to 38 | // version without notice, or even be removed. 39 | // 40 | // We mean it. 41 | // 42 | 43 | #include "qinapptransaction.h" 44 | #include "qwinrtinapppurchasebackend_p.h" 45 | 46 | #include 47 | #include 48 | #include 49 | 50 | #include 51 | #include 52 | 53 | QT_BEGIN_NAMESPACE 54 | 55 | class QWinRTInAppTransaction : public QInAppTransaction 56 | { 57 | Q_OBJECT 58 | public: 59 | explicit QWinRTInAppTransaction(TransactionStatus status, 60 | QInAppProduct *product, 61 | FailureReason reason, 62 | const QString &receipt, 63 | QObject *parent = nullptr); 64 | 65 | FailureReason failureReason() const override { return m_failureReason; } 66 | 67 | void finalize() override; 68 | QString platformProperty(const QString &propertyName) const override; 69 | 70 | Microsoft::WRL::ComPtr m_purchaseResults; 71 | QString m_receipt; 72 | QUuid m_uuid; 73 | private: 74 | QWinRTInAppPurchaseBackend *m_backend; 75 | FailureReason m_failureReason; 76 | }; 77 | 78 | QT_END_NAMESPACE 79 | 80 | #endif // QWINRTINAPPTRANSACTION_P_H 81 | -------------------------------------------------------------------------------- /src/purchasing/inapppurchase/winrt/winrt.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | SOURCES += \ 3 | $$PWD/qwinrtinapppurchasebackend.cpp \ 4 | $$PWD/qwinrtinapptransaction.cpp \ 5 | $$PWD/qwinrtinappproduct.cpp 6 | HEADERS += \ 7 | $$PWD/qwinrtinapppurchasebackend_p.h \ 8 | $$PWD/qwinrtinapptransaction_p.h \ 9 | $$PWD/qwinrtinappproduct_p.h 10 | 11 | QT += core-private 12 | -------------------------------------------------------------------------------- /src/purchasing/purchasing.pro: -------------------------------------------------------------------------------- 1 | TARGET = QtPurchasing 2 | QT = core 3 | 4 | QMAKE_TARGET_PRODUCT = "Qt Purchasing (Qt $$QT_VERSION)" 5 | QMAKE_TARGET_DESCRIPTION = "Purchasing component for Qt." 6 | 7 | QMAKE_DOCS = $$PWD/doc/qtpurchasing.qdocconf 8 | 9 | ANDROID_BUNDLED_JAR_DEPENDENCIES = \ 10 | jar/Qt$${QT_MAJOR_VERSION}AndroidPurchasing.jar 11 | 12 | HEADERS += \ 13 | $$PWD/qtpurchasingglobal.h 14 | 15 | include(inapppurchase/inapppurchase.pri) 16 | 17 | load(qt_module) 18 | -------------------------------------------------------------------------------- /src/purchasing/qtpurchasingglobal.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Purchasing module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL3-COMM$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QTPURCHASINGGLOBAL_H 30 | #define QTPURCHASINGGLOBAL_H 31 | 32 | #include 33 | 34 | QT_BEGIN_NAMESPACE 35 | 36 | #ifndef QT_STATIC 37 | # if defined(QT_BUILD_PURCHASING_LIB) 38 | # define Q_PURCHASING_EXPORT Q_DECL_EXPORT 39 | # else 40 | # define Q_PURCHASING_EXPORT Q_DECL_IMPORT 41 | # endif 42 | #else 43 | # define Q_PURCHASING_EXPORT 44 | #endif 45 | 46 | QT_END_NAMESPACE 47 | 48 | #endif // QTPURCHASINGGLOBAL_H 49 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = purchasing 3 | 4 | qtHaveModule(qml):qtHaveModule(quick) { 5 | src_imports.subdir = imports 6 | src_imports.depends = purchasing 7 | SUBDIRS += src_imports 8 | } 9 | 10 | android { 11 | SUBDIRS += android 12 | } 13 | -------------------------------------------------------------------------------- /sync.profile: -------------------------------------------------------------------------------- 1 | %modules = ( # path to module name map 2 | "QtPurchasing" => "$basedir/src/purchasing", 3 | ); 4 | %moduleheaders = ( # restrict the module headers to those found in relative path 5 | ); 6 | # Module dependencies. 7 | # Every module that is required to build this module should have one entry. 8 | # Each of the module version specifiers can take one of the following values: 9 | # - A specific Git revision. 10 | # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) 11 | # - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) 12 | # 13 | %dependencies = ( 14 | "qtbase" => "", 15 | "qtandroidextras" => "", 16 | "qtdeclarative" => "", 17 | ); 18 | -------------------------------------------------------------------------------- /tests/auto/auto.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | purchasing 4 | -------------------------------------------------------------------------------- /tests/auto/purchasing/purchasing.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | qinappstore 4 | -------------------------------------------------------------------------------- /tests/auto/purchasing/qinappstore/qinappstore.pro: -------------------------------------------------------------------------------- 1 | CONFIG += testcase 2 | TARGET = tst_qinappstore 3 | QT += testlib purchasing 4 | SOURCES += tst_qinappstore.cpp 5 | -------------------------------------------------------------------------------- /tests/auto/purchasing/qinappstore/tst_qinappstore.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the test suite of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | class tst_QInAppStore: public QObject 34 | { 35 | Q_OBJECT 36 | private slots: 37 | void registerUnknownProduct(); 38 | }; 39 | 40 | class SignalReceiver: public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | QList readyTransactions; 45 | QList registeredProducts; 46 | QList > unknownProducts; 47 | 48 | public slots: 49 | void productRegistered(QInAppProduct *product) 50 | { 51 | registeredProducts.append(product); 52 | } 53 | 54 | void productUnknown(QInAppProduct::ProductType productType, const QString &identifier) 55 | { 56 | unknownProducts.append(qMakePair(productType, identifier)); 57 | } 58 | 59 | void transactionReady(QInAppTransaction *transaction) 60 | { 61 | readyTransactions.append(transaction); 62 | } 63 | }; 64 | 65 | void tst_QInAppStore::registerUnknownProduct() 66 | { 67 | #ifdef Q_OS_DARWIN 68 | QSKIP("This test crashes on macOS. See QTBUG-56786."); 69 | #endif 70 | 71 | QInAppStore store(this); 72 | SignalReceiver receiver; 73 | 74 | connect(&store, &QInAppStore::productRegistered, &receiver, &SignalReceiver::productRegistered); 75 | connect(&store, &QInAppStore::productUnknown, &receiver, &SignalReceiver::productUnknown); 76 | connect(&store, &QInAppStore::transactionReady, &receiver, &SignalReceiver::transactionReady); 77 | 78 | store.registerProduct(QInAppProduct::Consumable, QStringLiteral("unknownConsumable")); 79 | store.registerProduct(QInAppProduct::Unlockable, QStringLiteral("unknownUnlockable")); 80 | 81 | //The backend is implemented on iOS, macOS, WinRT and Android, for others we expect failure. 82 | #if !(defined(Q_OS_DARWIN) && !defined(Q_OS_WATCHOS)) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) 83 | QEXPECT_FAIL("", "Qt Purchasing not implemented on this platform.", Abort); 84 | #endif 85 | 86 | //Due to network overload or connectivity issues QTRY_COMPARE sometimes fails with timeout, 87 | //that's why we need to increase the value, since it's better to wait than to fail. 88 | QTRY_COMPARE_WITH_TIMEOUT(receiver.unknownProducts.size(), 2, 10000); 89 | QCOMPARE(receiver.registeredProducts.size(), 0); 90 | QCOMPARE(receiver.readyTransactions.size(), 0); 91 | 92 | int found = 0; 93 | for (int i = 0; i < receiver.unknownProducts.size(); ++i) { 94 | const QPair &product = receiver.unknownProducts.at(i); 95 | 96 | if ((product.first == QInAppProduct::Unlockable && product.second == QStringLiteral("unknownUnlockable")) 97 | || (product.first == QInAppProduct::Consumable && product.second == QStringLiteral("unknownConsumable"))) { 98 | found++; 99 | } 100 | } 101 | 102 | QCOMPARE(found, 2); 103 | } 104 | 105 | QTEST_MAIN(tst_QInAppStore) 106 | 107 | #include "tst_qinappstore.moc" 108 | -------------------------------------------------------------------------------- /tests/manual/manual.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | qinappstore 4 | -------------------------------------------------------------------------------- /tests/manual/qinappstore/qinappstore.pro: -------------------------------------------------------------------------------- 1 | CONFIG += testcase 2 | TEMPLATE = app 3 | QT += testlib purchasing 4 | TARGET = tst_qinappstore 5 | SOURCES += tst_qinappstore.cpp 6 | -------------------------------------------------------------------------------- /tests/manual/qinappstore/tst_qinappstore.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the test suite of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | class tst_QInAppStore: public QObject 34 | { 35 | Q_OBJECT 36 | private slots: 37 | void registerProduct(); 38 | }; 39 | 40 | class SignalReceiver: public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | QList readyTransactions; 45 | QList registeredProducts; 46 | QList > unknownProducts; 47 | 48 | public slots: 49 | void productRegistered(QInAppProduct *product) 50 | { 51 | registeredProducts.append(product); 52 | } 53 | 54 | void productUnknown(QInAppProduct::ProductType productType, const QString &identifier) 55 | { 56 | unknownProducts.append(qMakePair(productType, identifier)); 57 | } 58 | 59 | void transactionReady(QInAppTransaction *transaction) 60 | { 61 | readyTransactions.append(transaction); 62 | } 63 | }; 64 | 65 | void tst_QInAppStore::registerProduct() 66 | { 67 | QInAppStore store(this); 68 | SignalReceiver receiver; 69 | 70 | connect(&store, SIGNAL(productRegistered(QInAppProduct*)), &receiver, SLOT(productRegistered(QInAppProduct*))); 71 | connect(&store, SIGNAL(productUnknown(QInAppProduct::ProductType,QString)), &receiver, SLOT(productUnknown(QInAppProduct::ProductType,QString))); 72 | connect(&store, SIGNAL(transactionReady(QInAppTransaction*)), &receiver, SLOT(transactionReady(QInAppTransaction*))); 73 | 74 | store.registerProduct(QInAppProduct::Consumable, QStringLiteral("consumable")); 75 | store.registerProduct(QInAppProduct::Unlockable, QStringLiteral("unlockable")); 76 | 77 | QTRY_COMPARE(receiver.registeredProducts.size(), 2); 78 | QCOMPARE(receiver.unknownProducts.size(), 0); 79 | QCOMPARE(receiver.readyTransactions.size(), 0); 80 | 81 | int found = 0; 82 | for (int i = 0; i < receiver.registeredProducts.size(); ++i) { 83 | QInAppProduct *product = receiver.registeredProducts.at(i); 84 | if ((product->identifier() == QStringLiteral("consumable") && product->productType() == QInAppProduct::Consumable) 85 | || (product->identifier() == QStringLiteral("unlockable") && product->productType() == QInAppProduct::Unlockable)) { 86 | found++; 87 | } 88 | 89 | switch (product->productType()) { 90 | case QInAppProduct::Consumable: 91 | QCOMPARE(product->description(), QStringLiteral("consumableDescription")); 92 | QCOMPARE(product->title(), QStringLiteral("consumableTitle")); 93 | break; 94 | case QInAppProduct::Unlockable: 95 | QCOMPARE(product->description(), QStringLiteral("unlockableDescription")); 96 | QCOMPARE(product->title(), QStringLiteral("unlockableTitle")); 97 | break; 98 | } 99 | 100 | QInAppProduct *registeredProduct = store.registeredProduct(product->identifier()); 101 | QCOMPARE(registeredProduct->identifier(), product->identifier()); 102 | QCOMPARE(registeredProduct->productType(), product->productType()); 103 | QCOMPARE(registeredProduct->title(), product->title()); 104 | QCOMPARE(registeredProduct->description(), product->description()); 105 | QCOMPARE(registeredProduct->price(), product->price()); 106 | } 107 | 108 | QCOMPARE(found, 2); 109 | } 110 | 111 | QTEST_MAIN(tst_QInAppStore) 112 | 113 | #include "tst_qinappstore.moc" 114 | 115 | -------------------------------------------------------------------------------- /tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | auto 4 | --------------------------------------------------------------------------------