diff options
Diffstat (limited to 'examples/bluetooth/picturetransfer')
16 files changed, 0 insertions, 890 deletions
diff --git a/examples/bluetooth/picturetransfer/Button.qml b/examples/bluetooth/picturetransfer/Button.qml deleted file mode 100644 index be8bbbf8..00000000 --- a/examples/bluetooth/picturetransfer/Button.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.1 - -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/picturetransfer/DeviceDiscovery.qml b/examples/bluetooth/picturetransfer/DeviceDiscovery.qml deleted file mode 100644 index 2ab99f86..00000000 --- a/examples/bluetooth/picturetransfer/DeviceDiscovery.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.1 -import QtBluetooth 5.2 - -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 - } - } - -//! [Discovery-1] - ListView { -//! [Discovery-1] - 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 } - } -//! [Discovery-2] - model: BluetoothDiscoveryModel { - discoveryMode: BluetoothDiscoveryModel.DeviceDiscovery - onErrorChanged: { - if (error == BluetoothDiscoveryModel.NoError) - return; - if (error == BluetoothDiscoveryModel.PoweredOffError) - titleLabel.text = "Bluetooth turned off"; - else - titleLabel.text = "Cannot find devices"; - } - } - - delegate: Button { - width: listView.width + 2 - text: model.name - onClicked: root.remoteDevice = model.remoteAddress - } - } -//! [Discovery-2] -} diff --git a/examples/bluetooth/picturetransfer/FileSending.qml b/examples/bluetooth/picturetransfer/FileSending.qml deleted file mode 100644 index 336488a6..00000000 --- a/examples/bluetooth/picturetransfer/FileSending.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.1 - -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/picturetransfer/PictureSelector.qml b/examples/bluetooth/picturetransfer/PictureSelector.qml deleted file mode 100644 index d9dd401b..00000000 --- a/examples/bluetooth/picturetransfer/PictureSelector.qml +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.1 -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 } - } - -//! [FileSelect-1] - model: FolderListModel { - folder: "file://"+SystemPictureFolder - showDirs: false - } - - delegate: Rectangle { -//! [FileSelect-1] - 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 - } - -//! [FileSelect-2] - Text { -//! [FileSelect-2] - id: label - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.margins: 20 - anchors.left: picture.right -//! [FileSelect-3] - text: model.fileName -//! [FileSelect-3] - font.bold: true - font.pointSize: 10 - color: "white" - wrapMode: Text.WordWrap -//! [FileSelect-4] - } - MouseArea { - id: mArea - anchors.fill: parent - onClicked: { - print ("path: " + model.filePath + " " + model.fileName) - root.fileName = model.filePath - } - } - } -//! [FileSelect-4] - } -} diff --git a/examples/bluetooth/picturetransfer/background.png b/examples/bluetooth/picturetransfer/background.png Binary files differdeleted file mode 100644 index c9f80fb5..00000000 --- a/examples/bluetooth/picturetransfer/background.png +++ /dev/null diff --git a/examples/bluetooth/picturetransfer/bttransfer.qml b/examples/bluetooth/picturetransfer/bttransfer.qml deleted file mode 100644 index 46ce24a3..00000000 --- a/examples/bluetooth/picturetransfer/bttransfer.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.1 - -//! [Root-1] -Image { - id: root -//! [Root-1] - width: 600; height: 800 - fillMode: Image.PreserveAspectCrop - source: "background.png" -//! [Root-2] - property string remoteDevice; - property string fileName; -//! [Root-2] - onRemoteDeviceChanged: { - loader.source = "PictureSelector.qml" - } - -//! [Root-3] - onFileNameChanged: { - fileTransfer.initTransfer(remoteDevice, fileName); - loader.source = "FileSending.qml" - } -//! [Root-3] - - Loader { - id: loader - anchors.fill: parent - source: "DeviceDiscovery.qml" - } -//! [Root-4] -} -//! [Root-4] diff --git a/examples/bluetooth/picturetransfer/doc/images/opp-example-1.png b/examples/bluetooth/picturetransfer/doc/images/opp-example-1.png Binary files differdeleted file mode 100644 index cf972277..00000000 --- a/examples/bluetooth/picturetransfer/doc/images/opp-example-1.png +++ /dev/null diff --git a/examples/bluetooth/picturetransfer/doc/images/opp-example-2.png b/examples/bluetooth/picturetransfer/doc/images/opp-example-2.png Binary files differdeleted file mode 100644 index bc248284..00000000 --- a/examples/bluetooth/picturetransfer/doc/images/opp-example-2.png +++ /dev/null diff --git a/examples/bluetooth/picturetransfer/doc/images/opp-example-3.png b/examples/bluetooth/picturetransfer/doc/images/opp-example-3.png Binary files differdeleted file mode 100644 index de7231dc..00000000 --- a/examples/bluetooth/picturetransfer/doc/images/opp-example-3.png +++ /dev/null diff --git a/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc b/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc deleted file mode 100644 index a2acafb9..00000000 --- a/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc +++ /dev/null @@ -1,100 +0,0 @@ -a/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 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 picturetransfer -\title QML Bluetooth Picture Push Example -\brief An example showing the use Bluetooth Object Push Profile (OPP). - -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 (OPP) 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 - -\include examples-run.qdocinc - -\sa {Qt Bluetooth} - -\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 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 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 - - - -*/ diff --git a/examples/bluetooth/picturetransfer/filetransfer.cpp b/examples/bluetooth/picturetransfer/filetransfer.cpp deleted file mode 100644 index 5816413b..00000000 --- a/examples/bluetooth/picturetransfer/filetransfer.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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) -{ -} - -//! [Transfer-1] -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))); -} -//! [Transfer-1] - -void FileTransfer::updateProgress(qint64 transferred, qint64 total) -{ - m_progress = ((float)transferred)/((float)total); - emit progressChanged(); -} diff --git a/examples/bluetooth/picturetransfer/filetransfer.h b/examples/bluetooth/picturetransfer/filetransfer.h deleted file mode 100644 index 4dee32fe..00000000 --- a/examples/bluetooth/picturetransfer/filetransfer.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 = nullptr); - 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/picturetransfer/icon.png b/examples/bluetooth/picturetransfer/icon.png Binary files differdeleted file mode 100644 index e378a26d..00000000 --- a/examples/bluetooth/picturetransfer/icon.png +++ /dev/null diff --git a/examples/bluetooth/picturetransfer/main.cpp b/examples/bluetooth/picturetransfer/main.cpp deleted file mode 100644 index 4622e87e..00000000 --- a/examples/bluetooth/picturetransfer/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication application(argc, argv); -//! [Transfer-2] - QQuickView view; - FileTransfer fileTransfer; - view.rootContext()->setContextProperty("fileTransfer", QVariant::fromValue(&fileTransfer)); -//! [Transfer-2] - view.rootContext()->setContextProperty("SystemPictureFolder", - QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first()); - qDebug() << QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); - - view.setSource(QUrl(QStringLiteral("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/picturetransfer/picturetransfer.pro b/examples/bluetooth/picturetransfer/picturetransfer.pro deleted file mode 100644 index 077673e9..00000000 --- a/examples/bluetooth/picturetransfer/picturetransfer.pro +++ /dev/null @@ -1,28 +0,0 @@ -QT += quick bluetooth - - -TARGET = qml_picturetransfer -TEMPLATE = app - -RESOURCES += \ - qmltransfer.qrc - -OTHER_FILES += \ - bttransfer.qml \ - Button.qml \ - DeviceDiscovery.qml \ - PictureSelector.qml \ - FileSending.qml - -HEADERS += \ - filetransfer.h - -SOURCES += \ - filetransfer.cpp \ - main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/picturetransfer -INSTALLS += target - -EXAMPLE_FILES += \ - icon.png diff --git a/examples/bluetooth/picturetransfer/qmltransfer.qrc b/examples/bluetooth/picturetransfer/qmltransfer.qrc deleted file mode 100644 index f28e97ea..00000000 --- a/examples/bluetooth/picturetransfer/qmltransfer.qrc +++ /dev/null @@ -1,10 +0,0 @@ -<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> |