aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/demos/calqlatr
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2012-11-29 16:02:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-10 18:16:48 +0100
commita6065d60f158ffad7a94877883af69731da94295 (patch)
tree5657fd490fd8a3f9794a8c9bcc9f85cf24a095c1 /examples/quick/demos/calqlatr
parentc18e04b2e61f174a4883f6884cf9a0712c5725e3 (diff)
centralize and fixup example sources install targets
follow respective change in qtbase Change-Id: I27502eb7ebea973e19ec5f7c3ec0e2338556f6e0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'examples/quick/demos/calqlatr')
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.pro9
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.qml110
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.qmlproject16
-rw-r--r--examples/quick/demos/calqlatr/content/Button.qml80
-rw-r--r--examples/quick/demos/calqlatr/content/Display.qml124
-rw-r--r--examples/quick/demos/calqlatr/content/NumberPad.qml69
-rw-r--r--examples/quick/demos/calqlatr/content/StyleLabel.qml50
-rw-r--r--examples/quick/demos/calqlatr/content/audio/touch.wavbin0 -> 950 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/calculator.js143
-rw-r--r--examples/quick/demos/calqlatr/content/images/icon-back.pngbin0 -> 328 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/icon-close.pngbin0 -> 488 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/icon-settings.pngbin0 -> 503 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/logo.pngbin0 -> 5950 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/paper-edge-left.pngbin0 -> 12401 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/paper-edge-right.pngbin0 -> 12967 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/paper-grip.pngbin0 -> 298 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/settings-selected-a.pngbin0 -> 2326 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/settings-selected-b.pngbin0 -> 2334 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/touch-green.pngbin0 -> 4808 bytes
-rw-r--r--examples/quick/demos/calqlatr/content/images/touch-white.pngbin0 -> 4601 bytes
-rw-r--r--examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.pngbin0 -> 37120 bytes
-rw-r--r--examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc39
-rw-r--r--examples/quick/demos/calqlatr/main.cpp41
23 files changed, 681 insertions, 0 deletions
diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro
new file mode 100644
index 0000000000..fec0d6416b
--- /dev/null
+++ b/examples/quick/demos/calqlatr/calqlatr.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+
+QT += qml quick
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr
+qml.files = calqlatr.qml content
+qml.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr
+INSTALLS += target qml
diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml
new file mode 100644
index 0000000000..7640fbd738
--- /dev/null
+++ b/examples/quick/demos/calqlatr/calqlatr.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+import "content/calculator.js" as CalcEngine
+
+
+Rectangle {
+ id: window
+ width: 320
+ height: 480
+ focus: true
+ color: "#272822"
+
+ onWidthChanged: controller.reload()
+
+ function operatorPressed(operator) { CalcEngine.operatorPressed(operator) }
+ function digitPressed(digit) { CalcEngine.digitPressed(digit) }
+
+ Item {
+ id: pad
+ width: window.width * 0.58
+ NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+
+ AnimationController {
+ id: controller
+ animation: ParallelAnimation {
+ id: anim
+ NumberAnimation { target: display; property: "x"; duration: 400; from: -16; to: window.width - display.width; easing.type: Easing.InOutQuad }
+ NumberAnimation { target: pad; property: "x"; duration: 400; from: window.width - pad.width; to: 0; easing.type: Easing.InOutQuad }
+ SequentialAnimation {
+ NumberAnimation { target: pad; property: "scale"; duration: 200; from: 1; to: 0.97; easing.type: Easing.InOutQuad }
+ NumberAnimation { target: pad; property: "scale"; duration: 200; from: 0.97; to: 1; easing.type: Easing.InOutQuad }
+ }
+ }
+ }
+
+ Display {
+ id: display
+ x: -16
+ width: window.width * 0.42
+ height: parent.height
+
+ MouseArea {
+ property real startX: 0
+ property real oldP: 0
+ property bool rewind: false
+
+ anchors.fill: parent
+ onPositionChanged: {
+ var reverse = startX > window.width / 2
+ var mx = mapToItem(window, mouse.x).x
+ var p = Math.abs((mx - startX) / (window.width - display.width))
+ if (p < oldP)
+ rewind = reverse ? false : true
+ else
+ rewind = reverse ? true : false
+ controller.progress = reverse ? 1 - p : p
+ oldP = p
+ }
+ onPressed: startX = mapToItem(window, mouse.x).x
+ onReleased: {
+ if (rewind)
+ controller.completeToBeginning()
+ else
+ controller.completeToEnd()
+ }
+ }
+ }
+
+}
diff --git a/examples/quick/demos/calqlatr/calqlatr.qmlproject b/examples/quick/demos/calqlatr/calqlatr.qmlproject
new file mode 100644
index 0000000000..ce2d59d310
--- /dev/null
+++ b/examples/quick/demos/calqlatr/calqlatr.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "calqlatr.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/demos/calqlatr/content/Button.qml b/examples/quick/demos/calqlatr/content/Button.qml
new file mode 100644
index 0000000000..c355c2d105
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/Button.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property alias text: textItem.text
+ property alias color: textItem.color
+
+ property bool operator: false
+
+ signal clicked
+
+ width: 30
+ height: 50
+
+ Text {
+ id: textItem
+ font.pixelSize: 48
+ wrapMode: Text.WordWrap
+ lineHeight: 0.75
+ color: "white"
+ }
+
+// Rectangle {
+// color: "red"
+// opacity: 0.2
+// anchors.fill: mouse
+// }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ anchors.margins: -5
+ onClicked: {
+ //parent.clicked()
+ if (operator)
+ window.operatorPressed(parent.text)
+ else
+ window.digitPressed(parent.text)
+ }
+ }
+}
diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml
new file mode 100644
index 0000000000..3c1d9c0cd5
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/Display.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: display
+
+ function displayOperator(operator)
+ {
+ listView.model.append({ "operator": operator, "operand": "" })
+ }
+
+ function newLine(operator, operand)
+ {
+ listView.model.append({ "operator": operator, "operand": operand })
+ }
+
+ function appendDigit(digit)
+ {
+ if (!listView.model.count)
+ listView.model.append({ "operator": "", "operand": "" })
+ var i = listView.model.count - 1;
+ listView.model.get(i).operand = listView.model.get(i).operand + digit;
+ }
+
+ Item {
+ id: theItem
+ width: parent.width + 32
+ height: parent.height
+
+ Rectangle {
+ id: rect
+ x: 16
+ color: "white"
+ height: parent.height
+ width: display.width - 16
+ }
+ Image {
+ anchors.right: rect.left
+ source: "images/paper-edge-left.png"
+ height: parent.height
+ fillMode: Image.TileVertically
+ }
+ Image {
+ anchors.left: rect.right
+ source: "images/paper-edge-right.png"
+ height: parent.height
+ fillMode: Image.TileVertically
+ }
+
+ Image {
+ source: "images/paper-grip.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20
+ }
+
+ ListView {
+ id: listView
+ x: 16; y: 30
+ width: display.width
+ height: display.height
+ delegate: Item {
+ height: 20
+ width: parent.width
+ Text {
+ id: operator
+ x: 8
+ font.pixelSize: 18
+ color: "#6da43d"
+ text: model.operator
+ }
+ Text {
+ id: operand
+ font.pixelSize: 18
+ anchors.right: parent.right
+ anchors.rightMargin: 26
+ text: model.operand
+ }
+ }
+ model: ListModel { }
+ }
+
+ }
+
+}
diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml
new file mode 100644
index 0000000000..853c7631c9
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/NumberPad.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Grid {
+ columns: 3
+ columnSpacing: 32
+ rowSpacing: 16
+
+ Button { text: "7" }
+ Button { text: "8" }
+ Button { text: "9" }
+ Button { text: "4" }
+ Button { text: "5" }
+ Button { text: "6" }
+ Button { text: "1" }
+ Button { text: "2" }
+ Button { text: "3" }
+ Button { text: "0" }
+ Button { text: "." }
+ Button { text: " " }
+ Button { text: "±"; color: "#6da43d"; operator: true }
+ Button { text: "−"; color: "#6da43d"; operator: true }
+ Button { text: "+"; color: "#6da43d"; operator: true }
+ Button { text: " "; color: "#6da43d"; operator: true }
+ Button { text: "÷"; color: "#6da43d"; operator: true }
+ Button { text: "×"; color: "#6da43d"; operator: true }
+ Button { text: "C"; color: "#6da43d"; operator: true }
+ Button { text: " "; color: "#6da43d"; operator: true }
+ Button { text: "="; color: "#6da43d"; operator: true }
+}
diff --git a/examples/quick/demos/calqlatr/content/StyleLabel.qml b/examples/quick/demos/calqlatr/content/StyleLabel.qml
new file mode 100644
index 0000000000..3bdea86129
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/StyleLabel.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Text {
+ width: 64
+ font.pixelSize: 14
+ font.bold: false
+ wrapMode: Text.WordWrap
+ lineHeight: 0.75
+ color: "#676764"
+}
diff --git a/examples/quick/demos/calqlatr/content/audio/touch.wav b/examples/quick/demos/calqlatr/content/audio/touch.wav
new file mode 100644
index 0000000000..94cccb7546
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/audio/touch.wav
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js
new file mode 100644
index 0000000000..843ef39c02
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/calculator.js
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+
+var curVal = 0
+var memory = 0
+var lastOp = ""
+var previousOperator = ""
+var digits = ""
+
+function disabled(op) {
+ if (op == "." && digits.toString().search(/\./) != -1) {
+ return true
+ } else if (op == window.squareRoot && digits.toString().search(/-/) != -1) {
+ return true
+ } else {
+ return false
+ }
+}
+
+function digitPressed(op)
+{
+ if (disabled(op))
+ return
+ if (digits.toString().length >= 14)
+ return
+ if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) {
+ digits = digits + op.toString()
+ display.appendDigit(op.toString())
+ } else {
+ digits = op
+ display.appendDigit(op.toString())
+ }
+ lastOp = op
+}
+
+function operatorPressed(op)
+{
+ if (disabled(op))
+ return
+ lastOp = op
+
+ if (previousOperator == "+") {
+ digits = Number(digits.valueOf()) + Number(curVal.valueOf())
+ } else if (previousOperator == "−") {
+ digits = Number(curVal) - Number(digits.valueOf())
+ } else if (previousOperator == "×") {
+ digits = Number(curVal) * Number(digits.valueOf())
+ } else if (previousOperator == "÷") {
+ digits = Number(Number(curVal) / Number(digits.valueOf())).toString()
+ } else if (previousOperator == "=") {
+ }
+
+ if (op == "+" || op == "−" || op == "×" || op == "÷") {
+ previousOperator = op
+ curVal = digits.valueOf()
+ display.displayOperator(previousOperator)
+ return
+ }
+
+ if (op == "=") {
+ display.newLine("=", digits.toString())
+ }
+
+ curVal = 0
+ previousOperator = ""
+
+ if (op == "1/x") {
+ digits = (1 / digits.valueOf()).toString()
+ } else if (op == "x^2") {
+ digits = (digits.valueOf() * digits.valueOf()).toString()
+ } else if (op == "Abs") {
+ digits = (Math.abs(digits.valueOf())).toString()
+ } else if (op == "Int") {
+ digits = (Math.floor(digits.valueOf())).toString()
+ } else if (op == window.plusminus) {
+ digits = (digits.valueOf() * -1).toString()
+ } else if (op == window.squareRoot) {
+ digits = (Math.sqrt(digits.valueOf())).toString()
+ } else if (op == "mc") {
+ memory = 0;
+ } else if (op == "m+") {
+ memory += digits.valueOf()
+ } else if (op == "mr") {
+ digits = memory.toString()
+ } else if (op == "m-") {
+ memory = digits.valueOf()
+ } else if (op == window.leftArrow) {
+ digits = digits.toString().slice(0, -1)
+ if (digits.length == 0) {
+ digits = "0"
+ }
+ } else if (op == "Off") {
+ Qt.quit();
+ } else if (op == "C") {
+ digits = "0"
+ } else if (op == "AC") {
+ curVal = 0
+ memory = 0
+ lastOp = ""
+ digits ="0"
+ }
+
+
+}
+
diff --git a/examples/quick/demos/calqlatr/content/images/icon-back.png b/examples/quick/demos/calqlatr/content/images/icon-back.png
new file mode 100644
index 0000000000..2989ee2e35
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/icon-back.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/icon-close.png b/examples/quick/demos/calqlatr/content/images/icon-close.png
new file mode 100644
index 0000000000..3e21248232
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/icon-close.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/icon-settings.png b/examples/quick/demos/calqlatr/content/images/icon-settings.png
new file mode 100644
index 0000000000..98e662f53f
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/icon-settings.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/logo.png b/examples/quick/demos/calqlatr/content/images/logo.png
new file mode 100644
index 0000000000..6bc65610bc
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/logo.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/paper-edge-left.png b/examples/quick/demos/calqlatr/content/images/paper-edge-left.png
new file mode 100644
index 0000000000..ca29a3ae10
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/paper-edge-left.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/paper-edge-right.png b/examples/quick/demos/calqlatr/content/images/paper-edge-right.png
new file mode 100644
index 0000000000..7c2da7b930
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/paper-edge-right.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/paper-grip.png b/examples/quick/demos/calqlatr/content/images/paper-grip.png
new file mode 100644
index 0000000000..953c408bca
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/paper-grip.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/settings-selected-a.png b/examples/quick/demos/calqlatr/content/images/settings-selected-a.png
new file mode 100644
index 0000000000..e08ddface8
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/settings-selected-a.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/settings-selected-b.png b/examples/quick/demos/calqlatr/content/images/settings-selected-b.png
new file mode 100644
index 0000000000..d9aa7e3431
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/settings-selected-b.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/touch-green.png b/examples/quick/demos/calqlatr/content/images/touch-green.png
new file mode 100644
index 0000000000..64dbde66b1
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/touch-green.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/content/images/touch-white.png b/examples/quick/demos/calqlatr/content/images/touch-white.png
new file mode 100644
index 0000000000..bb02b000cf
--- /dev/null
+++ b/examples/quick/demos/calqlatr/content/images/touch-white.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png b/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png
new file mode 100644
index 0000000000..af67f63dd1
--- /dev/null
+++ b/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc
new file mode 100644
index 0000000000..366f01ea2c
--- /dev/null
+++ b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and 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$
+**
+****************************************************************************/
+
+/*!
+ \title QML Demo - Calqlatr
+ \example demos/calqlatr
+ \brief This is an example calculator written in QML.
+ \image qml-calqlatr-demo-small.png
+ \ingroup qmldemos
+
+ This demo implements a simple calculator app, designed for portrait devices.
+
+ This app has the logic implemented in Javascipt and the appearance implemented in QML.
+*/
+
diff --git a/examples/quick/demos/calqlatr/main.cpp b/examples/quick/demos/calqlatr/main.cpp
new file mode 100644
index 0000000000..9000bfc7d7
--- /dev/null
+++ b/examples/quick/demos/calqlatr/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples 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 "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(calqlatr)