/****************************************************************************
**
** 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$
**
****************************************************************************/

/*!
    \example wearable
    \title Qt Quick Controls 2 - Wearable Demo
    \ingroup qtquickcontrols2-examples
    \brief Demonstrates an application launcher designed for wearable devices.

    \image qtquickcontrols2-wearable.png

    The \e {Wearable Demo} consists of an application launcher and a collection
    of small and simple example applications aimed at wearable devices.

    \section1 Structure

    The main .qml file \c wearable.qml consists of an ApplicationWindow, a StackView
    for a stack-based navigation model, and buttons for interactive navigation.

    \quotefromfile wearable/wearable.qml
    \skipuntil import "qml/Style"
    \printuntil id: window
    \dots
    \skipto header
    \printuntil id: homeButton
    \dots 8
    \skipto onClicked
    \printuntil }
    \printuntil id: backButton
    \dots 8
    \skipto onClicked
    \printuntil id: stackView
    \dots 8
    \skipuntil initialItem
    \printuntil /^\}/

    \section1 Styling

    The demo uses a custom \l {Styling Qt Quick Controls 2}{Qt Quick Controls 2 style}
    embedded into the demo's resources. Since the style is specific to this particular
    demo, it only needs to implement a few controls. The style also provides a singleton
    type that contains various styling attributes, such as fonts and colors.

    \list
        \li \c qml/Style/PageIndicator.qml
        \li \c qml/Style/Slider.qml
        \li \c qml/Style/Switch.qml
        \li \c qml/Style/UIStyle.qml
    \endlist

    The style is applied in \c main() in \c wearable.cpp:

    \snippet wearable/wearable.cpp style

    The main benefit of using the built-in styling system is that the style selection
    is fully transparent to the application code. There is no need to import a specific
    folder that contains the styled controls. This way, the application can be run with
    other styles too.

    \section1 Custom Type

    The demo application contains a custom button type implemented in \c qml/NaviButton.qml.
    The navigation button is used as a home and back button in \c wearable.qml. \c NaviButton
    extends the standard AbstractButton API with properties that control the slide in and slide
    out transitions and the button image.

    \quotefromfile wearable/qml/NaviButton.qml
    \skipuntil import "Style"
    \printuntil id: image
    \dots 8
    \skipuntil }
    \printuntil background:
    \dots 8
    \skipto }
    \printuntil /^\}/

    \section1 Launcher Page

    The application launcher, which is specified as the initial content above, is
    implemented using a circular PathView in \c LauncherPage.qml. Each application is
    contained within its own .qml file, which is listed in a ListModel on the launcher
    page.

    \quotefromfile wearable/qml/LauncherPage.qml
    \skipto PathView
    \printuntil signal launched
    \dots
    \skipto ListModel
    \printuntil }
    \dots 8
    \printline ListElement
    \skipto "Settings"
    \printuntil delegate:
    \dots 8
    \skipto onClicked:
    \printto path:
    \dots
    \skipto /^\}/
    \printline }

    \section1 Applications

    The applications are designed for touch input based on what input methods
    or communication means are typically offered by wearable devices.

    Most applications have their own JavaScript files that act as dummy
    application backends. They illustrate fetching external data and help
    manipulating or converting the data. In the \c Navigation and \c Weather
    applications, data acquisition is implemented using \l XMLHttpRequest to
    read from local files. These files were generated by storing responses from
    remote servers in JSON format. This code can be easily modified to acquire
    data from real remote servers.

    \section2 Navigation

    This application displays a walking route from source to destination. This
    route is obtained as a response by invoking an API provided by
    \l {https://www.openstreetmap.org/}. The response is in JSON format and the
    corresponding JavaScript file associated with the application helps interpret
    the response. Currently, it is not possible to specify the source and destination
    from within the application, but it can be easily added based on the device's
    capabilities. For example, user input could be implemented as screens with
    input fields, or can be communicated over Bluetooth/Wifi from a paired app
    running on another device such as a smart phone or PC.

    \section2 Weather

    This application displays weather information such as temperature, sunrise
    and sunset times, air pressure, and so on. This information is obtained
    as a response to invoking \l {https://openweathermap.org/}. The response is
    in JSON format and the corresponding JavaScript file associated with the
    application helps interpret the response. As with the Navigation application,
    this application can be modified by adding screens to accept location information
    to obtain weather data for a given location.

    \section2 World Clock

    This application displays a world clock for different cities. As of now, the
    list of cities is hard-coded in the application, but that can be changed based
    on the input capabilities of the device.

    \section2 Others

    The remaining applications return static data for now, but they can easily be
    modified to process response data obtained from respective services.

    \include examples-run.qdocinc
*/
