on bbbdccd help sign in
69 lines 2.1 kB history raw
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef PAYMENTS_H
18#define PAYMENTS_H
20#include <QObject>
22#include <libpay/pay-package.h>
25class Payments : public QObject
27 Q_OBJECT
28 Q_DISABLE_COPY(Payments)
29 Q_PROPERTY(QString currency READ currency WRITE setCurrency NOTIFY currencyChanged)
30 Q_PROPERTY(double price READ price WRITE setPrice NOTIFY priceChanged)
31 Q_PROPERTY(QString storeItemId READ storeItemId WRITE setStoreItemId NOTIFY storeItemIdChanged)
32 Q_PROPERTY(QString formattedPrice READ formattedPrice NOTIFY formattedPriceChanged)
34public:
35 explicit Payments(QObject *parent = 0);
36 virtual ~Payments();
38 QString currency() const;
39 double price() const;
40 QString storeItemId() const;
41 QString formattedPrice() const;
42 bool purchasing() const;
44 void setCurrency(const QString& currency);
45 void setPrice(const double price);
46 void setStoreItemId(const QString& store_item_id);
47 void setPurchasing(bool is_purchasing);
48 Q_INVOKABLE void start();
50Q_SIGNALS:
51 void currencyChanged(const QString& currency);
52 void priceChanged(const double price);
53 void storeItemIdChanged(const QString &store_item_id);
54 void formattedPriceChanged(const QString &formatted_price);
56 void purchaseError(const QString &error);
57 void purchaseCompleted();
58 void purchaseCancelled();
60private:
61 QString m_currency;
62 double m_price;
63 QString m_store_item_id;
64 bool m_purchasing;
66 PayPackage *m_package;
67};
69#endif // PAYMENTS_H