summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2014-01-26 17:23:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-28 16:06:11 +0100
commiteae113bb1c9991cdb58b8566242d75ddb9c6677d (patch)
treed3c2531935a7969c05da7098a1c810b6da1a3fa8 /examples/bluetooth
parent309da660cacf3abdae152947898dcc3685369484 (diff)
Adding a qml OPP example for sending pictures
[ChangeLog][QtBluetooth][General] Added a new Object-Push example. Change-Id: I78988771259dd9c7b65080bb7fb9828f6f55ece4 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/bluetooth')
-rw-r--r--examples/bluetooth/qmlpicturetransfer/Button.qml65
-rw-r--r--examples/bluetooth/qmlpicturetransfer/DeviceDiscovery.qml87
-rw-r--r--examples/bluetooth/qmlpicturetransfer/FileSending.qml101
-rw-r--r--examples/bluetooth/qmlpicturetransfer/PictureSelector.qml123
-rw-r--r--examples/bluetooth/qmlpicturetransfer/background.pngbin0 -> 189737 bytes
-rw-r--r--examples/bluetooth/qmlpicturetransfer/bttransfer.qml63
-rw-r--r--examples/bluetooth/qmlpicturetransfer/filetransfer.cpp66
-rw-r--r--examples/bluetooth/qmlpicturetransfer/filetransfer.h68
-rw-r--r--examples/bluetooth/qmlpicturetransfer/icon.pngbin0 -> 4712 bytes
-rw-r--r--examples/bluetooth/qmlpicturetransfer/main.cpp63
-rw-r--r--examples/bluetooth/qmlpicturetransfer/qmltransfer.pro30
-rw-r--r--examples/bluetooth/qmlpicturetransfer/qmltransfer.qrc10
12 files changed, 676 insertions, 0 deletions
diff --git a/examples/bluetooth/qmlpicturetransfer/Button.qml b/examples/bluetooth/qmlpicturetransfer/Button.qml
new file mode 100644
index 00000000..5ee56d10
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/Button.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ property alias text: label.text
+ signal clicked();
+ opacity: 0.7
+ height: label.height + 30
+ width: label.width + 90
+ border.color: Qt.lighter("#67b0d1")
+ border.width: 1
+ color: mArea.pressed ? "#5c9fba" : "#67b0d1"
+ Text {
+ id: label
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pointSize: 10
+ color: "black"
+ }
+ MouseArea {
+ id: mArea
+ anchors.fill: parent
+ onClicked: parent.clicked()
+ }
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/DeviceDiscovery.qml b/examples/bluetooth/qmlpicturetransfer/DeviceDiscovery.qml
new file mode 100644
index 00000000..c6629a80
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/DeviceDiscovery.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtBluetooth 5.0
+
+Item {
+ Rectangle {
+ id: title
+ opacity: 0.7
+ height: titleLabel.height + 90
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 100
+
+ color: "#5c9fba"
+ Text {
+ id: titleLabel
+ text: "Select device"
+ color: "black"
+ font.pointSize: 15
+ anchors.centerIn: parent
+ }
+ }
+
+ ListView {
+ id: listView
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.top: title.bottom
+ anchors.topMargin: 0
+ anchors.margins: 100
+ clip: true
+ add: Transition {
+ NumberAnimation { properties: "x"; from: 1000; duration: 500 }
+ }
+
+ model: BluetoothDiscoveryModel {
+ discoveryMode: BluetoothDiscoveryModel.DeviceDiscovery
+ }
+
+ delegate: Button {
+ width: listView.width + 2
+ text: model.name
+ onClicked: root.remoteDevice = model.remoteAddress
+ }
+ }
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/FileSending.qml b/examples/bluetooth/qmlpicturetransfer/FileSending.qml
new file mode 100644
index 00000000..d59eca50
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/FileSending.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ Button {
+ x: 40
+ y: 40
+ text: "Back"
+ onClicked: loader.source = "DeviceDiscovery.qml"
+ }
+
+ Text {
+ anchors.bottom: theProgress.top
+ anchors.left: theProgress.left
+ anchors.right: parent.right
+ anchors.rightMargin: 100
+ anchors.bottomMargin: 40
+ wrapMode: Text.Wrap
+ color: "white"
+ text: "Sending file: " + root.fileName + "<br>" + "Remote-Device:" + root.remoteDevice
+ }
+
+ Rectangle {
+ id: theProgress
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 100
+ width: (parent.width - 200) * fileTransfer.progress
+ height: 50
+ color: "#5c9fba"
+ opacity: 0.7
+ Behavior on width {
+ NumberAnimation {duration: 300}
+ }
+ }
+ Text {
+ text: "0%"
+ anchors.horizontalCenter: theProgress.left
+ anchors.top: theProgress.bottom
+ anchors.topMargin: 10
+ color: "white"
+ }
+
+ Text {
+ text: "100%"
+ anchors.right: parent.right
+ anchors.rightMargin: 100 - width/2
+ anchors.top: theProgress.bottom
+ anchors.topMargin: 10
+ color: "white"
+ }
+
+ Image {
+ anchors.top: theProgress.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.margins: 60
+ fillMode: Image.PreserveAspectFit
+ source: "file://" + root.fileName
+ }
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/PictureSelector.qml b/examples/bluetooth/qmlpicturetransfer/PictureSelector.qml
new file mode 100644
index 00000000..6cef7c6e
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/PictureSelector.qml
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.folderlistmodel 1.0
+
+Item {
+ Rectangle {
+ id: title
+ opacity: 0.7
+ height: titleLabel.height + 90
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 70
+
+ color: "#5c9fba"
+ Text {
+ id: titleLabel
+ text: "Select picture"
+ color: "white"
+ font.bold: true
+ font.pointSize: 15
+ anchors.centerIn: parent
+ }
+ }
+
+ ListView {
+ id: listView
+ clip: true
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.top: title.bottom
+ anchors.topMargin: 0
+ anchors.margins: 70
+ spacing: 5
+ add: Transition {
+ NumberAnimation { properties: "x"; from: 1000; duration: 500 }
+ }
+
+ model: FolderListModel {
+ folder: "file://"+SystemPictureFolder
+ showDirs: false
+ }
+
+ delegate: Rectangle {
+ opacity: 0.7
+ height: label.height + 130
+ width: listView.width + 2
+ x: -1
+ border.color: Qt.lighter("#67b0d1")
+ border.width: 1
+ color: mArea.pressed ? "#5c9fba" : "#67b0d1"
+ Image {
+ id: picture
+ anchors.verticalCenter: parent.verticalCenter
+ height: parent.height-10
+ fillMode: Image.PreserveAspectFit
+ asynchronous: true
+ source: "file://" + model.filePath
+ }
+
+ Text {
+ id: label
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.margins: 20
+ anchors.left: picture.right
+ text: model.fileName
+ font.bold: true
+ font.pointSize: 10
+ color: "white"
+ wrapMode: Text.WordWrap
+ }
+ MouseArea {
+ id: mArea
+ anchors.fill: parent
+ onClicked: {
+ print ("path: " + model.filePath + " " + model.fileName)
+ root.fileName = model.filePath
+ }
+ }
+ }
+ }
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/background.png b/examples/bluetooth/qmlpicturetransfer/background.png
new file mode 100644
index 00000000..c9f80fb5
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/background.png
Binary files differ
diff --git a/examples/bluetooth/qmlpicturetransfer/bttransfer.qml b/examples/bluetooth/qmlpicturetransfer/bttransfer.qml
new file mode 100644
index 00000000..d6588af2
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/bttransfer.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: root
+ width: 600; height: 800
+ fillMode: Image.PreserveAspectCrop
+ source: "background.png"
+ property string remoteDevice;
+ property string fileName;
+ onRemoteDeviceChanged: {
+ loader.source = "PictureSelector.qml"
+ }
+ onFileNameChanged: {
+ fileTransfer.initTransfer(remoteDevice, fileName);
+ loader.source = "FileSending.qml"
+ }
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ source: "DeviceDiscovery.qml"
+ }
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/filetransfer.cpp b/examples/bluetooth/qmlpicturetransfer/filetransfer.cpp
new file mode 100644
index 00000000..ba8ec47e
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/filetransfer.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "filetransfer.h"
+#include <QFile>
+#include <QBluetoothTransferReply>
+#include <QDebug>
+
+FileTransfer::FileTransfer(QObject *parent) :
+ QObject(parent), m_progress(0)
+{
+}
+
+
+void FileTransfer::initTransfer(QString address, QString fileName)
+{
+ qDebug() << "Begin sharing file: " << address << fileName;
+ QBluetoothAddress btAddress = QBluetoothAddress(address);
+ QBluetoothTransferRequest request(btAddress);
+ QFile *file = new QFile(fileName);
+ reply = manager.put(request, file);
+ connect(reply, SIGNAL(transferProgress(qint64,qint64)), this, SLOT(updateProgress(qint64,qint64)));
+}
+
+void FileTransfer::updateProgress(qint64 transferred, qint64 total)
+{
+ m_progress = ((float)transferred)/((float)total);
+ Q_EMIT progressChanged();
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/filetransfer.h b/examples/bluetooth/qmlpicturetransfer/filetransfer.h
new file mode 100644
index 00000000..1bc9c78d
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/filetransfer.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FILETRANSFER_H
+#define FILETRANSFER_H
+
+#include <QObject>
+#include <QBluetoothTransferManager>
+
+class FileTransfer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(float progress READ getProgress NOTIFY progressChanged)
+public:
+ explicit FileTransfer(QObject *parent = 0);
+ float getProgress() { return m_progress;}
+
+signals:
+ void progressChanged();
+
+public slots:
+ void initTransfer(QString address, QString fileName);
+ void updateProgress(qint64,qint64);
+
+private:
+ QBluetoothTransferManager manager;
+ QBluetoothTransferReply *reply;
+ float m_progress;
+};
+
+#endif // FILETRANSFER_H
diff --git a/examples/bluetooth/qmlpicturetransfer/icon.png b/examples/bluetooth/qmlpicturetransfer/icon.png
new file mode 100644
index 00000000..e378a26d
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/icon.png
Binary files differ
diff --git a/examples/bluetooth/qmlpicturetransfer/main.cpp b/examples/bluetooth/qmlpicturetransfer/main.cpp
new file mode 100644
index 00000000..3a6ce944
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QtQml/QQmlEngine>
+#include <QtQuick/QQuickView>
+#include <QDebug>
+#include <QQmlContext>
+#include <QStandardPaths>
+#include "filetransfer.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication application(argc, argv);
+ QQuickView view;
+ FileTransfer fileTransfer;
+ view.rootContext()->setContextProperty("fileTransfer", QVariant::fromValue(&fileTransfer));
+ view.rootContext()->setContextProperty("SystemPictureFolder",
+ QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first());
+
+ view.setSource(QUrl(QLatin1String("qrc:/bttransfer.qml")));
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
+ view.show();
+ return application.exec();
+}
diff --git a/examples/bluetooth/qmlpicturetransfer/qmltransfer.pro b/examples/bluetooth/qmlpicturetransfer/qmltransfer.pro
new file mode 100644
index 00000000..da5e1d18
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/qmltransfer.pro
@@ -0,0 +1,30 @@
+QT += quick bluetooth
+
+SOURCES += \
+ main.cpp
+
+TARGET = qml_transfer
+TEMPLATE = app
+
+RESOURCES += \
+ qmltransfer.qrc
+
+OTHER_FILES += \
+ bttransfer.qml \
+ Button.qml
+
+OTHER_FILES += \
+ DeviceDiscovery.qml
+
+OTHER_FILES += \
+ PictureSelector.qml
+
+HEADERS += \
+ filetransfer.h
+
+SOURCES += \
+ filetransfer.cpp
+
+OTHER_FILES += \
+ FileSending.qml
+
diff --git a/examples/bluetooth/qmlpicturetransfer/qmltransfer.qrc b/examples/bluetooth/qmlpicturetransfer/qmltransfer.qrc
new file mode 100644
index 00000000..f28e97ea
--- /dev/null
+++ b/examples/bluetooth/qmlpicturetransfer/qmltransfer.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>bttransfer.qml</file>
+ <file>DeviceDiscovery.qml</file>
+ <file>PictureSelector.qml</file>
+ <file>FileSending.qml</file>
+ <file>Button.qml</file>
+ <file>background.png</file>
+ </qresource>
+</RCC>