| 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 <QtCore/qobject.h> |
| 33 | #include <QtCore/qsharedpointer.h> |
| 34 | #include <QtPurchasing/qtpurchasingglobal.h> |
| 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<QInAppProductPrivate> d; |
| 75 | }; |
| 76 | |
| 77 | QT_END_NAMESPACE |
| 78 | |
| 79 | #endif // QINAPPPRODUCT_H |
| 80 | |