diff options
Diffstat (limited to 'examples/quick/demos')
293 files changed, 0 insertions, 13978 deletions
diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro deleted file mode 100644 index 20543c08da..0000000000 --- a/examples/quick/demos/calqlatr/calqlatr.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp - -RESOURCES += calqlatr.qrc \ - ../../shared/shared.qrc - -OTHER_FILES = calqlatr.qml \ - content/Button.qml \ - content/Display.qml \ - content/NumberPad.qml \ - content/calculator.js \ - content/images/paper-edge-left.png \ - content/images/paper-edge-right.png \ - content/images/paper-grip.png - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr -INSTALLS += target diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml deleted file mode 100644 index 017d819b01..0000000000 --- a/examples/quick/demos/calqlatr/calqlatr.qml +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" -import "content/calculator.js" as CalcEngine - - -Rectangle { - id: window - width: 320 - height: 480 - focus: true - color: "#272822" - - onWidthChanged: controller.reload() - onHeightChanged: controller.reload() - - function operatorPressed(operator) { - CalcEngine.operatorPressed(operator) - numPad.buttonPressed() - } - function digitPressed(digit) { - CalcEngine.digitPressed(digit) - numPad.buttonPressed() - } - function isButtonDisabled(op) { - return CalcEngine.disabled(op) - } - - Item { - id: pad - width: 180 - NumberPad { id: numPad; 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 } - } - } - } - - Keys.onPressed: { - if (event.key == Qt.Key_0) - digitPressed("0") - else if (event.key == Qt.Key_1) - digitPressed("1") - else if (event.key == Qt.Key_2) - digitPressed("2") - else if (event.key == Qt.Key_3) - digitPressed("3") - else if (event.key == Qt.Key_4) - digitPressed("4") - else if (event.key == Qt.Key_5) - digitPressed("5") - else if (event.key == Qt.Key_6) - digitPressed("6") - else if (event.key == Qt.Key_7) - digitPressed("7") - else if (event.key == Qt.Key_8) - digitPressed("8") - else if (event.key == Qt.Key_9) - digitPressed("9") - else if (event.key == Qt.Key_Plus) - operatorPressed("+") - else if (event.key == Qt.Key_Minus) - operatorPressed("−") - else if (event.key == Qt.Key_Asterisk) - operatorPressed("×") - else if (event.key == Qt.Key_Slash) - operatorPressed("÷") - else if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) - operatorPressed("=") - else if (event.key == Qt.Key_Comma || event.key == Qt.Key_Period) - digitPressed(".") - else if (event.key == Qt.Key_Backspace) - operatorPressed("backspace") - } - - Display { - id: display - x: -16 - width: window.width - pad.width - height: parent.height - - MouseArea { - id: mouseInput - property real startX: 0 - property real oldP: 0 - property bool rewind: false - - anchors { - bottom: parent.bottom - left: parent.left - right: parent.right - } - height: 50 - onPositionChanged: { - var reverse = startX > window.width / 2 - var mx = mapToItem(window, mouseInput.mouseX, mouseInput.mouseY).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, mouseInput.mouseX, mouseInput.mouseY).x - onReleased: { - if (rewind) - controller.completeToBeginning() - else - controller.completeToEnd() - } - } - } - -} diff --git a/examples/quick/demos/calqlatr/calqlatr.qmlproject b/examples/quick/demos/calqlatr/calqlatr.qmlproject deleted file mode 100644 index ce2d59d310..0000000000 --- a/examples/quick/demos/calqlatr/calqlatr.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "calqlatr.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/calqlatr/calqlatr.qrc b/examples/quick/demos/calqlatr/calqlatr.qrc deleted file mode 100644 index 7483304e02..0000000000 --- a/examples/quick/demos/calqlatr/calqlatr.qrc +++ /dev/null @@ -1,12 +0,0 @@ -<RCC> - <qresource prefix="/demos/calqlatr"> - <file>calqlatr.qml</file> - <file>content/Button.qml</file> - <file>content/calculator.js</file> - <file>content/Display.qml</file> - <file>content/NumberPad.qml</file> - <file>content/images/paper-edge-left.png</file> - <file>content/images/paper-edge-right.png</file> - <file>content/images/paper-grip.png</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/calqlatr/content/Button.qml b/examples/quick/demos/calqlatr/content/Button.qml deleted file mode 100644 index 9c5c6ecf6e..0000000000 --- a/examples/quick/demos/calqlatr/content/Button.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: button - property alias text: textItem.text - property color color: "#eceeea" - - property bool operator: false - property bool dimmable: false - property bool dimmed: false - - width: 30 - height: 50 - - Text { - id: textItem - font.pixelSize: 48 - wrapMode: Text.WordWrap - lineHeight: 0.75 - color: (dimmable && dimmed) ? Qt.darker(button.color) : button.color - Behavior on color { ColorAnimation { duration: 120; easing.type: Easing.OutElastic} } - states: [ - State { - name: "pressed" - when: mouse.pressed && !dimmed - PropertyChanges { - target: textItem - color: Qt.lighter(button.color) - } - } - ] - } - - MouseArea { - id: mouse - anchors.fill: parent - anchors.margins: -5 - onClicked: { - if (operator) - window.operatorPressed(parent.text) - else - window.digitPressed(parent.text) - } - } - - function updateDimmed() { - dimmed = window.isButtonDisabled(button.text) - } - - Component.onCompleted: { - numPad.buttonPressed.connect(updateDimmed) - updateDimmed() - } -} diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml deleted file mode 100644 index cf93d878bb..0000000000 --- a/examples/quick/demos/calqlatr/content/Display.qml +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -Item { - id: display - property real fontSize: Math.floor(Screen.pixelDensity * 5.0) - property bool enteringDigits: false - property int maxDigits: (width / fontSize) + 1 - property string displayedOperand - property string errorString: qsTr("ERROR") - property bool isError: displayedOperand === errorString - - function displayOperator(operator) - { - listView.model.append({ "operator": operator, "operand": "" }) - enteringDigits = true - listView.positionViewAtEnd() - } - - function newLine(operator, operand) - { - displayedOperand = displayNumber(operand) - listView.model.append({ "operator": operator, "operand": displayedOperand }) - enteringDigits = false - listView.positionViewAtEnd() - } - - function appendDigit(digit) - { - if (!enteringDigits) - listView.model.append({ "operator": "", "operand": "" }) - var i = listView.model.count - 1; - listView.model.get(i).operand = listView.model.get(i).operand + digit; - enteringDigits = true - listView.positionViewAtEnd() - } - - function setDigit(digit) - { - var i = listView.model.count - 1; - listView.model.get(i).operand = digit; - listView.positionViewAtEnd() - } - - function clear() - { - displayedOperand = "" - if (enteringDigits) { - var i = listView.model.count - 1 - if (i >= 0) - listView.model.remove(i) - enteringDigits = false - } - } - - // Returns a string representation of a number that fits in - // display.maxDigits characters, trying to keep as much precision - // as possible. If the number cannot be displayed, returns an - // error string. - function displayNumber(num) { - if (typeof(num) != "number") - return errorString; - - var intNum = parseInt(num); - var intLen = intNum.toString().length; - - // Do not count the minus sign as a digit - var maxLen = num < 0 ? maxDigits + 1 : maxDigits; - - if (num.toString().length <= maxLen) { - if (isFinite(num)) - return num.toString(); - return errorString; - } - - // Integer part of the number is too long - try - // an exponential notation - if (intNum == num || intLen > maxLen - 3) { - var expVal = num.toExponential(maxDigits - 6).toString(); - if (expVal.length <= maxLen) - return expVal; - } - - // Try a float presentation with fixed number of digits - var floatStr = parseFloat(num).toFixed(maxDigits - intLen - 1).toString(); - if (floatStr.length <= maxLen) - return floatStr; - - return errorString; - } - - 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 { - id: grip - 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 - 50 - y - delegate: Item { - height: display.fontSize * 1.1 - width: parent.width - Text { - id: operator - x: 6 - font.pixelSize: display.fontSize - color: "#6da43d" - text: model.operator - } - Text { - id: operand - font.pixelSize: display.fontSize - anchors.right: parent.right - anchors.rightMargin: 22 - text: model.operand - } - } - model: ListModel { } - } - - } - -} diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml deleted file mode 100644 index 6e7d441dd2..0000000000 --- a/examples/quick/demos/calqlatr/content/NumberPad.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Grid { - columns: 3 - columnSpacing: 32 - rowSpacing: 16 - - signal buttonPressed - - 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: "."; dimmable: true } - Button { text: " " } - Button { text: "±"; color: "#6da43d"; operator: true; dimmable: true } - Button { text: "−"; color: "#6da43d"; operator: true; dimmable: true } - Button { text: "+"; color: "#6da43d"; operator: true; dimmable: true } - Button { text: "√"; color: "#6da43d"; operator: true; dimmable: true } - Button { text: "÷"; color: "#6da43d"; operator: true; dimmable: true } - Button { text: "×"; color: "#6da43d"; operator: true; dimmable: true } - Button { text: "C"; color: "#6da43d"; operator: true } - Button { text: " "; color: "#6da43d"; operator: true } - Button { text: "="; color: "#6da43d"; operator: true; dimmable: true } -} diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js deleted file mode 100644 index 496a93ba79..0000000000 --- a/examples/quick/demos/calqlatr/content/calculator.js +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -var curVal = 0 -var memory = 0 -var lastOp = "" -var previousOperator = "" -var digits = "" - -function disabled(op) { - if (digits == "" && !((op >= "0" && op <= "9") || op == ".")) - return true - else if (op == '=' && previousOperator.length != 1) - return true - else if (op == "." && digits.toString().search(/\./) != -1) { - return true - } else if (op == "√" && digits.toString().search(/-/) != -1) { - return true - } else { - return false - } -} - -function digitPressed(op) -{ - if (disabled(op)) - return - if (digits.toString().length >= display.maxDigits) - 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 (op == "±") { - digits = Number(digits.valueOf() * -1) - display.setDigit(display.displayNumber(digits)) - return - } - - if (previousOperator == "+") { - digits = Number(digits.valueOf()) + Number(curVal.valueOf()) - } else if (previousOperator == "−") { - digits = Number(curVal.valueOf()) - Number(digits.valueOf()) - } else if (previousOperator == "×") { - digits = Number(curVal) * Number(digits.valueOf()) - } else if (previousOperator == "÷") { - digits = Number(curVal) / Number(digits.valueOf()) - } - - if (op == "+" || op == "−" || op == "×" || op == "÷") { - previousOperator = op - curVal = digits.valueOf() - digits = "" - display.displayOperator(previousOperator) - return - } - - if (op == "=") { - display.newLine("=", digits.valueOf()) - } - - 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 == "√") { - digits = Number(Math.sqrt(digits.valueOf())) - display.newLine("√", digits.valueOf()) - } 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 == "backspace") { - digits = digits.toString().slice(0, -1) - display.clear() - display.appendDigit(digits) - } else if (op == "Off") { - Qt.quit(); - } - - // Reset the state on 'C' operator or after - // an error occurred - if (op == "C" || display.isError) { - display.clear() - curVal = 0 - memory = 0 - lastOp = "" - digits = "" - } -} - diff --git a/examples/quick/demos/calqlatr/content/images/paper-edge-left.png b/examples/quick/demos/calqlatr/content/images/paper-edge-left.png Binary files differdeleted file mode 100644 index ca29a3ae10..0000000000 --- a/examples/quick/demos/calqlatr/content/images/paper-edge-left.png +++ /dev/null diff --git a/examples/quick/demos/calqlatr/content/images/paper-edge-right.png b/examples/quick/demos/calqlatr/content/images/paper-edge-right.png Binary files differdeleted file mode 100644 index 7c2da7b930..0000000000 --- a/examples/quick/demos/calqlatr/content/images/paper-edge-right.png +++ /dev/null diff --git a/examples/quick/demos/calqlatr/content/images/paper-grip.png b/examples/quick/demos/calqlatr/content/images/paper-grip.png Binary files differdeleted file mode 100644 index 953c408bca..0000000000 --- a/examples/quick/demos/calqlatr/content/images/paper-grip.png +++ /dev/null diff --git a/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png b/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png Binary files differdeleted file mode 100644 index af67f63dd1..0000000000 --- a/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png +++ /dev/null diff --git a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc deleted file mode 100644 index 85e77b96b4..0000000000 --- a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Calqlatr - \ingroup qtquickdemos - \example demos/calqlatr - \brief A QML app designed for portrait devices that uses custom components, - animated with AnimationController, and JavaScript for the application logic. - \image qtquick-demo-calqlatr.png - - \e{Calqlatr} demonstrates various QML and \l{Qt Quick} features, such as - displaying custom components and using animation to move the components - around in the application view. The application logic is implemented in - JavaScript and the appearance is implemented in QML. - - \include examples-run.qdocinc - - \section1 Displaying Custom Components - - In the Calqlatr application, we use the following custom types that are - each defined in a separate .qml file: - - \list - \li Button.qml - \li Display.qml - \li NumberPad.qml - \endlist - - To use the custom types, we add an import statement to the main QML file, - calqlatr.qml that imports the folder called \c content where the types are - located: - - \code - import "content" - \endcode - - We can then display custom components by adding the component types to - any QML file. For example, we use the NumberPad type in calqlatr.qml to - create the number pad of the calculator. We place the type inside an - \l{Item} QML type, which is the base type for all visual items in Qt Quick: - - \quotefromfile demos/calqlatr/calqlatr.qml - \skipto Item - \printuntil } - \printuntil } - - Further, we use the Button type in the \c NumberPad type to create the - calculator buttons. Button.qml specifies the basic properties for a - button that we can modify for each button instance in NumberPad.qml. For the - digit and separator buttons, we additionally specify the text property using - the property alias \c text that we define in Button.qml. - - For the operator buttons, we also specify another color (green) using the - property alias \c color and set the operator property to \c true. We use - the operator property in functions that perform the calculations. - - We place the buttons inside a \l{Grid} QML type to position them in a grid: - - \quotefromfile demos/calqlatr/content/NumberPad.qml - \skipto Grid - \printuntil /^\}/ - - Some of the buttons also have a \c dimmable property set, meaning that they - can be visually disabled (dimmed) whenever the calculator engine does not - accept input from that button. As an example, the button for square root - operator is dimmed for negative values. - - \section1 Animating Components - - We use the Display type to display calculations. In Display.qml, we use - images to make the display component look like a slip of paper that contains - a grip. Users can drag the grip to move the display from left to right. - - When users release the grip, the AnimationController QML type that we define - in the calqlatr.qml file finishes running the controlled animation in either - a forwards or a backwards direction. To run the animation, we call either - completeToEnd() or completeToBeginning(), depending on the direction. We do - this in the MouseArea's \c onReleased signal handler, where \c controller - is the id of our AnimationController: - - \quotefromfile demos/calqlatr/calqlatr.qml - \skipto MouseArea - \printuntil { - \dots 12 - \skipto onReleased - \printuntil } - \printuntil } - - Unlike other QML animation types, AnimationController is not driven by - internal timers but by explicitly setting its progress property to a - value between \c 0.0 and \c 1.0. - - Inside the AnimationController, we run two NumberAnimation instances in - parallel to move the number pad and the display components simultaneously to - the opposite sides of the view. In addition, we run a SequentialAnimation - instance to scale the number pad during the transition, giving the animation - some depth. - - \quotefromfile demos/calqlatr/calqlatr.qml - \skipto AnimationController - \printuntil 1; easing.type - \printuntil } - \printuntil } - \printuntil } - - We use the easing curve of the type \c Easing.InOutQuad to accelerate the - motion until halfway and then decelerate it. - - In Button.qml, the text colors of the number pad buttons are also animated. - - \quotefromfile demos/calqlatr/content/Button.qml - \skipto Text - \printuntil id: - \dots 8 - \skipto color: - \printuntil ] - \printuntil } - - We use \l {QtQml::Qt::darker()}{Qt.darker()} to darken the color when the - button is dimmed, and \l {QtQml::Qt::lighter()}{Qt.lighter()} to \e {light up} - the button when pressed. The latter is done in a separate \l [QML] {State} - {state} called \e "pressed", which activates when the \c pressed - property of the button's MouseArea is set. - - The color changes are animated by defining a \l Behavior on the \c color - property. - - In order to dynamically change the \c dimmed property of all the buttons - of the \c NumberPad, we connect its \c buttonPressed signal to the - \c Button's \c updateDimmed() function in Button.qml: - - \quotefromfile demos/calqlatr/content/Button.qml - \skipto function updateDimmed() { - \printuntil buttonPressed.connect - \printuntil } - - This way, when a button is pressed, all buttons on the \c NumPad - receive a \c buttonPressed signal and are activated or deactivated - according to the state of the calculator engine. - - \section1 Performing Calculations - - The calculator.js file defines our calculator engine. It contains variables - to store the calculator state, and functions that are called when the - user presses the digit and operator buttons. To use the engine, we - import calculator.js in the calqlatr.qml file as \c CalcEngine: - - \code - import "content/calculator.js" as CalcEngine - \endcode - - Importing the engine creates a new instance of it. Therefore, we only do it - in the main QML file, \c calqlatr.qml. The root item defined in this file - contains helper functions that allow other types to access the calculator - engine: - - \quotefromfile demos/calqlatr/calqlatr.qml - \skipto operatorPressed - \printuntil CalcEngine.disabled - \printuntil } - - When users press a digit, the text from the digit appears on the - display. When they press an operator, the appropriate calculation is - performed, and the result can be displayed using the equals (=) operator. - The clear (C) operator resets the calculator engine. - - \section1 List of Files - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/calqlatr/main.cpp b/examples/quick/demos/calqlatr/main.cpp deleted file mode 100644 index ca4f206da4..0000000000 --- a/examples/quick/demos/calqlatr/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/calqlatr/calqlatr) diff --git a/examples/quick/demos/clocks/clocks.pro b/examples/quick/demos/clocks/clocks.pro deleted file mode 100644 index 21d3f7f971..0000000000 --- a/examples/quick/demos/clocks/clocks.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick - -SOURCES += main.cpp -RESOURCES += clocks.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/clocks -INSTALLS += target - -OTHER_FILES += \ - clocks.qml \ - content/Clock.qml \ - content/*.png diff --git a/examples/quick/demos/clocks/clocks.qml b/examples/quick/demos/clocks/clocks.qml deleted file mode 100644 index d9694d169c..0000000000 --- a/examples/quick/demos/clocks/clocks.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" as Content - -Rectangle { - id: root - width: 640; height: 320 - color: "#646464" - - ListView { - id: clockview - anchors.fill: parent - orientation: ListView.Horizontal - cacheBuffer: 2000 - snapMode: ListView.SnapOneItem - highlightRangeMode: ListView.ApplyRange - - delegate: Content.Clock { city: cityName; shift: timeShift } - model: ListModel { - ListElement { cityName: "New York"; timeShift: -4 } - ListElement { cityName: "London"; timeShift: 0 } - ListElement { cityName: "Oslo"; timeShift: 1 } - ListElement { cityName: "Mumbai"; timeShift: 5.5 } - ListElement { cityName: "Tokyo"; timeShift: 9 } - ListElement { cityName: "Brisbane"; timeShift: 10 } - ListElement { cityName: "Los Angeles"; timeShift: -8 } - } - } - - Image { - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.margins: 10 - source: "content/arrow.png" - rotation: -90 - opacity: clockview.atXBeginning ? 0 : 0.5 - Behavior on opacity { NumberAnimation { duration: 500 } } - } - - Image { - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 10 - source: "content/arrow.png" - rotation: 90 - opacity: clockview.atXEnd ? 0 : 0.5 - Behavior on opacity { NumberAnimation { duration: 500 } } - } -} diff --git a/examples/quick/demos/clocks/clocks.qmlproject b/examples/quick/demos/clocks/clocks.qmlproject deleted file mode 100644 index b15654600e..0000000000 --- a/examples/quick/demos/clocks/clocks.qmlproject +++ /dev/null @@ -1,8 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "clocks.qml" - QmlFiles { directory: "." } - JavaScriptFiles { directory: "." } - ImageFiles { directory: "." } -} diff --git a/examples/quick/demos/clocks/clocks.qrc b/examples/quick/demos/clocks/clocks.qrc deleted file mode 100644 index eaff4729ae..0000000000 --- a/examples/quick/demos/clocks/clocks.qrc +++ /dev/null @@ -1,15 +0,0 @@ -<RCC> - <qresource prefix="/demos/clocks"> - <file>clocks.qml</file> - <file>content/arrow.png</file> - <file>content/background.png</file> - <file>content/center.png</file> - <file>content/clock-night.png</file> - <file>content/clock.png</file> - <file>content/Clock.qml</file> - <file>content/hour.png</file> - <file>content/minute.png</file> - <file>content/quit.png</file> - <file>content/second.png</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/clocks/content/Clock.qml b/examples/quick/demos/clocks/content/Clock.qml deleted file mode 100644 index 9e6ed16c80..0000000000 --- a/examples/quick/demos/clocks/content/Clock.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id : clock - width: { - if (ListView.view && ListView.view.width >= 200) - return ListView.view.width / Math.floor(ListView.view.width / 200.0); - else - return 200; - } - - height: { - if (ListView.view && ListView.view.height >= 240) - return ListView.view.height; - else - return 240; - } - - property alias city: cityLabel.text - property int hours - property int minutes - property int seconds - property real shift - property bool night: false - property bool internationalTime: true //Unset for local time - - function timeChanged() { - var date = new Date; - hours = internationalTime ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours() - night = ( hours < 7 || hours > 19 ) - minutes = internationalTime ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() - seconds = date.getUTCSeconds(); - } - - Timer { - interval: 100; running: true; repeat: true; - onTriggered: clock.timeChanged() - } - - Item { - anchors.centerIn: parent - width: 200; height: 240 - - Image { id: background; source: "clock.png"; visible: clock.night == false } - Image { source: "clock-night.png"; visible: clock.night == true } - - - Image { - x: 92.5; y: 27 - source: "hour.png" - transform: Rotation { - id: hourRotation - origin.x: 7.5; origin.y: 73; - angle: (clock.hours * 30) + (clock.minutes * 0.5) - Behavior on angle { - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - } - } - - Image { - x: 93.5; y: 17 - source: "minute.png" - transform: Rotation { - id: minuteRotation - origin.x: 6.5; origin.y: 83; - angle: clock.minutes * 6 - Behavior on angle { - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - } - } - - Image { - x: 97.5; y: 20 - source: "second.png" - transform: Rotation { - id: secondRotation - origin.x: 2.5; origin.y: 80; - angle: clock.seconds * 6 - Behavior on angle { - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - } - } - - Image { - anchors.centerIn: background; source: "center.png" - } - - Text { - id: cityLabel - y: 210; anchors.horizontalCenter: parent.horizontalCenter - color: "white" - font.family: "Helvetica" - font.bold: true; font.pixelSize: 16 - style: Text.Raised; styleColor: "black" - } - } -} diff --git a/examples/quick/demos/clocks/content/arrow.png b/examples/quick/demos/clocks/content/arrow.png Binary files differdeleted file mode 100644 index e437312217..0000000000 --- a/examples/quick/demos/clocks/content/arrow.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/background.png b/examples/quick/demos/clocks/content/background.png Binary files differdeleted file mode 100644 index a885950862..0000000000 --- a/examples/quick/demos/clocks/content/background.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/center.png b/examples/quick/demos/clocks/content/center.png Binary files differdeleted file mode 100644 index 7fbd802a44..0000000000 --- a/examples/quick/demos/clocks/content/center.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/clock-night.png b/examples/quick/demos/clocks/content/clock-night.png Binary files differdeleted file mode 100644 index cc7151a397..0000000000 --- a/examples/quick/demos/clocks/content/clock-night.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/clock.png b/examples/quick/demos/clocks/content/clock.png Binary files differdeleted file mode 100644 index 462edacc0e..0000000000 --- a/examples/quick/demos/clocks/content/clock.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/hour.png b/examples/quick/demos/clocks/content/hour.png Binary files differdeleted file mode 100644 index 9f33fc5d48..0000000000 --- a/examples/quick/demos/clocks/content/hour.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/minute.png b/examples/quick/demos/clocks/content/minute.png Binary files differdeleted file mode 100644 index e2f216c897..0000000000 --- a/examples/quick/demos/clocks/content/minute.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/quit.png b/examples/quick/demos/clocks/content/quit.png Binary files differdeleted file mode 100644 index b822057d4e..0000000000 --- a/examples/quick/demos/clocks/content/quit.png +++ /dev/null diff --git a/examples/quick/demos/clocks/content/second.png b/examples/quick/demos/clocks/content/second.png Binary files differdeleted file mode 100644 index d95d99e83d..0000000000 --- a/examples/quick/demos/clocks/content/second.png +++ /dev/null diff --git a/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png b/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png Binary files differdeleted file mode 100644 index 94b641d891..0000000000 --- a/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png +++ /dev/null diff --git a/examples/quick/demos/clocks/doc/src/clocks.qdoc b/examples/quick/demos/clocks/doc/src/clocks.qdoc deleted file mode 100644 index b5bd446cd3..0000000000 --- a/examples/quick/demos/clocks/doc/src/clocks.qdoc +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Clocks - \ingroup qtquickdemos - \example demos/clocks - \brief A QML clock application that demonstrates using a ListView type to - display data generated by a ListModel and a SpringAnimation type to animate - images. - \image qtquick-demo-clocks-small.png - - \e Clocks demonstrates using a ListView type to display data generated by a - ListModel. The delegate used by the model is specified as a custom QML type - that is specified in the Clock.qml file. - - JavaScript methods are used to fetch the current time in several cities in - different time zones and QML types are used to display the time on a clock - face with animated clock hands. - - \include examples-run.qdocinc - - \section1 Displaying Data Generated by List Models - - In the clocks.qml file, we use a \l Rectangle type to create the application - main window: - - \quotefromfile demos/clocks/clocks.qml - \skipto Rectangle - \printuntil color - - We use a ListView type to display a list of the items provided by a - ListModel type: - - \printuntil Los Angeles - \printuntil } - \printuntil } - - List elements are defined like other QML types except that they contain a - collection of \e role definitions instead of properties. Roles both define - how the data is accessed and include the data itself. - - For each list element, we use the \c cityName role to specify the name of a - city and the \c timeShift role to specify a time zone as a positive or - negative offset from UTC (coordinated universal time). - - The Clock custom type is used as the ListView's \c delegate, defining the - visual appearance of list items. To use the Clock type, we add an import - statement that imports the folder called \c content where the type is - located: - - \quotefromfile demos/clocks/clocks.qml - \skipto content - \printuntil " - - We use an \l Image type to display arrows that indicate whether users can - flick the view to see more clocks on the left or right: - - \quotefromfile demos/clocks/clocks.qml - \skipto Image - \printuntil /^\}/ - - We use the \c opacity property to hide the arrows when the list view is - located at the beginning or end of the x axis. - - In Clock.qml, we define a \c timeChanged() function in which we use - methods from the JavaScript \c Date object to fetch the current time in - UTC and to adjust it to the correct time zone: - - \quotefromfile demos/clocks/content/Clock.qml - \skipto timeChanged - \printuntil } - - We use a \l Timer type to update the time at intervals of 100 milliseconds: - - \printuntil } - - We use \l Image types within an \l Item type to display the time on an - analog clock face. Different images are used for daytime and nighttime - hours: - - \printuntil clock-night.png - - A \l Rotation transform applied to \l Image types provides a way to rotate - the clock hands. The \c origin property holds the point that stays fixed - relative to the parent as the rest of the item rotates. The \c angle - property determines the angle to rotate the hands in degrees clockwise. - - \printuntil center.png - \printuntil } - - We use a \l Behavior type on the \c angle property to apply a - SpringAnimation when the time changes. The \c spring and \c damping - properties enable the spring-like motion of the clock hands, and a - \c modulus of \c 360 makes the animation target values wrap around at a - full circle. - - We use a \l Text type to display the city name below the clock: - - \printuntil } - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/clocks/main.cpp b/examples/quick/demos/clocks/main.cpp deleted file mode 100644 index dd642fc24f..0000000000 --- a/examples/quick/demos/clocks/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/clocks/clocks) diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro deleted file mode 100644 index 0644b81a22..0000000000 --- a/examples/quick/demos/demos.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = samegame \ - calqlatr \ - clocks \ - tweetsearch \ - maroon \ - photosurface \ - stocqt - -qtHaveModule(xmlpatterns): SUBDIRS += rssnews photoviewer - diff --git a/examples/quick/demos/maroon/content/BuildButton.qml b/examples/quick/demos/maroon/content/BuildButton.qml deleted file mode 100644 index b44b158d78..0000000000 --- a/examples/quick/demos/maroon/content/BuildButton.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "logic.js" as Logic - -Item { - id: container - width: 64 - height: 64 - property alias source: img.source - property int index - property int row: 0 - property int col: 0 - property int towerType - property bool canBuild: true - property Item gameCanvas: parent.parent.parent - signal clicked() - - Image { - id: img - opacity: (canBuild && gameCanvas.coins >= Logic.towerData[towerType-1].cost) ? 1.0 : 0.4 - } - Text { - anchors.right: parent.right - font.pointSize: 14 - font.bold: true - color: "#ffffff" - text: Logic.towerData[towerType - 1].cost - } - MouseArea { - anchors.fill: parent - onClicked: { - Logic.buildTower(towerType, col, row) - container.clicked() - } - } - Image { - visible: col == index && row != 0 - source: "gfx/dialog-pointer.png" - anchors.top: parent.bottom - anchors.topMargin: 4 - anchors.horizontalCenter: parent.horizontalCenter - } - Image { - visible: col == index && row == 0 - source: "gfx/dialog-pointer.png" - rotation: 180 - anchors.bottom: parent.top - anchors.bottomMargin: 6 - anchors.horizontalCenter: parent.horizontalCenter - } -} diff --git a/examples/quick/demos/maroon/content/GameCanvas.qml b/examples/quick/demos/maroon/content/GameCanvas.qml deleted file mode 100644 index e461a3aaf1..0000000000 --- a/examples/quick/demos/maroon/content/GameCanvas.qml +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "logic.js" as Logic -import "towers" as Towers - -Item { - id: grid - - property int squareSize: 64 - property int rows: 6 - property int cols: 4 - property Item canvas: grid - property int score: 0 - property int coins: 100 - property int lives: 3 - property int waveNumber: 0 - property int waveProgress: 0 - property var towers - property var mobs - property bool gameRunning: false - property bool gameOver: false - property bool errored: false - property string errorString: "" - - width: cols * squareSize - height: rows * squareSize - - function freshState() { - lives = 3 - coins = 100 - score = 0 - waveNumber = 0 - waveProgress = 0 - gameOver = false - gameRunning = false - towerMenu.shown = false - helpButton.comeBack(); - } - - Text { - id: errorText // Mostly for debug purposes - text: errorString - visible: errored - color: "red" - font.pixelSize: 18 - wrapMode: Text.WordWrap - width: parent.width / 1.2 - height: parent.height / 1.2 - anchors.centerIn: parent - z: 1000 - } - - Timer { - interval: 16 - running: true - repeat: true - onTriggered: Logic.tick() - } - - MouseArea { - id: ma - anchors.fill: parent - onClicked: { - if (towerMenu.visible) - towerMenu.finish() - else - towerMenu.open(mouse.x, mouse.y) - } - } - - Image { - id: towerMenu - visible: false - z: 1500 - scale: 0.9 - opacity: 0.7 - property int dragDistance: 16 - property int targetRow: 0 - property int targetCol: 0 - property bool shown: false - property bool towerExists: false - - function finish() { - shown = false - } - - function open(xp,yp) { - if (!grid.gameRunning) - return - targetRow = Logic.row(yp) - targetCol = Logic.col(xp) - if (targetRow == 0) - towerMenu.y = (targetRow + 1) * grid.squareSize - else - towerMenu.y = (targetRow - 1) * grid.squareSize - towerExists = (grid.towers[Logic.towerIdx(targetCol, targetRow)] != null) - shown = true - helpButton.goAway(); - } - - states: State { - name: "shown"; when: towerMenu.shown && !grid.gameOver - PropertyChanges { target: towerMenu; visible: true; scale: 1; opacity: 1 } - } - - transitions: Transition { - PropertyAction { property: "visible" } - NumberAnimation { properties: "opacity,scale"; duration: 500; easing.type: Easing.OutElastic } - } - - x: -32 - source: "gfx/dialog.png" - Row { - id: buttonRow - height: 100 - anchors.centerIn: parent - spacing: 8 - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 1; index: 0 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-melee.png" - onClicked: towerMenu.finish() - } - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 2; index: 1 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-shooter.png" - onClicked: towerMenu.finish() - } - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 3; index: 2 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-bomb.png" - onClicked: towerMenu.finish() - } - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 4; index: 3 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-factory.png" - onClicked: towerMenu.finish() - } - } - } - - - Keys.onPressed: { // Cheat Codes while Testing - if (event.key == Qt.Key_Up && (event.modifiers & Qt.ShiftModifier)) - grid.coins += 10; - if (event.key == Qt.Key_Left && (event.modifiers & Qt.ShiftModifier)) - grid.lives += 1; - if (event.key == Qt.Key_Down && (event.modifiers & Qt.ShiftModifier)) - Logic.gameState.waveProgress += 1000; - if (event.key == Qt.Key_Right && (event.modifiers & Qt.ShiftModifier)) - Logic.endGame(); - } - - Image { - id: helpButton - z: 1010 - source: "gfx/button-help.png" - function goAway() { - helpMA.enabled = false; - helpButton.opacity = 0; - } - function comeBack() { - helpMA.enabled = true; - helpButton.opacity = 1; - } - Behavior on opacity { NumberAnimation {} } - MouseArea { - id: helpMA - anchors.fill: parent - onClicked: {helpImage.visible = true; helpButton.visible = false;} - } - - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - } - - Image { - id: helpImage - z: 1010 - source: "gfx/help.png" - anchors.fill: parent - visible: false - MouseArea { - anchors.fill: parent - onClicked: helpImage.visible = false; - } - } - -} diff --git a/examples/quick/demos/maroon/content/GameOverScreen.qml b/examples/quick/demos/maroon/content/GameOverScreen.qml deleted file mode 100644 index db045ba760..0000000000 --- a/examples/quick/demos/maroon/content/GameOverScreen.qml +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "logic.js" as Logic - -Item { - id: gameOverScreen - width: 320 - height: 400 - property GameCanvas gameCanvas - - Image { - id: img - source: "gfx/text-gameover.png" - anchors.centerIn: parent - } - - ParticleSystem { - anchors.fill: parent - ImageParticle { - id: cloud - source: "gfx/cloud.png" - alphaVariation: 0.25 - opacity: 0.25 - } - - Wander { - xVariance: 100; - pace: 1; - } - - Emitter { - id: cloudLeft - width: 160 - height: 160 - anchors.right: parent.left - emitRate: 0.5 - lifeSpan: 12000 - velocity: PointDirection{ x: 64; xVariation: 2; yVariation: 2 } - size: 160 - } - - Emitter { - id: cloudRight - width: 160 - height: 160 - anchors.left: parent.right - emitRate: 0.5 - lifeSpan: 12000 - velocity: PointDirection{ x: -64; xVariation: 2; yVariation: 2 } - size: 160 - } - } - - - Text { - visible: gameCanvas != undefined - text: "You saved " + gameCanvas.score + " fishes!" - anchors.top: img.bottom - anchors.topMargin: 12 - anchors.horizontalCenter: parent.horizontalCenter - font.bold: true - color: "#000000" - opacity: 0.5 - } - - Image { - source: "gfx/button-play.png" - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - MouseArea { - anchors.fill: parent - onClicked: gameCanvas.gameOver = false//This will actually trigger the state change in main.qml - } - } -} diff --git a/examples/quick/demos/maroon/content/InfoBar.qml b/examples/quick/demos/maroon/content/InfoBar.qml deleted file mode 100644 index ff5738de51..0000000000 --- a/examples/quick/demos/maroon/content/InfoBar.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - height: childrenRect.height - - // Display the number of lives - Row { - anchors.left: parent.left - anchors.leftMargin: 10 - spacing: 5 - Repeater { - id: rep - model: Math.min(10, canvas.lives) - delegate: Image { source: "gfx/lifes.png" } - } - } - - // Display the number of fishes saved - Row { - anchors.right: points.left - anchors.rightMargin: 20 - spacing: 5 - Image { source: "gfx/scores.png" } - Text { - text: canvas.score - font.bold: true - } - } - - // Display the number of coins - Row { - id: points - anchors.right: parent.right - anchors.rightMargin: 10 - spacing: 5 - Image { source: "gfx/points.png" } - Text { - id: pointsLabel - text: canvas.coins - font.bold: true - } - } -} - diff --git a/examples/quick/demos/maroon/content/NewGameScreen.qml b/examples/quick/demos/maroon/content/NewGameScreen.qml deleted file mode 100644 index f078300d05..0000000000 --- a/examples/quick/demos/maroon/content/NewGameScreen.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -// This is the first screen. -// It shows the logo and emit a startButtonClicked signal -// when the user press the "PLAY" button. - -Item { - id: newGameScreen - width: 320 - height: 480 - - signal startButtonClicked - - Image { - source: "gfx/logo.png" - anchors.top: parent.top - anchors.topMargin: 60 - } - - Image { - source: "gfx/logo-fish.png" - anchors.top: parent.top - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x + 148; to: x + 25; duration: 2000; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 25; to: x + 148; duration: 1600; easing.type: Easing.InOutQuad } - } - SequentialAnimation on anchors.topMargin { - loops: Animation.Infinite - NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "gfx/logo-bubble.png" - anchors.top: parent.top - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x + 140; to: x + 40; duration: 2000; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 40; to: x + 140; duration: 1600; easing.type: Easing.InOutQuad } - } - SequentialAnimation on anchors.topMargin { - loops: Animation.Infinite - NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: 140; to: 160; duration: 1000; easing.type: Easing.InOutQuad } - NumberAnimation { from: 160; to: 140; duration: 800; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: 150; to: 140; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: 140; to: 150; duration: 1000; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "gfx/button-play.png" - anchors.bottom: parent.bottom - anchors.bottomMargin: 60 - MouseArea { - anchors.fill: parent - onClicked: newGameScreen.startButtonClicked() - } - } -} diff --git a/examples/quick/demos/maroon/content/SoundEffect.qml b/examples/quick/demos/maroon/content/SoundEffect.qml deleted file mode 100644 index 136b33aa9b..0000000000 --- a/examples/quick/demos/maroon/content/SoundEffect.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -//Proxies a SoundEffect if QtMultimedia is installed -Item { - id: container - property QtObject effect: Qt.createQmlObject("import QtMultimedia 5.0; SoundEffect{ source: '" + container.source + "'; muted: !Qt.application.active }", container); - property url source: "" - onSourceChanged: if (effect != null) effect.source = source; - function play() { - if (effect != null) - effect.play(); - } -} diff --git a/examples/quick/demos/maroon/content/audio/bomb-action.wav b/examples/quick/demos/maroon/content/audio/bomb-action.wav Binary files differdeleted file mode 100644 index b334dc1e5b..0000000000 --- a/examples/quick/demos/maroon/content/audio/bomb-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/catch-action.wav b/examples/quick/demos/maroon/content/audio/catch-action.wav Binary files differdeleted file mode 100644 index 3e22124abf..0000000000 --- a/examples/quick/demos/maroon/content/audio/catch-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/catch.wav b/examples/quick/demos/maroon/content/audio/catch.wav Binary files differdeleted file mode 100644 index d3eade87f8..0000000000 --- a/examples/quick/demos/maroon/content/audio/catch.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/currency.wav b/examples/quick/demos/maroon/content/audio/currency.wav Binary files differdeleted file mode 100644 index 0d9ef2c200..0000000000 --- a/examples/quick/demos/maroon/content/audio/currency.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/factory-action.wav b/examples/quick/demos/maroon/content/audio/factory-action.wav Binary files differdeleted file mode 100644 index a2ace6c221..0000000000 --- a/examples/quick/demos/maroon/content/audio/factory-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/melee-action.wav b/examples/quick/demos/maroon/content/audio/melee-action.wav Binary files differdeleted file mode 100644 index d325af4700..0000000000 --- a/examples/quick/demos/maroon/content/audio/melee-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/projectile-action.wav b/examples/quick/demos/maroon/content/audio/projectile-action.wav Binary files differdeleted file mode 100644 index 4e2284fceb..0000000000 --- a/examples/quick/demos/maroon/content/audio/projectile-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/shooter-action.wav b/examples/quick/demos/maroon/content/audio/shooter-action.wav Binary files differdeleted file mode 100644 index 3e12b9419a..0000000000 --- a/examples/quick/demos/maroon/content/audio/shooter-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/background.png b/examples/quick/demos/maroon/content/gfx/background.png Binary files differdeleted file mode 100644 index d548b9314e..0000000000 --- a/examples/quick/demos/maroon/content/gfx/background.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/bomb-action.png b/examples/quick/demos/maroon/content/gfx/bomb-action.png Binary files differdeleted file mode 100644 index 42da5d789f..0000000000 --- a/examples/quick/demos/maroon/content/gfx/bomb-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/bomb-idle.png b/examples/quick/demos/maroon/content/gfx/bomb-idle.png Binary files differdeleted file mode 100644 index 3bd62e261d..0000000000 --- a/examples/quick/demos/maroon/content/gfx/bomb-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/bomb.png b/examples/quick/demos/maroon/content/gfx/bomb.png Binary files differdeleted file mode 100644 index 380da7d1a5..0000000000 --- a/examples/quick/demos/maroon/content/gfx/bomb.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/button-help.png b/examples/quick/demos/maroon/content/gfx/button-help.png Binary files differdeleted file mode 100644 index aecebc1275..0000000000 --- a/examples/quick/demos/maroon/content/gfx/button-help.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/button-play.png b/examples/quick/demos/maroon/content/gfx/button-play.png Binary files differdeleted file mode 100644 index 6cdad6c845..0000000000 --- a/examples/quick/demos/maroon/content/gfx/button-play.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/catch-action.png b/examples/quick/demos/maroon/content/gfx/catch-action.png Binary files differdeleted file mode 100644 index 78ca9fe1cc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/catch-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/catch.png b/examples/quick/demos/maroon/content/gfx/catch.png Binary files differdeleted file mode 100644 index b7620fe3de..0000000000 --- a/examples/quick/demos/maroon/content/gfx/catch.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/cloud.png b/examples/quick/demos/maroon/content/gfx/cloud.png Binary files differdeleted file mode 100644 index d7c35f8555..0000000000 --- a/examples/quick/demos/maroon/content/gfx/cloud.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/currency.png b/examples/quick/demos/maroon/content/gfx/currency.png Binary files differdeleted file mode 100644 index 1571341f6c..0000000000 --- a/examples/quick/demos/maroon/content/gfx/currency.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-bomb.png b/examples/quick/demos/maroon/content/gfx/dialog-bomb.png Binary files differdeleted file mode 100644 index 708d916ad7..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-bomb.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-factory.png b/examples/quick/demos/maroon/content/gfx/dialog-factory.png Binary files differdeleted file mode 100644 index d2e2a48e31..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-factory.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-melee.png b/examples/quick/demos/maroon/content/gfx/dialog-melee.png Binary files differdeleted file mode 100644 index 069d18d477..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-melee.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-pointer.png b/examples/quick/demos/maroon/content/gfx/dialog-pointer.png Binary files differdeleted file mode 100644 index 9b51a090f9..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-pointer.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-shooter.png b/examples/quick/demos/maroon/content/gfx/dialog-shooter.png Binary files differdeleted file mode 100644 index af980caabd..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-shooter.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog.png b/examples/quick/demos/maroon/content/gfx/dialog.png Binary files differdeleted file mode 100644 index d528ba78d1..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/factory-action.png b/examples/quick/demos/maroon/content/gfx/factory-action.png Binary files differdeleted file mode 100644 index 8981678267..0000000000 --- a/examples/quick/demos/maroon/content/gfx/factory-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/factory-idle.png b/examples/quick/demos/maroon/content/gfx/factory-idle.png Binary files differdeleted file mode 100644 index a145582c8f..0000000000 --- a/examples/quick/demos/maroon/content/gfx/factory-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/factory.png b/examples/quick/demos/maroon/content/gfx/factory.png Binary files differdeleted file mode 100644 index bfb9f3fb79..0000000000 --- a/examples/quick/demos/maroon/content/gfx/factory.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/grid.png b/examples/quick/demos/maroon/content/gfx/grid.png Binary files differdeleted file mode 100644 index b59555247a..0000000000 --- a/examples/quick/demos/maroon/content/gfx/grid.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/help.png b/examples/quick/demos/maroon/content/gfx/help.png Binary files differdeleted file mode 100644 index 4654e4c69b..0000000000 --- a/examples/quick/demos/maroon/content/gfx/help.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/lifes.png b/examples/quick/demos/maroon/content/gfx/lifes.png Binary files differdeleted file mode 100644 index 135310b38c..0000000000 --- a/examples/quick/demos/maroon/content/gfx/lifes.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/logo-bubble.png b/examples/quick/demos/maroon/content/gfx/logo-bubble.png Binary files differdeleted file mode 100644 index 136151caff..0000000000 --- a/examples/quick/demos/maroon/content/gfx/logo-bubble.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/logo-fish.png b/examples/quick/demos/maroon/content/gfx/logo-fish.png Binary files differdeleted file mode 100644 index c41833a0c9..0000000000 --- a/examples/quick/demos/maroon/content/gfx/logo-fish.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/logo.png b/examples/quick/demos/maroon/content/gfx/logo.png Binary files differdeleted file mode 100644 index 787ac99ce8..0000000000 --- a/examples/quick/demos/maroon/content/gfx/logo.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/melee-action.png b/examples/quick/demos/maroon/content/gfx/melee-action.png Binary files differdeleted file mode 100644 index c53873bfcc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/melee-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/melee-idle.png b/examples/quick/demos/maroon/content/gfx/melee-idle.png Binary files differdeleted file mode 100644 index 621d9dff54..0000000000 --- a/examples/quick/demos/maroon/content/gfx/melee-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/melee.png b/examples/quick/demos/maroon/content/gfx/melee.png Binary files differdeleted file mode 100644 index ab240151f3..0000000000 --- a/examples/quick/demos/maroon/content/gfx/melee.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/mob-idle.png b/examples/quick/demos/maroon/content/gfx/mob-idle.png Binary files differdeleted file mode 100644 index dedacc7866..0000000000 --- a/examples/quick/demos/maroon/content/gfx/mob-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/mob.png b/examples/quick/demos/maroon/content/gfx/mob.png Binary files differdeleted file mode 100644 index 7569c3525a..0000000000 --- a/examples/quick/demos/maroon/content/gfx/mob.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/points.png b/examples/quick/demos/maroon/content/gfx/points.png Binary files differdeleted file mode 100644 index 1d2386dbe7..0000000000 --- a/examples/quick/demos/maroon/content/gfx/points.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/projectile-action.png b/examples/quick/demos/maroon/content/gfx/projectile-action.png Binary files differdeleted file mode 100644 index aa2e650aeb..0000000000 --- a/examples/quick/demos/maroon/content/gfx/projectile-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/projectile.png b/examples/quick/demos/maroon/content/gfx/projectile.png Binary files differdeleted file mode 100644 index c25a0c3890..0000000000 --- a/examples/quick/demos/maroon/content/gfx/projectile.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/scores.png b/examples/quick/demos/maroon/content/gfx/scores.png Binary files differdeleted file mode 100644 index af757fe64a..0000000000 --- a/examples/quick/demos/maroon/content/gfx/scores.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/shooter-action.png b/examples/quick/demos/maroon/content/gfx/shooter-action.png Binary files differdeleted file mode 100644 index 08e7e300ca..0000000000 --- a/examples/quick/demos/maroon/content/gfx/shooter-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/shooter-idle.png b/examples/quick/demos/maroon/content/gfx/shooter-idle.png Binary files differdeleted file mode 100644 index 663098d3b0..0000000000 --- a/examples/quick/demos/maroon/content/gfx/shooter-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/shooter.png b/examples/quick/demos/maroon/content/gfx/shooter.png Binary files differdeleted file mode 100644 index d44401e055..0000000000 --- a/examples/quick/demos/maroon/content/gfx/shooter.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/sunlight.png b/examples/quick/demos/maroon/content/gfx/sunlight.png Binary files differdeleted file mode 100644 index d1c7042117..0000000000 --- a/examples/quick/demos/maroon/content/gfx/sunlight.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-1.png b/examples/quick/demos/maroon/content/gfx/text-1.png Binary files differdeleted file mode 100644 index 3ea399cc90..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-1.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-2.png b/examples/quick/demos/maroon/content/gfx/text-2.png Binary files differdeleted file mode 100644 index 934a481f3b..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-2.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-3.png b/examples/quick/demos/maroon/content/gfx/text-3.png Binary files differdeleted file mode 100644 index 47523f55b8..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-3.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-blank.png b/examples/quick/demos/maroon/content/gfx/text-blank.png Binary files differdeleted file mode 100644 index 4a687b24dc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-blank.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-gameover.png b/examples/quick/demos/maroon/content/gfx/text-gameover.png Binary files differdeleted file mode 100644 index 4f53ef0b29..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-gameover.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-go.png b/examples/quick/demos/maroon/content/gfx/text-go.png Binary files differdeleted file mode 100644 index bfc26f71fc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-go.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/wave.png b/examples/quick/demos/maroon/content/gfx/wave.png Binary files differdeleted file mode 100644 index f97426c4e7..0000000000 --- a/examples/quick/demos/maroon/content/gfx/wave.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/logic.js b/examples/quick/demos/maroon/content/logic.js deleted file mode 100644 index 7e087d8be4..0000000000 --- a/examples/quick/demos/maroon/content/logic.js +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -.pragma library // Shared game state -.import QtQuick 2.0 as QQ - -// Game Stuff -var gameState // Local reference -function getGameState() { return gameState; } - -var towerData = [ // Name and cost, stats are in the delegate per instance - { "name": "Melee", "cost": 20 }, - { "name": "Ranged", "cost": 50 }, - { "name": "Bomb", "cost": 75 }, - { "name": "Factory", "cost": 25 } -] - -var waveBaseData = [300, 290, 280, 270, 220, 180, 160, 80, 80, 80, 30, 30, 30, 30]; -var waveData = []; - -var towerComponents = new Array(towerData.length); -var mobComponent = Qt.createComponent("mobs/MobBase.qml"); - -function endGame() -{ - gameState.gameRunning = false; - gameState.gameOver = true; - for (var i = 0; i < gameState.cols; i++) { - for (var j = 0; j < gameState.rows; j++) { - if (gameState.towers[towerIdx(i, j)]) { - gameState.towers[towerIdx(i, j)].destroy(); - gameState.towers[towerIdx(i, j)] = null; - } - } - for (var j in gameState.mobs[i]) - gameState.mobs[i][j].destroy(); - gameState.mobs[i].splice(0,gameState.mobs[i].length); //Leaves queue reusable - } -} - -function startGame(gameCanvas) -{ - waveData = new Array(); - for (var i in waveBaseData) - waveData[i] = waveBaseData[i]; - gameState.freshState(); - for (var i = 0; i < gameCanvas.cols; i++) { - for (var j = 0; j < gameCanvas.rows; j++) - gameState.towers[towerIdx(i, j)] = null; - gameState.mobs[i] = new Array(); - } - gameState.towers[towerIdx(0, 0)] = newTower(3, 0, 0);//Start with a starfish in the corner - gameState.gameRunning = true; - gameState.gameOver = false; -} - -function newGameState(gameCanvas) -{ - for (var i = 0; i < towerComponents.length; i++) { - towerComponents[i] = Qt.createComponent("towers/" + towerData[i].name + ".qml"); - if (towerComponents[i].status == QQ.Component.Error) { - gameCanvas.errored = true; - gameCanvas.errorString += "Loading Tower " + towerData[i].name + "\n" + (towerComponents[i].errorString()); - console.log(towerComponents[i].errorString()); - } - } - gameState = gameCanvas; - gameState.freshState(); - gameState.towers = new Array(gameCanvas.rows * gameCanvas.cols); - gameState.mobs = new Array(gameCanvas.cols); - return gameState; -} - -function row(y) -{ - return Math.floor(y / gameState.squareSize); -} - -function col(x) -{ - return Math.floor(x / gameState.squareSize); -} - -function towerIdx(x, y) -{ - return y + (x * gameState.rows); -} - -function newMob(col) -{ - var ret = mobComponent.createObject(gameState.canvas, - { "col" : col, - "speed" : (Math.min(2.0, 0.10 * (gameState.waveNumber + 1))), - "y" : gameState.canvas.height }); - gameState.mobs[col].push(ret); - return ret; -} - -function newTower(type, row, col) -{ - var ret = towerComponents[type].createObject(gameState.canvas); - ret.row = row; - ret.col = col; - ret.fireCounter = ret.rof; - ret.spawn(); - return ret; -} - -function buildTower(type, x, y) -{ - if (gameState.towers[towerIdx(x,y)] != null) { - if (type <= 0) { - gameState.towers[towerIdx(x,y)].sell(); - gameState.towers[towerIdx(x,y)] = null; - } - } else { - if (gameState.coins < towerData[type - 1].cost) - return; - gameState.towers[towerIdx(x, y)] = newTower(type - 1, y, x); - gameState.coins -= towerData[type - 1].cost; - } -} - -function killMob(col, mob) -{ - if (!mob) - return; - var idx = gameState.mobs[col].indexOf(mob); - if (idx == -1 || !mob.hp) - return; - mob.hp = 0; - mob.die(); - gameState.mobs[col].splice(idx,1); -} - -function killTower(row, col) -{ - var tower = gameState.towers[towerIdx(col, row)]; - if (!tower) - return; - tower.hp = 0; - tower.die(); - gameState.towers[towerIdx(col, row)] = null; -} - -function tick() -{ - if (!gameState.gameRunning) - return; - - // Spawn - gameState.waveProgress += 1; - var i = gameState.waveProgress; - var j = 0; - while (i > 0 && j < waveData.length) - i -= waveData[j++]; - if ( i == 0 ) // Spawn a mob - newMob(Math.floor(Math.random() * gameState.cols)); - if ( j == waveData.length ) { // Next Wave - gameState.waveNumber += 1; - gameState.waveProgress = 0; - var waveModifier = 10; // Constant governing how much faster the next wave is to spawn (not fish speed) - for (var k in waveData ) // Slightly faster - if (waveData[k] > waveModifier) - waveData[k] -= waveModifier; - } - - // Towers Attack - for (var j in gameState.towers) { - var tower = gameState.towers[j]; - if (tower == null) - continue; - if (tower.fireCounter > 0) { - tower.fireCounter -= 1; - continue; - } - var column = tower.col; - for (var k in gameState.mobs[column]) { - var conflict = gameState.mobs[column][k]; - if (conflict.y <= gameState.canvas.height && conflict.y + conflict.height > tower.y - && conflict.y - ((tower.row + 1) * gameState.squareSize) < gameState.squareSize * tower.range) { // In Range - tower.fire(); - tower.fireCounter = tower.rof; - conflict.hit(tower.damage); - } - } - - // Income - if (tower.income) { - gameState.coins += tower.income; - tower.fire(); - tower.fireCounter = tower.rof; - } - } - - // Mobs move - for (var i = 0; i < gameState.cols; i++) { - for (var j = 0; j < gameState.mobs[i].length; j++) { - var mob = gameState.mobs[i][j]; - var newPos = gameState.mobs[i][j].y - gameState.mobs[i][j].speed; - if (newPos < 0) { - gameState.lives -= 1; - killMob(i, mob); - if (gameState.lives <= 0) - endGame(); - continue; - } - var conflict = gameState.towers[towerIdx(i, row(newPos))]; - if (conflict != null) { - if (mob.y < conflict.y + gameState.squareSize) - gameState.mobs[i][j].y += gameState.mobs[i][j].speed * 10; // Moved inside tower, now hurry back out - if (mob.fireCounter > 0) { - mob.fireCounter--; - } else { - gameState.mobs[i][j].fire(); - conflict.hp -= mob.damage; - if (conflict.hp <= 0) - killTower(conflict.row, conflict.col); - mob.fireCounter = mob.rof; - } - } else { - gameState.mobs[i][j].y = newPos; - } - } - } - -} diff --git a/examples/quick/demos/maroon/content/mobs/MobBase.qml b/examples/quick/demos/maroon/content/mobs/MobBase.qml deleted file mode 100644 index b281408c9e..0000000000 --- a/examples/quick/demos/maroon/content/mobs/MobBase.qml +++ /dev/null @@ -1,262 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -Item { - id: container - property string name: "Fish" - property int col: 0 - property real hp: 3 - property real damage: 1 - property real speed: 0.25 - property int rof: 30 //In ticks - property int fireCounter: 0 - property bool dying: false - width: parent ? parent.squareSize : 0 - height: parent ? parent.squareSize : 0 - x: col * width - z: 1001 - function fire() { } - - function die() { - if (dying) - return; - dying = true; - bubble.jumpTo("burst"); - if (fishSprite.currentSprite == "front") - fishSprite.jumpTo(Math.random() > 0.5 ? "left" : "right" ); - fishSwim.start(); - Logic.gameState.score += 1; - killedSound.play(); - bubble.scale = 0.9 - destroy(350); - } - - function inked() { - if (hp > 0) - ink.jumpTo("dirty"); - } - - function hit(dmg) { - hp -= dmg; - - if (hp <= 0) - Logic.killMob(col, container); - } - - Component.onCompleted: spawnSound.play() - - SoundEffect { - id: spawnSound - source: "../audio/catch.wav" - } - SoundEffect { - id: killedSound - source: "../audio/catch-action.wav" - } - - SpriteSequence { - id: fishSprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "left" - source: "../gfx/mob-idle.png" - frameWidth: 64 - frameHeight: 64 - frameCount: 1 - frameDuration: 800 - frameDurationVariation: 400 - to: { "front" : 1 } - } - - Sprite { - name: "front" - source: "../gfx/mob-idle.png" - frameCount: 1 - frameX: 64 - frameWidth: 64 - frameHeight: 64 - frameDuration: 800 - frameDurationVariation: 400 - to: { "left" : 1, "right" : 1 } - } - - Sprite { - name: "right" - source: "../gfx/mob-idle.png" - frameCount: 1 - frameX: 128 - frameWidth: 64 - frameHeight: 64 - frameDuration: 800 - frameDurationVariation: 400 - to: { "front" : 1 } - } - - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - - NumberAnimation on x { - id: fishSwim - running: false - property bool goingLeft: fishSprite.currentSprite == "right" - to: goingLeft ? -360 : 360 - duration: 300 - } - } - - SpriteSequence { - id: bubble - width: 64 - height: 64 - scale: 0.4 + (0.2 * hp) - interpolate: false - goalSprite: "" - - Behavior on scale { - NumberAnimation { duration: 150; easing.type: Easing.OutBack } - } - - Sprite { - name: "big" - source: "../gfx/catch.png" - frameCount: 1 - to: { "burst" : 0 } - } - - Sprite { - name: "burst" - source: "../gfx/catch-action.png" - frameCount: 3 - frameX: 64 - frameDuration: 200 - } - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad } - NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - } - - SpriteSequence { - id: ink - width: 64 - height: 64 - scale: bubble.scale - goalSprite: "" - - Sprite { - name: "clean" - source: "../gfx/projectile-action.png" - frameCount: 1 - frameX: 0 - frameWidth: 64 - frameHeight: 64 - } - Sprite { - name: "dirty" - source: "../gfx/projectile-action.png" - frameCount: 3 - frameX: 64 - frameWidth: 64 - frameHeight: 64 - frameDuration: 150 - to: {"clean":1} - } - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad } - NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x - 5; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x - 5; to: x; duration: 900; easing.type: Easing.InOutQuad } - } -} - diff --git a/examples/quick/demos/maroon/content/towers/Bomb.qml b/examples/quick/demos/maroon/content/towers/Bomb.qml deleted file mode 100644 index 85e0c8e53b..0000000000 --- a/examples/quick/demos/maroon/content/towers/Bomb.qml +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -TowerBase { - id: container - hp: 10 - range: 0.4 - rof: 10 - property real detonationRange: 2.5 - - function fire() { - sound.play() - sprite.jumpTo("shoot") - animDelay.start() - } - - function finishFire() { - var sCol = Math.max(0, col - 1) - var eCol = Math.min(Logic.gameState.cols - 1, col + 1) - var killList = new Array() - for (var i = sCol; i <= eCol; i++) { - for (var j = 0; j < Logic.gameState.mobs[i].length; j++) - if (Math.abs(Logic.gameState.mobs[i][j].y - container.y) < Logic.gameState.squareSize * detonationRange) - killList.push(Logic.gameState.mobs[i][j]) - while (killList.length > 0) - Logic.killMob(i, killList.pop()) - } - Logic.killTower(row, col); - } - - Timer { - id: animDelay - running: false - interval: shootState.frameCount * shootState.frameDuration - onTriggered: finishFire() - } - - function die() - { - destroy() // No blink, because we usually meant to die - } - - SoundEffect { - id: sound - source: "../audio/bomb-action.wav" - } - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/bomb-idle.png" - frameCount: 4 - frameDuration: 800 - } - - Sprite { - id: shootState - name: "shoot" - source: "../gfx/bomb-action.png" - frameCount: 6 - frameDuration: 155 - to: { "dying" : 1 } // So that if it takes a frame to clean up, it is on the last frame of the explosion - } - - Sprite { - name: "dying" - source: "../gfx/bomb-action.png" - frameCount: 1 - frameX: 64 * 5 - frameWidth: 64 - frameHeight: 64 - frameDuration: 155 - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/quick/demos/maroon/content/towers/Factory.qml b/examples/quick/demos/maroon/content/towers/Factory.qml deleted file mode 100644 index 154b12731e..0000000000 --- a/examples/quick/demos/maroon/content/towers/Factory.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -TowerBase { - id: container - rof: 160 - income: 5 - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/factory-idle.png" - frameCount: 4 - frameDuration: 200 - } - - Sprite { - name: "action" - source: "../gfx/factory-action.png" - frameCount: 4 - frameDuration: 90 - to: { "idle" : 1 } - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } - } - } - - SoundEffect { - id: actionSound - source: "../audio/factory-action.wav" - } - - function fire() { - actionSound.play() - sprite.jumpTo("action") - coinLaunch.start() - } - - function spawn() { - coin.target = Logic.gameState.mapToItem(container, 240, -32) - } - - Image { - id: coin - property var target: { "x" : 0, "y" : 0 } - source: "../gfx/currency.png" - visible: false - } - - SequentialAnimation { - id: coinLaunch - PropertyAction { target: coin; property: "visible"; value: true } - ParallelAnimation { - NumberAnimation { target: coin; property: "x"; from: 16; to: coin.target.x } - NumberAnimation { target: coin; property: "y"; from: 16; to: coin.target.y } - } - PropertyAction { target: coin; property: "visible"; value: false } - } -} diff --git a/examples/quick/demos/maroon/content/towers/Melee.qml b/examples/quick/demos/maroon/content/towers/Melee.qml deleted file mode 100644 index ee2621fa2c..0000000000 --- a/examples/quick/demos/maroon/content/towers/Melee.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import ".." - -TowerBase { - hp: 4 - range: 0.1 - damage: 1 - rof: 40 - income: 0 - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameDuration: 250 - } - - Sprite { - name: "shoot" - source: "../gfx/melee-action.png" - frameCount: 2 - frameDuration: 200 - to: { "idle" : 1 } - } - } - - function fire() { - shootSound.play() - sprite.jumpTo("shoot") - } - - SoundEffect { - id: shootSound - source: "../audio/melee-action.wav" - } -} diff --git a/examples/quick/demos/maroon/content/towers/Ranged.qml b/examples/quick/demos/maroon/content/towers/Ranged.qml deleted file mode 100644 index 9a4180f14c..0000000000 --- a/examples/quick/demos/maroon/content/towers/Ranged.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -TowerBase { - id: container - hp: 2 - range: 6 - damage: 0 // By projectile - rof: 40 - income: 0 - property var targetMob - property real realDamage: 1 - function fire() { - proj.x = 32 - proj.width / 2 - proj.y = 0 - targetMob = Logic.gameState.mobs[col][0] - projAnim.to = targetMob.y - container.y -10 - projAnim.start() - shootSound.play() - sprite.jumpTo("shoot") - } - - Image { - id: proj - y: 1000 - SequentialAnimation on y { - id: projAnim - running: false - property real to: 1000 - SmoothedAnimation { - to: projAnim.to - velocity: 400 - } - ScriptAction { - script: { - if (targetMob && targetMob.hit) { - targetMob.hit(realDamage) - targetMob.inked() - projSound.play() - } - } - } - PropertyAction { - value: 1000; - } - } - source: "../gfx/projectile.png" - } - - SoundEffect { - id: shootSound - source: "../audio/shooter-action.wav" - } - SoundEffect { - id: projSound - source: "../audio/projectile-action.wav" - } - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/shooter-idle.png" - frameCount: 4 - frameDuration: 250 - } - - Sprite { - name: "shoot" - source: "../gfx/shooter-action.png" - frameCount: 5 - frameDuration: 90 - to: { "idle" : 1 } - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x - 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/quick/demos/maroon/content/towers/TowerBase.qml b/examples/quick/demos/maroon/content/towers/TowerBase.qml deleted file mode 100644 index 127f2eeec6..0000000000 --- a/examples/quick/demos/maroon/content/towers/TowerBase.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - property real hp: 1 - property real range: 0 - property real damage: 0 - property int rof: 100 - property int fireCounter: 0 - property int income: 0 - property int row: 0 - property int col: 0 - - width: parent ? parent.squareSize : 0 - height: parent ? parent.squareSize : 0 - //This is how it is placed on the gameboard, do not modify/animate the X/Y/Z of a TowerBase please - x: col * width - y: row * height - z: 1000 - - function fire() { } - function spawn() { } //After all game properties are set - function die() { stdDeath.start(); destroy(1000); } - function sell() { destroy(); } - - SequentialAnimation on opacity { - id: stdDeath - running: false - loops: 2 - NumberAnimation { from: 1; to: 0; } - NumberAnimation { from: 0; to: 1; } - } -} diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png Binary files differdeleted file mode 100644 index 6d41179c23..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png Binary files differdeleted file mode 100644 index c8f37486f6..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg Binary files differdeleted file mode 100644 index a83e282d5f..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg Binary files differdeleted file mode 100644 index 8a6063b7c7..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg Binary files differdeleted file mode 100644 index e3e4a2ec89..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg Binary files differdeleted file mode 100644 index ad6b4bf156..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/src/maroon.qdoc b/examples/quick/demos/maroon/doc/src/maroon.qdoc deleted file mode 100644 index 3e38f8cfca..0000000000 --- a/examples/quick/demos/maroon/doc/src/maroon.qdoc +++ /dev/null @@ -1,889 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Maroon in Trouble - \ingroup qtquickdemos - \example demos/maroon - \brief A Qt Quick game for touch devices that uses SpriteSequence, - ParticleSystem, Emitter, and Wander types to animate objects and the SoundEffect type to - play sound effects. - - \image qtquick-demo-maroon-med-2.png - - \e{Maroon in Trouble} demonstrates QML features that are useful when - developing games: - - \list - \li Using custom QML types to create different screens for - different stages of the game. - \li Using the \l Item and \l Image types to construct a game background. - \li Using the SequentialAnimation, NumberAnimation, ParticleSystem, - \l Emitter, and \l Wander types to animate background objects. - \li Using the \l Timer and \l Repeater types to display a countdown - sequence before starting the game. - \li Using a custom QML type with custom properties to construct a game - board. - \li Using the SpriteSequence and \l Sprite types to add animated objects - to the game board. - \li Using a custom QML type that uses the \l Image type with some custom - properties to add a menu where the players can buy objects. - \li Using custom properties with private functions to keep track of game - statistics and a custom QML type to display them to the players. - \li Using the \l State type with JavaScript functions to manage game - states. - \li Using the \l SoundEffect type to play individual sound effects - depending on the object type and the action applied to the object. - \li Using signal handlers to specify keyboard shortcuts for some game - actions. - \li Using resource files to package game resources for deployment and - delivery. - \endlist - - \include examples-run.qdocinc - - \section1 Adding Screens - - In the Maroon in Trouble app, we use the following custom types that - are each defined in a separate .qml file to create the game screens: - - \list - \li NewGameScreen.qml - \li GameCanvas.qml - \li GameOverScreen.qml - \endlist - - To use the custom types, we add an import statement to the main QML file, - maroon.qml that imports the folder called \c content where the types are - located: - - \quotefromfile demos/maroon/maroon.qml - \skipto content - \printuntil " - - We use the screen types at different stages of the game. The NewGameScreen - type is used to create the screen that appears when the players start the - app. In NewGameScreen.qml, we use an \l{Image} type to create a New Game - button that the players can press to start a new game. - - \image qtquick-demo-maroon-med-1.png - - Tapping the button initiates a countdown timer that triggers the creation - of the game canvas by using the GameCanvas type. Another \l{Timer} type - spawns mobs of fish inside bubbles that the players must free before they - reach the surface. The players can tap on the screen to open a menu where - they can buy different types of weapons (melee, ranged, and bombs) to burst - the bubbles. - - \image qtquick-demo-maroon-med-2.png - - When the game finishes, a screen created by using the GameOverScreen type - appears. On this screen, the players can see their score and start a new - game. - - \image qtquick-demo-maroon-med-3.jpg - - The screens are all created on the same background and use some of the same - images and animations. - - \section1 Constructing the Background - - In the maroon.qml file, we use an \l{Item} type with the id \c root and a - fixed width and height to create a main window for the game: - - \skipto Item - \printuntil passedSplash - - We declare two custom properties for the root item, \c gameState and - \c passedSplash that we will use later to manage game states. - - We use an \l{Image} item to display the game background image: - - \printuntil anchors.bottom - - We want to be able to load the background image only once at app startup - and still use different scenes for the game screens. Therefore, - background.png is three times the length of the root item and displays a - scene that stretches from the bottom of sea to the sky above the horizon. - - We use the \c anchors.bottom property to anchor the background image to the - bottom of the \l{Column} layout that we use to position the screens: - - \skipto Column - \printuntil GameOverScreen - - We set a negative value for the \c y property to set the first scene at the - bottom of the sea. We calculate the position by subtracting the height of - a screen from the \c height property. - - Within the column layout, we use an \l{Item} type to add objects to the - background. Within the item, we use \l{Row} layout objects to position - \l{Image} objects that display waves on the game canvas and the game over - screen: - - \printuntil } - \printuntil } - \dots - \skipto Row - \printuntil } - \printuntil } - - The second row of waves is positioned on the y axis with a slight offset to - the first row. We also use the \c opacity property to make the waves appear - lighter in color than the first two waves, which gives the background some - depth. - - We use \l{Image} objects to also display sunlight on the new game screen and - on the game canvas: - - \skipto Image - \printuntil anchors - \dots - \skipto Image - \printuntil anchors - - We set the \c opacity property of the images to \c 0.02 and \c 0.04 to give - some depth to the rays of sunshine. We use the \c y property to position the - images at fixed locations on the y axis and the - \c {anchors.horizontalCenter} property to center them horizontally in - relation to their parent. - - We use an \l {Image} type to display an image that adds a deepening shadow - to the background: - - \skipto Image - \printuntil } - - We set the \c opacity property of the image to \c 0.5 to make the background - visible behind the shadow. - - To make the background more interesting, we animate some of the objects we - added to it. - - \section1 Animating Background Objects - - We use NumberAnimation to move the waves horizontally across the screen in - opposite directions and SequentialAnimation with NumberAnimation to move - them up and down. - - We apply the number animation to the \c x property of \c wave as a property - value source to animate the x value from its current value to the - \c -(wave.width), over 16 seconds. We set the \c loops property to - \c {Animation.Infinite} to repeat the animation indefinitely: - - \quotefromfile demos/maroon/maroon.qml - \skipto wave.width - \printuntil } - - We apply the sequential animation to the \c y property of the image as a - property value source to animate the y value. We use one number animation - to animate the image from the y position of two below the value of y to two - above it, over 1600 milliseconds. We use another number animation to - subsequently animate the image in the opposite direction, again over 1600 - milliseconds. The animation is repeated indefinitely: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - We use the easing curve of the type \c {Easing.InOutQuad} for a quintic - (t^5) function to accelerate the motion until halfway and then decelerate - it. - - We use sequential animation and number animation to animate \c wave2 - similarly to \c wave, but in the opposite direction: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - We use sequential animation to rotate the rays of sunlight in degrees - clockwise around an origin point that we set to \c {Item.Top} in the - \c transformOrigin property. The animation is repeated indefinitely: - - \skipto transformOrigin - \printuntil to: -10 - \printuntil } - - We use one number animation to rotate the image from \c -10 degrees to - \c 10 degrees over 8 seconds and another to subsequently rotate it from - \c 10 degrees to \c -10 degrees over the same duration. - - We use the easing curve of the type \c {Easing.InOutSine} for a sinusoidal - (sin(t)) function to accelerate the motion until halfway and then decelerate - it. - - We use sequential animation and number animation to animate another - sunlight.png image similarly, but in the opposite direction: - - \skipto transformOrigin - \printuntil to: 10 - \printuntil } - - For examples of using SequentialAnimation and NumberAnimation on the \c x - and \c y properties and the \c width and \c height properties, see - NewGameScreen.qml. - - \section1 Emitting Particles - - In addition to animation, we use particles to generate motion on the game - screens. We use the ParticleSystem QML type in maroon.qml to make bubbles - appear at the bottom of the new game screen and game canvas and slowly float - towards the top on varying trajectories. - - To use the ParticleSystem type, we must import \l{Qt Quick Particles QML Types}: - - \quotefromfile demos/maroon/maroon.qml - \skipto Particles - \printuntil 0 - - To have the particles appear on the game background, we place the - ParticleSystem type within the \l{Image} type that displays the game - background: - - \skipto Image - \printuntil anchors.fill - - In the ParticleSystem, we use an \l{Emitter} type to emit particles from the - location of the emitter at the rate of two per second with the life span of - 15 seconds: - - \skipto Emitter - \printuntil sizeVariation - \printuntil } - - The \c acceleration property uses the PointDirection type to - specify random variation of the x and y coordinates, so that the bubbles - appear inside a rectangular area around the emitter that is anchored to the - bottom of the image. - - The \c size property sets the base size of the particles at the beginning of - their life to 24 pixels and the \c sizeVariation property randomly increases - or decreases the particle size by up to 16 pixels, so that we get bubbles in - different sizes. - - As emitters have no visualization, we use the ImageParticle type to render - the catch.png image at the particle location: - - \quotefromfile demos/maroon/maroon.qml - \skipto ImageParticle - \printuntil } - - A \l{Wander} type applies a random trajectory to the particles, so that the - bubbles follow random routes from the bottom to the top. - - \printuntil } - - For another example of using the ParticleSystem type, see the - GameOverScreen.qml file, where an ImageParticle type is used to make clouds - move across the sky. - - \section1 Using Timers - - \image qtquick-demo-maroon-med-4.jpg - - In maroon.qml, we use the \l{Timer} type with a \l{Repeater} type to display - a countdown sequence before using another timer to start a new game. Both - timers are started simultaneously in the \c "gameOn" state, that is when the - players tap the New Game button and \c passedSplash is \c true. This is - explained in more detail in \l{Managing Game States}. - - We use the \c countdownTimer to display the countdown sequence: - - \skipto Timer - \printuntil } - - The \c onTriggered signal handler is called when the timer is triggered to - increment the value of the \c countdown custom property. - - We set the \c repeat property to \c true to specify that the timer is - triggered at the interval of 1 second as long as the value of \c countdown - is less than 5. - - The \c countdown property is defined in the root item with an initial value - of \c 10, so that \c countdownTimer is not running by default: - - \skipto countdown: - \printuntil 10 - - Each time the timer is triggered, an image from the countdown sequence is - displayed. We use a \l{Repeater} type to instantiate the \l{Image} delegate - in the context of the repeater's parent, \c canvasArea item, seeded with - data from the \c model: - - \quotefromfile demos/maroon/maroon.qml - \skipto Repeater - \printuntil scale - \printuntil } - \printuntil } - \printuntil } - \printuntil } - - We scale the images from \c 0.0 to \c 1.0 and use the \c visible property to - hide the images for the previous steps as the countdown progresses. We also - raise the opacity of the image that matches the current countdown step, - keeping the others nearly transparent. - - By animating the changes in the \c opacity and \c scale properties using a - \l Behavior type, we achieve a countdown sequence where numbers zoom in - towards the players. - - \section1 Constructing the Game Board - - To construct the game board, we use the GameCanvas custom type that is - defined in GameCanvas.qml. - - In maroon.qml, we use the GameCanvas type to display the game canvas - at the position of 32 on the x axis and 20 pixels from the bottom of - its parent item, \c canvasArea: - - \quotefromfile demos/maroon/maroon.qml - \skipto GameCanvas - \printuntil } - - We set the \c focus property to \c true to give \c canvas active focus on - startup. - - In GameCanvas.qml, we use an \l Item type and define custom properties for - it to create a grid of equally sized squares divided to 4 columns on 6 rows: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Item - \printuntil canvas - - We use the custom properties to set the \c width and \c height of the - \c grid item as the amount of columns and rows multiplied by square size: - - \skipto width - \printuntil height - - We use an \l{Image} type with a MouseArea type to display a help button - that the players can tap to view an image that contains instructions for - playing the game: - - \skipuntil endGame - \skipto Image - \printuntil bottomMargin - \printuntil } - - We declare the \c goAway() private function to disable the mouse area and - make the image fully transparent and a \c comeBack() function to enable the - mouse area and make the button fully opaque. We use a \l {Behavior} type on - the \c opacity property to apply the default number animation when the value - of \c opacity changes. - - When the players tap the help button, the \c onClicked signal handler is - called to hide the help button by setting the \c {helpButton.visible} - property to \c false and to show the help image by setting the - \c {helpImage.visible} property to \c false. - - \image qtquick-demo-maroon-med-6.jpg - - We use anchoring to position the help button at the bottom center of the - game canvas. - - We use another \l{Image} type to display the help image: - - \printuntil } - \printuntil } - - To hide the help image when the players tap it, the \c onClicked signal - handler within the MouseArea type is called to set the \c{helpImage.visible} - property to \c true. - - To ensure that the images are placed on top when they are visible, we set - a high value for their \c z property. - - The following sections describe how to use timers to add animated objects to - the game board and how to create a menu dialog from which the players can - add more objects to it. - - \section1 Animating Objects on the Game Board - - We use sprite animation to animate objects on the game board. The Qt Quick - \l{Sprite Animations}{sprite engine} is a stochastic state machine combined - with the ability to chop up images containing multiple frames of an - animation. - - \section2 Spawning Fish - - We use a \l{Timer} element with the \c tick() function in GameCanvas.qml to - spawn mobs of fish in waves at an increasing rate, starting at 16 - milliseconds: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Timer - \printuntil } - - We use the MobBase custom type that is defined in MobBase.qml to - animate mobs of fish that swim inside bubbles. We use an \l{Item} type with - custom properties and private functions to create the fish and the bubbles - and to define the actions that can be applied to them: - - \quotefromfile demos/maroon/content/mobs/MobBase.qml - \skipto Item - \printuntil } - \dots - - We use a SpriteSequence type to animate the fish: - - \skipto SpriteSequence - \printuntil goalSprite - - The SpriteSequence type renders and controls a list of animations - defined by \l{Sprite} types: - - \skipto Sprite { - \printuntil name: "right" - \printuntil } - \printuntil } - - In the \c fishSprite sprite sequence, each sprite defines one frame within - the mob-idle.png file, which shows a fish facing right, front, and left: - - \image ../../content/gfx/mob-idle.png - - We use the \c frameWidth, \c frameHeight, and \c frameX properties to - determine that the first 64x64-pixel square of the image is framed in the - \c "left" sprite, the second in the \c "front" sprite, and the third in the - \c "right" sprite. For each sprite, the \c frameCount property is set to - \c 1 to specify that the sprite contains one frame. - - We use the \c frameDuration and \c frameDurationVariation properties to - specify that the duration of an animation can vary from \c 400 to \c 1200 - milliseconds. - - The \c to property specifies that the sprites have weighted transitions to - other sprites. The \c "left" and \c "right" sprites always transfer to the - \c "front" sprite. When the \c "front" animation finishes, the sprite engine - chooses \c "left" or \c "right" randomly, but at roughly equal proportions, - because they both have the weight \c 1. - - When the fish are set free, we want them to swim away in the direction they - are facing until they get off the screen. If they were facing front, we use - the \c jumpTo method with the JavaScript \c {Math.random()} method in the - \c die() private function to randomly jump to the \c "left" or \c "right" - sprite: - - \quotefromfile demos/maroon/content/mobs/MobBase.qml - \skipto die() - \printuntil } - - We then use the \c start() function to run a NumberAnimation that applies a - number animation to the x value from its current value to \c -360 or \c 360, - depending on whether the \c goingLeft custom property is \c true, in 300 - milliseconds: - - \skipto NumberAnimation - \printuntil } - - \section2 Bursting Bubbles - - We use another SpriteSequence to animate the bubbles so that they - become smaller and finally burst when they are attacked by a shooter or - a melee. For this effect, we set the value of the \c scale property to - decrease by \c 0.2 each time the custom \c hp property changes: - - \skipto SpriteSequence - \printuntil goalSprite - - We use a \l{Behavior} type to apply a NumberAnimation when the value of - \c scale changes. We use the \c{Easing.OutBack} easing type for a back - (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out curve that - decelerates the motion to zero velocity in 150 milliseconds: - - \skipto Behavior - \printuntil } - \printuntil } - - The SpriteSequence consist of two sprites that display different images. The - first sprite, \c "big", uses the catch.png image to display an empty bubble: - - \skipto Sprite - \printuntil } - \printuntil } - - We set the \c to property to \c "burst" with the weight \c 0 to make the - second sprite, \c "burst", a valid goal for the \c jumpTo method that we use - in the \c die() private function to jump directly to the \c "burst" sprite - without playing the first sprite. - - In the \c "burst" sprite, we set the \c frameCount property to \c 3 and the - \c frameX property to \c 64 to specify that the animation starts at pixel - location 64 and loads each frame for the duration of 200 milliseconds. - - \skipto Sprite - \printuntil } - - Within the SpriteSequence, we use SequentialAnimation with NumberAnimation - to animate the transitions between the frames. To create a pulsating effect - on the bubbles, we apply a sequential animation on the \c width property - with two number animations to first increase the bubble width from - \c{* 1} to \c{* 1.1} over 800 milliseconds and then bring it back over 1 - second: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - Similarly, we increase the bubble height from \c{* 1} to \c{* 1.15} over - 1200 milliseconds and then bring it back over 1 second: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - We use yet another SpriteSequence to display the effect of squid ink on the - bubbles. For more examples of using sprite sequences, see the QML files in - the \c towers directory. - - \section1 Adding Dialogs - - \image qtquick-demo-maroon-med-5.jpg - - In GameCanvas.qml, we use an \l{Image} type with some custom properties to - create a menu where the players can buy tower objects: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Image - \printuntil towerExists - - We set the \c visible property to \c false to hide the menu by default. The - \c z property is set to 1500 to ensure that the menu is displayed in front - of all other items when it is visible. - - We use a MouseArea type to open or close the menu when players tap on the - canvas: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto MouseArea - \printuntil } - \printuntil } - - We set the \c anchors.fill property to \c parent to allow the players to tap - anywhere on the game canvas. We use a condition in the \c onClicked - signal handler to call the \c {finish()} function if the menu is visible - and the \c {open()} function otherwise. - - The \c {finish()} function hides the menu by setting the \c shown custom - property to \c false: - - \skipto finish - \printuntil } - - The \c {open()} function displays the menu at the x and y position of the - mouse pointer: - - \printuntil } - - If \c gameRunning is \c true, we call the JavaScript \c row() function to - calculate the value of the \c targetRow custom property and the \c col() - function to calculate the value of the \c targetCol custom property. If - the value of \c targetRow equals \c 0, the y position is set to one square - above the mouse pointer. Otherwise, it is set to one square below the mouse - pointer. - - We use the \c towerIdx() function to set the value of the \c towerExists - custom property. - - We set the \c shown custom property to \c true to show the menu and call the - \c {helpButton.goAway()} function to hide the help button when the menu - opens. - - We use states and transitions to display the menu when the \c shown - property is \c true and the \c gameOver property is \c false: - - \printuntil OutElastic - \printuntil } - - To set the visibility of the menu to \c "visible" without animating the - property change, we use a PropertyAction type. We do want to animate the - changes in opacity and scale, though, so we use number animation to - animate the value of the \c scale property from \c 0.9 to \c 1 and the - value of \c opacity property from \c 0.7 to \c 1, over 500 milliseconds. - We use the \c {Easing.outElastic} easing type for an elastic (exponentially - decaying sine wave) function easing curve that decelerates from zero - velocity. - - To construct the menu, we use a BuildButton custom type that is defined in - BuildButton.qml. In GameCanvas.qml, we create one build button for each - tower object that the players can buy and position them in a \l{Row} layout - in front of the menu background image, dialog.png: - - \printuntil dialog-factory.png - \printuntil } - \printuntil } - \printuntil } - - For each build button, we set the values of \c towerType and \c index custom - properties that we define in BuildButton.qml. - - We use the \c canBuild custom property to prevent players from adding tower - objects in locations where tower objects already exist. - - We use the \c source property to display the image for the tower type. - - The \c onClicked signal handler is called to execute the \c finish() - function that closes the menu when the players tap an enabled build button. - - Build buttons are enabled when the players have enough coins to buy the - tower objects. We use an \l {Image} type in BuildButton.qml to display - images on the buttons: - - \quotefromfile demos/maroon/content/BuildButton.qml - \skipto Image - \printuntil } - - We use the \c opacity property to make the buttons appear enabled. If - \c canBuild is \c true and the value of the \c gameCanvas.coins property - is larger than or equal to the cost of a tower object, the images are fully - opaque, otherwise their opacity is set to \c 0.4. - - We use a \l{Text} type to display the cost of each tower item, as specified - by the \c towerData variable, depending on \c towerType: - - \skipto Text - \printuntil } - - To display a pointer on the screen at the position where the tower object - will be added, we use the \l {Image} type. We use the \c visible property - to determine whether the dialog-pointer.png image should be positioned below - or above the menu. When the value of the \c col property equals the \c index - and the value or the \c row property is not \c 0, we anchor the image to the - bottom of its parent, BuildButton. - - When the value or the \c row property is \c 0, we anchor the image to the - top of BuildButton to position the pointer above the menu and use the - \c rotation property to rotate it by 180 degrees, so that it points upwards: - - \skipto Image - \printuntil } - \printuntil } - - \section1 Keeping Track of Game Statistics - - To keep track of the game statistics, we use the InfoBar custom type (that - is defined in InfoBar.qml) in maroon.qml: - - \quotefromfile demos/maroon/maroon.qml - \skipto InfoBar - \printuntil } - - We use the \c {anchors.bottom} and \c {anchors.bottomMargin} properties to - position the info bar at 6 points from the top of the game canvas. We bind - the \c width property of the info bar to that of its parent. - - In InfoBar.qml, we use an \l{Item} type to create the info bar. Within it, - we use a \l{Row} layout type to display the number of lives the players have - left, the number of fish that have been saved, and the amount of coins that - are available for use. - - We use the \c anchors property to position the rows in relationship to their - parent and to each other. In the first \l{Row} object, we use the - \c {anchors.left} and \c {anchors.leftMargin} properties to position the - heart icons at 10 points from the left border of the parent item: - - \quotefromfile demos/maroon/content/InfoBar.qml - \skipto Item - \printuntil } - \printuntil } - \printuntil } - - We use a \l{Repeater} type with a \c model and a \c delegate to display as - many hearts as the players have lives left. We use the \c spacing property - to leave 5 pixels between the displayed icons. - - In the second \l{Row} object, we use the \c {anchors.right} and - \c {anchors.rightMargin} properties to position the number of fish saved at - 20 points left of the third \l{Row} object that displays the number of coins - available (and has the id \c points): - - \skipto Row - \printuntil /^\}/ - - In these objects, we set spacing to 5 pixels to separate the icons from the - numbers that we display by using a \l{Text} type. - - In GameCanvas.qml, we define custom properties to hold the game statistics: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto score - \printuntil lives - - We declare the \c freshState() function to set the initial game statistics - when a new game starts: - - \skipto freshState() - \printuntil } - - We use the \c {Logic.gameState.score} variable in the \c die() function - that we declare in MobBase.qml to increase the score by one when the players - set a fish free: - - \quotefromfile demos/maroon/content/mobs/MobBase.qml - \skipto score - \printuntil ; - - \section1 Managing Game States - - In maroon.qml, we use a \l{State} type and JavaScript to switch between - screens according to the game state. The logic.js file contains definitions - for the functions. To use the functions in a QML file, we import logic.js as - the \c Logic namespace in that file: - - \quotefromfile demos/maroon/maroon.qml - \skipto logic.js - \printuntil Logic - - The base state displays the new game screen when the application starts. - In addition, we call the Component.onCompleted signal handler to initialize - a new game: - - \skipto newGameState - \printuntil ; - - In NewGameScreen.qml we use the \c onClicked signal handler to emit the - \c startButtonClicked() signal when the players tap the New Game button: - - \quotefromfile demos/maroon/content/NewGameScreen.qml - \skipto to: 150 - \skipto Image - \printuntil } - - In maroon.qml, we use the \c onStartButtonClicked signal handler to set the - \c passedSplash property of the \c root item to \c true: - - \quotefromfile demos/maroon/maroon.qml - \skipto NewGameScreen - \printuntil } - - We then use the \c passedSplash property in the \c when property of the - \c gameOn state to trigger the \c gameStarter timer: - - \skipto State { - \printuntil gameStarter - \printuntil } - - We also switch to the \c "gameOn" state and move to the y position - \c {-(height - 960)} to display the game canvas. - - In the \c gameStarter \l{Timer} object we use the \c onTriggered signal - handler to call the \c startGame() function that starts a new game: - - \quotefromfile demos/maroon/maroon.qml - \skipto property int - \skipto Timer - \printuntil } - - The game continues until \c gameState.gameOver is set to \c true and - \c gameState.gameRunning is set to \c false by calling the \c endGame() - function when the value of the \c gameState.lives property becomes less - than or equal to \c 0. - - In GameOverScreen.qml, we use a MouseArea type and an \c onClicked signal - handler within an \l{Image} type to return to the game canvas when the - players tap the New Game button: - - \quotefromfile demos/maroon/content/GameOverScreen.qml - \skipto opacity: 0.5 - \skipto Image - \printuntil } - \printuntil } - - The \c onClicked signal handler triggers a state change in maroon.qml to - display the game canvas: - - \quotefromfile demos/maroon/maroon.qml - \skipto target: gameStarter - \skipto State - \printuntil } - \printuntil } - - \section1 Playing Sound Effects - - The app can play sound effects if the \l{Qt Multimedia} module is installed. - In the SoundEffect.qml file, we proxy a SoundEffect type: - - \quotefromfile demos/maroon/content/SoundEffect.qml - \skipto Item - \printuntil } - \printuntil } - - We add the \c qtHaveModule() qmake command to the app .pro file, maroon.pro, - to check whether the \l{Qt Multimedia} module is present: - - \quotefromfile demos/maroon/maroon.pro - \skipto QT - \printuntil multimedia - - In each QML file that defines a custom type used on the game canvas, we - use a SoundEffect type to specify the audio file to play for that type - of objects. For example, in Bomb.qml, we specify the sound that a bomb - makes when it explodes: - - \quotefromfile demos/maroon/content/towers/Bomb.qml - \skipto SoundEffect - \printuntil } - - To play the sound effect when a bomb explodes, we call the \c sound.play() - function that we declare as a member of the private \c fire() function - within the TowerBase custom type: - - \quotefromfile demos/maroon/content/towers/Bomb.qml - \skipto fire() - \printuntil } - - For more examples of playing sound effects, see the QML files in the - \c towers directory and MobBase.qml. - - \section1 Adding Keyboard Shortcuts - - This is a touch example, so you should not really need to handle key - presses. However, we do not want you to have to spend more time playing the - game than you want to while testing it, so we use the \c {Keys.onPressed} - signal handler to specify keyboard shortcuts. You can press Shift+Up to - increment the values of the \c coins property to add coins, Shift+Left to - increment the value of \c lives, Shift+Down to increment the value of the - \c waveProgress property to spawn mobs of fish faster, and Shift+Right to - call the \c endGame() function to quit the game: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Keys - \printuntil } - - \section1 Packaging Resources for Deployment - - To be able to run the app on mobile devices, we package all QML, JavaScript, - image, and sound files into a Qt resource file (.qrc). For more information, - see \l{The Qt Resource System}. - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/maroon/main.cpp b/examples/quick/demos/maroon/main.cpp deleted file mode 100644 index 7e69e3359e..0000000000 --- a/examples/quick/demos/maroon/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon) diff --git a/examples/quick/demos/maroon/maroon.pro b/examples/quick/demos/maroon/maroon.pro deleted file mode 100644 index ada16d047a..0000000000 --- a/examples/quick/demos/maroon/maroon.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = app - -QT += qml quick -qtHaveModule(multimedia): QT += multimedia -SOURCES += main.cpp -RESOURCES += maroon.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/maroon -INSTALLS += target diff --git a/examples/quick/demos/maroon/maroon.qml b/examples/quick/demos/maroon/maroon.qml deleted file mode 100644 index 2582fd7e74..0000000000 --- a/examples/quick/demos/maroon/maroon.qml +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content" -import "content/logic.js" as Logic - -Item { - id: root - width: 320 - height: 480 - property var gameState - property bool passedSplash: false - - Image { - source:"content/gfx/background.png" - anchors.bottom: view.bottom - - ParticleSystem { - id: particles - anchors.fill: parent - - ImageParticle { - id: bubble - anchors.fill: parent - source: "content/gfx/catch.png" - opacity: 0.25 - } - - Wander { - xVariance: 25; - pace: 25; - } - - Emitter { - width: parent.width - height: 150 - anchors.bottom: parent.bottom - anchors.bottomMargin: 3 - startTime: 15000 - - emitRate: 2 - lifeSpan: 15000 - - acceleration: PointDirection{ y: -6; xVariation: 2; yVariation: 2 } - - size: 24 - sizeVariation: 16 - } - } - } - - Column { - id: view - y: -(height - 480) - width: 320 - - GameOverScreen { gameCanvas: canvas } - - Item { - id: canvasArea - width: 320 - height: 480 - - Row { - height: childrenRect.height - Image { - id: wave - y: 30 - source:"content/gfx/wave.png" - } - Image { - y: 30 - source:"content/gfx/wave.png" - } - NumberAnimation on x { from: 0; to: -(wave.width); duration: 16000; loops: Animation.Infinite } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad } - } - } - - Row { - opacity: 0.5 - Image { - id: wave2 - y: 25 - source: "content/gfx/wave.png" - } - Image { - y: 25 - source: "content/gfx/wave.png" - } - NumberAnimation on x { from: -(wave2.width); to: 0; duration: 32000; loops: Animation.Infinite } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "content/gfx/sunlight.png" - opacity: 0.02 - y: 0 - anchors.horizontalCenter: parent.horizontalCenter - transformOrigin: Item.Top - SequentialAnimation on rotation { - loops: Animation.Infinite - NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine } - NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine } - } - } - - Image { - source: "content/gfx/sunlight.png" - opacity: 0.04 - y: 20 - anchors.horizontalCenter: parent.horizontalCenter - transformOrigin: Item.Top - SequentialAnimation on rotation { - loops: Animation.Infinite - NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine } - NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine } - } - } - - Image { - source: "content/gfx/grid.png" - opacity: 0.5 - } - - GameCanvas { - id: canvas - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 - x: 32 - focus: true - } - - InfoBar { anchors.bottom: canvas.top; anchors.bottomMargin: 6; width: parent.width } - - //3..2..1..go - Timer { - id: countdownTimer - interval: 1000 - running: root.countdown < 5 - repeat: true - onTriggered: root.countdown++ - } - Repeater { - model: ["content/gfx/text-blank.png", "content/gfx/text-3.png", "content/gfx/text-2.png", "content/gfx/text-1.png", "content/gfx/text-go.png"] - delegate: Image { - visible: root.countdown <= index - opacity: root.countdown == index ? 0.5 : 0.1 - scale: root.countdown >= index ? 1.0 : 0.0 - source: modelData - Behavior on opacity { NumberAnimation {} } - Behavior on scale { NumberAnimation {} } - } - } - } - - NewGameScreen { - onStartButtonClicked: root.passedSplash = true - } - } - - property int countdown: 10 - Timer { - id: gameStarter - interval: 4000 - running: false - repeat: false - onTriggered: Logic.startGame(canvas); - } - - states: [ - State { - name: "gameOn"; when: gameState.gameOver == false && passedSplash - PropertyChanges { target: view; y: -(height - 960) } - StateChangeScript { script: root.countdown = 0; } - PropertyChanges { target: gameStarter; running: true } - }, - State { - name: "gameOver"; when: gameState.gameOver == true - PropertyChanges { target: view; y: 0 } - } - ] - - transitions: Transition { - NumberAnimation { properties: "x,y"; duration: 1200; easing.type: Easing.OutQuad } - } - - Component.onCompleted: gameState = Logic.newGameState(canvas); -} diff --git a/examples/quick/demos/maroon/maroon.qmlproject b/examples/quick/demos/maroon/maroon.qmlproject deleted file mode 100644 index 752666114f..0000000000 --- a/examples/quick/demos/maroon/maroon.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "maroon.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/maroon/maroon.qrc b/examples/quick/demos/maroon/maroon.qrc deleted file mode 100644 index 52c2a4e513..0000000000 --- a/examples/quick/demos/maroon/maroon.qrc +++ /dev/null @@ -1,71 +0,0 @@ -<RCC> - <qresource prefix="/demos/maroon"> - <file>maroon.qml</file> - <file>content/BuildButton.qml</file> - <file>content/GameCanvas.qml</file> - <file>content/GameOverScreen.qml</file> - <file>content/InfoBar.qml</file> - <file>content/logic.js</file> - <file>content/NewGameScreen.qml</file> - <file>content/SoundEffect.qml</file> - <file>content/audio/bomb-action.wav</file> - <file>content/audio/catch-action.wav</file> - <file>content/audio/catch.wav</file> - <file>content/audio/currency.wav</file> - <file>content/audio/factory-action.wav</file> - <file>content/audio/melee-action.wav</file> - <file>content/audio/projectile-action.wav</file> - <file>content/audio/shooter-action.wav</file> - <file>content/gfx/background.png</file> - <file>content/gfx/bomb-action.png</file> - <file>content/gfx/bomb-idle.png</file> - <file>content/gfx/bomb.png</file> - <file>content/gfx/button-help.png</file> - <file>content/gfx/button-play.png</file> - <file>content/gfx/catch-action.png</file> - <file>content/gfx/catch.png</file> - <file>content/gfx/cloud.png</file> - <file>content/gfx/currency.png</file> - <file>content/gfx/dialog-bomb.png</file> - <file>content/gfx/dialog-factory.png</file> - <file>content/gfx/dialog-melee.png</file> - <file>content/gfx/dialog-pointer.png</file> - <file>content/gfx/dialog-shooter.png</file> - <file>content/gfx/dialog.png</file> - <file>content/gfx/factory-action.png</file> - <file>content/gfx/factory-idle.png</file> - <file>content/gfx/factory.png</file> - <file>content/gfx/grid.png</file> - <file>content/gfx/help.png</file> - <file>content/gfx/lifes.png</file> - <file>content/gfx/logo-bubble.png</file> - <file>content/gfx/logo-fish.png</file> - <file>content/gfx/logo.png</file> - <file>content/gfx/melee-action.png</file> - <file>content/gfx/melee-idle.png</file> - <file>content/gfx/melee.png</file> - <file>content/gfx/mob-idle.png</file> - <file>content/gfx/mob.png</file> - <file>content/gfx/points.png</file> - <file>content/gfx/projectile-action.png</file> - <file>content/gfx/projectile.png</file> - <file>content/gfx/scores.png</file> - <file>content/gfx/shooter-action.png</file> - <file>content/gfx/shooter-idle.png</file> - <file>content/gfx/shooter.png</file> - <file>content/gfx/sunlight.png</file> - <file>content/gfx/text-1.png</file> - <file>content/gfx/text-2.png</file> - <file>content/gfx/text-3.png</file> - <file>content/gfx/text-blank.png</file> - <file>content/gfx/text-gameover.png</file> - <file>content/gfx/text-go.png</file> - <file>content/gfx/wave.png</file> - <file>content/mobs/MobBase.qml</file> - <file>content/towers/Bomb.qml</file> - <file>content/towers/Factory.qml</file> - <file>content/towers/Melee.qml</file> - <file>content/towers/Ranged.qml</file> - <file>content/towers/TowerBase.qml</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png b/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png Binary files differdeleted file mode 100644 index a0cd823999..0000000000 --- a/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png +++ /dev/null diff --git a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc deleted file mode 100644 index a032d730eb..0000000000 --- a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Photo Surface - \ingroup qtquickdemos - \example demos/photosurface - \brief A QML app for touch devices that uses a Repeater with a - FolderListModel to access content in a folder, and a PinchArea that contains - a MouseArea to handle pinch gestures on the fetched content. - \image qtquick-demo-photosurface-small.png - - \e{Photo Surface} demonstrates how to use a \l{Repeater} with a - FolderListModel and a FileDialog to access images from a folder selected - by a user and how to handle dragging, rotation and pinch zooming within the - same item using a \l PinchArea that contains a \l MouseArea. - - All the app code is contained in one QML file, photosurface.qml. Inline - JavaScript code is used to place, rotate, and scale images on the photo - surface. - - \include examples-run.qdocinc - - \section1 Creating the Main Window - - To create the main window for the Photo Surface app, we use the \l{Window} - QML type as the root item. It automatically sets up the window for use with - \l{Qt Quick} graphical types: - - \quotefromfile demos/photosurface/photosurface.qml - \skipto Window { - \printuntil currentFrame - - To use the \l{Window} type, we must import it: - - \code - import QtQuick.Window 2.1 - \endcode - - \section1 Accessing Folder Contents - - We use a \l{Repeater} QML type together with the FolderListModel to display - GIF, JPG, and PNG images located in a folder: - - \quotefromfile demos/photosurface/photosurface.qml - \skipto Repeater - \printuntil } - - To use the FolderListModel type, we must import it: - - \code - import Qt.labs.folderlistmodel 1.0 - \endcode - - We use a FileDialog to enable users to select the folder that contains - the images: - - \quotefromfile demos/photosurface/photosurface.qml - \skipto FileDialog - \printuntil } - - To use the FileDialog type, we must import \l{Qt Quick Dialogs}: - - \code - import QtQuick.Dialogs 1.0 - \endcode - - We use the \c {fileDialog.open()} function to open the file dialog when the - app starts: - - \code - Component.onCompleted: fileDialog.open() - \endcode - - Users can also click the file dialog icon to open the file dialog. We use - an \l{Image} QML type to display the icon. Inside the \l{Image} type, we - use a MouseArea with the \c onClicked signal handler to call the - \c {fileDialog.open()} function: - - \quotefromfile demos/photosurface/photosurface.qml - \skipuntil Image { - \skipto Image { - \printuntil } - \printuntil } - - \section1 Displaying Images on the Photo Surface - - We use a \l{Rectangle} as a delegate for a \l{Repeater} to provide a frame - for each image that the FolderListModel finds in the selected folder. We use - JavaScript \c Math() methods to place the frames randomly on the photo - surface and to rotate them at random angles, as well as to scale the images: - - \quotefromfile demos/photosurface/photosurface.qml - \skipto Rectangle - \printuntil Component.onCompleted - \printuntil } - - \section1 Handling Pinch Gestures - - We use a PinchArea that contains a MouseArea in the photo frames to handle - dragging, rotation and pinch zooming of the frame: - - \skipto PinchArea - \printuntil onPinchStarted - - We use the \c pinch group property to control how the photo frames react to - pinch gestures. The \c pinch.target sets \c photoFrame as the item to - manipulate. The rotation properties specify that the frames can be rotated - at all angles and the scale properties specify that they can be scaled - between \c 0.1 and \c 10. - - In the MouseArea's \c onPressed signal handler, we raise the selected photo - frame to the top by increasing the value of its \c z property. The root item - stores the z value of the top-most frame. The border color of the photo - frame is controlled in the \c onEntered signal handler to highlight the - selected image: - - \skipto MouseArea - \printuntil onEntered - - To enable you to test the example on the desktop, we use the MouseArea's - \c onWheel signal handler to simulate pinch gestures by using a mouse: - - \printuntil photoFrame.scale - \printuntil } - \printuntil } - - The \c onWheel signal handler is called in response to mouse wheel gestures. - Use the vertical wheel to zoom and Ctrl and the vertical wheel to rotate - frames. If the mouse has a horizontal wheel, use it to rotate frames. - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/photosurface/main.cpp b/examples/quick/demos/photosurface/main.cpp deleted file mode 100644 index b9d093df40..0000000000 --- a/examples/quick/demos/photosurface/main.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifdef QT_WIDGETS_LIB -#include <QtWidgets/QApplication> -#else -#include <QtGui/QGuiApplication> -#endif -#include <QtQml/QQmlApplicationEngine> -#include <QtQml/QQmlContext> -#include <QtQuick/QQuickWindow> -#include <QtGui/QImageReader> -#include <QtCore/QCommandLineParser> -#include <QtCore/QCommandLineOption> -#include <QtCore/QDebug> -#include <QtCore/QDir> -#include <QtCore/QMimeDatabase> -#include <QtCore/QStandardPaths> -#include <QtCore/QUrl> - -static QStringList imageNameFilters() -{ - QStringList result; - QMimeDatabase mimeDatabase; - const auto supportedMimeTypes = QImageReader::supportedMimeTypes(); - for (const QByteArray &m : supportedMimeTypes) { - const auto suffixes = mimeDatabase.mimeTypeForName(m).suffixes(); - for (const QString &suffix : suffixes) - result.append(QLatin1String("*.") + suffix); - } - return result; -} - -int main(int argc, char* argv[]) -{ - // The reason to use QApplication is that QWidget-based dialogs - // are the native dialogs on Qt-based platforms like KDE, - // but they cannot be instantiated if this is a QGuiApplication. -#ifdef QT_WIDGETS_LIB - QApplication app(argc, argv); -#else - QGuiApplication app(argc, argv); -#endif - QQuickWindow::setDefaultAlphaBuffer(true); - - QCoreApplication::setApplicationName(QStringLiteral("Photosurface")); - QCoreApplication::setOrganizationName(QStringLiteral("QtProject")); - QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR)); - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("Qt Quick Demo - Photo Surface")); - parser.addHelpOption(); - parser.addVersionOption(); - parser.addPositionalArgument(QStringLiteral("directory"), - QStringLiteral("The image directory or URL to show.")); - parser.process(app); - - QUrl initialUrl; - if (!parser.positionalArguments().isEmpty()) { - initialUrl = QUrl::fromUserInput(parser.positionalArguments().first(), - QDir::currentPath(), QUrl::AssumeLocalFile); - if (!initialUrl.isValid()) { - qWarning().nospace() << "Invalid argument: \"" - << parser.positionalArguments().first() << "\": " << initialUrl.errorString(); - return 1; - } - } - - const QStringList nameFilters = imageNameFilters(); - - QQmlApplicationEngine engine; - QQmlContext *context = engine.rootContext(); - - QUrl picturesLocationUrl = QUrl::fromLocalFile(QDir::homePath()); - const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); - if (!picturesLocations.isEmpty()) { - picturesLocationUrl = QUrl::fromLocalFile(picturesLocations.first()); - if (initialUrl.isEmpty() - && !QDir(picturesLocations.first()).entryInfoList(nameFilters, QDir::Files).isEmpty()) { - initialUrl = picturesLocationUrl; - } - } - - context->setContextProperty(QStringLiteral("contextPicturesLocation"), picturesLocationUrl); - context->setContextProperty(QStringLiteral("contextInitialUrl"), initialUrl); - context->setContextProperty(QStringLiteral("contextImageNameFilters"), nameFilters); - - engine.load(QUrl("qrc:///photosurface.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - - return app.exec(); -} diff --git a/examples/quick/demos/photosurface/photosurface.pro b/examples/quick/demos/photosurface/photosurface.pro deleted file mode 100644 index 5e5b0f0815..0000000000 --- a/examples/quick/demos/photosurface/photosurface.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app - -QT += qml quick -qtHaveModule(widgets): QT += widgets -SOURCES += main.cpp -RESOURCES += photosurface.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/photosurface -INSTALLS += target -ICON = resources/icon.png -macx: ICON = resources/photosurface.icns -win32: RC_FILE = resources/photosurface.rc - diff --git a/examples/quick/demos/photosurface/photosurface.qml b/examples/quick/demos/photosurface/photosurface.qml deleted file mode 100644 index d8a424e8f8..0000000000 --- a/examples/quick/demos/photosurface/photosurface.qml +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Dialogs 1.0 -import QtQuick.Window 2.1 -import Qt.labs.folderlistmodel 1.0 - -Window { - id: root - visible: true - width: 1024; height: 600 - color: "black" - property int highestZ: 0 - property real defaultSize: 200 - property var currentFrame: undefined - property real surfaceViewportRatio: 1.5 - - FileDialog { - id: fileDialog - title: "Choose a folder with some images" - selectFolder: true - folder: picturesLocation - onAccepted: folderModel.folder = fileUrl + "/" - } - - Flickable { - id: flick - anchors.fill: parent - contentWidth: width * surfaceViewportRatio - contentHeight: height * surfaceViewportRatio - Repeater { - model: FolderListModel { - id: folderModel - objectName: "folderModel" - showDirs: false - nameFilters: imageNameFilters - } - Rectangle { - id: photoFrame - width: image.width * (1 + 0.10 * image.height / image.width) - height: image.height * 1.10 - scale: defaultSize / Math.max(image.sourceSize.width, image.sourceSize.height) - Behavior on scale { NumberAnimation { duration: 200 } } - Behavior on x { NumberAnimation { duration: 200 } } - Behavior on y { NumberAnimation { duration: 200 } } - border.color: "black" - border.width: 2 - smooth: true - antialiasing: true - Component.onCompleted: { - x = Math.random() * root.width - width / 2 - y = Math.random() * root.height - height / 2 - rotation = Math.random() * 13 - 6 - } - Image { - id: image - anchors.centerIn: parent - fillMode: Image.PreserveAspectFit - source: folderModel.folder + fileName - antialiasing: true - } - PinchArea { - anchors.fill: parent - pinch.target: photoFrame - pinch.minimumRotation: -360 - pinch.maximumRotation: 360 - pinch.minimumScale: 0.1 - pinch.maximumScale: 10 - pinch.dragAxis: Pinch.XAndYAxis - onPinchStarted: setFrameColor(); - property real zRestore: 0 - onSmartZoom: { - if (pinch.scale > 0) { - photoFrame.rotation = 0; - photoFrame.scale = Math.min(root.width, root.height) / Math.max(image.sourceSize.width, image.sourceSize.height) * 0.85 - photoFrame.x = flick.contentX + (flick.width - photoFrame.width) / 2 - photoFrame.y = flick.contentY + (flick.height - photoFrame.height) / 2 - zRestore = photoFrame.z - photoFrame.z = ++root.highestZ; - } else { - photoFrame.rotation = pinch.previousAngle - photoFrame.scale = pinch.previousScale - photoFrame.x = pinch.previousCenter.x - photoFrame.width / 2 - photoFrame.y = pinch.previousCenter.y - photoFrame.height / 2 - photoFrame.z = zRestore - --root.highestZ - } - } - - MouseArea { - id: dragArea - hoverEnabled: true - anchors.fill: parent - drag.target: photoFrame - scrollGestureEnabled: false // 2-finger-flick gesture should pass through to the Flickable - onPressed: { - photoFrame.z = ++root.highestZ; - parent.setFrameColor(); - } - onEntered: parent.setFrameColor(); - onWheel: { - if (wheel.modifiers & Qt.ControlModifier) { - photoFrame.rotation += wheel.angleDelta.y / 120 * 5; - if (Math.abs(photoFrame.rotation) < 4) - photoFrame.rotation = 0; - } else { - photoFrame.rotation += wheel.angleDelta.x / 120; - if (Math.abs(photoFrame.rotation) < 0.6) - photoFrame.rotation = 0; - var scaleBefore = photoFrame.scale; - photoFrame.scale += photoFrame.scale * wheel.angleDelta.y / 120 / 10; - } - } - } - function setFrameColor() { - if (currentFrame) - currentFrame.border.color = "black"; - currentFrame = photoFrame; - currentFrame.border.color = "red"; - } - } - } - } - } - - Rectangle { - id: verticalScrollDecorator - anchors.right: parent.right - anchors.margins: 2 - color: "cyan" - border.color: "black" - border.width: 1 - width: 5 - radius: 2 - antialiasing: true - height: flick.height * (flick.height / flick.contentHeight) - (width - anchors.margins) * 2 - y: flick.contentY * (flick.height / flick.contentHeight) - NumberAnimation on opacity { id: vfade; to: 0; duration: 500 } - onYChanged: { opacity = 1.0; scrollFadeTimer.restart() } - } - - Rectangle { - id: horizontalScrollDecorator - anchors.bottom: parent.bottom - anchors.margins: 2 - color: "cyan" - border.color: "black" - border.width: 1 - height: 5 - radius: 2 - antialiasing: true - width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2 - x: flick.contentX * (flick.width / flick.contentWidth) - NumberAnimation on opacity { id: hfade; to: 0; duration: 500 } - onXChanged: { opacity = 1.0; scrollFadeTimer.restart() } - } - - Timer { id: scrollFadeTimer; interval: 1000; onTriggered: { hfade.start(); vfade.start() } } - - Image { - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: 10 - source: "resources/folder.png" - MouseArea { - anchors.fill: parent - anchors.margins: -10 - onClicked: fileDialog.open() - hoverEnabled: true - onPositionChanged: { - tooltip.visible = false - hoverTimer.start() - } - onExited: { - tooltip.visible = false - hoverTimer.stop() - } - Timer { - id: hoverTimer - interval: 1000 - onTriggered: { - tooltip.x = parent.mouseX - tooltip.y = parent.mouseY - tooltip.visible = true - } - } - Rectangle { - id: tooltip - border.color: "black" - color: "beige" - width: tooltipText.implicitWidth + 8 - height: tooltipText.implicitHeight + 8 - visible: false - Text { - id: tooltipText - anchors.centerIn: parent - text: "Open an image directory (" + openShortcut.sequenceString + ")" - } - } - } - Shortcut { - id: openShortcut - sequence: StandardKey.Open - onActivated: fileDialog.open() - } - } - - Text { - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 10 - color: "darkgrey" - wrapMode: Text.WordWrap - font.pointSize: 8 - text: "On a touchscreen: use two fingers to zoom and rotate, one finger to drag\n" + - "With a mouse: drag normally, use the vertical wheel to zoom, horizontal wheel to rotate, or hold Ctrl while using the vertical wheel to rotate" - } - - Shortcut { sequence: StandardKey.Quit; onActivated: Qt.quit() } - - Component.onCompleted: { - if (typeof contextInitialUrl !== 'undefined') { - // Launched from C++ with context properties set. - imageNameFilters = contextImageNameFilters; - picturesLocation = contextPicturesLocation; - if (contextInitialUrl == "") - fileDialog.open(); - else - folderModel.folder = contextInitialUrl + "/"; - } else { - // Launched via QML viewer without context properties set. - fileDialog.open(); - } - } - - property var imageNameFilters : ["*.png", "*.jpg", "*.gif"]; - property string picturesLocation : ""; -} diff --git a/examples/quick/demos/photosurface/photosurface.qmlproject b/examples/quick/demos/photosurface/photosurface.qmlproject deleted file mode 100644 index ae2065f59c..0000000000 --- a/examples/quick/demos/photosurface/photosurface.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "photosurface.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - Files { - filter: "*.ts" - directory: "i18n" - } -} diff --git a/examples/quick/demos/photosurface/photosurface.qrc b/examples/quick/demos/photosurface/photosurface.qrc deleted file mode 100644 index f8fafbb1ff..0000000000 --- a/examples/quick/demos/photosurface/photosurface.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>photosurface.qml</file> - <file>resources/folder.png</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/photosurface/resources/folder.png b/examples/quick/demos/photosurface/resources/folder.png Binary files differdeleted file mode 100644 index 2aec3b6ebf..0000000000 --- a/examples/quick/demos/photosurface/resources/folder.png +++ /dev/null diff --git a/examples/quick/demos/photosurface/resources/icon.png b/examples/quick/demos/photosurface/resources/icon.png Binary files differdeleted file mode 100644 index f8ff553fcb..0000000000 --- a/examples/quick/demos/photosurface/resources/icon.png +++ /dev/null diff --git a/examples/quick/demos/photosurface/resources/photosurface.icns b/examples/quick/demos/photosurface/resources/photosurface.icns Binary files differdeleted file mode 100644 index c69ec41c4e..0000000000 --- a/examples/quick/demos/photosurface/resources/photosurface.icns +++ /dev/null diff --git a/examples/quick/demos/photosurface/resources/photosurface.ico b/examples/quick/demos/photosurface/resources/photosurface.ico Binary files differdeleted file mode 100644 index 03bb7ee367..0000000000 --- a/examples/quick/demos/photosurface/resources/photosurface.ico +++ /dev/null diff --git a/examples/quick/demos/photosurface/resources/photosurface.rc b/examples/quick/demos/photosurface/resources/photosurface.rc deleted file mode 100644 index 3267bd033f..0000000000 --- a/examples/quick/demos/photosurface/resources/photosurface.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include "winver.h" - -IDI_ICON1 ICON DISCARDABLE "photosurface.ico" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGS 0x0L - FILEFLAGSMASK 0x3fL - FILEOS 0x00040004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "CompanyName", "The Qt Company Ltd" - VALUE "FileDescription", "Photo Surface Demo" - VALUE "FileVersion", "1.0.0.0" - VALUE "LegalCopyright", "Copyright (C) 2015 The Qt Company Ltd." - VALUE "InternalName", "photosurface" - VALUE "OriginalFilename", "photosurface.exe" - VALUE "ProductName", "Photo Surface Demo" - VALUE "ProductVersion", "1.0.0.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml deleted file mode 100644 index ea72302d74..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.XmlListModel 2.0 -import QtQml.Models 2.1 - -Component { - id: albumDelegate - Package { - - Item { - Package.name: 'browser' - GridView { - id: photosGridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height - 21 - x: 0; y: 21; cellWidth: 160; cellHeight: 153; interactive: false - onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain) - } - } - - Item { - Package.name: 'fullscreen' - ListView { - id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal - width: mainWindow.width; height: mainWindow.height; interactive: false - onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain) - highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem - } - } - - Item { - Package.name: 'album' - id: albumWrapper; width: 210; height: 220 - - DelegateModel { - id: visualModel; delegate: PhotoDelegate { } - model: RssModel { id: rssModel; tags: tag } - } - - BusyIndicator { - id: busyIndicator - anchors { centerIn: parent; verticalCenterOffset: -20 } - on: rssModel.status != XmlListModel.Ready - } - - PathView { - id: photosPathView; model: visualModel.parts.stack; pathItemCount: 5 - visible: !busyIndicator.visible - anchors.centerIn: parent; anchors.verticalCenterOffset: -30 - path: Path { - PathAttribute { name: 'z'; value: 9999.0 } - PathLine { x: 1; y: 1 } - PathAttribute { name: 'z'; value: 0.0 } - } - } - - MouseArea { - anchors.fill: parent - onClicked: mainWindow.editMode ? photosModel.remove(index) : albumWrapper.state = 'inGrid' - } - - Tag { - anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 10 } - frontLabel: tag; backLabel: qsTr("Remove"); flipped: mainWindow.editMode - onTagChanged: rssModel.tags = tag - onBackClicked: if (mainWindow.editMode) photosModel.remove(index); - } - - states: [ - State { - name: 'inGrid' - PropertyChanges { target: photosGridView; interactive: true } - PropertyChanges { target: albumsShade; opacity: 1 } - PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 } - }, - State { - name: 'fullscreen'; extend: 'inGrid' - PropertyChanges { target: photosGridView; interactive: false } - PropertyChanges { target: photosListView; interactive: true } - PropertyChanges { target: photosShade; opacity: 1 } - PropertyChanges { target: backButton; y: -backButton.height - 8 } - } - ] - - GridView.onAdd: NumberAnimation { - target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad - } - GridView.onRemove: SequentialAnimation { - PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true } - NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: Easing.OutQuad } - PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false } - } - - transitions: [ - Transition { - from: '*'; to: 'inGrid' - SequentialAnimation { - NumberAnimation { properties: 'opacity'; duration: 250 } - PauseAnimation { duration: 350 } - NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: Easing.OutQuad } - } - }, - Transition { - from: 'inGrid'; to: '*' - NumberAnimation { properties: "y,opacity"; easing.type: Easing.OutQuad; duration: 300 } - } - ] - } - } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml deleted file mode 100644 index 836abdf6a9..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Image { - id: container - property bool on: false - - source: "images/busy.png"; visible: container.on - NumberAnimation on rotation { running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/Button.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/Button.qml deleted file mode 100644 index cd575f6d99..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: container - - property alias label: labelText.text - property color tint: "transparent" - signal clicked - - width: labelText.width + 70 ; height: labelText.height + 18 - - BorderImage { - anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } - source: 'images/box-shadow.png' - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - - Image { anchors.fill: parent; source: "images/cardboard.png"; antialiasing: true } - - Rectangle { - anchors.fill: container; color: container.tint; visible: container.tint != "" - opacity: 0.25 - } - - Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent } - - MouseArea { - anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: container.clicked() - } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml deleted file mode 100644 index 35df4107eb..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: container - - property string label - signal clicked - - width: textInput.width + 70 ; height: textInput.height + 18 - - BorderImage { - anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } - source: 'images/box-shadow.png'; - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - - Image { anchors.fill: parent; source: "images/cardboard.png"; antialiasing: true } - - TextInput { - id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent - Keys.onReturnPressed: { - container.label = textInput.text - container.focus = true - } - Keys.onEnterPressed: { - container.label = textInput.text - container.focus = true - } - Keys.onEscapePressed: { - textInput.text = container.label - container.focus = true - } - } - - Rectangle { - anchors.fill: container; border.color: "steelblue"; border.width: 4 - color: "transparent"; visible: textInput.focus; antialiasing: true - } - - MouseArea { - anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: { textInput.forceActiveFocus(); Qt.inputMethod.show(); } - } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml deleted file mode 100644 index 2dcfc6158e..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "script/script.js" as Script - -Package { - Item { id: stackItem; Package.name: 'stack'; width: 160; height: 153; z: stackItem.PathView.z } - Item { id: listItem; Package.name: 'list'; width: mainWindow.width + 40; height: 153 } - Item { id: gridItem; Package.name: 'grid'; width: 160; height: 153 } - - Item { - width: 160; height: 153 - - Item { - id: photoWrapper - - property double randomAngle: Math.random() * (2 * 6 + 1) - 6 - property double randomAngle2: Math.random() * (2 * 6 + 1) - 6 - - x: 0; y: 0; width: 140; height: 133 - z: stackItem.PathView.z; rotation: photoWrapper.randomAngle - - BorderImage { - anchors { - fill: originalImage.status == Image.Ready ? border : placeHolder - leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 - } - source: 'images/box-shadow.png' - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - Rectangle { - id: placeHolder - - property int w: Script.getWidth(content) - property int h: Script.getHeight(content) - property double s: Script.calculateScale(w, h, photoWrapper.width) - - color: 'white'; anchors.centerIn: parent; antialiasing: true - width: w * s; height: h * s; visible: originalImage.status != Image.Ready - Rectangle { - color: "#878787"; antialiasing: true - anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 } - } - } - Rectangle { - id: border; color: 'white'; anchors.centerIn: parent; antialiasing: true - width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6 - visible: !placeHolder.visible - } - BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } - Image { - id: originalImage; antialiasing: true; - source: "http://" + Script.getImagePath(content); cache: false - fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height - } - Image { - id: hqImage; antialiasing: true; source: ""; visible: false; cache: false - fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height - } - Binding { - target: mainWindow; property: "downloadProgress"; value: hqImage.progress - when: listItem.ListView.isCurrentItem - } - Binding { - target: mainWindow; property: "imageLoading" - value: (hqImage.status == Image.Loading) ? 1 : 0; when: listItem.ListView.isCurrentItem - } - MouseArea { - width: originalImage.paintedWidth; height: originalImage.paintedHeight; anchors.centerIn: originalImage - onClicked: { - if (albumWrapper.state == 'inGrid') { - gridItem.GridView.view.currentIndex = index; - albumWrapper.state = 'fullscreen' - } else { - gridItem.GridView.view.currentIndex = index; - albumWrapper.state = 'inGrid' - } - } - } - - states: [ - State { - name: 'stacked'; when: albumWrapper.state == '' - ParentChange { target: photoWrapper; parent: stackItem; x: 10; y: 10 } - PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } - }, - State { - name: 'inGrid'; when: albumWrapper.state == 'inGrid' - ParentChange { target: photoWrapper; parent: gridItem; x: 10; y: 10; rotation: photoWrapper.randomAngle2 } - }, - State { - name: 'fullscreen'; when: albumWrapper.state == 'fullscreen' - ParentChange { - target: photoWrapper; parent: listItem; x: 0; y: 0; rotation: 0 - width: mainWindow.width; height: mainWindow.height - } - PropertyChanges { target: border; opacity: 0 } - PropertyChanges { target: hqImage; source: listItem.ListView.isCurrentItem ? hq : ""; visible: true } - } - ] - - transitions: [ - Transition { - from: 'stacked'; to: 'inGrid' - SequentialAnimation { - PauseAnimation { duration: 10 * index } - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { - target: photoWrapper; properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' - } - } - } - }, - Transition { - from: 'inGrid'; to: 'stacked' - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' } - } - }, - Transition { - from: 'inGrid'; to: 'fullscreen' - SequentialAnimation { - PauseAnimation { duration: gridItem.GridView.isCurrentItem ? 0 : 600 } - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { - targets: [ photoWrapper, border ] - properties: 'x,y,width,height,opacity,rotation' - duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' - } - } - } - }, - Transition { - from: 'fullscreen'; to: 'inGrid' - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { - targets: [ photoWrapper, border ] - properties: 'x,y,width,height,rotation,opacity' - duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' - } - } - } - ] - } - } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml deleted file mode 100644 index 73f7f10ace..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: container - - property real progress: 0 - - Behavior on opacity { NumberAnimation { duration: 600 } } - - Rectangle { anchors.fill: parent; color: "black"; opacity: 0.5 } - - Rectangle { - id: fill; color: "white"; height: container.height - width: container.width * container.progress - } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml deleted file mode 100644 index 5808090250..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.XmlListModel 2.0 - -XmlListModel { - property string tags : "" - - function encodeTags(x) { return encodeURIComponent(x.replace(' ',',')); } - - source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+encodeTags(tags)+"&" : "") - query: "/feed/entry" - namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';" - - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "content"; query: "content/string()" } - XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/Tag.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/Tag.qml deleted file mode 100644 index aff9f6fb3b..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/Tag.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Flipable { - id: flipable - - property alias frontLabel: frontButton.label - property alias backLabel: backButton.label - - property int angle: 0 - property int randomAngle: Math.random() * (2 * 6 + 1) - 6 - property bool flipped: false - - signal frontClicked - signal backClicked - signal tagChanged(string tag) - - front: EditableButton { - id: frontButton; rotation: flipable.randomAngle - anchors { centerIn: parent; verticalCenterOffset: -20 } - onClicked: flipable.frontClicked() - onLabelChanged: flipable.tagChanged(label) - } - - back: Button { - id: backButton; tint: "red"; rotation: flipable.randomAngle - anchors { centerIn: parent; verticalCenterOffset: -20 } - onClicked: flipable.backClicked() - } - - transform: Rotation { - origin.x: flipable.width / 2; origin.y: flipable.height / 2 - axis.x: 0; axis.y: 1; axis.z: 0 - angle: flipable.angle - } - - states: State { - name: "back"; when: flipable.flipped - PropertyChanges { target: flipable; angle: 180 } - } - - transitions: Transition { - ParallelAnimation { - NumberAnimation { properties: "angle"; duration: 400 } - SequentialAnimation { - NumberAnimation { target: flipable; property: "scale"; to: 0.8; duration: 200 } - NumberAnimation { target: flipable; property: "scale"; to: 1.0; duration: 200 } - } - } - } -} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png Binary files differdeleted file mode 100644 index 23c011d0ff..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png +++ /dev/null diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png b/examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png Binary files differdeleted file mode 100644 index fc65122d26..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png +++ /dev/null diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png Binary files differdeleted file mode 100644 index a8a9c6079d..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png +++ /dev/null diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/script/script.js b/examples/quick/demos/photoviewer/PhotoViewerCore/script/script.js deleted file mode 100644 index e8ef93a847..0000000000 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/script/script.js +++ /dev/null @@ -1,27 +0,0 @@ -.pragma library - -function getWidth(string) { - return (string.match(/width=\"([0-9]+)\"/))[1] -} - -function getHeight(string) { - return (string.match(/height=\"([0-9]+)\"/))[1] -} - -function getImagePath(string) { - var pattern = /src=\"http:\/\/(\S+)\"/ - return (string.match(pattern))[1] -} - -function calculateScale(width, height, cellSize) { - var widthScale = (cellSize * 1.0) / width - var heightScale = (cellSize * 1.0) / height - var scale = 0 - - if (widthScale <= heightScale) { - scale = widthScale; - } else if (heightScale < widthScale) { - scale = heightScale; - } - return scale; -} diff --git a/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png b/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png Binary files differdeleted file mode 100644 index d872310a3e..0000000000 --- a/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png +++ /dev/null diff --git a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc deleted file mode 100644 index 9c0f8b337e..0000000000 --- a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc +++ /dev/null @@ -1,326 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Photo Viewer - \ingroup qtquickdemos - \example demos/photoviewer - \brief A QML photo viewer that that uses XmlListModel and XmlRole to - download Flickr feeds, and Package to display the photos in different views. - - \image qtquick-demo-photoviewer-small.png - - \e{Photo Viewer} demonstrates the following \l{Qt Quick} features: - - \list - \li Using custom types to create screens and screen controls. - \li Using Qt Quick Controls to create an application window. - \li Using the \l Package type with a \l DelegateModel to provide - delegates with a shared context to multiple views. - \li Using XML list models to download Flickr feeds. - \li Using the \l Flipable type to create labels with different text on - the front and back. - \li Using the PathView, \l Path, PathAttribute, and PathLine types to - lay out photos on a path. - \li Providing feedback to users while data is loading. - \li Localizing applications. - \endlist - - \include examples-run.qdocinc - - \section1 Using Custom Types - - In the Photo Viewer app, we use the following custom types that are each - defined in a separate .qml file: - - \list - \li \c AlbumDelegate.qml - \li \c BusyIndicator.qml - \li \c Button.qml - \li \c EditableButton.qml - \li \c PhotoDelegate.qml - \li \c ProgressBar.qml - \li \c RssModel.qml - \li \c Tag.qml - \endlist - - To use the custom types, we add an import statement to the main QML file, - main.qml, that imports the folder called \c PhotoViewerCore where the types - are located: - - \quotefromfile demos/photoviewer/main.qml - \skipto PhotoViewerCore - \printuntil " - - \section1 Creating the Main Window - - In main.qml, we use the ApplicationWindow Qt Quick Control to create the app - main window: - - \printuntil visible - - We use a ListModel type with \l ListElement types to display photo albums: - - \skipto ListModel - \printuntil Prague - \printuntil } - - List elements are defined like other QML types except that they contain a - collection of \e role definitions instead of properties. Roles both define - how the data is accessed and include the data itself. For each list element, - we use the \c tag role to specify the photos to download. - - A DelegateModel type is used together with the \l Package type to provide - delegates to multiple views. The \c model property holds the model providing - data for the delegate model and the \c delegate property specifies the - template defining each item instantiated by a view: - - \printuntil DelegateModel - - We use a GridView type to lay out the albums as a grid: - - \printuntil } - - The \c model property references the package name \c album that we specify - in AlbumDelegate.qml. We use the \l Package type to allow the photos to move - between different views. The \l Package contains the named items \c browser, - \c fullscreen, and \c album: - - \quotefromfile demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml - \skipto Package - \printuntil albumWrapper - - The named items are used as the delegates by the views that reference the - special DelegateModel::parts property to select the model that provides - the chosen delegate. - - We use a ListView type to lay out albums in other views: - - \quotefromfile demos/photoviewer/main.qml - \skipto ListView - \printuntil } - \skipto ListView - \printuntil } - - \section1 Displaying Photos - - We use the PhotoDelegate custom type that is specified in PhotoDelegate.qml - to display photos. We use a \l Package type to lay out the photos either in - a stack, list, or a grid: - - \quotefromfile demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml - \skipto Package - \printuntil gridItem - - The photos are rotated at random angles by using the \c Math.random() - JavaScript method: - - \printuntil stackItem - - We use a BorderImage type to create borders for the images: - - \printuntil border.left - \printuntil } - - \section1 Downloading Flickr Feeds - - In AlbumDelegate.qml, we use the DelegateModel to provide the - PhotoDelegate delegate to the RssModel model: - - \quotefromfile demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml - \skipto DelegateModel - \printuntil RssModel - \printuntil } - - In RssModel.qml, we use an XmlListModel type as a data source for - \l Package objects to download photos from the selected feeds: - - \quotefromfile demos/photoviewer/PhotoViewerCore/RssModel.qml - \skipto XmlListModel - \printuntil encodeTags - - We use the \c tags custom property to specify which photos to download. The - \c encodeTags custom function uses the \c encodeURIComponent JavaScript - method to ensure that the requests to the server are correctly formatted. - - We use the \c source property to fetch photos that have the specified tags - attached from public Flickr feeds: - - \printuntil namespaceDeclarations - - The \c query property specifies that the XmlListModel generates a model item - for each feed entry. - - The \c namespaceDeclarations property specifies that the requested document - uses the namespace \c{http://www.w3.org/2005/Atom}, which is declared as the - default namespace. - - We use the XmlRole type to specify the model item attributes. Each model - item has the \c title, \c content, and \c hq attributes that match the - values of the corresponding feed entry: - - \printuntil hq - - \section1 Creating Flipable Labels - - When users select the \b Edit button, the album labels are flipped from - their front side to their back side and the text on them changes from album - name to \b Remove. - - In AlbumDelegate.qml, we use the Tag custom type to specify the text to - display on the front and back sides of album labels: - - \quotefromfile demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml - \skipto Tag - \printuntil onBackClicked - \printuntil } - - The \c onTagChanged signal handler is used to change the tag based on - which the model is populated. The \c onBackClicked signal handler is used to - remove the album. - - In Tag.qml, we use a \l Flipable type with custom properties and signals to - create the labels: - - \quotefromfile demos/photoviewer/PhotoViewerCore/Tag.qml - \skipto Flipable - \printuntil tagChanged - - The \c front property holds the EditableButton custom type that enables - users to edit the label text: - - \printuntil onLabelChanged - \printuntil } - - The \c back property holds the \c Button custom type that is used to remove - the album: - - \printuntil onClicked - \printuntil } - - \section1 Laying out Photos on a Path - - In AlbumDelegate.qml, we use a PathView type to lay out the photos provided - by the \c visualModel.parts.stack model on a path that has the form of a - stack: - - \quotefromfile demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml - \skipto PathView - \printuntil 0.0 - \printuntil } - \printuntil } - - The \c path property holds the \l Path type that defines the path used by - the PathView. The PathAttribute types are used to set a range of - \c 0 to \c 9999 for the \c z attribute. This way, the path creates a stack - of album photos. Because each PhotoDelegate is slightly rotated at a random - angle, this results in a realistic-looking stack of photos. - - \section1 Providing Feedback to Users - - We use a busy indicator and a progress bar to indicate activity while - Flickr feeds and photos are being loaded. - - In AlbumDelegate.qml, we use the \c BusyIndicator custom type and the - \c on custom property to display a rotating image while the Flickr feed is - being loaded: - - \quotefromfile demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml - \skipto BusyIndicator - \printuntil rssModel - \printuntil } - - In PhotoDelegate.qml, we use them to indicate activity while a photo is - being loaded: - - \quotefromfile demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml - \skipto BusyIndicator - \printuntil } - - We define the \c BusyIndicator type in \c BusyIndicator.qml. We use an - \l Image type to display an image and apply a NumberAnimation to its - \c rotation property to rotate the image in an infinite loop: - - \quotefromfile demos/photoviewer/PhotoViewerCore/BusyIndicator.qml - \skipto Image - \printuntil } - \printuntil } - - In your apps, you can also use the BusyIndicator type from the - \l {Qt Quick Controls} module. - - In main.qml, we use the \c ProgressBar custom type to indicate progress - while a high quality version of a photo is being opened on full screen: - - \quotefromfile demos/photoviewer/main.qml - \skipto ProgressBar - \printuntil } - - We define the \c ProgressBar type in \c ProgressBar.qml. We use a - \l Rectangle type to create the progress bar and apply a NumberAnimation to - its \c opacity property to change the color of the bar from black to white - as data loading proceeds: - - \quotefromfile demos/photoviewer/PhotoViewerCore/ProgressBar.qml - \skipto Item - \printuntil /^\}/ - - In your apps, you can also use the ProgressBar type from the - \l {Qt Quick Controls} module. - - \section1 Localizing Applications - - The example application is translated into German and French. The translated - strings are loaded at runtime according to the current locale. - - We use a \l Column type in main.qml to position buttons for adding and - editing albums and exiting the application: - - \quotefromfile demos/photoviewer/main.qml - \skipto Column - \printuntil quit() - \printuntil } - \printuntil } - - We use the \l[QML]{Qt::}{qsTr()} command to mark the button labels translatable. - - We use the \c lupdate() tool to generate the translation source files and - the \c lrelease() tool to convert the translated strings to the QM files used - by the application at runtime. These files are stored in the \c i18n - directory. - - To make the application aware of the translations, we add code to the - \c main() function in the main.cpp file. The code creates a \l QTranslator - object, loads a translation according to the current locale at runtime, and - installs the translator object into the application: - - \quotefromfile demos/photoviewer/main.cpp - \skipto main - \printuntil app.installTranslator - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/photoviewer/i18n/qml_de.qm b/examples/quick/demos/photoviewer/i18n/qml_de.qm Binary files differdeleted file mode 100644 index 8186e7309f..0000000000 --- a/examples/quick/demos/photoviewer/i18n/qml_de.qm +++ /dev/null diff --git a/examples/quick/demos/photoviewer/i18n/qml_de.ts b/examples/quick/demos/photoviewer/i18n/qml_de.ts deleted file mode 100644 index 92ab50a136..0000000000 --- a/examples/quick/demos/photoviewer/i18n/qml_de.ts +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="de_DE"> -<context> - <name>AlbumDelegate</name> - <message> - <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="102"/> - <source>Remove</source> - <translation>Entfernen</translation> - </message> -</context> -<context> - <name>main</name> - <message> - <location filename="../main.qml" line="75"/> - <source>Add</source> - <translation>Zufügen</translation> - </message> - <message> - <location filename="../main.qml" line="84"/> - <source>Edit</source> - <translation>Bearbeiten</translation> - </message> - <message> - <location filename="../main.qml" line="89"/> - <source>Quit</source> - <translation>Verlassen</translation> - </message> - <message> - <location filename="../main.qml" line="102"/> - <source>Back</source> - <translation>Zurück</translation> - </message> -</context> -</TS> diff --git a/examples/quick/demos/photoviewer/i18n/qml_fr.qm b/examples/quick/demos/photoviewer/i18n/qml_fr.qm Binary files differdeleted file mode 100644 index e4257d4073..0000000000 --- a/examples/quick/demos/photoviewer/i18n/qml_fr.qm +++ /dev/null diff --git a/examples/quick/demos/photoviewer/i18n/qml_fr.ts b/examples/quick/demos/photoviewer/i18n/qml_fr.ts deleted file mode 100644 index 1edb5e0fe4..0000000000 --- a/examples/quick/demos/photoviewer/i18n/qml_fr.ts +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.1" language="fr_FR"> -<context> - <name>AlbumDelegate</name> - <message> - <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="102"/> - <source>Remove</source> - <translation>Supprimer</translation> - </message> -</context> -<context> - <name>main</name> - <message> - <location filename="../main.qml" line="75"/> - <source>Add</source> - <translation>Ajouter</translation> - </message> - <message> - <location filename="../main.qml" line="84"/> - <source>Edit</source> - <translation>Éditer</translation> - </message> - <message> - <location filename="../main.qml" line="89"/> - <source>Quit</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../main.qml" line="102"/> - <source>Back</source> - <translation>Retour</translation> - </message> -</context> -</TS> diff --git a/examples/quick/demos/photoviewer/main.cpp b/examples/quick/demos/photoviewer/main.cpp deleted file mode 100644 index a269a61dcb..0000000000 --- a/examples/quick/demos/photoviewer/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QTranslator> -#include <QDebug> - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QTranslator qtTranslator; - qtTranslator.load("qml_" + QLocale::system().name(), ":/i18n/"); - app.installTranslator(&qtTranslator); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); - - return app.exec(); -} diff --git a/examples/quick/demos/photoviewer/main.qml b/examples/quick/demos/photoviewer/main.qml deleted file mode 100644 index 2e2b8e4ee2..0000000000 --- a/examples/quick/demos/photoviewer/main.qml +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQml.Models 2.1 -import "PhotoViewerCore" - -ApplicationWindow { - id: mainWindow - - visible: true - - Rectangle { - focus: true - - Keys.onBackPressed: { - event.accepted = true - backButton.clicked() - } - } - - property real downloadProgress: 0 - property bool imageLoading: false - property bool editMode: false - - width: 800; height: 480; color: "#d5d6d8" - - ListModel { - id: photosModel - ListElement { tag: "Flowers" } - ListElement { tag: "Wildlife" } - ListElement { tag: "Prague" } - } - - DelegateModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} } - - GridView { - id: albumView; width: parent.width; height: parent.height; cellWidth: 210; cellHeight: 220 - model: albumVisualModel.parts.album; visible: albumsShade.opacity != 1.0 - } - - Column { - spacing: 20; anchors { bottom: parent.bottom; right: parent.right; rightMargin: 20; bottomMargin: 20 } - Button { - id: newButton; label: qsTr("Add"); rotation: 3 - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - mainWindow.editMode = false - photosModel.append( { tag: "" } ) - albumView.positionViewAtIndex(albumView.count - 1, GridView.Contain) - } - } - Button { - id: deleteButton; label: qsTr("Edit"); rotation: -2; - onClicked: mainWindow.editMode = !mainWindow.editMode - anchors.horizontalCenter: parent.horizontalCenter - } - Button { - id: quitButton; label: qsTr("Quit"); rotation: -2; - onClicked: Qt.quit() - anchors.horizontalCenter: parent.horizontalCenter - } - } - - Rectangle { - id: albumsShade; color: mainWindow.color - width: parent.width; height: parent.height; opacity: 0.0 - } - - ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false } - - Button { - id: backButton - label: qsTr("Back") - rotation: 3 - x: parent.width - backButton.width - 6 - y: -backButton.height - 8 - visible: Qt.platform.os !== "android" - } - - Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 } - - ListView { anchors.fill: parent; model: albumVisualModel.parts.fullscreen; interactive: false } - - Item { id: foreground; anchors.fill: parent } - - ProgressBar { - progress: mainWindow.downloadProgress; width: parent.width; height: 4 - anchors.bottom: parent.bottom; opacity: mainWindow.imageLoading; visible: opacity != 0.0 - } -} diff --git a/examples/quick/demos/photoviewer/photoviewer.pro b/examples/quick/demos/photoviewer/photoviewer.pro deleted file mode 100644 index 68e43e13f9..0000000000 --- a/examples/quick/demos/photoviewer/photoviewer.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = app - -QT += qml quick xmlpatterns - -SOURCES += main.cpp - -lupdate_only{ -SOURCES = *.qml \ - PhotoViewerCore/*.qml \ - PhotoViewerCore/script/*.js -} - -TRANSLATIONS += i18n/qml_fr.ts \ - i18n/qml_de.ts - -RESOURCES += qml.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/photoviewer -INSTALLS += target diff --git a/examples/quick/demos/photoviewer/qml.qrc b/examples/quick/demos/photoviewer/qml.qrc deleted file mode 100644 index 8abefc6212..0000000000 --- a/examples/quick/demos/photoviewer/qml.qrc +++ /dev/null @@ -1,19 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>PhotoViewerCore/AlbumDelegate.qml</file> - <file>PhotoViewerCore/BusyIndicator.qml</file> - <file>PhotoViewerCore/Button.qml</file> - <file>PhotoViewerCore/EditableButton.qml</file> - <file>PhotoViewerCore/PhotoDelegate.qml</file> - <file>PhotoViewerCore/ProgressBar.qml</file> - <file>PhotoViewerCore/RssModel.qml</file> - <file>PhotoViewerCore/Tag.qml</file> - <file>PhotoViewerCore/images/box-shadow.png</file> - <file>PhotoViewerCore/images/busy.png</file> - <file>PhotoViewerCore/images/cardboard.png</file> - <file>PhotoViewerCore/script/script.js</file> - <file>i18n/qml_fr.qm</file> - <file>i18n/qml_de.qm</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/rssnews/content/BusyIndicator.qml b/examples/quick/demos/rssnews/content/BusyIndicator.qml deleted file mode 100644 index f82fc3b67d..0000000000 --- a/examples/quick/demos/rssnews/content/BusyIndicator.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Image { - id: container - - source: "images/busy.png"; - - NumberAnimation on rotation { - running: container.visible - from: 0; to: 360; - loops: Animation.Infinite; - duration: 1200 - } -} diff --git a/examples/quick/demos/rssnews/content/CategoryDelegate.qml b/examples/quick/demos/rssnews/content/CategoryDelegate.qml deleted file mode 100644 index 0df1ce55d5..0000000000 --- a/examples/quick/demos/rssnews/content/CategoryDelegate.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Rectangle { - id: delegate - - property bool selected: ListView.isCurrentItem - property real itemSize - width: itemSize - height: itemSize - - Image { - anchors.centerIn: parent - source: image - } - - Text { - id: titleText - - anchors { - left: parent.left; leftMargin: 20 - right: parent.right; rightMargin: 20 - top: parent.top; topMargin: 20 - } - - font { pixelSize: 18; bold: true } - text: name - color: selected ? "#ffffff" : "#ebebdd" - scale: selected ? 1.15 : 1.0 - Behavior on color { ColorAnimation { duration: 150 } } - Behavior on scale { PropertyAnimation { duration: 300 } } - } - - BusyIndicator { - scale: 0.8 - visible: delegate.ListView.isCurrentItem && window.loading - anchors.centerIn: parent - } - - MouseArea { - anchors.fill: delegate - onClicked: { - delegate.ListView.view.currentIndex = index - if (window.currentFeed == feed) - feedModel.reload() - else - window.currentFeed = feed - } - } -} diff --git a/examples/quick/demos/rssnews/content/NewsDelegate.qml b/examples/quick/demos/rssnews/content/NewsDelegate.qml deleted file mode 100644 index 3d71d9d516..0000000000 --- a/examples/quick/demos/rssnews/content/NewsDelegate.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Column { - id: delegate - width: delegate.ListView.view.width - spacing: 8 - - // Returns a string representing how long ago an event occurred - function timeSinceEvent(pubDate) { - var result = pubDate; - - // We need to modify the pubDate read from the RSS feed - // so the JavaScript Date object can interpret it - var d = pubDate.replace(',','').split(' '); - if (d.length != 6) - return result; - - var date = new Date([d[0], d[2], d[1], d[3], d[4], 'GMT' + d[5]].join(' ')); - - if (!isNaN(date.getDate())) { - var age = new Date() - date; - var minutes = Math.floor(Number(age) / 60000); - if (minutes < 1440) { - if (minutes < 2) - result = qsTr("Just now"); - else if (minutes < 60) - result = '' + minutes + ' ' + qsTr("minutes ago") - else if (minutes < 120) - result = qsTr("1 hour ago"); - else - result = '' + Math.floor(minutes/60) + ' ' + qsTr("hours ago"); - } - else { - result = date.toDateString(); - } - } - return result; - } - - Item { height: 8; width: delegate.width } - - Row { - width: parent.width - spacing: 8 - - Column { - Item { - width: 4 - height: titleText.font.pixelSize / 4 - } - - Image { - id: titleImage - source: image - } - } - - Text { - id: titleText - - text: title - width: delegate.width - titleImage.width - wrapMode: Text.WordWrap - font.pixelSize: 26 - font.bold: true - } - } - - Text { - width: delegate.width - font.pixelSize: 12 - textFormat: Text.RichText - font.italic: true - text: timeSinceEvent(pubDate) + " (<a href=\"" + link + "\">Link</a>)" - onLinkActivated: { - Qt.openUrlExternally(link) - } - } - - Text { - id: descriptionText - - text: description - width: parent.width - wrapMode: Text.WordWrap - font.pixelSize: 14 - textFormat: Text.StyledText - horizontalAlignment: Qt.AlignLeft - } -} diff --git a/examples/quick/demos/rssnews/content/RssFeeds.qml b/examples/quick/demos/rssnews/content/RssFeeds.qml deleted file mode 100644 index d6fb9e27d1..0000000000 --- a/examples/quick/demos/rssnews/content/RssFeeds.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -ListModel { - ListElement { name: "Top Stories"; feed: "news.yahoo.com/rss/topstories"; image: "images/TopStories.jpg" } - ListElement { name: "World"; feed: "news.yahoo.com/rss/world"; image: "images/World.jpg" } - ListElement { name: "Europe"; feed: "news.yahoo.com/rss/europe"; image: "images/Europe.jpg" } - ListElement { name: "Asia"; feed: "news.yahoo.com/rss/asia"; image: "images/Asia.jpg" } - ListElement { name: "U.S. National"; feed: "news.yahoo.com/rss/us"; image: "images/USNational.jpg" } - ListElement { name: "Politics"; feed: "news.yahoo.com/rss/politics"; image: "images/Politics.jpg" } - ListElement { name: "Business"; feed: "news.yahoo.com/rss/business"; image: "images/Business.jpg" } - ListElement { name: "Technology"; feed: "news.yahoo.com/rss/tech"; image: "images/Technology.jpg" } - ListElement { name: "Entertainment"; feed: "news.yahoo.com/rss/entertainment"; image: "images/Entertainment.jpg" } - ListElement { name: "Health"; feed: "news.yahoo.com/rss/health"; image: "images/Health.jpg" } - ListElement { name: "Science"; feed: "news.yahoo.com/rss/science"; image: "images/Science.jpg" } - ListElement { name: "Sports"; feed: "news.yahoo.com/rss/sports"; image: "images/Sports.jpg" } -} diff --git a/examples/quick/demos/rssnews/content/ScrollBar.qml b/examples/quick/demos/rssnews/content/ScrollBar.qml deleted file mode 100644 index 46d584655b..0000000000 --- a/examples/quick/demos/rssnews/content/ScrollBar.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Item { - id: container - - property variant scrollArea - property int orientation: Qt.Vertical - - opacity: 0 - - function position() - { - var ny = 0; - if (container.orientation == Qt.Vertical) - ny = scrollArea.visibleArea.yPosition * container.height; - else - ny = scrollArea.visibleArea.xPosition * container.width; - - if (ny > 2) - return ny; - else - return 2; - } - - function size() - { - var nh, ny; - - if (container.orientation == Qt.Vertical) - nh = scrollArea.visibleArea.heightRatio * container.height; - else - nh = scrollArea.visibleArea.widthRatio * container.width; - - if (container.orientation == Qt.Vertical) - ny = scrollArea.visibleArea.yPosition * container.height; - else - ny = scrollArea.visibleArea.xPosition * container.width; - - if (ny > 3) { - var t; - if (container.orientation == Qt.Vertical) - t = Math.ceil(container.height - 3 - ny); - else - t = Math.ceil(container.width - 3 - ny); - if (nh > t) - return t; - else - return nh; - } else - return nh + ny; - } - - Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 } - - BorderImage { - source: "images/scrollbar.png" - border { left: 1; right: 1; top: 1; bottom: 1 } - x: container.orientation == Qt.Vertical ? 2 : position() - y: container.orientation == Qt.Vertical ? position() : 2 - width: container.orientation == Qt.Vertical ? container.width - 4 : size() - height: container.orientation == Qt.Vertical ? size() : container.height - 4 - } - - states: State { - name: "visible" - when: container.orientation == Qt.Vertical ? - scrollArea.movingVertically : - scrollArea.movingHorizontally - PropertyChanges { target: container; opacity: 1.0 } - } - - transitions: Transition { - from: "visible"; to: "" - NumberAnimation { properties: "opacity"; duration: 600 } - } -} diff --git a/examples/quick/demos/rssnews/content/images/Asia.jpg b/examples/quick/demos/rssnews/content/images/Asia.jpg Binary files differdeleted file mode 100644 index a609557a08..0000000000 --- a/examples/quick/demos/rssnews/content/images/Asia.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Business.jpg b/examples/quick/demos/rssnews/content/images/Business.jpg Binary files differdeleted file mode 100644 index b2c1d92138..0000000000 --- a/examples/quick/demos/rssnews/content/images/Business.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Entertainment.jpg b/examples/quick/demos/rssnews/content/images/Entertainment.jpg Binary files differdeleted file mode 100644 index 2c69fc04d7..0000000000 --- a/examples/quick/demos/rssnews/content/images/Entertainment.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Europe.jpg b/examples/quick/demos/rssnews/content/images/Europe.jpg Binary files differdeleted file mode 100644 index bf524e13d0..0000000000 --- a/examples/quick/demos/rssnews/content/images/Europe.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Health.jpg b/examples/quick/demos/rssnews/content/images/Health.jpg Binary files differdeleted file mode 100644 index 0e8c71f0c9..0000000000 --- a/examples/quick/demos/rssnews/content/images/Health.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Politics.jpg b/examples/quick/demos/rssnews/content/images/Politics.jpg Binary files differdeleted file mode 100644 index 0b1800c97e..0000000000 --- a/examples/quick/demos/rssnews/content/images/Politics.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Science.jpg b/examples/quick/demos/rssnews/content/images/Science.jpg Binary files differdeleted file mode 100644 index 7faccbbb97..0000000000 --- a/examples/quick/demos/rssnews/content/images/Science.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Sports.jpg b/examples/quick/demos/rssnews/content/images/Sports.jpg Binary files differdeleted file mode 100644 index 0ab3bd3ce7..0000000000 --- a/examples/quick/demos/rssnews/content/images/Sports.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Technology.jpg b/examples/quick/demos/rssnews/content/images/Technology.jpg Binary files differdeleted file mode 100644 index db553028fb..0000000000 --- a/examples/quick/demos/rssnews/content/images/Technology.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/TopStories.jpg b/examples/quick/demos/rssnews/content/images/TopStories.jpg Binary files differdeleted file mode 100644 index e35bd67f20..0000000000 --- a/examples/quick/demos/rssnews/content/images/TopStories.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/USNational.jpg b/examples/quick/demos/rssnews/content/images/USNational.jpg Binary files differdeleted file mode 100644 index 82c78228c1..0000000000 --- a/examples/quick/demos/rssnews/content/images/USNational.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/World.jpg b/examples/quick/demos/rssnews/content/images/World.jpg Binary files differdeleted file mode 100644 index 7a0a806fd4..0000000000 --- a/examples/quick/demos/rssnews/content/images/World.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/btn_close.png b/examples/quick/demos/rssnews/content/images/btn_close.png Binary files differdeleted file mode 100644 index 1a3dc44380..0000000000 --- a/examples/quick/demos/rssnews/content/images/btn_close.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/busy.png b/examples/quick/demos/rssnews/content/images/busy.png Binary files differdeleted file mode 100644 index fc65122d26..0000000000 --- a/examples/quick/demos/rssnews/content/images/busy.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/scrollbar.png b/examples/quick/demos/rssnews/content/images/scrollbar.png Binary files differdeleted file mode 100644 index c2425dd0df..0000000000 --- a/examples/quick/demos/rssnews/content/images/scrollbar.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png b/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png Binary files differdeleted file mode 100644 index 9d324ceb70..0000000000 --- a/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/doc/src/rssnews.qdoc b/examples/quick/demos/rssnews/doc/src/rssnews.qdoc deleted file mode 100644 index e9509eda32..0000000000 --- a/examples/quick/demos/rssnews/doc/src/rssnews.qdoc +++ /dev/null @@ -1,372 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - RSS News - \ingroup qtquickdemos - \example demos/rssnews - \brief A QML RSS news reader that uses XmlListModel and XmlRole to download - XML data, ListModel and ListElement to create a category list, and ListView - to display the data. - - \image qtquick-demo-rssnews-small.png - - \e{RSS News} demonstrates the following \l{Qt Quick} features: - - \list - \li Using custom types to create screens and screen controls. - \li Using list models and list elements to represent data. - \li Using XML list models to download XML data. - \li Using list views to display data. - \li Using the \l Component type to create a footer for the news item - list view. - \li Using the \l Image type to create a button for closing the app. - \endlist - - \include examples-run.qdocinc - - \section1 Using Custom Types - - In the RSS News app, we use the following custom types that are each defined - in a separate .qml file: - - \list - \li \c BusyIndicator.qml - \li \c CategoryDelegate.qml - \li \c NewsDelegate.qml - \li \c RssFeeds.qml - \li \c ScrollBar.qml - \endlist - - To use the custom types, we add an import statement to the main QML file, - rssnews.qml that imports the folder called \c content where the types are - located: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto content - \printuntil " - - \section1 Creating the Main Window - - In rssnews.qml, we use a \l{Rectangle} type with custom properties to create - the app main window: - - \printuntil isPortrait - - We will use the custom properties later for loading XML data and for - adjusting the screen layout depending on its orientation. - - \section1 Creating a Category List - - In rssnews.qml, we use the RssFeeds custom type that we specify in - RssFeeds.qml to create a list of feed categories: - - \skipto RssFeeds - \printuntil } - - In RssFeeds.qml, we use a ListModel type with a ListElement type to - create a category list where list elements represent feed categories: - - \quotefromfile demos/rssnews/content/RssFeeds.qml - \skipto ListModel - \printuntil /^\}/ - - List elements are defined like other QML types except that they contain a - collection of \e role definitions instead of properties. Roles both define - how the data is accessed and include the data itself. - - For each list element, we use the \c name role to specify the category name, - the \c feed role to specify the URL to load the data from, and the \c image - role to display an image for the category. - - In rssnews.qml, we use a ListView type to display the category list: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto ListView - \printuntil } - \printuntil } - - To lay out the category list horizontally at the top of the window in - portrait orientation and vertically on the left side in landscape - orientation, we use the \c orientation property. Based on the orientation, - we bind either the width or the height of the list to a fixed value - (\c itemWidth). - - We use the \c anchors.top property to position the list view at the top of - the screen in both orientations. - - We use the \c model property to load XML data from the \c rssFeeds model, - and \c CategoryDelegate as the delegate to instantiate each item in the - list. - - \section1 Creating List Elements - - In CategoryDelegate.qml, we use the \l Rectangle type with custom properties - to create list elements: - - \quotefromfile demos/rssnews/content/CategoryDelegate.qml - \skipto Rectangle - \printuntil selected - - We set the \c selected property to the \c ListView.isCurrentItem attached - property to specify that \c selected is \c true if \c delegate is the - current item. - - We use the \l Image type \c source property to display the image, centered - in the delegate, specified for the list element by the \c image role in the - \c rssFeeds list model: - - \skipto Image - \printuntil } - - We use a \l Text type to add titles to list elements: - - \printuntil Behavior - \printuntil } - - We use the \c anchors property to position the title at the top of the list - element, with a 20-pixel margin. We use \c font properties to adjust font - size and text formatting. - - We use the \c color property to brighten the text and to scale it slightly - larger when the list item is the current item. By applying a \l Behavior to - the property, we animate the actions of selecting and deselecting list - items. - - We use a MouseArea type to download XML data when users tap a category list - element: - - \skipto MouseArea - \printuntil } - \printuntil } - - The \c anchors.fill property is set to \c delegate to enable users to tap - anywhere within the list element. - - We use the \c onClicked signal handler to load the XML data for the category - list. If the tapped category is already current, the \c reload() function - is called to reload the data. - - \section1 Downloading XML Data - - In rssnews.qml, we use an XmlListModel type as a data source for ListView - elements to display news items in the selected category: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto XmlListModel { - \printuntil namespaceDeclarations - - We use the \c source property and the \c window.currentFeed custom property - to fetch news items for the selected category. - - The \c query property specifies that the XmlListModel generates a model item - for each \c <item> in the XML document. - - We use the XmlRole type to specify the model item attributes. Each model - item has the \c title, \c description, \c image, \c link, and \c pubDate - attributes that match the values of the corresponding \c <item> in the XML - document: - - \printuntil pubDate - \printuntil } - - We use the \c feedModel model in a ListView type to display the data: - - \skipuntil ScrollBar - \skipto ListView - \printuntil } - \printuntil } - - To list the news items below the category list in portrait orientation and - to its right in landscape orientation, we use the \c isPortrait custom - property to anchor the top of the news items list to the left of \c window - and bottom of \c categories in portrait orientation and to the right of - \c categories and bottom of \c window in landscape orientation. - - We use the \c anchors.bottom property to anchor the bottom of the list view - to the bottom of the window in both orientations. - - In portrait orientation, we clip the painting of the news items to the - bounding rectangle of the list view to avoid graphical artifacts when news - items are scrolled over other items. In landscape, this is not required, - because the list spans the entire screen vertically. - - We use the \c model property to load XML data from the \c feedModel model, - and use \c NewsDelegate as the delegate to instantiate each item in the - list. - - In NewsDelegate.qml, we use a \l Column type to lay out the XML data: - - \quotefromfile demos/rssnews/content/NewsDelegate.qml - \skipto Column - \printuntil spacing - - Within the column, we use a \l Row and another column to position images and - title text: - - \skipto Row - \printuntil font.bold - \printuntil } - \printuntil } - - We generate a textual representation of how long ago the item was posted - using the \c timeSinceEvent() JavaScript function: - - \printuntil } - \printuntil } - - We use the \c onLinkActivated signal handler to open the URL in an external - browser when users select the link. - - \section1 Providing Feedback to Users - - In CategoryDelegate.qml, we use the \c BusyIndicator custom type to indicate - activity while the XML data is being loaded: - - \quotefromfile demos/rssnews/content/CategoryDelegate.qml - \skipto BusyIndicator - \printuntil } - - We use the \c scale property to reduce the indicator size to \c 0.8. We bind - the \c visible property to the \c isCurrentItem attached property of the - \c delegate list view and \c loading property of the main window to display - the indicator image when a category list item is the current item and XML - data is being loaded. - - We define the \c BusyIndicator type in \c BusyIndicator.qml. We use an - \l Image type to display an image and apply a NumberAnimation to its - \c rotation property to rotate the image in an infinite loop: - - \quotefromfile demos/rssnews/content/BusyIndicator.qml - \skipto Image - \printuntil } - \printuntil } - - In your apps, you can also use the BusyIndicator type from the - \l {Qt Quick Controls} module. - - \section1 Creating Scroll Bars - - In rssnews.qml, we use our own custom \c ScrollBar type to create scroll - bars in the category and news item list views. In your apps, you can also - use the ScrollView type from the \l {Qt Quick Controls} module. - - First, we create a scroll bar in the category list view. We bind the - \c orientation property to the \c isPortrait property and to the - \c Horizontal value of the \c Qt::Orientation enum type to display a - horizontal scroll bar in portrait orientation and to the \c Vertical value - to display a vertical scroll bar in landscape orientation: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto ScrollBar - \printuntil } - - Same as with the \c categories list view, we adjust the width and height of - the scroll bar based on the \c isPortrait property. - - We use the \c scrollArea property to display the scroll bar in the - \c categories list view. - - We use the \c anchors.right property to anchor the scroll bar to the right - side of the category list. - - \skipto ScrollBar - \printuntil } - - Second, we create another scroll bar in the news item list view. We want a - vertical scroll bar to appear on the right side of the view regardless of - screen orientation, so we can set the \c width property to \c 8 and bind the - \c anchors.right property to the \c window.right property. We use the - \c anchors.top property to anchor the scroll bar top to the bottom of the - category list in portrait orientation and to the top of the news item list - in landscape orientation. We use the \c anchors.bottom property to anchor - the scroll bar bottom to the list view bottom in both orientations. - - We define the \c ScrollBar type in \c ScrollBar.qml. We use an \l Item type - with custom properties to create a container for the scroll bar: - - \quotefromfile demos/rssnews/content/ScrollBar.qml - \skipto Item - \printuntil opacity - - We use a BorderImage type to display the scroll bar thumb at the x and y - position that we calculate by using the \c position() function: - - \skipto BorderImage - \printuntil height - \printuntil } - - We use the \c size function to calculate the thumb width and height - depending on the screen orientation. - - We use \c states to make the scroll bar visible when the users move the - scroll area: - - \printuntil } - \printuntil } - - We use \c transitions to apply a NumberAnimation to the \c "opacity" - property when the state changes from "visible" to the default state: - - \printuntil /^\}/ - - \section1 Creating Footers - - In rssnews.qml, we use a \l Component type with a \l Rectangle type to - create a footer for the news list view: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto Component - \printuntil } - \printuntil } - \printuntil } - - We bind the \c width of the footer to the width of the component and the - \c height to the of close button to align them when no news items are - displayed. - - \section1 Creating Buttons - - In rssnews.qml, we use an \l Image type to create a simple push button that - users can tap to close the app: - - \printuntil Qt.quit() - \printuntil } - \printuntil } - \printuntil } - - We use \c anchors to position the close button in the top right corner of - the news list view, with 4-pixel margins. Because the close button overlaps - the category list in portrait orientation, we animate the \c opacity - property to make the button almost fully transparent when users are - scrolling the category list. - - We use the \c onClicked signal handler within a MouseArea to call the - \c quit() function when users select the close button. - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/rssnews/main.cpp b/examples/quick/demos/rssnews/main.cpp deleted file mode 100644 index 08a2322845..0000000000 --- a/examples/quick/demos/rssnews/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/rssnews/rssnews) diff --git a/examples/quick/demos/rssnews/rssnews.pro b/examples/quick/demos/rssnews/rssnews.pro deleted file mode 100644 index c67c5a6558..0000000000 --- a/examples/quick/demos/rssnews/rssnews.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app - -QT += quick qml xml xmlpatterns -SOURCES += main.cpp -RESOURCES += rssnews.qrc - -OTHER_FILES = rssnews.qml \ - content/*.qml \ - content/*.js \ - content/images/* - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/rssnews -INSTALLS += target diff --git a/examples/quick/demos/rssnews/rssnews.qml b/examples/quick/demos/rssnews/rssnews.qml deleted file mode 100644 index bd1ed48af5..0000000000 --- a/examples/quick/demos/rssnews/rssnews.qml +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import QtQuick.XmlListModel 2.0 -import QtQuick.Window 2.1 -import "./content" - -Rectangle { - id: window - - width: 800 - height: 480 - - property string currentFeed: rssFeeds.get(0).feed - property bool loading: feedModel.status === XmlListModel.Loading - property bool isPortrait: Screen.primaryOrientation === Qt.PortraitOrientation - - onLoadingChanged: { - if (feedModel.status == XmlListModel.Ready) - list.positionViewAtBeginning() - } - - RssFeeds { id: rssFeeds } - - XmlListModel { - id: feedModel - - source: "http://" + window.currentFeed - query: "/rss/channel/item[child::media:content]" - namespaceDeclarations: "declare namespace media = 'http://search.yahoo.com/mrss/';" - - XmlRole { name: "title"; query: "title/string()" } - // Remove any links from the description - XmlRole { name: "description"; query: "fn:replace(description/string(), '\<a href=.*\/a\>', '')" } - XmlRole { name: "image"; query: "media:content/@url/string()" } - XmlRole { name: "link"; query: "link/string()" } - XmlRole { name: "pubDate"; query: "pubDate/string()" } - } - - ListView { - id: categories - property int itemWidth: 190 - - width: isPortrait ? parent.width : itemWidth - height: isPortrait ? itemWidth : parent.height - orientation: isPortrait ? ListView.Horizontal : ListView.Vertical - anchors.top: parent.top - model: rssFeeds - delegate: CategoryDelegate { itemSize: categories.itemWidth } - spacing: 3 - } - - ScrollBar { - id: listScrollBar - - orientation: isPortrait ? Qt.Horizontal : Qt.Vertical - height: isPortrait ? 8 : categories.height; - width: isPortrait ? categories.width : 8 - scrollArea: categories; - anchors.right: categories.right - } - - ListView { - id: list - - anchors.left: isPortrait ? window.left : categories.right - anchors.right: closeButton.left - anchors.top: isPortrait ? categories.bottom : window.top - anchors.bottom: window.bottom - anchors.leftMargin: 30 - anchors.rightMargin: 4 - clip: isPortrait - model: feedModel - footer: footerText - delegate: NewsDelegate {} - } - - ScrollBar { - scrollArea: list - width: 8 - anchors.right: window.right - anchors.top: isPortrait ? categories.bottom : window.top - anchors.bottom: window.bottom - } - - Component { - id: footerText - - Rectangle { - width: parent.width - height: closeButton.height - color: "lightgray" - - Text { - text: "RSS Feed from Yahoo News" - anchors.centerIn: parent - font.pixelSize: 14 - } - } - } - - Image { - id: closeButton - source: "content/images/btn_close.png" - scale: 0.8 - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 4 - opacity: (isPortrait && categories.moving) ? 0.2 : 1.0 - Behavior on opacity { - NumberAnimation { duration: 300; easing.type: Easing.OutSine } - } - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit() - } - } - } -} diff --git a/examples/quick/demos/rssnews/rssnews.qmlproject b/examples/quick/demos/rssnews/rssnews.qmlproject deleted file mode 100644 index 5becbdaed0..0000000000 --- a/examples/quick/demos/rssnews/rssnews.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "rssnews.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/rssnews/rssnews.qrc b/examples/quick/demos/rssnews/rssnews.qrc deleted file mode 100644 index 1208d44fd7..0000000000 --- a/examples/quick/demos/rssnews/rssnews.qrc +++ /dev/null @@ -1,25 +0,0 @@ -<RCC> - <qresource prefix="/demos/rssnews"> - <file>rssnews.qml</file> - <file>content/BusyIndicator.qml</file> - <file>content/CategoryDelegate.qml</file> - <file>content/NewsDelegate.qml</file> - <file>content/RssFeeds.qml</file> - <file>content/ScrollBar.qml</file> - <file>content/images/btn_close.png</file> - <file>content/images/Business.jpg</file> - <file>content/images/busy.png</file> - <file>content/images/Entertainment.jpg</file> - <file>content/images/Europe.jpg</file> - <file>content/images/Health.jpg</file> - <file>content/images/Asia.jpg</file> - <file>content/images/Politics.jpg</file> - <file>content/images/Science.jpg</file> - <file>content/images/scrollbar.png</file> - <file>content/images/Sports.jpg</file> - <file>content/images/Technology.jpg</file> - <file>content/images/TopStories.jpg</file> - <file>content/images/USNational.jpg</file> - <file>content/images/World.jpg</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/samegame/content/Block.qml b/examples/quick/demos/samegame/content/Block.qml deleted file mode 100644 index eadb2dcf62..0000000000 --- a/examples/quick/demos/samegame/content/Block.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: block - property bool dying: false - property bool spawned: false - property int type: 0 - property ParticleSystem particleSystem - - Behavior on x { - enabled: spawned; - SpringAnimation{ spring: 2; damping: 0.2 } - } - Behavior on y { - SpringAnimation{ spring: 2; damping: 0.2 } - } - - Image { - id: img - source: { - if (type == 0){ - "gfx/red.png"; - } else if (type == 1) { - "gfx/blue.png"; - } else if (type == 2) { - "gfx/green.png"; - } else { - "gfx/yellow.png"; - } - } - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - anchors.fill: parent - } - - //Foreground particles - BlockEmitter { - id: particles - system: particleSystem - group: { - if (type == 0){ - "red"; - } else if (type == 1) { - "blue"; - } else if (type == 2) { - "green"; - } else { - "yellow"; - } - } - anchors.fill: parent - } - - //Paint particles on the background - PaintEmitter { - id: particles2 - system: particleSystem - } - - states: [ - State { - name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - - State { - name: "DeathState"; when: dying == true - StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100); particles2.pulse(100);} } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/examples/quick/demos/samegame/content/BlockEmitter.qml b/examples/quick/demos/samegame/content/BlockEmitter.qml deleted file mode 100644 index 840c57a25e..0000000000 --- a/examples/quick/demos/samegame/content/BlockEmitter.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -// Needed for singletons QTBUG-34418 -import "." - -Emitter { - property Item block: parent - velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -40; magnitudeVariation: 40} - acceleration: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -100;} - shape: EllipseShape{fill:true} - enabled: false; - lifeSpan: 700; lifeSpanVariation: 100 - emitRate: 1000 - maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number) - size: Settings.blockSize * 0.85 - endSize: Settings.blockSize * 0.85 /2 -} diff --git a/examples/quick/demos/samegame/content/Button.qml b/examples/quick/demos/samegame/content/Button.qml deleted file mode 100644 index 8cbfe532f2..0000000000 --- a/examples/quick/demos/samegame/content/Button.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - property alias imgSrc: image.source - property alias system: emitter.system - property alias group: emitter.group - signal clicked - property bool rotatedButton: false - - width: image.width - height: image.sourceSize.height - Image { - id: image - height: parent.height - width: height/sourceSize.height * sourceSize.width - - anchors.horizontalCenter: parent.horizontalCenter - rotation: rotatedButton ? ((Math.random() * 3 + 2) * (Math.random() <= 0.5 ? -1 : 1)) : 0 - MenuEmitter { - id: emitter - anchors.fill: parent - //shape: MaskShape {source: image.source} - } - } - MouseArea { - anchors.fill: parent - onClicked: {parent.clicked(); emitter.burst(400);} - } -} diff --git a/examples/quick/demos/samegame/content/GameArea.qml b/examples/quick/demos/samegame/content/GameArea.qml deleted file mode 100644 index ab5e98e27a..0000000000 --- a/examples/quick/demos/samegame/content/GameArea.qml +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "samegame.js" as Logic -import "." - -Item { - id: gameCanvas - property bool gameOver: true - property int score: 0 - property int highScore: 0 - property int moves: 0 - property string mode: "" - property ParticleSystem ps: particleSystem - //For easy theming - property alias backgroundVisible: bg.visible - property string background: "gfx/background.png" - property string blockFile: "Block.qml" - property int blockSize: Settings.blockSize - onBlockFileChanged: Logic.changeBlock(blockFile); - property alias particlePack: auxLoader.source - //For multiplayer - property int score2: 0 - property int curTurn: 1 - property bool autoTurnChange: false - signal swapPlayers - property bool swapping: false - //onSwapPlayers: if (autoTurnChange) Logic.turnChange();//Now implemented below - //For puzzle - property url level - property bool puzzleWon: false - signal puzzleLost //Since root is tracking the puzzle progress - function showPuzzleEnd (won) { - if (won) { - smokeParticle.color = Qt.rgba(0,1,0,0); - puzzleWin.play(); - } else { - smokeParticle.color = Qt.rgba(1,0,0,0); - puzzleFail.play(); - puzzleLost(); - } - } - function showPuzzleGoal (str) { - puzzleTextBubble.opacity = 1; - puzzleTextLabel.text = str; - } - Image { - id: bg - z: -1 - anchors.fill: parent - source: background; - fillMode: Image.PreserveAspectCrop - } - - MouseArea { - anchors.fill: parent; onClicked: { - if (puzzleTextBubble.opacity == 1) { - puzzleTextBubble.opacity = 0; - Logic.finishLoadingMap(); - } else if (!swapping) { - Logic.handleClick(mouse.x,mouse.y); - } - } - } - - Image { - id: highScoreTextBubble - opacity: mode == "arcade" && gameOver && gameCanvas.score == gameCanvas.highScore ? 1 : 0 - Behavior on opacity { NumberAnimation {} } - anchors.centerIn: parent - z: 10 - source: "gfx/bubble-highscore.png" - Image { - anchors.centerIn: parent - source: "gfx/text-highscore-new.png" - rotation: -10 - } - } - - Image { - id: puzzleTextBubble - anchors.centerIn: parent - opacity: 0 - Behavior on opacity { NumberAnimation {} } - z: 10 - source: "gfx/bubble-puzzle.png" - Connections { - target: gameCanvas - onModeChanged: if (mode != "puzzle" && puzzleTextBubble.opacity > 0) puzzleTextBubble.opacity = 0; - } - Text { - id: puzzleTextLabel - width: parent.width - 24 - anchors.centerIn: parent - horizontalAlignment: Text.AlignHCenter - color: "white" - font.pixelSize: 24 - font.bold: true - wrapMode: Text.WordWrap - } - } - onModeChanged: { - p1WonImg.opacity = 0; - p2WonImg.opacity = 0; - } - SmokeText { id: puzzleWin; source: "gfx/icon-ok.png"; system: particleSystem } - SmokeText { id: puzzleFail; source: "gfx/icon-fail.png"; system: particleSystem } - - onSwapPlayers: { - smokeParticle.color = "yellow" - Logic.turnChange(); - if (curTurn == 1) { - p1Text.play(); - } else { - p2Text.play(); - } - clickDelay.running = true; - } - SequentialAnimation { - id: clickDelay - ScriptAction { script: gameCanvas.swapping = true; } - PauseAnimation { duration: 750 } - ScriptAction { script: gameCanvas.swapping = false; } - } - - SmokeText { - id: p1Text; source: "gfx/text-p1-go.png"; - system: particleSystem; playerNum: 1 - opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 - } - - SmokeText { - id: p2Text; source: "gfx/text-p2-go.png"; - system: particleSystem; playerNum: 2 - opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 - } - - onGameOverChanged: { - if (gameCanvas.mode == "multiplayer") { - if (gameCanvas.score >= gameCanvas.score2) { - p1WonImg.opacity = 1; - } else { - p2WonImg.opacity = 1; - } - } - } - Image { - id: p1WonImg - source: "gfx/text-p1-won.png" - anchors.centerIn: parent - opacity: 0 - Behavior on opacity { NumberAnimation {} } - z: 10 - } - Image { - id: p2WonImg - source: "gfx/text-p2-won.png" - anchors.centerIn: parent - opacity: 0 - Behavior on opacity { NumberAnimation {} } - z: 10 - } - - ParticleSystem{ - id: particleSystem; - anchors.fill: parent - z: 5 - ImageParticle { - id: smokeParticle - groups: ["smoke"] - source: "gfx/particle-smoke.png" - alpha: 0.1 - alphaVariation: 0.1 - color: "yellow" - } - Loader { - id: auxLoader - anchors.fill: parent - source: "PrimaryPack.qml" - onItemChanged: { - if (item && "particleSystem" in item) - item.particleSystem = particleSystem - if (item && "gameArea" in item) - item.gameArea = gameCanvas - } - } - } -} - diff --git a/examples/quick/demos/samegame/content/LogoAnimation.qml b/examples/quick/demos/samegame/content/LogoAnimation.qml deleted file mode 100644 index 99a056adcc..0000000000 --- a/examples/quick/demos/samegame/content/LogoAnimation.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container //Positioned where the 48x48 S/G should be - property alias running: mainAnim.running - property ParticleSystem particleSystem - property int dur: 500 - signal boomTime - Image { - id: s1 - source: "gfx/logo-s.png" - y: 0 - } - Image { - id: g1 - source: "gfx/logo-g.png" - y: -128 - } - Column { - Repeater { - model: 2 - Item { - width: 48 - height: 48 - BlockEmitter { - id: emitter - anchors.fill: parent - group: "red" - system: particleSystem - Connections { - target: container - onBoomTime: emitter.pulse(100); - } - } - } - } - } - SequentialAnimation { - id: mainAnim - running: true - loops: -1 - PropertyAction { target: g1; property: "y"; value: -128} - PropertyAction { target: g1; property: "opacity"; value: 1} - PropertyAction { target: s1; property: "y"; value: 0} - PropertyAction { target: s1; property: "opacity"; value: 1} - NumberAnimation { target: g1; property: "y"; from: -96; to: -48; duration: dur} - ParallelAnimation { - NumberAnimation { target: g1; property: "y"; from: -48; to: 0; duration: dur} - NumberAnimation { target: s1; property: "y"; from: 0; to: 48; duration: dur } - } - PauseAnimation { duration: dur } - ScriptAction { script: container.boomTime(); } - ParallelAnimation { - NumberAnimation { target: g1; property: "opacity"; to: 0; duration: dur } - NumberAnimation { target: s1; property: "opacity"; to: 0; duration: dur } - } - PropertyAction { target: s1; property: "y"; value: -128} - PropertyAction { target: s1; property: "opacity"; value: 1} - NumberAnimation { target: s1; property: "y"; from: -96; to: 0; duration: dur * 2} - } -} diff --git a/examples/quick/demos/samegame/content/MenuEmitter.qml b/examples/quick/demos/samegame/content/MenuEmitter.qml deleted file mode 100644 index 694badbbb9..0000000000 --- a/examples/quick/demos/samegame/content/MenuEmitter.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Emitter { - anchors.fill: parent - velocity: AngleDirection{angleVariation: 360; magnitude: 140; magnitudeVariation: 40} - enabled: false; - lifeSpan: 500; - emitRate: 1 - size: 28 - endSize: 14 - group: "yellow" -} diff --git a/examples/quick/demos/samegame/content/PaintEmitter.qml b/examples/quick/demos/samegame/content/PaintEmitter.qml deleted file mode 100644 index 15b217d6a8..0000000000 --- a/examples/quick/demos/samegame/content/PaintEmitter.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "." - -Emitter { - property Item block: parent - anchors.fill: parent - shape: EllipseShape { fill: true } - group: { - if (block.type == 0){ - "redspots"; - } else if (block.type == 1) { - "bluespots"; - } else if (block.type == 2) { - "greenspots"; - } else { - "yellowspots"; - } - } - size: Settings.blockSize * 2 - endSize: Settings.blockSize/2 - lifeSpan: 30000 - enabled: false - emitRate: 60 - maximumEmitted: 60 - velocity: PointDirection{ y: 4; yVariation: 4 } - /* Possibly better, but dependent on gerrit change,28212 - property real mainIntensity: 0.8 - property real subIntensity: 0.1 - property real colorVariation: 0.005 - onEmitParticles: {//One group, many colors, for better stacking - for (var i=0; i<particles.length; i++) { - var particle = particles[i]; - if (block.type == 0) { - particle.red = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.green = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.blue = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - } else if (block.type == 1) { - particle.red = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.green = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.blue = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - } else if (block.type == 2) { - particle.red = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.green = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.blue = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - } else if (block.type == 3) { - particle.red = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.green = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.blue = subIntensity + (Math.random() * colorVariation * 2 - colorVariation); - } else { - particle.red = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.green = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - particle.blue = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation); - } - } - } - */ -} diff --git a/examples/quick/demos/samegame/content/PrimaryPack.qml b/examples/quick/demos/samegame/content/PrimaryPack.qml deleted file mode 100644 index ecb30eb411..0000000000 --- a/examples/quick/demos/samegame/content/PrimaryPack.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property ParticleSystem particleSystem - property GameArea gameArea - onGameAreaChanged: bgstacker.parent = gameArea;//Move to direct child of game canvas - Item { - id: bgstacker - z: 0 - ImageParticle { - groups: ["yellowspots"] - color: Qt.darker("yellow");//Actually want desaturated... - system: particleSystem - source: "gfx/particle-paint.png" - colorVariation: 0.2 - alpha: 0.2 - entryEffect: ImageParticle.None - } - ImageParticle { - groups: ["redspots"] - system: particleSystem - color: Qt.darker("red");//Actually want desaturated... - source: "gfx/particle-paint.png" - colorVariation: 0.2 - alpha: 0.2 - entryEffect: ImageParticle.None - } - ImageParticle { - groups: ["greenspots"] - system: particleSystem - color: Qt.darker("green");//Actually want desaturated... - source: "gfx/particle-paint.png" - colorVariation: 0.2 - alpha: 0.2 - entryEffect: ImageParticle.None - } - ImageParticle { - groups: ["bluespots"] - system: particleSystem - color: Qt.darker("blue");//Actually want desaturated... - source: "gfx/particle-paint.png" - colorVariation: 0.2 - alpha: 0.2 - entryEffect: ImageParticle.None - } - } - ImageParticle { - groups: ["yellow"] - system: particleSystem - color: Qt.darker("yellow");//Actually want desaturated... - source: "gfx/particle-brick.png" - colorVariation: 0.4 - alpha: 0.1 - } - ImageParticle { - groups: ["red"] - system: particleSystem - color: Qt.darker("red");//Actually want desaturated... - source: "gfx/particle-brick.png" - colorVariation: 0.4 - alpha: 0.1 - } - ImageParticle { - groups: ["green"] - system: particleSystem - color: Qt.darker("green");//Actually want desaturated... - source: "gfx/particle-brick.png" - colorVariation: 0.4 - alpha: 0.1 - } - ImageParticle { - groups: ["blue"] - system: particleSystem - color: Qt.darker("blue");//Actually want desaturated... - source: "gfx/particle-brick.png" - colorVariation: 0.4 - alpha: 0.1 - } -} diff --git a/examples/quick/demos/samegame/content/PuzzleBlock.qml b/examples/quick/demos/samegame/content/PuzzleBlock.qml deleted file mode 100644 index e91bf48130..0000000000 --- a/examples/quick/demos/samegame/content/PuzzleBlock.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: block - property bool dying: false - property bool spawned: false - property int type: 0 - property ParticleSystem particleSystem - - Behavior on x { - enabled: spawned; - NumberAnimation{ easing.type: Easing.OutBounce } - } - Behavior on y { - NumberAnimation{ easing.type: Easing.InQuad } - } - - Image { - id: img - source: { - if (type == 0){ - "gfx/red-puzzle.png"; - } else if (type == 1) { - "gfx/blue-puzzle.png"; - } else if (type == 2) { - "gfx/green-puzzle.png"; - } else { - "gfx/yellow-puzzle.png"; - } - } - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - anchors.centerIn: parent - anchors.verticalCenterOffset: -4 - anchors.horizontalCenterOffset: 4 - } - - //Foreground particles - BlockEmitter { - id: particles - system: particleSystem - group: { - if (type == 0){ - "red"; - } else if (type == 1) { - "blue"; - } else if (type == 2) { - "green"; - } else { - "yellow"; - } - } - anchors.fill: parent - } - - states: [ - State { - name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - - State { - name: "DeathState"; when: dying == true - PropertyChanges { target: img; scale: 2 } - StateChangeScript { script: particles.pulse(200); } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/examples/quick/demos/samegame/content/SamegameText.qml b/examples/quick/demos/samegame/content/SamegameText.qml deleted file mode 100644 index 1ff447edc9..0000000000 --- a/examples/quick/demos/samegame/content/SamegameText.qml +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2012 Research In Motion -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "." - -Text { - font.pixelSize: Settings.fontPixelSize; - color: "white"; - textFormat: Text.StyledText; - Behavior on opacity { NumberAnimation {} } -} diff --git a/examples/quick/demos/samegame/content/Settings.qml b/examples/quick/demos/samegame/content/Settings.qml deleted file mode 100644 index 0de099b9c3..0000000000 --- a/examples/quick/demos/samegame/content/Settings.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -pragma Singleton -import QtQml 2.0 - -QtObject { - property int screenHeight: 480 - property int screenWidth: 320 - - property int menuDelay: 500 - - property int headerHeight: 20 // 70 on BB10 - property int footerHeight: 44 // 100 on BB10 - - property int fontPixelSize: 14 // 55 on BB10 - - property int blockSize: 32 // 64 on BB10 - - property int toolButtonHeight: 32 // 64 on BB10 - - property int menuButtonSpacing: 0 // 15 on BB10 -} diff --git a/examples/quick/demos/samegame/content/SimpleBlock.qml b/examples/quick/demos/samegame/content/SimpleBlock.qml deleted file mode 100644 index 1f15ce51be..0000000000 --- a/examples/quick/demos/samegame/content/SimpleBlock.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: block - property bool dying: false - property bool spawned: false - property int type: 0 - property ParticleSystem particleSystem - - Behavior on x { - enabled: spawned; - SpringAnimation{ spring: 2; damping: 0.2 } - } - Behavior on y { - SpringAnimation{ spring: 2; damping: 0.2 } - } - - Image { - id: img - source: { - if (type == 0){ - "gfx/red.png"; - } else if (type == 1) { - "gfx/blue.png"; - } else if (type == 2) { - "gfx/green.png"; - } else { - "gfx/yellow.png"; - } - } - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - anchors.fill: parent - } - - //Foreground particles - BlockEmitter { - id: particles - system: particleSystem - group: { - if (type == 0){ - "red"; - } else if (type == 1) { - "blue"; - } else if (type == 2) { - "green"; - } else { - "yellow"; - } - } - anchors.fill: parent - } - - states: [ - State { - name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - - State { - name: "DeathState"; when: dying == true - StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100); } } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/examples/quick/demos/samegame/content/SmokeText.qml b/examples/quick/demos/samegame/content/SmokeText.qml deleted file mode 100644 index 85ebb14b99..0000000000 --- a/examples/quick/demos/samegame/content/SmokeText.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - z: 10 - property alias source: img.source - property alias system: emitter.system - property int playerNum: 1 - function play() { - anim.running = true; - } - anchors.centerIn: parent - Image { - opacity: 0 - id: img - anchors.centerIn: parent - rotation: playerNum == 1 ? -8 : -5 - Emitter { - id: emitter - group: "smoke" - anchors.fill: parent - shape: MaskShape { source: img.source } - enabled: false - emitRate: 1000 - lifeSpan: 600 - size: 64 - endSize: 32 - velocity: AngleDirection { angleVariation: 360; magnitudeVariation: 160 } - } - } - SequentialAnimation { - id: anim - running: false - PauseAnimation { duration: 500} - ParallelAnimation { - NumberAnimation { target: img; property: "opacity"; from: 0.1; to: 1.0 } - NumberAnimation { target: img; property: "scale"; from: 0.1; to: 1.0 } - } - PauseAnimation { duration: 250} - ScriptAction { script: emitter.pulse(100); } - NumberAnimation { target: img; property: "opacity"; from: 1.0; to: 0.0 } - } -} diff --git a/examples/quick/demos/samegame/content/gfx/background-puzzle.png b/examples/quick/demos/samegame/content/gfx/background-puzzle.png Binary files differdeleted file mode 100644 index c2eca5f5dc..0000000000 --- a/examples/quick/demos/samegame/content/gfx/background-puzzle.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/background.png b/examples/quick/demos/samegame/content/gfx/background.png Binary files differdeleted file mode 100644 index 60f57b650f..0000000000 --- a/examples/quick/demos/samegame/content/gfx/background.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/bar.png b/examples/quick/demos/samegame/content/gfx/bar.png Binary files differdeleted file mode 100644 index 4953cd6221..0000000000 --- a/examples/quick/demos/samegame/content/gfx/bar.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/blue-puzzle.png b/examples/quick/demos/samegame/content/gfx/blue-puzzle.png Binary files differdeleted file mode 100644 index e550d5935b..0000000000 --- a/examples/quick/demos/samegame/content/gfx/blue-puzzle.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/blue.png b/examples/quick/demos/samegame/content/gfx/blue.png Binary files differdeleted file mode 100644 index b8161c0f70..0000000000 --- a/examples/quick/demos/samegame/content/gfx/blue.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/bubble-highscore.png b/examples/quick/demos/samegame/content/gfx/bubble-highscore.png Binary files differdeleted file mode 100644 index c4e38df824..0000000000 --- a/examples/quick/demos/samegame/content/gfx/bubble-highscore.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/bubble-puzzle.png b/examples/quick/demos/samegame/content/gfx/bubble-puzzle.png Binary files differdeleted file mode 100644 index 278556bc8d..0000000000 --- a/examples/quick/demos/samegame/content/gfx/bubble-puzzle.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-game-1.png b/examples/quick/demos/samegame/content/gfx/but-game-1.png Binary files differdeleted file mode 100644 index 3343b7ff13..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-game-1.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-game-2.png b/examples/quick/demos/samegame/content/gfx/but-game-2.png Binary files differdeleted file mode 100644 index afba106962..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-game-2.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-game-3.png b/examples/quick/demos/samegame/content/gfx/but-game-3.png Binary files differdeleted file mode 100644 index adea77a687..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-game-3.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-game-4.png b/examples/quick/demos/samegame/content/gfx/but-game-4.png Binary files differdeleted file mode 100644 index 18c922ba45..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-game-4.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-game-new.png b/examples/quick/demos/samegame/content/gfx/but-game-new.png Binary files differdeleted file mode 100644 index 257e182585..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-game-new.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-menu.png b/examples/quick/demos/samegame/content/gfx/but-menu.png Binary files differdeleted file mode 100644 index 8440e87759..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-menu.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-puzzle-next.png b/examples/quick/demos/samegame/content/gfx/but-puzzle-next.png Binary files differdeleted file mode 100644 index 7e3ed417d0..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-puzzle-next.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/but-quit.png b/examples/quick/demos/samegame/content/gfx/but-quit.png Binary files differdeleted file mode 100644 index 95c77ced94..0000000000 --- a/examples/quick/demos/samegame/content/gfx/but-quit.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/green-puzzle.png b/examples/quick/demos/samegame/content/gfx/green-puzzle.png Binary files differdeleted file mode 100644 index 581f76fd8d..0000000000 --- a/examples/quick/demos/samegame/content/gfx/green-puzzle.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/green.png b/examples/quick/demos/samegame/content/gfx/green.png Binary files differdeleted file mode 100644 index da4cca5e7f..0000000000 --- a/examples/quick/demos/samegame/content/gfx/green.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/icon-fail.png b/examples/quick/demos/samegame/content/gfx/icon-fail.png Binary files differdeleted file mode 100644 index 40726118a9..0000000000 --- a/examples/quick/demos/samegame/content/gfx/icon-fail.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/icon-ok.png b/examples/quick/demos/samegame/content/gfx/icon-ok.png Binary files differdeleted file mode 100644 index 15a8442e94..0000000000 --- a/examples/quick/demos/samegame/content/gfx/icon-ok.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/icon-time.png b/examples/quick/demos/samegame/content/gfx/icon-time.png Binary files differdeleted file mode 100644 index 9490e49e90..0000000000 --- a/examples/quick/demos/samegame/content/gfx/icon-time.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/logo-a.png b/examples/quick/demos/samegame/content/gfx/logo-a.png Binary files differdeleted file mode 100644 index 20c20ba480..0000000000 --- a/examples/quick/demos/samegame/content/gfx/logo-a.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/logo-e.png b/examples/quick/demos/samegame/content/gfx/logo-e.png Binary files differdeleted file mode 100644 index dd663f114a..0000000000 --- a/examples/quick/demos/samegame/content/gfx/logo-e.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/logo-g.png b/examples/quick/demos/samegame/content/gfx/logo-g.png Binary files differdeleted file mode 100644 index a319bf9ffa..0000000000 --- a/examples/quick/demos/samegame/content/gfx/logo-g.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/logo-m.png b/examples/quick/demos/samegame/content/gfx/logo-m.png Binary files differdeleted file mode 100644 index 6a029b3267..0000000000 --- a/examples/quick/demos/samegame/content/gfx/logo-m.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/logo-s.png b/examples/quick/demos/samegame/content/gfx/logo-s.png Binary files differdeleted file mode 100644 index 963b17546a..0000000000 --- a/examples/quick/demos/samegame/content/gfx/logo-s.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/logo.png b/examples/quick/demos/samegame/content/gfx/logo.png Binary files differdeleted file mode 100644 index e900eddb2f..0000000000 --- a/examples/quick/demos/samegame/content/gfx/logo.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/particle-brick.png b/examples/quick/demos/samegame/content/gfx/particle-brick.png Binary files differdeleted file mode 100644 index 5c83896d22..0000000000 --- a/examples/quick/demos/samegame/content/gfx/particle-brick.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/particle-paint.png b/examples/quick/demos/samegame/content/gfx/particle-paint.png Binary files differdeleted file mode 100644 index 9bd0a2a13f..0000000000 --- a/examples/quick/demos/samegame/content/gfx/particle-paint.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/particle-smoke.png b/examples/quick/demos/samegame/content/gfx/particle-smoke.png Binary files differdeleted file mode 100644 index b27f954a79..0000000000 --- a/examples/quick/demos/samegame/content/gfx/particle-smoke.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/red-puzzle.png b/examples/quick/demos/samegame/content/gfx/red-puzzle.png Binary files differdeleted file mode 100644 index 9ceb17e4d0..0000000000 --- a/examples/quick/demos/samegame/content/gfx/red-puzzle.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/red.png b/examples/quick/demos/samegame/content/gfx/red.png Binary files differdeleted file mode 100644 index 681810fe3b..0000000000 --- a/examples/quick/demos/samegame/content/gfx/red.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-highscore-new.png b/examples/quick/demos/samegame/content/gfx/text-highscore-new.png Binary files differdeleted file mode 100644 index 50f7fcd0f6..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-highscore-new.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-highscore.png b/examples/quick/demos/samegame/content/gfx/text-highscore.png Binary files differdeleted file mode 100644 index 7198c277b8..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-highscore.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-no-winner.png b/examples/quick/demos/samegame/content/gfx/text-no-winner.png Binary files differdeleted file mode 100644 index b4a6685111..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-no-winner.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-p1-go.png b/examples/quick/demos/samegame/content/gfx/text-p1-go.png Binary files differdeleted file mode 100644 index c7bd2a5e75..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-p1-go.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-p1-won.png b/examples/quick/demos/samegame/content/gfx/text-p1-won.png Binary files differdeleted file mode 100644 index 41c2eb7c98..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-p1-won.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-p1.png b/examples/quick/demos/samegame/content/gfx/text-p1.png Binary files differdeleted file mode 100644 index b59c87b977..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-p1.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-p2-go.png b/examples/quick/demos/samegame/content/gfx/text-p2-go.png Binary files differdeleted file mode 100644 index f03cd93afa..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-p2-go.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-p2-won.png b/examples/quick/demos/samegame/content/gfx/text-p2-won.png Binary files differdeleted file mode 100644 index 116b7f2e7a..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-p2-won.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/text-p2.png b/examples/quick/demos/samegame/content/gfx/text-p2.png Binary files differdeleted file mode 100644 index d4f2bc7335..0000000000 --- a/examples/quick/demos/samegame/content/gfx/text-p2.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/yellow-puzzle.png b/examples/quick/demos/samegame/content/gfx/yellow-puzzle.png Binary files differdeleted file mode 100644 index 66044c81b4..0000000000 --- a/examples/quick/demos/samegame/content/gfx/yellow-puzzle.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/gfx/yellow.png b/examples/quick/demos/samegame/content/gfx/yellow.png Binary files differdeleted file mode 100644 index 6bc5d385e3..0000000000 --- a/examples/quick/demos/samegame/content/gfx/yellow.png +++ /dev/null diff --git a/examples/quick/demos/samegame/content/levels/TemplateBase.qml b/examples/quick/demos/samegame/content/levels/TemplateBase.qml deleted file mode 100644 index 85f8b64703..0000000000 --- a/examples/quick/demos/samegame/content/levels/TemplateBase.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle{ - id: control - property int scoreTarget: -1 - property int timeTarget: -1 - property int moveTarget: -1 - property bool mustClear: true - property string goalText: "Clear the level..." - - property var startingGrid //If this isn't an array of ints, we will refuse to load the level. - /* Ints are 0-4. If not enough ints are there it will be prepadded with 0s to fill the grid - (which ruins everything if you have the wrong number of rows). - 0 - No block - 1 - Red - 2 - Blue - 3 - Green - 4 - Yellow - Ideas for future colors, but not supported in this version: - 5 - Purple - 6 - Cyan - 7 - Gray - 8 - Black - 9 - White - */ - - width: 320 - height: 416 - color: "white" //TODO: Theme support for both setting themes per level, and seeing it in the control! -} diff --git a/examples/quick/demos/samegame/content/levels/level0.qml b/examples/quick/demos/samegame/content/levels/level0.qml deleted file mode 100644 index a3cc06d548..0000000000 --- a/examples/quick/demos/samegame/content/levels/level0.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - moveTarget: 3 - goalText: "1 of 10<br><br>Clear in three moves..." - startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , - 0 , 0 , 0 , 0 , 0 , 1 , 1 , 2 , 1 , 1 , - 0 , 0 , 0 , 1 , 1 , 3 , 3 , 3 , 3 , 3 , - 0 , 1 , 1 , 3 , 3 , 3 , 1 , 3 , 1 , 1 , - 1 , 2 , 3 , 3 , 1 , 1 , 3 , 3 , 3 , 3 , - 1 , 3 , 3 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , - 1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level1.qml b/examples/quick/demos/samegame/content/levels/level1.qml deleted file mode 100644 index b9457aec4b..0000000000 --- a/examples/quick/demos/samegame/content/levels/level1.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - timeTarget: 10 - goalText: "2 of 10<br><br>Clear in 10 seconds..." - startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , 2 , - 1 , 2 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , - 2 , 2 , 1 , 3 , 3 , 3 , 1 , 1 , 1 , 2 , - 2 , 1 , 1 , 1 , 3 , 3 , 3 , 1 , 2 , 2 , - 1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 , 2 , 1 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level2.qml b/examples/quick/demos/samegame/content/levels/level2.qml deleted file mode 100644 index d7863ad286..0000000000 --- a/examples/quick/demos/samegame/content/levels/level2.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - scoreTarget: 1200 - timeTarget: 60 - goalText: "3 of 10<br><br>Score over 1200 points in one minute..." - mustClear: false - startingGrid: [ 3 , 1 , 2 , 1 , 1 , 2 , 1 , 1 , 3 , 3 , - 1 , 3 , 3 , 2 , 3 , 3 , 1 , 1 , 3 , 1 , - 3 , 1 , 3 , 3 , 2 , 3 , 3 , 3 , 1 , 2 , - 3 , 2 , 2 , 1 , 3 , 3 , 2 , 1 , 1 , 2 , - 3 , 1 , 2 , 2 , 2 , 2 , 2 , 1 , 3 , 1 , - 2 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , 3 , 2 , - 3 , 2 , 1 , 1 , 3 , 3 , 3 , 2 , 2 , 1 , - 1 , 2 , 2 , 3 , 2 , 3 , 3 , 3 , 1 , 1 , - 1 , 3 , 3 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , - 3 , 3 , 2 , 1 , 2 , 2 , 1 , 1 , 1 , 3 , - 2 , 1 , 3 , 2 , 3 , 2 , 3 , 2 , 2 , 1 , - 1 , 3 , 1 , 2 , 1 , 2 , 3 , 1 , 2 , 2 , - 1 , 2 , 2 , 2 , 1 , 1 , 2 , 3 , 1 , 2 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level3.qml b/examples/quick/demos/samegame/content/levels/level3.qml deleted file mode 100644 index e9b9b15190..0000000000 --- a/examples/quick/demos/samegame/content/levels/level3.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - scoreTarget: 3000 - timeTarget: 60 - goalText: "4 of 10<br>Clear the board with over 3000 points in under a minute..." - startingGrid: [ 3 , 3 , 1 , 1 , 1 , 2 , 2 , 4 , 3 , 3 , - 4 , 3 , 1 , 4 , 2 , 2 , 2 , 4 , 3 , 4 , - 4 , 3 , 3 , 4 , 1 , 1 , 3 , 3 , 4 , 4 , - 3 , 3 , 3 , 3 , 3 , 1 , 3 , 2 , 2 , 4 , - 4 , 4 , 3 , 4 , 3 , 1 , 4 , 4 , 4 , 4 , - 4 , 4 , 3 , 4 , 1 , 1 , 4 , 4 , 3 , 3 , - 4 , 2 , 2 , 2 , 2 , 2 , 4 , 4 , 4 , 1 , - 4 , 4 , 2 , 4 , 2 , 2 , 1 , 1 , 1 , 1 , - 4 , 4 , 2 , 4 , 2 , 2 , 1 , 4 , 4 , 1 , - 4 , 1 , 1 , 4 , 3 , 3 , 4 , 2 , 4 , 1 , - 4 , 1 , 1 , 2 , 3 , 3 , 4 , 2 , 2 , 1 , - 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 2 , 1 , - 4 , 1 , 1 , 2 , 2 , 3 , 4 , 3 , 4 , 4 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level4.qml b/examples/quick/demos/samegame/content/levels/level4.qml deleted file mode 100644 index 00e1d3703f..0000000000 --- a/examples/quick/demos/samegame/content/levels/level4.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - goalText: "5 of 10<br><br>Clear the level..." - startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 3 , 2 , 1 , 1 , 1 , 1 , 3 , 2 , 3 , - 1 , 2 , 3 , 1 , 3 , 2 , 2 , 1 , 1 , 2 , - 3 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 3 , 3 , - 2 , 1 , 1 , 3 , 2 , 1 , 1 , 2 , 1 , 3 , - 1 , 3 , 3 , 1 , 2 , 1 , 2 , 1 , 3 , 3 , - 1 , 3 , 2 , 2 , 2 , 1 , 1 , 3 , 2 , 3 , - 1 , 1 , 3 , 2 , 3 , 3 , 2 , 1 , 1 , 1 , - 1 , 2 , 2 , 3 , 2 , 2 , 1 , 3 , 1 , 3 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level5.qml b/examples/quick/demos/samegame/content/levels/level5.qml deleted file mode 100644 index 0be3c9d15d..0000000000 --- a/examples/quick/demos/samegame/content/levels/level5.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - moveTarget: 4 - goalText: "6 of 10<br><br>Clear in four or less moves..." - startingGrid: [ 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , - 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , - 4 , 2 , 4 , 4 , 4 , 3 , 2 , 3 , 4 , 4 , - 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , - 4 , 4 , 4 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , - 4 , 2 , 2 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , - 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , - 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , - 4 , 3 , 3 , 3 , 4 , 2 , 4 , 4 , 4 , 3 , - 4 , 3 , 3 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , - 4 , 3 , 4 , 3 , 4 , 2 , 4 , 4 , 4 , 4 , - 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , - 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level6.qml b/examples/quick/demos/samegame/content/levels/level6.qml deleted file mode 100644 index e4964678e3..0000000000 --- a/examples/quick/demos/samegame/content/levels/level6.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - moveTarget: 20 - timeTarget: 40 - goalText: "7 of 10<br><br>Clear with 20 moves in 40 seconds (or better)." - startingGrid: [ 1 , 3 , 1 , 1 , 1 , 1 , 2 , 1 , 2 , 2 , - 2 , 1 , 2 , 3 , 3 , 1 , 3 , 1 , 1 , 3 , - 3 , 1 , 1 , 1 , 2 , 2 , 3 , 2 , 3 , 1 , - 1 , 3 , 1 , 1 , 3 , 1 , 1 , 1 , 2 , 3 , - 2 , 1 , 1 , 1 , 3 , 2 , 3 , 3 , 2 , 3 , - 3 , 3 , 3 , 3 , 2 , 2 , 3 , 1 , 3 , 2 , - 2 , 2 , 3 , 2 , 2 , 3 , 2 , 2 , 2 , 2 , - 1 , 2 , 1 , 2 , 1 , 3 , 2 , 3 , 2 , 3 , - 1 , 1 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 2 , - 3 , 3 , 2 , 2 , 2 , 2 , 3 , 1 , 3 , 1 , - 1 , 2 , 3 , 3 , 3 , 1 , 3 , 2 , 1 , 2 , - 1 , 2 , 1 , 1 , 2 , 3 , 1 , 2 , 1 , 3 , - 3 , 1 , 2 , 2 , 1 , 3 , 3 , 1 , 3 , 2 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level7.qml b/examples/quick/demos/samegame/content/levels/level7.qml deleted file mode 100644 index bf190577d6..0000000000 --- a/examples/quick/demos/samegame/content/levels/level7.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - goalText: "8 of 10<br><br>Clear the grid." - startingGrid: [ 2 , 4 , 3 , 2 , 3 , 2 , 3 , 3 , 4 , 3 , - 2 , 2 , 3 , 3 , 1 , 4 , 3 , 3 , 3 , 2 , - 1 , 4 , 2 , 3 , 4 , 3 , 3 , 1 , 1 , 1 , - 2 , 1 , 2 , 4 , 4 , 2 , 2 , 3 , 2 , 1 , - 3 , 4 , 4 , 1 , 3 , 2 , 4 , 2 , 1 , 1 , - 2 , 2 , 3 , 1 , 2 , 4 , 1 , 2 , 1 , 2 , - 1 , 2 , 3 , 2 , 4 , 4 , 3 , 1 , 1 , 2 , - 4 , 4 , 2 , 1 , 2 , 4 , 2 , 2 , 4 , 3 , - 4 , 2 , 4 , 1 , 3 , 4 , 1 , 4 , 2 , 4 , - 4 , 3 , 4 , 1 , 4 , 3 , 1 , 3 , 1 , 1 , - 3 , 3 , 2 , 3 , 2 , 4 , 1 , 2 , 4 , 4 , - 3 , 4 , 2 , 2 , 4 , 3 , 4 , 1 , 3 , 2 , - 4 , 3 , 3 , 4 , 2 , 4 , 1 , 2 , 3 , 2 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level8.qml b/examples/quick/demos/samegame/content/levels/level8.qml deleted file mode 100644 index 45163e08b7..0000000000 --- a/examples/quick/demos/samegame/content/levels/level8.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - scoreTarget: 1000 - goalText: "9 of 10<br><br>Score over 1000 points" - startingGrid: [ 1 , 4 , 4 , 3 , 2 , 1 , 4 , 2 , 4 , 2 , - 2 , 3 , 4 , 4 , 1 , 1 , 1 , 4 , 4 , 4 , - 1 , 3 , 1 , 2 , 2 , 1 , 2 , 1 , 4 , 2 , - 4 , 3 , 4 , 2 , 1 , 4 , 1 , 2 , 2 , 3 , - 3 , 4 , 2 , 4 , 4 , 3 , 2 , 2 , 2 , 1 , - 4 , 4 , 3 , 2 , 4 , 4 , 2 , 1 , 1 , 1 , - 1 , 2 , 1 , 3 , 4 , 1 , 1 , 3 , 2 , 3 , - 3 , 4 , 2 , 2 , 1 , 3 , 2 , 2 , 4 , 2 , - 2 , 4 , 1 , 2 , 2 , 4 , 3 , 3 , 3 , 1 , - 1 , 2 , 2 , 4 , 1 , 2 , 2 , 3 , 3 , 3 , - 4 , 4 , 1 , 4 , 3 , 1 , 3 , 3 , 3 , 4 , - 1 , 2 , 4 , 1 , 2 , 1 , 1 , 4 , 2 , 1 , - 1 , 2 , 3 , 4 , 2 , 4 , 4 , 2 , 1 , 3 ] -} diff --git a/examples/quick/demos/samegame/content/levels/level9.qml b/examples/quick/demos/samegame/content/levels/level9.qml deleted file mode 100644 index 2498ca9abc..0000000000 --- a/examples/quick/demos/samegame/content/levels/level9.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TemplateBase{ - scoreTarget: 2000 - timeTarget: 60 - moveTarget: 20 - mustClear: false - goalText: "10 of 10<br><br>Score 2000 in one minute with less than 20 moves!" - startingGrid: [ 3 , 2 , 3 , 1 , 3 , 3 , 4 , 1 , 3 , 3 , - 2 , 3 , 2 , 1 , 1 , 2 , 2 , 2 , 4 , 1 , - 2 , 4 , 4 , 4 , 3 , 1 , 4 , 4 , 4 , 1 , - 3 , 1 , 3 , 4 , 4 , 2 , 2 , 2 , 2 , 3 , - 2 , 1 , 4 , 4 , 3 , 3 , 1 , 1 , 3 , 2 , - 3 , 2 , 1 , 4 , 3 , 4 , 1 , 3 , 4 , 2 , - 3 , 3 , 1 , 4 , 4 , 4 , 2 , 1 , 2 , 3 , - 2 , 3 , 4 , 3 , 4 , 1 , 1 , 3 , 2 , 4 , - 4 , 4 , 1 , 2 , 4 , 3 , 2 , 2 , 2 , 4 , - 1 , 4 , 2 , 2 , 1 , 1 , 2 , 1 , 1 , 4 , - 1 , 4 , 3 , 3 , 3 , 1 , 3 , 4 , 4 , 2 , - 3 , 4 , 1 , 1 , 2 , 2 , 2 , 3 , 2 , 1 , - 3 , 3 , 4 , 3 , 1 , 1 , 1 , 4 , 4 , 3 ] -} diff --git a/examples/quick/demos/samegame/content/qmldir b/examples/quick/demos/samegame/content/qmldir deleted file mode 100644 index 3b552ec1f1..0000000000 --- a/examples/quick/demos/samegame/content/qmldir +++ /dev/null @@ -1,13 +0,0 @@ -singleton Settings 1.0 Settings.qml -Block 1.0 Block.qml -BlockEmitter 1.0 BlockEmitter.qml -Button 1.0 Button.qml -GameArea 1.0 GameArea.qml -LogoAnimation 1.0 LogoAnimation.qml -MenuEmitter 1.0 MenuEmitter.qml -PaintEmitter 1.0 PaintEmitter.qml -PrimaryPack 1.0 PrimaryPack.qml -PuzzleBlock 1.0 PuzzleBlock.qml -SamegameText 1.0 SamegameText.qml -SimpleBlock 1.0 SimpleBlock.qml -SmokeText 1.0 SmokeText.qml diff --git a/examples/quick/demos/samegame/content/samegame.js b/examples/quick/demos/samegame/content/samegame.js deleted file mode 100644 index 8f32fb9007..0000000000 --- a/examples/quick/demos/samegame/content/samegame.js +++ /dev/null @@ -1,580 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* This script file handles the game logic */ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql - -var maxColumn = 10; -var maxRow = 13; -var types = 3; -var maxIndex = maxColumn*maxRow; -var board = new Array(maxIndex); -var blockSrc = "Block.qml"; -var gameDuration; -var component = Qt.createComponent(blockSrc); -var gameCanvas; -var betweenTurns = false; - -var puzzleLevel = null; -var puzzlePath = ""; - -var gameMode = "arcade"; //Set in new game, then tweaks behaviour of other functions -var gameOver = false; - -function changeBlock(src) -{ - blockSrc = src; - component = Qt.createComponent(blockSrc); -} - -// Index function used instead of a 2D array -function index(column, row) -{ - return column + row * maxColumn; -} - -function timeStr(msecs) -{ - var secs = Math.floor(msecs/1000); - var m = Math.floor(secs/60); - var ret = "" + m + "m " + (secs%60) + "s"; - return ret; -} - -function cleanUp() -{ - if (gameCanvas == undefined) - return; - // Delete blocks from previous game - for (var i = 0; i < maxIndex; i++) { - if (board[i] != null) - board[i].destroy(); - board[i] = null; - } - if (puzzleLevel != null){ - puzzleLevel.destroy(); - puzzleLevel = null; - } - gameCanvas.mode = "" -} - -function startNewGame(gc, mode, map) -{ - gameCanvas = gc; - if (mode == undefined) - gameMode = "arcade"; - else - gameMode = mode; - gameOver = false; - - cleanUp(); - - gc.gameOver = false; - gc.mode = gameMode; - // Calculate board size - maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize); - maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize); - maxIndex = maxRow * maxColumn; - if (gameMode == "arcade") //Needs to be after board sizing - getHighScore(); - - - // Initialize Board - board = new Array(maxIndex); - gameCanvas.score = 0; - gameCanvas.score2 = 0; - gameCanvas.moves = 0; - gameCanvas.curTurn = 1; - if (gameMode == "puzzle") - loadMap(map); - else//Note that we load them in reverse order for correct visual stacking - for (var column = maxColumn - 1; column >= 0; column--) - for (var row = maxRow - 1; row >= 0; row--) - createBlock(column, row); - if (gameMode == "puzzle") - getLevelHistory();//Needs to be after map load - gameDuration = new Date(); -} - -var fillFound; // Set after a floodFill call to the number of blocks found -var floodBoard; // Set to 1 if the floodFill reaches off that node - -// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope -function handleClick(x,y) -{ - if (betweenTurns || gameOver || gameCanvas == undefined) - return; - var column = Math.floor(x/gameCanvas.blockSize); - var row = Math.floor(y/gameCanvas.blockSize); - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (board[index(column, row)] == null) - return; - // If it's a valid block, remove it and all connected (does nothing if it's not connected) - floodFill(column,row, -1); - if (fillFound <= 0) - return; - if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) - gameCanvas.score2 += (fillFound - 1) * (fillFound - 1); - else - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) - shuffleUp(); - else - shuffleDown(); - gameCanvas.moves += 1; - if (gameMode == "endless") - refill(); - else if (gameMode != "multiplayer") - victoryCheck(); - if (gameMode == "multiplayer" && !gc.gameOver){ - betweenTurns = true; - gameCanvas.swapPlayers();//signal, animate and call turnChange() when ready - } -} - -function floodFill(column,row,type) -{ - if (board[index(column, row)] == null) - return; - var first = false; - if (type == -1) { - first = true; - type = board[index(column,row)].type; - - // Flood fill initialization - fillFound = 0; - floodBoard = new Array(maxIndex); - } - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) - return; - floodBoard[index(column, row)] = 1; - floodFill(column + 1, row, type); - floodFill(column - 1, row, type); - floodFill(column, row + 1, type); - floodFill(column, row - 1, type); - if (first == true && fillFound == 0) - return; // Can't remove single blocks - board[index(column, row)].dying = true; - board[index(column, row)] = null; - fillFound += 1; -} - -function shuffleDown() -{ - // Fall down - for (var column = 0; column < maxColumn; column++) { - var fallDist = 0; - for (var row = maxRow - 1; row >= 0; row--) { - if (board[index(column,row)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - var obj = board[index(column, row)]; - obj.y = (row + fallDist) * gameCanvas.blockSize; - board[index(column, row + fallDist)] = obj; - board[index(column, row)] = null; - } - } - } - } - // Fall to the left - fallDist = 0; - for (column = 0; column < maxColumn; column++) { - if (board[index(column, maxRow - 1)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - for (row = 0; row < maxRow; row++) { - obj = board[index(column, row)]; - if (obj == null) - continue; - obj.x = (column - fallDist) * gameCanvas.blockSize; - board[index(column - fallDist,row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - - -function shuffleUp() -{ - // Fall up - for (var column = 0; column < maxColumn; column++) { - var fallDist = 0; - for (var row = 0; row < maxRow; row++) { - if (board[index(column,row)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - var obj = board[index(column, row)]; - obj.y = (row - fallDist) * gameCanvas.blockSize; - board[index(column, row - fallDist)] = obj; - board[index(column, row)] = null; - } - } - } - } - // Fall to the left (or should it be right, so as to be left for P2?) - fallDist = 0; - for (column = 0; column < maxColumn; column++) { - if (board[index(column, 0)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - for (row = 0; row < maxRow; row++) { - obj = board[index(column, row)]; - if (obj == null) - continue; - obj.x = (column - fallDist) * gameCanvas.blockSize; - board[index(column - fallDist,row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - -function turnChange()//called by ui outside -{ - betweenTurns = false; - if (gameCanvas.curTurn == 1){ - shuffleUp(); - gameCanvas.curTurn = 2; - victoryCheck(); - }else{ - shuffleDown(); - gameCanvas.curTurn = 1; - victoryCheck(); - } -} - -function refill() -{ - for (var column = 0; column < maxColumn; column++) { - for (var row = 0; row < maxRow; row++) { - if (board[index(column, row)] == null) - createBlock(column, row); - } - } -} - -function victoryCheck() -{ - // Awards bonuses for no blocks left - var deservesBonus = true; - if (board[index(0,maxRow - 1)] != null || board[index(0,0)] != null) - deservesBonus = false; - // Checks for game over - if (deservesBonus){ - if (gameCanvas.curTurn = 1) - gameCanvas.score += 1000; - else - gameCanvas.score2 += 1000; - } - gameOver = deservesBonus; - if (gameCanvas.curTurn == 1){ - if (!(floodMoveCheck(0, maxRow - 1, -1))) - gameOver = true; - }else{ - if (!(floodMoveCheck(0, 0, -1, true))) - gameOver = true; - } - if (gameMode == "puzzle"){ - puzzleVictoryCheck(deservesBonus);//Takes it from here - return; - } - if (gameOver) { - var winnerScore = Math.max(gameCanvas.score, gameCanvas.score2); - if (gameMode == "multiplayer"){ - gameCanvas.score = winnerScore; - saveHighScore(gameCanvas.score2); - } - saveHighScore(gameCanvas.score); - gameDuration = new Date() - gameDuration; - gameCanvas.gameOver = true; - } -} - -// Only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type, goDownInstead) -{ - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return false; - if (board[index(column, row)] == null) - return false; - var myType = board[index(column, row)].type; - if (type == myType) - return true; - if (goDownInstead) - return floodMoveCheck(column + 1, row, myType, goDownInstead) || - floodMoveCheck(column, row + 1, myType, goDownInstead); - else - return floodMoveCheck(column + 1, row, myType) || - floodMoveCheck(column, row - 1, myType); -} - -function createBlock(column,row,type) -{ - // Note that we don't wait for the component to become ready. This will - // only work if the block QML is a local file. Otherwise the component will - // not be ready immediately. There is a statusChanged signal on the - // component you could use if you want to wait to load remote files. - if (component.status == 1){ - if (type == undefined) - type = Math.floor(Math.random() * types); - if (type < 0 || type > 4) { - console.log("Invalid type requested");//TODO: Is this triggered by custom levels much? - return; - } - var dynamicObject = component.createObject(gameCanvas, - {"type": type, - "x": column*gameCanvas.blockSize, - "y": -1*gameCanvas.blockSize, - "width": gameCanvas.blockSize, - "height": gameCanvas.blockSize, - "particleSystem": gameCanvas.ps}); - if (dynamicObject == null){ - console.log("error creating block"); - console.log(component.errorString()); - return false; - } - dynamicObject.y = row*gameCanvas.blockSize; - dynamicObject.spawned = true; - - board[index(column,row)] = dynamicObject; - }else{ - console.log("error loading block component"); - console.log(component.errorString()); - return false; - } - return true; -} - -function showPuzzleError(str) -{ - //TODO: Nice user visible UI? - console.log(str); -} - -function loadMap(map) -{ - puzzlePath = map; - var levelComp = Qt.createComponent(puzzlePath); - if (levelComp.status != 1){ - console.log("Error loading level"); - showPuzzleError(levelComp.errorString()); - return; - } - puzzleLevel = levelComp.createObject(); - if (puzzleLevel == null || !puzzleLevel.startingGrid instanceof Array) { - showPuzzleError("Bugger!"); - return; - } - gameCanvas.showPuzzleGoal(puzzleLevel.goalText); - //showPuzzleGoal should call finishLoadingMap as the next thing it does, before handling more events -} - -function finishLoadingMap() -{ - for (var i in puzzleLevel.startingGrid) - if (! (puzzleLevel.startingGrid[i] >= 0 && puzzleLevel.startingGrid[i] <= 9) ) - puzzleLevel.startingGrid[i] = 0; - //TODO: Don't allow loading larger levels, leads to cheating - while (puzzleLevel.startingGrid.length > maxIndex) puzzleLevel.startingGrid.shift(); - while (puzzleLevel.startingGrid.length < maxIndex) puzzleLevel.startingGrid.unshift(0); - for (var i in puzzleLevel.startingGrid) - if (puzzleLevel.startingGrid[i] > 0) - createBlock(i % maxColumn, Math.floor(i / maxColumn), puzzleLevel.startingGrid[i] - 1); - - //### Experimental feature - allow levels to contain arbitrary QML scenes as well! - //while (puzzleLevel.children.length) - // puzzleLevel.children[0].parent = gameCanvas; - gameDuration = new Date(); //Don't start until we finish loading -} - -function puzzleVictoryCheck(clearedAll)//gameOver has also been set if no more moves -{ - var won = true; - var soFar = new Date() - gameDuration; - if (puzzleLevel.scoreTarget != -1 && gameCanvas.score < puzzleLevel.scoreTarget){ - won = false; - } if (puzzleLevel.scoreTarget != -1 && gameCanvas.score >= puzzleLevel.scoreTarget && !puzzleLevel.mustClear){ - gameOver = true; - } if (puzzleLevel.timeTarget != -1 && soFar/1000.0 > puzzleLevel.timeTarget){ - gameOver = true; - } if (puzzleLevel.moveTarget != -1 && gameCanvas.moves >= puzzleLevel.moveTarget){ - gameOver = true; - } if (puzzleLevel.mustClear && gameOver && !clearedAll) { - won = false; - } - - if (gameOver) { - gameCanvas.gameOver = true; - gameCanvas.showPuzzleEnd(won); - - if (won) { - // Store progress - saveLevelHistory(); - } - } -} - -function getHighScore() -{ - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - // Only show results for the current grid size - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' - + maxColumn + "x" + maxRow + '" AND game = "' + gameMode + '" ORDER BY score desc'); - if (rs.rows.length > 0) - gameCanvas.highScore = rs.rows.item(0).score; - else - gameCanvas.highScore = 0; - } - ); -} - -function saveHighScore(score) -{ - // Offline storage - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [ - gameMode, - score, - maxColumn + "x" + maxRow, - Math.floor(gameDuration / 1000) - ]; - if (score >= gameCanvas.highScore)//Update UI field - gameCanvas.highScore = score; - - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - tx.executeSql(dataStr, data); - } - ); -} - -function getLevelHistory() -{ - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); - var rs = tx.executeSql('SELECT * FROM Puzzle WHERE level = "' + puzzlePath + '" ORDER BY score desc'); - if (rs.rows.length > 0) { - gameCanvas.puzzleWon = true; - gameCanvas.highScore = rs.rows.item(0).score; - } else { - gameCanvas.puzzleWon = false; - gameCanvas.highScore = 0; - } - } - ); -} - -function saveLevelHistory() -{ - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - var dataStr = "INSERT INTO Puzzle VALUES(?, ?, ?, ?)"; - var data = [ - puzzlePath, - gameCanvas.score, - gameCanvas.moves, - Math.floor(gameDuration / 1000) - ]; - gameCanvas.puzzleWon = true; - - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); - tx.executeSql(dataStr, data); - } - ); -} - -function nuke() //For "Debug mode" -{ - for (var row = 1; row <= 5; row++) { - for (var col = 0; col < 5; col++) { - if (board[index(col, maxRow - row)] != null) { - board[index(col, maxRow - row)].dying = true; - board[index(col, maxRow - row)] = null; - } - } - } - if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) - shuffleUp(); - else - shuffleDown(); - if (gameMode == "endless") - refill(); - else - victoryCheck(); -} diff --git a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png Binary files differdeleted file mode 100644 index cce9f11017..0000000000 --- a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png +++ /dev/null diff --git a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png Binary files differdeleted file mode 100644 index ca9e8368b1..0000000000 --- a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png +++ /dev/null diff --git a/examples/quick/demos/samegame/doc/src/samegame.qdoc b/examples/quick/demos/samegame/doc/src/samegame.qdoc deleted file mode 100644 index 107a869bff..0000000000 --- a/examples/quick/demos/samegame/doc/src/samegame.qdoc +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Same Game - \ingroup qtquickdemos - \example demos/samegame - \brief A QML implementation of the popular puzzle game by Kuniaki Moribe. - - \e{Same Game} demonstrates a QML game with custom types and logic written in - JavaScript. The game uses various \l{Qt Quick} features such as - particles, animation, and loading images. - - \image qtquick-demo-samegame-med-1.png - \image qtquick-demo-samegame-med-2.png - - For more details about different parts of the example, see - \l{QML Advanced Tutorial}. - - \include examples-run.qdocinc - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/samegame/main.cpp b/examples/quick/demos/samegame/main.cpp deleted file mode 100644 index c6b01f491a..0000000000 --- a/examples/quick/demos/samegame/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/samegame/samegame) diff --git a/examples/quick/demos/samegame/samegame.pro b/examples/quick/demos/samegame/samegame.pro deleted file mode 100644 index 7b680490ad..0000000000 --- a/examples/quick/demos/samegame/samegame.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app - -QT += qml quick sql -SOURCES += main.cpp -RESOURCES += samegame.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/samegame -INSTALLS += target diff --git a/examples/quick/demos/samegame/samegame.qml b/examples/quick/demos/samegame/samegame.qml deleted file mode 100644 index 63e4083a8b..0000000000 --- a/examples/quick/demos/samegame/samegame.qml +++ /dev/null @@ -1,372 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content/samegame.js" as Logic -import "content" - -Rectangle { - id: root - width: Settings.screenWidth; height: Settings.screenHeight - property int acc: 0 - - - function loadPuzzle() { - if (gameCanvas.mode != "") - Logic.cleanUp(); - Logic.startNewGame(gameCanvas,"puzzle","levels/level"+acc+".qml") - } - function nextPuzzle() { - acc = (acc + 1) % 10; - loadPuzzle(); - } - Timer { - id: gameOverTimer - interval: 1500 - running : gameCanvas.gameOver && gameCanvas.mode == "puzzle" //mode will be reset by cleanUp(); - repeat : false - onTriggered: { - Logic.cleanUp(); - nextPuzzle(); - } - } - - Image { - source: "content/gfx/background.png" - anchors.fill: parent - } - - GameArea { - id: gameCanvas - z: 1 - y: Settings.headerHeight - - width: parent.width - height: parent.height - Settings.headerHeight - Settings.footerHeight - - backgroundVisible: root.state == "in-game" - onModeChanged: if (gameCanvas.mode != "puzzle") puzzleWon = false; //UI has stricter constraints on this variable than the game does - Age { - groups: ["redspots", "greenspots", "bluespots", "yellowspots"] - enabled: root.state == "" - system: gameCanvas.ps - } - - onPuzzleLost: acc--;//So that nextPuzzle() reloads the current one - - } - - Item { - id: menu - z: 2 - width: parent.width; - anchors.top: parent.top - anchors.bottom: bottomBar.top - - LogoAnimation { - x: 64 - y: Settings.headerHeight - particleSystem: gameCanvas.ps - running: root.state == "" - } - Row { - x: 112 - y: 20 - Image { source: "content/gfx/logo-a.png" } - Image { source: "content/gfx/logo-m.png" } - Image { source: "content/gfx/logo-e.png" } - } - - Column { - y: 100 + 40 - spacing: Settings.menuButtonSpacing - width: parent.width - height: parent.height - (140 + Settings.footerHeight) - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-1.png" - onClicked: { - if (root.state == "in-game") - return //Prevent double clicking - root.state = "in-game" - gameCanvas.blockFile = "Block.qml" - gameCanvas.background = "gfx/background.png" - arcadeTimer.start(); - } - //Emitted particles don't fade out, because ImageParticle is on the GameArea - system: gameCanvas.ps - group: "green" - Timer { - id: arcadeTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: Logic.startNewGame(gameCanvas) - } - } - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-2.png" - onClicked: { - if (root.state == "in-game") - return - root.state = "in-game" - gameCanvas.blockFile = "Block.qml" - gameCanvas.background = "gfx/background.png" - twopTimer.start(); - } - system: gameCanvas.ps - group: "green" - Timer { - id: twopTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: Logic.startNewGame(gameCanvas, "multiplayer") - } - } - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-3.png" - onClicked: { - if (root.state == "in-game") - return - root.state = "in-game" - gameCanvas.blockFile = "SimpleBlock.qml" - gameCanvas.background = "gfx/background.png" - endlessTimer.start(); - } - system: gameCanvas.ps - group: "blue" - Timer { - id: endlessTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: Logic.startNewGame(gameCanvas, "endless") - } - } - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-4.png" - group: "yellow" - onClicked: { - if (root.state == "in-game") - return - root.state = "in-game" - gameCanvas.blockFile = "PuzzleBlock.qml" - gameCanvas.background = "gfx/background.png" - puzzleTimer.start(); - } - Timer { - id: puzzleTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: loadPuzzle(); - } - system: gameCanvas.ps - } - } - } - - Image { - id: scoreBar - source: "content/gfx/bar.png" - width: parent.width - z: 6 - y: -Settings.headerHeight - height: Settings.headerHeight - Behavior on opacity { NumberAnimation {} } - SamegameText { - id: arcadeScore - anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} - text: '<font color="#f7d303">P1:</font> ' + gameCanvas.score - font.pixelSize: Settings.fontPixelSize - textFormat: Text.StyledText - color: "white" - opacity: gameCanvas.mode == "arcade" ? 1 : 0 - Behavior on opacity { NumberAnimation {} } - } - SamegameText { - id: arcadeHighScore - anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} - text: '<font color="#f7d303">Highscore:</font> ' + gameCanvas.highScore - opacity: gameCanvas.mode == "arcade" ? 1 : 0 - } - SamegameText { - id: p1Score - anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} - text: '<font color="#f7d303">P1:</font> ' + gameCanvas.score - opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 - } - SamegameText { - id: p2Score - anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} - text: '<font color="#f7d303">P2:</font> ' + gameCanvas.score2 - opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 - rotation: 180 - } - SamegameText { - id: puzzleMoves - anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} - text: '<font color="#f7d303">Moves:</font> ' + gameCanvas.moves - opacity: gameCanvas.mode == "puzzle" ? 1 : 0 - } - SamegameText { - Image { - source: "content/gfx/icon-time.png" - x: -20 - } - id: puzzleTime - anchors { topMargin: 3; top: parent.top; horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: 20} - text: "00:00" - opacity: gameCanvas.mode == "puzzle" ? 1 : 0 - Timer { - interval: 1000 - repeat: true - running: gameCanvas.mode == "puzzle" && !gameCanvas.gameOver - onTriggered: { - var elapsed = Math.floor((new Date() - Logic.gameDuration)/ 1000.0); - var mins = Math.floor(elapsed/60.0); - var secs = (elapsed % 60); - puzzleTime.text = (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "") + secs; - } - } - } - SamegameText { - id: puzzleScore - anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} - text: '<font color="#f7d303">Score:</font> ' + gameCanvas.score - opacity: gameCanvas.mode == "puzzle" ? 1 : 0 - } - } - - Image { - id: bottomBar - width: parent.width - height: Settings.footerHeight - source: "content/gfx/bar.png" - y: parent.height - Settings.footerHeight; - z: 2 - Button { - id: quitButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-quit.png" - onClicked: {Qt.quit(); } - anchors { left: parent.left; verticalCenter: parent.verticalCenter; leftMargin: 11 } - } - Button { - id: menuButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-menu.png" - visible: (root.state == "in-game"); - onClicked: {root.state = ""; Logic.cleanUp(); gameCanvas.mode = ""} - anchors { left: quitButton.right; verticalCenter: parent.verticalCenter; leftMargin: 0 } - } - Button { - id: againButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-game-new.png" - visible: (root.state == "in-game"); - opacity: gameCanvas.gameOver && (gameCanvas.mode == "arcade" || gameCanvas.mode == "multiplayer") - Behavior on opacity{ NumberAnimation {} } - onClicked: {if (gameCanvas.gameOver) { Logic.startNewGame(gameCanvas, gameCanvas.mode);}} - anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } - } - Button { - id: nextButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-puzzle-next.png" - visible: (root.state == "in-game") && gameCanvas.mode == "puzzle" && gameCanvas.puzzleWon - opacity: gameCanvas.puzzleWon ? 1 : 0 - Behavior on opacity{ NumberAnimation {} } - onClicked: {if (gameCanvas.puzzleWon) nextPuzzle();} - anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } - } - } - - Connections { - target: root - onStateChanged: stateChangeAnim.running = true - } - SequentialAnimation { - id: stateChangeAnim - ParallelAnimation { - NumberAnimation { target: bottomBar; property: "y"; to: root.height; duration: Settings.menuDelay/2; easing.type: Easing.OutQuad } - NumberAnimation { target: scoreBar; property: "y"; to: -Settings.headerHeight; duration: Settings.menuDelay/2; easing.type: Easing.OutQuad } - } - ParallelAnimation { - NumberAnimation { target: bottomBar; property: "y"; to: root.height - Settings.footerHeight; duration: Settings.menuDelay/2; easing.type: Easing.OutBounce} - NumberAnimation { target: scoreBar; property: "y"; to: root.state == "" ? -Settings.headerHeight : 0; duration: Settings.menuDelay/2; easing.type: Easing.OutBounce} - } - } - - states: [ - State { - name: "in-game" - PropertyChanges { - target: menu - opacity: 0 - visible: false - } - } - ] - - transitions: [ - Transition { - NumberAnimation {properties: "x,y,opacity"} - } - ] - - //"Debug mode" - focus: true - Keys.onAsteriskPressed: Logic.nuke(); - Keys.onSpacePressed: gameCanvas.puzzleWon = true; -} diff --git a/examples/quick/demos/samegame/samegame.qmlproject b/examples/quick/demos/samegame/samegame.qmlproject deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/quick/demos/samegame/samegame.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "samegame.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/samegame/samegame.qrc b/examples/quick/demos/samegame/samegame.qrc deleted file mode 100644 index 348ee109f9..0000000000 --- a/examples/quick/demos/samegame/samegame.qrc +++ /dev/null @@ -1,73 +0,0 @@ -<RCC> - <qresource prefix="/demos/samegame"> - <file>samegame.qml</file> - <file>content/qmldir</file> - <file>content/Settings.qml</file> - <file>content/gfx/text-p1-won.png</file> - <file>content/gfx/background-puzzle.png</file> - <file>content/gfx/background.png</file> - <file>content/gfx/bar.png</file> - <file>content/gfx/blue-puzzle.png</file> - <file>content/gfx/blue.png</file> - <file>content/gfx/bubble-highscore.png</file> - <file>content/gfx/bubble-puzzle.png</file> - <file>content/gfx/but-game-1.png</file> - <file>content/gfx/but-game-2.png</file> - <file>content/gfx/but-game-3.png</file> - <file>content/gfx/but-game-4.png</file> - <file>content/gfx/but-game-new.png</file> - <file>content/gfx/but-menu.png</file> - <file>content/gfx/but-puzzle-next.png</file> - <file>content/gfx/but-quit.png</file> - <file>content/gfx/green-puzzle.png</file> - <file>content/gfx/green.png</file> - <file>content/gfx/icon-fail.png</file> - <file>content/gfx/icon-ok.png</file> - <file>content/gfx/icon-time.png</file> - <file>content/gfx/logo-a.png</file> - <file>content/gfx/logo-e.png</file> - <file>content/gfx/logo-g.png</file> - <file>content/gfx/logo-m.png</file> - <file>content/gfx/logo-s.png</file> - <file>content/gfx/logo.png</file> - <file>content/gfx/particle-brick.png</file> - <file>content/gfx/particle-paint.png</file> - <file>content/gfx/particle-smoke.png</file> - <file>content/gfx/red-puzzle.png</file> - <file>content/gfx/red.png</file> - <file>content/gfx/text-highscore-new.png</file> - <file>content/gfx/text-highscore.png</file> - <file>content/gfx/text-no-winner.png</file> - <file>content/gfx/text-p1-go.png</file> - <file>content/gfx/text-p1.png</file> - <file>content/gfx/text-p2-go.png</file> - <file>content/gfx/text-p2-won.png</file> - <file>content/gfx/text-p2.png</file> - <file>content/gfx/yellow-puzzle.png</file> - <file>content/gfx/yellow.png</file> - <file>content/levels/level0.qml</file> - <file>content/levels/level1.qml</file> - <file>content/levels/level2.qml</file> - <file>content/levels/level3.qml</file> - <file>content/levels/level4.qml</file> - <file>content/levels/level5.qml</file> - <file>content/levels/level6.qml</file> - <file>content/levels/level7.qml</file> - <file>content/levels/level8.qml</file> - <file>content/levels/level9.qml</file> - <file>content/levels/TemplateBase.qml</file> - <file>content/SamegameText.qml</file> - <file>content/SimpleBlock.qml</file> - <file>content/Block.qml</file> - <file>content/BlockEmitter.qml</file> - <file>content/Button.qml</file> - <file>content/GameArea.qml</file> - <file>content/LogoAnimation.qml</file> - <file>content/MenuEmitter.qml</file> - <file>content/PaintEmitter.qml</file> - <file>content/PrimaryPack.qml</file> - <file>content/PuzzleBlock.qml</file> - <file>content/samegame.js</file> - <file>content/SmokeText.qml</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/stocqt/content/+windows/Settings.qml b/examples/quick/demos/stocqt/content/+windows/Settings.qml deleted file mode 100644 index 1d4d7edcee..0000000000 --- a/examples/quick/demos/stocqt/content/+windows/Settings.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -pragma Singleton -import QtQml 2.0 - -QtObject { - property string fontFamily: "Arial" -} diff --git a/examples/quick/demos/stocqt/content/Banner.qml b/examples/quick/demos/stocqt/content/Banner.qml deleted file mode 100644 index 8d64e88410..0000000000 --- a/examples/quick/demos/stocqt/content/Banner.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 - -Rectangle { - id: banner - height: 80 - color: "#000000" - - GridLayout { - anchors.fill: parent - rows: 1 - columns: 3 - Rectangle { - Layout.leftMargin: 10 - Layout.topMargin: 20 - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - Image { - id: arrow - source: "./images/icon-left-arrow.png" - visible: root.currentIndex == 1 ? true : false - - MouseArea { - anchors.fill: parent - onClicked: root.currentIndex = 0; - } - } - } - Text { - id: stocText - color: "#ffffff" - font.family: "Abel" - font.pointSize: 40 - text: "Stoc" - Layout.alignment: Qt.AlignRight - Layout.leftMargin: parent.width / 2.5 - } - Text { - id: qtText - color: "#5caa15" - font.family: "Abel" - font.pointSize: 40 - text: "Qt" - Layout.fillWidth: true - } - } -} diff --git a/examples/quick/demos/stocqt/content/Button.qml b/examples/quick/demos/stocqt/content/Button.qml deleted file mode 100644 index 4ef86a2cc3..0000000000 --- a/examples/quick/demos/stocqt/content/Button.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "." - -Rectangle { - id: button - signal clicked - property alias text: txt.text - property bool buttonEnabled: false - width: Math.max(64, txt.width + 16) - height: 32 - color: "transparent" - MouseArea { - anchors.fill: parent - onClicked: button.clicked() - } - Text { - anchors.centerIn: parent - font.family: Settings.fontFamily - font.pointSize: 19 - font.weight: Font.DemiBold - color: button.buttonEnabled ? "#000000" : "#14aaff" - id: txt - } -} diff --git a/examples/quick/demos/stocqt/content/CheckBox.qml b/examples/quick/demos/stocqt/content/CheckBox.qml deleted file mode 100644 index f62eb538fb..0000000000 --- a/examples/quick/demos/stocqt/content/CheckBox.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Research In Motion. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: button - property bool buttonEnabled: true - width: 30 - height: 30 - x: 5 - MouseArea { - id: mouse - anchors.fill: parent - onClicked: { - if (buttonEnabled) - buttonEnabled = false; - else - buttonEnabled = true; - } - } - Rectangle { - id: checkbox - width: 30 - height: 30 - border.color: "#999999" - border.width: 1 - antialiasing: true - radius: 2 - color: "transparent" - Rectangle { - anchors.fill: parent - anchors.margins: 5 - antialiasing: true - radius: 1 - color: mouse.pressed || buttonEnabled ? "#999999" : "transparent" - } - } -} diff --git a/examples/quick/demos/stocqt/content/Settings.qml b/examples/quick/demos/stocqt/content/Settings.qml deleted file mode 100644 index 39e1c4c241..0000000000 --- a/examples/quick/demos/stocqt/content/Settings.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -pragma Singleton -import QtQml 2.0 - -QtObject { - property string fontFamily: "Open Sans" -} diff --git a/examples/quick/demos/stocqt/content/StockChart.qml b/examples/quick/demos/stocqt/content/StockChart.qml deleted file mode 100644 index e90aba3aef..0000000000 --- a/examples/quick/demos/stocqt/content/StockChart.qml +++ /dev/null @@ -1,419 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 -import "." - -Rectangle { - id: chart - - property var stockModel: null - property var startDate: new Date() - property var endDate: new Date() - property string activeChart: "week" - property var settings - property int gridSize: 4 - property real gridStep: gridSize ? (canvas.width - canvas.tickMargin) / gridSize : canvas.xGridStep - - function update() { - endDate = new Date(); - if (chart.activeChart === "year") { - chart.startDate = new Date(chart.endDate.getFullYear() - 1, - chart.endDate.getMonth(), - chart.endDate.getDate()); - chart.gridSize = 12; - } - else if (chart.activeChart === "month") { - chart.startDate = new Date(chart.endDate.getFullYear(), - chart.endDate.getMonth() - 1, - chart.endDate.getDate()); - gridSize = 4; - } - else if (chart.activeChart === "week") { - chart.startDate = new Date(chart.endDate.getFullYear(), - chart.endDate.getMonth(), - chart.endDate.getDate() - 7); - gridSize = 0; - } - else if (chart.activeChart === "halfyear") { - chart.startDate = new Date(chart.endDate.getFullYear(), - chart.endDate.getMonth() - 6, - chart.endDate.getDate()); - gridSize = 6; - } - else if (chart.activeChart === "quarter") { - chart.startDate = new Date(chart.endDate.getFullYear(), - chart.endDate.getMonth() - 3, - chart.endDate.getDate()); - gridSize = 3; - } - else { - chart.startDate = new Date(2005, 3, 25); - gridSize = 4; - } - - canvas.requestPaint(); - } - - GridLayout { - anchors.fill: parent - columns: 6 - rows: 3 - columnSpacing: 4 - Button { - id: weekButton - text: "Week" - buttonEnabled: chart.activeChart === "week" - onClicked: { - chart.activeChart = "week"; - chart.update(); - } - } - - Button { - id: monthButton - text: "Month" - buttonEnabled: chart.activeChart === "month" - onClicked: { - chart.activeChart = "month"; - chart.update(); - } - } - - Button { - id: quarterlyButton - text: "3M" - buttonEnabled: chart.activeChart === "quarter" - onClicked: { - chart.activeChart = "quarter"; - chart.update(); - } - } - - Button { - id: halfYearlyButton - text: "6M" - buttonEnabled: chart.activeChart === "halfyear" - onClicked: { - chart.activeChart = "halfyear"; - chart.update(); - } - } - Button { - id: yearButton - text: "Year" - buttonEnabled: chart.activeChart === "year" - onClicked: { - chart.activeChart = "year"; - chart.update(); - } - } - Button { - id: maxButton - text: "Max" - buttonEnabled: chart.activeChart === "max" - onClicked: { - chart.activeChart = "max"; - chart.update(); - } - } - - Canvas { - id: canvas - Layout.fillWidth: true - Layout.fillHeight: true - Layout.columnSpan: 6 - // Uncomment below lines to use OpenGL hardware accelerated rendering. - // See Canvas documentation for available options. - // renderTarget: Canvas.FramebufferObject - // renderStrategy: Canvas.Threaded - - property int pixelSkip: 1 - property int numPoints: 1 - property int tickMargin: 34 - - property real xGridStep: (canvas.width - tickMargin) / numPoints - property real yGridOffset: canvas.height / 26 - property real yGridStep: canvas.height / 12 - - function drawBackground(ctx) { - ctx.save(); - ctx.fillStyle = "#ffffff"; - ctx.fillRect(0, 0, canvas.width, canvas.height); - ctx.strokeStyle = "#d7d7d7"; - ctx.beginPath(); - // Horizontal grid lines - for (var i = 0; i < 12; i++) { - ctx.moveTo(0, canvas.yGridOffset + i * canvas.yGridStep); - ctx.lineTo(canvas.width, canvas.yGridOffset + i * canvas.yGridStep); - } - - // Vertical grid lines - var height = 35 * canvas.height / 36; - var yOffset = canvas.height - height; - var xOffset = 0; - for (i = 0; i < chart.gridSize; i++) { - ctx.moveTo(xOffset + i * chart.gridStep, yOffset); - ctx.lineTo(xOffset + i * chart.gridStep, height); - } - ctx.stroke(); - - // Right ticks - ctx.strokeStyle = "#666666"; - ctx.beginPath(); - var xStart = canvas.width - tickMargin; - ctx.moveTo(xStart, 0); - ctx.lineTo(xStart, canvas.height); - for (i = 0; i < 12; i++) { - ctx.moveTo(xStart, canvas.yGridOffset + i * canvas.yGridStep); - ctx.lineTo(canvas.width, canvas.yGridOffset + i * canvas.yGridStep); - } - ctx.moveTo(0, canvas.yGridOffset + 9 * canvas.yGridStep); - ctx.lineTo(canvas.width, canvas.yGridOffset + 9 * canvas.yGridStep); - ctx.closePath(); - ctx.stroke(); - - ctx.restore(); - } - - // Returns a shortened, readable version of the potentially - // large volume number. - function volumeToString(value) { - if (value < 1000) - return value; - var exponent = parseInt(Math.log(value) / Math.log(1000)); - var shortVal = parseFloat(parseFloat(value) / Math.pow(1000, exponent)).toFixed(1); - - // Drop the decimal point on 3-digit values to make it fit - if (shortVal >= 100.0) { - shortVal = parseFloat(shortVal).toFixed(0); - } - return shortVal + "KMBTG".charAt(exponent - 1); - } - - function drawScales(ctx, high, low, vol) - { - ctx.save(); - ctx.strokeStyle = "#888888"; - ctx.font = "10px Open Sans" - - ctx.beginPath(); - - // prices on y-axis - var x = canvas.width - tickMargin + 3; - var priceStep = (high - low) / 9.0; - for (var i = 0; i < 10; i += 2) { - var price = parseFloat(high - i * priceStep).toFixed(1); - ctx.text(price, x, canvas.yGridOffset + i * yGridStep - 2); - } - - // volume scale - for (i = 0; i < 3; i++) { - var volume = volumeToString(vol - (i * (vol/3))); - ctx.text(volume, x, canvas.yGridOffset + (i + 9) * yGridStep + 10); - } - - ctx.closePath(); - ctx.stroke(); - ctx.restore(); - } - - function drawPrice(ctx, from, to, color, price, points, highest, lowest) - { - ctx.save(); - ctx.globalAlpha = 0.7; - ctx.strokeStyle = color; - - ctx.lineWidth = numPoints > 200 ? 1 : 3 - - ctx.beginPath(); - - var end = points.length; - - var range = highest - lowest; - if (range == 0) { - range = 1; - } - - for (var i = 0; i < end; i += pixelSkip) { - var x = points[i].x; - var y = points[i][price]; - var h = 9 * yGridStep; - - y = h * (lowest - y)/range + h + yGridOffset; - - if (i == 0) { - ctx.moveTo(x, y); - } else { - ctx.lineTo(x, y); - } - } - ctx.stroke(); - ctx.restore(); - } - - function drawVolume(ctx, from, to, color, price, points, highest) - { - ctx.save(); - ctx.fillStyle = color; - ctx.globalAlpha = 0.8; - ctx.lineWidth = 0; - ctx.beginPath(); - - var end = points.length; - var margin = 0; - - if (chart.activeChart === "month" || chart.activeChart === "week") { - margin = 8; - ctx.shadowOffsetX = 4; - ctx.shadowBlur = 3.5; - ctx.shadowColor = Qt.darker(color); - } - - // To match the volume graph with price grid, skip drawing the initial - // volume of the first day on chart. - for (var i = 1; i < end; i += pixelSkip) { - var x = points[i - 1].x; - var y = points[i][price]; - y = canvas.height * (y / highest); - y = 3 * y / 12; - ctx.fillRect(x, canvas.height - y + yGridOffset, - canvas.xGridStep - margin, y); - } - - ctx.stroke(); - ctx.restore(); - } - - function drawError(ctx, msg) - { - ctx.save(); - ctx.strokeStyle = "#888888"; - ctx.font = "24px Open Sans" - ctx.textAlign = "center" - ctx.shadowOffsetX = 4; - ctx.shadowOffsetY = 4; - ctx.shadowBlur = 1.5; - ctx.shadowColor = "#aaaaaa"; - ctx.beginPath(); - - ctx.fillText(msg, (canvas.width - tickMargin) / 2, - (canvas.height - yGridOffset - yGridStep) / 2); - - ctx.closePath(); - ctx.stroke(); - ctx.restore(); - } - - onPaint: { - numPoints = stockModel.indexOf(chart.startDate); - - if (chart.gridSize == 0) - chart.gridSize = numPoints - - var ctx = canvas.getContext("2d"); - ctx.globalCompositeOperation = "source-over"; - ctx.lineWidth = 1; - - drawBackground(ctx); - - if (!stockModel.ready) { - drawError(ctx, "No data available."); - return; - } - - var highestPrice = 0; - var highestVolume = 0; - var lowestPrice = -1; - var points = []; - for (var i = numPoints, j = 0; i >= 0 ; i -= pixelSkip, j += pixelSkip) { - var price = stockModel.get(i); - if (parseFloat(highestPrice) < parseFloat(price.high)) - highestPrice = price.high; - if (parseInt(highestVolume, 10) < parseInt(price.volume, 10)) - highestVolume = price.volume; - if (lowestPrice < 0 || parseFloat(lowestPrice) > parseFloat(price.low)) - lowestPrice = price.low; - points.push({ - x: j * xGridStep, - open: price.open, - close: price.close, - high: price.high, - low: price.low, - volume: price.volume - }); - } - - if (settings.drawHighPrice) - drawPrice(ctx, 0, numPoints, settings.highColor, "high", points, highestPrice, lowestPrice); - if (settings.drawLowPrice) - drawPrice(ctx, 0, numPoints, settings.lowColor, "low", points, highestPrice, lowestPrice); - if (settings.drawOpenPrice) - drawPrice(ctx, 0, numPoints,settings.openColor, "open", points, highestPrice, lowestPrice); - if (settings.drawClosePrice) - drawPrice(ctx, 0, numPoints, settings.closeColor, "close", points, highestPrice, lowestPrice); - - drawVolume(ctx, 0, numPoints, settings.volumeColor, "volume", points, highestVolume); - drawScales(ctx, highestPrice, lowestPrice, highestVolume); - } - } - - - Text { - id: fromDate - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 8 - Layout.alignment: Qt.AlignLeft - text: "| " + startDate.toDateString() - } - Text { - id: toDate - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 8 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: canvas.tickMargin - Layout.columnSpan: 5 - text: endDate.toDateString() + " |" - } - } -} diff --git a/examples/quick/demos/stocqt/content/StockInfo.qml b/examples/quick/demos/stocqt/content/StockInfo.qml deleted file mode 100644 index 2935e74db9..0000000000 --- a/examples/quick/demos/stocqt/content/StockInfo.qml +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 -import "." - -Rectangle { - id: root - color: "transparent" - - property var stock: null - - GridLayout { - id: stockInfoLayout - anchors.fill: parent - columns: 2 - rows: 3 - rowSpacing: 4 - - Text { - id: stockIdText - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 28 - font.weight: Font.DemiBold - text: root.stock.stockId - Layout.alignment: Qt.AlignLeft | Qt.AlignBottom - Layout.leftMargin: 10 - } - - Text { - id: price - color: "#6d6d6d" - font.family: Settings.fontFamily - font.pointSize: 28 - font.weight: Font.DemiBold - text: parseFloat(root.stock.stockPrice).toFixed(2); - Layout.fillWidth: true - Layout.alignment: Qt.AlignLeft | Qt.AlignBottom - Layout.leftMargin: 5 - } - - Text { - id: stockNameText - color: "#0c0c0c" - font.family: Settings.fontFamily - font.pointSize: 16 - elide: Text.ElideRight - maximumLineCount: 3 - wrapMode: Text.WordWrap - text: root.stock.stockName - Layout.leftMargin: 10 - Layout.columnSpan: 2 - Layout.alignment: Qt.AlignLeft - } - - - Text { - id: priceChange - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - Layout.leftMargin: 10 - color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" - font.family: Settings.fontFamily - font.pointSize: 18 - text: parseFloat(root.stock.stockPriceChanged).toFixed(2); - } - - Text { - id: priceChangePercentage - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" - font.family: Settings.fontFamily - font.pointSize: 18 - font.weight: Font.DemiBold - Layout.fillWidth: true - text: "(" + - parseFloat(root.stock.stockPriceChanged / - (root.stock.stockPrice - root.stock.stockPriceChanged) * 100.0).toFixed(2) + - "%)" - } - } -} diff --git a/examples/quick/demos/stocqt/content/StockListDelegate.qml b/examples/quick/demos/stocqt/content/StockListDelegate.qml deleted file mode 100644 index f3a3ab6976..0000000000 --- a/examples/quick/demos/stocqt/content/StockListDelegate.qml +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import "." - -Rectangle { - height: 102 - width: parent.width - color: "transparent" - MouseArea { - anchors.fill: parent; - onClicked: { - if (view.currentIndex == index) - mainRect.currentIndex = 1; - else - view.currentIndex = index; - } - } - GridLayout { - id: stockGrid - columns: 3 - rows: 2 - anchors.fill: parent - - Text { - id: stockIdText - Layout.alignment: Qt.AlignLeft | Qt.AlignBottom - Layout.leftMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 20 - font.weight: Font.Bold - verticalAlignment: Text.AlignVCenter - text: stockId - } - - Text { - id: stockValueText - Layout.preferredWidth: 100 - Layout.alignment: Qt.AlignRight | Qt.AlignBottom - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 20 - font.bold: true - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: value - } - Text { - id: stockValueChangeText - Layout.preferredWidth: 135 - Layout.rightMargin: 10 - Layout.alignment: Qt.AlignRight | Qt.AlignBottom - color: "#328930" - font.family: Settings.fontFamily - font.pointSize: 20 - font.bold: true - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: change - onTextChanged: { - if (parseFloat(text) >= 0.0) - color = "#328930"; - else - color = "#d40000"; - } - } - Text { - id: stockNameText - Layout.preferredWidth: 300 - Layout.leftMargin: 10 - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 16 - font.bold: false - elide: Text.ElideRight - maximumLineCount: 1 - verticalAlignment: Text.AlignVCenter - text: name - } - - Item {Layout.fillWidth: true } - - Text { - id: stockValueChangePercentageText - Layout.fillWidth: true - Layout.alignment: Qt.AlignRight | Qt.AlignTop - Layout.rightMargin: 10 - color: "#328930" - font.family: Settings.fontFamily - font.pointSize: 18 - font.bold: false - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: changePercentage - onTextChanged: { - if (parseFloat(text) >= 0.0) - color = "#328930"; - else - color = "#d40000"; - } - } - } - - Rectangle { - id: endingLine - anchors.top: stockGrid.bottom - height: 1 - width: parent.width - color: "#d7d7d7" - } -} - diff --git a/examples/quick/demos/stocqt/content/StockListModel.qml b/examples/quick/demos/stocqt/content/StockListModel.qml deleted file mode 100644 index 02ece32a49..0000000000 --- a/examples/quick/demos/stocqt/content/StockListModel.qml +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -ListModel { - id: stocks - - // pre-fetch data for all entries - Component.onCompleted: { - for (var idx = 0; idx < count; ++idx) { - getCloseValue(idx) - } - } - - function requestUrl(stockId) { - var endDate = new Date(""); // today - var startDate = new Date() - startDate.setDate(startDate.getDate() - 5); - - var request = "http://ichart.finance.yahoo.com/table.csv?"; - request += "s=" + stockId; - request += "&g=d"; - request += "&a=" + startDate.getMonth(); - request += "&b=" + startDate.getDate(); - request += "&c=" + startDate.getFullYear(); - request += "&d=" + endDate.getMonth(); - request += "&e=" + endDate.getDate(); - request += "&f=" + endDate.getFullYear(); - request += "&g=d"; - request += "&ignore=.csv"; - return request; - } - - function getCloseValue(index) { - var req = requestUrl(get(index).stockId); - - if (!req) - return; - - var xhr = new XMLHttpRequest; - - xhr.open("GET", req, true); - - xhr.onreadystatechange = function() { - if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) { - var records = xhr.responseText.split('\n'); - var unknown = "n/a"; - set(index, {"value": unknown, "change": unknown, "changePercentage": unknown}); - if (records.length > 0 && xhr.status == 200) { - var r = records[1].split(','); - var today = parseFloat(r[4]); - if (!isNaN(today)) - setProperty(index, "value", today.toFixed(2)); - if (records.length > 2) { - r = records[2].split(','); - var yesterday = parseFloat(r[4]); - var change = today - yesterday; - if (change >= 0.0) - setProperty(index, "change", "+" + change.toFixed(2)); - else - setProperty(index, "change", change.toFixed(2)); - - var changePercentage = (change / yesterday) * 100.0; - if (changePercentage >= 0.0) - setProperty(index, "changePercentage", "+" + changePercentage.toFixed(2) + "%"); - else - setProperty(index, "changePercentage", changePercentage.toFixed(2) + "%"); - } - } - } - } - xhr.send() - } - // Uncomment to test invalid entries - // ListElement {name: "The Qt Company"; stockId: "TQTC"; value: "999.0"; change: "0.0"; changePercentage: "0.0"} - - // Data from http://www.nasdaq.com/quotes/nasdaq-100-stocks.aspx - ListElement {name: "Activision Blizzard Inc."; stockId: "ATVI"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Adobe Systems Inc."; stockId: "ADBE"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Akamai Technologies Inc."; stockId: "AKAM"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Alexion Pharmaceuticals Inc."; stockId: "ALXN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Alphabet Inc."; stockId: "GOOG"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Alphabet Inc."; stockId: "GOOGL"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Amazon.com Inc."; stockId: "AMZN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "American Airlines Group Inc."; stockId: "AAL"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Amgen Inc."; stockId: "AMGN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Analog Devices Inc."; stockId: "ADI"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Apple Inc."; stockId: "AAPL"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Applied Materials Inc."; stockId: "AMAT"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Autodesk Inc."; stockId: "ADSK"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Automatic Data Processing Inc."; stockId: "ADP"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Baidu Inc."; stockId: "BIDU"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Bed Bath & Beyond Inc."; stockId: "BBBY"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Biogen Inc."; stockId: "BIIB"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "BioMarin Pharmaceutical Inc."; stockId: "BMRN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Broadcom Limited"; stockId: "AVGO"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "CA Inc."; stockId: "CA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Celgene Corp."; stockId: "CELG"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Cerner Corp."; stockId: "CERN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Charter Communications Inc."; stockId: "CHTR"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Check Point Software Technologies Ltd."; stockId: "CHKP"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Cisco Systems Inc."; stockId: "CSCO"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Citrix Systems Inc."; stockId: "CTXS"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Cognizant Technology Solutions Corp."; stockId: "CTSH"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Comcast Corp."; stockId: "CMCSA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Costco Wholesale Corp."; stockId: "COST"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Ctrip.com International Ltd."; stockId: "CTRP"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Discovery Communications Inc."; stockId: "DISCA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Discovery Communications Inc."; stockId: "DISCK"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "DISH Network Corp."; stockId: "DISH"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Dollar Tree Inc."; stockId: "DLTR"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "eBay Inc."; stockId: "EBAY"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Electronic Arts Inc."; stockId: "EA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Endo International Plc"; stockId: "ENDP"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Intel Corp."; stockId: "INTC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Intuit Inc."; stockId: "INTU"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Intuitive Surgical Inc."; stockId: "ISRG"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "JD.com Inc."; stockId: "JD"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "KLA-Tencor Corp."; stockId: "KLAC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Lam Research Corp."; stockId: "LRCX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Liberty Global Plc"; stockId: "LBTYA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Liberty Global Plc"; stockId: "LBTYK"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Liberty Interactive Corp."; stockId: "LVNTA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Liberty Interactive Corp."; stockId: "QVCA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Liberty Media Corp."; stockId: "LMCA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Liberty Media Corp."; stockId: "LMCK"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Linear Technology Corp."; stockId: "LLTC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Marriott International"; stockId: "MAR"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Mattel Inc."; stockId: "MAT"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Maxim Integrated Products Inc."; stockId: "MXIM"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Micron Technology Inc."; stockId: "MU"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Microsoft Corp."; stockId: "MSFT"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Mondelez International Inc."; stockId: "MDLZ"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Monster Beverage Corp."; stockId: "MNST"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Mylan N.V."; stockId: "MYL"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "NetApp Inc."; stockId: "NTAP"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Netflix Inc."; stockId: "NFLX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Norwegian Cruise Line Holdings Ltd."; stockId: "NCLH"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "NVIDIA Corp."; stockId: "NVDA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "NXP Semiconductors N.V."; stockId: "NXPI"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "O'Reilly Automotive Inc."; stockId: "ORLY"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "PACCAR Inc."; stockId: "PCAR"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Paychex Inc."; stockId: "PAYX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "PayPal Holdings Inc."; stockId: "PYPL"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "QUALCOMM Inc."; stockId: "QCOM"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Regeneron Pharmaceuticals Inc."; stockId: "REGN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Ross Stores Inc."; stockId: "ROST"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "SanDisk Corp."; stockId: "SNDK"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "SBA Communications Corp."; stockId: "SBAC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Seagate Technology PLC"; stockId: "STX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Sirius XM Holdings Inc."; stockId: "SIRI"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Skyworks Solutions Inc."; stockId: "SWKS"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Starbucks Corp."; stockId: "SBUX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Stericycle Inc."; stockId: "SRCL"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Symantec Corp."; stockId: "SYMC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "T-Mobile US Inc."; stockId: "TMUS"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Tesla Motors Inc."; stockId: "TSLA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Texas Instruments Inc."; stockId: "TXN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "The Kraft Heinz Company"; stockId: "KHC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "The Priceline Group Inc."; stockId: "PCLN"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Tractor Supply Company"; stockId: "TSCO"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "TripAdvisor Inc."; stockId: "TRIP"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Twenty-First Century Fox Inc."; stockId: "FOX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Twenty-First Century Fox Inc."; stockId: "FOXA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Ulta Salon Cosmetics & Fragrance Inc."; stockId: "ULTA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Verisk Analytics Inc."; stockId: "VRSK"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Vertex Pharmaceuticals Inc."; stockId: "VRTX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Viacom Inc."; stockId: "VIAB"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Vodafone Group Plc"; stockId: "VOD"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Walgreens Boots Alliance Inc."; stockId: "WBA"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Western Digital Corp."; stockId: "WDC"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Whole Foods Market Inc."; stockId: "WFM"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Xilinx Inc."; stockId: "XLNX"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} - ListElement {name: "Yahoo! Inc."; stockId: "YHOO"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} -} diff --git a/examples/quick/demos/stocqt/content/StockListView.qml b/examples/quick/demos/stocqt/content/StockListView.qml deleted file mode 100644 index 177580cf6b..0000000000 --- a/examples/quick/demos/stocqt/content/StockListView.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "." - -Rectangle { - id: root - anchors.top: parent.top - anchors.bottom: parent.bottom - color: "white" - - property string currentStockId: "" - property string currentStockName: "" - - ListView { - id: view - anchors.fill: parent - clip: true - keyNavigationWraps: true - highlightMoveDuration: 0 - focus: true - snapMode: ListView.SnapToItem - model: StockListModel {} - currentIndex: -1 // Don't pre-select any item - - onCurrentIndexChanged: { - if (currentItem) { - root.currentStockId = model.get(currentIndex).stockId; - root.currentStockName = model.get(currentIndex).name; - } - } - - delegate: StockListDelegate {} - - highlight: Rectangle { - width: view.width - color: "#eeeeee" - } - } -} diff --git a/examples/quick/demos/stocqt/content/StockModel.qml b/examples/quick/demos/stocqt/content/StockModel.qml deleted file mode 100644 index 035d9454d0..0000000000 --- a/examples/quick/demos/stocqt/content/StockModel.qml +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -ListModel { - id: model - property string stockId: "" - property string stockName: "" - property string stockDataCycle: "d" - property bool ready: false - property real stockPrice: 0.0 - property real stockPriceChanged: 0.0 - - signal dataReady - - function indexOf(date) { - if (model.count == 0) - return -1; - - var newest = new Date(model.get(0).date); - var oldest = new Date(model.get(model.count - 1).date); - if (newest <= date) - return -1; - - if (oldest >= date) - return model.count - 1; - - var currDiff = 0; - var bestDiff = Math.abs(date.getTime() - newest.getTime()); - var retval = 0; - for (var i = 0; i < model.count; i++) { - var d = new Date(model.get(i).date); - currDiff = Math.abs(d.getTime() - date.getTime()); - if (currDiff < bestDiff) { - bestDiff = currDiff; - retval = i; - } - if (currDiff > bestDiff) - return retval; - } - - return -1; - } - - function requestUrl() { - if (stockId === "") - return; - - var startDate = new Date(2011, 4, 25); - - var endDate = new Date(); //today - - if (stockDataCycle !== "d" && stockDataCycle !== "w" && stockDataCycle !== "m") - stockDataCycle = "d"; - - /* - Fetch stock data from yahoo finance: - url: http://ichart.finance.yahoo.com/table.csv?s=NOK&a=5&b=11&c=2010&d=7&e=23&f=2010&g=d&ignore=.csv - s:stock name/id, a:start day, b:start month, c:start year default: 25 April 1995, oldest c= 1962 - d:end day, e:end month, f:end year, default:today (data only available 3 days before today) - g:data cycle(d daily, w weekly, m monthly, v Dividend) - */ - var request = "http://ichart.finance.yahoo.com/table.csv?"; - request += "s=" + stockId; - request += "&a=" + startDate.getMonth(); - request += "&b=" + startDate.getDate(); - request += "&c=" + startDate.getFullYear(); - request += "&d=" + endDate.getMonth(); - request += "&e=" + endDate.getDate(); - request += "&f=" + endDate.getFullYear(); - request += "&g=" + stockDataCycle; - request += "&ignore=.csv"; - return request; - } - - function createStockPrice(r) { - return { - "date": r[0], - "open":r[1], - "high":r[2], - "low":r[3], - "close":r[4], - "volume":r[5], - "adjusted":r[6] - }; - } - - function updateStock() { - var req = requestUrl(); - - if (!req) - return; - - var xhr = new XMLHttpRequest; - - xhr.open("GET", req, true); - - model.ready = false; - model.clear(); - var i = 1; //skip the first line - xhr.onreadystatechange = function() { - if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) { - var records = xhr.responseText.split('\n'); - - for (;i < records.length; i++ ) { - var r = records[i].split(','); - if (r.length === 7) - model.append(createStockPrice(r)); - } - - if (xhr.readyState === XMLHttpRequest.DONE) { - if (model.count > 0) { - model.ready = true; - model.stockPrice = model.get(0).adjusted; - model.stockPriceChanged = model.count > 1 ? (Math.round((model.stockPrice - model.get(1).close) * 100) / 100) : 0; - } else { - model.stockPrice = 0; - model.stockPriceChanged = 0; - } - model.dataReady(); // emit signal - model.ready indicates whether the data is valid - } - } - } - xhr.send() - } -} diff --git a/examples/quick/demos/stocqt/content/StockSettingsPanel.qml b/examples/quick/demos/stocqt/content/StockSettingsPanel.qml deleted file mode 100644 index 1ac1035789..0000000000 --- a/examples/quick/demos/stocqt/content/StockSettingsPanel.qml +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 -import "." - -Rectangle { - id: root - color: "transparent" - - property bool drawOpenPrice: openButton.buttonEnabled - property bool drawClosePrice: closeButton.buttonEnabled - property bool drawHighPrice: highButton.buttonEnabled - property bool drawLowPrice: lowButton.buttonEnabled - - property string openColor: "#face20" - property string closeColor: "#14aaff" - property string highColor: "#80c342" - property string lowColor: "#f30000" - property string volumeColor: "#14aaff" - - GridLayout { - id: settingsGrid - rows: 5 - columns: 3 - rowSpacing: 4 - anchors.fill: parent - - Item { - Layout.fillHeight: true - Layout.columnSpan: 3 - } - - Text { - id: openText - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "Open" - Layout.leftMargin: 10 - } - Rectangle { - Layout.preferredHeight: 4 - Layout.preferredWidth: 114 - color: openColor - } - CheckBox { - id: openButton - buttonEnabled: false - Layout.rightMargin: 10 - } - - Text { - id: closeText - Layout.leftMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "Close" - } - Rectangle { - Layout.preferredHeight: 4 - Layout.preferredWidth: 114 - color: closeColor - } - CheckBox { - id: closeButton - buttonEnabled: false - Layout.rightMargin: 10 - } - - Text { - id: highText - Layout.leftMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "High" - } - Rectangle { - Layout.preferredHeight: 4 - Layout.preferredWidth: 114 - color: highColor - } - CheckBox { - id: highButton - buttonEnabled: true - Layout.rightMargin: 10 - } - - Text { - id: lowText - Layout.leftMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "Low" - } - Rectangle { - Layout.preferredHeight: 4 - Layout.preferredWidth: 114 - color: lowColor - } - - CheckBox { - id: lowButton - buttonEnabled: true - Layout.rightMargin: 10 - } - } -} diff --git a/examples/quick/demos/stocqt/content/StockView.qml b/examples/quick/demos/stocqt/content/StockView.qml deleted file mode 100644 index d598ddd201..0000000000 --- a/examples/quick/demos/stocqt/content/StockView.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.1 -import QtQuick.Layouts 1.1 - -Rectangle { - id: root - width: 320 - height: 480 - color: "transparent" - - property var stock: null - property var stocklist: null - signal settingsClicked - - function update() { - chart.update() - } - - Rectangle { - id: mainRect - color: "transparent" - anchors.fill: parent - - GridLayout { - anchors.fill: parent - rows: 2 - columns: Screen.primaryOrientation === Qt.PortraitOrientation ? 1 : 2 - - StockInfo { - id: stockInfo - Layout.alignment: Qt.AlignTop - Layout.preferredWidth: 400 - Layout.preferredHeight: 160 - stock: root.stock - } - - StockChart { - id: chart - Layout.alignment: Qt.AlignRight - Layout.margins: 5 - Layout.fillWidth: true - Layout.fillHeight: true - Layout.rowSpan: 2 - stockModel: root.stock - settings: settingsPanel - } - StockSettingsPanel { - id: settingsPanel - Layout.alignment: Qt.AlignBottom - Layout.fillHeight: true - Layout.preferredWidth: 400 - Layout.bottomMargin: 5 - onDrawOpenPriceChanged: root.update() - onDrawClosePriceChanged: root.update(); - onDrawHighPriceChanged: root.update(); - onDrawLowPriceChanged: root.update(); - } - } - } -} diff --git a/examples/quick/demos/stocqt/content/images/icon-left-arrow.png b/examples/quick/demos/stocqt/content/images/icon-left-arrow.png Binary files differdeleted file mode 100644 index 926938cadd..0000000000 --- a/examples/quick/demos/stocqt/content/images/icon-left-arrow.png +++ /dev/null diff --git a/examples/quick/demos/stocqt/content/images/wheel-touch.png b/examples/quick/demos/stocqt/content/images/wheel-touch.png Binary files differdeleted file mode 100644 index 11c8120ada..0000000000 --- a/examples/quick/demos/stocqt/content/images/wheel-touch.png +++ /dev/null diff --git a/examples/quick/demos/stocqt/content/images/wheel.png b/examples/quick/demos/stocqt/content/images/wheel.png Binary files differdeleted file mode 100644 index 470a675b35..0000000000 --- a/examples/quick/demos/stocqt/content/images/wheel.png +++ /dev/null diff --git a/examples/quick/demos/stocqt/content/qmldir b/examples/quick/demos/stocqt/content/qmldir deleted file mode 100644 index 77f5ed3c56..0000000000 --- a/examples/quick/demos/stocqt/content/qmldir +++ /dev/null @@ -1,12 +0,0 @@ -singleton Settings 1.0 Settings.qml -Button 1.0 Button.qml -CheckBox 1.0 CheckBox.qml -StockChart 1.0 StockChart.qml -StockInfo 1.0 StockInfo.qml -StockListModel 1.0 StockListModel.qml -StockListView 1.0 StockListView.qml -StockModel 1.0 StockModel.qml -StockSettingsPanel 1.0 StockSettingsPanel.qml -StockView 1.0 StockView.qml -StockListDelegate 1.0 StockListDelegate.qml -Banner 1.0 Banner.qml diff --git a/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png b/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png Binary files differdeleted file mode 100644 index dc09a84dc3..0000000000 --- a/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png +++ /dev/null diff --git a/examples/quick/demos/stocqt/doc/src/stocqt.qdoc b/examples/quick/demos/stocqt/doc/src/stocqt.qdoc deleted file mode 100644 index 800bba570c..0000000000 --- a/examples/quick/demos/stocqt/doc/src/stocqt.qdoc +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - StocQt - \ingroup qtquickdemos - \example demos/stocqt - \brief A configurable stock chart for the NASDAQ-100. - \image qtquick-demo-stocqt.png - - The \e{StocQt} application presents a trend chart for the first stock in - the list of NASDAQ-100 stocks maintained by it. It allows the user to - choose another stock from the list, and fetches the required data for - the selected stock by sending an \c XMLHttpRequest to - http://finance.yahoo.com. - - The application uses several custom types such as Button, CheckBox, - StockChart, StockInfo, StockView, and so on. These types are used to - present the stock data in a readable form and also let the user customize - the trend chart. For example, the user can choose to view the yearly, - monthly, or daily trends in the stock price. - - The application uses the ObjectModel type to access the two visual data - models that it depends on. - - \quotefromfile demos/stocqt/stocqt.qml - \skipto ListView - \printuntil id - \dots 8 - \skipto model - \printuntil StockView - \printuntil } - \printuntil } - \printuntil } - - The StockListView model is a static data model listing the - NASDAQ-100 stocks with basic information such as stockId, name, value, - change, and so on. This data model is used by the application if the - user wants to choose another stock from the list. - - StockView is a complex data model that presents a trend chart for the - selected stock. It uses another custom type, StockChart, which presents - the graphical trend of the stock price using a Canvas. This data model - is used for most of the time during the lifetime of the application. - - \quotefromfile demos/stocqt/content/StockChart.qml - \skipto Rectangle - \printuntil id - \dots - \skipto Canvas - \printuntil id - \dots 8 - \skipto onPaint - \printuntil /^\}$/ - - To understand the application better, browse through its code using - Qt Creator. - - \include examples-run.qdocinc - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/stocqt/main.cpp b/examples/quick/demos/stocqt/main.cpp deleted file mode 100644 index cedffaf6e1..0000000000 --- a/examples/quick/demos/stocqt/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/stocqt/stocqt) diff --git a/examples/quick/demos/stocqt/stocqt.pro b/examples/quick/demos/stocqt/stocqt.pro deleted file mode 100644 index 0e89a30050..0000000000 --- a/examples/quick/demos/stocqt/stocqt.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp -RESOURCES += stocqt.qrc -OTHER_FILES += *.qml content/*.qml content/images/*.png - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/stocqt -INSTALLS += target diff --git a/examples/quick/demos/stocqt/stocqt.qml b/examples/quick/demos/stocqt/stocqt.qml deleted file mode 100644 index a13e63fd50..0000000000 --- a/examples/quick/demos/stocqt/stocqt.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQml.Models 2.1 -import QtQuick.Layouts 1.1 -import "./content" - -Rectangle { - id: mainRect - width: 1000 - height: 700 - - property alias currentIndex: root.currentIndex - - ColumnLayout { - anchors.fill: parent - - Banner { - id: banner - Layout.fillWidth: true - } - - ListView { - id: root - Layout.fillHeight: true - Layout.fillWidth: true - snapMode: ListView.SnapOneItem - highlightRangeMode: ListView.StrictlyEnforceRange - highlightMoveDuration: 250 - focus: false - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - - StockModel { - id: stock - stockId: listView.currentStockId - stockName: listView.currentStockName - onStockIdChanged: stock.updateStock(); - onDataReady: { - root.currentIndex = 1 - stockView.update() - } - } - - model: ObjectModel { - StockListView { - id: listView - width: root.width - height: root.height - } - - StockView { - id: stockView - width: root.width - height: root.height - stocklist: listView - stock: stock - } - } - } - } -} diff --git a/examples/quick/demos/stocqt/stocqt.qmlproject b/examples/quick/demos/stocqt/stocqt.qmlproject deleted file mode 100644 index 11ab78418a..0000000000 --- a/examples/quick/demos/stocqt/stocqt.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "stocqt.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/stocqt/stocqt.qrc b/examples/quick/demos/stocqt/stocqt.qrc deleted file mode 100644 index ab7772a62a..0000000000 --- a/examples/quick/demos/stocqt/stocqt.qrc +++ /dev/null @@ -1,22 +0,0 @@ -<RCC> - <qresource prefix="/demos/stocqt"> - <file>stocqt.qml</file> - <file>content/qmldir</file> - <file>content/Button.qml</file> - <file>content/CheckBox.qml</file> - <file>content/StockChart.qml</file> - <file>content/StockListModel.qml</file> - <file>content/StockListView.qml</file> - <file>content/StockModel.qml</file> - <file>content/StockView.qml</file> - <file>content/images/wheel-touch.png</file> - <file>content/images/wheel.png</file> - <file>content/images/icon-left-arrow.png</file> - <file>content/StockSettingsPanel.qml</file> - <file>content/StockInfo.qml</file> - <file>content/Settings.qml</file> - <file>content/+windows/Settings.qml</file> - <file>content/StockListDelegate.qml</file> - <file>content/Banner.qml</file> - </qresource> -</RCC> diff --git a/examples/quick/demos/tweetsearch/content/FlipBar.qml b/examples/quick/demos/tweetsearch/content/FlipBar.qml deleted file mode 100644 index f1e240c4a4..0000000000 --- a/examples/quick/demos/tweetsearch/content/FlipBar.qml +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/examples/quick/demos/tweetsearch/content/LineInput.qml b/examples/quick/demos/tweetsearch/content/LineInput.qml deleted file mode 100644 index 46bc73f3af..0000000000 --- a/examples/quick/demos/tweetsearch/content/LineInput.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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.displayText.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/examples/quick/demos/tweetsearch/content/ListFooter.qml b/examples/quick/demos/tweetsearch/content/ListFooter.qml deleted file mode 100644 index 9a062d9488..0000000000 --- a/examples/quick/demos/tweetsearch/content/ListFooter.qml +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/examples/quick/demos/tweetsearch/content/ListHeader.qml b/examples/quick/demos/tweetsearch/content/ListHeader.qml deleted file mode 100644 index d37300162d..0000000000 --- a/examples/quick/demos/tweetsearch/content/ListHeader.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/examples/quick/demos/tweetsearch/content/SearchDelegate.qml b/examples/quick/demos/tweetsearch/content/SearchDelegate.qml deleted file mode 100644 index 0dc4aacb34..0000000000 --- a/examples/quick/demos/tweetsearch/content/SearchDelegate.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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: { - if (Qt.inputMethod.visible) - Qt.inputMethod.hide() - flipBar.ok() - } - } - } - } - -} diff --git a/examples/quick/demos/tweetsearch/content/TweetDelegate.qml b/examples/quick/demos/tweetsearch/content/TweetDelegate.qml deleted file mode 100644 index 202ced0285..0000000000 --- a/examples/quick/demos/tweetsearch/content/TweetDelegate.qml +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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: 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("https://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: model.twitterName - 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/examples/quick/demos/tweetsearch/content/TweetsModel.qml b/examples/quick/demos/tweetsearch/content/TweetsModel.qml deleted file mode 100644 index d7de9a186e..0000000000 --- a/examples/quick/demos/tweetsearch/content/TweetsModel.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "tweetsearch.js" as Helper - -Item { - id: wrapper - - // Insert valid consumer key and secret tokens below - // See https://dev.twitter.com/apps -//! [auth tokens] - property string consumerKey : "" - property string consumerSecret : "" -//! [auth tokens] - property string bearerToken : "" - - property variant model: tweets - property string from : "" - property string phrase : "" - - property int status: XMLHttpRequest.UNSENT - property bool isLoading: status === XMLHttpRequest.LOADING - property bool wasLoading: false - signal isLoaded - - ListModel { id: tweets } - - function encodePhrase(x) { return encodeURIComponent(x); } - - function reload() { - tweets.clear() - - if (from == "" && phrase == "") - return; - -//! [requesting] - var req = new XMLHttpRequest; - req.open("GET", "https://api.twitter.com/1.1/search/tweets.json?from=" + from + - "&count=10&q=" + encodePhrase(phrase)); - req.setRequestHeader("Authorization", "Bearer " + bearerToken); - req.onreadystatechange = function() { - status = req.readyState; - if (status === XMLHttpRequest.DONE) { - var objectArray = JSON.parse(req.responseText); - if (objectArray.errors !== undefined) - console.log("Error fetching tweets: " + objectArray.errors[0].message) - else { - for (var key in objectArray.statuses) { - var jsonObject = objectArray.statuses[key]; - tweets.append(jsonObject); - } - } - if (wasLoading == true) - wrapper.isLoaded() - } - wasLoading = (status === XMLHttpRequest.LOADING); - } - req.send(); -//! [requesting] - } - - onPhraseChanged: reload(); - onFromChanged: reload(); - - Component.onCompleted: { - if (consumerKey === "" || consumerSecret == "") { - bearerToken = encodeURIComponent(Helper.demoToken()) - return; - } - - var authReq = new XMLHttpRequest; - authReq.open("POST", "https://api.twitter.com/oauth2/token"); - authReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); - authReq.setRequestHeader("Authorization", "Basic " + Qt.btoa(consumerKey + ":" + consumerSecret)); - authReq.onreadystatechange = function() { - if (authReq.readyState === XMLHttpRequest.DONE) { - var jsonResponse = JSON.parse(authReq.responseText); - if (jsonResponse.errors !== undefined) - console.log("Authentication error: " + jsonResponse.errors[0].message) - else - bearerToken = jsonResponse.access_token; - } - } - authReq.send("grant_type=client_credentials"); - } - -} diff --git a/examples/quick/demos/tweetsearch/content/resources/anonymous.png b/examples/quick/demos/tweetsearch/content/resources/anonymous.png Binary files differdeleted file mode 100644 index 88fba26e90..0000000000 --- a/examples/quick/demos/tweetsearch/content/resources/anonymous.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png b/examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png Binary files differdeleted file mode 100644 index 4e8d7e6116..0000000000 --- a/examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-clear.png b/examples/quick/demos/tweetsearch/content/resources/icon-clear.png Binary files differdeleted file mode 100644 index 75672f64c7..0000000000 --- a/examples/quick/demos/tweetsearch/content/resources/icon-clear.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-loading.png b/examples/quick/demos/tweetsearch/content/resources/icon-loading.png Binary files differdeleted file mode 100644 index 8dbff8b70f..0000000000 --- a/examples/quick/demos/tweetsearch/content/resources/icon-loading.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-refresh.png b/examples/quick/demos/tweetsearch/content/resources/icon-refresh.png Binary files differdeleted file mode 100644 index b639a638fe..0000000000 --- a/examples/quick/demos/tweetsearch/content/resources/icon-refresh.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-search.png b/examples/quick/demos/tweetsearch/content/resources/icon-search.png Binary files differdeleted file mode 100644 index e41935a6c1..0000000000 --- a/examples/quick/demos/tweetsearch/content/resources/icon-search.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/content/tweetsearch.js b/examples/quick/demos/tweetsearch/content/tweetsearch.js deleted file mode 100644 index 42a76c99fc..0000000000 --- a/examples/quick/demos/tweetsearch/content/tweetsearch.js +++ /dev/null @@ -1,62 +0,0 @@ -.pragma library - -function formatDate(date) -{ - var da = new Date(date) - return da.toDateString() -} - -function demoToken() -{ - var a = new Array(22).join('A') - return a + String.fromCharCode(0x44, 0x69, 0x4a, 0x52, 0x51, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x41, 0x74, 0x2b, 0x72, 0x6a, 0x6c, 0x2b, 0x71, - 0x6d, 0x7a, 0x30, 0x72, 0x63, 0x79, 0x2b, 0x42, 0x62, - 0x75, 0x58, 0x42, 0x42, 0x73, 0x72, 0x55, 0x48, 0x47, - 0x45, 0x67, 0x3d, 0x71, 0x30, 0x45, 0x4b, 0x32, 0x61, - 0x57, 0x71, 0x51, 0x4d, 0x62, 0x31, 0x35, 0x67, 0x43, - 0x5a, 0x4e, 0x77, 0x5a, 0x6f, 0x39, 0x79, 0x71, 0x61, - 0x65, 0x30, 0x68, 0x70, 0x65, 0x32, 0x46, 0x44, 0x73, - 0x53, 0x39, 0x32, 0x57, 0x41, 0x75, 0x30, 0x67) -} - -function linkForEntity(entity) -{ - return (entity.url ? entity.url : - (entity.screen_name ? 'https://twitter.com/' + entity.screen_name : - 'https://twitter.com/search?q=%23' + entity.text)) -} - -function textForEntity(entity) -{ - return (entity.display_url ? entity.display_url : - (entity.screen_name ? entity.screen_name : entity.text)) -} - -function insertLinks(text, entities) -{ - if (typeof text !== 'string') - return ""; - - if (!entities) - return text; - - // Add all links (urls, usernames and hashtags) to an array and sort them in - // descending order of appearance in text - var links = [] - if (entities.urls) - links = entities.urls.concat(entities.hashtags, entities.user_mentions) - else if (entities.url) - links = entities.url.urls - - links.sort(function(a, b) { return b.indices[0] - a.indices[0] }) - - for (var i = 0; i < links.length; i++) { - var offset = links[i].url ? 0 : 1 - text = text.substring(0, links[i].indices[0] + offset) + - '<a href=\"' + linkForEntity(links[i]) + '\">' + - textForEntity(links[i]) + '</a>' + - text.substring(links[i].indices[1]) - } - return text.replace(/\n/g, '<br>'); -} diff --git a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png Binary files differdeleted file mode 100644 index 930ee39929..0000000000 --- a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png Binary files differdeleted file mode 100644 index 9eff191a47..0000000000 --- a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png +++ /dev/null diff --git a/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc b/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc deleted file mode 100644 index 4b859bbcc7..0000000000 --- a/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Tweet Search - \ingroup qtquickdemos - \example demos/tweetsearch - \brief A Twitter search client with 3D effects. - \image qtquick-demo-tweetsearch-med-1.png - \image qtquick-demo-tweetsearch-med-2.png - - \e{Tweet Search} is a QML application that searches items posted to Twitter - service using a number of query parameters. Search can be done for tweets - from a specified user, a hashtag, or a search phrase. - - The search result is a list of items showing the contents of the - tweet as well as the name and image of the user who posted it. - Hashtags, names and links in the content are clickable. Clicking - on the image will flip the item to reveal more information. - - \include examples-run.qdocinc - - Tweet Search uses Twitter API v1.1 for running seaches. - - \section1 Request Authentication - - Each request must be authenticated on behalf of the application. - For demonstration purposes, the application uses a hard-coded - token for identifying itself to the Twitter service. However, this - token is subject to rate limits for the number of requests as well - as possible expiration. - - If you are having authentication or rate limit problems running the - demo, obtain a set of application-specific tokens (consumer - key and consumer secret) by registering a new application on - \l{https://dev.twitter.com/apps}. - - Type in the two token values in \e {TweetsModel.qml}: - - \snippet demos/tweetsearch/content/TweetsModel.qml auth tokens - - Rebuild and run the demo. - - \section1 JSON Parsing - - Search results are returned in JSON (JavaScript Object Notation) - format. \c TweetsModel uses an \l XMLHTTPRequest object to send - an HTTP GET request, and calls JSON.parse() on the returned text - string to convert it to a JavaScript object. Each object - representing a tweet is then added to a \l ListModel: - - \snippet demos/tweetsearch/content/TweetsModel.qml requesting - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/tweetsearch/main.cpp b/examples/quick/demos/tweetsearch/main.cpp deleted file mode 100644 index 554892ac2b..0000000000 --- a/examples/quick/demos/tweetsearch/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/tweetsearch/tweetsearch) diff --git a/examples/quick/demos/tweetsearch/tweetsearch.pro b/examples/quick/demos/tweetsearch/tweetsearch.pro deleted file mode 100644 index 27c34bac5d..0000000000 --- a/examples/quick/demos/tweetsearch/tweetsearch.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += tweetsearch.qrc - -OTHER_FILES = tweetsearch.qml \ - content/*.qml \ - content/*.js \ - content/resources/* - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/tweetsearch -INSTALLS += target diff --git a/examples/quick/demos/tweetsearch/tweetsearch.qml b/examples/quick/demos/tweetsearch/tweetsearch.qml deleted file mode 100644 index b1323a6dc9..0000000000 --- a/examples/quick/demos/tweetsearch/tweetsearch.qml +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" -import "content/tweetsearch.js" as Helper - -Rectangle { - id: main - width: 320 - height: 480 - color: "#d6d6d6" - - 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 - var item = tweetsModel.model.get(main.counter) - mainListView.add( { "statusText": Helper.insertLinks(item.text, item.entities), - "twitterName": item.user.screen_name, - "name" : item.user.name, - "userImage": item.user.profile_image_url, - "source": item.source, - "id": id, - "uri": Helper.insertLinks(item.user.url, item.user.entities), - "published": item.created_at } ); - 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.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/examples/quick/demos/tweetsearch/tweetsearch.qmlproject b/examples/quick/demos/tweetsearch/tweetsearch.qmlproject deleted file mode 100644 index 5a0f31117b..0000000000 --- a/examples/quick/demos/tweetsearch/tweetsearch.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "tweetsearch.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/tweetsearch/tweetsearch.qrc b/examples/quick/demos/tweetsearch/tweetsearch.qrc deleted file mode 100644 index b23c3c5537..0000000000 --- a/examples/quick/demos/tweetsearch/tweetsearch.qrc +++ /dev/null @@ -1,19 +0,0 @@ -<RCC> - <qresource prefix="/demos/tweetsearch"> - <file>tweetsearch.qml</file> - <file>content/FlipBar.qml</file> - <file>content/LineInput.qml</file> - <file>content/ListFooter.qml</file> - <file>content/ListHeader.qml</file> - <file>content/SearchDelegate.qml</file> - <file>content/TweetDelegate.qml</file> - <file>content/tweetsearch.js</file> - <file>content/TweetsModel.qml</file> - <file>content/resources/anonymous.png</file> - <file>content/resources/bird-anim-sprites.png</file> - <file>content/resources/icon-clear.png</file> - <file>content/resources/icon-loading.png</file> - <file>content/resources/icon-refresh.png</file> - <file>content/resources/icon-search.png</file> - </qresource> -</RCC> |