summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc
blob: 7a1661218d629b676e7ddf15117809f05f57a7aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
a/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the QtBluetooth module.
**
** $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 Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\example picturetransfer
\title QML Bluetooth Picture Push Example

The Bluetooth Picture Push example shows how to use the \l QBluetoothTransferManager
API. The example transfers a local image to a remote device. Unfortunately this example cannot be used on
Android as Qt does not support the Object Push Profile on this platform.

On the first user interface page the application scans for remote Bluetooth devices. The user must select
the appropriate device to continue:

\image opp-example-1.png

The next page presents a list of image files on the device. The files must be located under
\l QStandardPaths::PicturesLocation}:

\image opp-example-2.png

Once the picture was selected the UI shows the progress of the file transfer:

\image opp-example-3.png

\section1 Device Discovery

The device discovery uses the \l BluetoothDiscoveryModel to detect the remote devices. Each discovery is displayed
as an entry in a list. Once a device was selected the device address is stored in the \c root element. More
details about the \c root element will follow further below.

\snippet picturetransfer/DeviceDiscovery.qml Discovery-1
\snippet picturetransfer/DeviceDiscovery.qml Discovery-2

\section1 File Selection

The file is selected with the help of \l FolderListModel. Once again the selected file is stored in the \c root
element:

\snippet picturetransfer/PictureSelector.qml FileSelect-1
\snippet picturetransfer/PictureSelector.qml FileSelect-2
\snippet picturetransfer/PictureSelector.qml FileSelect-3
\snippet picturetransfer/PictureSelector.qml FileSelect-4

\section1 The root element

The already mentioned \c root element collects the necessary pieces of data for the picture transfer.
Once the file name has been set it triggers the file transfer:


\snippet picturetransfer/bttransfer.qml Root-1
\snippet picturetransfer/bttransfer.qml Root-2
\snippet picturetransfer/bttransfer.qml Root-3
\snippet picturetransfer/bttransfer.qml Root-3

\section1 The File Transfer

The file transfer is implemented in C++:

\snippet picturetransfer/filetransfer.cpp Transfer-1

and exposed to QML via a context property:

\snippet picturetransfer/main.cpp Transfer-2



*/