summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKimmo Ollila <kimmo.ollila@digia.com>2013-04-02 14:27:48 +0300
committerKimmo Ollila <kimmo.ollila@digia.com>2013-04-02 14:32:50 +0300
commitcf415963c09c6e2fc40ec38a0afa8b4958cdc14d (patch)
treeedd5361b2070ac7f03d49100714b4b7c4aca550c
parentad10a3639e4704c909874ccc8fac3d68b15035b1 (diff)
Added Qt logo and 2 sample demos to the scene
Change-Id: I29a69a97d5fc46910c78ee844c2e4a4a34478865 Reviewed-by: Kimmo Ollila <kimmo.ollila@digia.com>
-rw-r--r--QtDemo/qml/QtDemo/QtLogo.svg35
-rw-r--r--QtDemo/qml/QtDemo/Slide.qml58
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/Calqlatr.qml110
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/Button.qml80
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/Display.qml124
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/NumberPad.qml69
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/StyleLabel.qml50
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/audio/touch.wavbin0 -> 950 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/calculator.js143
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-back.pngbin0 -> 328 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-close.pngbin0 -> 488 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-settings.pngbin0 -> 503 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/logo.pngbin0 -> 5950 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-left.pngbin0 -> 12401 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-right.pngbin0 -> 12967 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-grip.pngbin0 -> 298 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-a.pngbin0 -> 2326 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-b.pngbin0 -> 2334 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-green.pngbin0 -> 4808 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-white.pngbin0 -> 4601 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml173
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml98
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml154
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/ListHeader.qml81
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/SearchDelegate.qml121
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetDelegate.qml189
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetsModel.qml91
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/anonymous.pngbin0 -> 1788 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/bird-anim-sprites.pngbin0 -> 11079 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.pngbin0 -> 1166 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.pngbin0 -> 1542 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.pngbin0 -> 1202 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.pngbin0 -> 1284 bytes
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js19
-rw-r--r--QtDemo/qml/QtDemo/demos/tweetsearch/tweetsearch.qml130
-rw-r--r--QtDemo/qml/QtDemo/engine.js62
-rw-r--r--QtDemo/qml/QtDemo/main.qml194
37 files changed, 1880 insertions, 101 deletions
diff --git a/QtDemo/qml/QtDemo/QtLogo.svg b/QtDemo/qml/QtDemo/QtLogo.svg
new file mode 100644
index 0000000..d0f7957
--- /dev/null
+++ b/QtDemo/qml/QtDemo/QtLogo.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<!-- Created with Inkscape (http://www.inkscape.org/) by Marsupilami -->
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0"
+ width="644"
+ height="768"
+ viewBox="-1.94121003 -1.94121003 68.58942106 81.73774406"
+ id="svg4095">
+ <defs
+ id="defs4097" />
+ <g
+ transform="translate(-173.36079,-579.1488)"
+ id="layer1">
+ <path
+ d="M 189.35054,579.28163 C 188.55516,579.15038 187.77492,579.11913 187.02091,579.17663 L 187.01954,579.17663 C 187.01954,579.17663 181.86766,579.52663 181.63329,579.54538 C 176.93066,579.92163 173.36079,583.78788 173.36079,589.12788 L 173.36079,652.09413 L 178.62691,657.00413 L 231.54979,648.10913 C 235.19191,647.47663 238.06779,643.18163 238.06779,638.54288 L 238.06779,587.26788 L 189.35054,579.28163"
+ id="path2464"
+ style="fill:#006325;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 238.06779,638.54413 C 238.06779,643.18163 235.19191,647.47663 231.54979,648.10913 L 178.62691,657.00413 L 178.62691,588.79413 C 178.62691,582.59038 183.57817,578.33038 189.35054,579.28163 L 238.06779,587.26788 L 238.06779,638.54413"
+ id="path2466"
+ style="fill:#80c341;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 201.42966,593.55413 C 197.65866,593.55413 194.67179,594.99788 192.52341,597.99163 C 189.97841,601.54038 188.67966,607.16038 188.67966,614.74163 C 188.67966,621.77413 189.60342,627.12788 191.46091,630.80413 C 193.29091,634.42163 195.94529,636.58163 199.33591,637.30413 C 200.07367,640.88163 201.21291,643.30038 202.77341,644.55413 C 203.95267,645.50413 205.52341,645.99163 207.46091,645.99163 C 208.04642,645.99163 208.68354,645.95163 209.33591,645.86663 L 211.55466,645.55413 L 211.55466,640.71038 C 211.21329,640.74913 210.88529,640.74163 210.58591,640.74163 C 209.55079,640.74163 208.77529,640.53538 208.27341,640.08538 C 207.62642,639.49913 207.12591,638.39288 206.80466,636.74163 C 209.99316,635.65038 212.34029,633.28163 213.86716,629.67913 C 215.36766,626.12663 216.11717,621.32788 216.11716,615.21038 C 216.11716,608.53163 215.10979,603.44538 213.05466,599.89788 C 210.96191,596.27038 207.74066,594.15913 203.30466,593.64788 C 202.66154,593.57163 202.03316,593.55413 201.42966,593.55413 z M 221.77341,596.17913 L 219.99216,603.71038 L 217.17966,603.52288 L 217.17966,608.55413 L 219.49216,608.67913 L 219.49216,627.74163 C 219.49216,630.23663 219.97992,632.04663 220.99216,633.17913 C 221.86079,634.15663 223.14166,634.64788 224.80466,634.64788 C 225.05329,634.64788 225.31979,634.63663 225.58591,634.61663 C 227.42241,634.45913 229.27341,633.95288 231.17966,633.11663 L 231.17966,628.77288 C 230.05804,629.28413 229.03267,629.59288 228.08591,629.64788 C 228.02441,629.65163 227.95803,629.64788 227.89841,629.64788 C 227.28028,629.64788 226.8218,629.45038 226.52341,629.05413 C 226.19241,628.62163 226.02341,627.67538 226.02341,626.17913 L 226.02341,608.96038 L 230.83591,609.17913 L 230.83591,604.49163 L 226.02341,604.14788 L 226.02341,596.64788 L 221.77341,596.17913 z M 202.89841,599.27288 C 203.02591,599.27288 203.17129,599.29288 203.30466,599.30413 C 205.04392,599.45663 206.34379,600.66163 207.21091,602.89788 C 208.07767,605.12288 208.49217,609.15788 208.49216,615.05413 C 208.49216,621.62413 208.05266,626.02913 207.17966,628.27288 C 206.30079,630.53913 205.02441,631.72663 203.30466,631.83538 C 203.22704,631.84038 203.13079,631.86663 203.05466,631.86663 C 201.33741,631.86663 200.05329,630.62413 199.17966,628.14788 C 198.25342,625.54788 197.77341,621.13913 197.77341,614.89788 C 197.77341,608.44038 198.24467,604.17538 199.17966,602.11663 C 200.04291,600.22788 201.28666,599.27288 202.89841,599.27288 z"
+ id="path2468"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 199.04829,593.55505 C 195.28166,593.55755 192.28854,595.0013 190.14204,597.99255 C 187.59653,601.5413 186.32954,607.1613 186.32954,614.74255 C 186.32955,621.77505 187.25329,627.1288 189.11079,630.80505 C 190.9413,634.42255 193.59567,636.58255 196.98579,637.30505 C 197.72354,640.88255 198.8628,643.3013 200.42329,644.55505 C 201.60253,645.50505 203.17329,645.99255 205.11079,645.99255 C 205.14741,645.99255 205.19967,645.9938 205.23579,645.99255 L 207.29829,645.99255 C 206.03316,645.97255 204.92242,645.7388 203.98579,645.30505 C 203.94328,645.2863 203.90229,645.26255 203.86079,645.24255 C 203.85691,645.24005 203.83405,645.24505 203.82954,645.24255 C 203.79153,645.2238 203.77342,645.20005 203.73579,645.18005 C 203.72854,645.1763 203.71229,645.1838 203.70454,645.18005 C 203.67028,645.1613 203.64454,645.1363 203.61079,645.11755 C 203.60003,645.1113 203.59029,645.09255 203.57954,645.0863 C 203.54928,645.07005 203.51554,645.07255 203.48579,645.05505 C 203.47116,645.04755 203.43742,645.03255 203.42329,645.0238 C 203.39691,645.0088 203.38717,644.97755 203.36079,644.9613 C 203.34316,644.9513 203.31542,644.9413 203.29829,644.93005 C 203.27528,644.91505 203.25779,644.91255 203.23579,644.8988 C 203.21429,644.88505 203.1943,644.8813 203.17329,644.86755 C 203.15516,644.85505 203.12942,644.81755 203.11079,644.80505 C 203.08641,644.7888 203.07279,644.79005 203.04829,644.7738 C 203.03416,644.76255 203.03129,644.7538 203.01704,644.74255 C 202.98879,644.72255 202.95155,644.7013 202.92329,644.68005 C 202.91391,644.67255 202.90179,644.6563 202.89204,644.6488 C 202.85491,644.62005 202.80367,644.58505 202.76704,644.55505 C 201.20653,643.3013 200.0673,640.88255 199.32954,637.30505 C 195.93891,636.58255 193.28454,634.42255 191.45454,630.80505 C 189.59704,627.1288 188.67329,621.77505 188.67329,614.74255 C 188.67329,607.1613 189.97204,601.5413 192.51704,597.99255 C 194.66541,594.9988 197.65229,593.55505 201.42329,593.55505 C 201.43553,593.55505 199.04829,593.55505 199.04829,593.55505 z M 219.51704,596.18005 L 217.79829,603.55505 L 219.98579,603.7113 L 221.76704,596.18005 L 219.51704,596.18005 z M 202.89204,599.2738 C 202.48678,599.2738 202.12542,599.3413 201.76704,599.4613 C 203.10341,599.8763 204.10342,601.02505 204.82954,602.8988 C 205.69679,605.1238 206.14204,609.1588 206.14204,615.05505 C 206.14204,621.62505 205.70254,626.03005 204.82954,628.2738 C 204.12691,630.08505 203.16154,631.21505 201.92329,631.6488 C 202.28116,631.7838 202.64542,631.86755 203.04829,631.86755 C 203.12441,631.86755 203.22067,631.8413 203.29829,631.8363 C 205.01803,631.72755 206.29442,630.54005 207.17329,628.2738 C 208.04628,626.03005 208.48579,621.62505 208.48579,615.05505 C 208.48579,609.1588 208.0713,605.1238 207.20454,602.8988 C 206.33741,600.66255 205.03755,599.45755 203.29829,599.30505 C 203.16491,599.2938 203.01954,599.2738 202.89204,599.2738 z M 214.92329,603.5238 L 214.92329,604.6488 C 215.24554,605.86255 215.51704,607.1663 215.70454,608.5863 L 217.23579,608.68005 L 217.23579,627.74255 C 217.23579,630.23755 217.75529,632.04755 218.76704,633.18005 C 219.63566,634.15755 220.91692,634.6488 222.57954,634.6488 L 224.79829,634.6488 C 223.13528,634.6488 221.85442,634.15755 220.98579,633.18005 C 219.97354,632.04755 219.48579,630.23755 219.48579,627.74255 L 219.48579,608.68005 L 217.17329,608.55505 L 217.17329,603.5238 L 214.92329,603.5238 z M 226.04829,608.9613 L 226.04829,609.0863 L 228.61079,609.18005 L 230.86079,609.18005 L 226.04829,608.9613 z M 228.95454,628.7738 C 228.27878,629.0813 227.65866,629.31755 227.04829,629.4613 C 227.29341,629.58255 227.58054,629.6488 227.92329,629.6488 C 227.98291,629.6488 228.04928,629.65255 228.11079,629.6488 C 229.05754,629.5938 230.08292,629.28505 231.20454,628.7738 L 228.95454,628.7738 z M 209.73579,640.68005 C 209.98579,640.7188 210.28453,640.74255 210.57954,640.74255 C 210.87877,640.74255 211.20704,640.7188 211.54829,640.68005 L 209.73579,640.68005 z"
+ id="path2470"
+ style="fill:#006325;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+</svg>
+<!-- version: 20080810, original size: 64.707001 77.855324, border: 3% -->
diff --git a/QtDemo/qml/QtDemo/Slide.qml b/QtDemo/qml/QtDemo/Slide.qml
index 9a3e565..7ad07df 100644
--- a/QtDemo/qml/QtDemo/Slide.qml
+++ b/QtDemo/qml/QtDemo/Slide.qml
@@ -3,18 +3,58 @@ import QtQuick 2.0
Rectangle {
id: slide
objectName: "slide"
- width: 640
- height: 480
- color: "grey"
- border {color: "#333333"; width:3}
+ width: 1280
+ height: 800
+ color: "transparent"
+ border {color: borderColor; width:3}
property int uid: 0
+ property color borderColor: "black"
+ property string url: ""
+ property bool loaded: false
- Text{
+ Rectangle{
+ id: demoContainer
anchors.centerIn: parent
- text: "^This side up^"
- font.pixelSize: 60
- color: "white"
+ width: 320
+ height: 480
+ color: "black"
+ clip: true
+ }
+
+ function loadDemo(){
+ if (!slide.url || slide.loaded) return;
+
+ slide.loaded = true
+ var component = Qt.createComponent(slide.url);
+ var incubator = component.incubateObject(demoContainer, {
+ x: 0,
+ y: 0,
+ objectName: "demoApp"
+ });
+ // if (incubator.status !== Component.Ready) {
+ // incubator.onStatusChanged = function(status) {
+ // if (status === Component.Ready) {
+ // print ("Object", incubator.object, "is now ready!");
+ // }
+ // }
+ // } else {
+ // print ("Object", incubator.object, "is ready immediately!");
+ // }
+ }
+
+ function releaseDemo(){
+ if (!slide.loaded) return;
+ slide.loaded = false;
+
+ for (var i =0; i<demoContainer.children.length; i++){
+ if (demoContainer.children[i].objectName === "demoApp"){
+ demoContainer.children[i].destroy();
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ print ("new slide created!")
}
- Component.onCompleted: print ("new slide created!")
}
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/Calqlatr.qml b/QtDemo/qml/QtDemo/demos/calqlatr/Calqlatr.qml
new file mode 100644
index 0000000..7640fbd
--- /dev/null
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/calqlatr/content/Button.qml b/QtDemo/qml/QtDemo/demos/calqlatr/content/Button.qml
new file mode 100644
index 0000000..c355c2d
--- /dev/null
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/calqlatr/content/Display.qml b/QtDemo/qml/QtDemo/demos/calqlatr/content/Display.qml
new file mode 100644
index 0000000..3c1d9c0
--- /dev/null
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/calqlatr/content/NumberPad.qml b/QtDemo/qml/QtDemo/demos/calqlatr/content/NumberPad.qml
new file mode 100644
index 0000000..853c763
--- /dev/null
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/calqlatr/content/StyleLabel.qml b/QtDemo/qml/QtDemo/demos/calqlatr/content/StyleLabel.qml
new file mode 100644
index 0000000..3bdea86
--- /dev/null
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/calqlatr/content/audio/touch.wav b/QtDemo/qml/QtDemo/demos/calqlatr/content/audio/touch.wav
new file mode 100644
index 0000000..94cccb7
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/audio/touch.wav
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/calculator.js b/QtDemo/qml/QtDemo/demos/calqlatr/content/calculator.js
new file mode 100644
index 0000000..843ef39
--- /dev/null
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-back.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-back.png
new file mode 100644
index 0000000..2989ee2
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-back.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-close.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-close.png
new file mode 100644
index 0000000..3e21248
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-close.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-settings.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-settings.png
new file mode 100644
index 0000000..98e662f
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/icon-settings.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/logo.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/logo.png
new file mode 100644
index 0000000..6bc6561
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/logo.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-left.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-left.png
new file mode 100644
index 0000000..ca29a3a
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-left.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-right.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-right.png
new file mode 100644
index 0000000..7c2da7b
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-edge-right.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-grip.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-grip.png
new file mode 100644
index 0000000..953c408
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/paper-grip.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-a.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-a.png
new file mode 100644
index 0000000..e08ddfa
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-a.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-b.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-b.png
new file mode 100644
index 0000000..d9aa7e3
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/settings-selected-b.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-green.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-green.png
new file mode 100644
index 0000000..64dbde6
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-green.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-white.png b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-white.png
new file mode 100644
index 0000000..bb02b00
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/calqlatr/content/images/touch-white.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml
new file mode 100644
index 0000000..4b6cd48
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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: container
+ property int animDuration: 300
+ property Item front: Item {}
+ property Item back: Item {}
+ property real factor: 0.1 // amount the edges fold in for the 3D effect
+ property alias delta: effect.delta
+ property Item cur: frontShown ? front : back
+ property Item noncur: frontShown ? back : front
+
+ function swap() {
+ var tmp = front;
+ front = back;
+ back = tmp;
+ resync();
+ }
+
+ width: cur.width
+ height: cur.height
+ onFrontChanged: resync();
+ onBackChanged: resync();
+
+ function resync() {//TODO: Are the items ever actually visible?
+ back.parent = container;
+ front.parent = container;
+ frontShown ? back.visible = false : front.visible = false;
+ }
+
+ property bool frontShown: true
+
+ onFrontShownChanged: {
+ back.visible = !frontShown
+ front.visible = frontShown
+ }
+
+ function flipUp(start) {
+ effect.visible = true;
+ effect.sourceA = effect.source1
+ effect.sourceB = effect.source2
+ if (start == undefined)
+ start = 1.0;
+ deltaAnim.from = start;
+ deltaAnim.to = 0.0
+ dAnim.start();
+ frontShown = false;
+ }
+
+ function flipDown(start) {
+ effect.visible = true;
+ effect.sourceA = effect.source1
+ effect.sourceB = effect.source2
+ if (start == undefined)
+ start = 0.0;
+ deltaAnim.from = start;
+ deltaAnim.to = 1.0
+ dAnim.start();
+ frontShown = true;
+ }
+
+ ShaderEffect {
+ id: effect
+ width: cur.width
+ height: cur.height
+ property real factor: container.factor * width
+ property real delta: 1.0
+
+ mesh: GridMesh { resolution: Qt.size(8,2) }
+
+ SequentialAnimation on delta {
+ id: dAnim
+ running: false
+ NumberAnimation {
+ id: deltaAnim
+ duration: animDuration//expose anim
+ }
+ }
+
+ property variant sourceA: source1
+ property variant sourceB: source1
+ property variant source1: ShaderEffectSource {
+ sourceItem: front
+ hideSource: effect.visible
+ }
+
+ property variant source2: ShaderEffectSource {
+ sourceItem: back
+ hideSource: effect.visible
+ }
+
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D sourceA;
+ uniform sampler2D sourceB;
+ uniform highp float delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 tex = vec4(qt_TexCoord0.x, qt_TexCoord0.y * 2.0, qt_TexCoord0.x, (qt_TexCoord0.y-0.5) * 2.0);
+ highp float shade = clamp(delta*2.0, 0.5, 1.0);
+ highp vec4 col;
+ if (qt_TexCoord0.y < 0.5) {
+ col = texture2D(sourceA, tex.xy) * (shade);
+ } else {
+ col = texture2D(sourceB, tex.zw) * (1.5 - shade);
+ col.w = 1.0;
+ }
+ gl_FragColor = col * qt_Opacity;
+ }
+ "
+ property real h: height
+ vertexShader: "
+ uniform highp float delta;
+ uniform highp float factor;
+ uniform highp float h;
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ if (qt_MultiTexCoord0.y == 0.0)
+ pos.x += factor * (1. - delta) * (qt_MultiTexCoord0.x * -2.0 + 1.0);
+ else if (qt_MultiTexCoord0.y == 1.0)
+ pos.x += factor * (delta) * (qt_MultiTexCoord0.x * -2.0 + 1.0);
+ else
+ pos.y = delta * h;
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+
+ }
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml
new file mode 100644
index 0000000..43e5f23
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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
+
+FocusScope {
+ id: wrapper
+
+ property alias text: input.text
+ property alias hint: hint.text
+ property alias prefix: prefix.text
+
+ signal accepted
+
+ Rectangle {
+ anchors.fill: parent
+ border.color: "#707070"
+ color: "#c1c1c1"
+ radius: 4
+
+ Text {
+ id: hint
+ anchors { fill: parent; leftMargin: 14 }
+ verticalAlignment: Text.AlignVCenter
+ text: "Enter word"
+ font.pixelSize: 18
+ color: "#707070"
+ opacity: input.length ? 0 : 1
+ }
+
+ Text {
+ id: prefix
+ anchors { left: parent.left; leftMargin: 14; verticalCenter: parent.verticalCenter }
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 18
+ color: "#707070"
+ opacity: !hint.opacity
+ }
+
+ TextInput {
+ id: input
+ focus: true
+ anchors { left: prefix.right; right: parent.right; top: parent.top; bottom: parent.bottom }
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 18
+ color: "#707070"
+ onAccepted: wrapper.accepted()
+ }
+
+ Image {
+ source: "resources/icon-search.png"
+ anchors.right: parent.right
+ anchors.rightMargin: 12
+ anchors.verticalCenter: parent.verticalCenter
+ MouseArea {
+ anchors { fill: parent; margins: -10 }
+ onClicked: wrapper.accepted()
+ }
+ }
+ }
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml
new file mode 100644
index 0000000..775c7a5
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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
+
+Rectangle {
+ color: "#d6d6d6"
+ width: parent.width
+ height: childrenRect.height
+ z: 2
+ Connections {
+ target: mainListView
+ onAutoSearch: {
+ if (type == 'tag') {
+ tagSearch.open()
+ tagSearch.searchText = str
+ } else if (type == 'user'){
+ userSearch.open()
+ userSearch.searchText = str
+ } else {
+ wordSearch.open()
+ wordSearch.searchText = str
+ }
+ }
+ }
+
+ Column {
+ width: parent.width
+
+ SearchDelegate {
+ id: wordSearch
+ label: "Search word..."
+ placeHolder: "Enter word"
+ onHasOpened: {
+ tagSearch.close()
+ userSearch.close()
+ }
+ onOk: {
+ mainListView.positionViewAtBeginning()
+ mainListView.clear()
+ tweetsModel.from = ""
+ tweetsModel.phrase = searchText
+ }
+ }
+
+ SearchDelegate {
+ id: userSearch
+ label: "From user..."
+ placeHolder: "@username"
+ prefix: "@"
+ onHasOpened:{
+ tagSearch.close()
+ wordSearch.close()
+ }
+ onOk: {
+ mainListView.positionViewAtBeginning()
+ mainListView.clear()
+ tweetsModel.phrase = ""
+ tweetsModel.from = searchText
+ }
+ }
+
+ SearchDelegate {
+ id: tagSearch
+ label: "Search hashtag..."
+ placeHolder: "#hashtag"
+ prefix: "#"
+ onHasOpened:{
+ userSearch.close()
+ wordSearch.close()
+ }
+ onOk: {
+ mainListView.positionViewAtBeginning()
+ mainListView.clear()
+ tweetsModel.from = ""
+ tweetsModel.phrase = "#" + searchText
+ }
+ }
+
+ SpriteSequence {
+ id: sprite
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 320
+ height: 300
+ running: true
+ interpolate: false
+ Sprite {
+ name: "bird"
+ source: "resources/bird-anim-sprites.png"
+ frameCount: 1
+ frameRate: 1
+ frameWidth: 320
+ frameHeight: 300
+ to: { "bird":10, "trill":1, "blink":1 }
+ }
+ Sprite {
+ name: "trill"
+ source: "resources/bird-anim-sprites.png"
+ frameCount: 5
+ frameRate: 3
+ frameWidth: 320
+ frameHeight: 300
+ to: {"bird":1}
+ }
+ Sprite {
+ name: "blink"
+ source: "resources/bird-anim-sprites.png"
+ frameCount: 1
+ frameRate: 3
+ frameWidth: 320
+ frameHeight: 300
+ frameX: 1600
+ to: {"bird":1}
+ }
+ }
+ }
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListHeader.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListHeader.qml
new file mode 100644
index 0000000..4ab56ec
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListHeader.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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 {
+ height: 60
+ width: parent.width
+
+ property bool refresh: state == "pulled" ? true : false
+
+ Row {
+ spacing: 6
+ height: childrenRect.height
+ anchors.centerIn: parent
+
+ Image {
+ id: arrow
+ source: "resources/icon-refresh.png"
+ transformOrigin: Item.Center
+ Behavior on rotation { NumberAnimation { duration: 200 } }
+ }
+
+ Text {
+ id: label
+ anchors.verticalCenter: arrow.verticalCenter
+ text: "Pull to refresh... "
+ font.pixelSize: 18
+ color: "#999999"
+ }
+ }
+
+ states: [
+ State {
+ name: "base"; when: mainListView.contentY >= -120
+ PropertyChanges { target: arrow; rotation: 180 }
+ },
+ State {
+ name: "pulled"; when: mainListView.contentY < -120
+ PropertyChanges { target: label; text: "Release to refresh..." }
+ PropertyChanges { target: arrow; rotation: 0 }
+ }
+ ]
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/SearchDelegate.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/SearchDelegate.qml
new file mode 100644
index 0000000..cb0e190
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/SearchDelegate.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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
+
+FlipBar {
+ id: flipBar
+ animDuration: 250
+ property string label: ""
+ property string placeHolder: ""
+ property alias searchText: lineInput.text
+ property alias prefix: lineInput.prefix
+ property bool opened: false
+ signal ok
+ signal hasOpened
+
+ height: 60
+ width: parent.width
+
+ function open() {
+ flipBar.flipUp()
+ flipBar.opened = true
+ lineInput.forceActiveFocus()
+ flipBar.hasOpened()
+ }
+
+ function close() {
+ if (opened) {
+ flipBar.flipDown()
+ flipBar.opened = false
+ }
+ }
+
+ front: Rectangle {
+ height: 60
+ width: parent.width
+ color: "#999999"
+
+ Rectangle { color: "#c1c1c1"; width: parent.width; height: 1 }
+ Rectangle { color: "#707070"; width: parent.width; height: 1; anchors.bottom: parent.bottom }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ if (!flipBar.opened)
+ open()
+ else if (!lineInput.activeFocus)
+ lineInput.forceActiveFocus()
+ else
+ close()
+ }
+ }
+
+ Text {
+ text: flipBar.label
+ anchors { left: parent.left; leftMargin: 20 }
+ anchors.verticalCenter: parent.verticalCenter
+ font.pixelSize: 18
+ color: "#ffffff"
+ }
+ }
+
+ back: FocusScope {
+ height: 60
+ width: parent.width
+ Rectangle {
+ anchors.fill: parent
+ color: "#999999"
+
+ Rectangle { color: "#c1c1c1"; width: parent.width; height: 1 }
+ Rectangle { color: "#707070"; width: parent.width; height: 1; anchors.bottom: parent.bottom }
+
+ LineInput {
+ id: lineInput
+ hint: flipBar.placeHolder
+ focus: flipBar.opened
+ anchors { fill: parent; margins: 6 }
+ onAccepted: flipBar.ok()
+ }
+ }
+ }
+
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetDelegate.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetDelegate.qml
new file mode 100644
index 0000000..8cd2211
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetDelegate.qml
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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 "tweetsearch.js" as Helper
+
+Item {
+ id: container
+ property real hm: 1.0
+ property int appear: -1
+ property real startRotation: 1
+
+ onAppearChanged: {
+ container.startRotation = 0.5
+ flipBar.animDuration = appear;
+ delayedAnim.start();
+ }
+
+ SequentialAnimation {
+ id: delayedAnim
+ PauseAnimation { duration: 50 }
+ ScriptAction { script: flipBar.flipDown(startRotation); }
+ }
+
+ width: 320
+ height: flipBar.height * hm
+
+ FlipBar {
+ id: flipBar
+
+ property bool flipped: false
+ delta: startRotation
+
+ anchors.bottom: parent.bottom
+ width: container.ListView.view ? container.ListView.view.width : 0
+ height: Math.max(72, tweet.y + tweet.height + 10)
+
+ front: Rectangle {
+ width: container.ListView.view ? container.ListView.view.width : 0
+ height: Math.max(72, tweet.y + tweet.height + 10)
+ color: "#2699bf"
+
+ Rectangle { color: "#33ccff"; width: parent.width; height: 1 }
+ Rectangle { color: "#1a6680"; width: parent.width; height: 1; anchors.bottom: parent.bottom }
+
+ Image {
+ id: placeHolder
+ source: "resources/anonymous.png"
+ x: 10; y: 9
+ visible: avatar.status != Image.Ready
+ }
+
+ Image {
+ id: avatar
+ source: model.userImage
+ anchors.fill: placeHolder
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ flipBar.flipUp()
+ flipBar.flipped = true
+ }
+ }
+ }
+
+ Text {
+ id: name
+ text: Helper.realName(model.name)
+ anchors { left: avatar.right; leftMargin: 10; top: avatar.top; topMargin: -3 }
+ font.pixelSize: 12
+ font.bold: true
+ color: "white"
+ linkColor: "white"
+ }
+
+ Text {
+ id: tweet
+ text: model.statusText
+ anchors { left: avatar.right; leftMargin: 10; top: name.bottom; topMargin: 0; right: parent.right; rightMargin: 10 }
+ wrapMode: Text.WordWrap
+ font.pixelSize: 12
+ font.bold: false
+ color: "#adebff"
+ linkColor: "white"
+ onLinkActivated: {
+ var tag = link.split("http://search.twitter.com/search?q=%23")
+ var user = link.split("https://twitter.com/")
+ if (tag[1] != undefined) {
+ mainListView.positionViewAtBeginning()
+ mainListView.clear()
+ mainListView.autoSearch('tag', tag[1])
+ tweetsModel.from = ""
+ tweetsModel.phrase = "#" + tag[1]
+ } else if (user[1] != undefined) {
+ mainListView.positionViewAtBeginning()
+ mainListView.clear()
+ mainListView.autoSearch('user', user[1])
+ tweetsModel.phrase = ""
+ tweetsModel.from = user[1]
+ } else
+ Qt.openUrlExternally(link)
+ }
+ }
+ }
+
+ back: Rectangle {
+ width: container.ListView.view ? container.ListView.view.width : 0
+ height: Math.max(72, tweet.y + tweet.height + 10)
+ color: "#be4a25"
+
+ Rectangle { color: "#ff6633"; width: parent.width; height: 1 }
+ Rectangle { color: "#80341a"; width: parent.width; height: 1; anchors.bottom: parent.bottom }
+
+ Image {
+ id: avatar2
+ source: model.userImage
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ y: 9
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ flipBar.flipDown()
+ flipBar.flipped = false
+ }
+ }
+ }
+
+ Text {
+ id: username
+ text: Helper.twitterName(model.name)
+ x: 10; anchors { top: avatar2.top; topMargin: -3 }
+ font.pixelSize: 12
+ font.bold: true
+ color: "white"
+ linkColor: "white"
+ }
+
+ Text {
+ text: model.source + "<br>" + Helper.formatDate(model.published) + "<br>" + model.uri
+ x: 10; anchors { top: username.bottom; topMargin: 0 }
+ wrapMode: Text.WordWrap
+ font.pixelSize: 12
+ font.bold: false
+ color: "#ffc2ad"
+ linkColor: "white"
+ onLinkActivated: Qt.openUrlExternally(link);
+ }
+ }
+ }
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetsModel.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetsModel.qml
new file mode 100644
index 0000000..cd91a78
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetsModel.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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 QtQuick.XmlListModel 2.0
+
+Item {
+ id: wrapper
+
+ property variant model: xmlModel
+ property string from : ""
+ property string phrase : ""
+
+ property string mode : "everyone"
+ property int status: xmlModel.status
+
+ function reload() { xmlModel.reload(); }
+
+ property bool isLoading: status == XmlListModel.Loading
+ property bool wasLoading: false
+ signal isLoaded
+
+ XmlListModel {
+ id: xmlModel
+
+ onStatusChanged: {
+ if (status == XmlListModel.Ready && wasLoading == true)
+ wrapper.isLoaded()
+ if (status == XmlListModel.Loading)
+ wasLoading = true;
+ else
+ wasLoading = false;
+ }
+
+ function encodePhrase(x) { return encodeURIComponent(x); }
+
+ source: (from == "" && phrase == "") ? "" :
+ 'http://search.twitter.com/search.atom?from='+from+"&rpp=10&phrase="+encodePhrase(phrase)
+
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " +
+ "declare namespace twitter=\"http://api.twitter.com/\";";
+
+ query: "/feed/entry"
+
+ XmlRole { name: "id"; query: "id/string()" }
+ XmlRole { name: "content"; query: "content/string()" }
+ XmlRole { name: "published"; query: "published/string()" }
+ XmlRole { name: "source"; query: "twitter:source/string()" }
+ XmlRole { name: "name"; query: "author/name/string()" }
+ XmlRole { name: "uri"; query: "author/uri/string()" }
+ XmlRole { name: "image"; query: "link[@rel = 'image']/@href/string()" }
+
+ }
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/anonymous.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/anonymous.png
new file mode 100644
index 0000000..88fba26
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/anonymous.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/bird-anim-sprites.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/bird-anim-sprites.png
new file mode 100644
index 0000000..4e8d7e6
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/bird-anim-sprites.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.png
new file mode 100644
index 0000000..75672f6
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.png
new file mode 100644
index 0000000..8dbff8b
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.png
new file mode 100644
index 0000000..b639a63
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.png
new file mode 100644
index 0000000..e41935a
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.png
Binary files differ
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js b/QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js
new file mode 100644
index 0000000..9b8638f
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js
@@ -0,0 +1,19 @@
+.pragma library
+
+function twitterName(str)
+{
+ var s = str.split("(")
+ return s[0]
+}
+
+function realName(str)
+{
+ var s = str.split("(")
+ return s[1].substring(0, s[1].length-1)
+}
+
+function formatDate(date)
+{
+ var da = new Date(date)
+ return da.toDateString()
+}
diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/tweetsearch.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/tweetsearch.qml
new file mode 100644
index 0000000..d7e77ce
--- /dev/null
+++ b/QtDemo/qml/QtDemo/demos/tweetsearch/tweetsearch.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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"
+
+Rectangle {
+ id: main
+ width: 320
+ height: 480
+ color: "#d6d6d6"
+
+ property string searchTerms: ""
+ property int inAnimDur: 250
+ property int counter: 0
+ property alias isLoading: tweetsModel.isLoading
+ property var idx
+ property var ids
+
+ Component.onCompleted: ids = new Array()
+
+ function idInModel(id)
+ {
+ for (var j = 0; j < ids.length; j++)
+ if (ids[j] === id)
+ return 1
+ return 0
+ }
+
+ TweetsModel {
+ id: tweetsModel
+ onIsLoaded: {
+ console.debug("Reload")
+ idx = new Array()
+ for (var i = 0; i < tweetsModel.model.count; i++) {
+ var id = tweetsModel.model.get(i).id
+ if (!idInModel(id))
+ idx.push(i)
+ }
+ console.debug(idx.length + " new tweets")
+ main.counter = idx.length
+ }
+ }
+
+ Timer {
+ id: timer
+ interval: 500; running: main.counter; repeat: true
+ onTriggered: {
+ main.counter--;
+ var id = tweetsModel.model.get(idx[main.counter]).id
+ mainListView.add( { "statusText": tweetsModel.model.get(main.counter).content,
+ "name": tweetsModel.model.get(main.counter).name,
+ "userImage": tweetsModel.model.get(main.counter).image,
+ "source": tweetsModel.model.get(main.counter).source,
+ "id": id,
+ "uri": tweetsModel.model.get(main.counter).uri,
+ "published": tweetsModel.model.get(main.counter).published } );
+ ids.push(id)
+ }
+ }
+
+ ListView {
+ id: mainListView
+ anchors.fill: parent
+ delegate: TweetDelegate { }
+ model: ListModel { id: finalModel }
+
+ add: Transition {
+ NumberAnimation { property: "hm"; from: 0; to: 1.0; duration: 300; easing.type: Easing.OutQuad }
+ PropertyAction { property: "appear"; value: 250 }
+ }
+
+ onDragEnded: if (header.refresh) { tweetsModel.model.reload() }
+
+ ListHeader {
+ id: header
+ y: -mainListView.contentY - height
+ }
+
+ footer: ListFooter { }
+
+ function clear() {
+ ids = new Array()
+ model.clear()
+ }
+
+ function add(obj) {
+ model.insert(0, obj)
+ }
+
+ signal autoSearch(string type, string str) // To communicate with Footer instance
+ }
+}
diff --git a/QtDemo/qml/QtDemo/engine.js b/QtDemo/qml/QtDemo/engine.js
index 573dec3..c89209a 100644
--- a/QtDemo/qml/QtDemo/engine.js
+++ b/QtDemo/qml/QtDemo/engine.js
@@ -1,47 +1,79 @@
-var positions = [{x:1300, y:-500, angle:-45, color: "blue", scale: .8},
- {x:-200, y:200, angle:0, color: "grey", scale: 1.2},
- {x:-1500, y:-1000, angle:170, color: "green", scale: .4},
- {x:-1000, y:1000, angle:289, color: "red", scale: .3},
- {x: 1700, y: 100, angle:257, color: "lime", scale: 1},
- {x:50, y:-1500, angle:-45, color: "black", scale: .5}
+var positions = [{x:1300, y:-500, angle:-45, borderColor: "blue", scale: .7, url: "demos/calqlatr/Calqlatr.qml"},
+ {x:-200, y:200, angle:0, borderColor: "grey", scale: .7, url: "demos/tweetsearch/tweetsearch.qml"},
+ {x:-1600, y:-1300, angle:170, borderColor: "green", scale: .8, url: "demos/calqlatr/Calqlatr.qml"},
+ {x:-1000, y:1500, angle:289, borderColor: "red", scale: .7, url: "demos/tweetsearch/tweetsearch.qml"},
+ {x: 1700, y: 1100, angle:270, borderColor: "lime", scale: .8, url: "demos/calqlatr/Calqlatr.qml"},
+ {x:50, y:-1500, angle:-45, borderColor: "black", scale: .7, url: "demos/tweetsearch/tweetsearch.qml"}
]
var objects = []
function initSlides(){
positions.forEach(function(pos){
- createNew(pos.x,pos.y,pos.angle, pos.color, pos.scale)
+ createNew(pos.x,pos.y,pos.angle, pos.borderColor, pos.scale, pos.url)
})
}
-function createNew(x,y,angle,color,scale){
+function createNew(x,y,angle,borderColor,scale,url){
var component = Qt.createComponent("Slide.qml")
if (component.status === Component.Ready)
var object=component.createObject(canvas)
object.x = x-object.width/2
object.y = y-object.height/2
object.rotation = angle
- object.color = color
object.scale = scale
object.uid = objects.length+1 //TODO make unique
//in future objects will also
//get destroyed and re-created
+ object.borderColor = borderColor
+
+ if (url){
+ object.url = url;
+ //object.loadDemo() //loads demo app to slide
+ }
objects.push(object)
}
+function lookForSlides(x,y,angle){
+ //find next slide to fly into from the given position and direction
+
+ for (var idx=0; idx < positions.length; idx++){
+
+ //TODO: improve heurestics by adding also distance here
+
+ var a=positions[idx].y-y
+ var b=positions[idx].x-x
+
+ var distance = Math.sqrt(a*a+b*b)
+
+ var angleBetween = Math.atan2(a,b)*57.2957795
+ var diff = Math.abs(angle-angleBetween)
+
+ if (distance > 100 && diff < 20) {
+ return selectTarget(positions[idx].uid);
+ }
+ }
+ return null; //no match
+}
+
function selectTarget(uid){
- var idx;
+ var idx = -1;
- if (uid){
- for (idx=0; idx < objects.length; idx++){
- if (objects[idx].uid === uid){
- return {"x": positions[idx].x, "y": positions[idx].y, "angle": positions[idx].angle, "scale": positions[idx].scale}
+ for (var i=0; i < objects.length; i++){
+ if (uid && objects[i].uid === uid){
+ idx = i
+ } else {
+ objects[i].releaseDemo();
}
}
- }
+ if (idx !== -1){
+ objects[idx].loadDemo();
+ return {"x": positions[idx].x, "y": positions[idx].y, "angle": positions[idx].angle, "scale": positions[idx].scale}
+ }
//randomly select new target for now
idx = Math.floor(Math.random()*positions.length)
+ objects[idx].loadDemo();
return {"x": positions[idx].x, "y": positions[idx].y, "angle": positions[idx].angle, "scale": positions[idx].scale}
}
diff --git a/QtDemo/qml/QtDemo/main.qml b/QtDemo/qml/QtDemo/main.qml
index abc5d53..48f01d8 100644
--- a/QtDemo/qml/QtDemo/main.qml
+++ b/QtDemo/qml/QtDemo/main.qml
@@ -3,8 +3,8 @@ import "engine.js" as Engine
Item{
id: app
- width: 640
- height: 480
+ width: 1280
+ height: 800
clip: true
Rectangle{
anchors.centerIn: parent
@@ -20,6 +20,101 @@ Item{
color: "black"
}
+ MouseArea{
+ id: worldMouseArea
+
+ property int startX: 0
+ property int startY: 0
+
+ property int oldX: 0
+ property int oldY: 0
+
+ property bool panning: false
+ property bool flicking: false
+
+ anchors.fill: parent
+
+ onClicked: {
+ var target = null;
+ var velocity = 0;
+
+ if (flicking){
+ var a=mouse.x-startX;
+ var b=mouse.y-startY;
+
+ velocity = Math.sqrt(a*a+b*b)
+
+ if (velocity < 10) flicking = false
+ }
+
+ if (flicking) {
+ print ("flick gesture recognized")
+
+ var angle = Math.atan2(-(mouse.y-startY),-(mouse.x-startX))*57.2957795
+ target = Engine.lookForSlides(mouse.x, mouse.y, angle)
+
+ } else if (panning) {
+ panning = false
+ return
+ }
+
+ if (!target){
+
+ var object = mapToItem(canvas, mouse.x, mouse.y)
+ var item = canvas.childAt(object.x,object.y)
+
+
+ if (item && item.objectName === 'slide') {
+ target = Engine.selectTarget(item.uid)
+ } else {
+ //select random target for now...
+ target = Engine.selectTarget(null)
+ }
+ }
+
+ canvas.xOffset = -target.x
+ canvas.yOffset = -target.y
+ canvas.rotationOriginX = target.x
+ canvas.rotationOriginY = target.y
+ canvas.angle = -target.angle
+
+ canvas.zoomOutTarget = .4
+ canvas.zoomInTarget = 1.0/target.scale
+
+ zoomFlyByAnimation.restart()
+ }
+
+ onPressed: {
+ startX = mouse.x
+ startY = mouse.y
+ oldX = mouse.x
+ oldY = mouse.y
+ flicking = true
+ flickTimer.restart()
+ }
+
+ onPositionChanged: {
+ panning= true
+
+ canvas.xOffset+=(mouse.x - oldX)
+ canvas.yOffset+=(mouse.y - oldY)
+
+ oldX = mouse.x
+ oldY = mouse.y
+ }
+
+ //onFlickingChanged: print ("Flicking changed to: "+flicking)
+
+ Timer {
+ id: flickTimer
+ interval: 200 //Adjust suitable interval for flicking gesture
+ repeat: false
+ onTriggered: {
+ worldMouseArea.flicking = false
+ }
+ }
+ }
+
Item{
id:canvas
width:1
@@ -39,7 +134,7 @@ Item{
property real rotationOriginX
property real rotationOriginY
- Behavior on angle {NumberAnimation{duration: 1000}}
+ Behavior on angle {RotationAnimation{duration: 1000; direction: RotationAnimation.Shortest}}
Behavior on xOffset {
id: xOffsetBehaviour
@@ -56,13 +151,24 @@ Item{
Behavior on rotationOriginX {NumberAnimation{duration: 1000}}
Behavior on rotationOriginY {NumberAnimation{duration: 1000}}
- Rectangle{
+ // Rectangle{
+ // anchors.centerIn: parent
+ // width:4000
+ // height:4000
+ // color:"transparent"
+ // radius:2000
+ // border{color:"red"; width:100}
+ // }
+
+ Image{
+ id: logo
+ //Qt logo image taken 28.3.2013 from: http://upload.wikimedia.org/wikipedia/de/0/08/Qt_(Bibliothek)_logo.svg
+ source: "QtLogo.svg"
anchors.centerIn: parent
- width:4000
- height:4000
- color:"transparent"
- radius:2000
- border{color:"red"; width:100}
+ width: 5030
+ height: 6000
+ sourceSize: Qt.size(5030,6000)
+ smooth: !zoomFlyByAnimation.running
}
transform: [
@@ -87,76 +193,10 @@ Item{
SequentialAnimation{
id: zoomFlyByAnimation
alwaysRunToEnd: true
- NumberAnimation { target: canvas; property: "scalingFactor"; duration: 500; to:canvas.zoomOutTarget; easing.type: Easing.OutCubic }
- NumberAnimation { target: canvas; property: "scalingFactor"; duration: 500; to:canvas.zoomInTarget; easing.type: Easing.InCubic }
+ NumberAnimation { target: canvas; property: "scalingFactor"; duration: 700; to:canvas.zoomOutTarget; easing.type: Easing.OutCubic }
+ NumberAnimation { target: canvas; property: "scalingFactor"; duration: 700; to:canvas.zoomInTarget; easing.type: Easing.OutBounce }
}
- MouseArea{
- id: worldMouseArea
-
- property int startX: 0
- property int startY: 0
-
- property int oldX: 0
- property int oldY: 0
-
- property bool panning: false
-
- anchors.fill: parent
-
- onClicked: {
- if (panning) {
- panning = false
- return
- }
- var object = mapToItem(canvas, mouse.x, mouse.y)
- var item = canvas.childAt(object.x,object.y)
-
- var target = null
-
- if (item && item.objectName === 'slide') {
- target = Engine.selectTarget(item.uid)
- } else {
- //select random target for now...
- target = Engine.selectTarget(null)
- }
-
- canvas.xOffset = -target.x
- canvas.yOffset = -target.y
- canvas.rotationOriginX = target.x
- canvas.rotationOriginY = target.y
- canvas.angle = -target.angle
- canvas.zoomOutTarget = .4
- canvas.zoomInTarget = 1.0/target.scale
-
- zoomFlyByAnimation.restart()
- }
-
- onPressed: {
- startX = mouse.x
- startY = mouse.y
- oldX = mouse.x
- oldY = mouse.y
- }
-
- onPositionChanged: {
- panning= true
-
- canvas.xOffset+=(mouse.x - oldX)
- canvas.yOffset+=(mouse.y - oldY)
-
- oldX = mouse.x
- oldY = mouse.y
- }
-
- onReleased: {
- //TODO: make it so that movement slows down and stops
- //rather that just stopping the movement
- }
-
- // drag.target: canvas
- // drag.axis: Drag.XAndYAxis
- }
NavigationPanel{
anchors{top:parent.top; right:parent.right}