diff options
author | Lasse Räihä <lasse.raiha@digia.com> | 2013-06-19 10:08:17 +0300 |
---|---|---|
committer | Kimmo Ollila <kimmo.ollila@digia.com> | 2013-06-19 10:09:12 +0300 |
commit | b319f4b1022ae1ceca238e31656405cddb993414 (patch) | |
tree | 14a33410dc20d28bff438f4fb26edc9fe85fe20f /QtDemo | |
parent | 1aace1990fec1e7a2a4022026c6c0b44b1e8a074 (diff) |
Removed tweetsearch. Fixed helpsreen. Added characters.
Change-Id: Ia123572ce80c633cb73fb74460eed74e20c46c18
Reviewed-by: Kimmo Ollila <kimmo.ollila@digia.com>
Diffstat (limited to 'QtDemo')
29 files changed, 23 insertions, 1066 deletions
diff --git a/QtDemo/qml/QtDemo/Element.qml b/QtDemo/qml/QtDemo/Element.qml index b765c64..097a3fc 100644 --- a/QtDemo/qml/QtDemo/Element.qml +++ b/QtDemo/qml/QtDemo/Element.qml @@ -54,13 +54,23 @@ Item { } Component.onCompleted: { - elementImage.source = root.itemId === 0 ? "images/man1.png" : - root.itemId === 1 ? "images/tree1.png" : + elementImage.source = root.itemId === 1 ? "images/tree1.png" : root.itemId === 2 ? "images/tree2.png" : root.itemId === 3 ? "images/mountain.png" : root.itemId === 4 ? "images/stones.png" : root.itemId === 5 ? "images/box_open.png" : root.itemId === 6 ? "images/box.png" : + root.itemId === 10 ? "images/character0.png" : + root.itemId === 11 ? "images/character1.png" : + root.itemId === 12 ? "images/character3.png" : + root.itemId === 13 ? "images/character7.png" : + root.itemId === 14 ? "images/character8.png" : + root.itemId === 15 ? "images/character9.png" : + root.itemId === 20 ? "images/character2.png" : + root.itemId === 21 ? "images/character4.png" : + root.itemId === 22 ? "images/character5.png" : + root.itemId === 23 ? "images/character6.png" : + root.itemId === 24 ? "images/character10.png" : "" } } diff --git a/QtDemo/qml/QtDemo/HelpScreen.qml b/QtDemo/qml/QtDemo/HelpScreen.qml index da8b5d7..3fb540c 100644 --- a/QtDemo/qml/QtDemo/HelpScreen.qml +++ b/QtDemo/qml/QtDemo/HelpScreen.qml @@ -196,7 +196,7 @@ Item { SequentialAnimation { id: clickAnimation property int index: 0 - property variant uids: [9,13] + property variant uids: [8,12] loops: 2 ScriptAction{ diff --git a/QtDemo/qml/QtDemo/IslandElementContainer.qml b/QtDemo/qml/QtDemo/IslandElementContainer.qml index e82085d..c191d68 100644 --- a/QtDemo/qml/QtDemo/IslandElementContainer.qml +++ b/QtDemo/qml/QtDemo/IslandElementContainer.qml @@ -63,7 +63,7 @@ Item { { // Left side if (place === 0) { - var temp0 = Math.floor(Math.random()*5.9); + var temp0 = Math.floor(Math.random()*6.9); switch(temp0) { case 0: createElement(elementContainer.width*0.4, elementContainer.height*0.2, 1); @@ -89,13 +89,15 @@ Item { createElement(elementContainer.width*0.7, elementContainer.height*0.6, 2); break; case 4: - createElement(elementContainer.width*0.7, elementContainer.height*0.3, 0); + case 5: + var characterId = 10 + Math.floor(Math.random()*5.9); + createElement(elementContainer.width*0.7, elementContainer.height*0.3, characterId); break; default: break; } } else if (place === 1) { - var temp1 = Math.floor(Math.random()*4.9); + var temp1 = Math.floor(Math.random()*6.9); switch(temp1) { case 0: createElement(elementContainer.width*0.6, elementContainer.height*0.2, 1); @@ -120,6 +122,11 @@ Item { createElement(elementContainer.width*0.5, elementContainer.height*0.5, 1); createElement(elementContainer.width*0.3, elementContainer.height*0.6, 2); break; + case 4: + case 5: + var characterId1 = 20 + Math.floor(Math.random()*4.9); + createElement(elementContainer.width*0.3, elementContainer.height*0.3, characterId1); + break; default: break; } } diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml deleted file mode 100644 index 4b6cd48..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/FlipBar.qml +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** 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 deleted file mode 100644 index 213c0b6..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/LineInput.qml +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** 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 string text: "" - property string hint: "" - property string prefix: "" - - signal accepted - - Rectangle { - anchors.fill: parent - border.color: "#707070" - color: "#c1c1c1" - radius: 4 - - TextInput { - id: input - focus: true - anchors { left: parent.left; leftMargin:14; right: parent.right; top: parent.top; bottom: parent.bottom } - verticalAlignment: Text.AlignVCenter - font.pixelSize: 18 - text: wrapper.hint - color: "#707070" - onAccepted: wrapper.accepted() - onActiveFocusChanged: { - if (focus) input.text = wrapper.hint - } - - onTextChanged: { - if (text.length >= wrapper.hint.length+1 && text.substring(0, wrapper.hint.length)===wrapper.hint) { - var tmp = text.substring(wrapper.hint.length) - text = tmp - } - if (text !== "") wrapper.text = text - } - } - - Rectangle { - id: searchRect - anchors.right: parent.right - anchors.margins: parent.height * 0.1 - anchors.verticalCenter: parent.verticalCenter - height: parent.height * 0.8 - width: height - color: "transparent" - radius: 4 - - Image { - source: "resources/icon-search.png" - anchors.fill: parent - anchors.margins: 5 - MouseArea { - anchors { fill: parent; margins: -10 } - onPressed: searchRect.color = "#ff9999" - onReleased: searchRect.color = "transparent" - onClicked: wrapper.accepted() - } - } - } - } -} diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml b/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml deleted file mode 100644 index 775c7a5..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListFooter.qml +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** 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 deleted file mode 100644 index 4ab56ec..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/ListHeader.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** 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 deleted file mode 100644 index cb0e190..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/SearchDelegate.qml +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** 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 deleted file mode 100644 index b96cd69..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetDelegate.qml +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** 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: parent.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 deleted file mode 100644 index cd91a78..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/TweetsModel.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** 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 Binary files differdeleted file mode 100644 index 88fba26..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/anonymous.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 4e8d7e6..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/bird-anim-sprites.png +++ /dev/null diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.png Binary files differdeleted file mode 100644 index 75672f6..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-clear.png +++ /dev/null diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.png Binary files differdeleted file mode 100644 index 8dbff8b..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-loading.png +++ /dev/null diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.png Binary files differdeleted file mode 100644 index b639a63..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-refresh.png +++ /dev/null diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.png b/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.png Binary files differdeleted file mode 100644 index e41935a..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/resources/icon-search.png +++ /dev/null diff --git a/QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js b/QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js deleted file mode 100644 index 9b8638f..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/content/tweetsearch.js +++ /dev/null @@ -1,19 +0,0 @@ -.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 deleted file mode 100644 index 9bef779..0000000 --- a/QtDemo/qml/QtDemo/demos/tweetsearch/tweetsearch.qml +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** 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 - anchors.fill: parent - 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/images/character0.png b/QtDemo/qml/QtDemo/images/character0.png Binary files differnew file mode 100644 index 0000000..11a1b35 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character0.png diff --git a/QtDemo/qml/QtDemo/images/character1.png b/QtDemo/qml/QtDemo/images/character1.png Binary files differnew file mode 100644 index 0000000..4f09ee6 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character1.png diff --git a/QtDemo/qml/QtDemo/images/character10.png b/QtDemo/qml/QtDemo/images/character10.png Binary files differnew file mode 100644 index 0000000..2039664 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character10.png diff --git a/QtDemo/qml/QtDemo/images/character2.png b/QtDemo/qml/QtDemo/images/character2.png Binary files differnew file mode 100644 index 0000000..e7a841b --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character2.png diff --git a/QtDemo/qml/QtDemo/images/character3.png b/QtDemo/qml/QtDemo/images/character3.png Binary files differnew file mode 100644 index 0000000..edad45f --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character3.png diff --git a/QtDemo/qml/QtDemo/images/character4.png b/QtDemo/qml/QtDemo/images/character4.png Binary files differnew file mode 100644 index 0000000..c343f50 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character4.png diff --git a/QtDemo/qml/QtDemo/images/character5.png b/QtDemo/qml/QtDemo/images/character5.png Binary files differnew file mode 100644 index 0000000..65e00f7 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character5.png diff --git a/QtDemo/qml/QtDemo/images/character6.png b/QtDemo/qml/QtDemo/images/character6.png Binary files differnew file mode 100644 index 0000000..05ab8f5 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character6.png diff --git a/QtDemo/qml/QtDemo/images/character7.png b/QtDemo/qml/QtDemo/images/character7.png Binary files differnew file mode 100644 index 0000000..700a46a --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character7.png diff --git a/QtDemo/qml/QtDemo/images/character8.png b/QtDemo/qml/QtDemo/images/character8.png Binary files differnew file mode 100644 index 0000000..3580062 --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character8.png diff --git a/QtDemo/qml/QtDemo/images/character9.png b/QtDemo/qml/QtDemo/images/character9.png Binary files differnew file mode 100644 index 0000000..298242e --- /dev/null +++ b/QtDemo/qml/QtDemo/images/character9.png |