summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-02-17 10:38:48 +0100
committerAlex Blasche <alexander.blasche@digia.com>2014-02-17 10:38:48 +0100
commit8fe7fbe6b552b0d196967cfea85fede5e7c211b9 (patch)
treeb90f246cc3b8847cedaf6b5f8dc045cfc563b9be /examples
parent9bcb79f0c741f7805dad17c467a5c2041227a18a (diff)
parentb4bde05d8459cc57c25bac3f7be19fcf03908606 (diff)
Merge branch 'dev' into btle
Conflicts: examples/bluetooth/bluetooth.pro src/bluetooth/doc/src/examples.qdoc src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp src/bluetooth/qbluetoothservicediscoveryagent_p.h src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp Change-Id: Ie1577e4b0f469cd5a6b05a61cbe94f180a64448d
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/bluetooth.pro5
-rw-r--r--examples/bluetooth/btchat/btchat.pro3
-rw-r--r--examples/bluetooth/btfiletransfer/btfiletransfer.pro3
-rw-r--r--examples/bluetooth/btscanner/btscanner.pro2
-rw-r--r--examples/bluetooth/bttennis/bttennis.pro6
-rw-r--r--examples/bluetooth/picturetransfer/Button.qml65
-rw-r--r--examples/bluetooth/picturetransfer/DeviceDiscovery.qml91
-rw-r--r--examples/bluetooth/picturetransfer/FileSending.qml101
-rw-r--r--examples/bluetooth/picturetransfer/PictureSelector.qml132
-rw-r--r--examples/bluetooth/picturetransfer/background.pngbin0 -> 189737 bytes
-rw-r--r--examples/bluetooth/picturetransfer/bttransfer.qml73
-rw-r--r--examples/bluetooth/picturetransfer/doc/images/opp-example-1.pngbin0 -> 152761 bytes
-rw-r--r--examples/bluetooth/picturetransfer/doc/images/opp-example-2.pngbin0 -> 155969 bytes
-rw-r--r--examples/bluetooth/picturetransfer/doc/images/opp-example-3.pngbin0 -> 169273 bytes
-rw-r--r--examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc91
-rw-r--r--examples/bluetooth/picturetransfer/filetransfer.cpp67
-rw-r--r--examples/bluetooth/picturetransfer/filetransfer.h68
-rw-r--r--examples/bluetooth/picturetransfer/icon.pngbin0 -> 4712 bytes
-rw-r--r--examples/bluetooth/picturetransfer/main.cpp66
-rw-r--r--examples/bluetooth/picturetransfer/picturetransfer.pro25
-rw-r--r--examples/bluetooth/picturetransfer/qmltransfer.qrc10
-rw-r--r--examples/bluetooth/scanner/Button.qml8
-rw-r--r--examples/bluetooth/scanner/qmlscanner.cpp2
-rw-r--r--examples/bluetooth/scanner/scanner.pro8
-rw-r--r--examples/bluetooth/scanner/scanner.qml32
-rw-r--r--examples/nfc/annotatedurl/annotatedurl.pro2
-rw-r--r--examples/nfc/corkboard/Mode.qml157
-rw-r--r--examples/nfc/corkboard/NfcFlag.pngbin0 -> 8591 bytes
-rw-r--r--examples/nfc/corkboard/bar-descriptor.xml32
-rw-r--r--examples/nfc/corkboard/cork.jpgbin0 -> 149337 bytes
-rw-r--r--examples/nfc/corkboard/corkboard.pro14
-rw-r--r--examples/nfc/corkboard/corkboard.qrc10
-rw-r--r--examples/nfc/corkboard/corkboards.qml88
-rw-r--r--examples/nfc/corkboard/doc/images/corkboard.pngbin0 -> 639743 bytes
-rw-r--r--examples/nfc/corkboard/doc/src/corkboard.qdoc39
-rw-r--r--examples/nfc/corkboard/icon.pngbin0 -> 6594 bytes
-rw-r--r--examples/nfc/corkboard/main.cpp54
-rw-r--r--examples/nfc/corkboard/note-yellow.pngbin0 -> 54559 bytes
-rw-r--r--examples/nfc/corkboard/tack.pngbin0 -> 7282 bytes
-rw-r--r--examples/nfc/ndefeditor/ndefeditor.pro3
-rw-r--r--examples/nfc/nfc.pro2
-rw-r--r--examples/nfc/poster/poster.pro3
42 files changed, 1248 insertions, 14 deletions
diff --git a/examples/bluetooth/bluetooth.pro b/examples/bluetooth/bluetooth.pro
index 4d520550..78ba1fc1 100644
--- a/examples/bluetooth/bluetooth.pro
+++ b/examples/bluetooth/bluetooth.pro
@@ -6,5 +6,6 @@ qtHaveModule(widgets) {
bttennis
}
-SUBDIRS += scanner \
- lowenergyscanner
+qtHaveModule(quick): SUBDIRS += scanner \
+ picturetransfer \
+ lowenergyscanner
diff --git a/examples/bluetooth/btchat/btchat.pro b/examples/bluetooth/btchat/btchat.pro
index 6d6a928b..08fdd4a7 100644
--- a/examples/bluetooth/btchat/btchat.pro
+++ b/examples/bluetooth/btchat/btchat.pro
@@ -19,3 +19,6 @@ HEADERS = \
FORMS = \
chat.ui \
remoteselector.ui
+
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/btchat
+INSTALLS += target
diff --git a/examples/bluetooth/btfiletransfer/btfiletransfer.pro b/examples/bluetooth/btfiletransfer/btfiletransfer.pro
index 58d4e638..00b16415 100644
--- a/examples/bluetooth/btfiletransfer/btfiletransfer.pro
+++ b/examples/bluetooth/btfiletransfer/btfiletransfer.pro
@@ -25,3 +25,6 @@ OTHER_FILES += \
RESOURCES += \
btfiletransfer.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/scanner
+INSTALLS += target
diff --git a/examples/bluetooth/btscanner/btscanner.pro b/examples/bluetooth/btscanner/btscanner.pro
index 81d83cae..f1254629 100644
--- a/examples/bluetooth/btscanner/btscanner.pro
+++ b/examples/bluetooth/btscanner/btscanner.pro
@@ -16,3 +16,5 @@ FORMS = \
device.ui \
service.ui
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/btscanner
+INSTALLS += target
diff --git a/examples/bluetooth/bttennis/bttennis.pro b/examples/bluetooth/bttennis/bttennis.pro
index 878795da..1c014784 100644
--- a/examples/bluetooth/bttennis/bttennis.pro
+++ b/examples/bluetooth/bttennis/bttennis.pro
@@ -28,3 +28,9 @@ FORMS = \
RESOURCES += \
tennis.qrc
+
+OTHER_FILES = \
+ connect.png
+
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/bttennis
+INSTALLS += target
diff --git a/examples/bluetooth/picturetransfer/Button.qml b/examples/bluetooth/picturetransfer/Button.qml
new file mode 100644
index 00000000..eed6a4e9
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/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.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
new file mode 100644
index 00000000..1da77975
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/DeviceDiscovery.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** 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.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
+ }
+
+ 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
new file mode 100644
index 00000000..3a4a282f
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/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.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
new file mode 100644
index 00000000..ca81ae44
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/PictureSelector.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** 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.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
new file mode 100644
index 00000000..c9f80fb5
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/background.png
Binary files differ
diff --git a/examples/bluetooth/picturetransfer/bttransfer.qml b/examples/bluetooth/picturetransfer/bttransfer.qml
new file mode 100644
index 00000000..bdfb47f0
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/bttransfer.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** 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.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
new file mode 100644
index 00000000..0b33bc8a
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/doc/images/opp-example-1.png
Binary files differ
diff --git a/examples/bluetooth/picturetransfer/doc/images/opp-example-2.png b/examples/bluetooth/picturetransfer/doc/images/opp-example-2.png
new file mode 100644
index 00000000..d3d325d5
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/doc/images/opp-example-2.png
Binary files differ
diff --git a/examples/bluetooth/picturetransfer/doc/images/opp-example-3.png b/examples/bluetooth/picturetransfer/doc/images/opp-example-3.png
new file mode 100644
index 00000000..cef9830c
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/doc/images/opp-example-3.png
Binary files differ
diff --git a/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc b/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc
new file mode 100644
index 00000000..fc2ffa32
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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.
+
+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::PictureLocation}:
+
+\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
+
+
+
+*/
diff --git a/examples/bluetooth/picturetransfer/filetransfer.cpp b/examples/bluetooth/picturetransfer/filetransfer.cpp
new file mode 100644
index 00000000..7cfd041d
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/filetransfer.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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)
+{
+}
+
+//! [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);
+ Q_EMIT progressChanged();
+}
diff --git a/examples/bluetooth/picturetransfer/filetransfer.h b/examples/bluetooth/picturetransfer/filetransfer.h
new file mode 100644
index 00000000..1bc9c78d
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/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/picturetransfer/icon.png b/examples/bluetooth/picturetransfer/icon.png
new file mode 100644
index 00000000..e378a26d
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/icon.png
Binary files differ
diff --git a/examples/bluetooth/picturetransfer/main.cpp b/examples/bluetooth/picturetransfer/main.cpp
new file mode 100644
index 00000000..7db3053e
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/main.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 <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);
+//! [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(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/picturetransfer/picturetransfer.pro b/examples/bluetooth/picturetransfer/picturetransfer.pro
new file mode 100644
index 00000000..0eee46a2
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/picturetransfer.pro
@@ -0,0 +1,25 @@
+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
+
+
+
diff --git a/examples/bluetooth/picturetransfer/qmltransfer.qrc b/examples/bluetooth/picturetransfer/qmltransfer.qrc
new file mode 100644
index 00000000..f28e97ea
--- /dev/null
+++ b/examples/bluetooth/picturetransfer/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>
diff --git a/examples/bluetooth/scanner/Button.qml b/examples/bluetooth/scanner/Button.qml
index a3debfca..17fb38b5 100644
--- a/examples/bluetooth/scanner/Button.qml
+++ b/examples/bluetooth/scanner/Button.qml
@@ -48,9 +48,7 @@ Rectangle {
property alias text: label.text
signal clicked()
-
- height: 60
- width: 105
+ height: label.height*1.1
color: active ? "#1c56f3" : "white"
@@ -61,9 +59,11 @@ Rectangle {
id: label
text: "Full Discovery"
font.bold: true
- anchors.fill: parent
+ font.pointSize: 17
+ width: parent.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
+ anchors.centerIn: parent
}
MouseArea {
diff --git a/examples/bluetooth/scanner/qmlscanner.cpp b/examples/bluetooth/scanner/qmlscanner.cpp
index 3602674b..47d0bb26 100644
--- a/examples/bluetooth/scanner/qmlscanner.cpp
+++ b/examples/bluetooth/scanner/qmlscanner.cpp
@@ -41,9 +41,11 @@
#include <QtGui/QGuiApplication>
#include <QtQuick/QQuickView>
#include <QtQml/QQmlEngine>
+#include <QtCore/QLoggingCategory>
int main(int argc, char *argv[])
{
+ //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
QGuiApplication application(argc, argv);
const QString mainQmlApp = QLatin1String("qrc:/scanner.qml");
QQuickView view;
diff --git a/examples/bluetooth/scanner/scanner.pro b/examples/bluetooth/scanner/scanner.pro
index 7e5c00f7..68572533 100644
--- a/examples/bluetooth/scanner/scanner.pro
+++ b/examples/bluetooth/scanner/scanner.pro
@@ -8,9 +8,11 @@ RESOURCES += \
scanner.qrc
OTHER_FILES += \
- scanner.qml
+ scanner.qml \
+ Button.qml \
+ default.png
#DEFINES += QMLJSDEBUGGER
-OTHER_FILES += \
- Button.qml
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/scanner
+INSTALLS += target
diff --git a/examples/bluetooth/scanner/scanner.qml b/examples/bluetooth/scanner/scanner.qml
index 48b2ee53..67aaecf0 100644
--- a/examples/bluetooth/scanner/scanner.qml
+++ b/examples/bluetooth/scanner/scanner.qml
@@ -54,6 +54,18 @@ Item {
onDiscoveryModeChanged: console.log("Discovery mode: " + discoveryMode)
onServiceDiscovered: console.log("Found new service " + service.deviceAddress + " " + service.deviceName + " " + service.serviceName);
onDeviceDiscovered: console.log("New device: " + device)
+ onErrorChanged: {
+ switch (btModel.error) {
+ case BluetoothDiscoveryModel.PoweredOffError:
+ console.log("Error: Bluetooth device not turned on"); break;
+ case BluetoothDiscoveryModel.InputOutputError:
+ console.log("Error: Bluetooth I/O Error"); break;
+ case BluetoothDiscoveryModel.NoError:
+ break;
+ default:
+ console.log("Error: Unknown Error"); break;
+ }
+ }
}
Rectangle {
@@ -62,7 +74,7 @@ Item {
width: top.width * 0.7;
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: top.top;
- height: 30;
+ height: text.height*1.2;
radius: 5
color: "#1c56f3"
visible: btModel.running
@@ -71,6 +83,7 @@ Item {
id: text
text: "Scanning"
font.bold: true
+ font.pointSize: 20
anchors.centerIn: parent
}
@@ -115,9 +128,9 @@ Item {
anchors.leftMargin: 5
Text {
id: bttext
- text: name;
+ text: deviceName ? deviceName : name
font.family: "FreeSerif"
- font.pointSize: 12
+ font.pointSize: 16
}
Text {
@@ -138,7 +151,8 @@ Item {
visible: opacity !== 0
opacity: btDelegate.expended ? 1 : 0.0
text: get_details(service)
- font: bttext.font
+ font.family: "FreeSerif"
+ font.pointSize: 14
Behavior on opacity {
NumberAnimation { duration: 200}
}
@@ -160,20 +174,28 @@ Item {
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
- spacing: 20
+ anchors.bottomMargin: 5
+ spacing: 10
Button {
id: fdButton
+ width: top.width/3*0.9
+ //mdButton has longest text
+ height: mdButton.height
text: "Full Discovery"
onClicked: btModel.discoveryMode = BluetoothDiscoveryModel.FullServiceDiscovery
}
Button {
id: mdButton
+ width: top.width/3*0.9
text: "Minimal Discovery"
onClicked: btModel.discoveryMode = BluetoothDiscoveryModel.MinimalServiceDiscovery
}
Button {
id: devButton
+ width: top.width/3*0.9
+ //mdButton has longest text
+ height: mdButton.height
text: "Device Discovery"
onClicked: btModel.discoveryMode = BluetoothDiscoveryModel.DeviceDiscovery
}
diff --git a/examples/nfc/annotatedurl/annotatedurl.pro b/examples/nfc/annotatedurl/annotatedurl.pro
index 65ed7c8d..e2bb7c06 100644
--- a/examples/nfc/annotatedurl/annotatedurl.pro
+++ b/examples/nfc/annotatedurl/annotatedurl.pro
@@ -13,3 +13,5 @@ HEADERS += mainwindow.h \
FORMS += mainwindow.ui
+target.path = $$[QT_INSTALL_EXAMPLES]/nfc/annotatedurl
+INSTALLS += target
diff --git a/examples/nfc/corkboard/Mode.qml b/examples/nfc/corkboard/Mode.qml
new file mode 100644
index 00000000..a3df4448
--- /dev/null
+++ b/examples/nfc/corkboard/Mode.qml
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtNfc module.
+**
+** $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.1
+
+Item {
+ id: page
+ width: ListView.view.width;
+ height: ListView.view.height
+ Rectangle {
+ id: frame
+ anchors.fill: parent
+ z: 1
+ color: "transparent"
+ border.color: "darkred"
+ border.width: 10
+ }
+
+ Image {
+ source: "qrc:/cork.jpg"
+ width: listView.width
+ height: listView.height
+ fillMode: Image.PreserveAspectCrop
+ }
+
+ Text {
+ anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 10}
+ text: name;
+ font.pixelSize: 30; font.bold: true; color: "white"
+ style: Text.Outline; styleColor: "black"
+ }
+
+ Repeater {
+ model: notes
+ Item {
+ id: stickyPage
+ z: 2
+
+ x: Math.random() * (listView.width-listView.width*0.30) + listView.width*0.10
+ y: Math.random() * (listView.height-listView.height*0.30) + listView.height*0.10
+
+ rotation: -listView.horizontalVelocity / 200;
+ Behavior on rotation {
+ SpringAnimation { spring: 2.0; damping: 0.15 }
+ }
+
+ Item {
+ id: sticky
+ scale: mouse.pressed ? 1 : 0.7
+ rotation: mouse.pressed ? 8 : 0
+ Behavior on rotation{
+ NumberAnimation {duration: 200 }
+ }
+ Behavior on scale{
+ NumberAnimation { duration: 200 }
+ }
+
+ Image {
+ id: stickyImage
+ x: 8 + -width * 0.6 / 2; y: -20
+ source: "qrc:/note-yellow.png"
+ scale: 0.6; transformOrigin: Item.TopLeft
+ smooth: true
+ }
+
+ TextEdit {
+ id: myText
+ text: noteText
+ x: -104; y: 36; width: 215; height: 200
+ smooth: true
+ font.pixelSize: 24
+ readOnly: false
+ rotation: -8
+ wrapMode: TextEdit.Wrap
+ }
+
+ Item {
+ id: interactionItem
+ x: stickyImage.x; y: -20
+ width: stickyImage.width * stickyImage.scale
+ height: stickyImage.height * stickyImage.scale
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ drag.target: stickyPage
+ drag.axis: Drag.XandYAxis
+ }
+ Image {
+ id: writeButton
+ source: "qrc:/NfcFlag.png"
+ rotation: -8 // Note image itself is rotated
+ anchors { bottom: parent.bottom; right:parent.right }
+ scale: flagMouse.pressed ? 1.3 : 1
+ MouseArea {
+ id: flagMouse
+ anchors.fill: parent
+ //onClicked: { }
+ }
+ }
+ }
+ }
+
+ Image {
+ x: -width / 2; y: -height * 0.5 / 2
+ source: "qrc:/tack.png"
+ scale: 0.7; transformOrigin: Item.TopLeft
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+
diff --git a/examples/nfc/corkboard/NfcFlag.png b/examples/nfc/corkboard/NfcFlag.png
new file mode 100644
index 00000000..6d2b9f89
--- /dev/null
+++ b/examples/nfc/corkboard/NfcFlag.png
Binary files differ
diff --git a/examples/nfc/corkboard/bar-descriptor.xml b/examples/nfc/corkboard/bar-descriptor.xml
new file mode 100644
index 00000000..f46eb355
--- /dev/null
+++ b/examples/nfc/corkboard/bar-descriptor.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<qnx >
+ <id>com.qt-project.cork</id>
+ <filename>corkboard</filename>
+ <name>NFC Corkboard</name>
+ <versionNumber>1.0.0</versionNumber>
+
+ <!-- adding the invoke target for a nfc Text element -->
+ <invoke-target id="com.fabian.cork">
+ <type>APPLICATION</type>
+ <filter>
+ <action>bb.action.OPEN</action>
+ <mime-type>application/vnd.rim.nfc.ndef</mime-type>
+ <property var="uris" value="ndef://1/T"/>
+ </filter>
+ </invoke-target>
+
+ <initialWindow>
+ <systemChrome>none</systemChrome>
+ <transparent>false</transparent>
+ <autoOrients>true</autoOrients>
+ <aspectRatio>portrait</aspectRatio>
+ </initialWindow>
+
+ <permission system="true">run_native</permission>
+
+ <asset entry="true" path="qml_corkboard" type="Qnx/Elf">qml_corkboard</asset>
+ <asset path="icon.png">icon.png</asset>
+ <icon>
+ <image>icon.png</image>
+ </icon>
+ </qnx>
diff --git a/examples/nfc/corkboard/cork.jpg b/examples/nfc/corkboard/cork.jpg
new file mode 100644
index 00000000..160bc002
--- /dev/null
+++ b/examples/nfc/corkboard/cork.jpg
Binary files differ
diff --git a/examples/nfc/corkboard/corkboard.pro b/examples/nfc/corkboard/corkboard.pro
new file mode 100644
index 00000000..d6247032
--- /dev/null
+++ b/examples/nfc/corkboard/corkboard.pro
@@ -0,0 +1,14 @@
+QT += quick nfc
+
+SOURCES += \
+ main.cpp
+
+TARGET = qml_corkboard
+TEMPLATE = app
+
+RESOURCES += \
+ corkboard.qrc
+
+OTHER_FILES += \
+ corkboards.qml \
+ Mode.qml
diff --git a/examples/nfc/corkboard/corkboard.qrc b/examples/nfc/corkboard/corkboard.qrc
new file mode 100644
index 00000000..10d80ce3
--- /dev/null
+++ b/examples/nfc/corkboard/corkboard.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>corkboards.qml</file>
+ <file>NfcFlag.png</file>
+ <file>tack.png</file>
+ <file>note-yellow.png</file>
+ <file>cork.jpg</file>
+ <file>Mode.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/nfc/corkboard/corkboards.qml b/examples/nfc/corkboard/corkboards.qml
new file mode 100644
index 00000000..55c83723
--- /dev/null
+++ b/examples/nfc/corkboard/corkboards.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtNfc module.
+**
+** $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.1
+import QtNfc 5.2
+
+Rectangle {
+ width: 800; height: 480
+ color: "black"
+
+ NearField {
+ orderMatch: false
+
+ onMessageRecordsChanged: {
+ list.get(listView.currentIndex).notes.append({"noteText":messageRecords[0].text})
+ }
+ }
+
+ ListModel {
+ id: list
+
+ ListElement {
+ name: "Personal"
+ notes: [
+ ListElement { noteText: "https://developer.blackberry.com" },
+ ListElement { noteText: "Near Field Communication" },
+ ListElement { noteText: "Touch a tag and its contents will appear as a new note" }
+ ]
+ }
+
+ ListElement {
+ name: "Work"
+ notes: [
+ //ListElement { noteText: "To write a tag, click the red flag of a note and then touch a tag" },
+ ListElement { noteText: "https://developer.blackberry.com/native/documentation/core/com.qnx.doc.nfc/topic/manual/c_stub_nfcdevguide_general_introduction.html" }
+ ]
+ }
+ }
+
+ ListView {
+ id: listView
+
+ anchors.fill: parent
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapOneItem
+ model: list
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ delegate: Mode {}
+ }
+}
diff --git a/examples/nfc/corkboard/doc/images/corkboard.png b/examples/nfc/corkboard/doc/images/corkboard.png
new file mode 100644
index 00000000..3f54ea18
--- /dev/null
+++ b/examples/nfc/corkboard/doc/images/corkboard.png
Binary files differ
diff --git a/examples/nfc/corkboard/doc/src/corkboard.qdoc b/examples/nfc/corkboard/doc/src/corkboard.qdoc
new file mode 100644
index 00000000..4027fc26
--- /dev/null
+++ b/examples/nfc/corkboard/doc/src/corkboard.qdoc
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtNfc 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 corkboard
+\title QML CorkBoard Example
+
+The QML CorkBoard example displays the contents of NDEF messages read from an
+NFC Tag. Each newly detected NDEF message is added to the corkboard and can be
+dragged into an arbitrary position on the board. The corkboard has a "Personal"
+and "Work" space. The workspace can be changed by sliding left or right.
+
+\image corkboard.png
+
+*/
diff --git a/examples/nfc/corkboard/icon.png b/examples/nfc/corkboard/icon.png
new file mode 100644
index 00000000..b115f836
--- /dev/null
+++ b/examples/nfc/corkboard/icon.png
Binary files differ
diff --git a/examples/nfc/corkboard/main.cpp b/examples/nfc/corkboard/main.cpp
new file mode 100644
index 00000000..044c083f
--- /dev/null
+++ b/examples/nfc/corkboard/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtNfc module.
+**
+** $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 <QtGui/QGuiApplication>
+#include <QtQml/QQmlEngine>
+#include <QtQuick/QQuickView>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication application(argc, argv);
+ QQuickView view;
+ view.setSource(QUrl("qrc:/corkboards.qml"));
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.show();
+ return application.exec();
+}
diff --git a/examples/nfc/corkboard/note-yellow.png b/examples/nfc/corkboard/note-yellow.png
new file mode 100644
index 00000000..8ddecc8b
--- /dev/null
+++ b/examples/nfc/corkboard/note-yellow.png
Binary files differ
diff --git a/examples/nfc/corkboard/tack.png b/examples/nfc/corkboard/tack.png
new file mode 100644
index 00000000..cef2d1cd
--- /dev/null
+++ b/examples/nfc/corkboard/tack.png
Binary files differ
diff --git a/examples/nfc/ndefeditor/ndefeditor.pro b/examples/nfc/ndefeditor/ndefeditor.pro
index 47971fdb..43ab47fa 100644
--- a/examples/nfc/ndefeditor/ndefeditor.pro
+++ b/examples/nfc/ndefeditor/ndefeditor.pro
@@ -21,3 +21,6 @@ FORMS += \
textrecordeditor.ui \
urirecordeditor.ui \
mimeimagerecordeditor.ui
+
+target.path = $$[QT_INSTALL_EXAMPLES]/nfc/ndefeditor
+INSTALLS += target
diff --git a/examples/nfc/nfc.pro b/examples/nfc/nfc.pro
index ddf7456b..e4f7e35b 100644
--- a/examples/nfc/nfc.pro
+++ b/examples/nfc/nfc.pro
@@ -5,3 +5,5 @@ qtHaveModule(widgets) {
ndefeditor \
poster
}
+
+qtHaveModule(quick): SUBDIRS += corkboard
diff --git a/examples/nfc/poster/poster.pro b/examples/nfc/poster/poster.pro
index d108b2a2..47de2986 100644
--- a/examples/nfc/poster/poster.pro
+++ b/examples/nfc/poster/poster.pro
@@ -11,3 +11,6 @@ RESOURCES += \
OTHER_FILES += \
poster.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/nfc/poster
+INSTALLS += target