/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \title Qt Purchasing Examples - QtHangman
    \example qthangman
    \brief QtHangman is an example that demonstrates how to use the Qt Purchasing API with Qt Quick.
    \image qthangman-example.png
    \ingroup qtpurchasing-examples

    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.
    In order to test the in-app purchase functionality in the example, you must first register the application and its products in the external
    store. For an introduction on how to do this, see the guides for \l{Registering Products in Google Play}{Google Play} and
    \l{Registering Products in App Store}{App Store} respectively.

    In-app purchasing can be added to a Qt Mobile application by first adding a Store object.  In QtHangman the Store object
    is created by the MainView component that is loaded on application startup.
    \snippet qthangman/qml/qthangman/MainView.qml 0

    QtHangman defines a component for displaying a store for purchasing in-app products made available.  These products must be first
    registered with the store object we created above in MainView.  There are two products available, the first being a consumable type.
    \snippet qthangman/qml/qthangman/StoreView.qml 0
    This consumable product provides 100 additional vowels to be used when guessing words in the game.  When it is successfully
    purchased we update the state of the application to include 100 additional vowels. Then we call finalize on the transaction object to
    confirm to the platform store that the consumable product has been provided.

    The second product is a non-consumable type that will unlock vowels permanently in the future.  In addition to updating the application
    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
    we create a signal handler for onPurchaseRestored.
    \snippet qthangman/qml/qthangman/StoreView.qml 1

    \image qthangman-store-example.png
    In additon to registering the products, we also provide an interface to actually purchase the registered product.  QtHangman defines a
    custom component called StoreItem to display and handle the purchasing interaction.
    \snippet qthangman/qml/qthangman/StoreView.qml 1
    The StoreItem component will display the product data that is queried from the platform's store, and will call the purchase() method on the
    product when it is clicked by the user.
    \snippet qthangman/qml/qthangman/StoreItem.qml 0
*/
