summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--dist/changes-5.10.026
-rw-r--r--dist/changes-5.10.126
-rw-r--r--examples/purchasing/qthangman/hangmangame.cpp6
-rw-r--r--src/android/android.pro61
-rw-r--r--src/android/bundledjar.pro3
-rw-r--r--src/android/distributedjar.pro2
-rw-r--r--src/android/jar.pri57
-rw-r--r--src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java18
-rw-r--r--src/purchasing/inapppurchase/android/qandroidinapppurchasebackend.cpp18
-rw-r--r--src/purchasing/inapppurchase/qinappproduct.h2
-rw-r--r--src/purchasing/inapppurchase/qinappstore.h2
-rw-r--r--src/purchasing/inapppurchase/qinapptransaction.h2
-rw-r--r--src/purchasing/inapppurchase/winrt/qwinrtinapptransaction_p.h2
-rw-r--r--src/purchasing/purchasing.pro2
15 files changed, 143 insertions, 86 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 07299be..ff8a3a7 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,6 +2,6 @@ load(qt_build_config)
DEFINES += QT_NO_FOREACH
-MODULE_VERSION = 5.9.5
+MODULE_VERSION = 5.11.0
CMAKE_MODULE_TESTS=-
diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0
new file mode 100644
index 0000000..a0bf9f7
--- /dev/null
+++ b/dist/changes-5.10.0
@@ -0,0 +1,26 @@
+Qt 5.10 introduces many new features and improvements as well as bugfixes
+over the 5.9.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.10 series is binary compatible with the 5.9.x series.
+Applications compiled for 5.9 will continue to run with 5.10.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.10.0 Changes *
+****************************************************************************
+
+Android
+-------
+
+ - [QTBUG-57700] Added more informative error messages when the purchasing
+ subsystem was unable to create the buy intent.
diff --git a/dist/changes-5.10.1 b/dist/changes-5.10.1
new file mode 100644
index 0000000..695c4e3
--- /dev/null
+++ b/dist/changes-5.10.1
@@ -0,0 +1,26 @@
+Qt 5.10.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.10.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.10 series is binary compatible with the 5.9.x series.
+Applications compiled for 5.9 will continue to run with 5.10.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+This release contains all fixes included in the Qt 5.9.4 release.
+
+****************************************************************************
+* Qt 5.10.1 Changes *
+****************************************************************************
+
+ - This release contains only minor code improvements.
diff --git a/examples/purchasing/qthangman/hangmangame.cpp b/examples/purchasing/qthangman/hangmangame.cpp
index a137d10..6852d77 100644
--- a/examples/purchasing/qthangman/hangmangame.cpp
+++ b/examples/purchasing/qthangman/hangmangame.cpp
@@ -51,8 +51,8 @@
#include "hangmangame.h"
#include <QFile>
#include <QDebug>
-#include <time.h>
#include <QBuffer>
+#include <QRandomGenerator>
#include <QtConcurrent/QtConcurrentRun>
HangmanGame::HangmanGame(QObject *parent)
@@ -60,7 +60,6 @@ HangmanGame::HangmanGame(QObject *parent)
, m_lock(QMutex::Recursive)
, m_vowelsUnlocked(false)
{
- qsrand(::time(0));
connect(this, &HangmanGame::vowelBought, this, &HangmanGame::registerLetterBought);
QtConcurrent::run(this, &HangmanGame::initWordList);
@@ -233,14 +232,13 @@ void HangmanGame::chooseRandomWord()
if (m_wordList.isEmpty())
return;
- m_word = m_wordList.at(qrand() % m_wordList.size());
+ m_word = m_wordList.at(QRandomGenerator::global()->bounded(m_wordList.size()));
emit wordChanged();
}
void HangmanGame::initWordList()
{
QMutexLocker locker(&m_lock);
- qsrand(::time(0) + 1000);
QFile file(":/enable2.txt");
if (file.open(QIODevice::ReadOnly)) {
QByteArray allData = file.readAll();
diff --git a/src/android/android.pro b/src/android/android.pro
index 8d19c1b..8c355d0 100644
--- a/src/android/android.pro
+++ b/src/android/android.pro
@@ -1,2 +1,59 @@
-TEMPLATE = subdirs
-SUBDIRS += bundledjar.pro distributedjar.pro
+TARGET = QtPurchasing
+
+CONFIG += java
+load(sdk)
+
+DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
+
+PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/purchasing/
+
+!build_pass {
+ isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT)
+ isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT
+
+ isEmpty(BUILD_TOOLS_REVISION) {
+ BUILD_TOOLS_REVISION = $$(ANDROID_BUILD_TOOLS_REVISION)
+ isEmpty(BUILD_TOOLS_REVISION) {
+ BUILD_TOOLS_REVISIONS = $$files($$SDK_ROOT/build-tools/*)
+ for (REVISION, BUILD_TOOLS_REVISIONS) {
+ BASENAME = $$basename(REVISION)
+ greaterThan(BASENAME, $$BUILD_TOOLS_REVISION): BUILD_TOOLS_REVISION = $$BASENAME
+ }
+ }
+ }
+
+ FRAMEWORK_AIDL_FILE = $$SDK_ROOT/platforms/$$API_VERSION_TO_USE/framework.aidl
+ !exists($$FRAMEWORK_AIDL_FILE) {
+ error("The Path $$FRAMEWORK_AIDL_FILE does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.")
+ }
+
+ AIDL_CMD = $$SDK_ROOT/platform-tools/aidl
+ contains(QMAKE_HOST.os, Windows): AIDL_CMD = $$AIDL_CMD".exe"
+ !exists($$AIDL_CMD) {
+ AIDL_CMD = $$SDK_ROOT/build-tools/$$BUILD_TOOLS_REVISION/aidl
+ contains(QMAKE_HOST.os, Windows): AIDL_CMD = $$AIDL_CMD".exe"
+ }
+ !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.")
+
+ 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)
+}
+
+JAVACLASSPATH += $$PWD/src/
+JAVASOURCES += \
+ $$PATHPREFIX/QtInAppPurchase.java \
+ $$PATHPREFIX/Security.java \
+ $$PATHPREFIX/Base64.java \
+ $$PATHPREFIX/Base64DecoderException.java \
+ $$OUT_PWD/src/com/android/vending/billing/IInAppBillingService.java
+
+
+
+# install
+target.path = $$[QT_INSTALL_PREFIX]/jar
+INSTALLS += target
+
+OTHER_FILES += \
+ $$JAVASOURCES \
+ $$PWD/src/com/android/vending/billing/qt_attribution.json \
+ $$PWD/src/org/qtproject/qt5/android/purchasing/qt_attribution.json \
+ $$PWD/src/LICENSE-APACHE-2.0.txt
diff --git a/src/android/bundledjar.pro b/src/android/bundledjar.pro
deleted file mode 100644
index 157f73c..0000000
--- a/src/android/bundledjar.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TARGET = QtPurchasing-bundled
-CONFIG += bundled_jar_file
-include(jar.pri)
diff --git a/src/android/distributedjar.pro b/src/android/distributedjar.pro
deleted file mode 100644
index e293041..0000000
--- a/src/android/distributedjar.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TARGET = QtPurchasing
-include(jar.pri)
diff --git a/src/android/jar.pri b/src/android/jar.pri
deleted file mode 100644
index 1d1aa95..0000000
--- a/src/android/jar.pri
+++ /dev/null
@@ -1,57 +0,0 @@
-CONFIG += java
-load(sdk)
-
-DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
-
-PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/purchasing/
-
-!build_pass {
- isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT)
- isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT
-
- isEmpty(BUILD_TOOLS_REVISION) {
- BUILD_TOOLS_REVISION = $$(ANDROID_BUILD_TOOLS_REVISION)
- isEmpty(BUILD_TOOLS_REVISION) {
- BUILD_TOOLS_REVISIONS = $$files($$SDK_ROOT/build-tools/*)
- for (REVISION, BUILD_TOOLS_REVISIONS) {
- BASENAME = $$basename(REVISION)
- greaterThan(BASENAME, $$BUILD_TOOLS_REVISION): BUILD_TOOLS_REVISION = $$BASENAME
- }
- }
- }
-
- FRAMEWORK_AIDL_FILE = $$SDK_ROOT/platforms/$$API_VERSION_TO_USE/framework.aidl
- !exists($$FRAMEWORK_AIDL_FILE) {
- error("The Path $$FRAMEWORK_AIDL_FILE does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.")
- }
-
- AIDL_CMD = $$SDK_ROOT/platform-tools/aidl
- contains(QMAKE_HOST.os, Windows): AIDL_CMD = $$AIDL_CMD".exe"
- !exists($$AIDL_CMD) {
- AIDL_CMD = $$SDK_ROOT/build-tools/$$BUILD_TOOLS_REVISION/aidl
- contains(QMAKE_HOST.os, Windows): AIDL_CMD = $$AIDL_CMD".exe"
- }
- !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.")
-
- 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)
-}
-
-JAVACLASSPATH += $$PWD/src/
-JAVASOURCES += \
- $$PATHPREFIX/QtInAppPurchase.java \
- $$PATHPREFIX/Security.java \
- $$PATHPREFIX/Base64.java \
- $$PATHPREFIX/Base64DecoderException.java \
- $$OUT_PWD/src/com/android/vending/billing/IInAppBillingService.java
-
-
-
-# install
-target.path = $$[QT_INSTALL_PREFIX]/jar
-INSTALLS += target
-
-OTHER_FILES += \
- $$JAVASOURCES \
- $$PWD/src/com/android/vending/billing/qt_attribution.json \
- $$PWD/src/org/qtproject/qt5/android/purchasing/qt_attribution.json \
- $$PWD/src/LICENSE-APACHE-2.0.txt
diff --git a/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java b/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java
index 002e94b..94bc202 100644
--- a/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java
+++ b/src/android/src/org/qtproject/qt5/android/purchasing/QtInAppPurchase.java
@@ -374,7 +374,7 @@ public class QtInAppPurchase
m_publicKey = publicKey;
}
- public IntentSender createBuyIntentSender(String identifier)
+ public IntentSender createBuyIntentSender(String identifier, int requestCode)
{
if (m_service == null) {
Log.e(TAG, "Unable to create buy intent. No IAP service connection.");
@@ -388,9 +388,21 @@ public class QtInAppPurchase
TYPE_INAPP,
identifier);
int response = bundleResponseCode(purchaseBundle);
+
if (response != RESULT_OK) {
- Log.e(TAG, "Unable to create buy intent. Response code: " + response);
- return null;
+ Log.e(TAG, "Unable to create buy intent. Response code: " + response);
+ String errorString;
+ switch (response) {
+ case RESULT_BILLING_UNAVAILABLE: errorString = "Billing unavailable"; break;
+ case RESULT_ITEM_UNAVAILABLE: errorString = "Item unavailable"; break;
+ case RESULT_DEVELOPER_ERROR: errorString = "Developer error"; break;
+ case RESULT_ERROR: errorString = "Fatal error occurred"; break;
+ case RESULT_ITEM_ALREADY_OWNED: errorString = "Item already owned"; break;
+ default: errorString = "Unknown billing error " + response; break;
+ };
+
+ purchaseFailed(requestCode, FAILUREREASON_ERROR, errorString);
+ return null;
}
PendingIntent pendingIntent = purchaseBundle.getParcelable("BUY_INTENT");
diff --git a/src/purchasing/inapppurchase/android/qandroidinapppurchasebackend.cpp b/src/purchasing/inapppurchase/android/qandroidinapppurchasebackend.cpp
index e6a42cb..ee00591 100644
--- a/src/purchasing/inapppurchase/android/qandroidinapppurchasebackend.cpp
+++ b/src/purchasing/inapppurchase/android/qandroidinapppurchasebackend.cpp
@@ -334,14 +334,6 @@ void QAndroidInAppPurchaseBackend::purchaseProduct(QAndroidInAppProduct *product
return;
}
- QAndroidJniObject intentSender = m_javaObject.callObjectMethod("createBuyIntentSender",
- "(Ljava/lang/String;)Landroid/content/IntentSender;",
- QAndroidJniObject::fromString(product->identifier()).object<jstring>());
- if (!intentSender.isValid()) {
- purchaseFailed(product, QInAppTransaction::ErrorOccurred, QStringLiteral("Unable to get intent sender from service"));
- return;
- }
-
int requestCode = 0;
while (m_activePurchaseRequests.contains(requestCode)) {
requestCode++;
@@ -352,6 +344,16 @@ void QAndroidInAppPurchaseBackend::purchaseProduct(QAndroidInAppProduct *product
}
m_activePurchaseRequests[requestCode] = product;
+
+ QAndroidJniObject intentSender = m_javaObject.callObjectMethod("createBuyIntentSender",
+ "(Ljava/lang/String;I)Landroid/content/IntentSender;",
+ QAndroidJniObject::fromString(product->identifier()).object<jstring>(), requestCode);
+
+ if (!intentSender.isValid()) {
+ m_activePurchaseRequests.remove(requestCode);
+ return;
+ }
+
QtAndroid::startIntentSender(intentSender, requestCode, this);
}
diff --git a/src/purchasing/inapppurchase/qinappproduct.h b/src/purchasing/inapppurchase/qinappproduct.h
index 76316c3..6d879bc 100644
--- a/src/purchasing/inapppurchase/qinappproduct.h
+++ b/src/purchasing/inapppurchase/qinappproduct.h
@@ -65,7 +65,7 @@ public:
Q_INVOKABLE virtual void purchase() = 0;
protected:
- explicit QInAppProduct(const QString &price, const QString &title, const QString &description, ProductType productType, const QString &identifier, QObject *parent = Q_NULLPTR);
+ explicit QInAppProduct(const QString &price, const QString &title, const QString &description, ProductType productType, const QString &identifier, QObject *parent = nullptr);
private:
friend class QInAppStore;
diff --git a/src/purchasing/inapppurchase/qinappstore.h b/src/purchasing/inapppurchase/qinappstore.h
index 4b5bce3..1eea173 100644
--- a/src/purchasing/inapppurchase/qinappstore.h
+++ b/src/purchasing/inapppurchase/qinappstore.h
@@ -42,7 +42,7 @@ class Q_PURCHASING_EXPORT QInAppStore: public QObject
{
Q_OBJECT
public:
- explicit QInAppStore(QObject *parent = Q_NULLPTR);
+ explicit QInAppStore(QObject *parent = nullptr);
~QInAppStore();
Q_INVOKABLE void restorePurchases();
diff --git a/src/purchasing/inapppurchase/qinapptransaction.h b/src/purchasing/inapppurchase/qinapptransaction.h
index dd25c33..407f958 100644
--- a/src/purchasing/inapppurchase/qinapptransaction.h
+++ b/src/purchasing/inapppurchase/qinapptransaction.h
@@ -79,7 +79,7 @@ public:
protected:
explicit QInAppTransaction(TransactionStatus status,
QInAppProduct *product,
- QObject *parent = Q_NULLPTR);
+ QObject *parent = nullptr);
private:
Q_DISABLE_COPY(QInAppTransaction)
diff --git a/src/purchasing/inapppurchase/winrt/qwinrtinapptransaction_p.h b/src/purchasing/inapppurchase/winrt/qwinrtinapptransaction_p.h
index 30936be..e143b64 100644
--- a/src/purchasing/inapppurchase/winrt/qwinrtinapptransaction_p.h
+++ b/src/purchasing/inapppurchase/winrt/qwinrtinapptransaction_p.h
@@ -60,7 +60,7 @@ public:
QInAppProduct *product,
FailureReason reason,
const QString &receipt,
- QObject *parent = Q_NULLPTR);
+ QObject *parent = nullptr);
FailureReason failureReason() const override { return m_failureReason; }
diff --git a/src/purchasing/purchasing.pro b/src/purchasing/purchasing.pro
index 56a2cf2..1c3fc52 100644
--- a/src/purchasing/purchasing.pro
+++ b/src/purchasing/purchasing.pro
@@ -7,8 +7,6 @@ QMAKE_TARGET_DESCRIPTION = "Purchasing component for Qt."
QMAKE_DOCS = $$PWD/doc/qtpurchasing.qdocconf
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
- jar/QtPurchasing-bundled.jar
-ANDROID_JAR_DEPENDENCIES = \
jar/QtPurchasing.jar
HEADERS += \