diff options
369 files changed, 19751 insertions, 73 deletions
diff --git a/.qmake.conf b/.qmake.conf index 76c202ab9..097d8b948 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.11.2 +MODULE_VERSION = 5.12.0 diff --git a/doc/config/qtdoc.qdocconf b/doc/config/qtdoc.qdocconf index 9f02fa199..623cf0d6b 100644 --- a/doc/config/qtdoc.qdocconf +++ b/doc/config/qtdoc.qdocconf @@ -82,7 +82,7 @@ sourcedirs += \ exampledirs += \ ../src \ ../snippets \ - ../../examples/demos + ../../examples # Don't parse files in snippets directory excludedirs += \ @@ -124,3 +124,7 @@ HTML.stylesheets += style/qt5-sidebar.html macro.indextitle = "\\title Qt $QT_VER" macro.qtver = "$QT_VER" + +# Config to enable YouTube links in the offline documentation +HTML.extraimages += ../images/I5jasWrsxT0.jpg +qhp.QtDoc.extraFiles += ../images/I5jasWrsxT0.jpg diff --git a/doc/images/I5jasWrsxT0.jpg b/doc/images/I5jasWrsxT0.jpg Binary files differnew file mode 100644 index 000000000..24ea46b20 --- /dev/null +++ b/doc/images/I5jasWrsxT0.jpg diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc index e12441c3d..7c9e9685e 100644 --- a/doc/src/getting-started/gettingstarted.qdoc +++ b/doc/src/getting-started/gettingstarted.qdoc @@ -83,6 +83,11 @@ documentation locally from your Qt sources, see \l{Getting Started with QDoc} for details. + You can also watch the following YouTube video for a complete guide of the + installation process: + + \youtube I5jasWrsxT0 + \section2 Platform Requirements Developing applications on different platforms are covered in the platform diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 214627243..17b23c8f4 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -64,7 +64,6 @@ visit the following page: \section1 \macos \list -\li \l{Qt for macOS - Requirements} \li \l{Qt for macOS - Building from Source} \endlist diff --git a/doc/src/platforms/emb-linux.qdoc b/doc/src/platforms/emb-linux.qdoc index dd6b6fe71..eec4938bb 100644 --- a/doc/src/platforms/emb-linux.qdoc +++ b/doc/src/platforms/emb-linux.qdoc @@ -879,6 +879,30 @@ ctx.doneCurrent(); \endcode + KMS/DRM can be used with two different DRM APIs which are \e legacy and \e atomic. + The main benefit of DRM atomic API is to allow several DRM plane updates + within the same renderloop, whereas legacy API would require one plane update + per vsync. + + Atomic API is useful when you application needs to blend content into overlays + keeping all the updates within the same vsync. Still not all devices + support this API and it could be unavailable on some older devices. + KMS backend will by default use the legacy API, but you can enable the DRM + atomic API with \c QT_QPA_EGLFS_KMS_ATOMIC environment variable set to 1. + + Using a smaller framebuffer than screen resolution can also be useful. + This is possible with DRM atomic using the \c size parameter in the JSON file. + The example below uses a 1280x720 framebuffer on a 3840x2160 videomode : + + \badcode + { + "device": "/dev/dri/card0", + "outputs": [ + { "name": "HDMI1", "mode": "3840x2160", "size": "1280x720", "format": "argb8888" } + ] + } + \endcode + \section2 eglfs with eglfs_kms_egldevice backend This backend, typically used on Tegra devices, is similar to the KMS/DRM diff --git a/doc/src/platforms/osx.qdoc b/doc/src/platforms/osx.qdoc index c08388a65..626928d2d 100644 --- a/doc/src/platforms/osx.qdoc +++ b/doc/src/platforms/osx.qdoc @@ -163,15 +163,22 @@ */ /*! - \page osx-requirements.html - \title Qt for macOS - Requirements - \brief Setting up the \macos environment for Qt. + \page osx-building.html + \title Qt for macOS - Building from Source + \brief How to install Qt on \macos. + + \section1 Requirements - Qt requires Xcode to be installed on the system. You can get it from: + Qt requires a macOS platform SDK and corresponding toolchain to be installed + on the system. You can get this by installing the Xcode command line tools: + + \code + xcode-select --install + \endcode - \l{http://developer.apple.com/xcode/} + Or by downloading and installing \l{https://developer.apple.com/xcode/}{Xcode}. - \section1 Required Compiler Versions + \section2 Compiler Versions Qt for macOS is tested and compatible with several versions of GCC (GNU Compiler Collection) and Clang (as available from Xcode). For a list of @@ -179,25 +186,13 @@ the \l{Community Supported Platforms#Reference Configurations}{supported platforms} page. - \section2 OS X on PowerPC hardware + \section1 Steps for Building - Qt 5 does not support OS X on PowerPC. - -*/ - -/*! - \page osx-building.html - \title Qt for macOS - Building from Source - \brief How to install Qt on \macos. - - Qt for macOS has some requirements that are given in more detail - in the \l{Qt for macOS Requirements} document. - - The following instructions describe how to install Qt from the source package. + The following instructions describe how to build Qt from the source package. You can download the Qt 5 sources from the \l{Downloads} page. For more information, visit the \l{Getting Started with Qt} page. - \section1 Step 1: Install the License File (Commercially Licensed Qt Only) + \section2 Step 1: Install the License File (Commercially Licensed Qt Only) If you use Qt with a commercial license, the Qt tools look for a local license file. If you are using a binary installer or the commercial Qt Creator, your licenses @@ -210,7 +205,7 @@ different location or file name, you need to set the \c{QT_LICENSE_FILE} environment variable to the respective file path. - \section1 Step 2: Unpack the Archive + \section2 Step 2: Unpack the Archive Unpack the archive if you have not done so already. For example, if you have the \c{qt-everywhere-opensource-src-%VERSION%.tar.gz} @@ -221,7 +216,7 @@ This creates the directory \c{/tmp/qt-everywhere-opensource-src-%VERSION%} containing the files from the archive. - \section1 Step 3: Build the Qt Library + \section2 Step 3: Build the Qt Library To configure the Qt library for your machine type, run the \c{./configure} script in the package directory. @@ -259,7 +254,7 @@ \note There is a potential race condition when running make install with multiple jobs. It is best to only run one make job (-j1) for the install. - \section1 Step 4: Set the Environment Variables + \section2 Step 4: Set the Environment Variables In order to use Qt, some environment variables need to be extended. @@ -281,6 +276,19 @@ \b {That's all. Qt is now installed.} + \section1 Limitations + + \section2 PowerPC hardware + + Qt 5 does not support macOS on PowerPC. + + \section2 Fink + + If you have installed the Qt for X11 package from \l{http://www.finkproject.org/}{Fink}, + it will set the \c QMAKESPEC environment variable to \c darwin-g++. This will cause + problems when you build the Qt for macOS package. To fix this, simply unset your \c + QMAKESPEC or set it to \c macx-g++ before you run \c configure. To get a + fresh Qt distribution, run \c{make confclean} on the command-line. */ /*! @@ -609,14 +617,6 @@ \section1 Limitations - \section2 Fink - - If you have installed the Qt for X11 package from \l{Fink}, it will set the - \c QMAKESPEC environment variable to \c darwin-g++. This will cause problems when - you build the Qt for macOS package. To fix this, simply unset your \c - QMAKESPEC or set it to \c macx-g++ before you run \c configure. To get a - fresh Qt distribution, run \c{make confclean} in the command-line. - \section2 MySQL and \macos There seems to be a issue when both \c -prebind and \c -multi_module are diff --git a/doc/src/qmlapp/deployment.qdoc b/doc/src/qmlapp/deployment.qdoc index 676e28e12..a370aabbc 100644 --- a/doc/src/qmlapp/deployment.qdoc +++ b/doc/src/qmlapp/deployment.qdoc @@ -74,11 +74,9 @@ mmap() system call on POSIX compliant operating systems or \c CreateFileMapping() on Windows, resulting in significant memory savings. Each time you load a changed QML document, the cache is automatically -re-created. Cache files are located in the same directory as the source code, -if the directory is writable. Otherwise they will be placed in a sub-directory -of QStandardPaths::CacheLocation with the name "qmlcache". The file extension -is \c .qmlc for QML documents and \c .jsc for imported JavaScript modules. -On the Android platform, cache files are always stored in the cache directory. +re-created. Cache files are located in a sub-directory of +QStandardPaths::CacheLocation with the name "qmlcache". The file extension is \c +.qmlc for QML documents and \c .jsc for imported JavaScript modules. \section1 Compiling QML Ahead of Time diff --git a/doc/src/qtmodules.qdoc b/doc/src/qtmodules.qdoc index 0dca75c37..447decba0 100644 --- a/doc/src/qtmodules.qdoc +++ b/doc/src/qtmodules.qdoc @@ -143,12 +143,6 @@ \li Functionality for near-realtime simulation systems with support for 2D and 3D rendering. \row - \li \l{Enginio Manual}{Enginio} (Deprecated) - \li All - \li All - \li A Backend-as-a-Service solution to ease the backend development for - connected and data-driven applications. - \row \li \l[QtAndroidExtras]{Qt Android Extras} \li All \li \l{Qt for Android}{Android} diff --git a/examples/demos/calqlatr/calqlatr.pro b/examples/demos/calqlatr/calqlatr.pro new file mode 100644 index 000000000..19ed61c6e --- /dev/null +++ b/examples/demos/calqlatr/calqlatr.pro @@ -0,0 +1,19 @@ +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]/demos/calqlatr +INSTALLS += target diff --git a/examples/demos/calqlatr/calqlatr.qml b/examples/demos/calqlatr/calqlatr.qml new file mode 100644 index 000000000..769513b7b --- /dev/null +++ b/examples/demos/calqlatr/calqlatr.qml @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "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/demos/calqlatr/calqlatr.qmlproject b/examples/demos/calqlatr/calqlatr.qmlproject new file mode 100644 index 000000000..ce2d59d31 --- /dev/null +++ b/examples/demos/calqlatr/calqlatr.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "calqlatr.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/demos/calqlatr/calqlatr.qrc b/examples/demos/calqlatr/calqlatr.qrc new file mode 100644 index 000000000..7483304e0 --- /dev/null +++ b/examples/demos/calqlatr/calqlatr.qrc @@ -0,0 +1,12 @@ +<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/demos/calqlatr/content/Button.qml b/examples/demos/calqlatr/content/Button.qml new file mode 100644 index 000000000..5279596ef --- /dev/null +++ b/examples/demos/calqlatr/content/Button.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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: 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/demos/calqlatr/content/Display.qml b/examples/demos/calqlatr/content/Display.qml new file mode 100644 index 000000000..9ddd64d25 --- /dev/null +++ b/examples/demos/calqlatr/content/Display.qml @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/calqlatr/content/NumberPad.qml b/examples/demos/calqlatr/content/NumberPad.qml new file mode 100644 index 000000000..9936116fa --- /dev/null +++ b/examples/demos/calqlatr/content/NumberPad.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/calqlatr/content/calculator.js b/examples/demos/calqlatr/content/calculator.js new file mode 100644 index 000000000..37eb75219 --- /dev/null +++ b/examples/demos/calqlatr/content/calculator.js @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +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/demos/calqlatr/content/images/paper-edge-left.png b/examples/demos/calqlatr/content/images/paper-edge-left.png Binary files differnew file mode 100644 index 000000000..ca29a3ae1 --- /dev/null +++ b/examples/demos/calqlatr/content/images/paper-edge-left.png diff --git a/examples/demos/calqlatr/content/images/paper-edge-right.png b/examples/demos/calqlatr/content/images/paper-edge-right.png Binary files differnew file mode 100644 index 000000000..7c2da7b93 --- /dev/null +++ b/examples/demos/calqlatr/content/images/paper-edge-right.png diff --git a/examples/demos/calqlatr/content/images/paper-grip.png b/examples/demos/calqlatr/content/images/paper-grip.png Binary files differnew file mode 100644 index 000000000..953c408bc --- /dev/null +++ b/examples/demos/calqlatr/content/images/paper-grip.png diff --git a/examples/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png b/examples/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png Binary files differnew file mode 100644 index 000000000..af67f63dd --- /dev/null +++ b/examples/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png diff --git a/examples/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/demos/calqlatr/doc/src/calqlatr.qdoc new file mode 100644 index 000000000..02503fe3b --- /dev/null +++ b/examples/demos/calqlatr/doc/src/calqlatr.qdoc @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/calqlatr/main.cpp b/examples/demos/calqlatr/main.cpp new file mode 100644 index 000000000..6e25fc639 --- /dev/null +++ b/examples/demos/calqlatr/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/calqlatr/calqlatr) diff --git a/examples/demos/clocks/clocks.pro b/examples/demos/clocks/clocks.pro new file mode 100644 index 000000000..43edde891 --- /dev/null +++ b/examples/demos/clocks/clocks.pro @@ -0,0 +1,14 @@ +TEMPLATE = app + +QT += qml quick + +SOURCES += main.cpp +RESOURCES += clocks.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/clocks +INSTALLS += target + +OTHER_FILES += \ + clocks.qml \ + content/Clock.qml \ + content/*.png diff --git a/examples/demos/clocks/clocks.qml b/examples/demos/clocks/clocks.qml new file mode 100644 index 000000000..5224e29a3 --- /dev/null +++ b/examples/demos/clocks/clocks.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "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/demos/clocks/clocks.qmlproject b/examples/demos/clocks/clocks.qmlproject new file mode 100644 index 000000000..b15654600 --- /dev/null +++ b/examples/demos/clocks/clocks.qmlproject @@ -0,0 +1,8 @@ +import QmlProject 1.1 + +Project { + mainFile: "clocks.qml" + QmlFiles { directory: "." } + JavaScriptFiles { directory: "." } + ImageFiles { directory: "." } +} diff --git a/examples/demos/clocks/clocks.qrc b/examples/demos/clocks/clocks.qrc new file mode 100644 index 000000000..eaff4729a --- /dev/null +++ b/examples/demos/clocks/clocks.qrc @@ -0,0 +1,15 @@ +<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/demos/clocks/content/Clock.qml b/examples/demos/clocks/content/Clock.qml new file mode 100644 index 000000000..542333d13 --- /dev/null +++ b/examples/demos/clocks/content/Clock.qml @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 : 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/demos/clocks/content/arrow.png b/examples/demos/clocks/content/arrow.png Binary files differnew file mode 100644 index 000000000..e43731221 --- /dev/null +++ b/examples/demos/clocks/content/arrow.png diff --git a/examples/demos/clocks/content/background.png b/examples/demos/clocks/content/background.png Binary files differnew file mode 100644 index 000000000..a88595086 --- /dev/null +++ b/examples/demos/clocks/content/background.png diff --git a/examples/demos/clocks/content/center.png b/examples/demos/clocks/content/center.png Binary files differnew file mode 100644 index 000000000..7fbd802a4 --- /dev/null +++ b/examples/demos/clocks/content/center.png diff --git a/examples/demos/clocks/content/clock-night.png b/examples/demos/clocks/content/clock-night.png Binary files differnew file mode 100644 index 000000000..cc7151a39 --- /dev/null +++ b/examples/demos/clocks/content/clock-night.png diff --git a/examples/demos/clocks/content/clock.png b/examples/demos/clocks/content/clock.png Binary files differnew file mode 100644 index 000000000..462edacc0 --- /dev/null +++ b/examples/demos/clocks/content/clock.png diff --git a/examples/demos/clocks/content/hour.png b/examples/demos/clocks/content/hour.png Binary files differnew file mode 100644 index 000000000..9f33fc5d4 --- /dev/null +++ b/examples/demos/clocks/content/hour.png diff --git a/examples/demos/clocks/content/minute.png b/examples/demos/clocks/content/minute.png Binary files differnew file mode 100644 index 000000000..e2f216c89 --- /dev/null +++ b/examples/demos/clocks/content/minute.png diff --git a/examples/demos/clocks/content/quit.png b/examples/demos/clocks/content/quit.png Binary files differnew file mode 100644 index 000000000..b822057d4 --- /dev/null +++ b/examples/demos/clocks/content/quit.png diff --git a/examples/demos/clocks/content/second.png b/examples/demos/clocks/content/second.png Binary files differnew file mode 100644 index 000000000..d95d99e83 --- /dev/null +++ b/examples/demos/clocks/content/second.png diff --git a/examples/demos/clocks/doc/images/qtquick-demo-clocks-small.png b/examples/demos/clocks/doc/images/qtquick-demo-clocks-small.png Binary files differnew file mode 100644 index 000000000..94b641d89 --- /dev/null +++ b/examples/demos/clocks/doc/images/qtquick-demo-clocks-small.png diff --git a/examples/demos/clocks/doc/src/clocks.qdoc b/examples/demos/clocks/doc/src/clocks.qdoc new file mode 100644 index 000000000..a4bf1a1f8 --- /dev/null +++ b/examples/demos/clocks/doc/src/clocks.qdoc @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/clocks/main.cpp b/examples/demos/clocks/main.cpp new file mode 100644 index 000000000..c2508dc6a --- /dev/null +++ b/examples/demos/clocks/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/clocks/clocks) diff --git a/examples/demos/coffee/ApplicationFlow.qml b/examples/demos/coffee/ApplicationFlow.qml index 406a19b8f..797c54a1d 100644 --- a/examples/demos/coffee/ApplicationFlow.qml +++ b/examples/demos/coffee/ApplicationFlow.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/ApplicationFlowForm.ui.qml b/examples/demos/coffee/ApplicationFlowForm.ui.qml index 1844d133b..e3c9a34cb 100644 --- a/examples/demos/coffee/ApplicationFlowForm.ui.qml +++ b/examples/demos/coffee/ApplicationFlowForm.ui.qml @@ -4,7 +4,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/Brewing.qml b/examples/demos/coffee/Brewing.qml index 3abe35b39..cb763db26 100644 --- a/examples/demos/coffee/Brewing.qml +++ b/examples/demos/coffee/Brewing.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/BrewingForm.ui.qml b/examples/demos/coffee/BrewingForm.ui.qml index 8de3d880a..95ee69d82 100644 --- a/examples/demos/coffee/BrewingForm.ui.qml +++ b/examples/demos/coffee/BrewingForm.ui.qml @@ -4,7 +4,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/ChoosingCoffee.ui.qml b/examples/demos/coffee/ChoosingCoffee.ui.qml index 8b9be8b92..f1fd62f48 100644 --- a/examples/demos/coffee/ChoosingCoffee.ui.qml +++ b/examples/demos/coffee/ChoosingCoffee.ui.qml @@ -4,7 +4,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/CoffeeButton.qml b/examples/demos/coffee/CoffeeButton.qml index 35480a9c4..c0200894d 100644 --- a/examples/demos/coffee/CoffeeButton.qml +++ b/examples/demos/coffee/CoffeeButton.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/Cup.qml b/examples/demos/coffee/Cup.qml index 08880c969..dc7508b61 100644 --- a/examples/demos/coffee/Cup.qml +++ b/examples/demos/coffee/Cup.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/CupForm.ui.qml b/examples/demos/coffee/CupForm.ui.qml index 6d01b3a3b..d63d9b551 100644 --- a/examples/demos/coffee/CupForm.ui.qml +++ b/examples/demos/coffee/CupForm.ui.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/EmptyCup.qml b/examples/demos/coffee/EmptyCup.qml index 3a74d27f6..ee960e673 100644 --- a/examples/demos/coffee/EmptyCup.qml +++ b/examples/demos/coffee/EmptyCup.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/EmptyCupForm.ui.qml b/examples/demos/coffee/EmptyCupForm.ui.qml index 3bdff6cdc..bcd5c7a5a 100644 --- a/examples/demos/coffee/EmptyCupForm.ui.qml +++ b/examples/demos/coffee/EmptyCupForm.ui.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/NavigationButton.ui.qml b/examples/demos/coffee/NavigationButton.ui.qml index 66216e6fd..e89a29319 100644 --- a/examples/demos/coffee/NavigationButton.ui.qml +++ b/examples/demos/coffee/NavigationButton.ui.qml @@ -4,7 +4,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/SideBar.qml b/examples/demos/coffee/SideBar.qml index bd11f16bd..b200ececf 100644 --- a/examples/demos/coffee/SideBar.qml +++ b/examples/demos/coffee/SideBar.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/SideBarForm.ui.qml b/examples/demos/coffee/SideBarForm.ui.qml index adcf0cc1b..e18d7dd41 100644 --- a/examples/demos/coffee/SideBarForm.ui.qml +++ b/examples/demos/coffee/SideBarForm.ui.qml @@ -4,7 +4,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/coffee.pro b/examples/demos/coffee/coffee.pro index 0c9dce00b..369b8be4e 100644 --- a/examples/demos/coffee/coffee.pro +++ b/examples/demos/coffee/coffee.pro @@ -23,9 +23,8 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 -# Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin +else: win32|if(unix:!android): target.path = $$[QT_INSTALL_EXAMPLES]/demos/$${TARGET} !isEmpty(target.path): INSTALLS += target DISTFILES += \ diff --git a/examples/demos/coffee/coffee.qdoc b/examples/demos/coffee/coffee.qdoc index c274870ce..e9fc57a62 100644 --- a/examples/demos/coffee/coffee.qdoc +++ b/examples/demos/coffee/coffee.qdoc @@ -50,7 +50,7 @@ /*! - \example coffee + \example demos/coffee \title Coffee Machine Example \ingroup examples-tutorials @@ -71,12 +71,12 @@ and \c animation2 in CoffeeButton.qml. On the right side, you will see the coffee blend you selected. - \snippet coffee/CoffeeButton.qml 0 + \snippet demos/coffee/CoffeeButton.qml 0 It also triggers cappuccinoButton.onClicked(), which sets the default mix for the coffee type selected: - \snippet coffee/SideBar.qml 0 + \snippet demos/coffee/SideBar.qml 0 \borderedimage coffee_machine_selection.png \caption Coffee blend cappuccino @@ -86,7 +86,7 @@ If you click "Brew me a cup", choosingCoffee.brewButtonSelection.onClicked is triggered: - \snippet coffee/ApplicationFlow.qml 0 + \snippet demos/coffee/ApplicationFlow.qml 0 On the right side of the screen, you will see two sliders, one for the amount of milk, and one for sugar. They will have default values, @@ -97,18 +97,18 @@ If you click on \c Brew, \c choosingCoffee.brewButton.onClicked() is triggered, which displays a screen with the message "Please insert cup into tray". - \snippet coffee/ApplicationFlow.qml 2 + \snippet demos/coffee/ApplicationFlow.qml 2 \borderedimage coffee_machine_emptycup.png Clicking on \c Continue starts the brewing of the coffee type you selected. - \snippet coffee/ApplicationFlow.qml 1 + \snippet demos/coffee/ApplicationFlow.qml 1 The brewing process is defined as follows in \c Brewing.qml: - \snippet coffee/Brewing.qml 0 + \snippet demos/coffee/Brewing.qml 0 After completion, the application returns to the start screen. */ diff --git a/examples/demos/coffee/imports/Coffee/Constants.qml b/examples/demos/coffee/imports/Coffee/Constants.qml index 8816a9f58..159364a3a 100644 --- a/examples/demos/coffee/imports/Coffee/Constants.qml +++ b/examples/demos/coffee/imports/Coffee/Constants.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/main.cpp b/examples/demos/coffee/main.cpp index 40c7e7577..81e0ef326 100644 --- a/examples/demos/coffee/main.cpp +++ b/examples/demos/coffee/main.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/coffee/main.qml b/examples/demos/coffee/main.qml index 14488156e..56f4656b0 100644 --- a/examples/demos/coffee/main.qml +++ b/examples/demos/coffee/main.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage diff --git a/examples/demos/demos.pro b/examples/demos/demos.pro new file mode 100644 index 000000000..88f4aa73f --- /dev/null +++ b/examples/demos/demos.pro @@ -0,0 +1,23 @@ +TEMPLATE = subdirs + +qtHaveModule(quick) { + SUBDIRS += \ + samegame \ + calqlatr \ + clocks \ + tweetsearch \ + maroon \ + photosurface \ + stocqt + + qtHaveModule(quickcontrols2) { + SUBDIRS += coffee + } + + qtHaveModule(xmlpatterns) { + SUBDIRS += rssnews + qtHaveModule(quickcontrols) { + SUBDIRS += photoviewer + } + } +} diff --git a/examples/demos/maroon/content/BuildButton.qml b/examples/demos/maroon/content/BuildButton.qml new file mode 100644 index 000000000..09d37746f --- /dev/null +++ b/examples/demos/maroon/content/BuildButton.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "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/demos/maroon/content/GameCanvas.qml b/examples/demos/maroon/content/GameCanvas.qml new file mode 100644 index 000000000..0c6772dc9 --- /dev/null +++ b/examples/demos/maroon/content/GameCanvas.qml @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "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/demos/maroon/content/GameOverScreen.qml b/examples/demos/maroon/content/GameOverScreen.qml new file mode 100644 index 000000000..6de3b13ba --- /dev/null +++ b/examples/demos/maroon/content/GameOverScreen.qml @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/maroon/content/InfoBar.qml b/examples/demos/maroon/content/InfoBar.qml new file mode 100644 index 000000000..8176b1a37 --- /dev/null +++ b/examples/demos/maroon/content/InfoBar.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 { + 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/demos/maroon/content/NewGameScreen.qml b/examples/demos/maroon/content/NewGameScreen.qml new file mode 100644 index 000000000..d87e6b36f --- /dev/null +++ b/examples/demos/maroon/content/NewGameScreen.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +// 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/demos/maroon/content/SoundEffect.qml b/examples/demos/maroon/content/SoundEffect.qml new file mode 100644 index 000000000..35a68eb5e --- /dev/null +++ b/examples/demos/maroon/content/SoundEffect.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 +//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.state != Qt.ApplicationActive }", container); + property url source: "" + onSourceChanged: if (effect != null) effect.source = source; + function play() { + if (effect != null) + effect.play(); + } +} diff --git a/examples/demos/maroon/content/audio/bomb-action.wav b/examples/demos/maroon/content/audio/bomb-action.wav Binary files differnew file mode 100644 index 000000000..b334dc1e5 --- /dev/null +++ b/examples/demos/maroon/content/audio/bomb-action.wav diff --git a/examples/demos/maroon/content/audio/catch-action.wav b/examples/demos/maroon/content/audio/catch-action.wav Binary files differnew file mode 100644 index 000000000..3e22124ab --- /dev/null +++ b/examples/demos/maroon/content/audio/catch-action.wav diff --git a/examples/demos/maroon/content/audio/catch.wav b/examples/demos/maroon/content/audio/catch.wav Binary files differnew file mode 100644 index 000000000..d3eade87f --- /dev/null +++ b/examples/demos/maroon/content/audio/catch.wav diff --git a/examples/demos/maroon/content/audio/currency.wav b/examples/demos/maroon/content/audio/currency.wav Binary files differnew file mode 100644 index 000000000..0d9ef2c20 --- /dev/null +++ b/examples/demos/maroon/content/audio/currency.wav diff --git a/examples/demos/maroon/content/audio/factory-action.wav b/examples/demos/maroon/content/audio/factory-action.wav Binary files differnew file mode 100644 index 000000000..a2ace6c22 --- /dev/null +++ b/examples/demos/maroon/content/audio/factory-action.wav diff --git a/examples/demos/maroon/content/audio/melee-action.wav b/examples/demos/maroon/content/audio/melee-action.wav Binary files differnew file mode 100644 index 000000000..d325af470 --- /dev/null +++ b/examples/demos/maroon/content/audio/melee-action.wav diff --git a/examples/demos/maroon/content/audio/projectile-action.wav b/examples/demos/maroon/content/audio/projectile-action.wav Binary files differnew file mode 100644 index 000000000..4e2284fce --- /dev/null +++ b/examples/demos/maroon/content/audio/projectile-action.wav diff --git a/examples/demos/maroon/content/audio/shooter-action.wav b/examples/demos/maroon/content/audio/shooter-action.wav Binary files differnew file mode 100644 index 000000000..3e12b9419 --- /dev/null +++ b/examples/demos/maroon/content/audio/shooter-action.wav diff --git a/examples/demos/maroon/content/gfx/background.png b/examples/demos/maroon/content/gfx/background.png Binary files differnew file mode 100644 index 000000000..d548b9314 --- /dev/null +++ b/examples/demos/maroon/content/gfx/background.png diff --git a/examples/demos/maroon/content/gfx/bomb-action.png b/examples/demos/maroon/content/gfx/bomb-action.png Binary files differnew file mode 100644 index 000000000..42da5d789 --- /dev/null +++ b/examples/demos/maroon/content/gfx/bomb-action.png diff --git a/examples/demos/maroon/content/gfx/bomb-idle.png b/examples/demos/maroon/content/gfx/bomb-idle.png Binary files differnew file mode 100644 index 000000000..3bd62e261 --- /dev/null +++ b/examples/demos/maroon/content/gfx/bomb-idle.png diff --git a/examples/demos/maroon/content/gfx/bomb.png b/examples/demos/maroon/content/gfx/bomb.png Binary files differnew file mode 100644 index 000000000..380da7d1a --- /dev/null +++ b/examples/demos/maroon/content/gfx/bomb.png diff --git a/examples/demos/maroon/content/gfx/button-help.png b/examples/demos/maroon/content/gfx/button-help.png Binary files differnew file mode 100644 index 000000000..aecebc127 --- /dev/null +++ b/examples/demos/maroon/content/gfx/button-help.png diff --git a/examples/demos/maroon/content/gfx/button-play.png b/examples/demos/maroon/content/gfx/button-play.png Binary files differnew file mode 100644 index 000000000..6cdad6c84 --- /dev/null +++ b/examples/demos/maroon/content/gfx/button-play.png diff --git a/examples/demos/maroon/content/gfx/catch-action.png b/examples/demos/maroon/content/gfx/catch-action.png Binary files differnew file mode 100644 index 000000000..78ca9fe1c --- /dev/null +++ b/examples/demos/maroon/content/gfx/catch-action.png diff --git a/examples/demos/maroon/content/gfx/catch.png b/examples/demos/maroon/content/gfx/catch.png Binary files differnew file mode 100644 index 000000000..b7620fe3d --- /dev/null +++ b/examples/demos/maroon/content/gfx/catch.png diff --git a/examples/demos/maroon/content/gfx/cloud.png b/examples/demos/maroon/content/gfx/cloud.png Binary files differnew file mode 100644 index 000000000..d7c35f855 --- /dev/null +++ b/examples/demos/maroon/content/gfx/cloud.png diff --git a/examples/demos/maroon/content/gfx/currency.png b/examples/demos/maroon/content/gfx/currency.png Binary files differnew file mode 100644 index 000000000..1571341f6 --- /dev/null +++ b/examples/demos/maroon/content/gfx/currency.png diff --git a/examples/demos/maroon/content/gfx/dialog-bomb.png b/examples/demos/maroon/content/gfx/dialog-bomb.png Binary files differnew file mode 100644 index 000000000..708d916ad --- /dev/null +++ b/examples/demos/maroon/content/gfx/dialog-bomb.png diff --git a/examples/demos/maroon/content/gfx/dialog-factory.png b/examples/demos/maroon/content/gfx/dialog-factory.png Binary files differnew file mode 100644 index 000000000..d2e2a48e3 --- /dev/null +++ b/examples/demos/maroon/content/gfx/dialog-factory.png diff --git a/examples/demos/maroon/content/gfx/dialog-melee.png b/examples/demos/maroon/content/gfx/dialog-melee.png Binary files differnew file mode 100644 index 000000000..069d18d47 --- /dev/null +++ b/examples/demos/maroon/content/gfx/dialog-melee.png diff --git a/examples/demos/maroon/content/gfx/dialog-pointer.png b/examples/demos/maroon/content/gfx/dialog-pointer.png Binary files differnew file mode 100644 index 000000000..9b51a090f --- /dev/null +++ b/examples/demos/maroon/content/gfx/dialog-pointer.png diff --git a/examples/demos/maroon/content/gfx/dialog-shooter.png b/examples/demos/maroon/content/gfx/dialog-shooter.png Binary files differnew file mode 100644 index 000000000..af980caab --- /dev/null +++ b/examples/demos/maroon/content/gfx/dialog-shooter.png diff --git a/examples/demos/maroon/content/gfx/dialog.png b/examples/demos/maroon/content/gfx/dialog.png Binary files differnew file mode 100644 index 000000000..d528ba78d --- /dev/null +++ b/examples/demos/maroon/content/gfx/dialog.png diff --git a/examples/demos/maroon/content/gfx/factory-action.png b/examples/demos/maroon/content/gfx/factory-action.png Binary files differnew file mode 100644 index 000000000..898167826 --- /dev/null +++ b/examples/demos/maroon/content/gfx/factory-action.png diff --git a/examples/demos/maroon/content/gfx/factory-idle.png b/examples/demos/maroon/content/gfx/factory-idle.png Binary files differnew file mode 100644 index 000000000..a145582c8 --- /dev/null +++ b/examples/demos/maroon/content/gfx/factory-idle.png diff --git a/examples/demos/maroon/content/gfx/factory.png b/examples/demos/maroon/content/gfx/factory.png Binary files differnew file mode 100644 index 000000000..bfb9f3fb7 --- /dev/null +++ b/examples/demos/maroon/content/gfx/factory.png diff --git a/examples/demos/maroon/content/gfx/grid.png b/examples/demos/maroon/content/gfx/grid.png Binary files differnew file mode 100644 index 000000000..b59555247 --- /dev/null +++ b/examples/demos/maroon/content/gfx/grid.png diff --git a/examples/demos/maroon/content/gfx/help.png b/examples/demos/maroon/content/gfx/help.png Binary files differnew file mode 100644 index 000000000..4654e4c69 --- /dev/null +++ b/examples/demos/maroon/content/gfx/help.png diff --git a/examples/demos/maroon/content/gfx/lifes.png b/examples/demos/maroon/content/gfx/lifes.png Binary files differnew file mode 100644 index 000000000..135310b38 --- /dev/null +++ b/examples/demos/maroon/content/gfx/lifes.png diff --git a/examples/demos/maroon/content/gfx/logo-bubble.png b/examples/demos/maroon/content/gfx/logo-bubble.png Binary files differnew file mode 100644 index 000000000..136151caf --- /dev/null +++ b/examples/demos/maroon/content/gfx/logo-bubble.png diff --git a/examples/demos/maroon/content/gfx/logo-fish.png b/examples/demos/maroon/content/gfx/logo-fish.png Binary files differnew file mode 100644 index 000000000..c41833a0c --- /dev/null +++ b/examples/demos/maroon/content/gfx/logo-fish.png diff --git a/examples/demos/maroon/content/gfx/logo.png b/examples/demos/maroon/content/gfx/logo.png Binary files differnew file mode 100644 index 000000000..787ac99ce --- /dev/null +++ b/examples/demos/maroon/content/gfx/logo.png diff --git a/examples/demos/maroon/content/gfx/melee-action.png b/examples/demos/maroon/content/gfx/melee-action.png Binary files differnew file mode 100644 index 000000000..c53873bfc --- /dev/null +++ b/examples/demos/maroon/content/gfx/melee-action.png diff --git a/examples/demos/maroon/content/gfx/melee-idle.png b/examples/demos/maroon/content/gfx/melee-idle.png Binary files differnew file mode 100644 index 000000000..621d9dff5 --- /dev/null +++ b/examples/demos/maroon/content/gfx/melee-idle.png diff --git a/examples/demos/maroon/content/gfx/melee.png b/examples/demos/maroon/content/gfx/melee.png Binary files differnew file mode 100644 index 000000000..ab240151f --- /dev/null +++ b/examples/demos/maroon/content/gfx/melee.png diff --git a/examples/demos/maroon/content/gfx/mob-idle.png b/examples/demos/maroon/content/gfx/mob-idle.png Binary files differnew file mode 100644 index 000000000..dedacc786 --- /dev/null +++ b/examples/demos/maroon/content/gfx/mob-idle.png diff --git a/examples/demos/maroon/content/gfx/mob.png b/examples/demos/maroon/content/gfx/mob.png Binary files differnew file mode 100644 index 000000000..7569c3525 --- /dev/null +++ b/examples/demos/maroon/content/gfx/mob.png diff --git a/examples/demos/maroon/content/gfx/points.png b/examples/demos/maroon/content/gfx/points.png Binary files differnew file mode 100644 index 000000000..1d2386dbe --- /dev/null +++ b/examples/demos/maroon/content/gfx/points.png diff --git a/examples/demos/maroon/content/gfx/projectile-action.png b/examples/demos/maroon/content/gfx/projectile-action.png Binary files differnew file mode 100644 index 000000000..aa2e650ae --- /dev/null +++ b/examples/demos/maroon/content/gfx/projectile-action.png diff --git a/examples/demos/maroon/content/gfx/projectile.png b/examples/demos/maroon/content/gfx/projectile.png Binary files differnew file mode 100644 index 000000000..c25a0c389 --- /dev/null +++ b/examples/demos/maroon/content/gfx/projectile.png diff --git a/examples/demos/maroon/content/gfx/scores.png b/examples/demos/maroon/content/gfx/scores.png Binary files differnew file mode 100644 index 000000000..af757fe64 --- /dev/null +++ b/examples/demos/maroon/content/gfx/scores.png diff --git a/examples/demos/maroon/content/gfx/shooter-action.png b/examples/demos/maroon/content/gfx/shooter-action.png Binary files differnew file mode 100644 index 000000000..08e7e300c --- /dev/null +++ b/examples/demos/maroon/content/gfx/shooter-action.png diff --git a/examples/demos/maroon/content/gfx/shooter-idle.png b/examples/demos/maroon/content/gfx/shooter-idle.png Binary files differnew file mode 100644 index 000000000..663098d3b --- /dev/null +++ b/examples/demos/maroon/content/gfx/shooter-idle.png diff --git a/examples/demos/maroon/content/gfx/shooter.png b/examples/demos/maroon/content/gfx/shooter.png Binary files differnew file mode 100644 index 000000000..d44401e05 --- /dev/null +++ b/examples/demos/maroon/content/gfx/shooter.png diff --git a/examples/demos/maroon/content/gfx/sunlight.png b/examples/demos/maroon/content/gfx/sunlight.png Binary files differnew file mode 100644 index 000000000..764ea151a --- /dev/null +++ b/examples/demos/maroon/content/gfx/sunlight.png diff --git a/examples/demos/maroon/content/gfx/text-1.png b/examples/demos/maroon/content/gfx/text-1.png Binary files differnew file mode 100644 index 000000000..3ea399cc9 --- /dev/null +++ b/examples/demos/maroon/content/gfx/text-1.png diff --git a/examples/demos/maroon/content/gfx/text-2.png b/examples/demos/maroon/content/gfx/text-2.png Binary files differnew file mode 100644 index 000000000..934a481f3 --- /dev/null +++ b/examples/demos/maroon/content/gfx/text-2.png diff --git a/examples/demos/maroon/content/gfx/text-3.png b/examples/demos/maroon/content/gfx/text-3.png Binary files differnew file mode 100644 index 000000000..47523f55b --- /dev/null +++ b/examples/demos/maroon/content/gfx/text-3.png diff --git a/examples/demos/maroon/content/gfx/text-blank.png b/examples/demos/maroon/content/gfx/text-blank.png Binary files differnew file mode 100644 index 000000000..4a687b24d --- /dev/null +++ b/examples/demos/maroon/content/gfx/text-blank.png diff --git a/examples/demos/maroon/content/gfx/text-gameover.png b/examples/demos/maroon/content/gfx/text-gameover.png Binary files differnew file mode 100644 index 000000000..4f53ef0b2 --- /dev/null +++ b/examples/demos/maroon/content/gfx/text-gameover.png diff --git a/examples/demos/maroon/content/gfx/text-go.png b/examples/demos/maroon/content/gfx/text-go.png Binary files differnew file mode 100644 index 000000000..bfc26f71f --- /dev/null +++ b/examples/demos/maroon/content/gfx/text-go.png diff --git a/examples/demos/maroon/content/gfx/wave.png b/examples/demos/maroon/content/gfx/wave.png Binary files differnew file mode 100644 index 000000000..f97426c4e --- /dev/null +++ b/examples/demos/maroon/content/gfx/wave.png diff --git a/examples/demos/maroon/content/logic.js b/examples/demos/maroon/content/logic.js new file mode 100644 index 000000000..3830b5ad6 --- /dev/null +++ b/examples/demos/maroon/content/logic.js @@ -0,0 +1,274 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +.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/demos/maroon/content/mobs/MobBase.qml b/examples/demos/maroon/content/mobs/MobBase.qml new file mode 100644 index 000000000..584623fa7 --- /dev/null +++ b/examples/demos/maroon/content/mobs/MobBase.qml @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../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/demos/maroon/content/towers/Bomb.qml b/examples/demos/maroon/content/towers/Bomb.qml new file mode 100644 index 000000000..e33d71d2e --- /dev/null +++ b/examples/demos/maroon/content/towers/Bomb.qml @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../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/demos/maroon/content/towers/Factory.qml b/examples/demos/maroon/content/towers/Factory.qml new file mode 100644 index 000000000..6b688e051 --- /dev/null +++ b/examples/demos/maroon/content/towers/Factory.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../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/demos/maroon/content/towers/Melee.qml b/examples/demos/maroon/content/towers/Melee.qml new file mode 100644 index 000000000..f83bd4c52 --- /dev/null +++ b/examples/demos/maroon/content/towers/Melee.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 ".." + +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/demos/maroon/content/towers/Ranged.qml b/examples/demos/maroon/content/towers/Ranged.qml new file mode 100644 index 000000000..2c1f5d134 --- /dev/null +++ b/examples/demos/maroon/content/towers/Ranged.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../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/demos/maroon/content/towers/TowerBase.qml b/examples/demos/maroon/content/towers/TowerBase.qml new file mode 100644 index 000000000..be37d732e --- /dev/null +++ b/examples/demos/maroon/content/towers/TowerBase.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 { + 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/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png Binary files differnew file mode 100644 index 000000000..162b66580 --- /dev/null +++ b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png diff --git a/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png Binary files differnew file mode 100644 index 000000000..15b7f115f --- /dev/null +++ b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png diff --git a/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg Binary files differnew file mode 100644 index 000000000..a83e282d5 --- /dev/null +++ b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg diff --git a/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg Binary files differnew file mode 100644 index 000000000..8a6063b7c --- /dev/null +++ b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg diff --git a/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg Binary files differnew file mode 100644 index 000000000..e3e4a2ec8 --- /dev/null +++ b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg diff --git a/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg Binary files differnew file mode 100644 index 000000000..ad6b4bf15 --- /dev/null +++ b/examples/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg diff --git a/examples/demos/maroon/doc/src/maroon.qdoc b/examples/demos/maroon/doc/src/maroon.qdoc new file mode 100644 index 000000000..e6f0a2523 --- /dev/null +++ b/examples/demos/maroon/doc/src/maroon.qdoc @@ -0,0 +1,889 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/maroon/main.cpp b/examples/demos/maroon/main.cpp new file mode 100644 index 000000000..baf372125 --- /dev/null +++ b/examples/demos/maroon/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon) diff --git a/examples/demos/maroon/maroon.pro b/examples/demos/maroon/maroon.pro new file mode 100644 index 000000000..da2c4341b --- /dev/null +++ b/examples/demos/maroon/maroon.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += qml quick +qtHaveModule(multimedia): QT += multimedia +SOURCES += main.cpp +RESOURCES += maroon.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/maroon +INSTALLS += target diff --git a/examples/demos/maroon/maroon.qml b/examples/demos/maroon/maroon.qml new file mode 100644 index 000000000..d05ef57b6 --- /dev/null +++ b/examples/demos/maroon/maroon.qml @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/maroon/maroon.qmlproject b/examples/demos/maroon/maroon.qmlproject new file mode 100644 index 000000000..752666114 --- /dev/null +++ b/examples/demos/maroon/maroon.qmlproject @@ -0,0 +1,16 @@ +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/demos/maroon/maroon.qrc b/examples/demos/maroon/maroon.qrc new file mode 100644 index 000000000..52c2a4e51 --- /dev/null +++ b/examples/demos/maroon/maroon.qrc @@ -0,0 +1,71 @@ +<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/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png b/examples/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png Binary files differnew file mode 100644 index 000000000..a0cd82399 --- /dev/null +++ b/examples/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png diff --git a/examples/demos/photosurface/doc/src/photosurface.qdoc b/examples/demos/photosurface/doc/src/photosurface.qdoc new file mode 100644 index 000000000..dd1b2fe79 --- /dev/null +++ b/examples/demos/photosurface/doc/src/photosurface.qdoc @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/photosurface/main.cpp b/examples/demos/photosurface/main.cpp new file mode 100644 index 000000000..d1522bd09 --- /dev/null +++ b/examples/demos/photosurface/main.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +#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/demos/photosurface/photosurface.pro b/examples/demos/photosurface/photosurface.pro new file mode 100644 index 000000000..bd683ef40 --- /dev/null +++ b/examples/demos/photosurface/photosurface.pro @@ -0,0 +1,13 @@ +TEMPLATE = app + +QT += qml quick +qtHaveModule(widgets): QT += widgets +SOURCES += main.cpp +RESOURCES += photosurface.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/photosurface +INSTALLS += target +ICON = resources/icon.png +macos: ICON = resources/photosurface.icns +win32: RC_FILE = resources/photosurface.rc + diff --git a/examples/demos/photosurface/photosurface.qml b/examples/demos/photosurface/photosurface.qml new file mode 100644 index 000000000..5d1445d77 --- /dev/null +++ b/examples/demos/photosurface/photosurface.qml @@ -0,0 +1,286 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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.originY) * (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.originY) * (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/demos/photosurface/photosurface.qmlproject b/examples/demos/photosurface/photosurface.qmlproject new file mode 100644 index 000000000..ae2065f59 --- /dev/null +++ b/examples/demos/photosurface/photosurface.qmlproject @@ -0,0 +1,20 @@ +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/demos/photosurface/photosurface.qrc b/examples/demos/photosurface/photosurface.qrc new file mode 100644 index 000000000..f8fafbb1f --- /dev/null +++ b/examples/demos/photosurface/photosurface.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>photosurface.qml</file> + <file>resources/folder.png</file> + </qresource> +</RCC> diff --git a/examples/demos/photosurface/resources/folder.png b/examples/demos/photosurface/resources/folder.png Binary files differnew file mode 100644 index 000000000..2aec3b6eb --- /dev/null +++ b/examples/demos/photosurface/resources/folder.png diff --git a/examples/demos/photosurface/resources/icon.png b/examples/demos/photosurface/resources/icon.png Binary files differnew file mode 100644 index 000000000..f8ff553fc --- /dev/null +++ b/examples/demos/photosurface/resources/icon.png diff --git a/examples/demos/photosurface/resources/photosurface.icns b/examples/demos/photosurface/resources/photosurface.icns Binary files differnew file mode 100644 index 000000000..c69ec41c4 --- /dev/null +++ b/examples/demos/photosurface/resources/photosurface.icns diff --git a/examples/demos/photosurface/resources/photosurface.ico b/examples/demos/photosurface/resources/photosurface.ico Binary files differnew file mode 100644 index 000000000..03bb7ee36 --- /dev/null +++ b/examples/demos/photosurface/resources/photosurface.ico diff --git a/examples/demos/photosurface/resources/photosurface.rc b/examples/demos/photosurface/resources/photosurface.rc new file mode 100644 index 000000000..3267bd033 --- /dev/null +++ b/examples/demos/photosurface/resources/photosurface.rc @@ -0,0 +1,32 @@ +#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/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml new file mode 100644 index 000000000..6b654377a --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml new file mode 100644 index 000000000..17a7b0d8d --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/Button.qml b/examples/demos/photoviewer/PhotoViewerCore/Button.qml new file mode 100644 index 000000000..8744dc2e7 --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/Button.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml new file mode 100644 index 000000000..2df47c063 --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml new file mode 100644 index 000000000..b3652701e --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** 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$ +** 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.mjs" 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/demos/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml new file mode 100644 index 000000000..ee21eb6fc --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/RssModel.qml b/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml new file mode 100644 index 000000000..c19888a40 --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/Tag.qml b/examples/demos/photoviewer/PhotoViewerCore/Tag.qml new file mode 100644 index 000000000..bc12d81a9 --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/Tag.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png Binary files differnew file mode 100644 index 000000000..23c011d0f --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/busy.png b/examples/demos/photoviewer/PhotoViewerCore/images/busy.png Binary files differnew file mode 100644 index 000000000..fc65122d2 --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/images/busy.png diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png Binary files differnew file mode 100644 index 000000000..a8a9c6079 --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png diff --git a/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs b/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs new file mode 100644 index 000000000..1eb7cac7e --- /dev/null +++ b/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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$ +** 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$ +** +****************************************************************************/ + +export function getWidth(string) { + return (string.match(/width=\"([0-9]+)\"/))[1] +} + +export function getHeight(string) { + return (string.match(/height=\"([0-9]+)\"/))[1] +} + +export function getImagePath(string) { + var pattern = /src=\"http:\/\/(\S+)\"/ + return (string.match(pattern))[1] +} + +export 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/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png b/examples/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png Binary files differnew file mode 100644 index 000000000..f5eac4caf --- /dev/null +++ b/examples/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png diff --git a/examples/demos/photoviewer/doc/src/photoviewer.qdoc b/examples/demos/photoviewer/doc/src/photoviewer.qdoc new file mode 100644 index 000000000..da9029f81 --- /dev/null +++ b/examples/demos/photoviewer/doc/src/photoviewer.qdoc @@ -0,0 +1,326 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/photoviewer/i18n/qml_de.ts b/examples/demos/photoviewer/i18n/qml_de.ts new file mode 100644 index 000000000..c36f169c6 --- /dev/null +++ b/examples/demos/photoviewer/i18n/qml_de.ts @@ -0,0 +1,35 @@ +<?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="111"/> + <source>Remove</source> + <translation>Entfernen</translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="../main.qml" line="93"/> + <source>Add</source> + <translation>Zufügen</translation> + </message> + <message> + <location filename="../main.qml" line="102"/> + <source>Edit</source> + <translation>Bearbeiten</translation> + </message> + <message> + <location filename="../main.qml" line="107"/> + <source>Quit</source> + <translation>Verlassen</translation> + </message> + <message> + <location filename="../main.qml" line="122"/> + <source>Back</source> + <translation>Zurück</translation> + </message> +</context> +</TS> diff --git a/examples/demos/photoviewer/i18n/qml_en.ts b/examples/demos/photoviewer/i18n/qml_en.ts new file mode 100644 index 000000000..5315a7552 --- /dev/null +++ b/examples/demos/photoviewer/i18n/qml_en.ts @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="en"> +</TS> diff --git a/examples/demos/photoviewer/i18n/qml_fr.ts b/examples/demos/photoviewer/i18n/qml_fr.ts new file mode 100644 index 000000000..353082569 --- /dev/null +++ b/examples/demos/photoviewer/i18n/qml_fr.ts @@ -0,0 +1,35 @@ +<?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="111"/> + <source>Remove</source> + <translation>Supprimer</translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="../main.qml" line="93"/> + <source>Add</source> + <translation>Ajouter</translation> + </message> + <message> + <location filename="../main.qml" line="102"/> + <source>Edit</source> + <translation>Éditer</translation> + </message> + <message> + <location filename="../main.qml" line="107"/> + <source>Quit</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../main.qml" line="122"/> + <source>Back</source> + <translation>Retour</translation> + </message> +</context> +</TS> diff --git a/examples/demos/photoviewer/main.cpp b/examples/demos/photoviewer/main.cpp new file mode 100644 index 000000000..e9d828230 --- /dev/null +++ b/examples/demos/photoviewer/main.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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$ +** 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(QLocale(), "qml", "_", ":/i18n/"); + app.installTranslator(&qtTranslator); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); + + return app.exec(); +} diff --git a/examples/demos/photoviewer/main.qml b/examples/demos/photoviewer/main.qml new file mode 100644 index 000000000..8ed77ad2a --- /dev/null +++ b/examples/demos/photoviewer/main.qml @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** 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$ +** 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/demos/photoviewer/photoviewer.pro b/examples/demos/photoviewer/photoviewer.pro new file mode 100644 index 000000000..234318057 --- /dev/null +++ b/examples/demos/photoviewer/photoviewer.pro @@ -0,0 +1,35 @@ +TEMPLATE = app + +QT += qml quick xmlpatterns +CONFIG += lrelease embed_translations + +SOURCES += main.cpp + +lupdate_only { +SOURCES = *.qml \ + PhotoViewerCore/*.qml \ + PhotoViewerCore/script/*.js +} + +TRANSLATIONS += i18n/qml_fr.ts \ + i18n/qml_de.ts + +EXTRA_TRANSLATIONS += i18n/qml_en.ts + +RESOURCES += main.qml \ + PhotoViewerCore/AlbumDelegate.qml \ + PhotoViewerCore/BusyIndicator.qml \ + PhotoViewerCore/Button.qml \ + PhotoViewerCore/EditableButton.qml \ + PhotoViewerCore/PhotoDelegate.qml \ + PhotoViewerCore/ProgressBar.qml \ + PhotoViewerCore/RssModel.qml \ + PhotoViewerCore/Tag.qml \ + PhotoViewerCore/images/box-shadow.png \ + PhotoViewerCore/images/busy.png \ + PhotoViewerCore/images/cardboard.png \ + PhotoViewerCore/script/script.mjs \ + + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/photoviewer +INSTALLS += target diff --git a/examples/demos/rssnews/content/BusyIndicator.qml b/examples/demos/rssnews/content/BusyIndicator.qml new file mode 100644 index 000000000..44b796bdf --- /dev/null +++ b/examples/demos/rssnews/content/BusyIndicator.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/rssnews/content/CategoryDelegate.qml b/examples/demos/rssnews/content/CategoryDelegate.qml new file mode 100644 index 000000000..c76bc78ac --- /dev/null +++ b/examples/demos/rssnews/content/CategoryDelegate.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/rssnews/content/NewsDelegate.qml b/examples/demos/rssnews/content/NewsDelegate.qml new file mode 100644 index 000000000..ed0c2bd97 --- /dev/null +++ b/examples/demos/rssnews/content/NewsDelegate.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/rssnews/content/RssFeeds.qml b/examples/demos/rssnews/content/RssFeeds.qml new file mode 100644 index 000000000..46a6c875c --- /dev/null +++ b/examples/demos/rssnews/content/RssFeeds.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/rssnews/content/ScrollBar.qml b/examples/demos/rssnews/content/ScrollBar.qml new file mode 100644 index 000000000..bd774188c --- /dev/null +++ b/examples/demos/rssnews/content/ScrollBar.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/rssnews/content/images/Asia.jpg b/examples/demos/rssnews/content/images/Asia.jpg Binary files differnew file mode 100644 index 000000000..a609557a0 --- /dev/null +++ b/examples/demos/rssnews/content/images/Asia.jpg diff --git a/examples/demos/rssnews/content/images/Business.jpg b/examples/demos/rssnews/content/images/Business.jpg Binary files differnew file mode 100644 index 000000000..b2c1d9213 --- /dev/null +++ b/examples/demos/rssnews/content/images/Business.jpg diff --git a/examples/demos/rssnews/content/images/Entertainment.jpg b/examples/demos/rssnews/content/images/Entertainment.jpg Binary files differnew file mode 100644 index 000000000..2c69fc04d --- /dev/null +++ b/examples/demos/rssnews/content/images/Entertainment.jpg diff --git a/examples/demos/rssnews/content/images/Europe.jpg b/examples/demos/rssnews/content/images/Europe.jpg Binary files differnew file mode 100644 index 000000000..bf524e13d --- /dev/null +++ b/examples/demos/rssnews/content/images/Europe.jpg diff --git a/examples/demos/rssnews/content/images/Health.jpg b/examples/demos/rssnews/content/images/Health.jpg Binary files differnew file mode 100644 index 000000000..0e8c71f0c --- /dev/null +++ b/examples/demos/rssnews/content/images/Health.jpg diff --git a/examples/demos/rssnews/content/images/Politics.jpg b/examples/demos/rssnews/content/images/Politics.jpg Binary files differnew file mode 100644 index 000000000..0b1800c97 --- /dev/null +++ b/examples/demos/rssnews/content/images/Politics.jpg diff --git a/examples/demos/rssnews/content/images/Science.jpg b/examples/demos/rssnews/content/images/Science.jpg Binary files differnew file mode 100644 index 000000000..7faccbbb9 --- /dev/null +++ b/examples/demos/rssnews/content/images/Science.jpg diff --git a/examples/demos/rssnews/content/images/Sports.jpg b/examples/demos/rssnews/content/images/Sports.jpg Binary files differnew file mode 100644 index 000000000..0ab3bd3ce --- /dev/null +++ b/examples/demos/rssnews/content/images/Sports.jpg diff --git a/examples/demos/rssnews/content/images/Technology.jpg b/examples/demos/rssnews/content/images/Technology.jpg Binary files differnew file mode 100644 index 000000000..db553028f --- /dev/null +++ b/examples/demos/rssnews/content/images/Technology.jpg diff --git a/examples/demos/rssnews/content/images/TopStories.jpg b/examples/demos/rssnews/content/images/TopStories.jpg Binary files differnew file mode 100644 index 000000000..e35bd67f2 --- /dev/null +++ b/examples/demos/rssnews/content/images/TopStories.jpg diff --git a/examples/demos/rssnews/content/images/USNational.jpg b/examples/demos/rssnews/content/images/USNational.jpg Binary files differnew file mode 100644 index 000000000..82c78228c --- /dev/null +++ b/examples/demos/rssnews/content/images/USNational.jpg diff --git a/examples/demos/rssnews/content/images/World.jpg b/examples/demos/rssnews/content/images/World.jpg Binary files differnew file mode 100644 index 000000000..7a0a806fd --- /dev/null +++ b/examples/demos/rssnews/content/images/World.jpg diff --git a/examples/demos/rssnews/content/images/btn_close.png b/examples/demos/rssnews/content/images/btn_close.png Binary files differnew file mode 100644 index 000000000..1a3dc4438 --- /dev/null +++ b/examples/demos/rssnews/content/images/btn_close.png diff --git a/examples/demos/rssnews/content/images/busy.png b/examples/demos/rssnews/content/images/busy.png Binary files differnew file mode 100644 index 000000000..fc65122d2 --- /dev/null +++ b/examples/demos/rssnews/content/images/busy.png diff --git a/examples/demos/rssnews/content/images/scrollbar.png b/examples/demos/rssnews/content/images/scrollbar.png Binary files differnew file mode 100644 index 000000000..c2425dd0d --- /dev/null +++ b/examples/demos/rssnews/content/images/scrollbar.png diff --git a/examples/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png b/examples/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png Binary files differnew file mode 100644 index 000000000..e13cc3096 --- /dev/null +++ b/examples/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png diff --git a/examples/demos/rssnews/doc/src/rssnews.qdoc b/examples/demos/rssnews/doc/src/rssnews.qdoc new file mode 100644 index 000000000..4ba874cd7 --- /dev/null +++ b/examples/demos/rssnews/doc/src/rssnews.qdoc @@ -0,0 +1,372 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/rssnews/main.cpp b/examples/demos/rssnews/main.cpp new file mode 100644 index 000000000..7bbd83c46 --- /dev/null +++ b/examples/demos/rssnews/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/rssnews/rssnews) diff --git a/examples/demos/rssnews/rssnews.pro b/examples/demos/rssnews/rssnews.pro new file mode 100644 index 000000000..0342578e6 --- /dev/null +++ b/examples/demos/rssnews/rssnews.pro @@ -0,0 +1,13 @@ +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]/demos/rssnews +INSTALLS += target diff --git a/examples/demos/rssnews/rssnews.qml b/examples/demos/rssnews/rssnews.qml new file mode 100644 index 000000000..263154f95 --- /dev/null +++ b/examples/demos/rssnews/rssnews.qml @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/rssnews/rssnews.qmlproject b/examples/demos/rssnews/rssnews.qmlproject new file mode 100644 index 000000000..5becbdaed --- /dev/null +++ b/examples/demos/rssnews/rssnews.qmlproject @@ -0,0 +1,16 @@ +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/demos/rssnews/rssnews.qrc b/examples/demos/rssnews/rssnews.qrc new file mode 100644 index 000000000..1208d44fd --- /dev/null +++ b/examples/demos/rssnews/rssnews.qrc @@ -0,0 +1,25 @@ +<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/demos/samegame/content/Block.qml b/examples/demos/samegame/content/Block.qml new file mode 100644 index 000000000..5c6e584e3 --- /dev/null +++ b/examples/demos/samegame/content/Block.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/BlockEmitter.qml b/examples/demos/samegame/content/BlockEmitter.qml new file mode 100644 index 000000000..cbcc5df99 --- /dev/null +++ b/examples/demos/samegame/content/BlockEmitter.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/Button.qml b/examples/demos/samegame/content/Button.qml new file mode 100644 index 000000000..baaa7c73b --- /dev/null +++ b/examples/demos/samegame/content/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/GameArea.qml b/examples/demos/samegame/content/GameArea.qml new file mode 100644 index 000000000..0f51fcf00 --- /dev/null +++ b/examples/demos/samegame/content/GameArea.qml @@ -0,0 +1,238 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/LogoAnimation.qml b/examples/demos/samegame/content/LogoAnimation.qml new file mode 100644 index 000000000..fd89ea816 --- /dev/null +++ b/examples/demos/samegame/content/LogoAnimation.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/MenuEmitter.qml b/examples/demos/samegame/content/MenuEmitter.qml new file mode 100644 index 000000000..20cbb2c1a --- /dev/null +++ b/examples/demos/samegame/content/MenuEmitter.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/PaintEmitter.qml b/examples/demos/samegame/content/PaintEmitter.qml new file mode 100644 index 000000000..dd67c966a --- /dev/null +++ b/examples/demos/samegame/content/PaintEmitter.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/PrimaryPack.qml b/examples/demos/samegame/content/PrimaryPack.qml new file mode 100644 index 000000000..0e3b77087 --- /dev/null +++ b/examples/demos/samegame/content/PrimaryPack.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/PuzzleBlock.qml b/examples/demos/samegame/content/PuzzleBlock.qml new file mode 100644 index 000000000..f65b79d51 --- /dev/null +++ b/examples/demos/samegame/content/PuzzleBlock.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/SamegameText.qml b/examples/demos/samegame/content/SamegameText.qml new file mode 100644 index 000000000..c69272bad --- /dev/null +++ b/examples/demos/samegame/content/SamegameText.qml @@ -0,0 +1,59 @@ +/*************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 "." + +Text { + font.pixelSize: Settings.fontPixelSize; + color: "white"; + textFormat: Text.StyledText; + Behavior on opacity { NumberAnimation {} } +} diff --git a/examples/demos/samegame/content/Settings.qml b/examples/demos/samegame/content/Settings.qml new file mode 100644 index 000000000..2892198b2 --- /dev/null +++ b/examples/demos/samegame/content/Settings.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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$ +** +****************************************************************************/ + +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/demos/samegame/content/SimpleBlock.qml b/examples/demos/samegame/content/SimpleBlock.qml new file mode 100644 index 000000000..eb2c458d4 --- /dev/null +++ b/examples/demos/samegame/content/SimpleBlock.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/SmokeText.qml b/examples/demos/samegame/content/SmokeText.qml new file mode 100644 index 000000000..1fc72010d --- /dev/null +++ b/examples/demos/samegame/content/SmokeText.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/content/gfx/background-puzzle.png b/examples/demos/samegame/content/gfx/background-puzzle.png Binary files differnew file mode 100644 index 000000000..fe91f9044 --- /dev/null +++ b/examples/demos/samegame/content/gfx/background-puzzle.png diff --git a/examples/demos/samegame/content/gfx/background.png b/examples/demos/samegame/content/gfx/background.png Binary files differnew file mode 100644 index 000000000..cfac5e37d --- /dev/null +++ b/examples/demos/samegame/content/gfx/background.png diff --git a/examples/demos/samegame/content/gfx/bar.png b/examples/demos/samegame/content/gfx/bar.png Binary files differnew file mode 100644 index 000000000..4953cd622 --- /dev/null +++ b/examples/demos/samegame/content/gfx/bar.png diff --git a/examples/demos/samegame/content/gfx/blue-puzzle.png b/examples/demos/samegame/content/gfx/blue-puzzle.png Binary files differnew file mode 100644 index 000000000..e550d5935 --- /dev/null +++ b/examples/demos/samegame/content/gfx/blue-puzzle.png diff --git a/examples/demos/samegame/content/gfx/blue.png b/examples/demos/samegame/content/gfx/blue.png Binary files differnew file mode 100644 index 000000000..b8161c0f7 --- /dev/null +++ b/examples/demos/samegame/content/gfx/blue.png diff --git a/examples/demos/samegame/content/gfx/bubble-highscore.png b/examples/demos/samegame/content/gfx/bubble-highscore.png Binary files differnew file mode 100644 index 000000000..c4e38df82 --- /dev/null +++ b/examples/demos/samegame/content/gfx/bubble-highscore.png diff --git a/examples/demos/samegame/content/gfx/bubble-puzzle.png b/examples/demos/samegame/content/gfx/bubble-puzzle.png Binary files differnew file mode 100644 index 000000000..278556bc8 --- /dev/null +++ b/examples/demos/samegame/content/gfx/bubble-puzzle.png diff --git a/examples/demos/samegame/content/gfx/but-game-1.png b/examples/demos/samegame/content/gfx/but-game-1.png Binary files differnew file mode 100644 index 000000000..3343b7ff1 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-game-1.png diff --git a/examples/demos/samegame/content/gfx/but-game-2.png b/examples/demos/samegame/content/gfx/but-game-2.png Binary files differnew file mode 100644 index 000000000..afba10696 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-game-2.png diff --git a/examples/demos/samegame/content/gfx/but-game-3.png b/examples/demos/samegame/content/gfx/but-game-3.png Binary files differnew file mode 100644 index 000000000..adea77a68 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-game-3.png diff --git a/examples/demos/samegame/content/gfx/but-game-4.png b/examples/demos/samegame/content/gfx/but-game-4.png Binary files differnew file mode 100644 index 000000000..18c922ba4 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-game-4.png diff --git a/examples/demos/samegame/content/gfx/but-game-new.png b/examples/demos/samegame/content/gfx/but-game-new.png Binary files differnew file mode 100644 index 000000000..257e18258 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-game-new.png diff --git a/examples/demos/samegame/content/gfx/but-menu.png b/examples/demos/samegame/content/gfx/but-menu.png Binary files differnew file mode 100644 index 000000000..8440e8775 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-menu.png diff --git a/examples/demos/samegame/content/gfx/but-puzzle-next.png b/examples/demos/samegame/content/gfx/but-puzzle-next.png Binary files differnew file mode 100644 index 000000000..7e3ed417d --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-puzzle-next.png diff --git a/examples/demos/samegame/content/gfx/but-quit.png b/examples/demos/samegame/content/gfx/but-quit.png Binary files differnew file mode 100644 index 000000000..95c77ced9 --- /dev/null +++ b/examples/demos/samegame/content/gfx/but-quit.png diff --git a/examples/demos/samegame/content/gfx/green-puzzle.png b/examples/demos/samegame/content/gfx/green-puzzle.png Binary files differnew file mode 100644 index 000000000..581f76fd8 --- /dev/null +++ b/examples/demos/samegame/content/gfx/green-puzzle.png diff --git a/examples/demos/samegame/content/gfx/green.png b/examples/demos/samegame/content/gfx/green.png Binary files differnew file mode 100644 index 000000000..da4cca5e7 --- /dev/null +++ b/examples/demos/samegame/content/gfx/green.png diff --git a/examples/demos/samegame/content/gfx/icon-fail.png b/examples/demos/samegame/content/gfx/icon-fail.png Binary files differnew file mode 100644 index 000000000..40726118a --- /dev/null +++ b/examples/demos/samegame/content/gfx/icon-fail.png diff --git a/examples/demos/samegame/content/gfx/icon-ok.png b/examples/demos/samegame/content/gfx/icon-ok.png Binary files differnew file mode 100644 index 000000000..15a8442e9 --- /dev/null +++ b/examples/demos/samegame/content/gfx/icon-ok.png diff --git a/examples/demos/samegame/content/gfx/icon-time.png b/examples/demos/samegame/content/gfx/icon-time.png Binary files differnew file mode 100644 index 000000000..9490e49e9 --- /dev/null +++ b/examples/demos/samegame/content/gfx/icon-time.png diff --git a/examples/demos/samegame/content/gfx/logo-a.png b/examples/demos/samegame/content/gfx/logo-a.png Binary files differnew file mode 100644 index 000000000..20c20ba48 --- /dev/null +++ b/examples/demos/samegame/content/gfx/logo-a.png diff --git a/examples/demos/samegame/content/gfx/logo-e.png b/examples/demos/samegame/content/gfx/logo-e.png Binary files differnew file mode 100644 index 000000000..dd663f114 --- /dev/null +++ b/examples/demos/samegame/content/gfx/logo-e.png diff --git a/examples/demos/samegame/content/gfx/logo-g.png b/examples/demos/samegame/content/gfx/logo-g.png Binary files differnew file mode 100644 index 000000000..a319bf9ff --- /dev/null +++ b/examples/demos/samegame/content/gfx/logo-g.png diff --git a/examples/demos/samegame/content/gfx/logo-m.png b/examples/demos/samegame/content/gfx/logo-m.png Binary files differnew file mode 100644 index 000000000..6a029b326 --- /dev/null +++ b/examples/demos/samegame/content/gfx/logo-m.png diff --git a/examples/demos/samegame/content/gfx/logo-s.png b/examples/demos/samegame/content/gfx/logo-s.png Binary files differnew file mode 100644 index 000000000..963b17546 --- /dev/null +++ b/examples/demos/samegame/content/gfx/logo-s.png diff --git a/examples/demos/samegame/content/gfx/logo.png b/examples/demos/samegame/content/gfx/logo.png Binary files differnew file mode 100644 index 000000000..e900eddb2 --- /dev/null +++ b/examples/demos/samegame/content/gfx/logo.png diff --git a/examples/demos/samegame/content/gfx/particle-brick.png b/examples/demos/samegame/content/gfx/particle-brick.png Binary files differnew file mode 100644 index 000000000..5c83896d2 --- /dev/null +++ b/examples/demos/samegame/content/gfx/particle-brick.png diff --git a/examples/demos/samegame/content/gfx/particle-paint.png b/examples/demos/samegame/content/gfx/particle-paint.png Binary files differnew file mode 100644 index 000000000..9bd0a2a13 --- /dev/null +++ b/examples/demos/samegame/content/gfx/particle-paint.png diff --git a/examples/demos/samegame/content/gfx/particle-smoke.png b/examples/demos/samegame/content/gfx/particle-smoke.png Binary files differnew file mode 100644 index 000000000..b27f954a7 --- /dev/null +++ b/examples/demos/samegame/content/gfx/particle-smoke.png diff --git a/examples/demos/samegame/content/gfx/red-puzzle.png b/examples/demos/samegame/content/gfx/red-puzzle.png Binary files differnew file mode 100644 index 000000000..9ceb17e4d --- /dev/null +++ b/examples/demos/samegame/content/gfx/red-puzzle.png diff --git a/examples/demos/samegame/content/gfx/red.png b/examples/demos/samegame/content/gfx/red.png Binary files differnew file mode 100644 index 000000000..681810fe3 --- /dev/null +++ b/examples/demos/samegame/content/gfx/red.png diff --git a/examples/demos/samegame/content/gfx/text-highscore-new.png b/examples/demos/samegame/content/gfx/text-highscore-new.png Binary files differnew file mode 100644 index 000000000..50f7fcd0f --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-highscore-new.png diff --git a/examples/demos/samegame/content/gfx/text-highscore.png b/examples/demos/samegame/content/gfx/text-highscore.png Binary files differnew file mode 100644 index 000000000..7198c277b --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-highscore.png diff --git a/examples/demos/samegame/content/gfx/text-no-winner.png b/examples/demos/samegame/content/gfx/text-no-winner.png Binary files differnew file mode 100644 index 000000000..b4a668511 --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-no-winner.png diff --git a/examples/demos/samegame/content/gfx/text-p1-go.png b/examples/demos/samegame/content/gfx/text-p1-go.png Binary files differnew file mode 100644 index 000000000..c7bd2a5e7 --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-p1-go.png diff --git a/examples/demos/samegame/content/gfx/text-p1-won.png b/examples/demos/samegame/content/gfx/text-p1-won.png Binary files differnew file mode 100644 index 000000000..41c2eb7c9 --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-p1-won.png diff --git a/examples/demos/samegame/content/gfx/text-p1.png b/examples/demos/samegame/content/gfx/text-p1.png Binary files differnew file mode 100644 index 000000000..b59c87b97 --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-p1.png diff --git a/examples/demos/samegame/content/gfx/text-p2-go.png b/examples/demos/samegame/content/gfx/text-p2-go.png Binary files differnew file mode 100644 index 000000000..f03cd93af --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-p2-go.png diff --git a/examples/demos/samegame/content/gfx/text-p2-won.png b/examples/demos/samegame/content/gfx/text-p2-won.png Binary files differnew file mode 100644 index 000000000..116b7f2e7 --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-p2-won.png diff --git a/examples/demos/samegame/content/gfx/text-p2.png b/examples/demos/samegame/content/gfx/text-p2.png Binary files differnew file mode 100644 index 000000000..d4f2bc733 --- /dev/null +++ b/examples/demos/samegame/content/gfx/text-p2.png diff --git a/examples/demos/samegame/content/gfx/yellow-puzzle.png b/examples/demos/samegame/content/gfx/yellow-puzzle.png Binary files differnew file mode 100644 index 000000000..66044c81b --- /dev/null +++ b/examples/demos/samegame/content/gfx/yellow-puzzle.png diff --git a/examples/demos/samegame/content/gfx/yellow.png b/examples/demos/samegame/content/gfx/yellow.png Binary files differnew file mode 100644 index 000000000..6bc5d385e --- /dev/null +++ b/examples/demos/samegame/content/gfx/yellow.png diff --git a/examples/demos/samegame/content/levels/TemplateBase.qml b/examples/demos/samegame/content/levels/TemplateBase.qml new file mode 100644 index 000000000..6501f277e --- /dev/null +++ b/examples/demos/samegame/content/levels/TemplateBase.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level0.qml b/examples/demos/samegame/content/levels/level0.qml new file mode 100644 index 000000000..3c09b1f3d --- /dev/null +++ b/examples/demos/samegame/content/levels/level0.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level1.qml b/examples/demos/samegame/content/levels/level1.qml new file mode 100644 index 000000000..29ad09cf0 --- /dev/null +++ b/examples/demos/samegame/content/levels/level1.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level2.qml b/examples/demos/samegame/content/levels/level2.qml new file mode 100644 index 000000000..830776223 --- /dev/null +++ b/examples/demos/samegame/content/levels/level2.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level3.qml b/examples/demos/samegame/content/levels/level3.qml new file mode 100644 index 000000000..91b03a165 --- /dev/null +++ b/examples/demos/samegame/content/levels/level3.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level4.qml b/examples/demos/samegame/content/levels/level4.qml new file mode 100644 index 000000000..589d38684 --- /dev/null +++ b/examples/demos/samegame/content/levels/level4.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level5.qml b/examples/demos/samegame/content/levels/level5.qml new file mode 100644 index 000000000..78ee6eb35 --- /dev/null +++ b/examples/demos/samegame/content/levels/level5.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level6.qml b/examples/demos/samegame/content/levels/level6.qml new file mode 100644 index 000000000..3e56808dc --- /dev/null +++ b/examples/demos/samegame/content/levels/level6.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level7.qml b/examples/demos/samegame/content/levels/level7.qml new file mode 100644 index 000000000..2e412a0c7 --- /dev/null +++ b/examples/demos/samegame/content/levels/level7.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level8.qml b/examples/demos/samegame/content/levels/level8.qml new file mode 100644 index 000000000..18daa7628 --- /dev/null +++ b/examples/demos/samegame/content/levels/level8.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/levels/level9.qml b/examples/demos/samegame/content/levels/level9.qml new file mode 100644 index 000000000..38d667318 --- /dev/null +++ b/examples/demos/samegame/content/levels/level9.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/samegame/content/qmldir b/examples/demos/samegame/content/qmldir new file mode 100644 index 000000000..3b552ec1f --- /dev/null +++ b/examples/demos/samegame/content/qmldir @@ -0,0 +1,13 @@ +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/demos/samegame/content/samegame.js b/examples/demos/samegame/content/samegame.js new file mode 100644 index 000000000..0e2cd4ea5 --- /dev/null +++ b/examples/demos/samegame/content/samegame.js @@ -0,0 +1,590 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +/* 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/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png b/examples/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png Binary files differnew file mode 100644 index 000000000..f3dd3d5e9 --- /dev/null +++ b/examples/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png diff --git a/examples/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png b/examples/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png Binary files differnew file mode 100644 index 000000000..951871fff --- /dev/null +++ b/examples/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png diff --git a/examples/demos/samegame/doc/src/samegame.qdoc b/examples/demos/samegame/doc/src/samegame.qdoc new file mode 100644 index 000000000..25d0376c8 --- /dev/null +++ b/examples/demos/samegame/doc/src/samegame.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/samegame/main.cpp b/examples/demos/samegame/main.cpp new file mode 100644 index 000000000..8ac1f7ab4 --- /dev/null +++ b/examples/demos/samegame/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/samegame/samegame) diff --git a/examples/demos/samegame/samegame.pro b/examples/demos/samegame/samegame.pro new file mode 100644 index 000000000..ebb32c771 --- /dev/null +++ b/examples/demos/samegame/samegame.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += qml quick sql +SOURCES += main.cpp +RESOURCES += samegame.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/samegame +INSTALLS += target diff --git a/examples/demos/samegame/samegame.qml b/examples/demos/samegame/samegame.qml new file mode 100644 index 000000000..6045c512f --- /dev/null +++ b/examples/demos/samegame/samegame.qml @@ -0,0 +1,382 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/samegame/samegame.qmlproject b/examples/demos/samegame/samegame.qmlproject new file mode 100644 index 000000000..42ffacf4f --- /dev/null +++ b/examples/demos/samegame/samegame.qmlproject @@ -0,0 +1,16 @@ +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/demos/samegame/samegame.qrc b/examples/demos/samegame/samegame.qrc new file mode 100644 index 000000000..348ee109f --- /dev/null +++ b/examples/demos/samegame/samegame.qrc @@ -0,0 +1,73 @@ +<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/demos/shared/Button.qml b/examples/demos/shared/Button.qml new file mode 100644 index 000000000..8abce273b --- /dev/null +++ b/examples/demos/shared/Button.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.1 +import QtQuick.Window 2.1 + +Item { + id: container + + property alias text: buttonLabel.text + property alias label: buttonLabel + signal clicked + property alias containsMouse: mouseArea.containsMouse + property alias pressed: mouseArea.pressed + implicitHeight: Math.max(Screen.pixelDensity * 7, buttonLabel.implicitHeight * 1.2) + implicitWidth: Math.max(Screen.pixelDensity * 11, buttonLabel.implicitWidth * 1.3) + height: implicitHeight + width: implicitWidth + + SystemPalette { id: palette } + + Rectangle { + id: frame + anchors.fill: parent + color: palette.button + gradient: Gradient { + GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } + } + antialiasing: true + radius: height / 6 + border.color: Qt.darker(palette.button, 1.5) + border.width: 1 + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + hoverEnabled: true + } + + Text { + id: buttonLabel + text: container.text + color: palette.buttonText + anchors.centerIn: parent + } +} diff --git a/examples/demos/shared/CheckBox.qml b/examples/demos/shared/CheckBox.qml new file mode 100644 index 000000000..bcf8178f7 --- /dev/null +++ b/examples/demos/shared/CheckBox.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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: root + implicitHeight: frame.height + implicitWidth: row.implicitWidth + width: implicitWidth + height: implicitHeight + property alias text: label.text + property bool checked + property alias pressed: mouseArea.pressed + property alias row: row + signal clicked + + SystemPalette { id: palette } + + Row { + id: row + anchors.verticalCenter: parent.verticalCenter + spacing: 6 + Rectangle { + id: frame + gradient: Gradient { + GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } + } + height: label.implicitHeight * 1.5 + width: height + anchors.margins: 1 + radius: 3 + antialiasing: true + border.color: Qt.darker(palette.button, 1.5) + Image { + id: theX + source: "images/checkmark.png" + anchors.fill: frame + anchors.margins: frame.width / 5 + fillMode: Image.PreserveAspectFit + smooth: true + visible: checked + } + } + Text { + id: label + color: palette.text + anchors.verticalCenter: frame.verticalCenter + } + } + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + parent.checked = !parent.checked + parent.clicked() + } + } +} diff --git a/examples/demos/shared/Label.qml b/examples/demos/shared/Label.qml new file mode 100644 index 000000000..acbffb8df --- /dev/null +++ b/examples/demos/shared/Label.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +Text { + SystemPalette { id: palette } + color: palette.text +} diff --git a/examples/demos/shared/LauncherList.qml b/examples/demos/shared/LauncherList.qml new file mode 100644 index 000000000..e532b53e7 --- /dev/null +++ b/examples/demos/shared/LauncherList.qml @@ -0,0 +1,252 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Crimson AS <info@crimson.no> +** Copyright (C) 2017 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$ +** 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 + +Rectangle { + property int activePageCount: 0 + + //model is a list of {"name":"somename", "url":"file:///some/url/mainfile.qml"} + //function used to add to model A) to enforce scheme B) to allow Qt.resolveUrl in url assignments + + color: "#eee" + function addExample(name, desc, url) { + myModel.append({"name":name, "description":desc, "url":url}) + } + function showExample(url) { + pageComponent.createObject(pageContainer, { exampleUrl: url }).show() + } + + // The container rectangle here is used to give a nice "feel" when + // transitioning into an example. + Rectangle { + anchors.fill: parent + color: "black" + + ListView { + id: launcherList + clip: true + delegate: SimpleLauncherDelegate{ + onClicked: showExample(url) + } + model: ListModel {id:myModel} + anchors.fill: parent + enabled: opacity == 1.0 + } + } + + Item { + id: pageContainer + anchors.fill: parent + } + + Component { + id: pageComponent + Rectangle { + id: page + clip: true + property url exampleUrl + width: parent.width + height: parent.height - bar.height + color: "white" + MouseArea{ + //Eats mouse events + anchors.fill: parent + } + Loader{ + focus: true + source: parent.exampleUrl + anchors.fill: parent + } + + x: -width + + function show() { + showAnim.start() + } + + function exit() { + exitAnim.start() + } + + ParallelAnimation { + id: showAnim + ScriptAction { + script: activePageCount++ + } + NumberAnimation { + target: launcherList + property: "opacity" + from: 1.0 + to: 0.0 + duration: 500 + } + NumberAnimation { + target: launcherList + property: "scale" + from: 1.0 + to: 0.0 + duration: 500 + } + NumberAnimation { + target: page + property: "x" + from: -page.width + to: 0 + duration: 300 + } + } + SequentialAnimation { + id: exitAnim + + ScriptAction { + script: activePageCount-- + } + + ParallelAnimation { + NumberAnimation { + target: launcherList + property: "opacity" + from: 0.0 + to: 1.0 + duration: 300 + } + NumberAnimation { + target: launcherList + property: "scale" + from: 0.0 + to: 1.0 + duration: 300 + } + NumberAnimation { + target: page + property: "x" + from: 0 + to: -page.width + duration: 300 + } + } + + ScriptAction { + script: page.destroy() + } + } + } + } + Rectangle { + id: bar + visible: height > 0 + anchors.bottom: parent.bottom + width: parent.width + height: activePageCount > 0 ? 40 : 0 + + Behavior on height { + NumberAnimation { + duration: 300 + } + } + + Rectangle { + height: 1 + color: "#ccc" + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } + + Rectangle { + height: 1 + color: "#fff" + anchors.top: parent.top + anchors.topMargin: 1 + anchors.left: parent.left + anchors.right: parent.right + } + + gradient: Gradient { + GradientStop { position: 0 ; color: "#eee" } + GradientStop { position: 1 ; color: "#ccc" } + } + + Image { + id: back + source: "images/back.png" + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 2 + anchors.left: parent.left + anchors.leftMargin: 16 + + MouseArea { + id: mouse + hoverEnabled: true + anchors.centerIn: parent + width: 38 + height: 31 + anchors.verticalCenterOffset: -1 + enabled: activePageCount > 0 + onClicked: { + pageContainer.children[pageContainer.children.length - 1].exit() + } + Rectangle { + anchors.fill: parent + opacity: mouse.pressed ? 1 : 0 + Behavior on opacity { NumberAnimation{ duration: 100 }} + gradient: Gradient { + GradientStop { position: 0 ; color: "#22000000" } + GradientStop { position: 0.2 ; color: "#11000000" } + } + border.color: "darkgray" + antialiasing: true + radius: 4 + } + } + } + } +} diff --git a/examples/demos/shared/README b/examples/demos/shared/README new file mode 100644 index 000000000..2bf26d7c8 --- /dev/null +++ b/examples/demos/shared/README @@ -0,0 +1,11 @@ +These files are shared between multiple examples as a set of common and +reusuable components. While they do demonstrate the building of reusable +components in QML, they are not official examples themselves. +Consequently they do not have entries in the Qt documentation, and are +documented only through the code comments within the files. Developers +new to QML are strongly encouraged to go through the official examples +before delving into this directory. + +For most application use, see the Qt Quick Components project to find +ready-made Components you can use in your own projects. Qt Quick +examples do not use them only to avoid external dependencies. diff --git a/examples/demos/shared/SimpleLauncherDelegate.qml b/examples/demos/shared/SimpleLauncherDelegate.qml new file mode 100644 index 000000000..86a3b0dfd --- /dev/null +++ b/examples/demos/shared/SimpleLauncherDelegate.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +Rectangle { + id: container + property Item exampleItem + width: ListView.view.width + height: button.implicitHeight + 22 + + signal clicked() + + gradient: Gradient { + GradientStop { + position: 0 + Behavior on color {ColorAnimation { duration: 100 }} + color: button.pressed ? "#e0e0e0" : "#fff" + } + GradientStop { + position: 1 + Behavior on color {ColorAnimation { duration: 100 }} + color: button.pressed ? "#e0e0e0" : button.containsMouse ? "#f5f5f5" : "#eee" + } + } + + Image { + id: image + opacity: 0.7 + Behavior on opacity {NumberAnimation {duration: 100}} + source: "images/next.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 16 + } + + Item { + id: button + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.right:image.left + implicitHeight: col.height + height: implicitHeight + width: buttonLabel.width + 20 + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + hoverEnabled: true + } + + Column { + spacing: 2 + id: col + anchors.verticalCenter: parent.verticalCenter + width: parent.width + Text { + id: buttonLabel + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + text: name + color: "black" + font.pixelSize: 22 + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + styleColor: "white" + style: Text.Raised + + } + Text { + id: buttonLabel2 + anchors.left: parent.left + anchors.leftMargin: 10 + text: description + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + color: "#666" + font.pixelSize: 12 + } + } + } + + Rectangle { + height: 1 + color: "#ccc" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } +} diff --git a/examples/demos/shared/Slider.qml b/examples/demos/shared/Slider.qml new file mode 100644 index 000000000..28f92446d --- /dev/null +++ b/examples/demos/shared/Slider.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick 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: slider + height: 26 + width: 320 + + property real min: 0 + property real max: 1 + property real value: min + (max - min) * mousearea.value + property real init: min+(max-min)/2 + property string name: "Slider" + property color color: "#0066cc" + property real minLabelWidth: 44 + + Component.onCompleted: setValue(init) + function setValue(v) { + if (min < max) + handle.x = Math.round( v / (max - min) * + (mousearea.drag.maximumX - mousearea.drag.minimumX) + + mousearea.drag.minimumX); + } + Rectangle { + id:sliderName + anchors.left: parent.left + anchors.leftMargin: 16 + height: childrenRect.height + width: Math.max(minLabelWidth, childrenRect.width) + anchors.verticalCenter: parent.verticalCenter + Text { + text: slider.name + ":" + font.pointSize: 12 + color: "#333" + } + } + + Rectangle{ + id: foo + width: parent.width - 8 - sliderName.width + color: "#eee" + height: 7 + radius: 3 + antialiasing: true + border.color: Qt.darker(color, 1.2) + anchors.left: sliderName.right + anchors.right: parent.right + anchors.leftMargin: 10 + anchors.rightMargin: 24 + anchors.verticalCenter: parent.verticalCenter + + Rectangle { + height: parent.height + anchors.left: parent.left + anchors.right: handle.horizontalCenter + color: slider.color + radius: 3 + border.width: 1 + border.color: Qt.darker(color, 1.3) + opacity: 0.8 + } + Image { + id: handle + source: "images/slider_handle.png" + anchors.verticalCenter: parent.verticalCenter + MouseArea { + id: mousearea + anchors.fill: parent + anchors.margins: -4 + drag.target: parent + drag.axis: Drag.XAxis + drag.minimumX: Math.round(-handle.width / 2 + 3) + drag.maximumX: Math.round(foo.width - handle.width/2 - 3) + property real value: (handle.x - drag.minimumX) / (drag.maximumX - drag.minimumX) + } + } + } +} diff --git a/examples/demos/shared/TabSet.qml b/examples/demos/shared/TabSet.qml new file mode 100644 index 000000000..d66aa3363 --- /dev/null +++ b/examples/demos/shared/TabSet.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.Window 2.1 + +Item { + id: tabWidget + + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Property Binding" + // documentation for details on default properties. + default property alias content: stack.children + + property int current: 0 + + onCurrentChanged: setZOrders() + Component.onCompleted: setZOrders() + + function setZOrders() { + for (var i = 0; i < stack.children.length; ++i) { + stack.children[i].z = (i == current ? 1 : 0) + stack.children[i].enabled = (i == current) + } + } + + Row { + id: header + + Repeater { + model: stack.children.length + delegate: Rectangle { + width: tabWidget.width / stack.children.length + height: Math.max(Screen.pixelDensity * 7, label.implicitHeight * 1.2) + + Rectangle { + width: parent.width; height: 1 + anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" + } + BorderImage { + anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "images/tab.png" + visible: tabWidget.current == index + } + Text { + id: label + horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index + } + MouseArea { + anchors.fill: parent + onClicked: tabWidget.current = index + } + } + } + } + + Item { + id: stack + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom + } +} diff --git a/examples/demos/shared/TextField.qml b/examples/demos/shared/TextField.qml new file mode 100644 index 000000000..05e048011 --- /dev/null +++ b/examples/demos/shared/TextField.qml @@ -0,0 +1,90 @@ +/***************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick.Dialogs 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.1 + +Item { + id: root + + property alias textInput: textInput + property alias text: textInput.text + signal accepted + signal downPressed + implicitWidth: textInput.implicitWidth + rect.radius * 2 + implicitHeight: textInput.implicitHeight + + function copyAll() { + textInput.selectAll() + textInput.copy() + } + + SystemPalette { id: palette } + height: textInput.implicitHeight + 8 + clip: true + + Rectangle { + id: rect + anchors.fill: parent + radius: height / 4 + color: palette.button + border.color: Qt.darker(palette.button, 1.5) + } + + TextInput { + id: textInput + color: palette.text + anchors.fill: parent + anchors.leftMargin: rect.radius + anchors.rightMargin: rect.radius + verticalAlignment: Text.AlignVCenter + onAccepted: root.accepted() + Keys.onDownPressed: root.downPressed() + } +} diff --git a/examples/demos/shared/images/back.png b/examples/demos/shared/images/back.png Binary files differnew file mode 100644 index 000000000..53402096b --- /dev/null +++ b/examples/demos/shared/images/back.png diff --git a/examples/demos/shared/images/checkmark.png b/examples/demos/shared/images/checkmark.png Binary files differnew file mode 100644 index 000000000..821aafccd --- /dev/null +++ b/examples/demos/shared/images/checkmark.png diff --git a/examples/demos/shared/images/next.png b/examples/demos/shared/images/next.png Binary files differnew file mode 100644 index 000000000..cdef8db6e --- /dev/null +++ b/examples/demos/shared/images/next.png diff --git a/examples/demos/shared/images/qt-logo.png b/examples/demos/shared/images/qt-logo.png Binary files differnew file mode 100644 index 000000000..ecbff0ca3 --- /dev/null +++ b/examples/demos/shared/images/qt-logo.png diff --git a/examples/demos/shared/images/slider_handle.png b/examples/demos/shared/images/slider_handle.png Binary files differnew file mode 100644 index 000000000..63c518be7 --- /dev/null +++ b/examples/demos/shared/images/slider_handle.png diff --git a/examples/demos/shared/images/tab.png b/examples/demos/shared/images/tab.png Binary files differnew file mode 100644 index 000000000..2ea989b68 --- /dev/null +++ b/examples/demos/shared/images/tab.png diff --git a/examples/demos/shared/qmldir b/examples/demos/shared/qmldir new file mode 100644 index 000000000..b539191fe --- /dev/null +++ b/examples/demos/shared/qmldir @@ -0,0 +1,7 @@ +Button 2.0 Button.qml +CheckBox 2.1 CheckBox.qml +LauncherList 2.0 LauncherList.qml +SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml +Slider 2.0 Slider.qml +TabSet 2.1 TabSet.qml +TextField 2.1 TextField.qml diff --git a/examples/demos/shared/quick_shared.qrc b/examples/demos/shared/quick_shared.qrc new file mode 100644 index 000000000..21f393a64 --- /dev/null +++ b/examples/demos/shared/quick_shared.qrc @@ -0,0 +1,15 @@ +<RCC> + <qresource prefix="/quick/shared"> + <file>LauncherList.qml</file> + <file>SimpleLauncherDelegate.qml</file> + <file>Button.qml</file> + <file>CheckBox.qml</file> + <file>Label.qml</file> + <file>TextField.qml</file> + <file>images/back.png</file> + <file>images/next.png</file> + <file>images/checkmark.png</file> + <file>Slider.qml</file> + <file>images/slider_handle.png</file> + </qresource> +</RCC> diff --git a/examples/demos/shared/shared.h b/examples/demos/shared/shared.h new file mode 100644 index 000000000..18e7ff056 --- /dev/null +++ b/examples/demos/shared/shared.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 <QDir> +#include <QGuiApplication> +#include <QQmlEngine> +#include <QQmlFileSelector> +#include <QQuickView> //Not using QQmlApplicationEngine because many examples don't have a Window{} +#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \ +{\ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);\ + QGuiApplication app(argc,argv);\ + app.setOrganizationName("QtProject");\ + app.setOrganizationDomain("qt-project.org");\ + app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\ + QQuickView view;\ + if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\ + QSurfaceFormat f = view.format();\ + f.setProfile(QSurfaceFormat::CoreProfile);\ + f.setVersion(4, 4);\ + view.setFormat(f);\ + }\ + if (qgetenv("QT_QUICK_MULTISAMPLE").toInt()) {\ + QSurfaceFormat f = view.format();\ + f.setSamples(4);\ + view.setFormat(f);\ + }\ + view.connect(view.engine(), &QQmlEngine::quit, &app, &QCoreApplication::quit);\ + new QQmlFileSelector(view.engine(), &view);\ + view.setSource(QUrl("qrc:///" #NAME ".qml")); \ + if (view.status() == QQuickView::Error)\ + return -1;\ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ + view.show();\ + return app.exec();\ +} diff --git a/examples/demos/shared/shared.qrc b/examples/demos/shared/shared.qrc new file mode 100644 index 000000000..89b3ff757 --- /dev/null +++ b/examples/demos/shared/shared.qrc @@ -0,0 +1,18 @@ +<RCC> + <qresource prefix="/shared"> + <file>LauncherList.qml</file> + <file>SimpleLauncherDelegate.qml</file> + <file>Button.qml</file> + <file>Slider.qml</file> + <file>images/slider_handle.png</file> + <file>CheckBox.qml</file> + <file>Label.qml</file> + <file>TabSet.qml</file> + <file>TextField.qml</file> + <file>images/back.png</file> + <file>images/next.png</file> + <file>images/qt-logo.png</file> + <file>images/checkmark.png</file> + <file>images/tab.png</file> + </qresource> +</RCC> diff --git a/examples/demos/stocqt/content/+windows/Settings.qml b/examples/demos/stocqt/content/+windows/Settings.qml new file mode 100644 index 000000000..137ec546c --- /dev/null +++ b/examples/demos/stocqt/content/+windows/Settings.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +pragma Singleton +import QtQml 2.0 + +QtObject { + property string fontFamily: "Arial" +} diff --git a/examples/demos/stocqt/content/Banner.qml b/examples/demos/stocqt/content/Banner.qml new file mode 100644 index 000000000..bcba12204 --- /dev/null +++ b/examples/demos/stocqt/content/Banner.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/stocqt/content/Button.qml b/examples/demos/stocqt/content/Button.qml new file mode 100644 index 000000000..ed9b4ed49 --- /dev/null +++ b/examples/demos/stocqt/content/Button.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "." + +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/demos/stocqt/content/CheckBox.qml b/examples/demos/stocqt/content/CheckBox.qml new file mode 100644 index 000000000..9f9138963 --- /dev/null +++ b/examples/demos/stocqt/content/CheckBox.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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: 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/demos/stocqt/content/Settings.qml b/examples/demos/stocqt/content/Settings.qml new file mode 100644 index 000000000..9c7c59ed7 --- /dev/null +++ b/examples/demos/stocqt/content/Settings.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +pragma Singleton +import QtQml 2.0 + +QtObject { + property string fontFamily: "Open Sans" +} diff --git a/examples/demos/stocqt/content/StockChart.qml b/examples/demos/stocqt/content/StockChart.qml new file mode 100644 index 000000000..0af06a8d5 --- /dev/null +++ b/examples/demos/stocqt/content/StockChart.qml @@ -0,0 +1,400 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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(stockModel.newest); + if (chart.activeChart === "month") { + chart.startDate = new Date(stockModel.newest.getFullYear(), + stockModel.newest.getMonth() - 1, + stockModel.newest.getDate()); + gridSize = 4; + } + else if (chart.activeChart === "quarter") { + chart.startDate = new Date(stockModel.newest.getFullYear(), + stockModel.newest.getMonth() - 3, + stockModel.newest.getDate()); + gridSize = 3; + } + else if (chart.activeChart === "halfyear") { + chart.startDate = new Date(stockModel.newest.getFullYear(), + stockModel.newest.getMonth() - 6, + stockModel.newest.getDate()); + gridSize = 6; + } + else { + chart.startDate = new Date(stockModel.newest.getFullYear(), + stockModel.newest.getMonth(), + stockModel.newest.getDate() - 7); + gridSize = 0; + } + + 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: "3 Months" + buttonEnabled: chart.activeChart === "quarter" + onClicked: { + chart.activeChart = "quarter"; + chart.update(); + } + } + + Button { + id: halfYearlyButton + text: "6 Months" + buttonEnabled: chart.activeChart === "halfyear" + onClicked: { + chart.activeChart = "halfyear"; + 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/demos/stocqt/content/StockInfo.qml b/examples/demos/stocqt/content/StockInfo.qml new file mode 100644 index 000000000..e18f34e83 --- /dev/null +++ b/examples/demos/stocqt/content/StockInfo.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/stocqt/content/StockListDelegate.qml b/examples/demos/stocqt/content/StockListDelegate.qml new file mode 100644 index 000000000..8a4a8f692 --- /dev/null +++ b/examples/demos/stocqt/content/StockListDelegate.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/stocqt/content/StockListModel.qml b/examples/demos/stocqt/content/StockListModel.qml new file mode 100644 index 000000000..2f697f564 --- /dev/null +++ b/examples/demos/stocqt/content/StockListModel.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +ListModel { + id: stocks + + // pre-fetch data for all entries + Component.onCompleted: { + for (var idx = 0; idx < count; ++idx) { + getCloseValue(idx) + } + } + + function getCloseValue(index) { + + var endDate = new Date(); // today + var startDate = new Date(); + endDate.setDate(startDate.getDate() - 1); + startDate.setDate(endDate.getDate() - 7); + + var req = "data/" + get(index).stockId + ".csv" + + 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"} + + // Offline data downloaded using the url, https://www.quandl.com/api/v3/datasets/WIKI/<stockId>.csv. + ListElement {name: "Advanced Micro Devices Inc."; stockId: "AMD"; 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: "Apple Inc."; stockId: "AAPL"; 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: "Cisco Systems Inc."; stockId: "CSCO"; 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: "Intel Corp."; stockId: "INTC"; 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: "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: "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: "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: "Facebook Inc."; stockId: "FB"; value: "0.0"; change: "0.0"; changePercentage: "0.0"} +} + diff --git a/examples/demos/stocqt/content/StockListView.qml b/examples/demos/stocqt/content/StockListView.qml new file mode 100644 index 000000000..e30355c67 --- /dev/null +++ b/examples/demos/stocqt/content/StockListView.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "." + +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/demos/stocqt/content/StockModel.qml b/examples/demos/stocqt/content/StockModel.qml new file mode 100644 index 000000000..9e3a815c1 --- /dev/null +++ b/examples/demos/stocqt/content/StockModel.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +ListModel { + id: model + property string stockId: "" + property string stockName: "" + property var newest + property var oldest + 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; + + if (newest <= date) + date = new Date(newest.getYear(), + newest.getMonth(), + newest.getDate() - 7); + + 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 + 1; + } + if (currDiff > bestDiff) + return retval; + } + return -1; + } + + function createStockPrice(r) { + return { + "date": r[0], + "open":r[1], + "high":r[2], + "low":r[3], + "close":r[4], + "volume":r[5], + }; + } + + function updateStock() { + if (stockId === "") + return; + + var startDate = new Date(2011, 4, 25); + var endDate = new Date(); //today + + var req = "data/" + stockId + ".csv" + 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 >= 6) + model.append(createStockPrice(r)); + } + + if (xhr.readyState === XMLHttpRequest.DONE) { + if (model.count > 0) { + model.ready = true; + model.stockPrice = model.get(0).close; + model.stockPriceChanged = model.count > 1 ? (Math.round((model.stockPrice - model.get(1).close) * 100) / 100) : 0; + newest = new Date(model.get(0).date); + oldest = new Date(model.get(model.count - 1).date); + } 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/demos/stocqt/content/StockSettingsPanel.qml b/examples/demos/stocqt/content/StockSettingsPanel.qml new file mode 100644 index 000000000..48a77d849 --- /dev/null +++ b/examples/demos/stocqt/content/StockSettingsPanel.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.Layouts 1.1 +import "." + +Rectangle { + id: root + color: "transparent" + + property bool drawOpenPrice: false + property bool drawClosePrice: false + property bool drawHighPrice: true + property bool drawLowPrice: true + + 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 + onButtonEnabledChanged: drawOpenPrice = buttonEnabled + 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 + onButtonEnabledChanged: drawClosePrice = buttonEnabled + 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 + onButtonEnabledChanged: drawHighPrice = buttonEnabled + 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 + onButtonEnabledChanged: drawLowPrice = buttonEnabled + Layout.rightMargin: 10 + } + } +} diff --git a/examples/demos/stocqt/content/StockView.qml b/examples/demos/stocqt/content/StockView.qml new file mode 100644 index 000000000..f966f06b1 --- /dev/null +++ b/examples/demos/stocqt/content/StockView.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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.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/demos/stocqt/content/data/AAPL.csv b/examples/demos/stocqt/content/data/AAPL.csv new file mode 100644 index 000000000..de56baa19 --- /dev/null +++ b/examples/demos/stocqt/content/data/AAPL.csv @@ -0,0 +1,147 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,170.52,170.59,169.22,169.23,25643711.0,0.0,1.0,170.52,170.59,169.22,169.23,25643711.0 +2017-12-28,171.0,171.85,170.48,171.08,15997739.0,0.0,1.0,171.0,171.85,170.48,171.08,15997739.0 +2017-12-27,170.1,170.78,169.71,170.6,21672062.0,0.0,1.0,170.1,170.78,169.71,170.6,21672062.0 +2017-12-26,170.8,171.47,169.679,170.57,32968167.0,0.0,1.0,170.8,171.47,169.679,170.57,32968167.0 +2017-12-22,174.68,175.424,174.5,175.01,16052615.0,0.0,1.0,174.68,175.424,174.5,175.01,16052615.0 +2017-12-21,174.17,176.02,174.1,175.01,20356826.0,0.0,1.0,174.17,176.02,174.1,175.01,20356826.0 +2017-12-20,174.87,175.42,173.25,174.35,23000392.0,0.0,1.0,174.87,175.42,173.25,174.35,23000392.0 +2017-12-19,175.03,175.39,174.09,174.54,27078872.0,0.0,1.0,175.03,175.39,174.09,174.54,27078872.0 +2017-12-18,174.88,177.2,174.86,176.42,28831533.0,0.0,1.0,174.88,177.2,174.86,176.42,28831533.0 +2017-12-15,173.63,174.17,172.46,173.87,37054632.0,0.0,1.0,173.63,174.17,172.46,173.87,37054632.0 +2017-12-14,172.4,173.13,171.65,172.22,20219307.0,0.0,1.0,172.4,173.13,171.65,172.22,20219307.0 +2017-12-13,172.5,173.54,172.0,172.27,23142242.0,0.0,1.0,172.5,173.54,172.0,172.27,23142242.0 +2017-12-12,172.15,172.39,171.461,171.7,18945457.0,0.0,1.0,172.15,172.39,171.461,171.7,18945457.0 +2017-12-11,169.2,172.89,168.79,172.67,33092051.0,0.0,1.0,169.2,172.89,168.79,172.67,33092051.0 +2017-12-08,170.49,171.0,168.82,169.37,23096872.0,0.0,1.0,170.49,171.0,168.82,169.37,23096872.0 +2017-12-07,169.03,170.44,168.91,169.452,24469613.0,0.0,1.0,169.03,170.44,168.91,169.452,24469613.0 +2017-12-06,167.5,170.2047,166.46,169.01,28224357.0,0.0,1.0,167.5,170.2047,166.46,169.01,28224357.0 +2017-12-05,169.06,171.52,168.4,169.64,27008428.0,0.0,1.0,169.06,171.52,168.4,169.64,27008428.0 +2017-12-04,172.48,172.62,169.63,169.8,32115052.0,0.0,1.0,172.48,172.62,169.63,169.8,32115052.0 +2017-12-01,169.95,171.67,168.5,171.05,39590080.0,0.0,1.0,169.95,171.67,168.5,171.05,39590080.0 +2017-11-30,170.43,172.14,168.44,171.85,40172368.0,0.0,1.0,170.43,172.14,168.44,171.85,40172368.0 +2017-11-29,172.63,172.92,167.16,169.48,40788324.0,0.0,1.0,172.63,172.92,167.16,169.48,40788324.0 +2017-11-28,174.3,174.87,171.86,173.07,25468442.0,0.0,1.0,174.3,174.87,171.86,173.07,25468442.0 +2017-11-27,175.05,175.08,173.34,174.09,20536313.0,0.0,1.0,175.05,175.08,173.34,174.09,20536313.0 +2017-11-24,175.1,175.5,174.6459,174.97,14026519.0,0.0,1.0,175.1,175.5,174.6459,174.97,14026519.0 +2017-11-22,173.36,175.0,173.05,174.96,24997274.0,0.0,1.0,173.36,175.0,173.05,174.96,24997274.0 +2017-11-21,170.78,173.7,170.78,173.14,24875471.0,0.0,1.0,170.78,173.7,170.78,173.14,24875471.0 +2017-11-20,170.29,170.56,169.56,169.98,15974387.0,0.0,1.0,170.29,170.56,169.56,169.98,15974387.0 +2017-11-17,171.04,171.39,169.64,170.15,21665811.0,0.0,1.0,171.04,171.39,169.64,170.15,21665811.0 +2017-11-16,171.18,171.87,170.3,171.1,23497326.0,0.0,1.0,171.18,171.87,170.3,171.1,23497326.0 +2017-11-15,169.97,170.3197,168.38,169.08,28702351.0,0.0,1.0,169.97,170.3197,168.38,169.08,28702351.0 +2017-11-14,173.04,173.48,171.18,171.34,23588451.0,0.0,1.0,173.04,173.48,171.18,171.34,23588451.0 +2017-11-13,173.5,174.5,173.4,173.97,16828025.0,0.0,1.0,173.5,174.5,173.4,173.97,16828025.0 +2017-11-10,175.11,175.38,174.27,174.67,25061183.0,0.0,1.0,175.11,175.38,174.27,174.67,25061183.0 +2017-11-09,175.11,176.095,173.14,175.88,28636531.0,0.0,1.0,175.11,176.095,173.14,175.88,28636531.0 +2017-11-07,173.91,175.25,173.6,174.81,23910914.0,0.0,1.0,173.91,175.25,173.6,174.81,23910914.0 +2017-11-06,172.365,174.99,171.72,174.25,34242566.0,0.0,1.0,172.365,174.99,171.72,174.25,34242566.0 +2017-11-03,174.0,174.26,171.12,172.5,58683826.0,0.0,1.0,174.0,174.26,171.12,172.5,58683826.0 +2017-11-02,167.64,168.5,165.28,168.11,32710040.0,0.0,1.0,167.64,168.5,165.28,168.11,32710040.0 +2017-11-01,169.87,169.94,165.61,166.89,33100847.0,0.0,1.0,169.87,169.94,165.61,166.89,33100847.0 +2017-10-31,167.9,169.6499,166.94,169.04,35474672.0,0.0,1.0,167.9,169.6499,166.94,169.04,35474672.0 +2017-10-30,163.89,168.07,163.72,166.72,43923292.0,0.0,1.0,163.89,168.07,163.72,166.72,43923292.0 +2017-10-27,159.29,163.6,158.7,163.05,43904150.0,0.0,1.0,159.29,163.6,158.7,163.05,43904150.0 +2017-10-26,157.23,157.8295,156.78,157.41,16751691.0,0.0,1.0,157.23,157.8295,156.78,157.41,16751691.0 +2017-10-25,156.91,157.55,155.27,156.405,20126554.0,0.0,1.0,156.91,157.55,155.27,156.405,20126554.0 +2017-10-24,156.29,157.42,156.2,157.1,17137731.0,0.0,1.0,156.29,157.42,156.2,157.1,17137731.0 +2017-10-23,156.89,157.69,155.5,156.17,21654461.0,0.0,1.0,156.89,157.69,155.5,156.17,21654461.0 +2017-10-20,156.61,157.75,155.96,156.16,23612246.0,0.0,1.0,156.61,157.75,155.96,156.16,23612246.0 +2017-10-19,156.75,157.08,155.02,155.98,42111326.0,0.0,1.0,156.75,157.08,155.02,155.98,42111326.0 +2017-10-18,160.42,160.71,159.6,159.76,16158659.0,0.0,1.0,160.42,160.71,159.6,159.76,16158659.0 +2017-10-17,159.78,160.87,159.23,160.47,18816438.0,0.0,1.0,159.78,160.87,159.23,160.47,18816438.0 +2017-10-16,157.9,160.0,157.65,159.88,23894630.0,0.0,1.0,157.9,160.0,157.65,159.88,23894630.0 +2017-10-13,156.73,157.28,156.41,156.99,16287608.0,0.0,1.0,156.73,157.28,156.41,156.99,16287608.0 +2017-10-12,156.35,157.37,155.7299,156.0,16045720.0,0.0,1.0,156.35,157.37,155.7299,156.0,16045720.0 +2017-10-11,155.97,156.98,155.75,156.55,16607693.0,0.0,1.0,155.97,156.98,155.75,156.55,16607693.0 +2017-10-10,156.055,158.0,155.1,155.9,15456331.0,0.0,1.0,156.055,158.0,155.1,155.9,15456331.0 +2017-10-09,155.81,156.73,155.485,155.84,16200129.0,0.0,1.0,155.81,156.73,155.485,155.84,16200129.0 +2017-10-06,154.97,155.49,154.56,155.3,16423749.0,0.0,1.0,154.97,155.49,154.56,155.3,16423749.0 +2017-10-05,154.18,155.44,154.05,155.39,21032800.0,0.0,1.0,154.18,155.44,154.05,155.39,21032800.0 +2017-10-04,153.63,153.86,152.46,153.4508,19844177.0,0.0,1.0,153.63,153.86,152.46,153.4508,19844177.0 +2017-10-03,154.01,155.09,153.91,154.48,16146388.0,0.0,1.0,154.01,155.09,153.91,154.48,16146388.0 +2017-10-02,154.26,154.45,152.72,153.81,18524860.0,0.0,1.0,154.26,154.45,152.72,153.81,18524860.0 +2017-09-29,153.21,154.13,152.0,154.12,25856530.0,0.0,1.0,153.21,154.13,152.0,154.12,25856530.0 +2017-09-28,153.89,154.28,152.7,153.28,21896592.0,0.0,1.0,153.89,154.28,152.7,153.28,21896592.0 +2017-09-27,153.8,154.7189,153.54,154.23,24959552.0,0.0,1.0,153.8,154.7189,153.54,154.23,24959552.0 +2017-09-26,151.78,153.92,151.69,153.14,35470985.0,0.0,1.0,151.78,153.92,151.69,153.14,35470985.0 +2017-09-25,149.99,151.83,149.16,150.55,43922334.0,0.0,1.0,149.99,151.83,149.16,150.55,43922334.0 +2017-09-22,152.02,152.27,150.56,151.89,46114424.0,0.0,1.0,152.02,152.27,150.56,151.89,46114424.0 +2017-09-21,155.8,155.8,152.75,153.39,36643382.0,0.0,1.0,155.8,155.8,152.75,153.39,36643382.0 +2017-09-20,157.9,158.26,153.83,156.07,51693239.0,0.0,1.0,157.9,158.26,153.83,156.07,51693239.0 +2017-09-19,159.51,159.77,158.44,158.73,20347352.0,0.0,1.0,159.51,159.77,158.44,158.73,20347352.0 +2017-09-18,160.11,160.5,157.995,158.67,27939718.0,0.0,1.0,160.11,160.5,157.995,158.67,27939718.0 +2017-09-15,158.47,160.97,158.0,159.88,48203642.0,0.0,1.0,158.47,160.97,158.0,159.88,48203642.0 +2017-09-14,158.99,159.4,158.09,158.28,23073646.0,0.0,1.0,158.99,159.4,158.09,158.28,23073646.0 +2017-09-13,159.87,159.96,157.91,159.65,44393752.0,0.0,1.0,159.87,159.96,157.91,159.65,44393752.0 +2017-09-12,162.61,163.96,158.77,160.82,71139119.0,0.0,1.0,162.61,163.96,158.77,160.82,71139119.0 +2017-09-11,160.5,162.05,159.89,161.5,31028926.0,0.0,1.0,160.5,162.05,159.89,161.5,31028926.0 +2017-09-08,160.86,161.15,158.53,158.63,28183159.0,0.0,1.0,160.86,161.15,158.53,158.63,28183159.0 +2017-09-07,162.09,162.24,160.36,161.26,21722995.0,0.0,1.0,162.09,162.24,160.36,161.26,21722995.0 +2017-09-06,162.71,162.99,160.52,161.91,21179047.0,0.0,1.0,162.71,162.99,160.52,161.91,21179047.0 +2017-09-05,163.75,164.25,160.56,162.08,29317054.0,0.0,1.0,163.75,164.25,160.56,162.08,29317054.0 +2017-09-01,164.8,164.94,163.63,164.05,16508568.0,0.0,1.0,164.8,164.94,163.63,164.05,16508568.0 +2017-08-31,163.64,164.52,163.48,164.0,26412439.0,0.0,1.0,163.64,164.52,163.48,164.0,26412439.0 +2017-08-30,163.8,163.89,162.61,163.35,26973946.0,0.0,1.0,163.8,163.89,162.61,163.35,26973946.0 +2017-08-29,160.1,163.12,160.0,162.91,29307862.0,0.0,1.0,160.1,163.12,160.0,162.91,29307862.0 +2017-08-28,160.14,162.0,159.93,161.47,25279674.0,0.0,1.0,160.14,162.0,159.93,161.47,25279674.0 +2017-08-25,159.65,160.56,159.27,159.86,25015218.0,0.0,1.0,159.65,160.56,159.27,159.86,25015218.0 +2017-08-24,160.43,160.74,158.55,159.27,19029621.0,0.0,1.0,160.43,160.74,158.55,159.27,19029621.0 +2017-08-23,159.07,160.47,158.88,159.98,19198189.0,0.0,1.0,159.07,160.47,158.88,159.98,19198189.0 +2017-08-22,158.23,160.0,158.02,159.78,21297812.0,0.0,1.0,158.23,160.0,158.02,159.78,21297812.0 +2017-08-21,157.5,157.89,155.1101,157.21,26145653.0,0.0,1.0,157.5,157.89,155.1101,157.21,26145653.0 +2017-08-18,157.86,159.5,156.72,157.5,27012525.0,0.0,1.0,157.86,159.5,156.72,157.5,27012525.0 +2017-08-17,160.52,160.71,157.84,157.87,26925694.0,0.0,1.0,160.52,160.71,157.84,157.87,26925694.0 +2017-08-16,161.94,162.51,160.15,160.95,27321761.0,0.0,1.0,161.94,162.51,160.15,160.95,27321761.0 +2017-08-15,160.66,162.195,160.14,161.6,27936774.0,0.0,1.0,160.66,162.195,160.14,161.6,27936774.0 +2017-08-14,159.32,160.21,158.75,159.85,21754810.0,0.0,1.0,159.32,160.21,158.75,159.85,21754810.0 +2017-08-11,156.6,158.5728,156.07,157.48,25943187.0,0.0,1.0,156.6,158.5728,156.07,157.48,25943187.0 +2017-08-10,159.9,160.0,154.63,155.27,39081017.0,0.63,1.0,159.9,160.0,154.63,155.27,39081017.0 +2017-08-09,159.26,161.27,159.11,161.06,25640394.0,0.0,1.0,158.61642206543,160.61829955099,158.46702822322,160.40914817191,25640394.0 +2017-08-08,158.6,161.83,158.27,160.08,35775675.0,0.0,1.0,157.95908915972,161.1760365619,157.63042270686,159.43310840282,35775675.0 +2017-08-04,156.07,157.4,155.69,156.39,20349532.0,0.0,1.0,155.43931302117,156.76393842207,155.06084862091,155.75801988454,20349532.0 +2017-08-03,157.05,157.21,155.02,155.57,26000738.0,0.0,1.0,156.41535279025,156.57470622194,154.39355612572,154.94133354715,26000738.0 +2017-08-02,159.28,159.75,156.16,157.14,69222793.0,0.0,1.0,158.63634124439,159.10444194997,155.52894932649,156.50498909557,69222793.0 +2017-08-01,149.1,150.22,148.41,150.05,24725526.0,0.0,1.0,148.4974791533,149.61295317511,147.81026747915,149.44364015394,24725526.0 +2017-07-31,149.9,150.33,148.13,148.85,19422655.0,0.0,1.0,149.29424631174,149.7225086594,147.5313989737,148.24848941629,19422655.0 +2017-07-28,149.89,150.23,149.19,149.5,16832947.0,0.0,1.0,149.28428672226,149.62291276459,148.58711545863,148.89586273252,16832947.0 +2017-07-27,153.75,153.99,147.3,150.56,32175875.0,0.0,1.0,153.12868826171,153.36771840924,146.70475304682,149.95157921745,32175875.0 +2017-07-26,153.35,153.93,153.06,153.46,15172136.0,0.0,1.0,152.73030468249,153.30796087235,152.44147658756,152.83986016677,15172136.0 +2017-07-25,151.8,153.84,151.8,152.74,18612649.0,0.0,1.0,151.18656831302,153.21832456703,151.18656831302,152.12276972418,18612649.0 +2017-07-24,150.58,152.44,149.9,152.09,21122730.0,0.0,1.0,149.97149839641,151.82398203977,149.29424631174,151.47539640795,21122730.0 +2017-07-21,149.99,150.44,148.88,150.27,24671002.0,0.0,1.0,149.38388261706,149.83206414368,148.27836818473,149.66275112251,24671002.0 +2017-07-20,151.5,151.74,150.19,150.34,17053326.0,0.0,1.0,150.88778062861,151.12681077614,149.58307440667,149.73246824888,17053326.0 +2017-07-19,150.48,151.42,149.95,151.02,20615419.0,0.0,1.0,149.8719025016,150.80810391276,149.34404425914,150.40972033355,20615419.0 +2017-07-18,149.2,150.13,148.67,150.08,17713795.0,0.0,1.0,148.59707504811,149.52331686979,148.06921680564,149.47351892239,17713795.0 +2017-07-17,148.82,150.9,148.57,149.56,23243713.0,0.0,1.0,148.21861064785,150.29020525978,147.96962091084,148.9556202694,23243713.0 +2017-07-14,147.97,149.33,147.33,149.04,19961788.0,0.0,1.0,147.37204554201,148.72654971135,146.73463181527,148.43772161642,19961788.0 +2017-07-13,145.5,148.49,145.44,147.77,24922788.0,0.0,1.0,144.91202694035,147.889944195,144.85226940346,147.17285375241,24922788.0 +2017-07-12,145.87,146.18,144.82,145.74,23617964.0,0.0,1.0,145.28053175112,145.58927902502,144.23477485568,145.15105708788,23617964.0 +2017-07-11,144.73,145.85,144.38,145.53,18311156.0,0.0,1.0,144.14513855035,145.26061257216,143.79655291854,144.94190570879,18311156.0 +2017-07-10,144.11,145.95,143.37,145.06,21030466.0,0.0,1.0,143.52764400257,145.36020846697,142.79063438101,144.47380500321,21030466.0 +2017-07-07,142.9,144.75,142.9,144.18,18505351.0,0.0,1.0,142.32253367543,144.16505772931,142.32253367543,143.59736112893,18505351.0 +2017-07-06,143.02,143.5,142.41,142.73,23374374.0,0.0,1.0,142.4420487492,142.92010904426,141.83451379089,142.15322065427,23374374.0 +2017-07-05,143.69,144.79,142.7237,144.09,20758795.0,0.0,1.0,143.10934124439,144.20489608724,142.14694611289,143.5077248236,20758795.0 +2017-07-03,144.88,145.3001,143.1,143.5,14276812.0,0.0,1.0,144.29453239256,144.71293474663,142.52172546504,142.92010904426,14276812.0 +2017-06-30,144.45,144.96,143.78,144.02,22328979.0,0.0,1.0,143.8662700449,144.3742091084,143.19897754971,143.43800769724,22328979.0 +2017-06-29,144.71,145.13,142.28,143.68,31116980.0,0.0,1.0,144.12521937139,144.54352212957,141.70503912765,143.09938165491,31116980.0 +2017-06-28,144.49,146.11,143.1601,145.83,21915939.0,0.0,1.0,143.90610840282,145.51956189865,142.58158259782,145.2406933932,21915939.0 +2017-06-27,145.01,146.16,143.62,143.74,24423643.0,0.0,1.0,144.4240070558,145.56935984606,143.03962411802,143.15913919179,24423643.0 +2017-06-26,147.17,148.28,145.38,145.82,25524661.0,0.0,1.0,146.57527838358,147.68079281591,144.79251186658,145.23073380372,25524661.0 +2017-06-23,145.13,147.16,145.11,146.35,25997976.0,0.0,1.0,144.54352212957,146.5653187941,144.52360295061,145.75859204618,25997976.0 +2017-06-22,145.77,146.7,145.1199,145.63,18673365.0,0.0,1.0,145.18093585632,146.107177678,144.5334629442,145.04150160359,18673365.0 +2017-06-21,145.52,146.0693,144.61,145.87,21064679.0,0.0,1.0,144.93194611931,145.47902636947,144.02562347659,145.28053175112,21064679.0 +2017-06-20,146.87,146.87,144.94,145.01,24572170.0,0.0,1.0,146.27649069917,146.27649069917,144.35428992944,144.4240070558,24572170.0 +2017-06-19,143.66,146.74,143.66,146.34,31449132.0,0.0,1.0,143.07946247595,146.14701603592,143.07946247595,145.7486324567,31449132.0 +2017-06-16,143.78,144.5,142.2,142.27,49180748.0,0.0,1.0,143.19897754971,143.9160679923,141.6253624118,141.69507953817,49180748.0 +2017-06-15,143.32,144.4798,142.21,144.29,31348832.0,0.0,1.0,142.74083643361,143.89594962155,141.63532200128,143.70691661321,31348832.0 +2017-06-14,147.5,147.5,143.84,145.16,31224203.0,0.0,1.0,146.90394483643,146.90394483643,143.25873508659,144.57340089801,31224203.0 +2017-06-13,147.16,147.45,145.15,146.59,33749154.0,0.0,1.0,146.5653187941,146.85414688903,144.56344130853,145.99762219371,33749154.0 +2017-06-12,145.74,146.09,142.51,145.32,71563614.0,0.0,1.0,145.15105708788,145.49964271969,141.9341096857,144.7327543297,71563614.0 +2017-06-09,155.19,155.19,146.02,148.98,64176149.0,0.0,1.0,154.56286914689,154.56286914689,145.42992559333,148.37796407954,64176149.0 +2017-06-08,155.25,155.54,154.4,154.99,20771367.0,0.0,1.0,154.62262668377,154.9114547787,153.77606157793,154.36367735728,20771367.0 +2017-06-07,155.02,155.98,154.48,155.37,20678772.0,0.0,1.0,154.39355612572,155.34967671584,153.85573829378,154.74214175754,20678772.0 +2017-06-06,153.9,155.81,153.78,154.45,26249630.0,0.0,1.0,153.27808210391,155.18036369468,153.15856703015,153.82585952534,26249630.0 +2017-06-05,154.34,154.45,153.46,153.93,24803858.0,0.0,1.0,153.71630404105,153.82585952534,152.83986016677,153.30796087235,24803858.0 +2017-06-02,153.58,155.45,152.89,155.45,27285861.0,0.0,1.0,152.95937524054,154.82181847338,152.27216356639,154.82181847338,27285861.0 +2017-06-01,153.17,153.33,152.22,153.18,16180143.0,0.0,1.0,152.55103207184,152.71038550353,151.6048710712,152.56099166132,16180143.0 diff --git a/examples/demos/stocqt/content/data/ADSK.csv b/examples/demos/stocqt/content/data/ADSK.csv new file mode 100644 index 000000000..704fa3f32 --- /dev/null +++ b/examples/demos/stocqt/content/data/ADSK.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,105.04,105.65,104.5301,104.83,1042328.0,0.0,1.0,105.04,105.65,104.5301,104.83,1042328.0 +2017-12-28,104.66,105.22,104.2,105.07,860725.0,0.0,1.0,104.66,105.22,104.2,105.07,860725.0 +2017-12-27,103.97,105.199,103.48,104.58,959904.0,0.0,1.0,103.97,105.199,103.48,104.58,959904.0 +2017-12-26,103.45,104.15,103.19,103.8,1307823.0,0.0,1.0,103.45,104.15,103.19,103.8,1307823.0 +2017-12-22,104.85,104.85,103.78,103.89,1411598.0,0.0,1.0,104.85,104.85,103.78,103.89,1411598.0 +2017-12-21,105.58,105.6699,103.65,104.43,3901415.0,0.0,1.0,105.58,105.6699,103.65,104.43,3901415.0 +2017-12-20,106.02,106.02,104.19,105.03,2502489.0,0.0,1.0,106.02,106.02,104.19,105.03,2502489.0 +2017-12-19,107.24,107.84,105.37,105.39,1807167.0,0.0,1.0,107.24,107.84,105.37,105.39,1807167.0 +2017-12-18,108.66,109.43,107.28,107.48,2305840.0,0.0,1.0,108.66,109.43,107.28,107.48,2305840.0 +2017-12-15,106.55,108.93,106.47,108.4,2434779.0,0.0,1.0,106.55,108.93,106.47,108.4,2434779.0 +2017-12-14,105.95,107.12,105.95,106.25,1479116.0,0.0,1.0,105.95,107.12,105.95,106.25,1479116.0 +2017-12-13,107.03,107.89,105.51,106.02,1924569.0,0.0,1.0,107.03,107.89,105.51,106.02,1924569.0 +2017-12-12,106.32,107.98,105.58,106.33,1987461.0,0.0,1.0,106.32,107.98,105.58,106.33,1987461.0 +2017-12-11,106.87,107.95,106.15,106.83,2270028.0,0.0,1.0,106.87,107.95,106.15,106.83,2270028.0 +2017-12-08,109.6,110.17,106.69,107.16,3094512.0,0.0,1.0,109.6,110.17,106.69,107.16,3094512.0 +2017-12-07,106.2,110.18,106.0,109.61,3028608.0,0.0,1.0,106.2,110.18,106.0,109.61,3028608.0 +2017-12-06,105.73,107.83,105.73,106.92,1678616.0,0.0,1.0,105.73,107.83,105.73,106.92,1678616.0 +2017-12-05,107.91,109.49,106.55,106.59,2983741.0,0.0,1.0,107.91,109.49,106.55,106.59,2983741.0 +2017-12-04,108.0,108.69,105.16,107.95,3940444.0,0.0,1.0,108.0,108.69,105.16,107.95,3940444.0 +2017-12-01,108.81,110.12,106.29,107.06,4905374.0,0.0,1.0,108.81,110.12,106.29,107.06,4905374.0 +2017-11-30,109.64,111.579,106.54,109.7,8408815.0,0.0,1.0,109.64,111.579,106.54,109.7,8408815.0 +2017-11-29,114.03,114.46,106.2,109.34,19333560.0,0.0,1.0,114.03,114.46,106.2,109.34,19333560.0 +2017-11-28,130.76,131.1,127.49,129.95,3683510.0,0.0,1.0,130.76,131.1,127.49,129.95,3683510.0 +2017-11-27,130.19,130.92,129.26,130.24,2248835.0,0.0,1.0,130.19,130.92,129.26,130.24,2248835.0 +2017-11-24,127.74,129.54,127.65,129.5,1013550.0,0.0,1.0,127.74,129.54,127.65,129.5,1013550.0 +2017-11-22,128.01,128.685,126.835,127.77,1467080.0,0.0,1.0,128.01,128.685,126.835,127.77,1467080.0 +2017-11-21,127.13,128.17,126.97,127.71,1567056.0,0.0,1.0,127.13,128.17,126.97,127.71,1567056.0 +2017-11-20,127.51,128.28,126.11,126.28,1711322.0,0.0,1.0,127.51,128.28,126.11,126.28,1711322.0 +2017-11-17,127.49,127.92,125.87,127.49,1458953.0,0.0,1.0,127.49,127.92,125.87,127.49,1458953.0 +2017-11-16,124.79,127.0,124.64,127.0,1525137.0,0.0,1.0,124.79,127.0,124.64,127.0,1525137.0 +2017-11-15,123.87,125.01,122.44,124.02,1439532.0,0.0,1.0,123.87,125.01,122.44,124.02,1439532.0 +2017-11-14,124.4,124.82,123.16,123.87,1221703.0,0.0,1.0,124.4,124.82,123.16,123.87,1221703.0 +2017-11-13,124.34,125.02,122.685,124.64,1132264.0,0.0,1.0,124.34,125.02,122.685,124.64,1132264.0 +2017-11-10,121.95,123.32,121.31,123.11,929375.0,0.0,1.0,121.95,123.32,121.31,123.11,929375.0 +2017-11-09,122.9,123.09,120.01,122.4,1455225.0,0.0,1.0,122.9,123.09,120.01,122.4,1455225.0 +2017-11-07,124.26,124.54,122.61,123.4,803631.0,0.0,1.0,124.26,124.54,122.61,123.4,803631.0 +2017-11-06,125.0,125.09,123.19,123.82,994672.0,0.0,1.0,125.0,125.09,123.19,123.82,994672.0 +2017-11-03,124.5,125.5,124.1101,124.85,1308745.0,0.0,1.0,124.5,125.5,124.1101,124.85,1308745.0 +2017-11-02,125.5,125.65,123.51,124.72,1732421.0,0.0,1.0,125.5,125.65,123.51,124.72,1732421.0 +2017-11-01,125.63,126.44,123.4,124.78,1612432.0,0.0,1.0,125.63,126.44,123.4,124.78,1612432.0 +2017-10-31,124.28,125.01,123.42,124.96,1836559.0,0.0,1.0,124.28,125.01,123.42,124.96,1836559.0 +2017-10-30,123.04,124.28,121.9,123.91,1606533.0,0.0,1.0,123.04,124.28,121.9,123.91,1606533.0 +2017-10-27,121.61,123.97,121.4,123.58,1503302.0,0.0,1.0,121.61,123.97,121.4,123.58,1503302.0 +2017-10-26,120.21,121.95,119.46,121.35,893806.0,0.0,1.0,120.21,121.95,119.46,121.35,893806.0 +2017-10-25,119.0,120.25,118.05,119.94,1064033.0,0.0,1.0,119.0,120.25,118.05,119.94,1064033.0 +2017-10-24,118.96,119.61,117.9,119.29,1306666.0,0.0,1.0,118.96,119.61,117.9,119.29,1306666.0 +2017-10-23,120.99,121.72,118.73,118.99,1484003.0,0.0,1.0,120.99,121.72,118.73,118.99,1484003.0 +2017-10-20,119.98,121.88,119.7,120.81,1570159.0,0.0,1.0,119.98,121.88,119.7,120.81,1570159.0 +2017-10-19,119.0,119.32,117.57,119.29,1087574.0,0.0,1.0,119.0,119.32,117.57,119.29,1087574.0 +2017-10-18,118.5,118.86,117.7834,118.54,998575.0,0.0,1.0,118.5,118.86,117.7834,118.54,998575.0 +2017-10-17,119.35,119.7599,118.06,118.72,1179973.0,0.0,1.0,119.35,119.7599,118.06,118.72,1179973.0 +2017-10-16,119.69,119.97,118.67,119.2,1176704.0,0.0,1.0,119.69,119.97,118.67,119.2,1176704.0 +2017-10-13,119.77,119.77,118.4498,119.63,1226925.0,0.0,1.0,119.77,119.77,118.4498,119.63,1226925.0 +2017-10-12,118.55,119.84,118.51,118.99,1226381.0,0.0,1.0,118.55,119.84,118.51,118.99,1226381.0 +2017-10-11,117.02,118.66,116.93,118.57,1072510.0,0.0,1.0,117.02,118.66,116.93,118.57,1072510.0 +2017-10-10,117.22,117.53,116.32,117.05,916721.0,0.0,1.0,117.22,117.53,116.32,117.05,916721.0 +2017-10-09,116.8,117.52,116.64,117.14,847005.0,0.0,1.0,116.8,117.52,116.64,117.14,847005.0 +2017-10-06,116.18,117.61,115.81,116.96,1718039.0,0.0,1.0,116.18,117.61,115.81,116.96,1718039.0 +2017-10-05,114.5,116.83,113.9,116.54,1578348.0,0.0,1.0,114.5,116.83,113.9,116.54,1578348.0 +2017-10-04,113.79,114.07,112.35,114.05,1120483.0,0.0,1.0,113.79,114.07,112.35,114.05,1120483.0 +2017-10-03,112.39,113.73,111.67,113.63,1039855.0,0.0,1.0,112.39,113.73,111.67,113.63,1039855.0 +2017-10-02,110.6915,113.76,110.68,112.47,1957433.0,0.0,1.0,110.6915,113.76,110.68,112.47,1957433.0 +2017-09-29,111.25,112.76,111.0,112.26,2013739.0,0.0,1.0,111.25,112.76,111.0,112.26,2013739.0 +2017-09-28,111.4,111.96,110.52,111.45,1335191.0,0.0,1.0,111.4,111.96,110.52,111.45,1335191.0 +2017-09-27,110.21,113.47,110.21,111.96,1717796.0,0.0,1.0,110.21,113.47,110.21,111.96,1717796.0 +2017-09-26,110.59,111.38,108.83,110.61,1579054.0,0.0,1.0,110.59,111.38,108.83,110.61,1579054.0 +2017-09-25,111.67,111.83,108.65,109.82,2015979.0,0.0,1.0,111.67,111.83,108.65,109.82,2015979.0 +2017-09-22,111.68,112.82,111.64,111.78,944731.0,0.0,1.0,111.68,112.82,111.64,111.78,944731.0 +2017-09-21,112.82,113.0,111.37,112.29,1148893.0,0.0,1.0,112.82,113.0,111.37,112.29,1148893.0 +2017-09-20,113.07,113.339,111.35,112.73,1686485.0,0.0,1.0,113.07,113.339,111.35,112.73,1686485.0 +2017-09-19,113.77,114.06,112.97,113.08,1945388.0,0.0,1.0,113.77,114.06,112.97,113.08,1945388.0 +2017-09-18,113.74,114.66,112.87,113.84,2020868.0,0.0,1.0,113.74,114.66,112.87,113.84,2020868.0 +2017-09-15,115.62,115.62,113.88,114.3,6185403.0,0.0,1.0,115.62,115.62,113.88,114.3,6185403.0 +2017-09-14,115.62,116.14,114.5,115.48,1625113.0,0.0,1.0,115.62,116.14,114.5,115.48,1625113.0 +2017-09-13,116.04,116.5,115.25,116.18,1269826.0,0.0,1.0,116.04,116.5,115.25,116.18,1269826.0 +2017-09-12,116.35,116.99,114.98,116.16,1523756.0,0.0,1.0,116.35,116.99,114.98,116.16,1523756.0 +2017-09-11,112.98,117.125,112.22,116.48,2279670.0,0.0,1.0,112.98,117.125,112.22,116.48,2279670.0 +2017-09-08,114.17,115.72,114.1,114.44,2650236.0,0.0,1.0,114.17,115.72,114.1,114.44,2650236.0 +2017-09-07,114.14,114.465,113.19,114.05,1705693.0,0.0,1.0,114.14,114.465,113.19,114.05,1705693.0 +2017-09-06,114.4,114.78,112.65,113.79,2328344.0,0.0,1.0,114.4,114.78,112.65,113.79,2328344.0 +2017-09-05,113.46,114.81,112.52,113.77,3089055.0,0.0,1.0,113.46,114.81,112.52,113.77,3089055.0 +2017-09-01,114.63,115.62,113.65,113.71,1521113.0,0.0,1.0,114.63,115.62,113.65,113.71,1521113.0 +2017-08-31,113.63,114.7,112.815,114.46,1442442.0,0.0,1.0,113.63,114.7,112.815,114.46,1442442.0 +2017-08-30,111.27,113.67,110.61,113.29,1439951.0,0.0,1.0,111.27,113.67,110.61,113.29,1439951.0 +2017-08-29,109.65,111.895,109.25,111.27,1798166.0,0.0,1.0,109.65,111.895,109.25,111.27,1798166.0 +2017-08-28,115.06,115.14,110.01,111.48,3591870.0,0.0,1.0,115.06,115.14,110.01,111.48,3591870.0 +2017-08-25,115.0,119.73,113.54,114.97,7085626.0,0.0,1.0,115.0,119.73,113.54,114.97,7085626.0 +2017-08-24,110.58,111.25,109.04,110.61,2948237.0,0.0,1.0,110.58,111.25,109.04,110.61,2948237.0 +2017-08-23,110.91,111.34,110.05,110.65,1631213.0,0.0,1.0,110.91,111.34,110.05,110.65,1631213.0 +2017-08-22,110.31,112.235,109.77,111.01,1705576.0,0.0,1.0,110.31,112.235,109.77,111.01,1705576.0 +2017-08-21,108.37,110.3,108.37,109.75,1265606.0,0.0,1.0,108.37,110.3,108.37,109.75,1265606.0 +2017-08-18,107.86,110.1,107.19,108.56,1145061.0,0.0,1.0,107.86,110.1,107.19,108.56,1145061.0 +2017-08-17,110.07,110.82,107.73,107.89,1715092.0,0.0,1.0,110.07,110.82,107.73,107.89,1715092.0 +2017-08-16,110.36,110.93,109.36,110.49,1312081.0,0.0,1.0,110.36,110.93,109.36,110.49,1312081.0 +2017-08-15,109.02,110.1,108.12,109.8,1258345.0,0.0,1.0,109.02,110.1,108.12,109.8,1258345.0 +2017-08-14,109.2,110.0,108.01,108.9,1634486.0,0.0,1.0,109.2,110.0,108.01,108.9,1634486.0 +2017-08-11,105.75,108.7577,105.1,108.01,1422869.0,0.0,1.0,105.75,108.7577,105.1,108.01,1422869.0 +2017-08-10,106.56,107.54,104.77,104.98,1842203.0,0.0,1.0,106.56,107.54,104.77,104.98,1842203.0 +2017-08-09,107.69,107.96,106.54,107.45,1115478.0,0.0,1.0,107.69,107.96,106.54,107.45,1115478.0 +2017-08-08,109.38,110.27,108.0,108.35,1080202.0,0.0,1.0,109.38,110.27,108.0,108.35,1080202.0 +2017-08-07,108.67,111.0,108.4,109.82,1491115.0,0.0,1.0,108.67,111.0,108.4,109.82,1491115.0 +2017-08-04,108.35,109.04,107.56,108.39,1481357.0,0.0,1.0,108.35,109.04,107.56,108.39,1481357.0 +2017-08-03,107.95,108.5,105.6,107.88,2249989.0,0.0,1.0,107.95,108.5,105.6,107.88,2249989.0 +2017-08-02,111.08,111.38,107.28,109.13,1756009.0,0.0,1.0,111.08,111.38,107.28,109.13,1756009.0 +2017-08-01,111.27,112.59,111.1,111.38,1304376.0,0.0,1.0,111.27,112.59,111.1,111.38,1304376.0 +2017-07-31,111.65,112.315,109.78,110.79,1356552.0,0.0,1.0,111.65,112.315,109.78,110.79,1356552.0 +2017-07-28,110.6,112.2754,110.3326,111.5,939043.0,0.0,1.0,110.6,112.2754,110.3326,111.5,939043.0 +2017-07-27,114.97,115.25,109.32,111.52,2357620.0,0.0,1.0,114.97,115.25,109.32,111.52,2357620.0 +2017-07-26,112.5,114.1,112.41,114.08,1882057.0,0.0,1.0,112.5,114.1,112.41,114.08,1882057.0 +2017-07-25,110.91,112.4,110.2,112.26,1337115.0,0.0,1.0,110.91,112.4,110.2,112.26,1337115.0 +2017-07-24,109.59,110.89,109.335,110.81,1050047.0,0.0,1.0,109.59,110.89,109.335,110.81,1050047.0 +2017-07-21,109.41,110.54,109.08,109.75,1100700.0,0.0,1.0,109.41,110.54,109.08,109.75,1100700.0 +2017-07-20,109.72,110.5,108.88,109.91,1259425.0,0.0,1.0,109.72,110.5,108.88,109.91,1259425.0 +2017-07-19,108.5,110.5,108.47,110.25,2034611.0,0.0,1.0,108.5,110.5,108.47,110.25,2034611.0 +2017-07-18,106.67,107.85,106.23,107.7,862647.0,0.0,1.0,106.67,107.85,106.23,107.7,862647.0 +2017-07-17,108.9,109.0,106.56,106.94,1175554.0,0.0,1.0,108.9,109.0,106.56,106.94,1175554.0 +2017-07-14,107.46,108.91,107.01,108.74,1479526.0,0.0,1.0,107.46,108.91,107.01,108.74,1479526.0 +2017-07-13,107.49,108.5,106.38,107.07,1411266.0,0.0,1.0,107.49,108.5,106.38,107.07,1411266.0 +2017-07-12,105.61,107.08,104.76,106.68,2612888.0,0.0,1.0,105.61,107.08,104.76,106.68,2612888.0 +2017-07-11,103.47,104.73,102.98,104.3,1450669.0,0.0,1.0,103.47,104.73,102.98,104.3,1450669.0 +2017-07-10,103.33,104.185,102.38,103.74,1191783.0,0.0,1.0,103.33,104.185,102.38,103.74,1191783.0 +2017-07-07,102.29,104.28,102.29,103.32,1666452.0,0.0,1.0,102.29,104.28,102.29,103.32,1666452.0 +2017-07-06,101.59,103.11,100.794,102.05,2593456.0,0.0,1.0,101.59,103.11,100.794,102.05,2593456.0 +2017-07-05,99.37,103.04,99.22,102.6,2759895.0,0.0,1.0,99.37,103.04,99.22,102.6,2759895.0 +2017-07-03,101.32,101.82,99.32,99.36,1454229.0,0.0,1.0,101.32,101.82,99.32,99.36,1454229.0 +2017-06-30,102.32,102.37,100.75,100.82,1659031.0,0.0,1.0,102.32,102.37,100.75,100.82,1659031.0 +2017-06-29,103.57,103.8105,100.0,101.39,2333399.0,0.0,1.0,103.57,103.8105,100.0,101.39,2333399.0 +2017-06-28,103.69,104.86,101.54,104.28,1640245.0,0.0,1.0,103.69,104.86,101.54,104.28,1640245.0 +2017-06-27,105.58,106.45,102.5,102.92,2215375.0,0.0,1.0,105.58,106.45,102.5,102.92,2215375.0 +2017-06-26,107.76,109.07,105.31,106.12,1870235.0,0.0,1.0,107.76,109.07,105.31,106.12,1870235.0 +2017-06-23,106.4,108.76,105.3,107.71,3598155.0,0.0,1.0,106.4,108.76,105.3,107.71,3598155.0 +2017-06-22,105.72,107.26,104.55,106.78,2327303.0,0.0,1.0,105.72,107.26,104.55,106.78,2327303.0 +2017-06-21,105.88,106.56,104.82,105.69,2641503.0,0.0,1.0,105.88,106.56,104.82,105.69,2641503.0 +2017-06-20,106.01,107.11,104.3,104.93,1946595.0,0.0,1.0,106.01,107.11,104.3,104.93,1946595.0 +2017-06-19,105.6,106.7,105.16,106.16,2432063.0,0.0,1.0,105.6,106.7,105.16,106.16,2432063.0 +2017-06-16,105.5,105.92,103.63,104.88,2536983.0,0.0,1.0,105.5,105.92,103.63,104.88,2536983.0 +2017-06-15,104.77,106.04,103.48,105.58,1740903.0,0.0,1.0,104.77,106.04,103.48,105.58,1740903.0 +2017-06-14,108.52,108.65,105.0232,106.2,1953219.0,0.0,1.0,108.52,108.65,105.0232,106.2,1953219.0 +2017-06-13,107.6,108.24,105.17,107.55,2257865.0,0.0,1.0,107.6,108.24,105.17,107.55,2257865.0 +2017-06-12,104.21,108.62,100.7,107.44,5005477.0,0.0,1.0,104.21,108.62,100.7,107.44,5005477.0 +2017-06-09,111.16,111.6999,103.62,105.95,3011163.0,0.0,1.0,111.16,111.6999,103.62,105.95,3011163.0 +2017-06-08,111.51,111.95,110.2,111.12,2006959.0,0.0,1.0,111.51,111.95,110.2,111.12,2006959.0 +2017-06-07,111.38,112.08,110.6,111.17,2010213.0,0.0,1.0,111.38,112.08,110.6,111.17,2010213.0 +2017-06-06,110.4,112.27,110.19,111.45,1505270.0,0.0,1.0,110.4,112.27,110.19,111.45,1505270.0 +2017-06-05,112.74,113.14,110.23,110.88,3933494.0,0.0,1.0,112.74,113.14,110.23,110.88,3933494.0 +2017-06-02,113.78,113.88,111.76,112.91,2213075.0,0.0,1.0,113.78,113.88,111.76,112.91,2213075.0 +2017-06-01,111.72,113.12,110.94,113.03,2318445.0,0.0,1.0,111.72,113.12,110.94,113.03,2318445.0 diff --git a/examples/demos/stocqt/content/data/AMD.csv b/examples/demos/stocqt/content/data/AMD.csv new file mode 100644 index 000000000..62c33c6fa --- /dev/null +++ b/examples/demos/stocqt/content/data/AMD.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,10.57,10.58,10.27,10.28,26321111.0,0.0,1.0,10.57,10.58,10.27,10.28,26321111.0 +2017-12-28,10.57,10.64,10.43,10.55,18345480.0,0.0,1.0,10.57,10.64,10.43,10.55,18345480.0 +2017-12-27,10.45,10.74,10.4,10.53,22780900.0,0.0,1.0,10.45,10.74,10.4,10.53,22780900.0 +2017-12-26,10.38,10.579,10.34,10.46,20362897.0,0.0,1.0,10.38,10.579,10.34,10.46,20362897.0 +2017-12-22,10.75,10.77,10.2,10.54,50572874.0,0.0,1.0,10.75,10.77,10.2,10.54,50572874.0 +2017-12-21,10.98,11.0793,10.87,10.89,21645217.0,0.0,1.0,10.98,11.0793,10.87,10.89,21645217.0 +2017-12-20,11.1,11.18,10.8,10.98,31053753.0,0.0,1.0,11.1,11.18,10.8,10.98,31053753.0 +2017-12-19,11.0,11.19,10.87,10.95,43445290.0,0.0,1.0,11.0,11.19,10.87,10.95,43445290.0 +2017-12-18,10.6,11.0,10.51,10.98,62789226.0,0.0,1.0,10.6,11.0,10.51,10.98,62789226.0 +2017-12-15,10.13,10.32,10.02,10.3,42459234.0,0.0,1.0,10.13,10.32,10.02,10.3,42459234.0 +2017-12-14,10.1,10.17,9.96,10.13,26491754.0,0.0,1.0,10.1,10.17,9.96,10.13,26491754.0 +2017-12-13,9.97,10.21,9.95,10.11,41201508.0,0.0,1.0,9.97,10.21,9.95,10.11,41201508.0 +2017-12-12,10.13,10.14,9.88,9.9,35843064.0,0.0,1.0,10.13,10.14,9.88,9.9,35843064.0 +2017-12-11,9.97,10.16,9.96,10.16,29359732.0,0.0,1.0,9.97,10.16,9.96,10.16,29359732.0 +2017-12-08,10.15,10.2,9.92,9.94,34582737.0,0.0,1.0,10.15,10.2,9.92,9.94,34582737.0 +2017-12-07,10.0705,10.19,9.95,10.04,32273896.0,0.0,1.0,10.0705,10.19,9.95,10.04,32273896.0 +2017-12-06,9.9,10.05,9.71,10.0,38351614.0,0.0,1.0,9.9,10.05,9.71,10.0,38351614.0 +2017-12-05,9.89,10.34,9.7,9.91,66840417.0,0.0,1.0,9.89,10.34,9.7,9.91,66840417.0 +2017-12-04,10.85,10.86,9.82,10.03,95608827.0,0.0,1.0,10.85,10.86,9.82,10.03,95608827.0 +2017-12-01,10.81,10.97,10.53,10.7201,41932685.0,0.0,1.0,10.81,10.97,10.53,10.7201,41932685.0 +2017-11-30,10.87,11.03,10.76,10.89,42311007.0,0.0,1.0,10.87,11.03,10.76,10.89,42311007.0 +2017-11-29,11.08,11.17,10.73,10.825,63028757.0,0.0,1.0,11.08,11.17,10.73,10.825,63028757.0 +2017-11-28,11.45,11.54,11.0,11.17,65088197.0,0.0,1.0,11.45,11.54,11.0,11.17,65088197.0 +2017-11-27,11.34,11.74,11.3358,11.55,41565129.0,0.0,1.0,11.34,11.74,11.3358,11.55,41565129.0 +2017-11-24,11.38,11.42,11.3,11.38,11033178.0,0.0,1.0,11.38,11.42,11.3,11.38,11033178.0 +2017-11-22,11.41,11.49,11.3,11.37,23686100.0,0.0,1.0,11.41,11.49,11.3,11.37,23686100.0 +2017-11-21,11.421,11.49,11.24,11.4,31469531.0,0.0,1.0,11.421,11.49,11.24,11.4,31469531.0 +2017-11-20,11.47,11.505,11.19,11.34,35827552.0,0.0,1.0,11.47,11.505,11.19,11.34,35827552.0 +2017-11-17,11.3,11.75,11.28,11.38,56245136.0,0.0,1.0,11.3,11.75,11.28,11.38,56245136.0 +2017-11-16,11.13,11.32,11.13,11.25,30814936.0,0.0,1.0,11.13,11.32,11.13,11.25,30814936.0 +2017-11-15,11.01,11.13,10.77,11.07,33326871.0,0.0,1.0,11.01,11.13,10.77,11.07,33326871.0 +2017-11-14,11.03,11.26,11.0,11.12,36254723.0,0.0,1.0,11.03,11.26,11.0,11.12,36254723.0 +2017-11-13,11.18,11.2,10.92,11.09,53925999.0,0.0,1.0,11.18,11.2,10.92,11.09,53925999.0 +2017-11-10,11.22,11.43,11.115,11.26,50022529.0,0.0,1.0,11.22,11.43,11.115,11.26,50022529.0 +2017-11-09,11.25,11.35,11.03,11.12,75698460.0,0.0,1.0,11.25,11.35,11.03,11.12,75698460.0 +2017-11-07,11.94,12.27,11.92,12.05,66232713.0,0.0,1.0,11.94,12.27,11.92,12.05,66232713.0 +2017-11-06,12.04,12.09,11.64,11.93,95719936.0,0.0,1.0,12.04,12.09,11.64,11.93,95719936.0 +2017-11-03,10.95,11.13,10.82,11.12,43989491.0,0.0,1.0,10.95,11.13,10.82,11.12,43989491.0 +2017-11-02,10.87,10.99,10.66,10.85,47509725.0,0.0,1.0,10.87,10.99,10.66,10.85,47509725.0 +2017-11-01,11.25,11.29,10.72,10.8,66416610.0,0.0,1.0,11.25,11.29,10.72,10.8,66416610.0 +2017-10-31,10.76,11.31,10.69,10.985,78118243.0,0.0,1.0,10.76,11.31,10.69,10.985,78118243.0 +2017-10-30,11.255,11.42,10.65,10.89,136725037.0,0.0,1.0,11.255,11.42,10.65,10.89,136725037.0 +2017-10-27,12.17,12.19,11.35,11.84,115163241.0,0.0,1.0,12.17,12.19,11.35,11.84,115163241.0 +2017-10-26,12.45,12.46,12.0,12.005,86725366.0,0.0,1.0,12.45,12.46,12.0,12.005,86725366.0 +2017-10-25,12.95,13.13,12.29,12.33,165686209.0,0.0,1.0,12.95,13.13,12.29,12.33,165686209.0 +2017-10-24,14.2,14.36,14.15,14.25,60340437.0,0.0,1.0,14.2,14.36,14.15,14.25,60340437.0 +2017-10-23,13.94,14.19,13.8999,14.1,49438627.0,0.0,1.0,13.94,14.19,13.8999,14.1,49438627.0 +2017-10-20,14.03,14.09,13.8,13.81,31624215.0,0.0,1.0,14.03,14.09,13.8,13.81,31624215.0 +2017-10-19,13.85,14.04,13.69,13.95,33600243.0,0.0,1.0,13.85,14.04,13.69,13.95,33600243.0 +2017-10-18,14.2,14.279,13.76,14.07,38868463.0,0.0,1.0,14.2,14.279,13.76,14.07,38868463.0 +2017-10-17,14.24,14.345,14.135,14.16,28695155.0,0.0,1.0,14.24,14.345,14.135,14.16,28695155.0 +2017-10-16,14.25,14.35,14.12,14.26,33684147.0,0.0,1.0,14.25,14.35,14.12,14.26,33684147.0 +2017-10-13,14.32,14.41,14.12,14.22,37160693.0,0.0,1.0,14.32,14.41,14.12,14.22,37160693.0 +2017-10-12,13.85,14.37,13.81,14.2,69313327.0,0.0,1.0,13.85,14.37,13.81,14.2,69313327.0 +2017-10-11,13.62,13.96,13.61,13.88,38017847.0,0.0,1.0,13.62,13.96,13.61,13.88,38017847.0 +2017-10-10,13.72,13.79,13.44,13.7,43046193.0,0.0,1.0,13.72,13.79,13.44,13.7,43046193.0 +2017-10-09,13.26,13.83,13.26,13.47,53748724.0,0.0,1.0,13.26,13.83,13.26,13.47,53748724.0 +2017-10-06,13.22,13.39,13.18,13.23,27939491.0,0.0,1.0,13.22,13.39,13.18,13.23,27939491.0 +2017-10-05,13.38,13.46,13.21,13.34,34409933.0,0.0,1.0,13.38,13.46,13.21,13.34,34409933.0 +2017-10-04,13.31,13.5,13.15,13.31,41814144.0,0.0,1.0,13.31,13.5,13.15,13.31,41814144.0 +2017-10-03,12.73,13.48,12.7,13.42,84656340.0,0.0,1.0,12.73,13.48,12.7,13.42,84656340.0 +2017-10-02,12.8,12.85,12.62,12.71,34256219.0,0.0,1.0,12.8,12.85,12.62,12.71,34256219.0 +2017-09-29,12.765,12.82,12.6,12.75,33358815.0,0.0,1.0,12.765,12.82,12.6,12.75,33358815.0 +2017-09-28,12.76,12.84,12.55,12.74,35439338.0,0.0,1.0,12.76,12.84,12.55,12.74,35439338.0 +2017-09-27,12.65,12.87,12.5,12.74,59391214.0,0.0,1.0,12.65,12.87,12.5,12.74,59391214.0 +2017-09-26,12.85,12.93,12.43,12.45,67417625.0,0.0,1.0,12.85,12.93,12.43,12.45,67417625.0 +2017-09-25,13.25,13.28,12.49,12.61,83429167.0,0.0,1.0,13.25,13.28,12.49,12.61,83429167.0 +2017-09-22,13.2,13.4,13.12,13.3,49752570.0,0.0,1.0,13.2,13.4,13.12,13.3,49752570.0 +2017-09-21,14.0,14.24,13.32,13.41,164802839.0,0.0,1.0,14.0,14.24,13.32,13.41,164802839.0 +2017-09-20,13.07,13.8,12.8,13.76,82385985.0,0.0,1.0,13.07,13.8,12.8,13.76,82385985.0 +2017-09-19,13.25,13.29,12.88,13.12,64693928.0,0.0,1.0,13.25,13.29,12.88,13.12,64693928.0 +2017-09-18,12.77,13.3,12.74,13.08,82647358.0,0.0,1.0,12.77,13.3,12.74,13.08,82647358.0 +2017-09-15,12.33,12.66,12.31,12.52,49576344.0,0.0,1.0,12.33,12.66,12.31,12.52,49576344.0 +2017-09-14,12.15,12.46,12.11,12.26,36903301.0,0.0,1.0,12.15,12.46,12.11,12.26,36903301.0 +2017-09-13,12.22,12.36,12.12,12.22,36978783.0,0.0,1.0,12.22,12.36,12.12,12.22,36978783.0 +2017-09-12,12.66,12.68,12.213,12.3,54029549.0,0.0,1.0,12.66,12.68,12.213,12.3,54029549.0 +2017-09-11,12.46,12.74,12.4001,12.55,42904404.0,0.0,1.0,12.46,12.74,12.4001,12.55,42904404.0 +2017-09-08,12.5712,12.61,12.035,12.25,60503832.0,0.0,1.0,12.5712,12.61,12.035,12.25,60503832.0 +2017-09-07,12.84,12.94,12.6,12.63,35467788.0,0.0,1.0,12.84,12.94,12.6,12.63,35467788.0 +2017-09-06,13.02,13.08,12.75,12.85,33828656.0,0.0,1.0,13.02,13.08,12.75,12.85,33828656.0 +2017-09-05,12.88,13.18,12.65,12.92,51359359.0,0.0,1.0,12.88,13.18,12.65,12.92,51359359.0 +2017-09-01,13.12,13.485,13.04,13.19,52901453.0,0.0,1.0,13.12,13.485,13.04,13.19,52901453.0 +2017-08-31,12.82,13.16,12.79,13.0,51056961.0,0.0,1.0,12.82,13.16,12.79,13.0,51056961.0 +2017-08-30,12.19,12.68,12.16,12.67,43434380.0,0.0,1.0,12.19,12.68,12.16,12.67,43434380.0 +2017-08-29,12.0,12.18,11.93,12.15,33290113.0,0.0,1.0,12.0,12.18,11.93,12.15,33290113.0 +2017-08-28,12.53,12.55,12.16,12.23,35078317.0,0.0,1.0,12.53,12.55,12.16,12.23,35078317.0 +2017-08-25,12.51,12.57,12.25,12.425,29543318.0,0.0,1.0,12.51,12.57,12.25,12.425,29543318.0 +2017-08-24,12.69,12.71,12.39,12.505,37056907.0,0.0,1.0,12.69,12.71,12.39,12.505,37056907.0 +2017-08-23,12.0,12.535,11.95,12.48,43429439.0,0.0,1.0,12.0,12.535,11.95,12.48,43429439.0 +2017-08-22,12.2,12.33,12.1,12.175,38705808.0,0.0,1.0,12.2,12.33,12.1,12.175,38705808.0 +2017-08-21,12.42,12.42,11.86,12.05,58620489.0,0.0,1.0,12.42,12.42,11.86,12.05,58620489.0 +2017-08-18,12.43,12.555,12.25,12.376,37172947.0,0.0,1.0,12.43,12.555,12.25,12.376,37172947.0 +2017-08-17,12.46,12.65,12.32,12.34,46960411.0,0.0,1.0,12.46,12.65,12.32,12.34,46960411.0 +2017-08-16,13.17,13.19,12.52,12.63,64171662.0,0.0,1.0,13.17,13.19,12.52,12.63,64171662.0 +2017-08-15,13.01,13.14,12.75,13.02,57447725.0,0.0,1.0,13.01,13.14,12.75,13.02,57447725.0 +2017-08-14,12.58,12.845,12.58,12.76,63873137.0,0.0,1.0,12.58,12.845,12.58,12.76,63873137.0 +2017-08-11,12.04,12.39,11.88,12.23,63319050.0,0.0,1.0,12.04,12.39,11.88,12.23,63319050.0 +2017-08-10,12.7,12.92,12.11,12.12,80131441.0,0.0,1.0,12.7,12.92,12.11,12.12,80131441.0 +2017-08-09,12.76,12.89,12.54,12.83,58571682.0,0.0,1.0,12.76,12.89,12.54,12.83,58571682.0 +2017-08-08,13.48,13.55,13.08,13.11,46548040.0,0.0,1.0,13.48,13.55,13.08,13.11,46548040.0 +2017-08-07,13.33,13.57,13.27,13.43,57203474.0,0.0,1.0,13.33,13.57,13.27,13.43,57203474.0 +2017-08-04,13.2,13.36,13.02,13.12,63954775.0,0.0,1.0,13.2,13.36,13.02,13.12,63954775.0 +2017-08-03,13.42,13.52,13.08,13.24,51720273.0,0.0,1.0,13.42,13.52,13.08,13.24,51720273.0 +2017-08-02,13.81,13.93,13.12,13.37,67062121.0,0.0,1.0,13.81,13.93,13.12,13.37,67062121.0 +2017-08-01,13.72,13.86,13.45,13.71,48273874.0,0.0,1.0,13.72,13.86,13.45,13.71,48273874.0 +2017-07-31,14.09,14.22,13.47,13.61,68653763.0,0.0,1.0,14.09,14.22,13.47,13.61,68653763.0 +2017-07-28,13.845,14.1,13.68,13.95,66352470.0,0.0,1.0,13.845,14.1,13.68,13.95,66352470.0 +2017-07-27,14.99,15.04,13.7,14.12,129095996.0,0.0,1.0,14.99,15.04,13.7,14.12,129095996.0 +2017-07-26,15.13,15.65,14.4,14.76,234655935.0,0.0,1.0,15.13,15.65,14.4,14.76,234655935.0 +2017-07-25,14.2895,14.32,13.87,14.11,76089789.0,0.0,1.0,14.2895,14.32,13.87,14.11,76089789.0 +2017-07-24,14.0,14.44,13.97,14.16,70306709.0,0.0,1.0,14.0,14.44,13.97,14.16,70306709.0 +2017-07-21,13.7,14.05,13.62,13.88,50836269.0,0.0,1.0,13.7,14.05,13.62,13.88,50836269.0 +2017-07-20,13.61,13.89,13.45,13.8,47328081.0,0.0,1.0,13.61,13.89,13.45,13.8,47328081.0 +2017-07-19,13.62,13.74,13.41,13.55,51511044.0,0.0,1.0,13.62,13.74,13.41,13.55,51511044.0 +2017-07-18,13.29,13.53,13.15,13.48,77823247.0,0.0,1.0,13.29,13.53,13.15,13.48,77823247.0 +2017-07-17,14.03,14.12,13.51,13.8,70594469.0,0.0,1.0,14.03,14.12,13.51,13.8,70594469.0 +2017-07-14,13.46,13.93,13.32,13.92,81515312.0,0.0,1.0,13.46,13.93,13.32,13.92,81515312.0 +2017-07-13,14.33,14.49,13.43,13.53,110860494.0,0.0,1.0,14.33,14.49,13.43,13.53,110860494.0 +2017-07-12,14.17,14.39,13.96,14.29,78011028.0,0.0,1.0,14.17,14.39,13.96,14.29,78011028.0 +2017-07-11,13.77,14.099,13.62,13.89,70760527.0,0.0,1.0,13.77,14.099,13.62,13.89,70760527.0 +2017-07-10,13.61,13.88,13.27,13.81,77940920.0,0.0,1.0,13.61,13.88,13.27,13.81,77940920.0 +2017-07-07,13.27,13.745,13.18,13.36,88021133.0,0.0,1.0,13.27,13.745,13.18,13.36,88021133.0 +2017-07-06,12.94,13.32,12.665,13.02,88418322.0,0.0,1.0,12.94,13.32,12.665,13.02,88418322.0 +2017-07-05,12.36,13.21,12.32,13.19,98729984.0,0.0,1.0,12.36,13.21,12.32,13.19,98729984.0 +2017-07-03,12.57,12.73,12.13,12.15,39888247.0,0.0,1.0,12.57,12.73,12.13,12.15,39888247.0 +2017-06-30,12.57,12.83,12.36,12.48,58976478.0,0.0,1.0,12.57,12.83,12.36,12.48,58976478.0 +2017-06-29,13.06,13.15,12.45,12.6,86658774.0,0.0,1.0,13.06,13.15,12.45,12.6,86658774.0 +2017-06-28,13.65,13.7,13.09,13.23,84591176.0,0.0,1.0,13.65,13.7,13.09,13.23,84591176.0 +2017-06-27,13.76,14.04,13.37,13.395,88742270.0,0.0,1.0,13.76,14.04,13.37,13.395,88742270.0 +2017-06-26,14.39,14.49,13.84,14.08,100078492.0,0.0,1.0,14.39,14.49,13.84,14.08,100078492.0 +2017-06-23,14.15,14.67,13.9,14.15,151603584.0,0.0,1.0,14.15,14.67,13.9,14.15,151603584.0 +2017-06-22,14.1,14.5,13.56,14.3708,147959418.0,0.0,1.0,14.1,14.5,13.56,14.3708,147959418.0 +2017-06-21,13.36,14.01,13.13,13.98,187161633.0,0.0,1.0,13.36,14.01,13.13,13.98,187161633.0 +2017-06-20,12.19,12.93,12.18,12.64,116319537.0,0.0,1.0,12.19,12.93,12.18,12.64,116319537.0 +2017-06-19,11.63,12.12,11.62,11.93,61268773.0,0.0,1.0,11.63,12.12,11.62,11.93,61268773.0 +2017-06-16,11.66,11.83,11.28,11.44,58774371.0,0.0,1.0,11.66,11.83,11.28,11.44,58774371.0 +2017-06-15,11.34,11.58,11.21,11.5,60332254.0,0.0,1.0,11.34,11.58,11.21,11.5,60332254.0 +2017-06-14,11.91,12.05,11.65,11.76,51454208.0,0.0,1.0,11.91,12.05,11.65,11.76,51454208.0 +2017-06-13,12.33,12.48,11.67,11.96,86585397.0,0.0,1.0,12.33,12.48,11.67,11.96,86585397.0 +2017-06-12,11.75,12.35,11.47,12.085,123725528.0,0.0,1.0,11.75,12.35,11.47,12.085,123725528.0 +2017-06-09,13.1,13.4,11.63,12.28,165174160.0,0.0,1.0,13.1,13.4,11.63,12.28,165174160.0 +2017-06-08,12.81,12.91,12.4,12.9,87201152.0,0.0,1.0,12.81,12.91,12.4,12.9,87201152.0 +2017-06-07,12.42,12.96,12.2348,12.38,149171943.0,0.0,1.0,12.42,12.96,12.2348,12.38,149171943.0 +2017-06-06,11.27,12.24,11.24,12.02,113010266.0,0.0,1.0,11.27,12.24,11.24,12.02,113010266.0 +2017-06-05,10.84,11.34,10.8,11.24,64357671.0,0.0,1.0,10.84,11.34,10.8,11.24,64357671.0 +2017-06-02,10.93,10.96,10.565,10.9,42838855.0,0.0,1.0,10.93,10.96,10.565,10.9,42838855.0 +2017-06-01,11.25,11.285,10.81,10.93,47175511.0,0.0,1.0,11.25,11.285,10.81,10.93,47175511.0 diff --git a/examples/demos/stocqt/content/data/AMZN.csv b/examples/demos/stocqt/content/data/AMZN.csv new file mode 100644 index 000000000..f6fea4d2c --- /dev/null +++ b/examples/demos/stocqt/content/data/AMZN.csv @@ -0,0 +1,147 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,1182.35,1184.0,1167.5,1169.47,2625283.0,0.0,1.0,1182.35,1184.0,1167.5,1169.47,2625283.0 +2017-12-28,1189.0,1190.1,1184.38,1186.1,1803460.0,0.0,1.0,1189.0,1190.1,1184.38,1186.1,1803460.0 +2017-12-27,1179.91,1187.29,1175.61,1182.26,1779382.0,0.0,1.0,1179.91,1187.29,1175.61,1182.26,1779382.0 +2017-12-26,1168.36,1178.32,1160.55,1176.76,1964871.0,0.0,1.0,1168.36,1178.32,1160.55,1176.76,1964871.0 +2017-12-22,1172.08,1174.62,1167.83,1168.36,1553997.0,0.0,1.0,1172.08,1174.62,1167.83,1168.36,1553997.0 +2017-12-21,1175.9,1179.17,1167.64,1174.76,2042448.0,0.0,1.0,1175.9,1179.17,1167.64,1174.76,2042448.0 +2017-12-20,1190.5,1191.0,1176.0,1177.62,2318916.0,0.0,1.0,1190.5,1191.0,1176.0,1177.62,2318916.0 +2017-12-19,1189.15,1192.97,1179.14,1187.38,2555235.0,0.0,1.0,1189.15,1192.97,1179.14,1187.38,2555235.0 +2017-12-18,1187.37,1194.78,1180.91,1190.58,2767271.0,0.0,1.0,1187.37,1194.78,1180.91,1190.58,2767271.0 +2017-12-15,1179.03,1182.75,1169.33,1179.14,4539895.0,0.0,1.0,1179.03,1182.75,1169.33,1179.14,4539895.0 +2017-12-14,1163.71,1177.93,1162.45,1174.26,3069993.0,0.0,1.0,1163.71,1177.93,1162.45,1174.26,3069993.0 +2017-12-13,1170.0,1170.87,1160.27,1164.13,2555053.0,0.0,1.0,1170.0,1170.87,1160.27,1164.13,2555053.0 +2017-12-12,1166.51,1173.6,1161.61,1165.08,2197697.0,0.0,1.0,1166.51,1173.6,1161.61,1165.08,2197697.0 +2017-12-11,1164.6,1169.9,1157.0,1168.92,2257922.0,0.0,1.0,1164.6,1169.9,1157.0,1168.92,2257922.0 +2017-12-08,1170.4,1172.79,1157.1,1162.0,2957785.0,0.0,1.0,1170.4,1172.79,1157.1,1162.0,2957785.0 +2017-12-07,1156.59,1163.19,1151.0,1159.79,2408323.0,0.0,1.0,1156.59,1163.19,1151.0,1159.79,2408323.0 +2017-12-06,1137.99,1155.89,1136.08,1152.35,2756730.0,0.0,1.0,1137.99,1155.89,1136.08,1152.35,2756730.0 +2017-12-05,1128.26,1159.27,1124.74,1141.57,4033184.0,0.0,1.0,1128.26,1159.27,1124.74,1141.57,4033184.0 +2017-12-04,1173.85,1175.2,1128.0,1133.95,5872358.0,0.0,1.0,1173.85,1175.2,1128.0,1133.95,5872358.0 +2017-12-01,1172.05,1179.65,1152.0,1162.35,4070722.0,0.0,1.0,1172.05,1179.65,1152.0,1162.35,4070722.0 +2017-11-30,1167.1,1178.57,1160.0,1176.75,4406535.0,0.0,1.0,1167.1,1178.57,1160.0,1176.75,4406535.0 +2017-11-29,1194.8,1194.8,1145.19,1161.27,9179567.0,0.0,1.0,1194.8,1194.8,1145.19,1161.27,9179567.0 +2017-11-28,1204.88,1205.34,1188.52,1193.6,4463476.0,0.0,1.0,1204.88,1205.34,1188.52,1193.6,4463476.0 +2017-11-27,1202.66,1213.41,1191.15,1195.83,6701343.0,0.0,1.0,1202.66,1213.41,1191.15,1195.83,6701343.0 +2017-11-24,1160.7,1186.84,1160.7,1186.0,3526582.0,0.0,1.0,1160.7,1186.84,1160.7,1186.0,3526582.0 +2017-11-22,1141.0,1160.27,1141.0,1156.16,3516336.0,0.0,1.0,1141.0,1160.27,1141.0,1156.16,3516336.0 +2017-11-21,1132.86,1140.0,1128.2,1139.49,2449503.0,0.0,1.0,1132.86,1140.0,1128.2,1139.49,2449503.0 +2017-11-20,1129.77,1133.42,1122.55,1126.31,2134381.0,0.0,1.0,1129.77,1133.42,1122.55,1126.31,2134381.0 +2017-11-17,1138.28,1138.8,1125.81,1129.88,2333554.0,0.0,1.0,1138.28,1138.8,1125.81,1129.88,2333554.0 +2017-11-16,1130.16,1138.16,1130.05,1137.29,2190456.0,0.0,1.0,1130.16,1138.16,1130.05,1137.29,2190456.0 +2017-11-15,1127.01,1131.75,1121.63,1126.69,3897230.0,0.0,1.0,1127.01,1131.75,1121.63,1126.69,3897230.0 +2017-11-14,1130.11,1138.0,1123.89,1136.84,3042295.0,0.0,1.0,1130.11,1138.0,1123.89,1136.84,3042295.0 +2017-11-13,1123.0,1139.9,1122.34,1129.17,2897563.0,0.0,1.0,1123.0,1139.9,1122.34,1129.17,2897563.0 +2017-11-10,1126.1,1131.75,1124.06,1125.35,2162985.0,0.0,1.0,1126.1,1131.75,1124.06,1125.35,2162985.0 +2017-11-09,1125.96,1129.62,1115.77,1129.13,3661411.0,0.0,1.0,1125.96,1129.62,1115.77,1129.13,3661411.0 +2017-11-07,1124.74,1130.6,1117.5,1123.17,2623474.0,0.0,1.0,1124.74,1130.6,1117.5,1123.17,2623474.0 +2017-11-06,1109.15,1125.41,1108.77,1120.66,3313857.0,0.0,1.0,1109.15,1125.41,1108.77,1120.66,3313857.0 +2017-11-03,1091.15,1112.68,1088.52,1111.6,3685172.0,0.0,1.0,1091.15,1112.68,1088.52,1111.6,3685172.0 +2017-11-02,1097.81,1101.94,1086.87,1094.22,3658748.0,0.0,1.0,1097.81,1101.94,1086.87,1094.22,3658748.0 +2017-11-01,1105.4,1108.97,1096.74,1103.68,3723680.0,0.0,1.0,1105.4,1108.97,1096.74,1103.68,3723680.0 +2017-10-31,1109.0,1110.54,1101.12,1105.28,3428461.0,0.0,1.0,1109.0,1110.54,1101.12,1105.28,3428461.0 +2017-10-30,1095.01,1122.79,1093.56,1110.85,6516639.0,0.0,1.0,1095.01,1122.79,1093.56,1110.85,6516639.0 +2017-10-27,1058.14,1105.58,1050.55,1100.95,16360527.0,0.0,1.0,1058.14,1105.58,1050.55,1100.95,16360527.0 +2017-10-26,980.33,982.9,968.55,972.43,3670282.0,0.0,1.0,980.33,982.9,968.55,972.43,3670282.0 +2017-10-25,978.0,984.44,966.24,972.91,2969295.0,0.0,1.0,978.0,984.44,966.24,972.91,2969295.0 +2017-10-24,969.0,979.85,965.0,975.9,2666782.0,0.0,1.0,969.0,979.85,965.0,975.9,2666782.0 +2017-10-23,986.73,986.775,962.5,966.3,3465469.0,0.0,1.0,986.73,986.775,962.5,966.3,3465469.0 +2017-10-20,993.53,994.62,982.0,982.91,2294145.0,0.0,1.0,993.53,994.62,982.0,982.91,2294145.0 +2017-10-19,990.0,991.05,980.24,986.61,3040066.0,0.0,1.0,990.0,991.05,980.24,986.61,3040066.0 +2017-10-18,1009.27,1022.31,996.55,997.0,2477357.0,0.0,1.0,1009.27,1022.31,996.55,997.0,2477357.0 +2017-10-17,1005.59,1011.47,1004.38,1009.13,2307075.0,0.0,1.0,1005.59,1011.47,1004.38,1009.13,2307075.0 +2017-10-16,1008.44,1009.57,1001.04,1006.34,1991556.0,0.0,1.0,1008.44,1009.57,1001.04,1006.34,1991556.0 +2017-10-13,1007.0,1007.77,1001.03,1002.94,2399403.0,0.0,1.0,1007.0,1007.77,1001.03,1002.94,2399403.0 +2017-10-12,996.81,1008.44,992.4,1000.93,4056172.0,0.0,1.0,996.81,1008.44,992.4,1000.93,4056172.0 +2017-10-11,991.27,995.5,986.695,995.0,2310872.0,0.0,1.0,991.27,995.5,986.695,995.0,2310872.0 +2017-10-10,996.67,997.95,980.099,987.2,3062820.0,0.0,1.0,996.67,997.95,980.099,987.2,3062820.0 +2017-10-09,993.24,998.5,987.5,990.99,2927994.0,0.0,1.0,993.24,998.5,987.5,990.99,2927994.0 +2017-10-06,975.64,995.75,975.64,989.58,3719840.0,0.0,1.0,975.64,995.75,975.64,989.58,3719840.0 +2017-10-05,970.0,981.51,969.64,980.85,3119487.0,0.0,1.0,970.0,981.51,969.64,980.85,3119487.0 +2017-10-04,954.21,967.79,954.05,965.45,2460721.0,0.0,1.0,954.21,967.79,954.05,965.45,2460721.0 +2017-10-03,958.0,963.69,950.37,957.1,2643484.0,0.0,1.0,958.0,963.69,950.37,957.1,2643484.0 +2017-10-02,964.0,967.305,952.1201,959.19,2415846.0,0.0,1.0,964.0,967.305,952.1201,959.19,2415846.0 +2017-09-29,960.11,964.83,958.375,961.35,2411643.0,0.0,1.0,960.11,964.83,958.375,961.35,2411643.0 +2017-09-28,951.86,959.7,950.101,956.4,2512567.0,0.0,1.0,951.86,959.7,950.101,956.4,2512567.0 +2017-09-27,948.0,955.3,943.3,950.87,3111263.0,0.0,1.0,948.0,955.3,943.3,950.87,3111263.0 +2017-09-26,945.49,948.63,931.75,938.6,3464183.0,0.0,1.0,945.49,948.63,931.75,938.6,3464183.0 +2017-09-25,949.31,949.42,932.89,939.79,5065542.0,0.0,1.0,949.31,949.42,932.89,939.79,5065542.0 +2017-09-22,961.01,965.61,954.42,955.1,2602418.0,0.0,1.0,961.01,965.61,954.42,955.1,2602418.0 +2017-09-21,971.31,971.7,962.02,964.65,2252940.0,0.0,1.0,971.31,971.7,962.02,964.65,2252940.0 +2017-09-20,971.79,974.81,962.1626,973.21,2727355.0,0.0,1.0,971.79,974.81,962.1626,973.21,2727355.0 +2017-09-19,977.25,978.24,967.46,969.86,2614059.0,0.0,1.0,977.25,978.24,967.46,969.86,2614059.0 +2017-09-18,990.4,992.7922,968.17,974.19,3376772.0,0.0,1.0,990.4,992.7922,968.17,974.19,3376772.0 +2017-09-15,993.01,996.25,984.03,986.79,3697742.0,0.0,1.0,993.01,996.25,984.03,986.79,3697742.0 +2017-09-14,996.8,998.56,987.74,992.21,3788472.0,0.0,1.0,996.8,998.56,987.74,992.21,3788472.0 +2017-09-13,983.97,1000.0,979.42,999.6,3314978.0,0.0,1.0,983.97,1000.0,979.42,999.6,3314978.0 +2017-09-12,983.27,984.6718,975.517,982.58,2444699.0,0.0,1.0,983.27,984.6718,975.517,982.58,2444699.0 +2017-09-11,974.46,981.94,974.22,977.96,2134582.0,0.0,1.0,974.46,981.94,974.22,977.96,2134582.0 +2017-09-08,979.1,979.88,963.47,965.9,2578269.0,0.0,1.0,979.1,979.88,963.47,965.9,2578269.0 +2017-09-07,974.0,980.59,972.55,979.47,2536000.0,0.0,1.0,974.0,980.59,972.55,979.47,2536000.0 +2017-09-06,968.32,971.84,960.6,967.8,2106605.0,0.0,1.0,968.32,971.84,960.6,967.8,2106605.0 +2017-09-05,975.4,976.7699,960.37,965.27,2875228.0,0.0,1.0,975.4,976.7699,960.37,965.27,2875228.0 +2017-09-01,984.2,984.5,976.875,978.25,2423132.0,0.0,1.0,984.2,984.5,976.875,978.25,2423132.0 +2017-08-31,974.7,981.0,972.76,980.6,3280945.0,0.0,1.0,974.7,981.0,972.76,980.6,3280945.0 +2017-08-30,958.44,969.41,956.9062,967.59,2860718.0,0.0,1.0,958.44,969.41,956.9062,967.59,2860718.0 +2017-08-29,940.0,956.0,936.33,954.06,2853972.0,0.0,1.0,940.0,956.0,936.33,954.06,2853972.0 +2017-08-28,946.54,953.0,942.25,946.02,2529087.0,0.0,1.0,946.54,953.0,942.25,946.02,2529087.0 +2017-08-25,956.0,957.621,944.1,945.26,3292776.0,0.0,1.0,956.0,957.621,944.1,945.26,3292776.0 +2017-08-24,957.42,959.0,941.14,952.45,5086748.0,0.0,1.0,957.42,959.0,941.14,952.45,5086748.0 +2017-08-23,959.38,962.0,954.2,958.0,2590245.0,0.0,1.0,959.38,962.0,954.2,958.0,2590245.0 +2017-08-22,955.52,967.93,955.495,966.9,2718261.0,0.0,1.0,955.52,967.93,955.495,966.9,2718261.0 +2017-08-21,957.57,961.2,945.46,953.29,3008450.0,0.0,1.0,957.57,961.2,945.46,953.29,3008450.0 +2017-08-18,961.4,965.43,954.65,958.47,3248677.0,0.0,1.0,961.4,965.43,954.65,958.47,3248677.0 +2017-08-17,977.84,977.84,960.32,960.57,3396045.0,0.0,1.0,977.84,977.84,960.32,960.57,3396045.0 +2017-08-16,981.65,986.4605,973.22,978.18,3096051.0,0.0,1.0,981.65,986.4605,973.22,978.18,3096051.0 +2017-08-15,988.9,991.74,982.0,982.74,2513139.0,0.0,1.0,988.9,991.74,982.0,982.74,2513139.0 +2017-08-14,978.41,985.5,976.19,983.3,3008007.0,0.0,1.0,978.41,985.5,976.19,983.3,3008007.0 +2017-08-11,960.0,970.39,951.38,967.99,3431423.0,0.0,1.0,960.0,970.39,951.38,967.99,3431423.0 +2017-08-10,976.295,979.86,954.68,956.92,5560388.0,0.0,1.0,976.295,979.86,954.68,956.92,5560388.0 +2017-08-09,982.6,988.0,975.27,982.01,3434077.0,0.0,1.0,982.6,988.0,975.27,982.01,3434077.0 +2017-08-08,994.35,996.28,985.79,989.84,2847527.0,0.0,1.0,994.35,996.28,985.79,989.84,2847527.0 +2017-08-04,989.68,991.672,982.0,987.58,2704026.0,0.0,1.0,989.68,991.672,982.0,987.58,2704026.0 +2017-08-03,999.47,999.5,984.59,986.92,3203134.0,0.0,1.0,999.47,999.5,984.59,986.92,3203134.0 +2017-08-02,1001.77,1003.21,981.73,995.89,4017780.0,0.0,1.0,1001.77,1003.21,981.73,995.89,4017780.0 +2017-08-01,996.11,1006.4,991.58,996.19,4421395.0,0.0,1.0,996.11,1006.4,991.58,996.19,4421395.0 +2017-07-31,1019.05,1019.05,987.02,987.78,7246638.0,0.0,1.0,1019.05,1019.05,987.02,987.78,7246638.0 +2017-07-28,1012.14,1032.85,1001.0,1020.04,7624498.0,0.0,1.0,1012.14,1032.85,1001.0,1020.04,7624498.0 +2017-07-27,1069.55,1083.31,1040.18,1046.0,9905158.0,0.0,1.0,1069.55,1083.31,1040.18,1046.0,9905158.0 +2017-07-26,1043.2,1053.2,1043.2,1052.8,2828980.0,0.0,1.0,1043.2,1053.2,1043.2,1052.8,2828980.0 +2017-07-25,1038.05,1043.33,1032.48,1039.87,2432328.0,0.0,1.0,1038.05,1043.33,1032.48,1039.87,2432328.0 +2017-07-24,1028.34,1043.01,1027.43,1038.95,3212499.0,0.0,1.0,1028.34,1043.01,1027.43,1038.95,3212499.0 +2017-07-21,1021.28,1026.1,1011.0,1025.67,2677517.0,0.0,1.0,1021.28,1026.1,1011.0,1025.67,2677517.0 +2017-07-20,1031.59,1034.97,1022.52,1028.7,2964341.0,0.0,1.0,1031.59,1034.97,1022.52,1028.7,2964341.0 +2017-07-19,1025.0,1031.59,1022.5,1026.87,2936902.0,0.0,1.0,1025.0,1031.59,1022.5,1026.87,2936902.0 +2017-07-18,1006.0,1026.03,1004.0,1024.38,3957892.0,0.0,1.0,1006.0,1026.03,1004.0,1024.38,3957892.0 +2017-07-17,1004.69,1014.75,1003.81,1010.04,3636801.0,0.0,1.0,1004.69,1014.75,1003.81,1010.04,3636801.0 +2017-07-14,1002.4,1004.45,996.89,1001.81,2066362.0,0.0,1.0,1002.4,1004.45,996.89,1001.81,2066362.0 +2017-07-13,1004.62,1006.88,995.9,999.855,2864533.0,0.0,1.0,1004.62,1006.88,995.9,999.855,2864533.0 +2017-07-12,1000.65,1008.55,998.1,1006.51,3491988.0,0.0,1.0,1000.65,1008.55,998.1,1006.51,3491988.0 +2017-07-11,993.0,995.99,983.72,994.13,2947479.0,0.0,1.0,993.0,995.99,983.72,994.13,2947479.0 +2017-07-10,985.0,999.4392,983.5,996.47,3462884.0,0.0,1.0,985.0,999.4392,983.5,996.47,3462884.0 +2017-07-07,969.55,980.11,969.14,978.76,2582645.0,0.0,1.0,969.55,980.11,969.14,978.76,2582645.0 +2017-07-06,964.66,974.4,959.02,965.14,3229378.0,0.0,1.0,964.66,974.4,959.02,965.14,3229378.0 +2017-07-05,961.53,975.0,955.25,971.4,3587645.0,0.0,1.0,961.53,975.0,955.25,971.4,3587645.0 +2017-07-03,972.79,974.49,951.0001,953.66,2908267.0,0.0,1.0,972.79,974.49,951.0001,953.66,2908267.0 +2017-06-30,980.12,983.47,967.61,968.0,3309138.0,0.0,1.0,980.12,983.47,967.61,968.0,3309138.0 +2017-06-29,979.0,987.56,965.25,975.93,4246765.0,0.0,1.0,979.0,987.56,965.25,975.93,4246765.0 +2017-06-28,978.55,990.68,969.21,990.33,3708638.0,0.0,1.0,978.55,990.68,969.21,990.33,3708638.0 +2017-06-27,990.69,998.8,976.0,976.78,3735360.0,0.0,1.0,990.69,998.8,976.0,976.78,3735360.0 +2017-06-26,1008.5,1009.8,992.0,993.98,3347195.0,0.0,1.0,1008.5,1009.8,992.0,993.98,3347195.0 +2017-06-23,1002.54,1004.62,998.02,1003.74,2645973.0,0.0,1.0,1002.54,1004.62,998.02,1003.74,2645973.0 +2017-06-22,1002.23,1006.96,997.2,1001.3,2221035.0,0.0,1.0,1002.23,1006.96,997.2,1001.3,2221035.0 +2017-06-21,998.7,1002.72,992.6518,1002.23,2892563.0,0.0,1.0,998.7,1002.72,992.6518,1002.23,2892563.0 +2017-06-20,998.0,1004.88,992.02,992.59,4040990.0,0.0,1.0,998.0,1004.88,992.02,992.59,4040990.0 +2017-06-19,1017.0,1017.0,989.9,995.17,4967600.0,0.0,1.0,1017.0,1017.0,989.9,995.17,4967600.0 +2017-06-16,996.0,999.75,982.0,987.71,11314754.0,0.0,1.0,996.0,999.75,982.0,987.71,11314754.0 +2017-06-15,958.7,965.73,950.86,964.17,5202147.0,0.0,1.0,958.7,965.73,950.86,964.17,5202147.0 +2017-06-14,988.59,990.34,966.71,976.47,3943670.0,0.0,1.0,988.59,990.34,966.71,976.47,3943670.0 +2017-06-13,977.99,984.5,966.1,980.79,4533933.0,0.0,1.0,977.99,984.5,966.1,980.79,4533933.0 +2017-06-12,967.0,975.95,945.0,964.83,9393802.0,0.0,1.0,967.0,975.95,945.0,964.83,9393802.0 +2017-06-09,1012.5,1012.99,927.0,978.31,7548854.0,0.0,1.0,1012.5,1012.99,927.0,978.31,7548854.0 +2017-06-08,1012.06,1013.61,1006.11,1009.94,2724408.0,0.0,1.0,1012.06,1013.61,1006.11,1009.94,2724408.0 +2017-06-07,1005.95,1010.25,1002.0,1010.07,2779551.0,0.0,1.0,1005.95,1010.25,1002.0,1010.07,2779551.0 +2017-06-06,1012.0,1016.5,1001.25,1002.97,3298378.0,0.0,1.0,1012.0,1016.5,1001.25,1002.97,3298378.0 +2017-06-05,1007.23,1013.21,1003.51,1011.34,2676857.0,0.0,1.0,1007.23,1013.21,1003.51,1011.34,2676857.0 +2017-06-02,998.99,1008.48,995.67,1006.73,3714954.0,0.0,1.0,998.99,1008.48,995.67,1006.73,3714954.0 +2017-06-01,998.59,998.99,991.37,995.95,2384298.0,0.0,1.0,998.59,998.99,991.37,995.95,2384298.0 diff --git a/examples/demos/stocqt/content/data/CSCO.csv b/examples/demos/stocqt/content/data/CSCO.csv new file mode 100644 index 000000000..0c4b9b05c --- /dev/null +++ b/examples/demos/stocqt/content/data/CSCO.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,38.41,38.62,38.3,38.3,12359455.0,0.0,1.0,38.41,38.62,38.3,38.3,12359455.0 +2017-12-28,38.73,38.73,38.45,38.59,8662664.0,0.0,1.0,38.73,38.73,38.45,38.59,8662664.0 +2017-12-27,38.54,38.65,38.45,38.56,10262927.0,0.0,1.0,38.54,38.65,38.45,38.56,10262927.0 +2017-12-26,38.55,38.68,38.36,38.48,8148042.0,0.0,1.0,38.55,38.68,38.36,38.48,8148042.0 +2017-12-22,38.52,38.74,38.47,38.55,11120656.0,0.0,1.0,38.52,38.74,38.47,38.55,11120656.0 +2017-12-21,38.88,38.995,38.49,38.53,16188471.0,0.0,1.0,38.88,38.995,38.49,38.53,16188471.0 +2017-12-20,38.49,38.8,38.21,38.74,18701741.0,0.0,1.0,38.49,38.8,38.21,38.74,18701741.0 +2017-12-19,38.66,38.86,38.28,38.3,18478762.0,0.0,1.0,38.66,38.86,38.28,38.3,18478762.0 +2017-12-18,38.48,38.89,38.3,38.48,21036306.0,0.0,1.0,38.48,38.89,38.3,38.48,21036306.0 +2017-12-15,38.01,38.28,37.7,38.19,36491640.0,0.0,1.0,38.01,38.28,37.7,38.19,36491640.0 +2017-12-14,38.2,38.27,37.855,37.9,16556403.0,0.0,1.0,38.2,38.27,37.855,37.9,16556403.0 +2017-12-13,38.09,38.37,38.0,38.15,19934529.0,0.0,1.0,38.09,38.37,38.0,38.15,19934529.0 +2017-12-12,37.79,38.1,37.56,37.91,16451320.0,0.0,1.0,37.79,38.1,37.56,37.91,16451320.0 +2017-12-11,37.59,38.04,37.57,37.96,15619388.0,0.0,1.0,37.59,38.04,37.57,37.96,15619388.0 +2017-12-08,37.59,37.69,37.42,37.61,13777371.0,0.0,1.0,37.59,37.69,37.42,37.61,13777371.0 +2017-12-07,37.26,37.78,37.26,37.4,15189086.0,0.0,1.0,37.26,37.78,37.26,37.4,15189086.0 +2017-12-06,37.37,37.72,37.25,37.41,16312845.0,0.0,1.0,37.37,37.72,37.25,37.41,16312845.0 +2017-12-05,37.74,37.82,37.17,37.31,22743474.0,0.0,1.0,37.74,37.82,37.17,37.31,22743474.0 +2017-12-04,37.81,37.99,37.54,37.72,29006129.0,0.0,1.0,37.81,37.99,37.54,37.72,29006129.0 +2017-12-01,37.09,37.66,36.73,37.6,26851147.0,0.0,1.0,37.09,37.66,36.73,37.6,26851147.0 +2017-11-30,37.62,37.8,37.3,37.3,28692862.0,0.0,1.0,37.62,37.8,37.3,37.3,28692862.0 +2017-11-29,37.75,38.025,37.23,37.48,36640805.0,0.0,1.0,37.75,38.025,37.23,37.48,36640805.0 +2017-11-28,37.0,37.8,36.98,37.73,30097816.0,0.0,1.0,37.0,37.8,36.98,37.73,30097816.0 +2017-11-27,36.51,37.09,36.5,36.87,20667352.0,0.0,1.0,36.51,37.09,36.5,36.87,20667352.0 +2017-11-24,36.41,36.57,36.32,36.49,6155294.0,0.0,1.0,36.41,36.57,36.32,36.49,6155294.0 +2017-11-22,36.7,36.715,36.36,36.45,16650130.0,0.0,1.0,36.7,36.715,36.36,36.45,16650130.0 +2017-11-21,36.75,36.97,36.58,36.65,23986203.0,0.0,1.0,36.75,36.97,36.58,36.65,23986203.0 +2017-11-20,35.93,36.54,35.93,36.5,26376364.0,0.0,1.0,35.93,36.54,35.93,36.5,26376364.0 +2017-11-17,35.9,36.32,35.81,35.9,27106406.0,0.0,1.0,35.9,36.32,35.81,35.9,27106406.0 +2017-11-16,36.04,36.67,35.83,35.88,59861205.0,0.0,1.0,36.04,36.67,35.83,35.88,59861205.0 +2017-11-15,33.97,34.31,33.75,34.11,27797071.0,0.0,1.0,33.97,34.31,33.75,34.11,27797071.0 +2017-11-14,33.86,34.16,33.8,34.04,15540925.0,0.0,1.0,33.86,34.16,33.8,34.04,15540925.0 +2017-11-13,33.86,34.21,33.83,33.95,15608341.0,0.0,1.0,33.86,34.21,33.83,33.95,15608341.0 +2017-11-10,34.06,34.09,33.67,33.99,19003147.0,0.0,1.0,34.06,34.09,33.67,33.99,19003147.0 +2017-11-09,34.29,34.32,33.871,34.05,16266161.0,0.0,1.0,34.29,34.32,33.871,34.05,16266161.0 +2017-11-07,34.32,34.48,34.2147,34.4,10980008.0,0.0,1.0,34.32,34.48,34.2147,34.4,10980008.0 +2017-11-06,34.37,34.56,34.26,34.41,12725467.0,0.0,1.0,34.37,34.56,34.26,34.41,12725467.0 +2017-11-03,34.28,34.49,34.0269,34.47,13293171.0,0.0,1.0,34.28,34.49,34.0269,34.47,13293171.0 +2017-11-02,34.55,34.64,34.16,34.21,19647242.0,0.0,1.0,34.55,34.64,34.16,34.21,19647242.0 +2017-11-01,34.29,34.75,34.28,34.62,21831973.0,0.0,1.0,34.29,34.75,34.28,34.62,21831973.0 +2017-10-31,33.98,34.24,33.96,34.15,13544441.0,0.0,1.0,33.98,34.24,33.96,34.15,13544441.0 +2017-10-30,34.32,34.38,33.8244,34.04,18241531.0,0.0,1.0,34.32,34.38,33.8244,34.04,18241531.0 +2017-10-27,34.15,34.62,34.09,34.43,20237956.0,0.0,1.0,34.15,34.62,34.09,34.43,20237956.0 +2017-10-26,34.41,34.51,34.07,34.27,14541155.0,0.0,1.0,34.41,34.51,34.07,34.27,14541155.0 +2017-10-25,34.73,34.73,34.163,34.3,17012218.0,0.0,1.0,34.73,34.73,34.163,34.3,17012218.0 +2017-10-24,34.4,34.675,34.25,34.58,15273905.0,0.0,1.0,34.4,34.675,34.25,34.58,15273905.0 +2017-10-23,34.45,34.68,34.27,34.35,22490134.0,0.0,1.0,34.45,34.68,34.27,34.35,22490134.0 +2017-10-20,34.02,34.39,34.01,34.25,24055347.0,0.0,1.0,34.02,34.39,34.01,34.25,24055347.0 +2017-10-19,33.51,33.89,33.45,33.75,12928532.0,0.0,1.0,33.51,33.89,33.45,33.75,12928532.0 +2017-10-18,33.72,33.75,33.44,33.55,9739887.0,0.0,1.0,33.72,33.75,33.44,33.55,9739887.0 +2017-10-17,33.59,33.67,33.46,33.6,8633089.0,0.0,1.0,33.59,33.67,33.46,33.6,8633089.0 +2017-10-16,33.6,33.64,33.47,33.54,10469019.0,0.0,1.0,33.6,33.64,33.47,33.54,10469019.0 +2017-10-13,33.4,33.57,33.323,33.47,13451108.0,0.0,1.0,33.4,33.57,33.323,33.47,13451108.0 +2017-10-12,33.26,33.46,33.17,33.26,17811160.0,0.0,1.0,33.26,33.46,33.17,33.26,17811160.0 +2017-10-11,33.38,33.63,33.25,33.59,12353462.0,0.0,1.0,33.38,33.63,33.25,33.59,12353462.0 +2017-10-10,33.88,33.91,33.47,33.55,17978700.0,0.0,1.0,33.88,33.91,33.47,33.55,17978700.0 +2017-10-09,33.77,33.89,33.61,33.76,8684822.0,0.0,1.0,33.77,33.89,33.61,33.76,8684822.0 +2017-10-06,33.65,33.78,33.5247,33.75,13438950.0,0.0,1.0,33.65,33.78,33.5247,33.75,13438950.0 +2017-10-05,33.58,33.67,33.41,33.59,14301206.0,0.0,1.0,33.58,33.67,33.41,33.59,14301206.0 +2017-10-04,33.53,33.56,33.29,33.44,14606016.0,0.29,1.0,33.53,33.56,33.29,33.44,14606016.0 +2017-10-03,33.72,33.9,33.61,33.85,13159079.0,0.0,1.0,33.430085976875,33.608538393122,33.321031722502,33.558968277498,13159079.0 +2017-10-02,33.61,33.77,33.52,33.75,16443224.0,0.0,1.0,33.321031722502,33.479656092499,33.231805514379,33.45982804625,16443224.0 +2017-09-29,33.31,33.67,33.24,33.63,14419404.0,0.0,1.0,33.023611028758,33.380515861251,32.954212866884,33.340859768752,14419404.0 +2017-09-28,33.22,33.46,33.22,33.35,14689819.0,0.0,1.0,32.934384820634,33.17232137563,32.934384820634,33.063267121257,14689819.0 +2017-09-27,33.78,33.92,33.3037,33.48,21687593.0,0.0,1.0,33.489570115624,33.628366439371,33.017365194189,33.19214942188,21687593.0 +2017-09-26,33.76,34.1,33.67,33.76,25835270.0,0.0,1.0,33.469742069374,33.806818855618,33.380515861251,33.469742069374,25835270.0 +2017-09-25,33.31,33.84,33.2,33.72,30475969.0,0.0,1.0,33.023611028758,33.549054254373,32.914556774385,33.430085976875,30475969.0 +2017-09-22,32.66,33.53,32.64,33.37,27904695.0,0.0,1.0,32.379199525645,33.241719537504,32.359371479395,33.083095167507,27904695.0 +2017-09-21,32.72,32.9,32.5,32.7,19762651.0,0.0,1.0,32.438683664394,32.61713608064,32.220575155648,32.418855618144,19762651.0 +2017-09-20,32.55,32.75,32.39,32.6,18701702.0,0.0,1.0,32.270145271272,32.468425733768,32.111520901275,32.319715386896,18701702.0 +2017-09-19,32.46,32.65,32.395,32.49,12424056.0,0.0,1.0,32.180919063149,32.36928550252,32.116477912837,32.210661132523,12424056.0 +2017-09-18,32.43,32.66,32.26,32.52,17035443.0,0.0,1.0,32.151176993774,32.379199525645,31.982638600652,32.240403201897,17035443.0 +2017-09-15,32.2,32.5,32.12,32.44,27708447.0,0.0,1.0,31.923154461903,32.220575155648,31.843842276905,32.161091016899,27708447.0 +2017-09-14,31.91,32.22,31.91,32.19,17711003.0,0.0,1.0,31.635647791284,31.942982508153,31.635647791284,31.913240438779,17711003.0 +2017-09-13,32.34,32.39,31.96,32.18,21872095.0,0.0,1.0,32.061950785651,32.111520901275,31.685217906908,31.903326415654,21872095.0 +2017-09-12,32.3,32.47,32.19,32.41,18510454.0,0.0,1.0,32.022294693151,32.190833086273,31.913240438779,32.131348947524,18510454.0 +2017-09-11,31.71,32.3,31.67,32.205,21365590.0,0.0,1.0,31.437367328787,32.022294693151,31.397711236288,31.928111473466,21365590.0 +2017-09-08,31.68,31.78,31.46,31.48,15115756.0,0.0,1.0,31.407625259413,31.506765490661,31.189516750667,31.209344796917,15115756.0 +2017-09-07,31.96,31.97,31.74,31.76,14611809.0,0.0,1.0,31.685217906908,31.695131930033,31.467109398162,31.486937444412,14611809.0 +2017-09-06,31.75,31.91,31.63,31.87,16380030.0,0.0,1.0,31.477023421287,31.635647791284,31.358055143789,31.595991698784,16380030.0 +2017-09-05,32.15,32.245,31.455,31.62,24327663.0,0.0,1.0,31.873584346279,31.967767565965,31.184559739105,31.348141120664,24327663.0 +2017-09-01,32.22,32.345,32.03,32.32,14661162.0,0.0,1.0,31.942982508153,32.066907797213,31.754616068782,32.042122739401,14661162.0 +2017-08-31,32.1,32.34,31.99,32.21,27138172.0,0.0,1.0,31.824014230655,32.061950785651,31.714959976282,31.933068485028,27138172.0 +2017-08-30,31.47,32.2,31.42,31.99,23028578.0,0.0,1.0,31.199430773792,31.923154461903,31.149860658168,31.714959976282,23028578.0 +2017-08-29,31.26,31.6299,31.19,31.48,16192694.0,0.0,1.0,30.991236288171,31.357956003558,30.921838126297,31.209344796917,16192694.0 +2017-08-28,31.6,31.66,31.41,31.54,12747867.0,0.0,1.0,31.328313074414,31.387797213163,31.139946635043,31.268828935666,12747867.0 +2017-08-25,31.39,31.8,31.36,31.44,19351094.0,0.0,1.0,31.120118588793,31.526593536911,31.090376519419,31.169688704417,19351094.0 +2017-08-24,30.95,31.4,30.9,31.24,21867401.0,0.0,1.0,30.683901571302,31.130032611918,30.634331455677,30.971408241921,21867401.0 +2017-08-23,31.21,31.4,30.91,30.92,22269978.0,0.0,1.0,30.941666172547,31.130032611918,30.644245478802,30.654159501927,22269978.0 +2017-08-22,30.85,31.33,30.75,31.27,24438367.0,0.0,1.0,30.584761340053,31.060634450044,30.485621108805,31.001150311296,24438367.0 +2017-08-21,30.37,30.795,30.36,30.68,24025228.0,0.0,1.0,30.108888230062,30.530234212867,30.098974206937,30.416222946932,24025228.0 +2017-08-18,31.0,31.06,30.36,30.37,34622147.0,0.0,1.0,30.733471686926,30.792955825674,30.098974206937,30.108888230062,34622147.0 +2017-08-17,31.49,31.77,30.85,31.04,51557052.0,0.0,1.0,31.219258820042,31.496851467536,30.584761340053,30.773127779425,51557052.0 +2017-08-16,32.1,32.4652,32.06,32.34,27088237.0,0.0,1.0,31.824014230655,32.186074355173,31.784358138156,32.061950785651,27088237.0 +2017-08-15,31.85,32.21,31.84,32.09,24406258.0,0.0,1.0,31.576163652535,31.933068485028,31.56624962941,31.81410020753,24406258.0 +2017-08-14,31.69,31.89,31.56,31.84,21605411.0,0.0,1.0,31.417539282538,31.615819745034,31.288656981915,31.56624962941,21605411.0 +2017-08-11,31.23,31.545,31.04,31.47,20521935.0,0.0,1.0,30.961494218796,31.273785947228,30.773127779425,31.199430773792,20521935.0 +2017-08-10,31.56,31.56,31.0,31.0,22748854.0,0.0,1.0,31.288656981915,31.288656981915,30.733471686926,30.733471686926,22748854.0 +2017-08-09,31.55,31.675,31.36,31.62,15931711.0,0.0,1.0,31.27874295879,31.402668247851,31.090376519419,31.348141120664,15931711.0 +2017-08-08,31.75,32.0,31.6,31.67,13632423.0,0.0,1.0,31.477023421287,31.724873999407,31.328313074414,31.397711236288,13632423.0 +2017-08-07,31.79,31.8799,31.69,31.84,11730203.0,0.0,1.0,31.516679513786,31.605806581678,31.417539282538,31.56624962941,11730203.0 +2017-08-04,31.67,31.91,31.58,31.8,16322686.0,0.0,1.0,31.397711236288,31.635647791284,31.308485028165,31.526593536911,16322686.0 +2017-08-03,31.59,31.72,31.43,31.56,13884046.0,0.0,1.0,31.31839905129,31.447281351912,31.159774681293,31.288656981915,13884046.0 +2017-08-02,31.57,31.57,31.25,31.52,15797711.0,0.0,1.0,31.29857100504,31.29857100504,30.981322265046,31.249000889416,15797711.0 +2017-08-01,31.59,31.66,31.43,31.65,12727298.0,0.0,1.0,31.31839905129,31.387797213163,31.159774681293,31.377883190039,12727298.0 +2017-07-31,31.54,31.59,31.37,31.45,18534978.0,0.0,1.0,31.268828935666,31.31839905129,31.100290542544,31.179602727542,18534978.0 +2017-07-28,31.45,31.6,31.26,31.52,15509841.0,0.0,1.0,31.179602727542,31.328313074414,30.991236288171,31.249000889416,15509841.0 +2017-07-27,31.73,31.7502,31.21,31.57,21224338.0,0.0,1.0,31.457195375037,31.477221701749,30.941666172547,31.29857100504,21224338.0 +2017-07-26,32.12,32.225,31.51,31.66,21472799.0,0.0,1.0,31.843842276905,31.947939519715,31.239086866291,31.387797213163,21472799.0 +2017-07-25,31.9,32.25,31.88,32.12,14848920.0,0.0,1.0,31.625733768159,31.972724577527,31.605905721909,31.843842276905,14848920.0 +2017-07-24,31.86,31.925,31.66,31.86,15232167.0,0.0,1.0,31.58607767566,31.650518825971,31.387797213163,31.58607767566,15232167.0 +2017-07-21,31.86,32.03,31.705,31.84,13271427.0,0.0,1.0,31.58607767566,31.754616068782,31.432410317225,31.56624962941,13271427.0 +2017-07-20,31.91,32.05,31.76,31.86,15917114.0,0.0,1.0,31.635647791284,31.774444115031,31.486937444412,31.58607767566,15917114.0 +2017-07-19,31.51,32.05,31.46,31.9,21369697.0,0.0,1.0,31.239086866291,31.774444115031,31.189516750667,31.625733768159,21369697.0 +2017-07-18,31.41,31.51,31.17,31.51,15366450.0,0.0,1.0,31.139946635043,31.239086866291,30.902010080047,31.239086866291,15366450.0 +2017-07-17,31.5,31.635,31.45,31.5,16012951.0,0.0,1.0,31.229172843166,31.363012155351,31.179602727542,31.229172843166,16012951.0 +2017-07-14,31.37,31.45,31.27,31.42,13261554.0,0.0,1.0,31.100290542544,31.179602727542,31.001150311296,31.149860658168,13261554.0 +2017-07-13,31.26,31.28,31.08,31.27,15870454.0,0.0,1.0,30.991236288171,31.01106433442,30.812783871924,31.001150311296,15870454.0 +2017-07-12,31.25,31.44,31.145,31.16,18428809.0,0.0,1.0,30.981322265046,31.169688704417,30.877225022235,30.892096056923,18428809.0 +2017-07-11,31.05,31.12,30.86,31.09,12253478.0,0.0,1.0,30.78304180255,30.852439964423,30.594675363178,30.822697895049,12253478.0 +2017-07-10,30.88,31.09,30.82,30.98,15193572.0,0.0,1.0,30.614503409428,30.822697895049,30.555019270679,30.713643640676,15193572.0 +2017-07-07,30.76,31.07,30.75,30.9,15221015.0,0.0,1.0,30.49553513193,30.802869848799,30.485621108805,30.634331455677,15221015.0 +2017-07-06,30.99,31.02,30.67,30.725,20456451.0,0.0,1.0,30.723557663801,30.753299733175,30.406308923807,30.460836050993,20456451.0 +2017-07-05,30.85,31.27,30.73,31.11,23391894.0,0.29,1.0,30.584761340053,31.001150311296,30.465793062556,30.842525941299,23391894.0 +2017-07-03,31.09,31.64,31.03,31.33,14111474.0,0.0,1.0,30.538029666082,31.078264993079,30.479094903137,30.773768717863,14111474.0 +2017-06-30,31.79,31.79,31.3,31.3,22981379.0,0.0,1.0,31.225601900442,31.225601900442,30.74430133639,30.74430133639,22981379.0 +2017-06-29,31.79,32.025,31.25,31.41,26891695.0,0.0,1.0,31.225601900442,31.456429721977,30.695189033936,30.852348401789,26891695.0 +2017-06-28,31.78,32.275,31.76,32.08,17587686.0,0.0,1.0,31.215779439951,31.701991234249,31.196134518969,31.510453254677,17587686.0 +2017-06-27,32.09,32.26,31.76,31.76,23092594.0,0.0,1.0,31.520275715168,31.687257543512,31.196134518969,31.196134518969,23092594.0 +2017-06-26,32.22,32.5,32.18,32.24,21409287.0,0.0,1.0,31.647967701549,31.922996595293,31.608677859586,31.667612622531,21409287.0 +2017-06-23,31.85,32.3,31.75,32.1,23006424.0,0.0,1.0,31.284536663387,31.726547385476,31.186312058479,31.530098175659,23006424.0 +2017-06-22,31.91,32.0,31.7,31.85,19194637.0,0.0,1.0,31.343471426332,31.43187357075,31.137199756024,31.284536663387,19194637.0 +2017-06-21,31.73,31.87,31.51,31.84,20103067.0,0.0,1.0,31.166667137497,31.304181584369,30.950573006698,31.274714202896,20103067.0 +2017-06-20,31.94,32.16,31.84,31.85,17859664.0,0.0,1.0,31.372938807805,31.589032938604,31.274714202896,31.284536663387,17859664.0 +2017-06-19,31.77,32.02,31.581,31.99,16753701.0,0.0,1.0,31.20595697946,31.451518491732,31.020312476183,31.422051110259,16753701.0 +2017-06-16,31.61,31.64,31.2,31.6201,33785850.0,0.0,1.0,31.048797611607,31.078264993079,30.646076731481,31.058718296702,33785850.0 +2017-06-15,31.25,31.64,31.22,31.5801,19110962.0,0.0,1.0,30.695189033936,31.078264993079,30.665721652463,31.019428454739,19110962.0 +2017-06-14,31.87,31.97,31.33,31.6,24850713.0,0.0,1.0,31.304181584369,31.402406189278,30.773768717863,31.038975151116,24850713.0 +2017-06-13,31.3,31.8,31.28,31.7,27251001.0,0.0,1.0,30.74430133639,31.235424360933,30.724656415408,31.137199756024,27251001.0 +2017-06-12,31.34,31.64,31.15,31.245,24330382.0,0.0,1.0,30.783591178353,31.078264993079,30.596964429027,30.69027780369,24330382.0 +2017-06-09,31.64,31.83,31.085,31.37,25031675.0,0.0,1.0,31.078264993079,31.264891742406,30.533118435836,30.813058559826,25031675.0 +2017-06-08,31.53,31.81,31.52,31.615,19877271.0,0.0,1.0,30.97021792768,31.245246821424,30.960395467189,31.053708841852,19877271.0 +2017-06-07,31.61,31.72,31.44,31.61,14417549.0,0.0,1.0,31.048797611607,31.156844677006,30.881815783262,31.048797611607,14417549.0 +2017-06-06,31.75,31.76,31.5,31.56,15987734.0,0.0,1.0,31.186312058479,31.196134518969,30.940750546207,30.999685309152,15987734.0 +2017-06-05,32.05,32.05,31.57,31.76,15581429.0,0.0,1.0,31.480985873204,31.480985873204,31.009507769643,31.196134518969,15581429.0 +2017-06-02,31.93,32.06,31.68,31.98,19978713.0,0.0,1.0,31.363116347314,31.490808333695,31.117554835043,31.412228649768,19978713.0 +2017-06-01,31.52,31.82,31.47,31.82,15397418.0,0.0,1.0,30.960395467189,31.255069281915,30.911283164735,31.255069281915,15397418.0 diff --git a/examples/demos/stocqt/content/data/EA.csv b/examples/demos/stocqt/content/data/EA.csv new file mode 100644 index 000000000..ad6a60fc7 --- /dev/null +++ b/examples/demos/stocqt/content/data/EA.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,105.29,105.68,104.39,105.06,2033331.0,0.0,1.0,105.29,105.68,104.39,105.06,2033331.0 +2017-12-28,105.29,105.55,104.55,105.31,1431096.0,0.0,1.0,105.29,105.55,104.55,105.31,1431096.0 +2017-12-27,105.4,106.44,104.58,105.23,2427713.0,0.0,1.0,105.4,106.44,104.58,105.23,2427713.0 +2017-12-26,105.66,106.02,104.65,105.06,1685265.0,0.0,1.0,105.66,106.02,104.65,105.06,1685265.0 +2017-12-22,108.31,108.31,105.675,106.02,2401349.0,0.0,1.0,108.31,108.31,105.675,106.02,2401349.0 +2017-12-21,107.88,108.735,107.78,107.97,2784216.0,0.0,1.0,107.88,108.735,107.78,107.97,2784216.0 +2017-12-20,107.5,108.87,107.15,108.45,2642416.0,0.0,1.0,107.5,108.87,107.15,108.45,2642416.0 +2017-12-19,107.42,107.7558,106.69,107.0,1985332.0,0.0,1.0,107.42,107.7558,106.69,107.0,1985332.0 +2017-12-18,109.89,110.0,106.56,107.34,4241871.0,0.0,1.0,109.89,110.0,106.56,107.34,4241871.0 +2017-12-15,107.77,109.68,106.63,109.28,5755867.0,0.0,1.0,107.77,109.68,106.63,109.28,5755867.0 +2017-12-14,105.2,107.62,104.7,106.42,2580582.0,0.0,1.0,105.2,107.62,104.7,106.42,2580582.0 +2017-12-13,107.71,108.31,105.22,105.54,3730504.0,0.0,1.0,107.71,108.31,105.22,105.54,3730504.0 +2017-12-12,108.0,108.92,107.02,107.66,3512468.0,0.0,1.0,108.0,108.92,107.02,107.66,3512468.0 +2017-12-11,105.61,108.16,105.0,107.92,3271833.0,0.0,1.0,105.61,108.16,105.0,107.92,3271833.0 +2017-12-08,104.49,106.4,104.42,105.27,3194502.0,0.0,1.0,104.49,106.4,104.42,105.27,3194502.0 +2017-12-07,103.23,105.6,102.75,104.37,3486643.0,0.0,1.0,103.23,105.6,102.75,104.37,3486643.0 +2017-12-06,102.96,103.92,100.41,103.18,4441608.0,0.0,1.0,102.96,103.92,100.41,103.18,4441608.0 +2017-12-05,100.55,105.1926,99.63,103.38,4454836.0,0.0,1.0,100.55,105.1926,99.63,103.38,4454836.0 +2017-12-04,105.53,105.875,100.68,100.83,6476227.0,0.0,1.0,105.53,105.875,100.68,100.83,6476227.0 +2017-12-01,105.86,106.87,103.95,106.02,3810130.0,0.0,1.0,105.86,106.87,103.95,106.02,3810130.0 +2017-11-30,106.11,106.5,105.06,106.35,5338599.0,0.0,1.0,106.11,106.5,105.06,106.35,5338599.0 +2017-11-29,109.21,109.39,104.95,105.49,5484734.0,0.0,1.0,109.21,109.39,104.95,105.49,5484734.0 +2017-11-28,106.99,110.52,106.74,109.47,5362601.0,0.0,1.0,106.99,110.52,106.74,109.47,5362601.0 +2017-11-27,107.86,108.285,106.79,106.99,2398540.0,0.0,1.0,107.86,108.285,106.79,106.99,2398540.0 +2017-11-24,107.66,108.58,107.59,107.94,1306290.0,0.0,1.0,107.66,108.58,107.59,107.94,1306290.0 +2017-11-22,108.04,108.44,106.61,107.32,2512190.0,0.0,1.0,108.04,108.44,106.61,107.32,2512190.0 +2017-11-21,107.78,108.7699,107.54,107.71,3089096.0,0.0,1.0,107.78,108.7699,107.54,107.71,3089096.0 +2017-11-20,108.28,108.45,106.75,107.64,5948591.0,0.0,1.0,108.28,108.45,106.75,107.64,5948591.0 +2017-11-17,108.99,109.55,107.5,108.82,8476713.0,0.0,1.0,108.99,109.55,107.5,108.82,8476713.0 +2017-11-16,111.85,113.13,111.21,111.6,2308873.0,0.0,1.0,111.85,113.13,111.21,111.6,2308873.0 +2017-11-15,112.72,112.87,110.52,111.48,2483272.0,0.0,1.0,112.72,112.87,110.52,111.48,2483272.0 +2017-11-14,110.6,113.9,110.39,112.27,3554816.0,0.0,1.0,110.6,113.9,110.39,112.27,3554816.0 +2017-11-13,112.0,113.24,111.19,112.01,3157879.0,0.0,1.0,112.0,113.24,111.19,112.01,3157879.0 +2017-11-10,111.26,112.83,110.82,112.75,2515313.0,0.0,1.0,111.26,112.83,110.82,112.75,2515313.0 +2017-11-09,112.99,113.3,110.94,111.89,3331403.0,0.0,1.0,112.99,113.3,110.94,111.89,3331403.0 +2017-11-07,112.29,112.72,110.08,111.7,2671700.0,0.0,1.0,112.29,112.72,110.08,111.7,2671700.0 +2017-11-06,112.99,113.5,110.76,112.46,3571671.0,0.0,1.0,112.99,113.5,110.76,112.46,3571671.0 +2017-11-03,113.47,113.76,112.57,113.2,2859092.0,0.0,1.0,113.47,113.76,112.57,113.2,2859092.0 +2017-11-02,114.35,114.52,112.6,112.69,3405672.0,0.0,1.0,114.35,114.52,112.6,112.69,3405672.0 +2017-11-01,116.0,116.6,111.28,114.47,9639100.0,0.0,1.0,116.0,116.6,111.28,114.47,9639100.0 +2017-10-31,118.125,119.84,116.37,119.6,4762517.0,0.0,1.0,118.125,119.84,116.37,119.6,4762517.0 +2017-10-30,117.13,117.77,116.64,117.58,2599653.0,0.0,1.0,117.13,117.77,116.64,117.58,2599653.0 +2017-10-27,116.83,117.55,115.41,116.89,2883562.0,0.0,1.0,116.83,117.55,115.41,116.89,2883562.0 +2017-10-26,115.07,117.06,115.02,115.83,2443955.0,0.0,1.0,115.07,117.06,115.02,115.83,2443955.0 +2017-10-25,113.2,114.88,112.59,114.56,2963441.0,0.0,1.0,113.2,114.88,112.59,114.56,2963441.0 +2017-10-24,113.68,114.72,112.763,113.39,1847039.0,0.0,1.0,113.68,114.72,112.763,113.39,1847039.0 +2017-10-23,113.81,114.43,112.73,113.68,2060904.0,0.0,1.0,113.81,114.43,112.73,113.68,2060904.0 +2017-10-20,113.6,114.28,113.15,113.62,1921562.0,0.0,1.0,113.6,114.28,113.15,113.62,1921562.0 +2017-10-19,112.0,113.08,111.12,113.07,3023265.0,0.0,1.0,112.0,113.08,111.12,113.07,3023265.0 +2017-10-18,113.41,113.75,110.31,113.16,9671971.0,0.0,1.0,113.41,113.75,110.31,113.16,9671971.0 +2017-10-17,117.2,118.15,115.63,115.98,3116041.0,0.0,1.0,117.2,118.15,115.63,115.98,3116041.0 +2017-10-16,118.81,119.0,117.05,117.48,2581184.0,0.0,1.0,118.81,119.0,117.05,117.48,2581184.0 +2017-10-13,117.76,118.92,117.55,118.62,1883150.0,0.0,1.0,117.76,118.92,117.55,118.62,1883150.0 +2017-10-12,115.97,117.78,115.7701,117.14,2031131.0,0.0,1.0,115.97,117.78,115.7701,117.14,2031131.0 +2017-10-11,117.33,118.0,115.52,116.05,2917782.0,0.0,1.0,117.33,118.0,115.52,116.05,2917782.0 +2017-10-10,119.03,119.49,116.71,117.82,1511975.0,0.0,1.0,119.03,119.49,116.71,117.82,1511975.0 +2017-10-09,119.24,119.3,117.67,118.62,1513237.0,0.0,1.0,119.24,119.3,117.67,118.62,1513237.0 +2017-10-06,119.03,120.29,118.44,120.09,1503375.0,0.0,1.0,119.03,120.29,118.44,120.09,1503375.0 +2017-10-05,118.63,119.75,117.93,119.52,1430493.0,0.0,1.0,118.63,119.75,117.93,119.52,1430493.0 +2017-10-04,117.52,118.75,116.41,118.56,1587004.0,0.0,1.0,117.52,118.75,116.41,118.56,1587004.0 +2017-10-03,117.92,118.1,116.76,117.96,1227392.0,0.0,1.0,117.92,118.1,116.76,117.96,1227392.0 +2017-10-02,118.89,119.72,116.94,117.95,1822193.0,0.0,1.0,118.89,119.72,116.94,117.95,1822193.0 +2017-09-29,116.71,118.17,116.3,118.06,1730832.0,0.0,1.0,116.71,118.17,116.3,118.06,1730832.0 +2017-09-28,115.82,116.79,115.24,116.61,1395076.0,0.0,1.0,115.82,116.79,115.24,116.61,1395076.0 +2017-09-27,115.4,116.65,115.4,115.97,1728987.0,0.0,1.0,115.4,116.65,115.4,115.97,1728987.0 +2017-09-26,114.5,114.67,112.833,113.92,2886349.0,0.0,1.0,114.5,114.67,112.833,113.92,2886349.0 +2017-09-25,118.05,118.29,112.85,114.2,4019941.0,0.0,1.0,118.05,118.29,112.85,114.2,4019941.0 +2017-09-22,117.46,120.18,117.15,118.5,2074145.0,0.0,1.0,117.46,120.18,117.15,118.5,2074145.0 +2017-09-21,120.49,120.49,117.82,118.02,1857324.0,0.0,1.0,120.49,120.49,117.82,118.02,1857324.0 +2017-09-20,120.77,121.4,118.74,120.34,2290740.0,0.0,1.0,120.77,121.4,118.74,120.34,2290740.0 +2017-09-19,120.25,121.2,119.37,120.21,2147853.0,0.0,1.0,120.25,121.2,119.37,120.21,2147853.0 +2017-09-18,119.5,120.87,119.5,119.96,2562195.0,0.0,1.0,119.5,120.87,119.5,119.96,2562195.0 +2017-09-15,119.29,119.915,117.75,119.42,3161686.0,0.0,1.0,119.29,119.915,117.75,119.42,3161686.0 +2017-09-14,118.74,119.66,117.71,119.19,2453409.0,0.0,1.0,118.74,119.66,117.71,119.19,2453409.0 +2017-09-13,119.86,120.45,119.0,119.6,2468517.0,0.0,1.0,119.86,120.45,119.0,119.6,2468517.0 +2017-09-12,121.61,122.125,118.675,120.41,2568453.0,0.0,1.0,121.61,122.125,118.675,120.41,2568453.0 +2017-09-11,119.88,121.35,119.28,121.19,2184608.0,0.0,1.0,119.88,121.35,119.28,121.19,2184608.0 +2017-09-08,119.99,120.16,117.71,118.28,2334882.0,0.0,1.0,119.99,120.16,117.71,118.28,2334882.0 +2017-09-07,117.2,119.1,116.59,118.93,1717120.0,0.0,1.0,117.2,119.1,116.59,118.93,1717120.0 +2017-09-06,118.77,119.15,116.47,117.0,1711537.0,0.0,1.0,118.77,119.15,116.47,117.0,1711537.0 +2017-09-05,118.8,119.3,116.32,118.21,2269814.0,0.0,1.0,118.8,119.3,116.32,118.21,2269814.0 +2017-09-01,121.27,121.77,118.51,119.31,2696421.0,0.0,1.0,121.27,121.77,118.51,119.31,2696421.0 +2017-08-31,122.0,122.79,120.94,121.5,2580446.0,0.0,1.0,122.0,122.79,120.94,121.5,2580446.0 +2017-08-30,119.42,122.08,119.065,121.97,2097613.0,0.0,1.0,119.42,122.08,119.065,121.97,2097613.0 +2017-08-29,117.47,119.43,117.2201,119.23,1223068.0,0.0,1.0,117.47,119.43,117.2201,119.23,1223068.0 +2017-08-28,117.52,119.04,116.95,118.73,1756217.0,0.0,1.0,117.52,119.04,116.95,118.73,1756217.0 +2017-08-25,118.19,118.71,115.71,116.93,2155476.0,0.0,1.0,118.19,118.71,115.71,116.93,2155476.0 +2017-08-24,118.49,118.92,116.0,117.82,1303354.0,0.0,1.0,118.49,118.92,116.0,117.82,1303354.0 +2017-08-23,118.65,119.37,117.55,118.18,1235965.0,0.0,1.0,118.65,119.37,117.55,118.18,1235965.0 +2017-08-22,117.28,120.45,117.22,119.03,2476188.0,0.0,1.0,117.28,120.45,117.22,119.03,2476188.0 +2017-08-21,116.85,117.4,116.12,116.84,1479440.0,0.0,1.0,116.85,117.4,116.12,116.84,1479440.0 +2017-08-18,116.0,117.84,115.46,116.88,1906661.0,0.0,1.0,116.0,117.84,115.46,116.88,1906661.0 +2017-08-17,119.19,119.4745,116.46,116.47,1755405.0,0.0,1.0,119.19,119.4745,116.46,116.47,1755405.0 +2017-08-16,117.49,119.59,117.03,119.25,2039136.0,0.0,1.0,117.49,119.59,117.03,119.25,2039136.0 +2017-08-15,117.23,117.62,116.58,117.43,1036988.0,0.0,1.0,117.23,117.62,116.58,117.43,1036988.0 +2017-08-14,116.71,118.0,116.4,117.11,2858947.0,0.0,1.0,116.71,118.0,116.4,117.11,2858947.0 +2017-08-11,113.74,115.98,113.51,115.45,1541337.0,0.0,1.0,113.74,115.98,113.51,115.45,1541337.0 +2017-08-10,115.41,115.715,113.69,113.99,2591680.0,0.0,1.0,115.41,115.715,113.69,113.99,2591680.0 +2017-08-09,115.55,116.84,114.75,116.11,1572284.0,0.0,1.0,115.55,116.84,114.75,116.11,1572284.0 +2017-08-08,116.5,117.13,116.02,116.5,1298672.0,0.0,1.0,116.5,117.13,116.02,116.5,1298672.0 +2017-08-07,117.6,117.96,116.49,116.96,1878689.0,0.0,1.0,117.6,117.96,116.49,116.96,1878689.0 +2017-08-04,119.15,119.18,116.9,117.22,2329950.0,0.0,1.0,119.15,119.18,116.9,117.22,2329950.0 +2017-08-03,117.38,119.23,116.98,118.85,2807213.0,0.0,1.0,117.38,119.23,116.98,118.85,2807213.0 +2017-08-02,117.11,117.42,113.83,116.83,3035692.0,0.0,1.0,117.11,117.42,113.83,116.83,3035692.0 +2017-08-01,117.57,117.65,116.44,116.92,2434299.0,0.0,1.0,117.57,117.65,116.44,116.92,2434299.0 +2017-07-31,119.05,119.25,116.5,116.74,2874265.0,0.0,1.0,119.05,119.25,116.5,116.74,2874265.0 +2017-07-28,114.0,118.75,113.5,118.25,4996998.0,0.0,1.0,114.0,118.75,113.5,118.25,4996998.0 +2017-07-27,119.01,120.25,116.06,117.6,8804997.0,0.0,1.0,119.01,120.25,116.06,117.6,8804997.0 +2017-07-26,115.46,118.11,115.19,118.0,4476211.0,0.0,1.0,115.46,118.11,115.19,118.0,4476211.0 +2017-07-25,113.97,114.52,113.31,113.66,2731441.0,0.0,1.0,113.97,114.52,113.31,113.66,2731441.0 +2017-07-24,112.22,113.97,112.22,113.75,2719644.0,0.0,1.0,112.22,113.97,112.22,113.75,2719644.0 +2017-07-21,111.5,112.91,111.27,112.22,2412908.0,0.0,1.0,111.5,112.91,111.27,112.22,2412908.0 +2017-07-20,111.61,112.18,110.38,111.97,2137684.0,0.0,1.0,111.61,112.18,110.38,111.97,2137684.0 +2017-07-19,110.43,111.65,109.81,111.58,2306302.0,0.0,1.0,110.43,111.65,109.81,111.58,2306302.0 +2017-07-18,110.0,110.93,109.48,110.28,1902014.0,0.0,1.0,110.0,110.93,109.48,110.28,1902014.0 +2017-07-17,109.02,110.43,108.715,109.44,1600888.0,0.0,1.0,109.02,110.43,108.715,109.44,1600888.0 +2017-07-14,109.61,110.34,108.75,108.99,1319830.0,0.0,1.0,109.61,110.34,108.75,108.99,1319830.0 +2017-07-13,110.83,111.61,108.92,108.98,1705243.0,0.0,1.0,110.83,111.61,108.92,108.98,1705243.0 +2017-07-12,109.5,110.9,109.05,110.68,1929711.0,0.0,1.0,109.5,110.9,109.05,110.68,1929711.0 +2017-07-11,107.63,109.71,107.1001,108.42,2254636.0,0.0,1.0,107.63,109.71,107.1001,108.42,2254636.0 +2017-07-10,107.84,108.69,107.01,107.84,1829832.0,0.0,1.0,107.84,108.69,107.01,107.84,1829832.0 +2017-07-07,106.28,108.47,105.54,107.45,2113210.0,0.0,1.0,106.28,108.47,105.54,107.45,2113210.0 +2017-07-06,106.06,107.12,105.5,105.75,2418406.0,0.0,1.0,106.06,107.12,105.5,105.75,2418406.0 +2017-07-05,105.95,107.31,105.35,106.76,2790438.0,0.0,1.0,105.95,107.31,105.35,106.76,2790438.0 +2017-07-03,106.51,107.0,105.21,105.42,1656433.0,0.0,1.0,106.51,107.0,105.21,105.42,1656433.0 +2017-06-30,107.1,107.56,105.65,105.72,3193822.0,0.0,1.0,107.1,107.56,105.65,105.72,3193822.0 +2017-06-29,108.16,108.72,105.47,106.68,3801546.0,0.0,1.0,108.16,108.72,105.47,106.68,3801546.0 +2017-06-28,108.7,109.2,106.74,108.81,3666366.0,0.0,1.0,108.7,109.2,106.74,108.81,3666366.0 +2017-06-27,111.35,111.93,108.13,108.32,3051541.0,0.0,1.0,111.35,111.93,108.13,108.32,3051541.0 +2017-06-26,111.0,112.64,110.375,111.86,2433287.0,0.0,1.0,111.0,112.64,110.375,111.86,2433287.0 +2017-06-23,112.51,112.95,110.77,110.83,5488299.0,0.0,1.0,112.51,112.95,110.77,110.83,5488299.0 +2017-06-22,113.51,113.52,111.36,112.62,2233674.0,0.0,1.0,113.51,113.52,111.36,112.62,2233674.0 +2017-06-21,114.33,114.69,111.83,113.17,3048981.0,0.0,1.0,114.33,114.69,111.83,113.17,3048981.0 +2017-06-20,113.43,115.12,113.29,113.47,2694325.0,0.0,1.0,113.43,115.12,113.29,113.47,2694325.0 +2017-06-19,111.18,113.86,111.18,113.65,2863975.0,0.0,1.0,111.18,113.86,111.18,113.65,2863975.0 +2017-06-16,110.72,112.51,110.07,110.51,9457081.0,0.0,1.0,110.72,112.51,110.07,110.51,9457081.0 +2017-06-15,108.24,111.03,107.32,110.53,3062302.0,0.0,1.0,108.24,111.03,107.32,110.53,3062302.0 +2017-06-14,110.16,111.11,108.68,110.02,2161626.0,0.0,1.0,110.16,111.11,108.68,110.02,2161626.0 +2017-06-13,110.33,110.96,108.08,109.98,2727219.0,0.0,1.0,110.33,110.96,108.08,109.98,2727219.0 +2017-06-12,109.3,111.175,105.54,108.9,5802602.0,0.0,1.0,109.3,111.175,105.54,108.9,5802602.0 +2017-06-09,114.84,115.36,107.03,110.46,5712259.0,0.0,1.0,114.84,115.36,107.03,110.46,5712259.0 +2017-06-08,116.04,116.04,113.24,114.29,3268285.0,0.0,1.0,116.04,116.04,113.24,114.29,3268285.0 +2017-06-07,114.84,115.54,114.23,115.37,2466012.0,0.0,1.0,114.84,115.54,114.23,115.37,2466012.0 +2017-06-06,114.54,115.39,113.59,113.69,2492255.0,0.0,1.0,114.54,115.39,113.59,113.69,2492255.0 +2017-06-05,114.68,115.13,114.19,114.69,1858473.0,0.0,1.0,114.68,115.13,114.19,114.69,1858473.0 +2017-06-02,113.85,114.54,113.2,114.52,1867350.0,0.0,1.0,113.85,114.54,113.2,114.52,1867350.0 +2017-06-01,113.96,114.94,113.175,113.87,2226980.0,0.0,1.0,113.96,114.94,113.175,113.87,2226980.0 diff --git a/examples/demos/stocqt/content/data/EBAY.csv b/examples/demos/stocqt/content/data/EBAY.csv new file mode 100644 index 000000000..925448979 --- /dev/null +++ b/examples/demos/stocqt/content/data/EBAY.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,37.82,38.03,37.65,37.74,4476821.0,0.0,1.0,37.82,38.03,37.65,37.74,4476821.0 +2017-12-28,37.46,37.93,37.4501,37.92,3379374.0,0.0,1.0,37.46,37.93,37.4501,37.92,3379374.0 +2017-12-27,38.07,38.08,37.56,37.61,4091574.0,0.0,1.0,38.07,38.08,37.56,37.61,4091574.0 +2017-12-26,37.79,38.01,37.605,37.94,4493535.0,0.0,1.0,37.79,38.01,37.605,37.94,4493535.0 +2017-12-22,37.69,37.905,37.53,37.76,7145144.0,0.0,1.0,37.69,37.905,37.53,37.76,7145144.0 +2017-12-21,38.11,38.24,37.77,37.81,9594664.0,0.0,1.0,38.11,38.24,37.77,37.81,9594664.0 +2017-12-20,37.87,38.1,37.745,37.93,6480341.0,0.0,1.0,37.87,38.1,37.745,37.93,6480341.0 +2017-12-19,38.15,38.23,37.72,37.82,7711342.0,0.0,1.0,38.15,38.23,37.72,37.82,7711342.0 +2017-12-18,38.5,38.66,38.12,38.18,7566184.0,0.0,1.0,38.5,38.66,38.12,38.18,7566184.0 +2017-12-15,37.72,38.42,37.39,38.37,12791334.0,0.0,1.0,37.72,38.42,37.39,38.37,12791334.0 +2017-12-14,37.41,37.77,37.41,37.6,5346581.0,0.0,1.0,37.41,37.77,37.41,37.6,5346581.0 +2017-12-13,37.46,37.64,37.33,37.4,5742256.0,0.0,1.0,37.46,37.64,37.33,37.4,5742256.0 +2017-12-12,37.44,37.49,37.1,37.44,6223963.0,0.0,1.0,37.44,37.49,37.1,37.44,6223963.0 +2017-12-11,37.51,37.69,37.32,37.52,6245593.0,0.0,1.0,37.51,37.69,37.32,37.52,6245593.0 +2017-12-08,37.25,37.99,37.16,37.65,12217992.0,0.0,1.0,37.25,37.99,37.16,37.65,12217992.0 +2017-12-07,36.72,37.15,36.5,36.85,7364150.0,0.0,1.0,36.72,37.15,36.5,36.85,7364150.0 +2017-12-06,36.64,36.91,36.36,36.83,8813063.0,0.0,1.0,36.64,36.91,36.36,36.83,8813063.0 +2017-12-05,35.94,37.19,35.75,36.81,18630500.0,0.0,1.0,35.94,37.19,35.75,36.81,18630500.0 +2017-12-04,35.58,36.08,35.38,35.7,11046784.0,0.0,1.0,35.58,36.08,35.38,35.7,11046784.0 +2017-12-01,34.38,35.25,34.31,35.2,11236547.0,0.0,1.0,34.38,35.25,34.31,35.2,11236547.0 +2017-11-30,34.48,35.19,34.4612,34.67,16173978.0,0.0,1.0,34.48,35.19,34.4612,34.67,16173978.0 +2017-11-29,35.42,35.45,33.945,34.38,21446119.0,0.0,1.0,35.42,35.45,33.945,34.38,21446119.0 +2017-11-28,35.99,36.2,35.42,35.5,10191191.0,0.0,1.0,35.99,36.2,35.42,35.5,10191191.0 +2017-11-27,35.88,36.2,35.7905,35.99,6981252.0,0.0,1.0,35.88,36.2,35.7905,35.99,6981252.0 +2017-11-24,36.07,36.11,35.7,35.84,3123070.0,0.0,1.0,36.07,36.11,35.7,35.84,3123070.0 +2017-11-22,36.05,36.195,35.84,35.94,4563054.0,0.0,1.0,36.05,36.195,35.84,35.94,4563054.0 +2017-11-21,35.72,36.11,35.56,35.96,5807385.0,0.0,1.0,35.72,36.11,35.56,35.96,5807385.0 +2017-11-20,35.62,35.97,35.42,35.53,5964478.0,0.0,1.0,35.62,35.97,35.42,35.53,5964478.0 +2017-11-17,35.64,35.71,35.31,35.58,7458295.0,0.0,1.0,35.64,35.71,35.31,35.58,7458295.0 +2017-11-16,35.37,35.815,35.32,35.62,7632669.0,0.0,1.0,35.37,35.815,35.32,35.62,7632669.0 +2017-11-15,35.03,35.47,34.79,35.3,7871444.0,0.0,1.0,35.03,35.47,34.79,35.3,7871444.0 +2017-11-14,35.71,35.79,35.18,35.22,10858859.0,0.0,1.0,35.71,35.79,35.18,35.22,10858859.0 +2017-11-13,35.7,36.1,35.32,35.85,7047371.0,0.0,1.0,35.7,36.1,35.32,35.85,7047371.0 +2017-11-10,35.51,36.045,35.34,35.97,8276878.0,0.0,1.0,35.51,36.045,35.34,35.97,8276878.0 +2017-11-09,36.26,36.36,35.21,35.69,16766871.0,0.0,1.0,36.26,36.36,35.21,35.69,16766871.0 +2017-11-07,37.6,37.6,37.1,37.41,5564092.0,0.0,1.0,37.6,37.6,37.1,37.41,5564092.0 +2017-11-06,37.38,37.61,37.3,37.37,4338972.0,0.0,1.0,37.38,37.61,37.3,37.37,4338972.0 +2017-11-03,37.44,37.545,37.11,37.5,5708840.0,0.0,1.0,37.44,37.545,37.11,37.5,5708840.0 +2017-11-02,37.49,37.5,36.995,37.4,5341879.0,0.0,1.0,37.49,37.5,36.995,37.4,5341879.0 +2017-11-01,37.85,38.09,37.435,37.54,7052554.0,0.0,1.0,37.85,38.09,37.435,37.54,7052554.0 +2017-10-31,37.11,37.68,37.02,37.64,6678430.0,0.0,1.0,37.11,37.68,37.02,37.64,6678430.0 +2017-10-30,36.86,37.13,36.74,37.0,7988838.0,0.0,1.0,36.86,37.13,36.74,37.0,7988838.0 +2017-10-27,37.07,37.36,36.635,36.8,10660803.0,0.0,1.0,37.07,37.36,36.635,36.8,10660803.0 +2017-10-26,36.74,37.24,36.72,36.9,7622668.0,0.0,1.0,36.74,37.24,36.72,36.9,7622668.0 +2017-10-25,36.66,36.92,36.45,36.68,7839488.0,0.0,1.0,36.66,36.92,36.45,36.68,7839488.0 +2017-10-24,36.51,37.03,36.51,36.74,8439952.0,0.0,1.0,36.51,37.03,36.51,36.74,8439952.0 +2017-10-23,37.66,37.85,36.74,36.83,10318056.0,0.0,1.0,37.66,37.85,36.74,36.83,10318056.0 +2017-10-20,37.34,37.86,37.3,37.61,14821200.0,0.0,1.0,37.34,37.86,37.3,37.61,14821200.0 +2017-10-19,36.48,37.49,36.19,37.29,28992713.0,0.0,1.0,36.48,37.49,36.19,37.29,28992713.0 +2017-10-18,37.68,38.22,37.54,37.97,13424086.0,0.0,1.0,37.68,38.22,37.54,37.97,13424086.0 +2017-10-17,37.76,37.84,37.42,37.49,11904108.0,0.0,1.0,37.76,37.84,37.42,37.49,11904108.0 +2017-10-16,38.29,38.5,37.725,37.77,8645585.0,0.0,1.0,38.29,38.5,37.725,37.77,8645585.0 +2017-10-13,38.35,38.53,38.16,38.35,9392998.0,0.0,1.0,38.35,38.53,38.16,38.35,9392998.0 +2017-10-12,38.31,38.5,38.055,38.09,10020870.0,0.0,1.0,38.31,38.5,38.055,38.09,10020870.0 +2017-10-11,38.85,38.98,38.17,38.31,10841024.0,0.0,1.0,38.85,38.98,38.17,38.31,10841024.0 +2017-10-10,39.02,39.275,38.77,38.84,5998658.0,0.0,1.0,39.02,39.275,38.77,38.84,5998658.0 +2017-10-09,38.8,39.265,38.8,38.99,4982743.0,0.0,1.0,38.8,39.265,38.8,38.99,4982743.0 +2017-10-06,39.05,39.08,38.67,38.81,6947721.0,0.0,1.0,39.05,39.08,38.67,38.81,6947721.0 +2017-10-05,38.76,39.035,38.675,38.99,5155812.0,0.0,1.0,38.76,39.035,38.675,38.99,5155812.0 +2017-10-04,38.8,38.83,38.5,38.66,5590600.0,0.0,1.0,38.8,38.83,38.5,38.66,5590600.0 +2017-10-03,38.78,39.05,38.485,38.71,5103669.0,0.0,1.0,38.78,39.05,38.485,38.71,5103669.0 +2017-10-02,38.51,38.78,38.37,38.73,7220120.0,0.0,1.0,38.51,38.78,38.37,38.73,7220120.0 +2017-09-29,37.73,38.6,37.71,38.46,9573477.0,0.0,1.0,37.73,38.6,37.71,38.46,9573477.0 +2017-09-28,37.44,37.96,37.44,37.73,7683377.0,0.0,1.0,37.44,37.96,37.44,37.73,7683377.0 +2017-09-27,38.03,38.29,37.76,38.05,9331736.0,0.0,1.0,38.03,38.29,37.76,38.05,9331736.0 +2017-09-26,37.85,38.19,37.75,37.85,5348200.0,0.0,1.0,37.85,38.19,37.75,37.85,5348200.0 +2017-09-25,38.22,38.31,37.54,37.78,7053896.0,0.0,1.0,38.22,38.31,37.54,37.78,7053896.0 +2017-09-22,38.13,38.31,38.05,38.29,4851365.0,0.0,1.0,38.13,38.31,38.05,38.29,4851365.0 +2017-09-21,38.55,38.67,38.19,38.25,5673772.0,0.0,1.0,38.55,38.67,38.19,38.25,5673772.0 +2017-09-20,38.67,38.87,38.21,38.54,5703686.0,0.0,1.0,38.67,38.87,38.21,38.54,5703686.0 +2017-09-19,38.5,38.75,38.32,38.59,5131286.0,0.0,1.0,38.5,38.75,38.32,38.59,5131286.0 +2017-09-18,38.3,38.665,38.18,38.39,5127823.0,0.0,1.0,38.3,38.665,38.18,38.39,5127823.0 +2017-09-15,38.27,38.865,38.07,38.4,10869179.0,0.0,1.0,38.27,38.865,38.07,38.4,10869179.0 +2017-09-14,38.24,38.585,38.13,38.31,6478656.0,0.0,1.0,38.24,38.585,38.13,38.31,6478656.0 +2017-09-13,38.0,38.5,38.0,38.27,4960915.0,0.0,1.0,38.0,38.5,38.0,38.27,4960915.0 +2017-09-12,38.07,38.3,37.98,38.18,4170327.0,0.0,1.0,38.07,38.3,37.98,38.18,4170327.0 +2017-09-11,38.04,38.26,38.0,38.09,5945142.0,0.0,1.0,38.04,38.26,38.0,38.09,5945142.0 +2017-09-08,38.04,38.3,37.725,37.79,9052735.0,0.0,1.0,38.04,38.3,37.725,37.79,9052735.0 +2017-09-07,36.95,38.19,36.84,38.01,13980230.0,0.0,1.0,36.95,38.19,36.84,38.01,13980230.0 +2017-09-06,36.08,36.98,36.08,36.76,12653446.0,0.0,1.0,36.08,36.98,36.08,36.76,12653446.0 +2017-09-05,36.19,36.48,35.77,36.09,6296438.0,0.0,1.0,36.19,36.48,35.77,36.09,6296438.0 +2017-09-01,36.2,36.58,36.14,36.35,5037396.0,0.0,1.0,36.2,36.58,36.14,36.35,5037396.0 +2017-08-31,35.85,36.32,35.821,36.13,8522717.0,0.0,1.0,35.85,36.32,35.821,36.13,8522717.0 +2017-08-30,35.14,35.955,35.1,35.69,8205167.0,0.0,1.0,35.14,35.955,35.1,35.69,8205167.0 +2017-08-29,34.48,35.315,34.42,35.2,7089389.0,0.0,1.0,34.48,35.315,34.42,35.2,7089389.0 +2017-08-28,34.75,34.9,34.66,34.81,5005834.0,0.0,1.0,34.75,34.9,34.66,34.81,5005834.0 +2017-08-25,34.98,35.07,34.56,34.68,6720164.0,0.0,1.0,34.98,35.07,34.56,34.68,6720164.0 +2017-08-24,34.86,35.04,34.51,34.88,5638387.0,0.0,1.0,34.86,35.04,34.51,34.88,5638387.0 +2017-08-23,34.62,34.98,34.51,34.89,6295975.0,0.0,1.0,34.62,34.98,34.51,34.89,6295975.0 +2017-08-22,34.37,34.81,34.31,34.81,6144284.0,0.0,1.0,34.37,34.81,34.31,34.81,6144284.0 +2017-08-21,35.13,35.13,34.09,34.24,7592681.0,0.0,1.0,35.13,35.13,34.09,34.24,7592681.0 +2017-08-18,34.83,35.14,34.75,34.79,8521640.0,0.0,1.0,34.83,35.14,34.75,34.79,8521640.0 +2017-08-17,35.5,35.5,34.8,34.85,6290987.0,0.0,1.0,35.5,35.5,34.8,34.85,6290987.0 +2017-08-16,35.23,35.48,35.07,35.36,3809705.0,0.0,1.0,35.23,35.48,35.07,35.36,3809705.0 +2017-08-15,35.24,35.42,35.12,35.25,4487094.0,0.0,1.0,35.24,35.42,35.12,35.25,4487094.0 +2017-08-14,35.44,35.45,34.88,35.2,6932178.0,0.0,1.0,35.44,35.45,34.88,35.2,6932178.0 +2017-08-11,35.16,35.32,34.76,35.05,7688311.0,0.0,1.0,35.16,35.32,34.76,35.05,7688311.0 +2017-08-10,35.95,35.9845,34.88,35.0,12151126.0,0.0,1.0,35.95,35.9845,34.88,35.0,12151126.0 +2017-08-09,36.13,36.225,35.72,36.08,7540671.0,0.0,1.0,36.13,36.225,35.72,36.08,7540671.0 +2017-08-08,35.96,36.64,35.89,36.36,9441402.0,0.0,1.0,35.96,36.64,35.89,36.36,9441402.0 +2017-08-07,35.61,36.15,35.38,36.11,5309161.0,0.0,1.0,35.61,36.15,35.38,36.11,5309161.0 +2017-08-04,35.86,35.86,35.55,35.62,5036090.0,0.0,1.0,35.86,35.86,35.55,35.62,5036090.0 +2017-08-03,35.97,35.98,35.57,35.71,5592728.0,0.0,1.0,35.97,35.98,35.57,35.71,5592728.0 +2017-08-02,35.69,35.95,35.42,35.9,6395959.0,0.0,1.0,35.69,35.95,35.42,35.9,6395959.0 +2017-08-01,35.82,36.02,35.75,35.91,4598532.0,0.0,1.0,35.82,36.02,35.75,35.91,4598532.0 +2017-07-31,36.09,36.13,35.65,35.73,6117033.0,0.0,1.0,36.09,36.13,35.65,35.73,6117033.0 +2017-07-28,36.08,36.21,35.73,35.94,7097225.0,0.0,1.0,36.08,36.21,35.73,35.94,7097225.0 +2017-07-27,37.09,37.265,35.54,36.17,15261765.0,0.0,1.0,37.09,37.265,35.54,36.17,15261765.0 +2017-07-26,36.36,37.07,36.36,37.04,10987896.0,0.0,1.0,36.36,37.07,36.36,37.04,10987896.0 +2017-07-25,36.33,36.485,36.06,36.32,6191010.0,0.0,1.0,36.33,36.485,36.06,36.32,6191010.0 +2017-07-24,36.45,36.73,36.22,36.39,9661599.0,0.0,1.0,36.45,36.73,36.22,36.39,9661599.0 +2017-07-21,36.2,36.9,36.05,36.61,22131224.0,0.0,1.0,36.2,36.9,36.05,36.61,22131224.0 +2017-07-20,37.17,37.48,37.0,37.18,13467628.0,0.0,1.0,37.17,37.48,37.0,37.18,13467628.0 +2017-07-19,36.95,37.26,36.645,37.08,8510278.0,0.0,1.0,36.95,37.26,36.645,37.08,8510278.0 +2017-07-18,36.94,36.94,36.57,36.8,12755207.0,0.0,1.0,36.94,36.94,36.57,36.8,12755207.0 +2017-07-17,37.03,37.17,36.57,37.05,8151725.0,0.0,1.0,37.03,37.17,36.57,37.05,8151725.0 +2017-07-14,36.91,37.2,36.83,37.08,9654192.0,0.0,1.0,36.91,37.2,36.83,37.08,9654192.0 +2017-07-13,36.61,37.13,36.26,36.5,12877614.0,0.0,1.0,36.61,37.13,36.26,36.5,12877614.0 +2017-07-12,35.53,36.2,35.53,36.03,13411174.0,0.0,1.0,35.53,36.2,35.53,36.03,13411174.0 +2017-07-11,34.97,35.45,34.89,35.19,8306962.0,0.0,1.0,34.97,35.45,34.89,35.19,8306962.0 +2017-07-10,34.31,35.14,34.28,35.04,8695234.0,0.0,1.0,34.31,35.14,34.28,35.04,8695234.0 +2017-07-07,34.02,34.55,34.01,34.23,6747508.0,0.0,1.0,34.02,34.55,34.01,34.23,6747508.0 +2017-07-06,34.39,34.5,33.95,34.03,8551358.0,0.0,1.0,34.39,34.5,33.95,34.03,8551358.0 +2017-07-05,34.73,34.86,34.505,34.72,7381884.0,0.0,1.0,34.73,34.86,34.505,34.72,7381884.0 +2017-07-03,35.15,35.305,34.55,34.6,4517402.0,0.0,1.0,35.15,35.305,34.55,34.6,4517402.0 +2017-06-30,34.78,35.07,34.52,34.92,10561065.0,0.0,1.0,34.78,35.07,34.52,34.92,10561065.0 +2017-06-29,35.3,35.3,34.09,34.51,8166989.0,0.0,1.0,35.3,35.3,34.09,34.51,8166989.0 +2017-06-28,35.0,35.33,34.615,35.31,4791632.0,0.0,1.0,35.0,35.33,34.615,35.31,4791632.0 +2017-06-27,35.0,35.32,34.85,34.91,8598433.0,0.0,1.0,35.0,35.32,34.85,34.91,8598433.0 +2017-06-26,35.89,35.97,35.0,35.09,6634019.0,0.0,1.0,35.89,35.97,35.0,35.09,6634019.0 +2017-06-23,35.12,35.735,34.96,35.58,8872359.0,0.0,1.0,35.12,35.735,34.96,35.58,8872359.0 +2017-06-22,34.99,35.285,34.84,35.12,5120718.0,0.0,1.0,34.99,35.285,34.84,35.12,5120718.0 +2017-06-21,35.0,35.12,34.75,34.96,5400949.0,0.0,1.0,35.0,35.12,34.75,34.96,5400949.0 +2017-06-20,34.74,35.34,34.74,34.93,10506559.0,0.0,1.0,34.74,35.34,34.74,34.93,10506559.0 +2017-06-19,34.12,34.99,34.0,34.9,5760279.0,0.0,1.0,34.12,34.99,34.0,34.9,5760279.0 +2017-06-16,33.92,34.32,33.91,33.96,9640312.0,0.0,1.0,33.92,34.32,33.91,33.96,9640312.0 +2017-06-15,34.26,34.29,33.89,34.09,5344405.0,0.0,1.0,34.26,34.29,33.89,34.09,5344405.0 +2017-06-14,34.63,34.73,34.11,34.5,6371265.0,0.0,1.0,34.63,34.73,34.11,34.5,6371265.0 +2017-06-13,34.21,34.55,34.08,34.47,7302410.0,0.0,1.0,34.21,34.55,34.08,34.47,7302410.0 +2017-06-12,34.7,34.77,33.975,34.15,12807616.0,0.0,1.0,34.7,34.77,33.975,34.15,12807616.0 +2017-06-09,36.25,36.5,34.69,34.94,10974043.0,0.0,1.0,36.25,36.5,34.69,34.94,10974043.0 +2017-06-08,36.07,36.315,35.865,36.14,8767604.0,0.0,1.0,36.07,36.315,35.865,36.14,8767604.0 +2017-06-07,35.65,35.87,35.56,35.77,5280007.0,0.0,1.0,35.65,35.87,35.56,35.77,5280007.0 +2017-06-06,35.41,35.805,35.35,35.47,5463513.0,0.0,1.0,35.41,35.805,35.35,35.47,5463513.0 +2017-06-05,36.02,36.02,35.39,35.55,5946671.0,0.0,1.0,36.02,36.02,35.39,35.55,5946671.0 +2017-06-02,34.92,35.44,34.61,35.32,6843000.0,0.0,1.0,34.92,35.44,34.61,35.32,6843000.0 +2017-06-01,34.44,34.89,34.2,34.79,6463818.0,0.0,1.0,34.44,34.89,34.2,34.79,6463818.0 diff --git a/examples/demos/stocqt/content/data/FB.csv b/examples/demos/stocqt/content/data/FB.csv new file mode 100644 index 000000000..d9ebf9eeb --- /dev/null +++ b/examples/demos/stocqt/content/data/FB.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,178.0,178.85,176.46,176.46,10028758.0,0.0,1.0,178.0,178.85,176.46,176.46,10028758.0 +2017-12-28,177.95,178.9367,177.68,177.92,11008996.0,0.0,1.0,177.95,178.9367,177.68,177.92,11008996.0 +2017-12-27,176.55,178.44,176.26,177.62,9296258.0,0.0,1.0,176.55,178.44,176.26,177.62,9296258.0 +2017-12-26,176.63,177.0,174.67,175.99,8726829.0,0.0,1.0,176.63,177.0,174.67,175.99,8726829.0 +2017-12-22,177.14,177.53,176.23,177.2,8462491.0,0.0,1.0,177.14,177.53,176.23,177.2,8462491.0 +2017-12-21,177.94,178.68,177.05,177.45,11050969.0,0.0,1.0,177.94,178.68,177.05,177.45,11050969.0 +2017-12-20,179.81,179.81,177.36,177.89,11754823.0,0.0,1.0,179.81,179.81,177.36,177.89,11754823.0 +2017-12-19,179.95,180.08,178.22,179.51,14769239.0,0.0,1.0,179.95,180.08,178.22,179.51,14769239.0 +2017-12-18,181.01,181.3,179.75,180.82,17014337.0,0.0,1.0,181.01,181.3,179.75,180.82,17014337.0 +2017-12-15,179.02,180.4934,178.36,180.18,26225100.0,0.0,1.0,179.02,180.4934,178.36,180.18,26225100.0 +2017-12-14,178.29,180.3601,177.68,178.39,13393757.0,0.0,1.0,178.29,180.3601,177.68,178.39,13393757.0 +2017-12-13,177.3,179.16,177.25,178.3,14406776.0,0.0,1.0,177.3,179.16,177.25,178.3,14406776.0 +2017-12-12,178.6,179.18,176.6,176.96,16675275.0,0.0,1.0,178.6,179.18,176.6,176.96,16675275.0 +2017-12-11,179.3,180.22,178.8,179.04,12630207.0,0.0,1.0,179.3,180.22,178.8,179.04,12630207.0 +2017-12-08,181.53,182.28,178.7401,179.0,19377310.0,0.0,1.0,181.53,182.28,178.7401,179.0,19377310.0 +2017-12-07,175.8,180.39,175.8,180.14,19588217.0,0.0,1.0,175.8,180.39,175.8,180.14,19588217.0 +2017-12-06,172.5,176.77,171.9,176.06,20059293.0,0.0,1.0,172.5,176.77,171.9,176.06,20059293.0 +2017-12-05,170.45,175.38,169.01,172.83,20028656.0,0.0,1.0,170.45,175.38,169.01,172.83,20028656.0 +2017-12-04,176.29,176.57,170.79,171.47,24184006.0,0.0,1.0,176.29,176.57,170.79,171.47,24184006.0 +2017-12-01,176.03,177.48,172.34,175.1,19824531.0,0.0,1.0,176.03,177.48,172.34,175.1,19824531.0 +2017-11-30,176.85,178.275,175.2,177.18,24613431.0,0.0,1.0,176.85,178.275,175.2,177.18,24613431.0 +2017-11-29,181.89,181.97,174.0,175.13,41651953.0,0.0,1.0,181.89,181.97,174.0,175.13,41651953.0 +2017-11-28,183.51,184.25,182.09,182.42,13761926.0,0.0,1.0,183.51,184.25,182.09,182.42,13761926.0 +2017-11-27,182.56,183.73,181.99,183.03,12249740.0,0.0,1.0,182.56,183.73,181.99,183.03,12249740.0 +2017-11-24,180.4,183.15,180.29,182.78,9426010.0,0.0,1.0,180.4,183.15,180.29,182.78,9426010.0 +2017-11-22,181.3,181.73,180.44,180.87,10238140.0,0.0,1.0,181.3,181.73,180.44,180.87,10238140.0 +2017-11-21,179.15,181.89,178.99,181.86,14409305.0,0.0,1.0,179.15,181.89,178.99,181.86,14409305.0 +2017-11-20,178.87,179.5,178.1,178.74,9476502.0,0.0,1.0,178.87,179.5,178.1,178.74,9476502.0 +2017-11-17,179.3,179.98,178.9,179.0,12722802.0,0.0,1.0,179.3,179.98,178.9,179.0,12722802.0 +2017-11-16,178.76,179.83,178.5,179.59,14655982.0,0.0,1.0,178.76,179.83,178.5,179.59,14655982.0 +2017-11-15,176.66,178.57,176.4,177.95,10131051.0,0.0,1.0,176.66,178.57,176.4,177.95,10131051.0 +2017-11-14,178.13,178.97,177.18,178.07,9465112.0,0.0,1.0,178.13,178.97,177.18,178.07,9465112.0 +2017-11-13,177.5,179.04,177.3,178.77,9431449.0,0.0,1.0,177.5,179.04,177.3,178.77,9431449.0 +2017-11-10,178.35,179.0999,177.96,178.46,10933405.0,0.0,1.0,178.35,179.0999,177.96,178.46,10933405.0 +2017-11-09,178.31,179.4,177.09,179.3,12460345.0,0.0,1.0,178.31,179.4,177.09,179.3,12460345.0 +2017-11-07,180.5,180.7478,178.96,180.25,12679885.0,0.0,1.0,180.5,180.7478,178.96,180.25,12679885.0 +2017-11-06,178.56,180.45,178.31,180.17,13065077.0,0.0,1.0,178.56,180.45,178.31,180.17,13065077.0 +2017-11-03,179.29,179.86,176.71,178.92,17572587.0,0.0,1.0,179.29,179.86,176.71,178.92,17572587.0 +2017-11-02,180.63,181.94,177.34,178.92,35119841.0,0.0,1.0,180.63,181.94,177.34,178.92,35119841.0 +2017-11-01,182.36,182.9,180.57,182.66,28922959.0,0.0,1.0,182.36,182.9,180.57,182.66,28922959.0 +2017-10-31,180.57,180.8,178.94,180.06,19766043.0,0.0,1.0,180.57,180.8,178.94,180.06,19766043.0 +2017-10-30,179.26,180.69,177.61,179.87,24179258.0,0.0,1.0,179.26,180.69,177.61,179.87,24179258.0 +2017-10-27,174.15,178.21,173.9,177.88,29867490.0,0.0,1.0,174.15,178.21,173.9,177.88,29867490.0 +2017-10-26,171.38,172.285,170.39,170.63,10932929.0,0.0,1.0,171.38,172.285,170.39,170.63,10932929.0 +2017-10-25,171.9,172.25,168.89,170.6,15095603.0,0.0,1.0,171.9,172.25,168.89,170.6,15095603.0 +2017-10-24,172.3,173.24,171.5,171.8,11629341.0,0.0,1.0,172.3,173.24,171.5,171.8,11629341.0 +2017-10-23,175.2,175.34,171.25,171.27,13622072.0,0.0,1.0,175.2,175.34,171.25,171.27,13622072.0 +2017-10-20,175.5,175.88,174.63,174.98,11861307.0,0.0,1.0,175.5,175.88,174.63,174.98,11861307.0 +2017-10-19,174.93,176.03,172.63,174.56,13602869.0,0.0,1.0,174.93,176.03,172.63,174.56,13602869.0 +2017-10-18,176.65,176.74,175.75,176.03,12655492.0,0.0,1.0,176.65,176.74,175.75,176.03,12655492.0 +2017-10-17,174.71,176.13,174.36,176.11,15381990.0,0.0,1.0,174.71,176.13,174.36,176.11,15381990.0 +2017-10-16,174.49,175.0,174.06,174.52,11225293.0,0.0,1.0,174.49,175.0,174.06,174.52,11225293.0 +2017-10-13,173.45,174.65,173.2,173.74,13305724.0,0.0,1.0,173.45,174.65,173.2,173.74,13305724.0 +2017-10-12,172.61,173.85,172.29,172.55,10312488.0,0.0,1.0,172.61,173.85,172.29,172.55,10312488.0 +2017-10-11,171.95,172.78,171.4,172.74,11023310.0,0.0,1.0,171.95,172.78,171.4,172.74,11023310.0 +2017-10-10,173.0,173.2,170.8,171.59,11231234.0,0.0,1.0,173.0,173.2,170.8,171.59,11231234.0 +2017-10-09,172.7,174.88,172.0,172.5,14472612.0,0.0,1.0,172.7,174.88,172.0,172.5,14472612.0 +2017-10-06,170.25,172.37,169.75,172.23,12670089.0,0.0,1.0,170.25,172.37,169.75,172.23,12670089.0 +2017-10-05,169.18,171.31,168.6,171.24,14013869.0,0.0,1.0,169.18,171.31,168.6,171.24,14013869.0 +2017-10-04,169.83,170.67,168.29,168.42,11829323.0,0.0,1.0,169.83,170.67,168.29,168.42,11829323.0 +2017-10-03,169.3,170.73,169.2,169.96,8054219.0,0.0,1.0,169.3,170.73,169.2,169.96,8054219.0 +2017-10-02,171.39,171.87,168.75,169.47,13104304.0,0.0,1.0,171.39,171.87,168.75,169.47,13104304.0 +2017-09-29,168.83,171.66,168.81,170.81,15114619.0,0.0,1.0,168.83,171.66,168.81,170.81,15114619.0 +2017-09-28,167.94,169.0696,167.16,168.73,12084865.0,0.0,1.0,167.94,169.0696,167.16,168.73,12084865.0 +2017-09-27,165.9,168.34,165.57,167.68,18963276.0,0.0,1.0,165.9,168.34,165.57,167.68,18963276.0 +2017-09-26,164.5,165.5,162.78,164.21,22866403.0,0.0,1.0,164.5,165.5,162.78,164.21,22866403.0 +2017-09-25,169.24,169.3,161.56,162.87,40538994.0,0.0,1.0,169.24,169.3,161.56,162.87,40538994.0 +2017-09-22,170.21,171.73,169.22,170.54,11835708.0,0.0,1.0,170.21,171.73,169.22,170.54,11835708.0 +2017-09-21,171.69,172.27,170.01,171.11,11054545.0,0.0,1.0,171.69,172.27,170.01,171.11,11054545.0 +2017-09-20,172.5,173.05,170.7,172.17,11899057.0,0.0,1.0,172.5,173.05,170.7,172.17,11899057.0 +2017-09-19,170.62,172.56,170.36,172.52,12911661.0,0.0,1.0,170.62,172.56,170.36,172.52,12911661.0 +2017-09-18,171.99,172.07,169.34,170.01,12785437.0,0.0,1.0,171.99,172.07,169.34,170.01,12785437.0 +2017-09-15,170.88,172.34,170.26,171.58,15468473.0,0.0,1.0,170.88,172.34,170.26,171.58,15468473.0 +2017-09-14,172.26,172.28,170.5,170.96,15496424.0,0.0,1.0,172.26,172.28,170.5,170.96,15496424.0 +2017-09-13,173.01,173.17,172.06,173.05,8908633.0,0.0,1.0,173.01,173.17,172.06,173.05,8908633.0 +2017-09-12,173.76,174.0,171.75,172.96,11051768.0,0.0,1.0,173.76,174.0,171.75,172.96,11051768.0 +2017-09-11,172.4,173.89,172.2,173.51,12183568.0,0.0,1.0,172.4,173.89,172.2,173.51,12183568.0 +2017-09-08,173.09,173.49,170.8,170.95,10936358.0,0.0,1.0,173.09,173.49,170.8,170.95,10936358.0 +2017-09-07,171.94,173.3067,170.27,173.21,17922494.0,0.0,1.0,171.94,173.3067,170.27,173.21,17922494.0 +2017-09-06,170.91,172.48,169.57,172.09,13659317.0,0.0,1.0,170.91,172.48,169.57,172.09,13659317.0 +2017-09-05,171.27,172.3875,169.55,170.72,13175866.0,0.0,1.0,171.27,172.3875,169.55,170.72,13175866.0 +2017-09-01,172.4,172.915,171.31,172.02,11614185.0,0.0,1.0,172.4,172.915,171.31,172.02,11614185.0 +2017-08-31,170.4,172.145,170.06,172.0,16873901.0,0.0,1.0,170.4,172.145,170.06,172.0,16873901.0 +2017-08-30,168.17,170.18,167.63,169.92,10850005.0,0.0,1.0,168.17,170.18,167.63,169.92,10850005.0 +2017-08-29,165.25,168.425,165.0,168.05,10992617.0,0.0,1.0,165.25,168.425,165.0,168.05,10992617.0 +2017-08-28,166.91,167.7,166.33,167.24,8360380.0,0.0,1.0,166.91,167.7,166.33,167.24,8360380.0 +2017-08-25,167.86,168.38,166.18,166.32,12391910.0,0.0,1.0,167.86,168.38,166.18,166.32,12391910.0 +2017-08-24,168.88,169.29,166.41,167.74,13552865.0,0.0,1.0,168.88,169.29,166.41,167.74,13552865.0 +2017-08-23,168.84,169.36,168.2,168.71,9756817.0,0.0,1.0,168.84,169.36,168.2,168.71,9756817.0 +2017-08-22,168.28,169.87,167.15,169.64,11333260.0,0.0,1.0,168.28,169.87,167.15,169.64,11333260.0 +2017-08-21,167.16,168.0,165.82,167.78,11880823.0,0.0,1.0,167.16,168.0,165.82,167.78,11880823.0 +2017-08-18,166.84,168.67,166.21,167.41,14933261.0,0.0,1.0,166.84,168.67,166.21,167.41,14933261.0 +2017-08-17,169.34,169.86,166.85,166.91,16791591.0,0.0,1.0,169.34,169.86,166.85,166.91,16791591.0 +2017-08-16,171.25,171.38,169.24,170.0,15580549.0,0.0,1.0,171.25,171.38,169.24,170.0,15580549.0 +2017-08-15,171.49,171.5,170.01,171.0,8621787.0,0.0,1.0,171.49,171.5,170.01,171.0,8621787.0 +2017-08-14,170.09,171.08,169.29,170.75,12786286.0,0.0,1.0,170.09,171.08,169.29,170.75,12786286.0 +2017-08-11,167.95,168.82,166.85,168.08,13664032.0,0.0,1.0,167.95,168.82,166.85,168.08,13664032.0 +2017-08-10,170.06,170.59,166.85,167.4,20353485.0,0.0,1.0,170.06,170.59,166.85,167.4,20353485.0 +2017-08-09,169.98,171.45,169.56,171.18,10597084.0,0.0,1.0,169.98,171.45,169.56,171.18,10597084.0 +2017-08-08,171.88,173.05,170.62,171.23,13813683.0,0.0,1.0,171.88,173.05,170.62,171.23,13813683.0 +2017-08-07,169.95,172.06,169.66,171.98,12504157.0,0.0,1.0,169.95,172.06,169.66,171.98,12504157.0 +2017-08-04,168.97,170.06,168.69,169.62,10360774.0,0.0,1.0,168.97,170.06,168.69,169.62,10360774.0 +2017-08-03,169.3,169.7,168.25,168.59,10316246.0,0.0,1.0,169.3,169.7,168.25,168.59,10316246.0 +2017-08-02,170.3,170.55,166.91,169.25,17061845.0,0.0,1.0,170.3,170.55,166.91,169.25,17061845.0 +2017-08-01,169.82,170.47,169.05,169.86,14051379.0,0.0,1.0,169.82,170.47,169.05,169.86,14051379.0 +2017-07-31,172.0,172.72,168.55,169.25,25157896.0,0.0,1.0,172.0,172.72,168.55,169.25,25157896.0 +2017-07-28,169.07,173.43,169.05,172.45,24036502.0,0.0,1.0,169.07,173.43,169.05,172.45,24036502.0 +2017-07-27,174.7,175.49,167.5,170.44,68065163.0,0.0,1.0,174.7,175.49,167.5,170.44,68065163.0 +2017-07-26,166.01,166.01,164.1,165.61,24081060.0,0.0,1.0,166.01,166.01,164.1,165.61,24081060.0 +2017-07-25,165.01,165.54,163.8619,165.28,15164613.0,0.0,1.0,165.01,165.54,163.8619,165.28,15164613.0 +2017-07-24,164.64,166.17,164.31,166.0,16595460.0,0.0,1.0,164.64,166.17,164.31,166.0,16595460.0 +2017-07-21,164.16,165.05,163.75,164.43,14494667.0,0.0,1.0,164.16,165.05,163.75,164.43,14494667.0 +2017-07-20,164.8,165.0,162.81,164.53,18293111.0,0.0,1.0,164.8,165.0,162.81,164.53,18293111.0 +2017-07-19,163.59,165.7,163.17,164.14,25915988.0,0.0,1.0,163.59,165.7,163.17,164.14,25915988.0 +2017-07-18,159.66,163.73,159.42,162.86,23621711.0,0.0,1.0,159.66,163.73,159.42,162.86,23621711.0 +2017-07-17,160.25,160.78,158.81,159.73,12567935.0,0.0,1.0,160.25,160.78,158.81,159.73,12567935.0 +2017-07-14,160.13,160.32,159.3254,159.97,16172560.0,0.0,1.0,160.13,160.32,159.3254,159.97,16172560.0 +2017-07-13,158.74,159.78,158.4227,159.26,13839891.0,0.0,1.0,158.74,159.78,158.4227,159.26,13839891.0 +2017-07-12,156.49,159.16,156.2,158.9,22483868.0,0.0,1.0,156.49,159.16,156.2,158.9,22483868.0 +2017-07-11,153.37,155.4225,152.91,155.27,13208251.0,0.0,1.0,153.37,155.4225,152.91,155.27,13208251.0 +2017-07-10,151.69,153.98,151.51,153.5,13296447.0,0.0,1.0,151.69,153.98,151.51,153.5,13296447.0 +2017-07-07,149.25,151.99,149.19,151.44,13229352.0,0.0,1.0,149.25,151.99,149.19,151.44,13229352.0 +2017-07-06,149.03,150.04,148.0,148.82,14788811.0,0.0,1.0,149.03,150.04,148.0,148.82,14788811.0 +2017-07-05,149.0,150.85,148.13,150.34,14037692.0,0.0,1.0,149.0,150.85,148.13,150.34,14037692.0 +2017-07-03,151.72,152.15,147.8,148.43,13860113.0,0.0,1.0,151.72,152.15,147.8,148.43,13860113.0 +2017-06-30,151.9,151.92,150.06,150.98,14540013.0,0.0,1.0,151.9,151.92,150.06,150.98,14540013.0 +2017-06-29,152.28,152.5,148.9175,151.04,23771610.0,0.0,1.0,152.28,152.5,148.9175,151.04,23771610.0 +2017-06-28,150.92,153.47,149.86,153.24,16621566.0,0.0,1.0,150.92,153.47,149.86,153.24,16621566.0 +2017-06-27,152.84,153.31,150.39,150.58,19274022.0,0.0,1.0,152.84,153.31,150.39,150.58,19274022.0 +2017-06-26,156.25,156.5,153.1954,153.59,17934289.0,0.0,1.0,156.25,156.5,153.1954,153.59,17934289.0 +2017-06-23,152.72,155.2,152.65,155.07,16192249.0,0.0,1.0,152.72,155.2,152.65,155.07,16192249.0 +2017-06-22,153.01,154.55,152.91,153.4,12783958.0,0.0,1.0,153.01,154.55,152.91,153.4,12783958.0 +2017-06-21,152.36,154.08,151.88,153.91,14760242.0,0.0,1.0,152.36,154.08,151.88,153.91,14760242.0 +2017-06-20,152.88,153.84,152.21,152.25,14557895.0,0.0,1.0,152.88,153.84,152.21,152.25,14557895.0 +2017-06-19,151.71,153.57,151.71,152.87,18678807.0,0.0,1.0,151.71,153.57,151.71,152.87,18678807.0 +2017-06-16,149.59,150.83,148.6,150.64,22169800.0,0.0,1.0,149.59,150.83,148.6,150.64,22169800.0 +2017-06-15,147.67,150.0366,146.3747,149.8,18877305.0,0.0,1.0,147.67,150.0366,146.3747,149.8,18877305.0 +2017-06-14,151.26,152.4,149.05,150.25,20552981.0,0.0,1.0,151.26,152.4,149.05,150.25,20552981.0 +2017-06-13,150.15,151.18,148.9,150.68,20316202.0,0.0,1.0,150.15,151.18,148.9,150.68,20316202.0 +2017-06-12,148.17,149.195,144.56,148.44,33238543.0,0.0,1.0,148.17,149.195,144.56,148.44,33238543.0 +2017-06-09,154.77,155.59,146.61,149.63,35256368.0,0.0,1.0,154.77,155.59,146.61,149.63,35256368.0 +2017-06-08,154.08,154.73,153.1,154.71,17539521.0,0.0,1.0,154.08,154.73,153.1,154.71,17539521.0 +2017-06-07,153.27,153.75,152.34,153.12,11822136.0,0.0,1.0,153.27,153.75,152.34,153.12,11822136.0 +2017-06-06,153.41,154.52,152.48,152.81,13291727.0,0.0,1.0,153.41,154.52,152.48,152.81,13291727.0 +2017-06-05,153.64,154.7088,153.41,153.63,12279871.0,0.0,1.0,153.64,154.7088,153.41,153.63,12279871.0 +2017-06-02,151.85,153.63,151.3,153.61,16787255.0,0.0,1.0,151.85,153.63,151.3,153.61,16787255.0 +2017-06-01,151.75,152.29,150.3,151.53,14459173.0,0.0,1.0,151.75,152.29,150.3,151.53,14459173.0 diff --git a/examples/demos/stocqt/content/data/GOOG.csv b/examples/demos/stocqt/content/data/GOOG.csv new file mode 100644 index 000000000..bde72eafe --- /dev/null +++ b/examples/demos/stocqt/content/data/GOOG.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,1046.72,1049.7,1044.9,1046.4,867943.0,0.0,1.0,1046.72,1049.7,1044.9,1046.4,867943.0 +2017-12-28,1051.6,1054.75,1044.77,1048.14,829623.0,0.0,1.0,1051.6,1054.75,1044.77,1048.14,829623.0 +2017-12-27,1057.39,1058.37,1048.05,1049.37,1214775.0,0.0,1.0,1057.39,1058.37,1048.05,1049.37,1214775.0 +2017-12-26,1058.07,1060.12,1050.2,1056.74,756324.0,0.0,1.0,1058.07,1060.12,1050.2,1056.74,756324.0 +2017-12-22,1061.11,1064.2,1059.44,1060.12,734566.0,0.0,1.0,1061.11,1064.2,1059.44,1060.12,734566.0 +2017-12-21,1064.95,1069.33,1061.79,1063.63,974594.0,0.0,1.0,1064.95,1069.33,1061.79,1063.63,974594.0 +2017-12-20,1071.78,1073.38,1061.52,1064.95,1266115.0,0.0,1.0,1071.78,1073.38,1061.52,1064.95,1266115.0 +2017-12-19,1075.2,1076.84,1063.55,1070.68,1254615.0,0.0,1.0,1075.2,1076.84,1063.55,1070.68,1254615.0 +2017-12-18,1066.08,1078.49,1062.0,1077.14,1531522.0,0.0,1.0,1066.08,1078.49,1062.0,1077.14,1531522.0 +2017-12-15,1054.61,1067.62,1049.5,1064.19,3142760.0,0.0,1.0,1054.61,1067.62,1049.5,1064.19,3142760.0 +2017-12-14,1045.0,1058.5,1043.11,1049.15,1545616.0,0.0,1.0,1045.0,1058.5,1043.11,1049.15,1545616.0 +2017-12-13,1046.12,1046.66,1038.38,1040.61,1207286.0,0.0,1.0,1046.12,1046.66,1038.38,1040.61,1207286.0 +2017-12-12,1039.63,1050.31,1033.69,1040.48,1269883.0,0.0,1.0,1039.63,1050.31,1033.69,1040.48,1269883.0 +2017-12-11,1035.5,1043.8,1032.05,1041.1,1119052.0,0.0,1.0,1035.5,1043.8,1032.05,1041.1,1119052.0 +2017-12-08,1037.49,1042.05,1032.52,1037.05,1277894.0,0.0,1.0,1037.49,1042.05,1032.52,1037.05,1277894.0 +2017-12-07,1020.43,1034.24,1018.07,1030.93,1387107.0,0.0,1.0,1020.43,1034.24,1018.07,1030.93,1387107.0 +2017-12-06,1001.5,1024.97,1001.14,1018.38,1254837.0,0.0,1.0,1001.5,1024.97,1001.14,1018.38,1254837.0 +2017-12-05,995.94,1020.61,988.28,1005.15,2023376.0,0.0,1.0,995.94,1020.61,988.28,1005.15,2023376.0 +2017-12-04,1012.66,1016.1,995.57,998.68,1891408.0,0.0,1.0,1012.66,1016.1,995.57,998.68,1891408.0 +2017-12-01,1015.8,1022.49,1002.02,1010.17,1895786.0,0.0,1.0,1015.8,1022.49,1002.02,1010.17,1895786.0 +2017-11-30,1022.37,1028.49,1015.0,1021.41,1684292.0,0.0,1.0,1022.37,1028.49,1015.0,1021.41,1684292.0 +2017-11-29,1042.68,1044.08,1015.65,1021.66,2414465.0,0.0,1.0,1042.68,1044.08,1015.65,1021.66,2414465.0 +2017-11-28,1055.09,1062.38,1040.0,1047.41,1341000.0,0.0,1.0,1055.09,1062.38,1040.0,1047.41,1341000.0 +2017-11-27,1040.0,1055.46,1038.44,1054.21,1284354.0,0.0,1.0,1040.0,1055.46,1038.44,1054.21,1284354.0 +2017-11-24,1035.87,1043.18,1035.0,1040.61,536958.0,0.0,1.0,1035.87,1043.18,1035.0,1040.61,536958.0 +2017-11-22,1035.0,1039.71,1031.43,1035.96,716661.0,0.0,1.0,1035.0,1039.71,1031.43,1035.96,716661.0 +2017-11-21,1023.31,1035.11,1022.66,1034.49,1083715.0,0.0,1.0,1023.31,1035.11,1022.66,1034.49,1083715.0 +2017-11-20,1020.26,1022.61,1017.5,1018.38,894844.0,0.0,1.0,1020.26,1022.61,1017.5,1018.38,894844.0 +2017-11-17,1034.01,1034.42,1017.75,1019.09,1350144.0,0.0,1.0,1034.01,1034.42,1017.75,1019.09,1350144.0 +2017-11-16,1022.52,1035.92,1022.52,1032.5,1117578.0,0.0,1.0,1022.52,1035.92,1022.52,1032.5,1117578.0 +2017-11-15,1019.21,1024.09,1015.42,1020.91,859951.0,0.0,1.0,1019.21,1024.09,1015.42,1020.91,859951.0 +2017-11-14,1022.59,1026.81,1014.15,1026.0,947273.0,0.0,1.0,1022.59,1026.81,1014.15,1026.0,947273.0 +2017-11-13,1023.42,1031.58,1022.57,1025.75,878969.0,0.0,1.0,1023.42,1031.58,1022.57,1025.75,878969.0 +2017-11-10,1026.46,1030.76,1025.28,1028.07,719227.0,0.0,1.0,1026.46,1030.76,1025.28,1028.07,719227.0 +2017-11-09,1033.99,1033.99,1019.67,1031.26,1236903.0,0.0,1.0,1033.99,1033.99,1019.67,1031.26,1236903.0 +2017-11-07,1027.27,1033.97,1025.13,1033.33,1089887.0,0.0,1.0,1027.27,1033.97,1025.13,1033.33,1089887.0 +2017-11-06,1028.99,1034.87,1025.0,1025.9,1119131.0,0.0,1.0,1028.99,1034.87,1025.0,1025.9,1119131.0 +2017-11-03,1022.11,1032.65,1020.31,1032.48,1058037.0,0.0,1.0,1022.11,1032.65,1020.31,1032.48,1058037.0 +2017-11-02,1021.76,1028.09,1013.01,1025.58,1008190.0,0.0,1.0,1021.76,1028.09,1013.01,1025.58,1008190.0 +2017-11-01,1017.21,1029.67,1016.95,1025.5,1360900.0,0.0,1.0,1017.21,1029.67,1016.95,1025.5,1360900.0 +2017-10-31,1015.22,1024.0,1010.42,1016.64,1324961.0,0.0,1.0,1015.22,1024.0,1010.42,1016.64,1324961.0 +2017-10-30,1014.0,1024.97,1007.5,1017.11,2074619.0,0.0,1.0,1014.0,1024.97,1007.5,1017.11,2074619.0 +2017-10-27,1009.19,1048.39,1008.2,1019.27,5125791.0,0.0,1.0,1009.19,1048.39,1008.2,1019.27,5125791.0 +2017-10-26,980.0,987.6,972.2,972.56,1660850.0,0.0,1.0,980.0,987.6,972.2,972.56,1660850.0 +2017-10-25,968.37,976.09,960.5201,973.33,1162606.0,0.0,1.0,968.37,976.09,960.5201,973.33,1162606.0 +2017-10-24,970.0,972.23,961.0,970.54,1155231.0,0.0,1.0,970.0,972.23,961.0,970.54,1155231.0 +2017-10-23,989.52,989.52,966.12,968.45,1431886.0,0.0,1.0,989.52,989.52,966.12,968.45,1431886.0 +2017-10-20,989.44,991.0,984.58,988.2,1120038.0,0.0,1.0,989.44,991.0,984.58,988.2,1120038.0 +2017-10-19,986.0,988.88,978.39,984.45,1282755.0,0.0,1.0,986.0,988.88,978.39,984.45,1282755.0 +2017-10-18,991.77,996.72,986.9747,992.81,1022521.0,0.0,1.0,991.77,996.72,986.9747,992.81,1022521.0 +2017-10-17,990.29,996.44,988.59,992.18,1266399.0,0.0,1.0,990.29,996.44,988.59,992.18,1266399.0 +2017-10-16,992.1,993.9065,984.0,992.0,900751.0,0.0,1.0,992.1,993.9065,984.0,992.0,900751.0 +2017-10-13,992.0,997.21,989.0,989.68,1143907.0,0.0,1.0,992.0,997.21,989.0,989.68,1143907.0 +2017-10-12,987.45,994.12,985.0,987.83,1259082.0,0.0,1.0,987.45,994.12,985.0,987.83,1259082.0 +2017-10-11,973.72,990.71,972.25,989.25,1663731.0,0.0,1.0,973.72,990.71,972.25,989.25,1663731.0 +2017-10-10,980.0,981.57,966.0801,972.6,956419.0,0.0,1.0,980.0,981.57,966.0801,972.6,956419.0 +2017-10-09,980.0,985.425,976.11,977.0,886700.0,0.0,1.0,980.0,985.425,976.11,977.0,886700.0 +2017-10-06,966.7,979.46,963.36,978.89,1142699.0,0.0,1.0,966.7,979.46,963.36,978.89,1142699.0 +2017-10-05,955.49,970.91,955.18,969.96,1202101.0,0.0,1.0,955.49,970.91,955.18,969.96,1202101.0 +2017-10-04,957.0,960.39,950.69,951.68,881380.0,0.0,1.0,957.0,960.39,950.69,951.68,881380.0 +2017-10-03,954.0,958.0,949.14,957.79,881562.0,0.0,1.0,954.0,958.0,949.14,957.79,881562.0 +2017-10-02,959.98,962.54,947.84,953.27,1222026.0,0.0,1.0,959.98,962.54,947.84,953.27,1222026.0 +2017-09-29,952.0,959.7864,951.51,959.11,1533133.0,0.0,1.0,952.0,959.7864,951.51,959.11,1533133.0 +2017-09-28,941.36,950.69,940.55,949.5,959648.0,0.0,1.0,941.36,950.69,940.55,949.5,959648.0 +2017-09-27,927.74,949.9,927.74,944.49,2202959.0,0.0,1.0,927.74,949.9,927.74,944.49,2202959.0 +2017-09-26,923.72,930.82,921.14,924.86,1652848.0,0.0,1.0,923.72,930.82,921.14,924.86,1652848.0 +2017-09-25,925.45,926.4,909.7,920.97,1822881.0,0.0,1.0,925.45,926.4,909.7,920.97,1822881.0 +2017-09-22,927.75,934.73,926.48,928.53,1038551.0,0.0,1.0,927.75,934.73,926.48,928.53,1038551.0 +2017-09-21,933.0,936.53,923.83,932.45,1207656.0,0.0,1.0,933.0,936.53,923.83,932.45,1207656.0 +2017-09-20,922.98,933.88,922.0,931.58,1518166.0,0.0,1.0,922.98,933.88,922.0,931.58,1518166.0 +2017-09-19,917.42,922.4199,912.55,921.81,902415.0,0.0,1.0,917.42,922.4199,912.55,921.81,902415.0 +2017-09-18,920.01,922.08,910.6,915.0,1263456.0,0.0,1.0,920.01,922.08,910.6,915.0,1263456.0 +2017-09-15,924.66,926.49,916.36,920.29,2475031.0,0.0,1.0,924.66,926.49,916.36,920.29,2475031.0 +2017-09-14,931.25,932.77,924.0,925.11,1389012.0,0.0,1.0,931.25,932.77,924.0,925.11,1389012.0 +2017-09-13,930.66,937.25,929.86,935.09,1066051.0,0.0,1.0,930.66,937.25,929.86,935.09,1066051.0 +2017-09-12,932.59,933.48,923.861,932.07,1120449.0,0.0,1.0,932.59,933.48,923.861,932.07,1120449.0 +2017-09-11,934.25,938.38,926.92,929.08,1247138.0,0.0,1.0,934.25,938.38,926.92,929.08,1247138.0 +2017-09-08,936.49,936.99,924.88,926.5,993832.0,0.0,1.0,936.49,936.99,924.88,926.5,993832.0 +2017-09-07,931.73,936.41,923.62,935.95,1200257.0,0.0,1.0,931.73,936.41,923.62,935.95,1200257.0 +2017-09-06,930.15,930.915,919.27,927.81,1468808.0,0.0,1.0,930.15,930.915,919.27,927.81,1468808.0 +2017-09-05,933.08,937.0,921.96,928.45,1202163.0,0.0,1.0,933.08,937.0,921.96,928.45,1202163.0 +2017-09-01,941.13,942.48,935.15,937.34,913404.0,0.0,1.0,941.13,942.48,935.15,937.34,913404.0 +2017-08-31,931.76,941.98,931.76,939.33,1553301.0,0.0,1.0,931.76,941.98,931.76,939.33,1553301.0 +2017-08-30,920.05,930.819,919.65,929.57,1282093.0,0.0,1.0,920.05,930.819,919.65,929.57,1282093.0 +2017-08-29,905.1,923.33,905.0,921.29,1180160.0,0.0,1.0,905.1,923.33,905.0,921.29,1180160.0 +2017-08-28,916.0,919.245,911.87,913.81,1072467.0,0.0,1.0,916.0,919.245,911.87,913.81,1072467.0 +2017-08-25,923.49,925.555,915.5,915.89,1040693.0,0.0,1.0,923.49,925.555,915.5,915.89,1040693.0 +2017-08-24,928.66,930.84,915.5,921.28,1218875.0,0.0,1.0,928.66,930.84,915.5,921.28,1218875.0 +2017-08-23,921.93,929.93,919.36,927.0,1077809.0,0.0,1.0,921.93,929.93,919.36,927.0,1077809.0 +2017-08-22,912.72,925.86,911.4751,924.69,1145571.0,0.0,1.0,912.72,925.86,911.4751,924.69,1145571.0 +2017-08-21,910.0,913.0,903.4,906.66,932903.0,0.0,1.0,910.0,913.0,903.4,906.66,932903.0 +2017-08-18,910.31,915.275,907.1543,910.67,1333572.0,0.0,1.0,910.31,915.275,907.1543,910.67,1333572.0 +2017-08-17,925.78,926.86,910.98,910.98,1218963.0,0.0,1.0,925.78,926.86,910.98,910.98,1218963.0 +2017-08-16,925.29,932.7,923.445,926.96,988604.0,0.0,1.0,925.29,932.7,923.445,926.96,988604.0 +2017-08-15,924.23,926.5499,919.82,922.22,873070.0,0.0,1.0,924.23,926.5499,919.82,922.22,873070.0 +2017-08-14,922.53,924.668,918.19,922.67,1047828.0,0.0,1.0,922.53,924.668,918.19,922.67,1047828.0 +2017-08-11,907.97,917.78,905.58,914.39,1190458.0,0.0,1.0,907.97,917.78,905.58,914.39,1190458.0 +2017-08-10,917.55,919.26,906.13,907.24,1722296.0,0.0,1.0,917.55,919.26,906.13,907.24,1722296.0 +2017-08-09,920.61,925.98,917.2501,922.9,1169431.0,0.0,1.0,920.61,925.98,917.2501,922.9,1169431.0 +2017-08-08,927.09,935.814,925.6095,926.79,1039394.0,0.0,1.0,927.09,935.814,925.6095,926.79,1039394.0 +2017-08-07,929.06,931.7,926.5,929.36,1012296.0,0.0,1.0,929.06,931.7,926.5,929.36,1012296.0 +2017-08-04,926.75,930.3068,923.03,927.96,1019159.0,0.0,1.0,926.75,930.3068,923.03,927.96,1019159.0 +2017-08-03,930.34,932.24,922.24,923.65,1179126.0,0.0,1.0,930.34,932.24,922.24,923.65,1179126.0 +2017-08-02,928.61,932.6,916.68,930.39,1816343.0,0.0,1.0,928.61,932.6,916.68,930.39,1816343.0 +2017-08-01,932.38,937.447,929.26,930.83,1211553.0,0.0,1.0,932.38,937.447,929.26,930.83,1211553.0 +2017-07-31,941.89,943.59,926.04,930.5,1952716.0,0.0,1.0,941.89,943.59,926.04,930.5,1952716.0 +2017-07-28,929.4,943.83,927.5,941.53,1775076.0,0.0,1.0,929.4,943.83,927.5,941.53,1775076.0 +2017-07-27,951.78,951.78,920.0,934.09,3095263.0,0.0,1.0,951.78,951.78,920.0,934.09,3095263.0 +2017-07-26,954.68,955.0,942.2788,947.8,2056013.0,0.0,1.0,954.68,955.0,942.2788,947.8,2056013.0 +2017-07-25,953.81,959.7,945.4,950.7,4626086.0,0.0,1.0,953.81,959.7,945.4,950.7,4626086.0 +2017-07-24,972.22,986.2,970.77,980.34,2634669.0,0.0,1.0,972.22,986.2,970.77,980.34,2634669.0 +2017-07-21,962.25,973.23,960.15,972.92,1665103.0,0.0,1.0,962.25,973.23,960.15,972.92,1665103.0 +2017-07-20,975.0,975.9,961.51,968.15,1577103.0,0.0,1.0,975.0,975.9,961.51,968.15,1577103.0 +2017-07-19,967.84,973.04,964.03,970.89,1212814.0,0.0,1.0,967.84,973.04,964.03,970.89,1212814.0 +2017-07-18,953.0,968.04,950.6,965.4,1131130.0,0.0,1.0,953.0,968.04,950.6,965.4,1131130.0 +2017-07-17,957.0,960.74,949.2407,953.42,1141026.0,0.0,1.0,957.0,960.74,949.2407,953.42,1141026.0 +2017-07-14,952.0,956.91,948.005,955.99,1017632.0,0.0,1.0,952.0,956.91,948.005,955.99,1017632.0 +2017-07-13,946.29,954.45,943.01,947.16,1291782.0,0.0,1.0,946.29,954.45,943.01,947.16,1291782.0 +2017-07-12,938.68,946.3,934.47,943.83,1505982.0,0.0,1.0,938.68,946.3,934.47,943.83,1505982.0 +2017-07-11,929.54,931.43,922.0,930.09,1093281.0,0.0,1.0,929.54,931.43,922.0,930.09,1093281.0 +2017-07-10,921.77,930.38,919.59,928.8,1189085.0,0.0,1.0,921.77,930.38,919.59,928.8,1189085.0 +2017-07-07,908.85,921.54,908.85,918.59,1588034.0,0.0,1.0,908.85,921.54,908.85,918.59,1588034.0 +2017-07-06,904.12,914.9444,899.7,906.69,1409533.0,0.0,1.0,904.12,914.9444,899.7,906.69,1409533.0 +2017-07-05,901.76,914.51,898.5,911.94,1743497.0,0.0,1.0,901.76,914.51,898.5,911.94,1743497.0 +2017-07-03,912.18,913.94,894.79,898.7,1710189.0,0.0,1.0,912.18,913.94,894.79,898.7,1710189.0 +2017-06-30,926.05,926.05,908.31,908.73,2035931.0,0.0,1.0,926.05,926.05,908.31,908.73,2035931.0 +2017-06-29,929.92,931.26,910.62,917.79,3248393.0,0.0,1.0,929.92,931.26,910.62,917.79,3248393.0 +2017-06-28,929.0,942.75,916.0,940.49,2712222.0,0.0,1.0,929.0,942.75,916.0,940.49,2712222.0 +2017-06-27,942.46,948.29,926.85,927.33,2553771.0,0.0,1.0,942.46,948.29,926.85,927.33,2553771.0 +2017-06-26,969.9,973.31,950.79,952.27,1581031.0,0.0,1.0,969.9,973.31,950.79,952.27,1581031.0 +2017-06-23,956.83,966.0,954.2,965.59,1394008.0,0.0,1.0,956.83,966.0,954.2,965.59,1394008.0 +2017-06-22,958.7,960.72,954.55,957.09,940373.0,0.0,1.0,958.7,960.72,954.55,957.09,940373.0 +2017-06-21,953.64,960.1,950.76,959.45,1192342.0,0.0,1.0,953.64,960.1,950.76,959.45,1192342.0 +2017-06-20,957.52,961.62,950.01,950.63,1111840.0,0.0,1.0,957.52,961.62,950.01,950.63,1111840.0 +2017-06-19,949.96,959.99,949.05,957.37,1494191.0,0.0,1.0,949.96,959.99,949.05,957.37,1494191.0 +2017-06-16,940.0,942.04,931.595,939.78,2921393.0,0.0,1.0,940.0,942.04,931.595,939.78,2921393.0 +2017-06-15,933.97,943.339,924.44,942.31,2055953.0,0.0,1.0,933.97,943.339,924.44,942.31,2055953.0 +2017-06-14,959.92,961.15,942.25,950.76,1477033.0,0.0,1.0,959.92,961.15,942.25,950.76,1477033.0 +2017-06-13,951.91,959.98,944.09,953.4,1995350.0,0.0,1.0,951.91,959.98,944.09,953.4,1995350.0 +2017-06-12,939.56,949.355,915.2328,942.9,3731589.0,0.0,1.0,939.56,949.355,915.2328,942.9,3731589.0 +2017-06-09,984.5,984.5,935.63,949.83,3270248.0,0.0,1.0,984.5,984.5,935.63,949.83,3270248.0 +2017-06-08,982.35,984.57,977.2,983.41,1451232.0,0.0,1.0,982.35,984.57,977.2,983.41,1451232.0 +2017-06-07,979.65,984.15,975.77,981.08,1429834.0,0.0,1.0,979.65,984.15,975.77,981.08,1429834.0 +2017-06-06,983.16,988.25,975.14,976.57,1796904.0,0.0,1.0,983.16,988.25,975.14,976.57,1796904.0 +2017-06-05,976.55,986.91,975.1,983.68,1221971.0,0.0,1.0,976.55,986.91,975.1,983.68,1221971.0 +2017-06-02,969.46,975.88,966.0,975.6,1717212.0,0.0,1.0,969.46,975.88,966.0,975.6,1717212.0 +2017-06-01,968.95,971.5,960.01,966.95,1403200.0,0.0,1.0,968.95,971.5,960.01,966.95,1403200.0 diff --git a/examples/demos/stocqt/content/data/GOOGL.csv b/examples/demos/stocqt/content/data/GOOGL.csv new file mode 100644 index 000000000..883f78e5f --- /dev/null +++ b/examples/demos/stocqt/content/data/GOOGL.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,1055.49,1058.05,1052.7,1053.4,1156357.0,0.0,1.0,1055.49,1058.05,1052.7,1053.4,1156357.0 +2017-12-28,1062.25,1064.84,1053.38,1055.95,982285.0,0.0,1.0,1062.25,1064.84,1053.38,1055.95,982285.0 +2017-12-27,1066.6,1068.27,1058.38,1060.2,1027634.0,0.0,1.0,1066.6,1068.27,1058.38,1060.2,1027634.0 +2017-12-26,1068.64,1068.86,1058.64,1065.85,914574.0,0.0,1.0,1068.64,1068.86,1058.64,1065.85,914574.0 +2017-12-22,1070.0,1071.72,1067.64,1068.86,860800.0,0.0,1.0,1070.0,1071.72,1067.64,1068.86,860800.0 +2017-12-21,1075.39,1077.52,1069.0,1070.85,1211012.0,0.0,1.0,1075.39,1077.52,1069.0,1070.85,1211012.0 +2017-12-20,1080.92,1081.23,1068.6,1073.56,1429035.0,0.0,1.0,1080.92,1081.23,1068.6,1073.56,1429035.0 +2017-12-19,1083.02,1084.97,1072.27,1079.78,1287930.0,0.0,1.0,1083.02,1084.97,1072.27,1079.78,1287930.0 +2017-12-18,1076.45,1086.49,1070.37,1085.09,1482768.0,0.0,1.0,1076.45,1086.49,1070.37,1085.09,1482768.0 +2017-12-15,1063.78,1075.25,1060.09,1072.0,3080738.0,0.0,1.0,1063.78,1075.25,1060.09,1072.0,3080738.0 +2017-12-14,1055.49,1067.08,1053.6,1057.47,1531504.0,0.0,1.0,1055.49,1067.08,1053.6,1057.47,1531504.0 +2017-12-13,1052.08,1055.48,1046.58,1051.39,1369580.0,0.0,1.0,1052.08,1055.48,1046.58,1051.39,1369580.0 +2017-12-12,1050.0,1062.5,1044.87,1048.77,1684977.0,0.0,1.0,1050.0,1062.5,1044.87,1048.77,1684977.0 +2017-12-11,1051.11,1056.0,1044.12,1051.97,1096997.0,0.0,1.0,1051.11,1056.0,1044.12,1051.97,1096997.0 +2017-12-08,1051.81,1056.42,1045.86,1049.38,1479665.0,0.0,1.0,1051.81,1056.42,1045.86,1049.38,1479665.0 +2017-12-07,1036.07,1048.92,1035.36,1044.57,1437448.0,0.0,1.0,1036.07,1048.92,1035.36,1044.57,1437448.0 +2017-12-06,1016.52,1039.58,1015.31,1032.72,1369276.0,0.0,1.0,1016.52,1039.58,1015.31,1032.72,1369276.0 +2017-12-05,1010.99,1036.68,1002.32,1019.6,1927802.0,0.0,1.0,1010.99,1036.68,1002.32,1019.6,1927802.0 +2017-12-04,1027.8,1031.34,1009.22,1011.87,1896325.0,0.0,1.0,1027.8,1031.34,1009.22,1011.87,1896325.0 +2017-12-01,1030.41,1037.24,1016.9,1025.07,1850541.0,0.0,1.0,1030.41,1037.24,1016.9,1025.07,1850541.0 +2017-11-30,1039.94,1044.14,1030.07,1036.17,2190379.0,0.0,1.0,1039.94,1044.14,1030.07,1036.17,2190379.0 +2017-11-29,1056.18,1058.77,1029.65,1037.38,2737664.0,0.0,1.0,1056.18,1058.77,1029.65,1037.38,2737664.0 +2017-11-28,1073.99,1080.0,1054.54,1063.29,1694098.0,0.0,1.0,1073.99,1080.0,1054.54,1063.29,1694098.0 +2017-11-27,1058.57,1073.04,1054.77,1072.01,1708195.0,0.0,1.0,1058.57,1073.04,1054.77,1072.01,1708195.0 +2017-11-24,1054.39,1060.07,1051.92,1056.52,825342.0,0.0,1.0,1054.39,1060.07,1051.92,1056.52,825342.0 +2017-11-22,1051.16,1055.43,1047.25,1051.92,721498.0,0.0,1.0,1051.16,1055.43,1047.25,1051.92,721498.0 +2017-11-21,1040.04,1050.39,1039.14,1050.3,1075568.0,0.0,1.0,1040.04,1050.39,1039.14,1050.3,1075568.0 +2017-11-20,1036.0,1038.7,1032.68,1034.66,850423.0,0.0,1.0,1036.0,1038.7,1032.68,1034.66,850423.0 +2017-11-17,1049.8,1051.0,1033.73,1035.89,1286044.0,0.0,1.0,1049.8,1051.0,1033.73,1035.89,1286044.0 +2017-11-16,1038.75,1051.76,1038.0,1048.47,1125995.0,0.0,1.0,1038.75,1051.76,1038.0,1048.47,1125995.0 +2017-11-15,1035.0,1039.63,1030.76,1036.41,900695.0,0.0,1.0,1035.0,1039.63,1030.76,1036.41,900695.0 +2017-11-14,1037.72,1042.3,1029.33,1041.64,982782.0,0.0,1.0,1037.72,1042.3,1029.33,1041.64,982782.0 +2017-11-13,1040.8,1048.74,1039.26,1041.2,914852.0,0.0,1.0,1040.8,1048.74,1039.26,1041.2,914852.0 +2017-11-10,1043.87,1046.63,1041.22,1044.15,955500.0,0.0,1.0,1043.87,1046.63,1041.22,1044.15,955500.0 +2017-11-09,1048.0,1050.88,1035.85,1047.72,1776722.0,0.0,1.0,1048.0,1050.88,1035.85,1047.72,1776722.0 +2017-11-07,1049.65,1053.41,1043.0,1052.39,1254965.0,0.0,1.0,1049.65,1053.41,1043.0,1052.39,1254965.0 +2017-11-06,1049.1,1052.59,1042.0,1042.68,897897.0,0.0,1.0,1049.1,1052.59,1042.0,1042.68,897897.0 +2017-11-03,1042.75,1050.66,1037.65,1049.99,1370874.0,0.0,1.0,1042.75,1050.66,1037.65,1049.99,1370874.0 +2017-11-02,1039.99,1045.52,1028.66,1042.97,1233333.0,0.0,1.0,1039.99,1045.52,1028.66,1042.97,1233333.0 +2017-11-01,1036.32,1047.86,1034.0,1042.6,2105729.0,0.0,1.0,1036.32,1047.86,1034.0,1042.6,2105729.0 +2017-10-31,1033.0,1041.0,1026.3,1033.04,1490660.0,0.0,1.0,1033.0,1041.0,1026.3,1033.04,1490660.0 +2017-10-30,1029.16,1039.83,1022.33,1033.13,2245352.0,0.0,1.0,1029.16,1039.83,1022.33,1033.13,2245352.0 +2017-10-27,1030.99,1063.62,1026.85,1033.67,5139945.0,0.0,1.0,1030.99,1063.62,1026.85,1033.67,5139945.0 +2017-10-26,998.47,1006.51,990.47,991.42,1827682.0,0.0,1.0,998.47,1006.51,990.47,991.42,1827682.0 +2017-10-25,986.27,994.43,977.722,991.46,1368042.0,0.0,1.0,986.27,994.43,977.722,991.46,1368042.0 +2017-10-24,986.5,989.26,977.08,988.49,1416283.0,0.0,1.0,986.5,989.26,977.08,988.49,1416283.0 +2017-10-23,1005.18,1005.79,983.1,985.54,1623580.0,0.0,1.0,1005.18,1005.79,983.1,985.54,1623580.0 +2017-10-20,1007.05,1008.65,1002.27,1005.07,1568454.0,0.0,1.0,1007.05,1008.65,1002.27,1005.07,1568454.0 +2017-10-19,1004.75,1007.32,997.3,1001.84,1677021.0,0.0,1.0,1004.75,1007.32,997.3,1001.84,1677021.0 +2017-10-18,1011.05,1016.31,1005.32,1012.74,1270218.0,0.0,1.0,1011.05,1016.31,1005.32,1012.74,1270218.0 +2017-10-17,1007.44,1014.56,1006.05,1011.0,991412.0,0.0,1.0,1007.44,1014.56,1006.05,1011.0,991412.0 +2017-10-16,1009.63,1012.0,1001.52,1009.35,1066744.0,0.0,1.0,1009.63,1012.0,1001.52,1009.35,1066744.0 +2017-10-13,1009.11,1014.76,1007.06,1007.87,1308881.0,0.0,1.0,1009.11,1014.76,1007.06,1007.87,1308881.0 +2017-10-12,1003.84,1011.54,1001.1,1005.65,1521137.0,0.0,1.0,1003.84,1011.54,1001.1,1005.65,1521137.0 +2017-10-11,989.04,1007.56,987.94,1005.65,1748443.0,0.0,1.0,989.04,1007.56,987.94,1005.65,1748443.0 +2017-10-10,995.3,997.47,981.11,987.8,1158864.0,0.0,1.0,995.3,997.47,981.11,987.8,1158864.0 +2017-10-09,995.0,1000.46,991.5,992.31,1151035.0,0.0,1.0,995.0,1000.46,991.5,992.31,1151035.0 +2017-10-06,980.0,994.26,978.51,993.64,1490744.0,0.0,1.0,980.0,994.26,978.51,993.64,1490744.0 +2017-10-05,972.79,986.5085,970.27,985.19,1627255.0,0.0,1.0,972.79,986.5085,970.27,985.19,1627255.0 +2017-10-04,971.76,974.4,965.61,966.78,896531.0,0.0,1.0,971.76,974.4,965.61,966.78,896531.0 +2017-10-03,967.56,972.44,962.705,972.08,1080312.0,0.0,1.0,967.56,972.44,962.705,972.08,1080312.0 +2017-10-02,975.65,977.74,961.95,967.47,1466444.0,0.0,1.0,975.65,977.74,961.95,967.47,1466444.0 +2017-09-29,966.0,975.81,966.0,973.72,1906445.0,0.0,1.0,966.0,975.81,966.0,973.72,1906445.0 +2017-09-28,956.25,966.18,955.55,964.81,1347750.0,0.0,1.0,956.25,966.18,955.55,964.81,1347750.0 +2017-09-27,942.74,965.43,941.95,959.9,2313498.0,0.0,1.0,942.74,965.43,941.95,959.9,2313498.0 +2017-09-26,936.69,944.08,935.12,937.43,1618182.0,0.0,1.0,936.69,944.08,935.12,937.43,1618182.0 +2017-09-25,939.45,939.75,924.5101,934.28,1847436.0,0.0,1.0,939.45,939.75,924.5101,934.28,1847436.0 +2017-09-22,942.77,950.0,940.835,943.26,1067617.0,0.0,1.0,942.77,950.0,940.835,943.26,1067617.0 +2017-09-21,948.13,952.8,939.38,947.55,1302726.0,0.0,1.0,948.13,952.8,939.38,947.55,1302726.0 +2017-09-20,937.73,950.0,937.5,947.54,1896919.0,0.0,1.0,937.73,950.0,937.5,947.54,1896919.0 +2017-09-19,933.41,937.94,926.66,936.86,1217430.0,0.0,1.0,933.41,937.94,926.66,936.86,1217430.0 +2017-09-18,935.01,936.86,925.4,929.75,1445532.0,0.0,1.0,935.01,936.86,925.4,929.75,1445532.0 +2017-09-15,940.09,941.75,931.25,935.29,1940047.0,0.0,1.0,940.09,941.75,931.25,935.29,1940047.0 +2017-09-14,946.0,948.03,938.356,940.13,1415168.0,0.0,1.0,946.0,948.03,938.356,940.13,1415168.0 +2017-09-13,945.5,952.85,944.74,950.44,1092849.0,0.0,1.0,945.5,952.85,944.74,950.44,1092849.0 +2017-09-12,946.92,948.085,937.5,946.65,1245767.0,0.0,1.0,946.92,948.085,937.5,946.65,1245767.0 +2017-09-11,947.2,952.68,941.0,943.29,1317796.0,0.0,1.0,947.2,952.68,941.0,943.29,1317796.0 +2017-09-08,949.7,950.7,940.01,941.41,996449.0,0.0,1.0,949.7,950.7,940.01,941.41,996449.0 +2017-09-07,944.25,950.4965,937.53,949.89,1103286.0,0.0,1.0,944.25,950.4965,937.53,949.89,1103286.0 +2017-09-06,943.87,944.5,932.68,942.02,1375952.0,0.0,1.0,943.87,944.5,932.68,942.02,1375952.0 +2017-09-05,946.86,951.3854,935.6,941.48,1455058.0,0.0,1.0,946.86,951.3854,935.6,941.48,1455058.0 +2017-09-01,957.47,958.33,950.28,951.99,1034769.0,0.0,1.0,957.47,958.33,950.28,951.99,1034769.0 +2017-08-31,946.3,957.195,946.25,955.24,1672387.0,0.0,1.0,946.3,957.195,946.25,955.24,1672387.0 +2017-08-30,935.67,945.86,934.05,943.63,1112814.0,0.0,1.0,935.67,945.86,934.05,943.63,1112814.0 +2017-08-29,919.95,938.19,919.31,935.75,1144834.0,0.0,1.0,919.95,938.19,919.31,935.75,1144834.0 +2017-08-28,931.88,934.85,926.11,928.13,1025199.0,0.0,1.0,931.88,934.85,926.11,928.13,1025199.0 +2017-08-25,939.21,940.73,930.1,930.5,1169101.0,0.0,1.0,939.21,940.73,930.1,930.5,1169101.0 +2017-08-24,943.71,946.31,930.74,936.89,1249098.0,0.0,1.0,943.71,946.31,930.74,936.89,1249098.0 +2017-08-23,937.0,945.425,935.24,942.58,1126487.0,0.0,1.0,937.0,945.425,935.24,942.58,1126487.0 +2017-08-22,926.96,941.9617,926.17,940.4,1711377.0,0.0,1.0,926.96,941.9617,926.17,940.4,1711377.0 +2017-08-21,925.77,928.25,918.6,920.87,1292624.0,0.0,1.0,925.77,928.25,918.6,920.87,1292624.0 +2017-08-18,926.98,931.02,923.45,926.18,1327288.0,0.0,1.0,926.98,931.02,923.45,926.18,1327288.0 +2017-08-17,942.95,943.81,927.64,927.66,1653779.0,0.0,1.0,942.95,943.81,927.64,927.66,1653779.0 +2017-08-16,941.25,949.9,940.0391,944.27,1329301.0,0.0,1.0,941.25,949.9,940.0391,944.27,1329301.0 +2017-08-15,941.03,943.07,936.64,938.08,1006064.0,0.0,1.0,941.03,943.07,936.64,938.08,1006064.0 +2017-08-14,939.07,941.04,934.485,938.93,1140212.0,0.0,1.0,939.07,941.04,934.485,938.93,1140212.0 +2017-08-11,923.71,933.36,921.22,930.09,1589808.0,0.0,1.0,923.71,933.36,921.22,930.09,1589808.0 +2017-08-10,935.0,936.3,921.7768,923.59,2657279.0,0.0,1.0,935.0,936.3,921.7768,923.59,2657279.0 +2017-08-09,938.45,943.76,933.92,940.08,1360604.0,0.0,1.0,938.45,943.76,933.92,940.08,1360604.0 +2017-08-08,944.29,952.49,942.48,944.19,1438418.0,0.0,1.0,944.29,952.49,942.48,944.19,1438418.0 +2017-08-07,947.52,948.96,943.5,945.75,1405132.0,0.0,1.0,947.52,948.96,943.5,945.75,1405132.0 +2017-08-04,943.95,947.54,939.795,945.79,1192871.0,0.0,1.0,943.95,947.54,939.795,945.79,1192871.0 +2017-08-03,949.1,950.0,939.44,940.3,1028591.0,0.0,1.0,949.1,950.0,939.44,940.3,1028591.0 +2017-08-02,948.37,949.1,932.521,947.64,2019979.0,0.0,1.0,948.37,949.1,932.521,947.64,2019979.0 +2017-08-01,947.81,954.49,944.96,946.56,1205799.0,0.0,1.0,947.81,954.49,944.96,946.56,1205799.0 +2017-07-31,960.0,961.1925,941.725,945.5,2268160.0,0.0,1.0,960.0,961.1925,941.725,945.5,2268160.0 +2017-07-28,947.99,961.79,945.31,958.33,1795477.0,0.0,1.0,947.99,961.79,945.31,958.33,1795477.0 +2017-07-27,969.18,969.52,937.06,952.51,3685905.0,0.0,1.0,969.18,969.52,937.06,952.51,3685905.0 +2017-07-26,972.78,973.95,960.23,965.31,2166225.0,0.0,1.0,972.78,973.95,960.23,965.31,2166225.0 +2017-07-25,970.7,976.73,963.8,969.03,5793414.0,0.0,1.0,970.7,976.73,963.8,969.03,5793414.0 +2017-07-24,994.1,1006.19,990.2728,998.31,3053176.0,0.0,1.0,994.1,1006.19,990.2728,998.31,3053176.0 +2017-07-21,989.0,995.11,984.17,993.84,1412108.0,0.0,1.0,989.0,995.11,984.17,993.84,1412108.0 +2017-07-20,997.0,998.68,984.62,992.19,1410290.0,0.0,1.0,997.0,998.68,984.62,992.19,1410290.0 +2017-07-19,990.01,995.6,987.01,992.77,1392709.0,0.0,1.0,990.01,995.6,987.01,992.77,1392709.0 +2017-07-18,973.36,990.85,972.04,986.95,1398920.0,0.0,1.0,973.36,990.85,972.04,986.95,1398920.0 +2017-07-17,976.32,983.35,970.8,975.96,1644618.0,0.0,1.0,976.32,983.35,970.8,975.96,1644618.0 +2017-07-14,974.0,977.54,970.15,976.91,1048240.0,0.0,1.0,974.0,977.54,970.15,976.91,1048240.0 +2017-07-13,970.8,978.7,964.8,968.7175,1519987.0,0.0,1.0,970.8,978.7,964.8,968.7175,1519987.0 +2017-07-12,960.86,969.63,957.04,967.66,1589548.0,0.0,1.0,960.86,969.63,957.04,967.66,1589548.0 +2017-07-11,950.52,954.89,945.12,953.53,1444540.0,0.0,1.0,950.52,954.89,945.12,953.53,1444540.0 +2017-07-10,941.95,953.13,941.95,951.0,1409850.0,0.0,1.0,941.95,953.13,941.95,951.0,1409850.0 +2017-07-07,930.985,944.66,929.79,940.81,1614080.0,0.0,1.0,930.985,944.66,929.79,940.81,1614080.0 +2017-07-06,925.0,936.14,919.85,927.69,1941822.0,0.0,1.0,925.0,936.14,919.85,927.69,1941822.0 +2017-07-05,924.2,936.29,918.6305,932.26,2054927.0,0.0,1.0,924.2,936.29,918.6305,932.26,2054927.0 +2017-07-03,933.22,934.24,915.31,919.46,1694587.0,0.0,1.0,933.22,934.24,915.31,919.46,1694587.0 +2017-06-30,943.99,944.9995,929.61,929.68,2185444.0,0.0,1.0,943.99,944.9995,929.61,929.68,2185444.0 +2017-06-29,951.35,951.66,929.6,937.82,3182331.0,0.0,1.0,951.35,951.66,929.6,937.82,3182331.0 +2017-06-28,950.66,963.24,936.16,961.01,2713366.0,0.0,1.0,950.66,963.24,936.16,961.01,2713366.0 +2017-06-27,961.6,967.22,947.09,948.09,2428048.0,0.0,1.0,961.6,967.22,947.09,948.09,2428048.0 +2017-06-26,990.0,993.99,970.33,972.09,1505655.0,0.0,1.0,990.0,993.99,970.33,972.09,1505655.0 +2017-06-23,975.5,986.62,974.46,986.09,1439728.0,0.0,1.0,975.5,986.62,974.46,986.09,1439728.0 +2017-06-22,976.87,980.5,973.3148,976.62,940086.0,0.0,1.0,976.87,980.5,973.3148,976.62,940086.0 +2017-06-21,970.79,979.67,969.16,978.59,1141315.0,0.0,1.0,970.79,979.67,969.16,978.59,1141315.0 +2017-06-20,975.31,980.79,968.2,968.99,1273013.0,0.0,1.0,975.31,980.79,968.2,968.99,1273013.0 +2017-06-19,969.65,979.3,968.2,975.22,1449343.0,0.0,1.0,969.65,979.3,968.2,975.22,1449343.0 +2017-06-16,957.91,959.95,948.7,958.62,2484914.0,0.0,1.0,957.91,959.95,948.7,958.62,2484914.0 +2017-06-15,948.02,960.6775,940.37,960.18,2349212.0,0.0,1.0,948.02,960.6775,940.37,960.18,2349212.0 +2017-06-14,975.5,979.7,959.5103,967.93,1489046.0,0.0,1.0,975.5,979.7,959.5103,967.93,1489046.0 +2017-06-13,972.04,977.91,962.01,970.5,1992456.0,0.0,1.0,972.04,977.91,962.01,970.5,1992456.0 +2017-06-12,958.72,968.0,936.795,961.81,4167184.0,0.0,1.0,958.72,968.0,936.795,961.81,4167184.0 +2017-06-09,1005.49,1005.5,953.37,970.12,3613964.0,0.0,1.0,1005.49,1005.5,953.37,970.12,3613964.0 +2017-06-08,1004.23,1005.6,996.62,1004.28,1657881.0,0.0,1.0,1004.23,1005.6,996.62,1004.28,1657881.0 +2017-06-07,998.82,1003.91,995.81,1001.59,1348198.0,0.0,1.0,998.82,1003.91,995.81,1001.59,1348198.0 +2017-06-06,1003.31,1008.61,994.8,996.68,1517356.0,0.0,1.0,1003.31,1008.61,994.8,996.68,1517356.0 +2017-06-05,997.89,1007.4,995.45,1003.88,1353264.0,0.0,1.0,997.89,1007.4,995.45,1003.88,1353264.0 +2017-06-02,988.59,996.48,987.07,996.12,1719720.0,0.0,1.0,988.59,996.48,987.07,996.12,1719720.0 +2017-06-01,990.96,993.14,981.29,988.29,1295552.0,0.0,1.0,990.96,993.14,981.29,988.29,1295552.0 diff --git a/examples/demos/stocqt/content/data/INTC.csv b/examples/demos/stocqt/content/data/INTC.csv new file mode 100644 index 000000000..9e762ffb4 --- /dev/null +++ b/examples/demos/stocqt/content/data/INTC.csv @@ -0,0 +1,147 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,46.21,46.49,46.09,46.16,17136416.0,0.0,1.0,46.21,46.49,46.09,46.16,17136416.0 +2017-12-28,46.36,46.36,45.95,46.22,9279766.0,0.0,1.0,46.36,46.36,45.95,46.22,9279766.0 +2017-12-27,46.11,46.36,46.0,46.11,12412977.0,0.0,1.0,46.11,46.36,46.0,46.11,12412977.0 +2017-12-26,46.28,46.47,45.95,46.08,15477747.0,0.0,1.0,46.28,46.47,45.95,46.08,15477747.0 +2017-12-22,46.33,47.02,46.02,46.7,33404280.0,0.0,1.0,46.33,47.02,46.02,46.7,33404280.0 +2017-12-21,47.54,47.59,46.56,46.76,42113273.0,0.0,1.0,47.54,47.59,46.56,46.76,42113273.0 +2017-12-20,47.47,47.64,46.66,47.56,39536777.0,0.0,1.0,47.47,47.64,46.66,47.56,39536777.0 +2017-12-19,46.3,47.26,45.89,47.04,39973826.0,0.0,1.0,46.3,47.26,45.89,47.04,39973826.0 +2017-12-18,45.15,46.35,45.04,46.26,49305190.0,0.0,1.0,45.15,46.35,45.04,46.26,49305190.0 +2017-12-15,43.4,44.84,43.07,44.56,44377039.0,0.0,1.0,43.4,44.84,43.07,44.56,44377039.0 +2017-12-14,43.43,43.57,43.015,43.26,18871565.0,0.0,1.0,43.43,43.57,43.015,43.26,18871565.0 +2017-12-13,43.65,43.66,43.24,43.34,21055298.0,0.0,1.0,43.65,43.66,43.24,43.34,21055298.0 +2017-12-12,43.47,43.62,43.08,43.33,15571482.0,0.0,1.0,43.47,43.62,43.08,43.33,15571482.0 +2017-12-11,43.28,43.78,43.25,43.66,18840783.0,0.0,1.0,43.28,43.78,43.25,43.66,18840783.0 +2017-12-08,43.35,43.58,43.11,43.35,22833083.0,0.0,1.0,43.35,43.58,43.11,43.35,22833083.0 +2017-12-07,43.46,43.6,42.78,43.08,31193561.0,0.0,1.0,43.46,43.6,42.78,43.08,31193561.0 +2017-12-06,43.14,43.72,42.67,43.45,24497550.0,0.0,1.0,43.14,43.72,42.67,43.45,24497550.0 +2017-12-05,44.6,44.9,43.23,43.44,30112131.0,0.0,1.0,44.6,44.9,43.23,43.44,30112131.0 +2017-12-04,45.02,45.3,44.33,44.49,26829460.0,0.0,1.0,45.02,45.3,44.33,44.49,26829460.0 +2017-12-01,44.73,44.84,43.53,44.68,26393385.0,0.0,1.0,44.73,44.84,43.53,44.68,26393385.0 +2017-11-30,44.36,45.2,44.33,44.84,32735416.0,0.0,1.0,44.36,45.2,44.33,44.84,32735416.0 +2017-11-29,44.85,45.09,43.77,43.95,26246867.0,0.0,1.0,44.85,45.09,43.77,43.95,26246867.0 +2017-11-28,44.65,44.84,44.32,44.73,19084500.0,0.0,1.0,44.65,44.84,44.32,44.73,19084500.0 +2017-11-27,44.42,44.61,44.2736,44.49,17187942.0,0.0,1.0,44.42,44.61,44.2736,44.49,17187942.0 +2017-11-24,44.55,44.775,44.43,44.75,6465615.0,0.0,1.0,44.55,44.775,44.43,44.75,6465615.0 +2017-11-22,44.94,44.95,44.535,44.65,19191241.0,0.0,1.0,44.94,44.95,44.535,44.65,19191241.0 +2017-11-21,44.72,45.22,44.71,44.94,20730988.0,0.0,1.0,44.72,45.22,44.71,44.94,20730988.0 +2017-11-20,44.73,45.115,44.5,44.62,22162614.0,0.0,1.0,44.73,45.115,44.5,44.62,22162614.0 +2017-11-17,45.5,45.62,44.62,44.63,62637555.0,0.0,1.0,45.5,45.62,44.62,44.63,62637555.0 +2017-11-16,45.63,46.07,45.46,45.65,21446297.0,0.0,1.0,45.63,46.07,45.46,45.65,21446297.0 +2017-11-15,45.39,45.805,45.1725,45.46,16781344.0,0.0,1.0,45.39,45.805,45.1725,45.46,16781344.0 +2017-11-14,45.7,45.92,45.32,45.86,20747874.0,0.0,1.0,45.7,45.92,45.32,45.86,20747874.0 +2017-11-13,45.26,45.94,45.25,45.75,18923183.0,0.0,1.0,45.26,45.94,45.25,45.75,18923183.0 +2017-11-10,46.04,46.09,45.38,45.58,23953470.0,0.0,1.0,46.04,46.09,45.38,45.58,23953470.0 +2017-11-09,46.05,46.39,45.65,46.3,24830309.0,0.0,1.0,46.05,46.39,45.65,46.3,24830309.0 +2017-11-07,46.7,47.09,46.39,46.78,23074092.0,0.0,1.0,46.7,47.09,46.39,46.78,23074092.0 +2017-11-06,46.6,46.74,46.09,46.7,31865449.0,0.273,1.0,46.329167819811,46.468354160901,45.822131862985,46.428586634875,31865449.0 +2017-11-03,47.2,47.3,45.6,46.34,38647115.0,0.0,1.0,46.652955722779,46.751796730667,45.071499596583,45.802923054949,38647115.0 +2017-11-02,46.61,47.23,46.213,47.1,37260192.0,0.0,1.0,46.069793776245,46.682608025146,45.677394974932,46.554114714892,37260192.0 +2017-11-01,45.97,46.71,45.59,46.71,47077781.0,0.0,1.0,45.437211325766,46.168634784132,45.061615495795,46.168634784132,47077781.0 +2017-10-31,45.2,45.8,44.65,45.49,46206973.0,0.0,1.0,44.676135565035,45.269181612358,44.132510021655,44.962774487908,46206973.0 +2017-10-30,44.48,45.19,43.88,44.37,46012316.0,0.0,1.0,43.964480308246,44.666251464246,43.371434260923,43.85575519957,46012316.0 +2017-10-27,43.3,45.0,43.1,44.4,88413551.0,0.0,1.0,42.798156415177,44.47845354926,42.600474399402,43.885407501937,88413551.0 +2017-10-26,40.91,41.575,40.71,41.35,35618913.0,0.0,1.0,40.435856326672,41.093149029122,40.238174310897,40.870756761376,35618913.0 +2017-10-25,40.89,41.055,40.49,40.78,23079947.0,0.0,1.0,40.416088125094,40.579175788108,40.020724093545,40.307363016418,23079947.0 +2017-10-24,41.0,41.05,40.72,40.95,18616857.0,0.0,1.0,40.52481323377,40.574233737714,40.248058411686,40.475392729827,18616857.0 +2017-10-23,40.55,41.04,40.395,40.83,28306520.0,0.0,1.0,40.080028698278,40.564349636925,39.926825136052,40.356783520362,28306520.0 +2017-10-20,40.33,40.45,40.1,40.43,17556315.0,0.0,1.0,39.862578480926,39.98118769039,39.635244162785,39.961419488813,17556315.0 +2017-10-19,39.88,40.33,39.83,40.09,18541779.0,0.0,1.0,39.417793945433,39.862578480926,39.368373441489,39.625360061996,18541779.0 +2017-10-18,39.8,40.29,39.6,40.25,20592939.0,0.0,1.0,39.338721139123,39.823042077771,39.141039123349,39.783505674616,20592939.0 +2017-10-17,39.56,39.865,39.37,39.79,15300505.0,0.0,1.0,39.101502720194,39.40296779425,38.913704805208,39.328837038335,15300505.0 +2017-10-16,39.71,39.79,39.44,39.76,12448746.0,0.0,1.0,39.249764232025,39.328837038335,38.982893510729,39.299184735968,12448746.0 +2017-10-13,39.44,39.81,39.28,39.67,16611521.0,0.0,1.0,38.982893510729,39.348605239912,38.82474789811,39.21022782887,16611521.0 +2017-10-12,39.35,39.39,38.98,39.19,18236204.0,0.0,1.0,38.893936603631,38.933473006786,38.528224874448,38.735790991011,18236204.0 +2017-10-11,39.48,39.67,39.06,39.3,30452182.0,0.0,1.0,39.022429913884,39.21022782887,38.607297680758,38.844516099687,30452182.0 +2017-10-10,39.93,39.95,39.38,39.65,29838331.0,0.0,1.0,39.467214449377,39.486982650954,38.923588905997,39.190459627292,29838331.0 +2017-10-09,39.68,39.88,39.52,39.86,18372360.0,0.0,1.0,39.220111929659,39.417793945433,39.061966317039,39.398025743856,18372360.0 +2017-10-06,39.6,39.89,39.42,39.63,18063051.0,0.0,1.0,39.141039123349,39.427678046222,38.963125309152,39.170691425715,18063051.0 +2017-10-05,39.5,39.65,39.21,39.53,17588371.0,0.0,1.0,39.042198115462,39.190459627292,38.755559192589,39.071850417828,17588371.0 +2017-10-04,39.39,39.4,38.8606,39.34,27900633.0,0.0,1.0,38.933473006786,38.943357107574,38.410208711031,38.884052502842,27900633.0 +2017-10-03,38.95,39.7,38.95,39.38,33266885.0,0.0,1.0,38.498572572082,39.239880131236,38.498572572082,38.923588905997,33266885.0 +2017-10-02,38.12,39.09,38.08,39.04,36985170.0,0.0,1.0,37.678192206618,38.636949983124,37.638655803463,38.58752947918,36985170.0 +2017-09-29,37.84,38.15,37.7,38.08,22617651.0,0.0,1.0,37.401437384533,37.707844508984,37.263059973491,37.638655803463,22617651.0 +2017-09-28,37.32,37.88,37.29,37.83,20601061.0,0.0,1.0,36.88746414352,37.440973787688,36.857811841153,37.391553283745,20601061.0 +2017-09-27,37.62,37.69,37.1,37.54,25457387.0,0.0,1.0,37.183987167181,37.253175872702,36.670013926168,37.104914360872,25457387.0 +2017-09-26,37.21,37.64,37.0,37.47,29198356.0,0.0,1.0,36.778739034844,37.203755368759,36.57117291828,37.035725655351,29198356.0 +2017-09-25,37.05,37.23,36.85,37.16,22158905.0,0.0,1.0,36.620593422224,36.798507236421,36.42291140645,36.7293185309,22158905.0 +2017-09-22,36.95,37.22,36.95,37.18,20928369.0,0.0,1.0,36.521752414337,36.788623135632,36.521752414337,36.749086732477,20928369.0 +2017-09-21,36.99,37.27,36.85,37.2,20175216.0,0.0,1.0,36.561288817492,36.838043639576,36.42291140645,36.768854934055,20175216.0 +2017-09-20,37.23,37.29,36.655,37.07,23127098.0,0.0,1.0,36.798507236421,36.857811841153,36.230171441069,36.640361623802,23127098.0 +2017-09-19,37.2,37.295,37.02,37.23,21823446.0,0.0,1.0,36.768854934055,36.862753891548,36.590941119858,36.798507236421,21823446.0 +2017-09-18,37.0,37.33,36.8,37.0,19083499.0,0.0,1.0,36.57117291828,36.897348244308,36.373490902506,36.57117291828,19083499.0 +2017-09-15,36.55,37.08,36.22,37.0,32109972.0,0.0,1.0,36.126388382788,36.65024572459,35.80021305676,36.57117291828,32109972.0 +2017-09-14,36.19,36.695,36.16,36.48,17902903.0,0.0,1.0,35.770560754394,36.269707844224,35.740908452028,36.057199677267,17902903.0 +2017-09-13,36.0,36.4,35.97,36.33,15069601.0,0.0,1.0,35.582762839408,35.978126870957,35.553110537042,35.908938165436,15069601.0 +2017-09-12,35.88,36.34,35.74,36.09,19061818.0,0.0,1.0,35.464153629943,35.918822266225,35.325776218901,35.671719746507,19061818.0 +2017-09-11,35.49,36.0,35.14,35.77,18895979.0,0.0,1.0,35.078673699183,35.582762839408,34.732730171578,35.355428521267,18895979.0 +2017-09-08,35.42,35.54,35.08,35.19,13881093.0,0.0,1.0,35.009484993662,35.128094203127,34.673425566845,34.782150675521,13881093.0 +2017-09-07,35.88,35.95,35.33,35.54,16045217.0,0.0,1.0,35.464153629943,35.533342335464,34.920528086563,35.128094203127,16045217.0 +2017-09-06,35.22,35.94,35.11,35.76,26811090.0,0.0,1.0,34.811802977888,35.523458234676,34.703077869212,35.345544420479,26811090.0 +2017-09-05,35.02,35.33,34.93,35.02,18665229.0,0.0,1.0,34.614120962113,34.920528086563,34.525164055014,34.614120962113,18665229.0 +2017-09-01,35.24,35.39,35.07,35.085,12713069.0,0.0,1.0,34.831571179465,34.979832691296,34.663541466057,34.67836761724,12713069.0 +2017-08-31,34.94,35.18,34.87,35.07,15959145.0,0.0,1.0,34.535048155803,34.772266574733,34.465859450282,34.663541466057,15959145.0 +2017-08-30,34.75,34.96,34.63,34.89,18230633.0,0.0,1.0,34.347250240817,34.554816357381,34.228641031353,34.48562765186,18230633.0 +2017-08-29,34.51,34.75,34.455,34.73,15605382.0,0.0,1.0,34.110031821888,34.347250240817,34.05566926755,34.32748203924,15605382.0 +2017-08-28,34.78,34.8,34.59,34.65,20463229.0,0.0,1.0,34.376902543184,34.396670744761,34.189104628198,34.24840923293,20463229.0 +2017-08-25,34.82,34.93,34.58,34.67,14126663.0,0.0,1.0,34.416438946339,34.525164055014,34.179220527409,34.268177434508,14126663.0 +2017-08-24,34.7,34.89,34.55,34.71,13495890.0,0.0,1.0,34.297829736874,34.48562765186,34.149568225043,34.307713837663,13495890.0 +2017-08-23,34.54,34.81,34.38,34.66,19439392.0,0.0,1.0,34.139684124254,34.40655484555,33.981538511635,34.258293333719,19439392.0 +2017-08-22,35.02,35.19,34.62,34.65,25496798.0,0.0,1.0,34.614120962113,34.782150675521,34.218756930564,34.24840923293,25496798.0 +2017-08-21,35.09,35.28,34.7,34.92,25642017.0,0.0,1.0,34.683309667634,34.87110758262,34.297829736874,34.515279954226,25642017.0 +2017-08-18,35.29,35.31,34.99,35.01,15556756.0,0.0,1.0,34.880991683409,34.900759884986,34.584468659747,34.604236861324,15556756.0 +2017-08-17,35.6,35.68,35.17,35.17,18464078.0,0.0,1.0,35.187398807859,35.266471614169,34.762382473944,34.762382473944,18464078.0 +2017-08-16,35.98,36.07,35.56,35.82,21319536.0,0.0,1.0,35.562994637831,35.651951544929,35.147862404704,35.404849025211,21319536.0 +2017-08-15,36.3,36.32,35.815,36.0,20630421.0,0.0,1.0,35.87928586307,35.899054064647,35.399906974817,35.582762839408,20630421.0 +2017-08-14,36.12,36.47,36.08,36.34,16255600.0,0.0,1.0,35.701372048873,36.047315576478,35.661835645718,35.918822266225,16255600.0 +2017-08-11,36.26,36.4,35.79,35.87,18697159.0,0.0,1.0,35.839749459915,35.978126870957,35.375196722845,35.454269529155,18697159.0 +2017-08-10,36.4,36.56,36.11,36.12,22414962.0,0.0,1.0,35.978126870957,36.136272483577,35.691487948084,35.701372048873,22414962.0 +2017-08-09,36.28,36.66,36.02,36.59,22596679.0,0.0,1.0,35.859517661492,36.235113491464,35.602531040985,36.165924785943,22596679.0 +2017-08-08,36.37,36.7,36.3,36.41,21067835.0,0.0,1.0,35.948474568591,36.274649894619,35.87928586307,35.988010971746,21067835.0 +2017-08-04,36.45,36.56,36.1,36.3,20312844.0,0.0,1.0,36.027547374901,36.136272483577,35.681603847295,35.87928586307,20312844.0 +2017-08-03,36.55,36.59,36.15,36.49,26377878.0,0.273,1.0,36.126388382788,36.165924785943,35.731024351239,36.067083778056,26377878.0 +2017-08-02,36.33,36.67,36.055,36.64,34502824.0,0.0,1.0,35.642280381273,35.975844249416,35.372486076158,35.946412143404,34502824.0 +2017-08-01,35.66,36.43,35.57,36.35,37556349.0,0.0,1.0,34.984963346992,35.740387401316,34.896667028954,35.661901785282,37556349.0 +2017-07-31,35.47,35.74,35.32,35.47,26748090.0,0.0,1.0,34.798560008912,35.063448963025,34.651399478849,34.798560008912,26748090.0 +2017-07-28,35.13,35.86,35.0,35.31,35538732.0,0.0,1.0,34.464996140769,35.181177387076,34.337457014714,34.641588776845,35538732.0 +2017-07-27,34.78,35.25,34.67,34.97,39239149.0,0.0,1.0,34.121621570622,34.582724564819,34.013703848576,34.308024908702,39239149.0 +2017-07-26,34.7,34.97,34.59,34.75,15400452.0,0.0,1.0,34.043135954588,34.308024908702,33.935218232542,34.092189464609,15400452.0 +2017-07-25,34.55,34.735,34.4,34.67,17569006.0,0.0,1.0,33.895975424525,34.077473411603,33.748814894462,34.013703848576,17569006.0 +2017-07-24,34.73,34.8,34.38,34.5,15114242.0,0.0,1.0,34.072568060601,34.14124297463,33.729193490454,33.846921914504,15114242.0 +2017-07-21,34.54,34.82,34.395,34.73,21682999.0,0.0,1.0,33.886164722521,34.160864378639,33.74390954346,34.072568060601,21682999.0 +2017-07-20,34.54,34.84,34.475,34.75,16643270.0,0.0,1.0,33.886164722521,34.180485782647,33.822395159494,34.092189464609,16643270.0 +2017-07-19,34.68,34.68,34.46,34.56,15923372.0,0.0,1.0,34.02351455058,34.02351455058,33.807679106487,33.905786126529,15923372.0 +2017-07-18,34.43,34.58,34.25,34.53,14031968.0,0.0,1.0,33.778247000475,33.925407530538,33.601654364399,33.876354020517,14031968.0 +2017-07-17,34.74,34.74,34.36,34.47,20910434.0,0.0,1.0,34.082378762605,34.082378762605,33.709572086445,33.817489808492,20910434.0 +2017-07-14,34.48,34.71,34.265,34.68,16039785.0,0.0,1.0,33.827300510496,34.052946656592,33.616370417405,34.02351455058,16039785.0 +2017-07-13,34.33,34.4,34.12,34.24,14978889.0,0.0,1.0,33.680139980433,33.748814894462,33.474115238344,33.591843662395,14978889.0 +2017-07-12,34.28,34.39,33.94,34.25,23430086.0,0.0,1.0,33.631086470412,33.739004192458,33.297522602269,33.601654364399,23430086.0 +2017-07-11,33.64,33.93,33.4311,33.92,24800985.0,0.0,1.0,33.003201542143,33.287711900264,32.798255977275,33.27790119826,24800985.0 +2017-07-10,33.25,33.74,33.23,33.65,26781949.0,0.0,1.0,32.620584163979,33.101308562185,32.60096275997,33.013012244147,26781949.0 +2017-07-07,33.7,34.12,33.7,33.88,17702383.0,0.0,1.0,33.062065754168,33.474115238344,33.062065754168,33.238658390243,17702383.0 +2017-07-06,34.12,34.29,33.56,33.63,20161025.0,0.0,1.0,33.474115238344,33.640897172416,32.924715926109,32.993390840138,20161025.0 +2017-07-05,33.52,34.43,33.485,34.34,29307289.0,0.0,1.0,32.885473118092,33.778247000475,32.851135661077,33.689950682437,29307289.0 +2017-07-03,33.51,34.03,33.43,33.46,12676069.0,0.0,1.0,32.875662416088,33.385818920307,32.797176800054,32.826608906067,12676069.0 +2017-06-30,33.87,33.93,33.535,33.74,23636451.0,0.0,1.0,33.228847688239,33.287711900264,32.900189171098,33.101308562185,23636451.0 +2017-06-29,33.92,34.1,33.34,33.54,24613002.0,0.0,1.0,33.27790119826,33.454493834336,32.708880482016,32.905094522101,24613002.0 +2017-06-28,33.77,34.24,33.74,34.2,25777730.0,0.0,1.0,33.130740668197,33.591843662395,33.101308562185,33.552600854378,25777730.0 +2017-06-27,34.0,34.145,33.65,33.65,26891930.0,0.0,1.0,33.356386814294,33.498641993355,33.013012244147,33.013012244147,26891930.0 +2017-06-26,34.26,34.51,34.03,34.07,18379220.0,0.0,1.0,33.611465066403,33.856732616508,33.385818920307,33.425061728323,18379220.0 +2017-06-23,34.21,34.55,34.095,34.19,24381873.0,0.0,1.0,33.562411556382,33.895975424525,33.449588483334,33.542790152374,24381873.0 +2017-06-22,34.56,34.63,34.29,34.36,23744016.0,0.0,1.0,33.905786126529,33.974461040559,33.640897172416,33.709572086445,23744016.0 +2017-06-21,34.33,34.6,34.09,34.58,26338267.0,0.0,1.0,33.680139980433,33.945028934546,33.444683132332,33.925407530538,26338267.0 +2017-06-20,35.45,35.45,34.84,34.86,21024240.0,0.0,1.0,34.778938604904,34.778938604904,34.180485782647,34.200107186655,21024240.0 +2017-06-19,35.61,35.61,35.32,35.51,20336817.0,0.0,1.0,34.935909836971,34.935909836971,34.651399478849,34.837802816929,20336817.0 +2017-06-16,35.28,35.33,35.01,35.21,28353654.0,0.0,1.0,34.612156670832,34.661210180853,34.347267716719,34.543481756803,28353654.0 +2017-06-15,35.21,35.48,35.14,35.31,19954738.0,0.0,1.0,34.543481756803,34.808370710916,34.474806842773,34.641588776845,19954738.0 +2017-06-14,35.99,36.05,35.22,35.53,19001268.0,0.0,1.0,35.308716513131,35.367580725156,34.553292458807,34.857424220937,19001268.0 +2017-06-13,35.68,35.95,35.53,35.88,20398500.0,0.0,1.0,35.004584751,35.269473705114,34.857424220937,35.200798791084,20398500.0 +2017-06-12,35.59,36.01,35.41,35.73,27374877.0,0.0,1.0,34.916288432962,35.328337917139,34.739695796887,35.053638261021,27374877.0 +2017-06-09,36.5,36.56,35.31,35.71,32858966.0,0.0,1.0,35.809062315345,35.86792652737,34.641588776845,35.034016857013,32858966.0 +2017-06-08,36.34,36.53,36.16,36.48,16202388.0,0.0,1.0,35.652091083278,35.838494421358,35.475498447202,35.789440911337,16202388.0 +2017-06-07,36.13,36.57,36.1,36.26,16521287.0,0.0,1.0,35.446066341189,35.877737229374,35.416634235177,35.573605467244,16521287.0 +2017-06-06,36.16,36.45,35.98,36.13,18153646.0,0.0,1.0,35.475498447202,35.760008805324,35.298905811126,35.446066341189,18153646.0 +2017-06-05,36.3,36.5,36.2,36.34,11288983.0,0.0,1.0,35.612848275261,35.809062315345,35.514741255219,35.652091083278,11288983.0 +2017-06-02,36.27,36.33,36.0,36.32,18902927.0,0.0,1.0,35.583416169248,35.642280381273,35.318527215135,35.632469679269,18902927.0 +2017-06-01,36.12,36.13,35.8,36.12,17288864.0,0.0,1.0,35.436255639185,35.446066341189,35.122313175051,35.436255639185,17288864.0 diff --git a/examples/demos/stocqt/content/data/MSFT.csv b/examples/demos/stocqt/content/data/MSFT.csv new file mode 100644 index 000000000..056639e4c --- /dev/null +++ b/examples/demos/stocqt/content/data/MSFT.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,85.63,86.05,85.5,85.54,18162779.0,0.0,1.0,85.63,86.05,85.5,85.54,18162779.0 +2017-12-28,85.9,85.93,85.55,85.72,9872795.0,0.0,1.0,85.9,85.93,85.55,85.72,9872795.0 +2017-12-27,85.65,85.98,85.215,85.71,13000828.0,0.0,1.0,85.65,85.98,85.215,85.71,13000828.0 +2017-12-26,85.31,85.5346,85.03,85.4,9737412.0,0.0,1.0,85.31,85.5346,85.03,85.4,9737412.0 +2017-12-22,85.4,85.63,84.92,85.51,14033977.0,0.0,1.0,85.4,85.63,84.92,85.51,14033977.0 +2017-12-21,86.05,86.1,85.4,85.5,16638402.0,0.0,1.0,86.05,86.1,85.4,85.5,16638402.0 +2017-12-20,86.2,86.3,84.71,85.52,23425009.0,0.0,1.0,86.2,86.3,84.71,85.52,23425009.0 +2017-12-19,86.35,86.35,85.27,85.83,23241979.0,0.0,1.0,86.35,86.35,85.27,85.83,23241979.0 +2017-12-18,87.12,87.4999,86.23,86.38,21551076.0,0.0,1.0,87.12,87.4999,86.23,86.38,21551076.0 +2017-12-15,85.26,87.09,84.88,86.85,52430167.0,0.0,1.0,85.26,87.09,84.88,86.85,52430167.0 +2017-12-14,85.43,85.8739,84.53,84.69,19080106.0,0.0,1.0,85.43,85.8739,84.53,84.69,19080106.0 +2017-12-13,85.74,86.0,85.17,85.35,21307911.0,0.0,1.0,85.74,86.0,85.17,85.35,21307911.0 +2017-12-12,85.31,86.05,85.08,85.58,23534946.0,0.0,1.0,85.31,86.05,85.08,85.58,23534946.0 +2017-12-11,84.29,85.37,84.12,85.23,19909119.0,0.0,1.0,84.29,85.37,84.12,85.23,19909119.0 +2017-12-08,83.63,84.58,83.33,84.16,23825056.0,0.0,1.0,83.63,84.58,83.33,84.16,23825056.0 +2017-12-07,82.54,82.8,82.0,82.49,20378114.0,0.0,1.0,82.54,82.8,82.0,82.49,20378114.0 +2017-12-06,81.55,83.14,81.43,82.78,24821403.0,0.0,1.0,81.55,83.14,81.43,82.78,24821403.0 +2017-12-05,81.34,82.68,80.9801,81.59,25512120.0,0.0,1.0,81.34,82.68,80.9801,81.59,25512120.0 +2017-12-04,84.42,84.4299,80.7,81.08,37977732.0,0.0,1.0,84.42,84.4299,80.7,81.08,37977732.0 +2017-12-01,83.6,84.81,83.22,84.26,29113662.0,0.0,1.0,83.6,84.81,83.22,84.26,29113662.0 +2017-11-30,83.51,84.52,83.34,84.17,32074914.0,0.0,1.0,83.51,84.52,83.34,84.17,32074914.0 +2017-11-29,84.71,84.9172,83.175,83.34,26401761.0,0.0,1.0,84.71,84.9172,83.175,83.34,26401761.0 +2017-11-28,84.07,85.06,84.02,84.88,21162639.0,0.0,1.0,84.07,85.06,84.02,84.88,21162639.0 +2017-11-27,83.31,83.98,83.3,83.87,17603760.0,0.0,1.0,83.31,83.98,83.3,83.87,17603760.0 +2017-11-24,83.01,83.43,82.78,83.26,7425503.0,0.0,1.0,83.01,83.43,82.78,83.26,7425503.0 +2017-11-22,83.83,83.9,83.04,83.11,20213704.0,0.0,1.0,83.83,83.9,83.04,83.11,20213704.0 +2017-11-21,82.74,83.84,82.74,83.72,21033981.0,0.0,1.0,82.74,83.84,82.74,83.72,21033981.0 +2017-11-20,82.4,82.59,82.25,82.53,16072495.0,0.0,1.0,82.4,82.59,82.25,82.53,16072495.0 +2017-11-17,83.12,83.12,82.24,82.4,21715498.0,0.0,1.0,83.12,83.12,82.24,82.4,21715498.0 +2017-11-16,83.1,83.42,82.94,83.2,20659209.0,0.0,1.0,83.1,83.42,82.94,83.2,20659209.0 +2017-11-15,83.47,83.69,82.69,82.98,19097333.0,0.42,1.0,83.47,83.69,82.69,82.98,19097333.0 +2017-11-14,83.5,84.1,82.98,84.05,18604034.0,0.0,1.0,83.079496402878,83.676474820144,82.562115107914,83.626726618705,18604034.0 +2017-11-13,83.66,83.94,83.46,83.93,14080820.0,0.0,1.0,83.238690647482,83.51728057554,83.039697841727,83.507330935252,14080820.0 +2017-11-10,83.79,84.095,83.23,83.87,19340435.0,0.0,1.0,83.368035971223,83.6715,82.810856115108,83.447633093525,19340435.0 +2017-11-09,84.11,84.27,82.9,84.09,20924172.0,0.0,1.0,83.686424460432,83.845618705036,82.482517985612,83.666525179856,20924172.0 +2017-11-07,84.77,84.9,83.93,84.27,17152583.0,0.0,1.0,84.343100719424,84.472446043165,83.507330935252,83.845618705036,17152583.0 +2017-11-06,84.2,84.7,84.0825,84.47,19039847.0,0.0,1.0,83.775971223022,84.27345323741,83.65906294964,84.044611510791,19039847.0 +2017-11-03,84.08,84.54,83.4,84.14,17569120.0,0.0,1.0,83.656575539568,84.114258992806,82.98,83.716273381295,17569120.0 +2017-11-02,83.35,84.46,83.12,84.05,23822964.0,0.0,1.0,82.930251798561,84.034661870504,82.701410071942,83.626726618705,23822964.0 +2017-11-01,83.68,83.76,82.88,83.18,22039635.0,0.0,1.0,83.258589928058,83.33818705036,82.462618705036,82.761107913669,22039635.0 +2017-10-31,84.36,84.36,83.11,83.18,26728947.0,0.0,1.0,83.935165467626,83.935165467626,82.691460431655,82.761107913669,26728947.0 +2017-10-30,83.7,84.325,83.105,83.89,31291801.0,0.0,1.0,83.278489208633,83.900341726619,82.686485611511,83.467532374101,31291801.0 +2017-10-27,84.37,86.2,83.61,83.81,70877350.0,0.0,1.0,83.945115107914,85.765899280576,83.188942446043,83.387935251799,70877350.0 +2017-10-26,79.2,79.42,78.75,78.76,29181652.0,0.0,1.0,78.801151079137,79.020043165468,78.353417266187,78.363366906475,29181652.0 +2017-10-25,78.58,79.1,78.01,78.63,19714512.0,0.0,1.0,78.184273381295,78.701654676259,77.617143884892,78.234021582734,19714512.0 +2017-10-24,78.9,79.2,78.46,78.86,16613928.0,0.0,1.0,78.502661870504,78.801151079137,78.064877697842,78.462863309353,16613928.0 +2017-10-23,78.99,79.34,78.76,78.83,20479731.0,0.0,1.0,78.592208633094,78.940446043165,78.363366906475,78.433014388489,20479731.0 +2017-10-20,78.32,78.97,78.22,78.81,22517092.0,0.0,1.0,77.925582733813,78.572309352518,77.826086330935,78.413115107914,22517092.0 +2017-10-19,77.57,77.93,77.35,77.91,14982129.0,0.0,1.0,77.17935971223,77.53754676259,76.960467625899,77.517647482014,14982129.0 +2017-10-18,77.67,77.85,77.37,77.61,13147124.0,0.0,1.0,77.278856115108,77.457949640288,76.980366906475,77.219158273381,13147124.0 +2017-10-17,77.47,77.62,77.25,77.59,15953665.0,0.0,1.0,77.079863309353,77.229107913669,76.860971223022,77.199258992806,15953665.0 +2017-10-16,77.42,77.81,77.35,77.65,12331147.0,0.0,1.0,77.030115107914,77.418151079137,76.960467625899,77.258956834532,12331147.0 +2017-10-13,77.59,77.87,77.29,77.49,15250772.0,0.0,1.0,77.199258992806,77.477848920863,76.900769784173,77.099762589928,15250772.0 +2017-10-12,76.49,77.29,76.37,77.12,16778148.0,0.0,1.0,76.104798561151,76.900769784173,75.985402877698,76.731625899281,16778148.0 +2017-10-11,76.36,76.46,75.95,76.42,14780652.0,0.0,1.0,75.97545323741,76.074949640288,75.567517985612,76.035151079137,14780652.0 +2017-10-10,76.33,76.63,76.14,76.29,13734627.0,0.0,1.0,75.945604316547,76.24409352518,75.756561151079,75.905805755396,13734627.0 +2017-10-09,75.97,76.55,75.86,76.29,11364275.0,0.0,1.0,75.587417266187,76.164496402878,75.477971223022,75.905805755396,11364275.0 +2017-10-06,75.67,76.03,75.54,76.0,13692791.0,0.0,1.0,75.288928057554,75.647115107914,75.159582733813,75.61726618705,13692791.0 +2017-10-05,75.22,76.12,74.96,75.97,20656238.0,0.0,1.0,74.841194244604,75.736661870504,74.582503597122,75.587417266187,20656238.0 +2017-10-04,74.0,74.72,73.71,74.69,13287346.0,0.0,1.0,73.627338129496,74.343712230216,73.338798561151,74.313863309353,13287346.0 +2017-10-03,74.67,74.88,74.195,74.26,11935853.0,0.0,1.0,74.293964028777,74.50290647482,73.821356115108,73.886028776978,11935853.0 +2017-10-02,74.71,75.01,74.295,74.61,15210338.0,0.0,1.0,74.333762589928,74.632251798561,73.920852517986,74.23426618705,15210338.0 +2017-09-29,73.94,74.535,73.88,74.49,16700435.0,0.0,1.0,73.56764028777,74.159643884892,73.507942446043,74.114870503597,16700435.0 +2017-09-28,73.54,73.97,73.31,73.87,10814063.0,0.0,1.0,73.169654676259,73.597489208633,72.94081294964,73.497992805755,10814063.0 +2017-09-27,73.55,74.17,73.17,73.85,18934048.0,0.0,1.0,73.179604316547,73.796482014388,72.801517985612,73.47809352518,18934048.0 +2017-09-26,73.67,73.81,72.99,73.26,17105469.0,0.0,1.0,73.299,73.438294964029,72.622424460432,72.891064748201,17105469.0 +2017-09-25,74.09,74.25,72.92,73.26,23502422.0,0.0,1.0,73.716884892086,73.876079136691,72.552776978417,72.891064748201,23502422.0 +2017-09-22,73.99,74.51,73.85,74.41,13969937.0,0.0,1.0,73.617388489209,74.134769784173,73.47809352518,74.035273381295,13969937.0 +2017-09-21,75.11,75.24,74.11,74.21,19038998.0,0.0,1.0,74.731748201439,74.86109352518,73.736784172662,73.83628057554,19038998.0 +2017-09-20,75.35,75.55,74.31,74.94,20415084.0,0.0,1.0,74.970539568345,75.169532374101,73.935776978417,74.562604316547,20415084.0 +2017-09-19,75.21,75.71,75.01,75.44,15606870.0,0.0,1.0,74.831244604317,75.328726618705,74.632251798561,75.060086330935,15606870.0 +2017-09-18,75.23,75.97,75.04,75.16,22730355.0,0.0,1.0,74.851143884892,75.587417266187,74.662100719424,74.781496402878,22730355.0 +2017-09-15,74.83,75.39,74.07,75.31,37901927.0,0.0,1.0,74.453158273381,75.010338129496,73.696985611511,74.930741007194,37901927.0 +2017-09-14,75.0,75.49,74.52,74.77,15373384.0,0.0,1.0,74.622302158273,75.109834532374,74.14471942446,74.393460431655,15373384.0 +2017-09-13,74.93,75.23,74.55,75.21,12998629.0,0.0,1.0,74.552654676259,74.851143884892,74.174568345324,74.831244604317,12998629.0 +2017-09-12,74.76,75.24,74.37,74.68,14003880.0,0.0,1.0,74.383510791367,74.86109352518,73.995474820144,74.303913669065,14003880.0 +2017-09-11,74.31,74.945,74.31,74.76,17428067.0,0.0,1.0,73.935776978417,74.567579136691,73.935776978417,74.383510791367,17428067.0 +2017-09-08,74.33,74.44,73.84,73.98,14474383.0,0.0,1.0,73.955676258993,74.065122302158,73.468143884892,73.607438848921,14474383.0 +2017-09-07,73.68,74.6,73.6,74.34,17165518.0,0.0,1.0,73.308949640288,74.224316546763,73.229352517986,73.965625899281,17165518.0 +2017-09-06,73.74,74.04,73.35,73.4,15945136.0,0.0,1.0,73.368647482014,73.667136690647,72.980611510791,73.03035971223,15945136.0 +2017-09-05,73.34,73.89,72.98,73.61,21432599.0,0.0,1.0,72.970661870504,73.517892086331,72.612474820144,73.239302158273,21432599.0 +2017-09-01,74.71,74.74,73.64,73.94,21593192.0,0.0,1.0,74.333762589928,74.363611510791,73.269151079137,73.56764028777,21593192.0 +2017-08-31,74.03,74.96,73.8,74.77,26688077.0,0.0,1.0,73.65718705036,74.582503597122,73.428345323741,74.393460431655,26688077.0 +2017-08-30,73.01,74.2099,72.8293,74.01,16826094.0,0.0,1.0,72.642323741007,73.836181079137,72.462533741007,73.637287769784,16826094.0 +2017-08-29,72.25,73.16,72.05,73.05,11325418.0,0.0,1.0,71.886151079137,72.791568345324,71.687158273381,72.682122302158,11325418.0 +2017-08-28,73.06,73.09,72.55,72.83,14112777.0,0.0,1.0,72.692071942446,72.721920863309,72.18464028777,72.463230215827,14112777.0 +2017-08-25,72.86,73.35,72.48,72.82,12574503.0,0.0,1.0,72.493079136691,72.980611510791,72.114992805755,72.45328057554,12574503.0 +2017-08-24,72.74,72.86,72.07,72.69,15980144.0,0.0,1.0,72.373683453237,72.493079136691,71.707057553957,72.323935251799,15980144.0 +2017-08-23,72.96,73.15,72.53,72.72,13586784.0,0.0,1.0,72.592575539568,72.781618705036,72.164741007194,72.353784172662,13586784.0 +2017-08-22,72.35,73.24,72.35,73.16,14183146.0,0.0,1.0,71.985647482014,72.871165467626,71.985647482014,72.791568345324,14183146.0 +2017-08-21,72.47,72.48,71.7,72.15,17656716.0,0.0,1.0,72.105043165468,72.114992805755,71.338920863309,71.786654676259,17656716.0 +2017-08-18,72.27,72.84,71.93,72.49,18215276.0,0.0,1.0,71.906050359712,72.473179856115,71.567762589928,72.124942446043,18215276.0 +2017-08-17,73.58,73.87,72.4,72.4,21834250.0,0.0,1.0,73.20945323741,73.497992805755,72.035395683453,72.035395683453,21834250.0 +2017-08-16,73.34,74.1,73.17,73.65,17814317.0,0.0,1.0,72.970661870504,73.726834532374,72.801517985612,73.279100719424,17814317.0 +2017-08-15,73.59,73.59,73.04,73.22,17791179.0,0.39,1.0,73.219402877698,73.219402877698,72.672172661871,72.85126618705,17791179.0 +2017-08-14,73.06,73.72,72.95,73.59,19756773.0,0.0,1.0,72.306935302621,72.960132363936,72.198069125735,72.831472336707,19756773.0 +2017-08-11,71.61,72.7,71.28,72.5,21121250.0,0.0,1.0,70.87188115276,71.950645996448,70.545282622102,71.752707493019,21121250.0 +2017-08-10,71.9,72.19,71.35,71.41,23153711.0,0.0,1.0,71.158891982732,71.445902812704,70.614561098302,70.673942649331,23153711.0 +2017-08-09,72.25,72.51,72.05,72.47,20401071.0,0.0,1.0,71.505284363733,71.762604418191,71.307345860304,71.723016717505,20401071.0 +2017-08-08,72.09,73.13,71.75,72.79,21446993.0,0.0,1.0,71.34693356099,72.376213778821,71.01043810516,72.039718322991,21446993.0 +2017-08-07,72.8,72.9,72.26,72.4,18582345.0,0.0,1.0,72.049615248163,72.148584499877,71.515181288904,71.653738241305,18582345.0 +2017-08-04,72.4,73.04,72.24,72.68,22412719.0,0.0,1.0,71.653738241305,72.287141452278,71.495387438562,71.930852146105,22412719.0 +2017-08-03,72.19,72.44,71.845,72.15,17937522.0,0.0,1.0,71.445902812704,71.693325941991,71.104458894289,71.406315112019,17937522.0 +2017-08-02,72.55,72.56,71.445,72.26,26405096.0,0.0,1.0,71.802192118877,71.812089044048,70.708581887431,71.515181288904,26405096.0 +2017-08-01,73.1,73.42,72.49,72.58,19060885.0,0.0,1.0,72.346523003306,72.663224608793,71.742810567848,71.831882894391,19060885.0 +2017-07-31,73.3,73.44,72.41,72.72,23151962.0,0.0,1.0,72.544461506735,72.683018459136,71.663635166476,71.970439846791,23151962.0 +2017-07-28,72.67,73.31,72.54,73.04,17472880.0,0.0,1.0,71.920955220934,72.554358431907,71.792295193705,72.287141452278,17472880.0 +2017-07-27,73.76,74.42,72.32,73.16,35518251.0,0.0,1.0,72.999720064622,73.652917125938,71.574562839933,72.405904554335,35518251.0 +2017-07-26,74.34,74.38,73.81,74.05,15850344.0,0.0,1.0,73.573741724566,73.613329425252,73.049204690479,73.286730894594,15850344.0 +2017-07-25,73.8,74.31,73.5,74.19,21522189.0,0.0,1.0,73.039307765308,73.544050949052,72.742400010164,73.425287846995,21522189.0 +2017-07-24,73.53,73.75,73.13,73.6,20836422.0,0.0,1.0,72.772090785679,72.989823139451,72.376213778821,72.841369261879,20836422.0 +2017-07-21,73.45,74.29,73.17,73.79,45302930.0,0.0,1.0,72.692915384307,73.524257098709,72.415801479507,73.029410840136,45302930.0 +2017-07-20,74.18,74.3,73.28,74.24,34174677.0,0.0,1.0,73.415390921823,73.53415402388,72.524667656392,73.474772472852,34174677.0 +2017-07-19,73.5,74.04,73.45,73.86,21769229.0,0.0,1.0,72.742400010164,73.276833969423,72.692915384307,73.098689316337,21769229.0 +2017-07-18,73.09,73.39,72.66,73.3,26150272.0,0.0,1.0,72.336626078135,72.633533833278,71.911058295763,72.544461506735,26150272.0 +2017-07-17,72.8,73.45,72.72,73.35,21481069.0,0.0,1.0,72.049615248163,72.692915384307,71.970439846791,72.593946132593,21481069.0 +2017-07-14,72.24,73.27,71.96,72.78,25689303.0,0.0,1.0,71.495387438562,72.514770731221,71.218273533761,72.02982139782,25689303.0 +2017-07-13,71.5,72.0399,71.31,71.77,20149208.0,0.0,1.0,70.763014975874,71.297349965881,70.574973397617,71.030231955503,20149208.0 +2017-07-12,70.69,71.28,70.55,71.15,17382861.0,0.0,1.0,69.961364036987,70.545282622102,69.822807084586,70.416622594873,17382861.0 +2017-07-11,70.0,70.68,69.75,69.99,16880205.0,0.0,1.0,69.278476200157,69.951467111815,69.03105307087,69.268579274985,16880205.0 +2017-07-10,69.46,70.25,69.2,69.98,14903400.0,0.0,1.0,68.744042240898,69.525899329443,68.486722186441,69.258682349814,14903400.0 +2017-07-07,68.7,69.84,68.7,69.46,15897154.0,0.0,1.0,67.991875927868,69.120125397413,67.991875927868,68.744042240898,15897154.0 +2017-07-06,68.27,68.78,68.12,68.57,20776555.0,0.0,1.0,67.566308145496,68.07105132924,67.417854267924,67.863215900639,20776555.0 +2017-07-05,68.255,69.44,68.22,69.08,20174523.0,0.0,1.0,67.551462757738,68.724248390555,67.516823519638,68.367959084383,20174523.0 +2017-07-03,69.33,69.6,68.02,68.17,16164331.0,0.0,1.0,68.615382213669,68.882599193299,67.318885016209,67.467338893781,16164331.0 +2017-06-30,68.78,69.38,68.74,68.93,23039328.0,0.0,1.0,68.07105132924,68.664866839527,68.031463628554,68.219505206811,23039328.0 +2017-06-29,69.38,69.49,68.09,68.49,28231562.0,0.0,1.0,68.664866839527,68.773733016413,67.388163492409,67.784040499267,28231562.0 +2017-06-28,69.21,69.841,68.79,69.8,25226070.0,0.0,1.0,68.496619111612,69.12111508993,68.080948254411,69.080537696728,25226070.0 +2017-06-27,70.11,70.18,69.18,69.21,24862560.0,0.0,1.0,69.387342377043,69.456620853243,68.466928336098,68.496619111612,24862560.0 +2017-06-26,71.4,71.71,70.445,70.53,19308122.0,0.0,1.0,70.66404572416,70.970850404475,69.718889370286,69.803013234243,19308122.0 +2017-06-23,70.09,71.25,69.92,71.21,23176418.0,0.0,1.0,69.3675485267,70.515591846588,69.199300798785,70.476004145902,23176418.0 +2017-06-22,70.54,70.59,69.71,70.26,22222851.0,0.0,1.0,69.812910159415,69.862394785272,68.991465370184,69.535796254614,22222851.0 +2017-06-21,70.21,70.62,69.94,70.27,19190623.0,0.0,1.0,69.486311628757,69.892085560787,69.219094649128,69.545693179786,19190623.0 +2017-06-20,70.82,70.87,69.87,69.91,20775590.0,0.0,1.0,70.090024064216,70.139508690073,69.149816172928,69.189403873614,20775590.0 +2017-06-19,70.5,70.945,70.35,70.87,23146852.0,0.0,1.0,69.773322458729,70.213735628859,69.624868581157,70.139508690073,23146852.0 +2017-06-16,69.73,70.0252,69.22,70.0,46911637.0,0.0,1.0,69.011259220527,69.303416451589,68.506516036783,69.278476200157,46911637.0 +2017-06-15,69.27,70.21,68.8,69.9,25701569.0,0.0,1.0,68.556000662641,69.486311628757,68.090845179582,69.179506948442,25701569.0 +2017-06-14,70.91,71.1,69.43,70.27,25271276.0,0.0,1.0,70.179096390759,70.367137969016,68.714351465384,69.545693179786,25271276.0 +2017-06-13,70.02,70.82,69.96,70.65,24815455.0,0.0,1.0,69.298270050499,70.090024064216,69.238888499471,69.921776336301,24815455.0 +2017-06-12,69.25,69.94,68.13,69.78,47363986.0,0.0,1.0,68.536206812298,69.219094649128,67.427751193095,69.060743846385,47363986.0 +2017-06-09,72.035,72.08,68.59,70.32,48619420.0,0.0,1.0,71.292500472547,71.337036635818,67.883009750982,69.595177805643,48619420.0 +2017-06-08,72.51,72.52,71.5,71.945,23982410.0,0.0,1.0,71.762604418191,71.772501343362,70.763014975874,71.203428146004,23982410.0 +2017-06-07,72.635,72.77,71.95,72.39,21895156.0,0.0,1.0,71.886315982834,72.019924472648,71.20837660859,71.643841316133,21895156.0 +2017-06-06,72.3,72.62,72.27,72.52,31220057.0,0.0,1.0,71.55476898959,71.871470595077,71.525078214076,71.772501343362,31220057.0 +2017-06-05,71.97,72.89,71.81,72.28,29507429.0,0.0,1.0,71.228170458932,72.138687574706,71.069819656189,71.534975139247,29507429.0 +2017-06-02,70.44,71.86,70.24,71.76,34586054.0,0.0,1.0,69.7139409077,71.119304282046,69.516002404271,71.020335030332,34586054.0 +2017-06-01,70.24,70.61,69.451,70.1,21066468.0,0.0,1.0,69.516002404271,69.882188635615,68.735135008244,69.377445451871,21066468.0 diff --git a/examples/demos/stocqt/content/data/NCLH.csv b/examples/demos/stocqt/content/data/NCLH.csv new file mode 100644 index 000000000..3827fd20a --- /dev/null +++ b/examples/demos/stocqt/content/data/NCLH.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,53.45,53.96,53.2,53.25,889909.0,0.0,1.0,53.45,53.96,53.2,53.25,889909.0 +2017-12-28,54.01,54.03,53.34,53.61,1186989.0,0.0,1.0,54.01,54.03,53.34,53.61,1186989.0 +2017-12-27,53.95,54.19,53.7,54.0,792700.0,0.0,1.0,53.95,54.19,53.7,54.0,792700.0 +2017-12-26,53.93,54.25,53.65,53.73,906947.0,0.0,1.0,53.93,54.25,53.65,53.73,906947.0 +2017-12-22,54.325,54.47,53.72,54.03,1251857.0,0.0,1.0,54.325,54.47,53.72,54.03,1251857.0 +2017-12-21,54.9,55.31,54.01,54.14,1346967.0,0.0,1.0,54.9,55.31,54.01,54.14,1346967.0 +2017-12-20,55.74,56.41,54.74,54.82,1797666.0,0.0,1.0,55.74,56.41,54.74,54.82,1797666.0 +2017-12-19,55.14,56.05,55.02,55.59,1592622.0,0.0,1.0,55.14,56.05,55.02,55.59,1592622.0 +2017-12-18,54.51,55.355,54.5,54.98,2094664.0,0.0,1.0,54.51,55.355,54.5,54.98,2094664.0 +2017-12-15,53.14,54.3,52.58,54.0,6275489.0,0.0,1.0,53.14,54.3,52.58,54.0,6275489.0 +2017-12-14,53.16,53.46,52.7,52.81,1433280.0,0.0,1.0,53.16,53.46,52.7,52.81,1433280.0 +2017-12-13,53.93,53.93,53.09,53.16,1222815.0,0.0,1.0,53.93,53.93,53.09,53.16,1222815.0 +2017-12-12,54.64,54.64,53.55,53.65,1640536.0,0.0,1.0,54.64,54.64,53.55,53.65,1640536.0 +2017-12-11,54.75,55.37,54.33,54.72,1492003.0,0.0,1.0,54.75,55.37,54.33,54.72,1492003.0 +2017-12-08,54.74,55.57,54.36,55.03,1249849.0,0.0,1.0,54.74,55.57,54.36,55.03,1249849.0 +2017-12-07,54.5,54.62,54.08,54.34,1093747.0,0.0,1.0,54.5,54.62,54.08,54.34,1093747.0 +2017-12-06,54.49,54.8,53.7,54.31,1161732.0,0.0,1.0,54.49,54.8,53.7,54.31,1161732.0 +2017-12-05,55.53,55.67,54.265,54.33,938087.0,0.0,1.0,55.53,55.67,54.265,54.33,938087.0 +2017-12-04,55.68,56.84,55.3,55.41,2507341.0,0.0,1.0,55.68,56.84,55.3,55.41,2507341.0 +2017-12-01,53.94,54.91,53.675,54.81,1314538.0,0.0,1.0,53.94,54.91,53.675,54.81,1314538.0 +2017-11-30,54.0,54.69,52.36,54.16,3452181.0,0.0,1.0,54.0,54.69,52.36,54.16,3452181.0 +2017-11-29,55.48,56.21,55.12,55.29,1637536.0,0.0,1.0,55.48,56.21,55.12,55.29,1637536.0 +2017-11-28,55.62,55.83,54.92,55.31,1759104.0,0.0,1.0,55.62,55.83,54.92,55.31,1759104.0 +2017-11-27,55.55,56.03,55.47,55.61,1224822.0,0.0,1.0,55.55,56.03,55.47,55.61,1224822.0 +2017-11-24,55.41,55.74,55.01,55.5,550824.0,0.0,1.0,55.41,55.74,55.01,55.5,550824.0 +2017-11-22,55.42,56.0,55.11,55.31,1270402.0,0.0,1.0,55.42,56.0,55.11,55.31,1270402.0 +2017-11-21,54.93,55.88,54.8,55.48,2014071.0,0.0,1.0,54.93,55.88,54.8,55.48,2014071.0 +2017-11-20,54.78,55.09,54.28,54.69,2306354.0,0.0,1.0,54.78,55.09,54.28,54.69,2306354.0 +2017-11-17,54.12,54.9,53.69,54.84,3943455.0,0.0,1.0,54.12,54.9,53.69,54.84,3943455.0 +2017-11-16,53.85,54.3,53.5,53.97,6186166.0,0.0,1.0,53.85,54.3,53.5,53.97,6186166.0 +2017-11-15,55.09,55.19,54.58,55.07,1345399.0,0.0,1.0,55.09,55.19,54.58,55.07,1345399.0 +2017-11-14,55.08,55.22,54.1,55.1,1301048.0,0.0,1.0,55.08,55.22,54.1,55.1,1301048.0 +2017-11-13,54.91,55.34,54.65,55.27,1717783.0,0.0,1.0,54.91,55.34,54.65,55.27,1717783.0 +2017-11-10,55.75,56.06,54.07,55.23,2272543.0,0.0,1.0,55.75,56.06,54.07,55.23,2272543.0 +2017-11-09,55.74,58.27,55.29,56.89,3115303.0,0.0,1.0,55.74,58.27,55.29,56.89,3115303.0 +2017-11-07,56.55,57.37,54.97,55.36,1793433.0,0.0,1.0,56.55,57.37,54.97,55.36,1793433.0 +2017-11-06,55.0,56.12,54.905,55.26,1518782.0,0.0,1.0,55.0,56.12,54.905,55.26,1518782.0 +2017-11-03,54.91,55.09,54.53,55.03,922980.0,0.0,1.0,54.91,55.09,54.53,55.03,922980.0 +2017-11-02,54.27,55.17,54.205,54.91,2134024.0,0.0,1.0,54.27,55.17,54.205,54.91,2134024.0 +2017-11-01,56.06,56.1,54.04,54.2,2246546.0,0.0,1.0,56.06,56.1,54.04,54.2,2246546.0 +2017-10-31,54.82,55.98,54.715,55.75,1441239.0,0.0,1.0,54.82,55.98,54.715,55.75,1441239.0 +2017-10-30,55.29,55.67,54.67,54.8,972388.0,0.0,1.0,55.29,55.67,54.67,54.8,972388.0 +2017-10-27,54.8,56.28,54.49,55.64,2308873.0,0.0,1.0,54.8,56.28,54.49,55.64,2308873.0 +2017-10-26,54.8,55.25,54.53,54.92,1373500.0,0.0,1.0,54.8,55.25,54.53,54.92,1373500.0 +2017-10-25,54.67,55.19,54.38,54.79,2407822.0,0.0,1.0,54.67,55.19,54.38,54.79,2407822.0 +2017-10-24,53.63,54.78,53.5,54.66,2467749.0,0.0,1.0,53.63,54.78,53.5,54.66,2467749.0 +2017-10-23,53.76,54.1014,53.531,53.72,1984765.0,0.0,1.0,53.76,54.1014,53.531,53.72,1984765.0 +2017-10-20,54.87,54.94,53.45,53.73,3459633.0,0.0,1.0,54.87,54.94,53.45,53.73,3459633.0 +2017-10-19,56.4,56.52,53.8,54.17,7936900.0,0.0,1.0,56.4,56.52,53.8,54.17,7936900.0 +2017-10-18,58.45,58.45,57.13,57.47,4187580.0,0.0,1.0,58.45,58.45,57.13,57.47,4187580.0 +2017-10-17,58.69,59.0,58.44,58.61,2360423.0,0.0,1.0,58.69,59.0,58.44,58.61,2360423.0 +2017-10-16,58.83,59.15,58.4,58.92,2088445.0,0.0,1.0,58.83,59.15,58.4,58.92,2088445.0 +2017-10-13,59.43,59.6,58.22,58.74,3925398.0,0.0,1.0,59.43,59.6,58.22,58.74,3925398.0 +2017-10-12,58.56,59.3,58.43,58.86,29345290.0,0.0,1.0,58.56,59.3,58.43,58.86,29345290.0 +2017-10-11,59.15,59.42,58.58,58.8,2721843.0,0.0,1.0,59.15,59.42,58.58,58.8,2721843.0 +2017-10-10,59.19,59.535,58.985,59.16,2658838.0,0.0,1.0,59.19,59.535,58.985,59.16,2658838.0 +2017-10-09,58.75,59.66,58.71,58.89,2211669.0,0.0,1.0,58.75,59.66,58.71,58.89,2211669.0 +2017-10-06,58.25,59.4,58.25,58.84,3026934.0,0.0,1.0,58.25,59.4,58.25,58.84,3026934.0 +2017-10-05,58.01,58.54,57.53,58.41,7767820.0,0.0,1.0,58.01,58.54,57.53,58.41,7767820.0 +2017-10-04,54.58,56.2,54.53,55.98,1566581.0,0.0,1.0,54.58,56.2,54.53,55.98,1566581.0 +2017-10-03,54.46,55.11,54.03,54.73,1212466.0,0.0,1.0,54.46,55.11,54.03,54.73,1212466.0 +2017-10-02,53.94,54.53,53.6,54.42,1111899.0,0.0,1.0,53.94,54.53,53.6,54.42,1111899.0 +2017-09-29,53.46,54.15,52.44,54.05,2508346.0,0.0,1.0,53.46,54.15,52.44,54.05,2508346.0 +2017-09-28,52.52,53.93,51.99,53.65,2527667.0,0.0,1.0,52.52,53.93,51.99,53.65,2527667.0 +2017-09-27,54.99,55.04,52.74,52.83,1960663.0,0.0,1.0,54.99,55.04,52.74,52.83,1960663.0 +2017-09-26,54.46,55.68,54.26,54.89,2549545.0,0.0,1.0,54.46,55.68,54.26,54.89,2549545.0 +2017-09-25,53.74,54.11,53.23,53.6,1422751.0,0.0,1.0,53.74,54.11,53.23,53.6,1422751.0 +2017-09-22,54.09,54.81,53.75,54.02,1392579.0,0.0,1.0,54.09,54.81,53.75,54.02,1392579.0 +2017-09-21,54.54,54.83,53.95,54.4,1231315.0,0.0,1.0,54.54,54.83,53.95,54.4,1231315.0 +2017-09-20,55.36,55.42,53.71,54.36,2204298.0,0.0,1.0,55.36,55.42,53.71,54.36,2204298.0 +2017-09-19,56.27,56.27,55.29,55.46,1504249.0,0.0,1.0,56.27,56.27,55.29,55.46,1504249.0 +2017-09-18,56.7,57.21,56.28,56.35,1455687.0,0.0,1.0,56.7,57.21,56.28,56.35,1455687.0 +2017-09-15,56.55,56.74,55.28,56.74,3808399.0,0.0,1.0,56.55,56.74,55.28,56.74,3808399.0 +2017-09-14,57.35,58.58,57.25,57.72,1354813.0,0.0,1.0,57.35,58.58,57.25,57.72,1354813.0 +2017-09-13,56.94,57.84,56.75,57.79,1399743.0,0.0,1.0,56.94,57.84,56.75,57.79,1399743.0 +2017-09-12,56.92,57.22,56.41,57.2,1019670.0,0.0,1.0,56.92,57.22,56.41,57.2,1019670.0 +2017-09-11,56.19,58.2,56.0,56.65,2870913.0,0.0,1.0,56.19,58.2,56.0,56.65,2870913.0 +2017-09-08,55.84,56.98,55.01,55.12,1537947.0,0.0,1.0,55.84,56.98,55.01,55.12,1537947.0 +2017-09-07,57.0,57.43,55.77,55.86,1642298.0,0.0,1.0,57.0,57.43,55.77,55.86,1642298.0 +2017-09-06,56.53,57.17,55.91,57.12,1961468.0,0.0,1.0,56.53,57.17,55.91,57.12,1961468.0 +2017-09-05,58.51,58.54,55.3,56.69,2810897.0,0.0,1.0,58.51,58.54,55.3,56.69,2810897.0 +2017-09-01,59.62,60.0,58.48,58.54,1159890.0,0.0,1.0,59.62,60.0,58.48,58.54,1159890.0 +2017-08-31,58.42,59.5,58.41,59.46,1792821.0,0.0,1.0,58.42,59.5,58.41,59.46,1792821.0 +2017-08-30,57.53,58.8,57.25,58.22,1430195.0,0.0,1.0,57.53,58.8,57.25,58.22,1430195.0 +2017-08-29,57.43,57.74,56.47,57.64,1532747.0,0.0,1.0,57.43,57.74,56.47,57.64,1532747.0 +2017-08-28,57.98,58.03,57.48,57.88,878613.0,0.0,1.0,57.98,58.03,57.48,57.88,878613.0 +2017-08-25,57.99,58.0,57.58,57.72,1934962.0,0.0,1.0,57.99,58.0,57.58,57.72,1934962.0 +2017-08-24,57.33,57.905,57.29,57.73,1495111.0,0.0,1.0,57.33,57.905,57.29,57.73,1495111.0 +2017-08-23,56.53,57.91,56.53,57.15,1903662.0,0.0,1.0,56.53,57.91,56.53,57.15,1903662.0 +2017-08-22,56.01,57.03,56.01,56.9,1072763.0,0.0,1.0,56.01,57.03,56.01,56.9,1072763.0 +2017-08-21,55.81,56.15,55.59,55.86,980583.0,0.0,1.0,55.81,56.15,55.59,55.86,980583.0 +2017-08-18,56.33,56.33,55.26,55.78,1424778.0,0.0,1.0,56.33,56.33,55.26,55.78,1424778.0 +2017-08-17,57.98,58.07,56.01,56.18,2067539.0,0.0,1.0,57.98,58.07,56.01,56.18,2067539.0 +2017-08-16,57.8,58.41,57.44,57.9,1434593.0,0.0,1.0,57.8,58.41,57.44,57.9,1434593.0 +2017-08-15,57.61,58.56,57.22,57.45,2822548.0,0.0,1.0,57.61,58.56,57.22,57.45,2822548.0 +2017-08-14,57.14,57.83,57.01,57.46,2619908.0,0.0,1.0,57.14,57.83,57.01,57.46,2619908.0 +2017-08-11,54.75,57.17,54.15,56.77,12874815.0,0.0,1.0,54.75,57.17,54.15,56.77,12874815.0 +2017-08-10,58.04,58.16,56.9,57.07,1656606.0,0.0,1.0,58.04,58.16,56.9,57.07,1656606.0 +2017-08-09,58.88,58.99,58.05,58.36,2075241.0,0.0,1.0,58.88,58.99,58.05,58.36,2075241.0 +2017-08-08,59.05,61.48,58.85,59.42,5341341.0,0.0,1.0,59.05,61.48,58.85,59.42,5341341.0 +2017-08-07,57.15,57.62,56.49,56.65,2833326.0,0.0,1.0,57.15,57.62,56.49,56.65,2833326.0 +2017-08-04,56.47,57.48,56.27,56.9,1265045.0,0.0,1.0,56.47,57.48,56.27,56.9,1265045.0 +2017-08-03,55.77,56.96,55.77,56.25,1152770.0,0.0,1.0,55.77,56.96,55.77,56.25,1152770.0 +2017-08-02,56.89,57.25,55.45,55.84,1255978.0,0.0,1.0,56.89,57.25,55.45,55.84,1255978.0 +2017-08-01,56.49,57.25,56.15,56.91,2486095.0,0.0,1.0,56.49,57.25,56.15,56.91,2486095.0 +2017-07-31,55.45,55.73,54.975,55.07,886281.0,0.0,1.0,55.45,55.73,54.975,55.07,886281.0 +2017-07-28,54.71,55.26,54.39,55.21,983892.0,0.0,1.0,54.71,55.26,54.39,55.21,983892.0 +2017-07-27,55.7,55.85,54.29,55.11,1201890.0,0.0,1.0,55.7,55.85,54.29,55.11,1201890.0 +2017-07-26,56.0,56.01,55.2,55.65,631774.0,0.0,1.0,56.0,56.01,55.2,55.65,631774.0 +2017-07-25,55.9,56.36,55.43,55.75,998410.0,0.0,1.0,55.9,56.36,55.43,55.75,998410.0 +2017-07-24,55.3,55.77,55.04,55.73,1082025.0,0.0,1.0,55.3,55.77,55.04,55.73,1082025.0 +2017-07-21,54.9,55.23,54.7645,55.07,658226.0,0.0,1.0,54.9,55.23,54.7645,55.07,658226.0 +2017-07-20,54.53,55.33,54.33,55.05,972645.0,0.0,1.0,54.53,55.33,54.33,55.05,972645.0 +2017-07-19,54.27,54.51,54.09,54.38,688376.0,0.0,1.0,54.27,54.51,54.09,54.38,688376.0 +2017-07-18,54.22,54.44,53.71,54.18,620018.0,0.0,1.0,54.22,54.44,53.71,54.18,620018.0 +2017-07-17,53.51,54.45,53.16,54.13,1062125.0,0.0,1.0,53.51,54.45,53.16,54.13,1062125.0 +2017-07-14,54.43,54.48,53.4,53.47,923880.0,0.0,1.0,54.43,54.48,53.4,53.47,923880.0 +2017-07-13,54.12,54.49,53.65,54.24,1061017.0,0.0,1.0,54.12,54.49,53.65,54.24,1061017.0 +2017-07-12,54.32,54.64,53.58,54.09,1174740.0,0.0,1.0,54.32,54.64,53.58,54.09,1174740.0 +2017-07-11,53.79,54.3,53.4,53.96,780957.0,0.0,1.0,53.79,54.3,53.4,53.96,780957.0 +2017-07-10,54.53,55.09,53.663,54.03,1253838.0,0.0,1.0,54.53,55.09,53.663,54.03,1253838.0 +2017-07-07,54.2,55.04,54.2,54.68,950235.0,0.0,1.0,54.2,55.04,54.2,54.68,950235.0 +2017-07-06,55.06,55.06,53.925,54.06,1550796.0,0.0,1.0,55.06,55.06,53.925,54.06,1550796.0 +2017-07-05,54.52,55.75,54.495,55.41,973694.0,0.0,1.0,54.52,55.75,54.495,55.41,973694.0 +2017-07-03,54.63,55.21,54.38,54.55,496186.0,0.0,1.0,54.63,55.21,54.38,54.55,496186.0 +2017-06-30,54.96,55.0,54.27,54.29,1025663.0,0.0,1.0,54.96,55.0,54.27,54.29,1025663.0 +2017-06-29,55.16,55.33,54.08,54.42,844905.0,0.0,1.0,55.16,55.33,54.08,54.42,844905.0 +2017-06-28,54.18,55.73,54.18,55.28,1012373.0,0.0,1.0,54.18,55.73,54.18,55.28,1012373.0 +2017-06-27,55.01,55.29,53.84,53.86,1517157.0,0.0,1.0,55.01,55.29,53.84,53.86,1517157.0 +2017-06-26,54.82,56.12,54.82,55.31,1225716.0,0.0,1.0,54.82,56.12,54.82,55.31,1225716.0 +2017-06-23,55.57,55.87,54.74,54.81,2188845.0,0.0,1.0,55.57,55.87,54.74,54.81,2188845.0 +2017-06-22,55.01,56.26,54.9,55.46,2613554.0,0.0,1.0,55.01,56.26,54.9,55.46,2613554.0 +2017-06-21,53.24,55.23,53.2,54.9,2426566.0,0.0,1.0,53.24,55.23,53.2,54.9,2426566.0 +2017-06-20,53.51,53.92,52.95,53.1,1059158.0,0.0,1.0,53.51,53.92,52.95,53.1,1059158.0 +2017-06-19,53.2,53.84,53.06,53.63,1036571.0,0.0,1.0,53.2,53.84,53.06,53.63,1036571.0 +2017-06-16,52.71,53.01,52.09,52.9,2348629.0,0.0,1.0,52.71,53.01,52.09,52.9,2348629.0 +2017-06-15,51.61,52.95,51.61,52.91,1146075.0,0.0,1.0,51.61,52.95,51.61,52.91,1146075.0 +2017-06-14,51.99,52.74,51.7,52.17,1432854.0,0.0,1.0,51.99,52.74,51.7,52.17,1432854.0 +2017-06-13,50.78,52.23,50.77,51.84,1457083.0,0.0,1.0,50.78,52.23,50.77,51.84,1457083.0 +2017-06-12,50.98,51.26,49.52,50.42,2050208.0,0.0,1.0,50.98,51.26,49.52,50.42,2050208.0 +2017-06-09,51.97,52.31,50.8,51.13,2214803.0,0.0,1.0,51.97,52.31,50.8,51.13,2214803.0 +2017-06-08,50.93,52.1,50.68,51.79,2046748.0,0.0,1.0,50.93,52.1,50.68,51.79,2046748.0 +2017-06-07,50.08,50.81,49.75,50.79,1934974.0,0.0,1.0,50.08,50.81,49.75,50.79,1934974.0 +2017-06-06,50.0,50.6,49.66,49.72,2199861.0,0.0,1.0,50.0,50.6,49.66,49.72,2199861.0 +2017-06-05,51.17,51.17,50.07,50.31,1580004.0,0.0,1.0,51.17,51.17,50.07,50.31,1580004.0 +2017-06-02,51.16,51.64,50.97,51.16,1166461.0,0.0,1.0,51.16,51.64,50.97,51.16,1166461.0 +2017-06-01,50.23,51.1,49.98,50.93,1713508.0,0.0,1.0,50.23,51.1,49.98,50.93,1713508.0 diff --git a/examples/demos/stocqt/content/data/NFLX.csv b/examples/demos/stocqt/content/data/NFLX.csv new file mode 100644 index 000000000..d7a667843 --- /dev/null +++ b/examples/demos/stocqt/content/data/NFLX.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,192.51,193.95,191.22,191.96,5158845.0,0.0,1.0,192.51,193.95,191.22,191.96,5158845.0 +2017-12-28,187.18,194.49,186.85,192.71,10080261.0,0.0,1.0,187.18,194.49,186.85,192.71,10080261.0 +2017-12-27,187.8,188.1,185.22,186.24,3932094.0,0.0,1.0,187.8,188.1,185.22,186.24,3932094.0 +2017-12-26,189.78,189.94,186.4,187.76,3032707.0,0.0,1.0,189.78,189.94,186.4,187.76,3032707.0 +2017-12-22,188.33,190.95,186.8,189.94,3760922.0,0.0,1.0,188.33,190.95,186.8,189.94,3760922.0 +2017-12-21,189.44,190.95,187.58,188.62,3522551.0,0.0,1.0,189.44,190.95,187.58,188.62,3522551.0 +2017-12-20,187.94,189.11,185.26,188.82,5814609.0,0.0,1.0,187.94,189.11,185.26,188.82,5814609.0 +2017-12-19,190.18,190.2981,185.75,187.02,6526555.0,0.0,1.0,190.18,190.2981,185.75,187.02,6526555.0 +2017-12-18,191.2,191.65,188.9,190.42,4944337.0,0.0,1.0,191.2,191.65,188.9,190.42,4944337.0 +2017-12-15,189.61,191.43,188.01,190.12,7048874.0,0.0,1.0,189.61,191.43,188.01,190.12,7048874.0 +2017-12-14,187.98,192.64,187.2,189.56,7677048.0,0.0,1.0,187.98,192.64,187.2,189.56,7677048.0 +2017-12-13,186.1,188.69,185.41,187.86,4653749.0,0.0,1.0,186.1,188.69,185.41,187.86,4653749.0 +2017-12-12,186.01,187.85,184.8183,185.73,4135595.0,0.0,1.0,186.01,187.85,184.8183,185.73,4135595.0 +2017-12-11,187.85,189.42,185.91,186.22,5131319.0,0.0,1.0,187.85,189.42,185.91,186.22,5131319.0 +2017-12-08,186.5,189.42,186.3,188.54,4909440.0,0.0,1.0,186.5,189.42,186.3,188.54,4909440.0 +2017-12-07,185.71,187.34,183.22,185.2,4543492.0,0.0,1.0,185.71,187.34,183.22,185.2,4543492.0 +2017-12-06,183.38,186.4844,182.88,185.3,5006257.0,0.0,1.0,183.38,186.4844,182.88,185.3,5006257.0 +2017-12-05,183.5,188.14,181.19,184.21,5547802.0,0.0,1.0,183.5,188.14,181.19,184.21,5547802.0 +2017-12-04,189.36,189.72,178.38,184.04,9137873.0,0.0,1.0,189.36,189.72,178.38,184.04,9137873.0 +2017-12-01,186.99,189.8,185.0,186.82,6163366.0,0.0,1.0,186.99,189.8,185.0,186.82,6163366.0 +2017-11-30,190.31,190.86,186.68,187.58,6499326.0,0.0,1.0,190.31,190.86,186.68,187.58,6499326.0 +2017-11-29,198.91,199.029,184.32,188.15,13905339.0,0.0,1.0,198.91,199.029,184.32,188.15,13905339.0 +2017-11-28,195.34,199.68,194.01,199.18,6942358.0,0.0,1.0,195.34,199.68,194.01,199.18,6942358.0 +2017-11-27,195.56,195.85,194.0,195.05,3186677.0,0.0,1.0,195.56,195.85,194.0,195.05,3186677.0 +2017-11-24,196.65,196.9,195.33,195.75,2160300.0,0.0,1.0,196.65,196.9,195.33,195.75,2160300.0 +2017-11-22,196.58,196.75,193.63,196.32,5879771.0,0.0,1.0,196.58,196.75,193.63,196.32,5879771.0 +2017-11-21,195.04,197.52,194.971,196.23,4598017.0,0.0,1.0,195.04,197.52,194.971,196.23,4598017.0 +2017-11-20,193.3,194.32,191.9,194.1,3727412.0,0.0,1.0,193.3,194.32,191.9,194.1,3727412.0 +2017-11-17,195.74,195.95,192.65,193.2,3753775.0,0.0,1.0,195.74,195.95,192.65,193.2,3753775.0 +2017-11-16,194.33,197.7,193.75,195.51,5655042.0,0.0,1.0,194.33,197.7,193.75,195.51,5655042.0 +2017-11-15,194.54,195.42,191.53,192.12,4162712.0,0.0,1.0,194.54,195.42,191.53,192.12,4162712.0 +2017-11-14,193.64,195.88,193.0,195.71,3408535.0,0.0,1.0,193.64,195.88,193.0,195.71,3408535.0 +2017-11-13,191.12,196.05,191.0,195.08,4598005.0,0.0,1.0,191.12,196.05,191.0,195.08,4598005.0 +2017-11-10,191.61,192.59,189.5,192.02,6609739.0,0.0,1.0,191.61,192.59,189.5,192.02,6609739.0 +2017-11-09,194.46,194.49,190.81,193.9,5839579.0,0.0,1.0,194.46,194.49,190.81,193.9,5839579.0 +2017-11-07,200.0,200.61,194.8,195.89,6413310.0,0.0,1.0,200.0,200.61,194.8,195.89,6413310.0 +2017-11-06,200.0,202.48,198.09,200.13,5834857.0,0.0,1.0,200.0,202.48,198.09,200.13,5834857.0 +2017-11-03,199.8,200.55,197.99,200.01,3643216.0,0.0,1.0,199.8,200.55,197.99,200.01,3643216.0 +2017-11-02,197.45,199.44,197.0901,199.32,3578289.0,0.0,1.0,197.45,199.44,197.0901,199.32,3578289.0 +2017-11-01,197.24,199.199,196.0,198.0,4983343.0,0.0,1.0,197.24,199.199,196.0,198.0,4983343.0 +2017-10-31,198.21,198.59,195.218,196.43,5437925.0,0.0,1.0,198.21,198.59,195.218,196.43,5437925.0 +2017-10-30,199.62,201.099,197.0721,198.37,5412277.0,0.0,1.0,199.62,201.099,197.0721,198.37,5412277.0 +2017-10-27,197.2,200.65,196.22,199.54,8088364.0,0.0,1.0,197.2,200.65,196.22,199.54,8088364.0 +2017-10-26,194.66,197.61,194.08,195.21,5101258.0,0.0,1.0,194.66,197.61,194.08,195.21,5101258.0 +2017-10-25,195.38,197.055,193.01,193.77,5231713.0,0.0,1.0,195.38,197.055,193.01,193.77,5231713.0 +2017-10-24,192.75,196.735,191.4,196.02,6985460.0,0.0,1.0,192.75,196.735,191.4,196.02,6985460.0 +2017-10-23,194.17,194.8999,191.0346,192.47,6952997.0,0.0,1.0,194.17,194.8999,191.0346,192.47,6952997.0 +2017-10-20,195.9,196.38,193.77,194.16,5907121.0,0.0,1.0,195.9,196.38,193.77,194.16,5907121.0 +2017-10-19,193.01,195.25,191.16,195.13,7007447.0,0.0,1.0,193.01,195.25,191.16,195.13,7007447.0 +2017-10-18,199.99,200.01,194.25,195.54,11133883.0,0.0,1.0,199.99,200.01,194.25,195.54,11133883.0 +2017-10-17,200.11,204.38,197.77,199.48,23819054.0,0.0,1.0,200.11,204.38,197.77,199.48,23819054.0 +2017-10-16,201.95,202.83,197.86,202.68,18103086.0,0.0,1.0,201.95,202.83,197.86,202.68,18103086.0 +2017-10-13,199.7,200.8199,197.1866,199.49,11929816.0,0.0,1.0,199.7,200.8199,197.1866,199.49,11929816.0 +2017-10-12,196.75,198.62,194.71,195.86,7723224.0,0.0,1.0,196.75,198.62,194.71,195.86,7723224.0 +2017-10-11,195.57,196.2199,193.81,194.95,5544715.0,0.0,1.0,195.57,196.2199,193.81,194.95,5544715.0 +2017-10-10,197.85,198.3,192.1,195.08,6179012.0,0.0,1.0,197.85,198.3,192.1,195.08,6179012.0 +2017-10-09,199.1,199.4,196.56,196.87,6912140.0,0.0,1.0,199.1,199.4,196.56,196.87,6912140.0 +2017-10-06,194.3,198.92,192.05,198.02,15096222.0,0.0,1.0,194.3,198.92,192.05,198.02,15096222.0 +2017-10-05,185.65,194.49,184.49,194.39,19270032.0,0.0,1.0,185.65,194.49,184.49,194.39,19270032.0 +2017-10-04,181.41,186.7,181.25,184.45,9170855.0,0.0,1.0,181.41,186.7,181.25,184.45,9170855.0 +2017-10-03,177.65,179.7,177.55,179.19,3903112.0,0.0,1.0,177.65,179.7,177.55,179.19,3903112.0 +2017-10-02,182.11,182.8,176.58,177.01,7316345.0,0.0,1.0,182.11,182.8,176.58,177.01,7316345.0 +2017-09-29,180.73,182.9,180.65,181.35,4193999.0,0.0,1.0,180.73,182.9,180.65,181.35,4193999.0 +2017-09-28,181.25,181.95,179.36,180.7,4064507.0,0.0,1.0,181.25,181.95,179.36,180.7,4064507.0 +2017-09-27,181.01,183.34,180.7,181.97,4963152.0,0.0,1.0,181.01,183.34,180.7,181.97,4963152.0 +2017-09-26,180.7,180.95,176.55,179.38,5572599.0,0.0,1.0,180.7,180.95,176.55,179.38,5572599.0 +2017-09-25,186.46,186.55,177.7,178.55,9322531.0,0.0,1.0,186.46,186.55,177.7,178.55,9322531.0 +2017-09-22,188.4,189.85,186.39,187.35,5420227.0,0.0,1.0,188.4,189.85,186.39,187.35,5420227.0 +2017-09-21,185.82,189.95,184.51,188.78,7113489.0,0.0,1.0,185.82,189.95,184.51,188.78,7113489.0 +2017-09-20,186.1,186.5,183.2,185.51,4473036.0,0.0,1.0,186.1,186.5,183.2,185.51,4473036.0 +2017-09-19,184.98,186.23,184.17,185.68,4951465.0,0.0,1.0,184.98,186.23,184.17,185.68,4951465.0 +2017-09-18,183.61,185.45,182.73,184.62,5318130.0,0.0,1.0,183.61,185.45,182.73,184.62,5318130.0 +2017-09-15,182.73,184.93,181.43,182.1,5442089.0,0.0,1.0,182.73,184.93,181.43,182.1,5442089.0 +2017-09-14,183.25,185.2882,182.07,182.63,4469985.0,0.0,1.0,183.25,185.2882,182.07,182.63,4469985.0 +2017-09-13,184.07,184.4995,182.55,183.64,4303277.0,0.0,1.0,184.07,184.4995,182.55,183.64,4303277.0 +2017-09-12,182.55,185.33,180.6435,185.15,6606688.0,0.0,1.0,182.55,185.33,180.6435,185.15,6606688.0 +2017-09-11,178.1,182.47,178.03,181.74,5936476.0,0.0,1.0,178.1,182.47,178.03,181.74,5936476.0 +2017-09-08,178.45,180.39,176.25,176.42,4577777.0,0.0,1.0,178.45,180.39,176.25,176.42,4577777.0 +2017-09-07,178.8,180.35,177.1,179.0,5938152.0,0.0,1.0,178.8,180.35,177.1,179.0,5938152.0 +2017-09-06,175.25,179.46,173.73,179.25,8695383.0,0.0,1.0,175.25,179.46,173.73,179.25,8695383.0 +2017-09-05,173.4,175.88,172.44,174.52,4580903.0,0.0,1.0,173.4,175.88,172.44,174.52,4580903.0 +2017-09-01,175.55,176.48,173.92,174.74,3781453.0,0.0,1.0,175.55,176.48,173.92,174.74,3781453.0 +2017-08-31,175.45,176.24,173.86,174.71,6886143.0,0.0,1.0,175.45,176.24,173.86,174.71,6886143.0 +2017-08-30,169.5,174.85,169.37,174.69,7985196.0,0.0,1.0,169.5,174.85,169.37,174.69,7985196.0 +2017-08-29,165.0,169.68,164.73,168.81,4573282.0,0.0,1.0,165.0,169.68,164.73,168.81,4573282.0 +2017-08-28,166.43,168.67,165.6,167.12,3619575.0,0.0,1.0,166.43,168.67,165.6,167.12,3619575.0 +2017-08-25,168.58,168.75,165.5,165.95,4045626.0,0.0,1.0,168.58,168.75,165.5,165.95,4045626.0 +2017-08-24,169.86,171.2363,166.15,168.13,5270931.0,0.0,1.0,169.86,171.2363,166.15,168.13,5270931.0 +2017-08-23,168.35,169.64,166.7,169.06,4616656.0,0.0,1.0,168.35,169.64,166.7,169.06,4616656.0 +2017-08-22,167.76,169.93,167.04,169.34,4857816.0,0.0,1.0,167.76,169.93,167.04,169.34,4857816.0 +2017-08-21,166.91,168.99,164.23,166.76,6303314.0,0.0,1.0,166.91,168.99,164.23,166.76,6303314.0 +2017-08-18,165.95,169.97,165.8,166.54,7363750.0,0.0,1.0,165.95,169.97,165.8,166.54,7363750.0 +2017-08-17,169.23,170.58,165.72,166.09,5161920.0,0.0,1.0,169.23,170.58,165.72,166.09,5161920.0 +2017-08-16,167.5,170.5,166.25,169.98,6916579.0,0.0,1.0,167.5,170.5,166.25,169.98,6916579.0 +2017-08-15,171.53,171.88,168.25,168.5,5470271.0,0.0,1.0,171.53,171.88,168.25,168.5,5470271.0 +2017-08-14,169.8,172.45,168.8,171.0,7377962.0,0.0,1.0,169.8,172.45,168.8,171.0,7377962.0 +2017-08-11,169.86,172.58,169.0,171.4,4972045.0,0.0,1.0,169.86,172.58,169.0,171.4,4972045.0 +2017-08-10,174.03,174.45,167.6,169.14,9539473.0,0.0,1.0,174.03,174.45,167.6,169.14,9539473.0 +2017-08-09,171.43,175.96,170.01,175.78,9573608.0,0.0,1.0,171.43,175.96,170.01,175.78,9573608.0 +2017-08-08,181.37,181.91,177.45,178.36,4806525.0,0.0,1.0,181.37,181.91,177.45,178.36,4806525.0 +2017-08-07,181.0,182.27,179.1,181.33,4470746.0,0.0,1.0,181.0,182.27,179.1,181.33,4470746.0 +2017-08-04,179.6,181.0,178.5,180.27,4446148.0,0.0,1.0,179.6,181.0,178.5,180.27,4446148.0 +2017-08-03,180.53,181.2248,178.02,179.23,4596187.0,0.0,1.0,180.53,181.2248,178.02,179.23,4596187.0 +2017-08-02,182.22,182.57,177.8149,180.74,5713517.0,0.0,1.0,182.22,182.57,177.8149,180.74,5713517.0 +2017-08-01,182.49,184.62,181.43,182.03,5003248.0,0.0,1.0,182.49,184.62,181.43,182.03,5003248.0 +2017-07-31,184.26,184.9738,180.65,181.66,4776740.0,0.0,1.0,184.26,184.9738,180.65,181.66,4776740.0 +2017-07-28,182.0,185.03,181.18,184.04,6166404.0,0.0,1.0,182.0,185.03,181.18,184.04,6166404.0 +2017-07-27,189.89,190.0,179.38,182.68,11013995.0,0.0,1.0,189.89,190.0,179.38,182.68,11013995.0 +2017-07-26,187.7,189.7043,187.51,189.08,4354866.0,0.0,1.0,187.7,189.7043,187.51,189.08,4354866.0 +2017-07-25,187.79,188.66,185.81,186.97,5357533.0,0.0,1.0,187.79,188.66,185.81,186.97,5357533.0 +2017-07-24,188.685,190.25,187.01,187.91,8646192.0,0.0,1.0,188.685,190.25,187.01,187.91,8646192.0 +2017-07-21,182.72,191.5,182.71,188.54,9215232.0,0.0,1.0,182.72,191.5,182.71,188.54,9215232.0 +2017-07-20,183.84,185.92,182.7,183.6,7688768.0,0.0,1.0,183.84,185.92,182.7,183.6,7688768.0 +2017-07-19,182.97,187.17,181.75,183.86,17149580.0,0.0,1.0,182.97,187.17,181.75,183.86,17149580.0 +2017-07-18,176.12,185.0,174.24,183.6,40126110.0,0.0,1.0,176.12,185.0,174.24,183.6,40126110.0 +2017-07-17,162.91,163.55,160.0201,161.7,12299024.0,0.0,1.0,162.91,163.55,160.0201,161.7,12299024.0 +2017-07-14,159.3,161.35,157.97,161.12,5412128.0,0.0,1.0,159.3,161.35,157.97,161.12,5412128.0 +2017-07-13,158.51,160.13,156.98,158.17,6666000.0,0.0,1.0,158.51,160.13,156.98,158.17,6666000.0 +2017-07-12,155.77,158.8,155.77,158.75,8095303.0,0.0,1.0,155.77,158.8,155.77,158.75,8095303.0 +2017-07-11,152.37,155.23,151.55,154.33,4824579.0,0.0,1.0,152.37,155.23,151.55,154.33,4824579.0 +2017-07-10,150.34,153.23,149.65,152.67,5113353.0,0.0,1.0,150.34,153.23,149.65,152.67,5113353.0 +2017-07-07,146.65,150.75,146.65,150.18,5490809.0,0.0,1.0,146.65,150.75,146.65,150.18,5490809.0 +2017-07-06,146.13,147.27,144.25,146.25,5253871.0,0.0,1.0,146.13,147.27,144.25,146.25,5253871.0 +2017-07-05,146.58,148.26,145.58,147.61,4469163.0,0.0,1.0,146.58,148.26,145.58,147.61,4469163.0 +2017-07-03,149.8,150.45,145.8,146.17,3907790.0,0.0,1.0,149.8,150.45,145.8,146.17,3907790.0 +2017-06-30,149.76,150.71,148.42,149.41,5164844.0,0.0,1.0,149.76,150.71,148.42,149.41,5164844.0 +2017-06-29,152.82,152.82,148.0,150.09,7106930.0,0.0,1.0,152.82,152.82,148.0,150.09,7106930.0 +2017-06-28,151.64,154.2,150.12,153.41,5522740.0,0.0,1.0,151.64,154.2,150.12,153.41,5522740.0 +2017-06-27,156.62,156.9775,150.7197,151.03,7386827.0,0.0,1.0,156.62,156.9775,150.7197,151.03,7386827.0 +2017-06-26,158.78,159.97,156.56,157.5,5951060.0,0.0,1.0,158.78,159.97,156.56,157.5,5951060.0 +2017-06-23,155.01,158.19,153.76,158.03,6086644.0,0.0,1.0,155.01,158.19,153.76,158.03,6086644.0 +2017-06-22,155.13,155.2,153.7,154.89,3735995.0,0.0,1.0,155.13,155.2,153.7,154.89,3735995.0 +2017-06-21,152.5,155.38,152.26,155.03,5783436.0,0.0,1.0,152.5,155.38,152.26,155.03,5783436.0 +2017-06-20,153.68,154.5,151.4,152.05,4850911.0,0.0,1.0,153.68,154.5,151.4,152.05,4850911.0 +2017-06-19,154.29,155.58,152.41,153.4,6461866.0,0.0,1.0,154.29,155.58,152.41,153.4,6461866.0 +2017-06-16,151.45,153.53,150.39,152.38,6751799.0,0.0,1.0,151.45,153.53,150.39,152.38,6751799.0 +2017-06-15,149.44,152.56,147.3,151.76,6976720.0,0.0,1.0,149.44,152.56,147.3,151.76,6976720.0 +2017-06-14,154.34,155.615,150.28,152.2,6364572.0,0.0,1.0,154.34,155.615,150.28,152.2,6364572.0 +2017-06-13,154.38,155.68,150.13,152.72,8379437.0,0.0,1.0,154.38,155.68,150.13,152.72,8379437.0 +2017-06-12,155.3,155.53,148.31,151.44,14045559.0,0.0,1.0,155.3,155.53,148.31,151.44,14045559.0 +2017-06-09,166.27,166.27,154.5,158.03,10255110.0,0.0,1.0,166.27,166.27,154.5,158.03,10255110.0 +2017-06-08,166.12,166.87,164.84,165.88,3666393.0,0.0,1.0,166.12,166.87,164.84,165.88,3666393.0 +2017-06-07,165.6,166.4,164.4086,165.61,3285592.0,0.0,1.0,165.6,166.4,164.4086,165.61,3285592.0 +2017-06-06,164.95,166.82,164.51,165.17,4325459.0,0.0,1.0,164.95,166.82,164.51,165.17,4325459.0 +2017-06-05,165.49,165.5,163.43,165.06,3830296.0,0.0,1.0,165.49,165.5,163.43,165.06,3830296.0 +2017-06-02,163.42,165.36,162.8,165.18,4217679.0,0.0,1.0,163.42,165.36,162.8,165.18,4217679.0 +2017-06-01,163.52,163.9316,161.7,162.99,3869808.0,0.0,1.0,163.52,163.9316,161.7,162.99,3869808.0 diff --git a/examples/demos/stocqt/content/data/NTAP.csv b/examples/demos/stocqt/content/data/NTAP.csv new file mode 100644 index 000000000..dcceae9ac --- /dev/null +++ b/examples/demos/stocqt/content/data/NTAP.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,55.8,55.94,55.26,55.32,1287431.0,0.0,1.0,55.8,55.94,55.26,55.32,1287431.0 +2017-12-28,56.25,56.45,55.39,55.8,904513.0,0.0,1.0,56.25,56.45,55.39,55.8,904513.0 +2017-12-27,55.9,56.19,55.76,56.15,961107.0,0.0,1.0,55.9,56.19,55.76,56.15,961107.0 +2017-12-26,56.2,56.3,55.64,55.86,875796.0,0.0,1.0,56.2,56.3,55.64,55.86,875796.0 +2017-12-22,56.19,56.49,56.16,56.3,1019859.0,0.0,1.0,56.19,56.49,56.16,56.3,1019859.0 +2017-12-21,57.09,57.17,56.13,56.21,2342109.0,0.0,1.0,57.09,57.17,56.13,56.21,2342109.0 +2017-12-20,58.42,58.44,56.88,57.04,1872565.0,0.0,1.0,58.42,58.44,56.88,57.04,1872565.0 +2017-12-19,57.71,58.125,57.47,57.91,3065092.0,0.0,1.0,57.71,58.125,57.47,57.91,3065092.0 +2017-12-18,57.76,58.13,57.43,57.73,2009903.0,0.0,1.0,57.76,58.13,57.43,57.73,2009903.0 +2017-12-15,57.29,57.88,57.26,57.27,4421855.0,0.0,1.0,57.29,57.88,57.26,57.27,4421855.0 +2017-12-14,57.89,58.16,57.25,57.37,2368380.0,0.0,1.0,57.89,58.16,57.25,57.37,2368380.0 +2017-12-13,57.95,58.32,57.71,57.78,2930515.0,0.0,1.0,57.95,58.32,57.71,57.78,2930515.0 +2017-12-12,58.67,58.82,57.76,57.8,2540225.0,0.0,1.0,58.67,58.82,57.76,57.8,2540225.0 +2017-12-11,58.09,58.99,58.0,58.58,2795677.0,0.0,1.0,58.09,58.99,58.0,58.58,2795677.0 +2017-12-08,57.9,58.63,57.475,58.26,3376794.0,0.0,1.0,57.9,58.63,57.475,58.26,3376794.0 +2017-12-07,57.21,57.82,56.72,57.53,2822878.0,0.0,1.0,57.21,57.82,56.72,57.53,2822878.0 +2017-12-06,56.14,57.275,55.92,57.21,3139341.0,0.0,1.0,56.14,57.275,55.92,57.21,3139341.0 +2017-12-05,55.97,56.56,55.62,56.14,2585323.0,0.0,1.0,55.97,56.56,55.62,56.14,2585323.0 +2017-12-04,56.72,58.11,55.92,55.93,4249052.0,0.0,1.0,56.72,58.11,55.92,55.93,4249052.0 +2017-12-01,55.59,56.51,54.93,56.41,4054006.0,0.0,1.0,55.59,56.51,54.93,56.41,4054006.0 +2017-11-30,56.79,57.75,56.5,56.51,4294760.0,0.0,1.0,56.79,57.75,56.5,56.51,4294760.0 +2017-11-29,56.67,57.18,56.08,56.23,2628942.0,0.0,1.0,56.67,57.18,56.08,56.23,2628942.0 +2017-11-28,56.15,56.91,56.08,56.8,2472780.0,0.0,1.0,56.15,56.91,56.08,56.8,2472780.0 +2017-11-27,56.0,56.32,55.205,56.23,2818463.0,0.0,1.0,56.0,56.32,55.205,56.23,2818463.0 +2017-11-24,56.1,56.55,56.0,56.41,1533554.0,0.0,1.0,56.1,56.55,56.0,56.41,1533554.0 +2017-11-22,55.0,56.1,54.69,56.05,2732890.0,0.0,1.0,55.0,56.1,54.69,56.05,2732890.0 +2017-11-21,54.55,55.5,54.44,55.08,3438391.0,0.0,1.0,54.55,55.5,54.44,55.08,3438391.0 +2017-11-20,52.5,54.81,52.46,54.73,4364375.0,0.0,1.0,52.5,54.81,52.46,54.73,4364375.0 +2017-11-17,53.03,54.72,52.5,52.95,5601447.0,0.0,1.0,53.03,54.72,52.5,52.95,5601447.0 +2017-11-16,51.41,53.89,51.31,53.11,12798497.0,0.0,1.0,51.41,53.89,51.31,53.11,12798497.0 +2017-11-15,45.45,46.09,45.24,45.82,3834732.0,0.0,1.0,45.45,46.09,45.24,45.82,3834732.0 +2017-11-14,45.95,46.14,45.59,45.62,2122392.0,0.0,1.0,45.95,46.14,45.59,45.62,2122392.0 +2017-11-13,46.21,46.62,45.93,46.0,2314390.0,0.0,1.0,46.21,46.62,45.93,46.0,2314390.0 +2017-11-10,46.19,46.7,46.1,46.34,1641852.0,0.0,1.0,46.19,46.7,46.1,46.34,1641852.0 +2017-11-09,46.15,47.2,45.93,46.3,3559622.0,0.0,1.0,46.15,47.2,45.93,46.3,3559622.0 +2017-11-07,45.0,45.07,44.41,44.65,1904133.0,0.0,1.0,45.0,45.07,44.41,44.65,1904133.0 +2017-11-06,44.07,45.12,44.02,45.005,2541032.0,0.0,1.0,44.07,45.12,44.02,45.005,2541032.0 +2017-11-03,44.39,44.485,43.91,44.24,2055137.0,0.0,1.0,44.39,44.485,43.91,44.24,2055137.0 +2017-11-02,44.55,44.605,43.94,44.25,2109252.0,0.0,1.0,44.55,44.605,43.94,44.25,2109252.0 +2017-11-01,44.74,44.9,44.4,44.53,1937032.0,0.0,1.0,44.74,44.9,44.4,44.53,1937032.0 +2017-10-31,43.71,44.57,43.56,44.42,2462916.0,0.0,1.0,43.71,44.57,43.56,44.42,2462916.0 +2017-10-30,43.74,43.95,43.24,43.52,2050846.0,0.0,1.0,43.74,43.95,43.24,43.52,2050846.0 +2017-10-27,44.52,44.52,43.86,44.01,1818983.0,0.0,1.0,44.52,44.52,43.86,44.01,1818983.0 +2017-10-26,43.92,44.675,43.82,44.42,1567088.0,0.0,1.0,43.92,44.675,43.82,44.42,1567088.0 +2017-10-25,44.66,44.66,43.665,43.71,3428810.0,0.0,1.0,44.66,44.66,43.665,43.71,3428810.0 +2017-10-24,44.7,45.03,44.65,44.82,2477689.0,0.0,1.0,44.7,45.03,44.65,44.82,2477689.0 +2017-10-23,44.92,45.14,44.66,44.74,2719135.0,0.0,1.0,44.92,45.14,44.66,44.74,2719135.0 +2017-10-20,44.57,45.03,44.39,44.56,2540716.0,0.0,1.0,44.57,45.03,44.39,44.56,2540716.0 +2017-10-19,44.37,44.505,43.91,44.26,2253612.0,0.0,1.0,44.37,44.505,43.91,44.26,2253612.0 +2017-10-18,44.32,44.64,44.08,44.62,2523179.0,0.0,1.0,44.32,44.64,44.08,44.62,2523179.0 +2017-10-17,43.29,44.11,43.29,44.08,1760179.0,0.0,1.0,43.29,44.11,43.29,44.08,1760179.0 +2017-10-16,43.83,43.939,43.65,43.72,1433772.0,0.0,1.0,43.83,43.939,43.65,43.72,1433772.0 +2017-10-13,43.65,44.22,43.615,43.63,1840650.0,0.0,1.0,43.65,44.22,43.615,43.63,1840650.0 +2017-10-12,43.38,43.59,42.99,43.42,3223379.0,0.0,1.0,43.38,43.59,42.99,43.42,3223379.0 +2017-10-11,43.54,43.9399,43.29,43.51,1654470.0,0.0,1.0,43.54,43.9399,43.29,43.51,1654470.0 +2017-10-10,44.36,44.52,43.57,43.66,3930121.0,0.0,1.0,44.36,44.52,43.57,43.66,3930121.0 +2017-10-09,44.42,44.815,44.25,44.37,2039538.0,0.0,1.0,44.42,44.815,44.25,44.37,2039538.0 +2017-10-06,44.34,44.63,44.05,44.43,1778991.0,0.0,1.0,44.34,44.63,44.05,44.43,1778991.0 +2017-10-05,44.28,44.565,44.17,44.55,2957479.0,0.2,1.0,44.28,44.565,44.17,44.55,2957479.0 +2017-10-04,44.19,44.54,44.17,44.46,2875404.0,0.0,1.0,43.992502793296,44.340938547486,43.972592178771,44.261296089385,2875404.0 +2017-10-03,44.07,44.52,43.75,44.39,2905694.0,0.0,1.0,43.873039106145,44.321027932961,43.554469273743,44.191608938547,2905694.0 +2017-10-02,43.89,44.1,43.71,44.0,3186168.0,0.0,1.0,43.693843575419,43.902905027933,43.514648044693,43.803351955307,3186168.0 +2017-09-29,43.7,43.975,43.39,43.76,1866218.0,0.0,1.0,43.50469273743,43.778463687151,43.196078212291,43.564424581006,1866218.0 +2017-09-28,43.95,44.045,43.52,43.84,2195811.0,0.0,1.0,43.753575418994,43.848150837989,43.325497206704,43.644067039106,2195811.0 +2017-09-27,43.98,44.47,43.56,44.17,2566121.0,0.0,1.0,43.783441340782,44.271251396648,43.365318435754,43.972592178771,2566121.0 +2017-09-26,43.0,43.82,42.875,43.76,3262283.0,0.0,1.0,42.80782122905,43.624156424581,42.683379888268,43.564424581006,3262283.0 +2017-09-25,42.17,43.085,42.11,42.7,2486787.0,0.0,1.0,41.981530726257,42.892441340782,41.921798882682,42.509162011173,2486787.0 +2017-09-22,41.77,42.6,41.7,42.55,1820422.0,0.0,1.0,41.583318435754,42.409608938547,41.513631284916,42.359832402235,1820422.0 +2017-09-21,41.75,42.04,41.64,41.86,2621389.0,0.0,1.0,41.563407821229,41.852111731844,41.453899441341,41.672916201117,2621389.0 +2017-09-20,41.72,41.91,41.22,41.7,2878107.0,0.0,1.0,41.533541899441,41.72269273743,41.035776536313,41.513631284916,2878107.0 +2017-09-19,41.79,42.32,41.3,41.71,5252863.0,0.0,1.0,41.603229050279,42.130860335196,41.115418994413,41.523586592179,5252863.0 +2017-09-18,41.04,41.16,40.51,40.63,2686167.0,0.0,1.0,40.856581005587,40.976044692737,40.32894972067,40.448413407821,2686167.0 +2017-09-15,40.72,41.06,40.33,41.03,3537425.0,0.0,1.0,40.538011173184,40.876491620112,40.149754189944,40.846625698324,3537425.0 +2017-09-14,40.17,40.69,39.95,40.65,2799617.0,0.0,1.0,39.990469273743,40.508145251397,39.771452513966,40.468324022346,2799617.0 +2017-09-13,39.82,40.54,39.55,40.28,3019737.0,0.0,1.0,39.642033519553,40.358815642458,39.373240223464,40.099977653631,3019737.0 +2017-09-12,39.62,40.24,39.16,39.93,4031681.0,0.0,1.0,39.442927374302,40.060156424581,38.984983240223,39.751541899441,4031681.0 +2017-09-11,38.91,39.56,38.8,39.46,2798378.0,0.0,1.0,38.736100558659,39.383195530726,38.626592178771,39.283642458101,2798378.0 +2017-09-08,38.61,38.835,38.3799,38.63,2715485.0,0.0,1.0,38.437441340782,38.66143575419,38.20836972067,38.457351955307,2715485.0 +2017-09-07,38.9,38.9,38.12,38.69,2541004.0,0.0,1.0,38.726145251397,38.726145251397,37.949631284916,38.517083798883,2541004.0 +2017-09-06,38.09,38.97,37.855,38.85,3720730.0,0.0,1.0,37.919765363128,38.795832402235,37.685815642458,38.676368715084,3720730.0 +2017-09-05,38.49,38.74,37.55,37.98,2318304.0,0.0,1.0,38.317977653631,38.566860335196,37.38217877095,37.81025698324,2318304.0 +2017-09-01,38.82,38.9,38.56,38.65,1784904.0,0.0,1.0,38.646502793296,38.726145251397,38.387664804469,38.477262569832,1784904.0 +2017-08-31,38.46,38.6975,38.07,38.66,2576968.0,0.0,1.0,38.288111731844,38.52455027933,37.899854748603,38.487217877095,2576968.0 +2017-08-30,37.98,38.26,37.84,38.22,1625130.0,0.0,1.0,37.81025698324,38.089005586592,37.670882681564,38.049184357542,1625130.0 +2017-08-29,37.92,38.315,37.89,38.03,1437800.0,0.0,1.0,37.750525139665,38.143759776536,37.720659217877,37.860033519553,1437800.0 +2017-08-28,38.73,38.81,38.18,38.34,1448478.0,0.0,1.0,38.556905027933,38.636547486034,38.009363128492,38.168648044693,1448478.0 +2017-08-25,38.97,38.99,38.52,38.54,1868152.0,0.0,1.0,38.795832402235,38.81574301676,38.347843575419,38.367754189944,1868152.0 +2017-08-24,38.76,38.93,38.51,38.81,2128753.0,0.0,1.0,38.586770949721,38.756011173184,38.337888268156,38.636547486034,2128753.0 +2017-08-23,38.49,38.95,38.35,38.6792,2625700.0,0.0,1.0,38.317977653631,38.775921787709,38.178603351955,38.506332067039,2625700.0 +2017-08-22,39.17,39.21,38.59,38.7,3834442.0,0.0,1.0,38.994938547486,39.034759776536,38.417530726257,38.527039106145,3834442.0 +2017-08-21,39.76,39.87,38.51,38.95,4371303.0,0.0,1.0,39.582301675978,39.691810055866,38.337888268156,38.775921787709,4371303.0 +2017-08-18,39.62,39.87,39.26,39.35,4934878.0,0.0,1.0,39.442927374302,39.691810055866,39.084536312849,39.174134078212,4934878.0 +2017-08-17,40.37,41.49,39.475,39.56,11599368.0,0.0,1.0,40.189575418994,41.304569832402,39.298575418994,39.383195530726,11599368.0 +2017-08-16,42.0,42.549,42.0,42.41,3481046.0,0.0,1.0,41.812290502793,42.358836871508,41.812290502793,42.220458100559,3481046.0 +2017-08-15,42.96,43.05,41.97,41.97,3781136.0,0.0,1.0,42.768,42.857597765363,41.782424581006,41.782424581006,3781136.0 +2017-08-14,42.37,42.53,41.75,42.03,3763330.0,0.0,1.0,42.180636871508,42.339921787709,41.563407821229,41.842156424581,3763330.0 +2017-08-11,41.44,41.85,41.23,41.49,1407483.0,0.0,1.0,41.254793296089,41.662960893855,41.045731843575,41.304569832402,1407483.0 +2017-08-10,42.01,42.23,41.23,41.29,2117207.0,0.0,1.0,41.822245810056,42.041262569832,41.045731843575,41.105463687151,2117207.0 +2017-08-09,42.49,42.61,42.18,42.24,1538691.0,0.0,1.0,42.300100558659,42.41956424581,41.99148603352,42.051217877095,1538691.0 +2017-08-08,42.66,43.16,42.52,42.69,1901300.0,0.0,1.0,42.469340782123,42.967106145251,42.329966480447,42.499206703911,1901300.0 +2017-08-07,42.83,42.8843,42.44,42.74,1611901.0,0.0,1.0,42.638581005587,42.692638324022,42.250324022346,42.548983240223,1611901.0 +2017-08-04,43.07,43.11,42.61,42.74,1871097.0,0.0,1.0,42.877508379888,42.917329608939,42.41956424581,42.548983240223,1871097.0 +2017-08-03,43.34,43.34,42.74,42.91,2350321.0,0.0,1.0,43.146301675978,43.146301675978,42.548983240223,42.718223463687,2350321.0 +2017-08-02,43.65,43.79,43.04,43.41,1460145.0,0.0,1.0,43.454916201117,43.594290502793,42.847642458101,43.215988826816,1460145.0 +2017-08-01,43.72,43.83,43.16,43.55,2576291.0,0.0,1.0,43.524603351955,43.634111731844,42.967106145251,43.355363128492,2576291.0 +2017-07-31,43.67,43.82,43.11,43.42,2360992.0,0.0,1.0,43.474826815642,43.624156424581,42.917329608939,43.225944134078,2360992.0 +2017-07-28,43.66,43.86,43.09,43.49,2581751.0,0.0,1.0,43.46487150838,43.663977653631,42.897418994413,43.295631284916,2581751.0 +2017-07-27,44.32,44.97,43.65,44.0197,4149229.0,0.0,1.0,44.121921787709,44.769016759777,43.454916201117,43.822963910615,4149229.0 +2017-07-26,44.87,44.87,44.025,44.36,3272594.0,0.0,1.0,44.669463687151,44.669463687151,43.828240223464,44.16174301676,3272594.0 +2017-07-25,44.58,44.94,44.21,44.76,3495184.0,0.0,1.0,44.380759776536,44.739150837989,44.012413407821,44.559955307263,3495184.0 +2017-07-24,44.4,45.23,44.4,44.86,2877601.0,0.0,1.0,44.20156424581,45.027854748603,44.20156424581,44.659508379888,2877601.0 +2017-07-21,44.56,45.24,44.18,44.76,4496318.0,0.0,1.0,44.360849162011,45.037810055866,43.982547486034,44.559955307263,4496318.0 +2017-07-20,44.18,44.69,44.09,44.6,3563323.0,0.0,1.0,43.982547486034,44.490268156425,43.89294972067,44.400670391061,3563323.0 +2017-07-19,43.88,44.5299,43.83,44.16,3618018.0,0.0,1.0,43.683888268156,44.330883687151,43.634111731844,43.962636871508,3618018.0 +2017-07-18,43.25,43.88,43.18,43.77,3030714.0,0.0,1.0,43.056703910615,43.683888268156,42.987016759777,43.574379888268,3030714.0 +2017-07-17,43.2,43.76,43.0,43.62,5253442.0,0.0,1.0,43.006927374302,43.564424581006,42.80782122905,43.42505027933,5253442.0 +2017-07-14,42.04,43.9,42.0,43.64,8405233.0,0.0,1.0,41.852111731844,43.703798882682,41.812290502793,43.444960893855,8405233.0 +2017-07-13,40.17,41.5,40.04,41.38,3940472.0,0.0,1.0,39.990469273743,41.314525139665,39.86105027933,41.195061452514,3940472.0 +2017-07-12,39.45,40.19,39.1701,40.17,2597317.0,0.0,1.0,39.273687150838,40.010379888268,38.995038100559,39.990469273743,2597317.0 +2017-07-11,38.55,39.11,38.51,39.07,2155200.0,0.0,1.0,38.377709497207,38.935206703911,38.337888268156,38.89538547486,2155200.0 +2017-07-10,38.5,38.91,38.35,38.57,2273543.0,0.0,1.0,38.327932960894,38.736100558659,38.178603351955,38.397620111732,2273543.0 +2017-07-07,38.44,38.83,38.32,38.64,1883863.0,0.0,1.0,38.268201117318,38.656458100559,38.148737430168,38.46730726257,1883863.0 +2017-07-06,39.33,39.39,38.2,38.3,2510853.0,0.0,1.0,39.154223463687,39.213955307263,38.029273743017,38.128826815642,2510853.0 +2017-07-05,39.55,40.25,39.475,39.66,2484571.0,0.2,1.0,39.373240223464,40.070111731844,39.298575418994,39.482748603352,2484571.0 +2017-07-03,40.44,40.5,39.53,39.57,1568751.0,0.0,1.0,40.057259245348,40.116691380726,39.155871858768,39.195493282354,1568751.0 +2017-06-30,40.18,40.38,39.73,40.05,3859273.0,0.0,1.0,39.799719992039,39.997827109969,39.353978976698,39.670950365385,3859273.0 +2017-06-29,40.28,40.38,39.55,40.1,3177050.0,0.0,1.0,39.898773551004,39.997827109969,39.175682570561,39.720477144867,3177050.0 +2017-06-28,39.8,40.59,39.6,40.41,2635603.0,0.0,1.0,39.423316467973,40.205839583795,39.225209350044,40.027543177658,2635603.0 +2017-06-27,40.14,40.35,39.62,39.63,2705421.0,0.0,1.0,39.760098568453,39.968111042279,39.245020061837,39.254925417733,2705421.0 +2017-06-26,39.87,40.515,39.87,40.29,3251780.0,0.0,1.0,39.492653959248,40.131549414571,39.492653959248,39.9086789069,3251780.0 +2017-06-23,39.13,40.07,39.01,39.87,4505252.0,0.0,1.0,38.759657622909,39.690761077178,38.640793352152,39.492653959248,4505252.0 +2017-06-22,38.59,39.36,38.58,39.11,3042690.0,0.0,1.0,38.2247684045,38.987480808528,38.214863048603,38.739846911116,3042690.0 +2017-06-21,38.36,38.86,38.3501,38.61,2462900.0,0.0,1.0,37.996945218881,38.492213013704,37.987138916543,38.244579116292,2462900.0 +2017-06-20,38.27,38.65,38.25,38.26,2206944.0,0.0,1.0,37.907797015812,38.284200539878,37.887986304019,37.897891659916,2206944.0 +2017-06-19,38.17,38.495,38.04,38.42,2487716.0,0.0,1.0,37.808743456848,38.130667523483,37.679973830193,38.056377354259,2487716.0 +2017-06-16,37.94,38.11,37.78,37.98,2238387.0,0.0,1.0,37.580920271229,37.749311321469,37.422434576885,37.620541694815,2238387.0 +2017-06-15,37.72,38.1,37.43,37.97,2208659.0,0.0,1.0,37.363002441506,37.739405965572,37.075747120508,37.610636338918,2208659.0 +2017-06-14,38.94,39.01,37.78,38.1,2849570.0,0.0,1.0,38.571455860876,38.640793352152,37.422434576885,37.739405965572,2849570.0 +2017-06-13,38.95,39.37,38.7,38.93,2827824.0,0.0,1.0,38.581361216773,38.997386164425,38.333727319361,38.56155050498,2827824.0 +2017-06-12,39.14,39.66,38.65,38.86,4222954.0,0.0,1.0,38.769562978806,39.284641485422,38.284200539878,38.492213013704,4222954.0 +2017-06-09,39.87,40.395,39.13,39.52,2961902.0,0.0,1.0,39.492653959248,40.012685143813,38.759657622909,39.145966502872,2961902.0 +2017-06-08,39.21,40.12,39.09,40.01,3552505.0,0.0,1.0,38.838900470081,39.74028785666,38.720036199323,39.631328941799,3552505.0 +2017-06-07,38.86,39.57,38.71,39.27,2414656.0,0.0,1.0,38.492213013704,39.195493282354,38.343632675257,38.89833260546,2414656.0 +2017-06-06,38.7,39.23,38.67,38.7,2459220.0,0.0,1.0,38.333727319361,38.858711181874,38.304011251671,38.333727319361,2459220.0 +2017-06-05,39.19,39.7,38.95,38.98,2387428.0,0.0,1.0,38.819089758288,39.324262909008,38.581361216773,38.611077284462,2387428.0 +2017-06-02,39.51,39.75,39.24,39.41,3121583.0,0.0,1.0,39.136061146975,39.373789688491,38.86861653777,39.037007588011,3121583.0 +2017-06-01,39.85,40.25,39.54,39.61,3933108.0,0.0,1.0,39.472843247455,39.869057483314,39.165777214665,39.23511470594,3933108.0 diff --git a/examples/demos/stocqt/content/data/NVDA.csv b/examples/demos/stocqt/content/data/NVDA.csv new file mode 100644 index 000000000..c37a25ae5 --- /dev/null +++ b/examples/demos/stocqt/content/data/NVDA.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,198.46,198.46,193.5,193.5,6896330.0,0.0,1.0,198.46,198.46,193.5,193.5,6896330.0 +2017-12-28,198.13,199.38,197.1514,197.4,5978211.0,0.0,1.0,198.13,199.38,197.1514,197.4,5978211.0 +2017-12-27,196.9,199.97,196.31,197.17,8097374.0,0.0,1.0,196.9,199.97,196.31,197.17,8097374.0 +2017-12-26,193.03,197.75,191.82,197.44,8821296.0,0.0,1.0,193.03,197.75,191.82,197.44,8821296.0 +2017-12-22,194.4,195.65,191.25,195.27,11613423.0,0.0,1.0,194.4,195.65,191.25,195.27,11613423.0 +2017-12-21,196.94,197.95,195.55,195.89,7458634.0,0.0,1.0,196.94,197.95,195.55,195.89,7458634.0 +2017-12-20,197.7,198.07,194.55,196.8,7185318.0,0.0,1.0,197.7,198.07,194.55,196.8,7185318.0 +2017-12-19,197.52,197.73,194.96,196.11,9217358.0,0.0,1.0,197.52,197.73,194.96,196.11,9217358.0 +2017-12-18,193.2,198.02,192.0,197.9,11730697.0,0.0,1.0,193.2,198.02,192.0,197.9,11730697.0 +2017-12-15,188.251,192.38,185.62,191.56,16090200.0,0.0,1.0,188.251,192.38,185.62,191.56,16090200.0 +2017-12-14,185.92,189.34,184.6,186.47,10871746.0,0.0,1.0,185.92,189.34,184.6,186.47,10871746.0 +2017-12-13,192.5,192.55,185.88,186.18,13744496.0,0.0,1.0,192.5,192.55,185.88,186.18,13744496.0 +2017-12-12,192.9,193.84,189.89,190.84,11296559.0,0.0,1.0,192.9,193.84,189.89,190.84,11296559.0 +2017-12-11,192.06,194.78,191.42,194.66,9106693.0,0.0,1.0,192.06,194.78,191.42,194.66,9106693.0 +2017-12-08,194.01,194.78,191.15,191.49,11483868.0,0.0,1.0,194.01,194.78,191.15,191.49,11483868.0 +2017-12-07,191.96,193.6,190.12,191.99,13190983.0,0.0,1.0,191.96,193.6,190.12,191.99,13190983.0 +2017-12-06,185.7,190.14,184.84,189.26,11464458.0,0.0,1.0,185.7,190.14,184.84,189.26,11464458.0 +2017-12-05,182.4,192.7,180.58,187.74,24480558.0,0.0,1.0,182.4,192.7,180.58,187.74,24480558.0 +2017-12-04,200.05,200.3,184.5,186.66,27080405.0,0.0,1.0,200.05,200.3,184.5,186.66,27080405.0 +2017-12-01,199.31,200.13,192.47,197.68,16352946.0,0.0,1.0,199.31,200.13,192.47,197.68,16352946.0 +2017-11-30,199.2,202.68,196.65,200.71,20144301.0,0.0,1.0,199.2,202.68,196.65,200.71,20144301.0 +2017-11-29,210.01,210.1226,191.23,196.42,34731979.0,0.0,1.0,210.01,210.1226,191.23,196.42,34731979.0 +2017-11-28,214.35,214.73,208.24,210.71,12677148.0,0.0,1.0,214.35,214.73,208.24,210.71,12677148.0 +2017-11-27,217.31,217.36,214.01,214.14,10477983.0,0.0,1.0,217.31,217.36,214.01,214.14,10477983.0 +2017-11-24,215.59,217.0,214.6,216.96,4517982.0,0.0,1.0,215.59,217.0,214.6,216.96,4517982.0 +2017-11-22,217.0,217.0,213.61,214.93,8766814.0,0.0,1.0,217.0,217.0,213.61,214.93,8766814.0 +2017-11-21,215.69,216.52,214.4,216.05,9858634.0,0.0,1.0,215.69,216.52,214.4,216.05,9858634.0 +2017-11-20,211.99,214.57,210.5,214.08,9828414.0,0.0,1.0,211.99,214.57,210.5,214.08,9828414.0 +2017-11-17,213.92,215.35,210.75,211.36,12702474.0,0.0,1.0,213.92,215.35,210.75,211.36,12702474.0 +2017-11-16,212.98,214.2,211.25,211.61,9947915.0,0.0,1.0,212.98,214.2,211.25,211.61,9947915.0 +2017-11-15,211.95,212.0,207.8,209.98,12427082.0,0.0,1.0,211.95,212.0,207.8,209.98,12427082.0 +2017-11-14,213.0,214.8,211.23,214.18,13101484.0,0.0,1.0,213.0,214.8,211.23,214.18,13101484.0 +2017-11-13,216.14,217.17,212.01,212.63,14398431.0,0.0,1.0,216.14,217.17,212.01,212.63,14398431.0 +2017-11-10,213.08,218.67,211.63,216.14,31197127.0,0.0,1.0,213.08,218.67,211.63,216.14,31197127.0 +2017-11-09,205.27,206.33,200.37,205.32,20123846.0,0.0,1.0,205.27,206.33,200.37,205.32,20123846.0 +2017-11-07,210.55,212.9,210.0556,212.03,10580672.0,0.0,1.0,210.55,212.9,210.0556,212.03,10580672.0 +2017-11-06,207.2,209.98,206.7,209.63,9693716.0,0.0,1.0,207.2,209.98,206.7,209.63,9693716.0 +2017-11-03,207.2,208.69,205.341,208.69,8777981.0,0.0,1.0,207.2,208.69,205.341,208.69,8777981.0 +2017-11-02,206.0,207.81,203.65,205.94,8480413.0,0.0,1.0,206.0,207.81,203.65,205.94,8480413.0 +2017-11-01,209.35,209.97,204.6,207.2,12385654.0,0.0,1.0,209.35,209.97,204.6,207.2,12385654.0 +2017-10-31,205.13,207.89,204.9,206.81,10179802.0,0.0,1.0,205.13,207.89,204.9,206.81,10179802.0 +2017-10-30,201.86,206.0899,201.22,203.84,12522329.0,0.0,1.0,201.86,206.0899,201.22,203.84,12522329.0 +2017-10-27,197.8,201.87,196.75,201.86,14174171.0,0.0,1.0,197.8,201.87,196.75,201.86,14174171.0 +2017-10-26,194.78,196.16,193.81,195.69,7892651.0,0.0,1.0,194.78,196.16,193.81,195.69,7892651.0 +2017-10-25,197.08,199.22,191.17,193.66,20588601.0,0.0,1.0,197.08,199.22,191.17,193.66,20588601.0 +2017-10-24,196.99,198.75,195.94,198.68,9820462.0,0.0,1.0,196.99,198.75,195.94,198.68,9820462.0 +2017-10-23,197.78,198.85,195.8,196.62,10592416.0,0.0,1.0,197.78,198.85,195.8,196.62,10592416.0 +2017-10-20,198.49,199.59,196.54,196.9,11006029.0,0.0,1.0,198.49,199.59,196.54,196.9,11006029.0 +2017-10-19,194.44,198.0,192.4501,197.8,14156573.0,0.0,1.0,194.44,198.0,192.4501,197.8,14156573.0 +2017-10-18,198.11,198.14,193.32,197.58,14066925.0,0.0,1.0,198.11,198.14,193.32,197.58,14066925.0 +2017-10-17,197.09,198.9,196.35,197.75,11482547.0,0.0,1.0,197.09,198.9,196.35,197.75,11482547.0 +2017-10-16,195.8,198.048,193.24,197.93,14279032.0,0.0,1.0,195.8,198.048,193.24,197.93,14279032.0 +2017-10-13,193.55,195.0,191.65,194.59,15626525.0,0.0,1.0,193.55,195.0,191.65,194.59,15626525.0 +2017-10-12,191.08,193.09,189.9301,191.03,13036890.0,0.0,1.0,191.08,193.09,189.9301,191.03,13036890.0 +2017-10-11,189.6,191.0,187.74,190.94,13051762.0,0.0,1.0,189.6,191.0,187.74,190.94,13051762.0 +2017-10-10,191.43,192.95,187.26,188.88,24261445.0,0.0,1.0,191.43,192.95,187.26,188.88,24261445.0 +2017-10-09,182.79,186.73,182.03,185.39,13986610.0,0.0,1.0,182.79,186.73,182.03,185.39,13986610.0 +2017-10-06,179.65,181.84,179.0,181.3,7911087.0,0.0,1.0,179.65,181.84,179.0,181.3,7911087.0 +2017-10-05,181.86,182.0,179.56,180.77,10830438.0,0.0,1.0,181.86,182.0,179.56,180.77,10830438.0 +2017-10-04,179.62,181.77,178.14,180.87,10621386.0,0.0,1.0,179.62,181.77,178.14,180.87,10621386.0 +2017-10-03,179.25,180.58,177.58,179.37,9678430.0,0.0,1.0,179.25,180.58,177.58,179.37,9678430.0 +2017-10-02,180.8,181.98,177.0,179.0,12475560.0,0.0,1.0,180.8,181.98,177.0,179.0,12475560.0 +2017-09-29,179.08,179.73,177.25,178.77,14936876.0,0.0,1.0,179.08,179.73,177.25,178.77,14936876.0 +2017-09-28,176.02,176.18,173.76,175.68,10801464.0,0.0,1.0,176.02,176.18,173.76,175.68,10801464.0 +2017-09-27,175.62,176.27,172.75,175.73,17602299.0,0.0,1.0,175.62,176.27,172.75,175.73,17602299.0 +2017-09-26,176.45,178.68,170.35,171.96,27542805.0,0.0,1.0,176.45,178.68,170.35,171.96,27542805.0 +2017-09-25,177.75,177.8,170.16,171.0,21628235.0,0.0,1.0,177.75,177.8,170.16,171.0,21628235.0 +2017-09-22,180.3,182.31,178.6,179.0,12196947.0,0.0,1.0,180.3,182.31,178.6,179.0,12196947.0 +2017-09-21,181.64,182.7,177.61,180.7799,26631321.0,0.0,1.0,181.64,182.7,177.61,180.7799,26631321.0 +2017-09-20,187.5,189.42,184.21,185.84,16435216.0,0.0,1.0,187.5,189.42,184.21,185.84,16435216.0 +2017-09-19,185.51,189.85,184.615,187.35,21631434.0,0.0,1.0,185.51,189.85,184.615,187.35,21631434.0 +2017-09-18,185.14,191.2,184.86,187.55,41601951.0,0.0,1.0,185.14,191.2,184.86,187.55,41601951.0 +2017-09-15,172.86,180.11,172.65,180.11,33338633.0,0.0,1.0,172.86,180.11,172.65,180.11,33338633.0 +2017-09-14,168.79,172.56,167.8,169.4,12728431.0,0.0,1.0,168.79,172.56,167.8,169.4,12728431.0 +2017-09-13,168.59,171.54,167.28,170.37,14340105.0,0.0,1.0,168.59,171.54,167.28,170.37,14340105.0 +2017-09-12,170.0,170.0,166.97,169.61,10155905.0,0.0,1.0,170.0,170.0,166.97,169.61,10155905.0 +2017-09-11,165.54,169.4325,165.32,169.0,13934287.0,0.0,1.0,165.54,169.4325,165.32,169.0,13934287.0 +2017-09-08,166.11,166.71,162.71,163.69,12365074.0,0.0,1.0,166.11,166.71,162.71,163.69,12365074.0 +2017-09-07,166.49,167.89,164.95,166.58,8731886.0,0.0,1.0,166.49,167.89,164.95,166.58,8731886.0 +2017-09-06,167.24,167.8,164.4,165.81,9800559.0,0.0,1.0,167.24,167.8,164.4,165.81,9800559.0 +2017-09-05,168.38,168.5843,163.5625,165.91,17358768.0,0.0,1.0,168.38,168.5843,163.5625,165.91,17358768.0 +2017-09-01,169.95,171.9,169.6,170.46,11017001.0,0.0,1.0,169.95,171.9,169.6,170.46,11017001.0 +2017-08-31,166.5,169.6,166.2,169.44,15022660.0,0.0,1.0,166.5,169.6,166.2,169.44,15022660.0 +2017-08-30,165.5,166.13,164.27,165.68,9469680.0,0.0,1.0,165.5,166.13,164.27,165.68,9469680.0 +2017-08-29,162.59,165.58,162.261,164.7,7992338.0,0.0,1.0,162.59,165.58,162.261,164.7,7992338.0 +2017-08-28,164.58,165.1,162.33,164.97,9568908.0,0.0,1.0,164.58,165.1,162.33,164.97,9568908.0 +2017-08-25,166.17,166.58,163.55,163.81,8753208.0,0.0,1.0,166.17,166.58,163.55,163.81,8753208.0 +2017-08-24,167.1,167.28,164.12,165.19,11592997.0,0.0,1.0,167.1,167.28,164.12,165.19,11592997.0 +2017-08-23,161.2,166.25,160.85,165.8,14421053.0,0.0,1.0,161.2,166.25,160.85,165.8,14421053.0 +2017-08-22,160.49,162.79,159.71,162.51,11084658.0,0.14,1.0,160.49,162.79,159.71,162.51,11084658.0 +2017-08-21,162.49,162.95,157.37,159.12,15203637.0,0.0,1.0,162.35013771903,162.80974177682,157.23454472794,158.98303842607,15203637.0 +2017-08-18,163.67,164.36,159.64,161.5,14883408.0,0.0,1.0,163.52912204119,164.21852812788,159.50259083923,161.36098985552,14883408.0 +2017-08-17,164.81,165.5,161.38,161.47,12937916.0,0.0,1.0,164.66814079311,165.3575468798,161.24109314479,161.33101567784,12937916.0 +2017-08-16,167.59,168.54,163.84,165.15,14788247.0,0.0,1.0,167.44574792499,168.39493021826,163.69897571472,165.00784814018,14788247.0 +2017-08-15,168.61,169.67,165.59,166.98,18980198.0,0.0,1.0,168.46486996619,169.52395757762,165.44746941285,166.83627297879,18980198.0 +2017-08-14,159.67,168.55,159.2,168.4,31674266.0,0.0,1.0,159.53256501691,168.40492161082,159.06296956655,168.25505072241,31674266.0 +2017-08-11,157.14,159.0,152.91,155.95,37272782.0,0.0,1.0,157.00474269905,158.86314171534,152.77838364587,155.81576698432,37272782.0 +2017-08-10,172.16,172.66,164.33,164.74,26065538.0,0.0,1.0,172.01181432524,172.51138395327,164.1885539502,164.59820104519,26065538.0 +2017-08-09,168.43,172.21,167.67,172.11,13060514.0,0.0,1.0,168.28502490009,172.06177128804,167.52567906548,171.96185736243,13060514.0 +2017-08-08,173.89,174.56,168.71,170.3,18632853.0,0.0,1.0,173.74032523824,174.40974853981,168.56478389179,170.15341530895,18632853.0 +2017-08-07,168.39,172.37,168.0,172.25,17743004.0,0.0,1.0,168.24505932985,172.22163356901,167.85539501998,172.10173685828,17743004.0 +2017-08-04,167.4,170.07,166.48,167.21,14653397.0,0.0,1.0,167.25591146634,169.92361328005,166.33670335075,167.06607500769,14653397.0 +2017-08-03,164.37,166.63,163.68,166.48,10926536.0,0.0,1.0,164.22851952044,166.48657423916,163.53911343375,166.33670335075,10926536.0 +2017-08-02,165.75,165.91,161.27,164.39,11565556.0,0.0,1.0,165.60733169382,165.76719397479,161.13118782662,164.24850230556,11565556.0 +2017-08-01,162.125,164.56,161.0,164.49,10606575.0,0.0,1.0,161.98545189056,164.4183559791,160.86142022748,164.34841623117,10606575.0 +2017-07-31,164.94,166.4,160.62,162.51,13800261.0,0.0,1.0,164.7980288964,166.25677221027,160.48174731018,162.37012050415,13800261.0 +2017-07-28,160.29,165.38,159.28,164.39,12776296.0,0.0,1.0,160.15203135567,165.23765016907,159.14290070704,164.24850230556,12776296.0 +2017-07-27,168.27,168.74,157.56,161.74,18888931.0,0.0,1.0,168.12516261912,168.59475806947,157.4243811866,161.60078327698,18888931.0 +2017-07-26,167.68,169.927,165.85,167.26,15755026.0,0.0,1.0,167.53567045804,169.78073636643,165.70724561943,167.11603197049,15755026.0 +2017-07-25,165.22,165.93,163.581,165.35,12002860.0,0.0,1.0,165.0777878881,165.78717675991,163.4401986474,165.20767599139,12002860.0 +2017-07-24,168.39,168.78,165.72,166.15,15868676.0,0.0,1.0,168.24505932985,168.63472363972,165.57735751614,166.00698739625,15868676.0 +2017-07-21,166.67,169.3,166.09,168.1,15886110.0,0.0,1.0,166.52653980941,169.15427605287,165.94703904089,167.95530894559,15886110.0 +2017-07-20,165.93,167.51,163.9121,167.48,17258237.0,0.0,1.0,165.78717675991,167.36581678451,163.77101365509,167.33584260682,17258237.0 +2017-07-19,166.33,167.4,164.61,165.1,17014089.0,0.0,1.0,166.18683246234,167.25591146634,164.4683129419,164.95789117737,17014089.0 +2017-07-18,161.78,166.55,161.3,165.96,19123179.0,0.0,1.0,161.64074884722,166.40664309868,161.1611620043,165.8171509376,19123179.0 +2017-07-17,166.33,167.5,161.75,164.25,22936328.0,0.0,1.0,166.18683246234,167.35582539195,161.61077466954,164.10862280971,22936328.0 +2017-07-14,161.29,165.01,161.01,164.95,23349534.0,0.0,1.0,161.15117061174,164.86796864433,160.87141162004,164.80802028896,23349534.0 +2017-07-13,163.0,166.3,158.75,160.63,34123997.0,0.0,1.0,162.85969873962,166.15685828466,158.61335690132,160.49173870274,34123997.0 +2017-07-12,158.3,163.0,156.56,162.51,28283476.0,0.0,1.0,158.16374423609,162.85969873962,156.42524193053,162.37012050415,28283476.0 +2017-07-11,153.85,156.19,152.15,155.88,18744156.0,0.0,1.0,153.71757454657,156.05556040578,152.01903781125,155.7458272364,18744156.0 +2017-07-10,149.74,154.0,148.6842,153.7,23720137.0,0.0,1.0,149.61111220412,153.86744543498,148.55622097756,153.56770365816,23720137.0 +2017-07-07,145.78,147.5,144.85,146.76,16258515.0,0.0,1.0,145.65452075008,147.37304027052,144.72532124193,146.63367722103,16258515.0 +2017-07-06,141.87,145.3799,139.76,143.48,18383056.0,0.0,1.0,141.74788625884,145.25476513372,139.63970242853,143.35650046111,18383056.0 +2017-07-05,141.9,144.22,141.13,143.05,20226442.0,0.0,1.0,141.77786043652,144.09586351061,141.00852320935,142.926870581,20226442.0 +2017-07-03,145.05,145.6537,138.58,139.33,17722284.0,0.0,1.0,144.92514909314,145.52832946204,138.46071810636,139.21007254842,17722284.0 +2017-06-30,147.38,147.93,143.5,144.56,17992137.0,0.0,1.0,147.25314355979,147.80267015063,143.37648324623,144.43557085767,17992137.0 +2017-06-29,150.6,150.72,144.08,146.68,26334702.0,0.0,1.0,150.47037196434,150.59026867507,143.95598401476,146.55374608054,26334702.0 +2017-06-28,149.32,151.94,145.75,151.75,24660291.0,0.0,1.0,149.19147371657,151.80921856748,145.62454657239,151.61938210882,24660291.0 +2017-06-27,151.44,151.79,146.35,146.58,24850612.0,0.0,1.0,151.30964893944,151.65934767907,146.22403012604,146.45383215493,24850612.0 +2017-06-26,155.16,156.6,148.33,152.15,26418557.0,0.0,1.0,155.02644697203,156.46520750077,148.20232585306,152.01903781125,26418557.0 +2017-06-23,158.68,159.32,153.22,154.11,24565502.0,0.0,1.0,158.5434171534,159.18286627728,153.08811681525,153.97735075315,24565502.0 +2017-06-22,159.8,160.34,157.4,158.37,11596308.0,0.0,1.0,159.6624531202,160.20198831848,157.26451890563,158.23368398401,11596308.0 +2017-06-21,158.21,159.62,155.7,159.47,16945632.0,0.0,1.0,158.07382170304,159.4826080541,155.5659821703,159.33273716569,16945632.0 +2017-06-20,159.03,161.74,156.92,157.09,27169647.0,0.0,1.0,158.89311589302,161.60078327698,156.78493206271,156.95478573624,27169647.0 +2017-06-19,153.41,157.53,153.26,157.32,19260255.0,0.0,1.0,153.2779532739,157.39440700891,153.12808238549,157.18458776514,19260255.0 +2017-06-16,152.76,154.7,150.24,151.62,22554327.0,0.0,1.0,152.62851275745,154.56684291423,150.11068183215,151.48949400553,22554327.0 +2017-06-15,146.96,153.6,146.5,152.37,23883179.0,0.0,1.0,146.83350507224,153.46778973255,146.37390101445,152.23884844759,23883179.0 +2017-06-14,151.52,154.06,148.5,151.72,29431459.0,0.0,1.0,151.38958007993,153.92739379035,148.37217952659,151.58940793114,29431459.0 +2017-06-13,154.4,154.77,145.65,151.4,41488612.0,0.0,1.0,154.26710113741,154.63678266216,145.52463264679,151.2696833692,41488612.0 +2017-06-12,145.88,151.7,142.11,149.97,41793262.0,0.0,1.0,145.75443467568,151.56942514602,141.9876796803,149.84091423302,41793262.0 +2017-06-09,164.74,168.5,142.75,149.6,91979374.0,0.0,1.0,164.59820104519,168.35496464802,142.62712880418,149.47123270827,91979374.0 +2017-06-08,153.46,160.0,151.79,159.952,28475455.0,0.0,1.0,153.3279102367,159.86228097141,151.65934767907,159.81432228712,28475455.0 +2017-06-07,148.33,149.88,147.7,149.12,15057318.0,0.0,1.0,148.20232585306,149.75099169997,147.57286812173,148.99164586536,15057318.0 +2017-06-06,147.82,149.69,146.8,147.34,18743334.0,0.0,1.0,147.69276483246,149.56115524132,146.67364279127,147.21317798955,18743334.0 +2017-06-05,142.98,148.53,142.51,148.01,20311623.0,0.0,1.0,142.85693083308,148.40215370427,142.38733538272,147.88260129112,20311623.0 +2017-06-02,144.24,145.3,143.4,143.64,12140804.0,0.0,1.0,144.11584629573,145.17493390716,143.27656932063,143.51636274208,12140804.0 +2017-06-01,144.99,145.03,142.52,144.2499,12462061.0,0.0,1.0,144.86520073778,144.90516630802,142.39732677528,144.12573777436,12462061.0 diff --git a/examples/demos/stocqt/content/data/PYPL.csv b/examples/demos/stocqt/content/data/PYPL.csv new file mode 100644 index 000000000..53034c65d --- /dev/null +++ b/examples/demos/stocqt/content/data/PYPL.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,73.92,74.53,73.58,73.62,4396182.0,0.0,1.0,73.92,74.53,73.58,73.62,4396182.0 +2017-12-28,74.96,75.0,73.86,74.17,3363964.0,0.0,1.0,74.96,75.0,73.86,74.17,3363964.0 +2017-12-27,74.25,74.93,74.0,74.59,4226467.0,0.0,1.0,74.25,74.93,74.0,74.59,4226467.0 +2017-12-26,73.29,74.34,72.63,74.27,4683371.0,0.0,1.0,73.29,74.34,72.63,74.27,4683371.0 +2017-12-22,73.8,74.04,72.9,73.89,3570969.0,0.0,1.0,73.8,74.04,72.9,73.89,3570969.0 +2017-12-21,74.19,74.47,73.8,74.02,4556474.0,0.0,1.0,74.19,74.47,73.8,74.02,4556474.0 +2017-12-20,74.64,74.9,73.76,74.0,5964055.0,0.0,1.0,74.64,74.9,73.76,74.0,5964055.0 +2017-12-19,75.39,75.39,73.91,74.5,7430435.0,0.0,1.0,75.39,75.39,73.91,74.5,7430435.0 +2017-12-18,76.3,76.35,75.2,75.32,8034166.0,0.0,1.0,76.3,76.35,75.2,75.32,8034166.0 +2017-12-15,74.82,75.87,73.51,75.65,10935788.0,0.0,1.0,74.82,75.87,73.51,75.65,10935788.0 +2017-12-14,74.5,75.53,74.2,74.26,7453419.0,0.0,1.0,74.5,75.53,74.2,74.26,7453419.0 +2017-12-13,74.08,75.42,73.77,74.09,7037486.0,0.0,1.0,74.08,75.42,73.77,74.09,7037486.0 +2017-12-12,73.45,74.31,73.0,73.62,5947690.0,0.0,1.0,73.45,74.31,73.0,73.62,5947690.0 +2017-12-11,72.96,73.68,72.56,73.29,5786918.0,0.0,1.0,72.96,73.68,72.56,73.29,5786918.0 +2017-12-08,74.71,74.71,72.6,72.91,8130594.0,0.0,1.0,74.71,74.71,72.6,72.91,8130594.0 +2017-12-07,73.25,74.069,73.25,73.69,7547591.0,0.0,1.0,73.25,74.069,73.25,73.69,7547591.0 +2017-12-06,70.89,73.2,70.83,73.14,9188317.0,0.0,1.0,70.89,73.2,70.83,73.14,9188317.0 +2017-12-05,69.81,72.75,69.61,71.2,15818651.0,0.0,1.0,69.81,72.75,69.61,71.2,15818651.0 +2017-12-04,75.59,75.7439,68.61,70.97,26157704.0,0.0,1.0,75.59,75.7439,68.61,70.97,26157704.0 +2017-12-01,75.22,76.44,74.26,75.2999,13310272.0,0.0,1.0,75.22,76.44,74.26,75.2999,13310272.0 +2017-11-30,73.77,75.87,73.54,75.73,15737916.0,0.0,1.0,73.77,75.87,73.54,75.73,15737916.0 +2017-11-29,77.95,77.98,71.67,73.25,24981118.0,0.0,1.0,77.95,77.98,71.67,73.25,24981118.0 +2017-11-28,77.95,78.23,77.2435,77.79,8570920.0,0.0,1.0,77.95,78.23,77.2435,77.79,8570920.0 +2017-11-27,78.63,79.385,77.71,77.84,6745449.0,0.0,1.0,78.63,79.385,77.71,77.84,6745449.0 +2017-11-24,77.81,78.9,77.7,78.57,4305618.0,0.0,1.0,77.81,78.9,77.7,78.57,4305618.0 +2017-11-22,77.9,77.99,76.62,77.57,7975445.0,0.0,1.0,77.9,77.99,76.62,77.57,7975445.0 +2017-11-21,77.09,78.43,76.85,77.77,10283504.0,0.0,1.0,77.09,78.43,76.85,77.77,10283504.0 +2017-11-20,76.6,77.32,75.88,76.01,6799610.0,0.0,1.0,76.6,77.32,75.88,76.01,6799610.0 +2017-11-17,78.01,78.01,75.8,76.38,11771514.0,0.0,1.0,78.01,78.01,75.8,76.38,11771514.0 +2017-11-16,75.5,77.94,75.28,77.7,12154083.0,0.0,1.0,75.5,77.94,75.28,77.7,12154083.0 +2017-11-15,74.3,74.4,73.1853,73.43,5780290.0,0.0,1.0,74.3,74.4,73.1853,73.43,5780290.0 +2017-11-14,74.1,74.82,73.62,74.49,5426087.0,0.0,1.0,74.1,74.82,73.62,74.49,5426087.0 +2017-11-13,73.61,74.29,73.34,74.03,5821794.0,0.0,1.0,73.61,74.29,73.34,74.03,5821794.0 +2017-11-10,73.77,74.14,73.56,73.99,5703206.0,0.0,1.0,73.77,74.14,73.56,73.99,5703206.0 +2017-11-09,74.02,74.2,72.41,74.1,8526645.0,0.0,1.0,74.02,74.2,72.41,74.1,8526645.0 +2017-11-07,75.17,75.45,74.19,74.41,6855004.0,0.0,1.0,75.17,75.45,74.19,74.41,6855004.0 +2017-11-06,73.72,74.76,73.42,74.74,10052359.0,0.0,1.0,73.72,74.76,73.42,74.74,10052359.0 +2017-11-03,72.37,73.41,71.94,73.39,6714105.0,0.0,1.0,72.37,73.41,71.94,73.39,6714105.0 +2017-11-02,72.46,72.7755,72.01,72.25,4518557.0,0.0,1.0,72.46,72.7755,72.01,72.25,4518557.0 +2017-11-01,72.78,72.99,71.69,72.38,6576235.0,0.0,1.0,72.78,72.99,71.69,72.38,6576235.0 +2017-10-31,71.34,72.74,71.11,72.56,7478157.0,0.0,1.0,71.34,72.74,71.11,72.56,7478157.0 +2017-10-30,71.45,71.54,70.53,71.15,6911407.0,0.0,1.0,71.45,71.54,70.53,71.15,6911407.0 +2017-10-27,71.72,71.79,70.58,71.06,9192172.0,0.0,1.0,71.72,71.79,70.58,71.06,9192172.0 +2017-10-26,71.46,72.07,71.04,71.34,7967791.0,0.0,1.0,71.46,72.07,71.04,71.34,7967791.0 +2017-10-25,69.94,71.42,69.85,71.02,11908785.0,0.0,1.0,69.94,71.42,69.85,71.02,11908785.0 +2017-10-24,69.73,70.565,69.67,70.21,12057648.0,0.0,1.0,69.73,70.565,69.67,70.21,12057648.0 +2017-10-23,71.02,71.33,69.55,69.8,12004583.0,0.0,1.0,71.02,71.33,69.55,69.8,12004583.0 +2017-10-20,71.33,71.73,69.69,70.97,33976887.0,0.0,1.0,71.33,71.73,69.69,70.97,33976887.0 +2017-10-19,67.3,67.45,66.16,67.25,11645310.0,0.0,1.0,67.3,67.45,66.16,67.25,11645310.0 +2017-10-18,67.4,67.5,67.0,67.26,7866118.0,0.0,1.0,67.4,67.5,67.0,67.26,7866118.0 +2017-10-17,67.65,67.67,66.35,66.67,10630805.0,0.0,1.0,67.65,67.67,66.35,66.67,10630805.0 +2017-10-16,69.04,69.2,67.28,67.31,9449837.0,0.0,1.0,69.04,69.2,67.28,67.31,9449837.0 +2017-10-13,69.49,69.61,68.0,68.66,8596855.0,0.0,1.0,69.49,69.61,68.0,68.66,8596855.0 +2017-10-12,68.02,68.98,67.8048,68.86,8607233.0,0.0,1.0,68.02,68.98,67.8048,68.86,8607233.0 +2017-10-11,67.25,68.42,66.98,67.78,11918941.0,0.0,1.0,67.25,68.42,66.98,67.78,11918941.0 +2017-10-10,66.6,66.67,65.79,66.04,5795772.0,0.0,1.0,66.6,66.67,65.79,66.04,5795772.0 +2017-10-09,66.2,66.55,65.9,66.23,5511409.0,0.0,1.0,66.2,66.55,65.9,66.23,5511409.0 +2017-10-06,66.0,66.41,65.79,66.05,6102894.0,0.0,1.0,66.0,66.41,65.79,66.05,6102894.0 +2017-10-05,64.38,66.0,64.22,65.82,6918222.0,0.0,1.0,64.38,66.0,64.22,65.82,6918222.0 +2017-10-04,64.3,64.3,63.69,64.01,4399565.0,0.0,1.0,64.3,64.3,63.69,64.01,4399565.0 +2017-10-03,64.51,64.51,63.7607,64.22,5614020.0,0.0,1.0,64.51,64.51,63.7607,64.22,5614020.0 +2017-10-02,64.5,65.12,64.1,64.18,5141673.0,0.0,1.0,64.5,65.12,64.1,64.18,5141673.0 +2017-09-29,63.86,64.17,63.5,64.03,6706995.0,0.0,1.0,63.86,64.17,63.5,64.03,6706995.0 +2017-09-28,63.62,64.055,63.11,63.93,3982117.0,0.0,1.0,63.62,64.055,63.11,63.93,3982117.0 +2017-09-27,63.41,63.75,63.1601,63.33,6807674.0,0.0,1.0,63.41,63.75,63.1601,63.33,6807674.0 +2017-09-26,63.71,63.7623,62.84,62.94,8084916.0,0.0,1.0,63.71,63.7623,62.84,62.94,8084916.0 +2017-09-25,65.0,65.0,62.365,63.5,13088161.0,0.0,1.0,65.0,65.0,62.365,63.5,13088161.0 +2017-09-22,64.33,65.24,64.11,65.08,6539011.0,0.0,1.0,64.33,65.24,64.11,65.08,6539011.0 +2017-09-21,64.67,64.95,63.905,64.63,6539750.0,0.0,1.0,64.67,64.95,63.905,64.63,6539750.0 +2017-09-20,63.99,64.87,63.83,64.74,11704012.0,0.0,1.0,63.99,64.87,63.83,64.74,11704012.0 +2017-09-19,63.01,63.925,62.96,63.83,7646245.0,0.0,1.0,63.01,63.925,62.96,63.83,7646245.0 +2017-09-18,62.62,63.5299,62.52,62.92,7561354.0,0.0,1.0,62.62,63.5299,62.52,62.92,7561354.0 +2017-09-15,62.27,62.8,61.96,62.5,9561717.0,0.0,1.0,62.27,62.8,61.96,62.5,9561717.0 +2017-09-14,62.04,62.37,61.71,62.24,5657030.0,0.0,1.0,62.04,62.37,61.71,62.24,5657030.0 +2017-09-13,62.47,62.75,61.58,62.04,6113877.0,0.0,1.0,62.47,62.75,61.58,62.04,6113877.0 +2017-09-12,62.95,63.12,62.15,62.56,6199885.0,0.0,1.0,62.95,63.12,62.15,62.56,6199885.0 +2017-09-11,61.73,63.26,61.62,62.64,8162604.0,0.0,1.0,61.73,63.26,61.62,62.64,8162604.0 +2017-09-08,61.94,62.0,61.1,61.13,4876488.0,0.0,1.0,61.94,62.0,61.1,61.13,4876488.0 +2017-09-07,61.33,62.13,61.28,62.0,4962951.0,0.0,1.0,61.33,62.13,61.28,62.0,4962951.0 +2017-09-06,61.74,61.99,60.9,61.24,5217668.0,0.0,1.0,61.74,61.99,60.9,61.24,5217668.0 +2017-09-05,61.26,61.75,60.58,61.27,5696603.0,0.0,1.0,61.26,61.75,60.58,61.27,5696603.0 +2017-09-01,61.98,62.23,61.3831,61.46,3389772.0,0.0,1.0,61.98,62.23,61.3831,61.46,3389772.0 +2017-08-31,62.0,62.029,61.17,61.68,6088973.0,0.0,1.0,62.0,62.029,61.17,61.68,6088973.0 +2017-08-30,61.05,61.86,60.89,61.77,5613393.0,0.0,1.0,61.05,61.86,60.89,61.77,5613393.0 +2017-08-29,59.82,61.16,59.63,61.01,4330268.0,0.0,1.0,59.82,61.16,59.63,61.01,4330268.0 +2017-08-28,60.31,60.53,59.81,60.53,4616049.0,0.0,1.0,60.31,60.53,59.81,60.53,4616049.0 +2017-08-25,60.33,60.58,59.61,59.97,4006421.0,0.0,1.0,60.33,60.58,59.61,59.97,4006421.0 +2017-08-24,60.22,60.43,59.11,60.0,3787878.0,0.0,1.0,60.22,60.43,59.11,60.0,3787878.0 +2017-08-23,60.3,60.51,59.82,60.04,4511679.0,0.0,1.0,60.3,60.51,59.82,60.04,4511679.0 +2017-08-22,59.72,61.0,59.44,60.84,5782471.0,0.0,1.0,59.72,61.0,59.44,60.84,5782471.0 +2017-08-21,59.33,59.65,58.755,59.4,4206531.0,0.0,1.0,59.33,59.65,58.755,59.4,4206531.0 +2017-08-18,59.36,59.82,58.94,59.44,4594653.0,0.0,1.0,59.36,59.82,58.94,59.44,4594653.0 +2017-08-17,60.15,60.28,59.29,59.29,6537123.0,0.0,1.0,60.15,60.28,59.29,59.29,6537123.0 +2017-08-16,59.95,60.7,59.6,60.29,5679048.0,0.0,1.0,59.95,60.7,59.6,60.29,5679048.0 +2017-08-15,59.3,59.98,59.23,59.69,6419599.0,0.0,1.0,59.3,59.98,59.23,59.69,6419599.0 +2017-08-14,58.61,59.2763,58.271,59.06,7127903.0,0.0,1.0,58.61,59.2763,58.271,59.06,7127903.0 +2017-08-11,57.85,58.25,57.58,58.04,6891359.0,0.0,1.0,57.85,58.25,57.58,58.04,6891359.0 +2017-08-10,59.24,59.37,57.81,58.02,9341375.0,0.0,1.0,59.24,59.37,57.81,58.02,9341375.0 +2017-08-09,58.97,59.73,58.59,59.67,5991127.0,0.0,1.0,58.97,59.73,58.59,59.67,5991127.0 +2017-08-08,59.61,59.88,59.25,59.48,5960460.0,0.0,1.0,59.61,59.88,59.25,59.48,5960460.0 +2017-08-07,59.18,59.64,58.84,59.62,5875028.0,0.0,1.0,59.18,59.64,58.84,59.62,5875028.0 +2017-08-04,58.62,58.93,58.32,58.86,6118655.0,0.0,1.0,58.62,58.93,58.32,58.86,6118655.0 +2017-08-03,59.16,59.28,58.36,58.42,6104372.0,0.0,1.0,59.16,59.28,58.36,58.42,6104372.0 +2017-08-02,59.67,59.71,58.44,59.12,6486312.0,0.0,1.0,59.67,59.71,58.44,59.12,6486312.0 +2017-08-01,59.0,59.39,58.79,59.34,8950112.0,0.0,1.0,59.0,59.39,58.79,59.34,8950112.0 +2017-07-31,59.37,59.64,58.52,58.55,7307044.0,0.0,1.0,59.37,59.64,58.52,58.55,7307044.0 +2017-07-28,59.8,60.71,59.04,59.2,10684806.0,0.0,1.0,59.8,60.71,59.04,59.2,10684806.0 +2017-07-27,61.0,61.3,57.6921,60.15,22678000.0,0.0,1.0,61.0,61.3,57.6921,60.15,22678000.0 +2017-07-26,58.48,58.94,57.9,58.79,12794748.0,0.0,1.0,58.48,58.94,57.9,58.79,12794748.0 +2017-07-25,58.73,58.83,58.19,58.26,7859354.0,0.0,1.0,58.73,58.83,58.19,58.26,7859354.0 +2017-07-24,58.9,59.07,58.34,58.58,6373567.0,0.0,1.0,58.9,59.07,58.34,58.58,6373567.0 +2017-07-21,59.0,59.33,58.59,58.67,7486133.0,0.0,1.0,59.0,59.33,58.59,58.67,7486133.0 +2017-07-20,58.75,59.38,58.43,59.09,7990391.0,0.0,1.0,58.75,59.38,58.43,59.09,7990391.0 +2017-07-19,58.31,58.62,57.55,58.35,9624663.0,0.0,1.0,58.31,58.62,57.55,58.35,9624663.0 +2017-07-18,57.5,58.96,57.31,58.96,9436755.0,0.0,1.0,57.5,58.96,57.31,58.96,9436755.0 +2017-07-17,57.53,57.6,57.02,57.58,5604480.0,0.0,1.0,57.53,57.6,57.02,57.58,5604480.0 +2017-07-14,58.14,58.63,56.915,57.16,11651935.0,0.0,1.0,58.14,58.63,56.915,57.16,11651935.0 +2017-07-13,57.3,57.91,56.8,57.9,14687917.0,0.0,1.0,57.3,57.91,56.8,57.9,14687917.0 +2017-07-12,56.6,57.445,55.55,56.55,17345098.0,0.0,1.0,56.6,57.445,55.55,56.55,17345098.0 +2017-07-11,54.92,55.2,54.33,54.76,8865099.0,0.0,1.0,54.92,55.2,54.33,54.76,8865099.0 +2017-07-10,54.91,55.42,54.7,54.96,9916785.0,0.0,1.0,54.91,55.42,54.7,54.96,9916785.0 +2017-07-07,53.7,54.48,53.52,53.97,4805962.0,0.0,1.0,53.7,54.48,53.52,53.97,4805962.0 +2017-07-06,54.22,54.3506,53.15,53.47,7289275.0,0.0,1.0,54.22,54.3506,53.15,53.47,7289275.0 +2017-07-05,53.0,54.75,52.94,54.61,9638570.0,0.0,1.0,53.0,54.75,52.94,54.61,9638570.0 +2017-07-03,54.14,54.33,52.83,52.87,4831590.0,0.0,1.0,54.14,54.33,52.83,52.87,4831590.0 +2017-06-30,53.6,54.25,53.29,53.67,7611077.0,0.0,1.0,53.6,54.25,53.29,53.67,7611077.0 +2017-06-29,53.81,54.1,52.52,53.42,11162726.0,0.0,1.0,53.81,54.1,52.52,53.42,11162726.0 +2017-06-28,52.75,54.44,52.65,54.39,7894816.0,0.0,1.0,52.75,54.44,52.65,54.39,7894816.0 +2017-06-27,53.6,53.79,52.64,52.73,7680978.0,0.0,1.0,53.6,53.79,52.64,52.73,7680978.0 +2017-06-26,54.44,55.1,53.65,53.74,4728731.0,0.0,1.0,54.44,55.1,53.65,53.74,4728731.0 +2017-06-23,53.82,54.53,53.69,54.34,5954697.0,0.0,1.0,53.82,54.53,53.69,54.34,5954697.0 +2017-06-22,53.71,53.951,52.86,53.87,9631525.0,0.0,1.0,53.71,53.951,52.86,53.87,9631525.0 +2017-06-21,52.99,53.58,52.61,53.54,7992648.0,0.0,1.0,52.99,53.58,52.61,53.54,7992648.0 +2017-06-20,52.84,53.23,52.43,52.52,4522851.0,0.0,1.0,52.84,53.23,52.43,52.52,4522851.0 +2017-06-19,52.28,53.0,52.1101,52.93,5276661.0,0.0,1.0,52.28,53.0,52.1101,52.93,5276661.0 +2017-06-16,52.04,52.16,51.58,51.84,10792581.0,0.0,1.0,52.04,52.16,51.58,51.84,10792581.0 +2017-06-15,51.44,52.38,50.83,52.29,9945649.0,0.0,1.0,51.44,52.38,50.83,52.29,9945649.0 +2017-06-14,52.0,52.505,51.535,51.9,7114891.0,0.0,1.0,52.0,52.505,51.535,51.9,7114891.0 +2017-06-13,52.29,52.485,51.7,52.04,10119801.0,0.0,1.0,52.29,52.485,51.7,52.04,10119801.0 +2017-06-12,52.81,52.9,51.43,52.16,15724406.0,0.0,1.0,52.81,52.9,51.43,52.16,15724406.0 +2017-06-09,54.65,55.14,52.85,53.4,10524856.0,0.0,1.0,54.65,55.14,52.85,53.4,10524856.0 +2017-06-08,54.03,54.43,53.45,54.39,6251592.0,0.0,1.0,54.03,54.43,53.45,54.39,6251592.0 +2017-06-07,53.3,53.94,53.26,53.85,6282623.0,0.0,1.0,53.3,53.94,53.26,53.85,6282623.0 +2017-06-06,53.75,53.8,53.16,53.4,6212080.0,0.0,1.0,53.75,53.8,53.16,53.4,6212080.0 +2017-06-05,53.77,54.07,53.59,53.8,9119908.0,0.0,1.0,53.77,54.07,53.59,53.8,9119908.0 +2017-06-02,53.44,53.64,53.08,53.52,9019731.0,0.0,1.0,53.44,53.64,53.08,53.52,9019731.0 +2017-06-01,52.48,53.39,52.475,53.16,13878328.0,0.0,1.0,52.48,53.39,52.475,53.16,13878328.0 diff --git a/examples/demos/stocqt/content/data/QCOM.csv b/examples/demos/stocqt/content/data/QCOM.csv new file mode 100644 index 000000000..0067fe307 --- /dev/null +++ b/examples/demos/stocqt/content/data/QCOM.csv @@ -0,0 +1,147 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,64.36,64.65,64.0,64.02,4553732.0,0.0,1.0,64.36,64.65,64.0,64.02,4553732.0 +2017-12-28,64.69,64.73,64.35,64.38,2371094.0,0.0,1.0,64.69,64.73,64.35,64.38,2371094.0 +2017-12-27,64.32,64.64,64.18,64.54,4821727.0,0.0,1.0,64.32,64.64,64.18,64.54,4821727.0 +2017-12-26,64.49,64.94,64.2,64.3,4185772.0,0.0,1.0,64.49,64.94,64.2,64.3,4185772.0 +2017-12-22,64.31,64.98,64.3,64.73,4386678.0,0.0,1.0,64.31,64.98,64.3,64.73,4386678.0 +2017-12-21,64.75,64.9604,64.34,64.39,5349137.0,0.0,1.0,64.75,64.9604,64.34,64.39,5349137.0 +2017-12-20,64.56,65.17,64.33,64.6,6919901.0,0.0,1.0,64.56,65.17,64.33,64.6,6919901.0 +2017-12-19,65.11,65.48,64.43,64.5,6906151.0,0.0,1.0,65.11,65.48,64.43,64.5,6906151.0 +2017-12-18,64.93,65.46,64.8,65.38,7092422.0,0.0,1.0,64.93,65.46,64.8,65.38,7092422.0 +2017-12-15,65.33,65.42,64.5,64.76,14158271.0,0.0,1.0,65.33,65.42,64.5,64.76,14158271.0 +2017-12-14,64.86,65.17,64.545,64.7,7012732.0,0.0,1.0,64.86,65.17,64.545,64.7,7012732.0 +2017-12-13,64.98,65.425,64.83,64.9,6431073.0,0.0,1.0,64.98,65.425,64.83,64.9,6431073.0 +2017-12-12,64.88,65.11,64.55,64.86,5559918.0,0.0,1.0,64.88,65.11,64.55,64.86,5559918.0 +2017-12-11,64.06,65.2631,64.0,65.18,11846177.0,0.0,1.0,64.06,65.2631,64.0,65.18,11846177.0 +2017-12-08,65.6,65.6,63.88,64.24,9170240.0,0.0,1.0,65.6,65.6,63.88,64.24,9170240.0 +2017-12-07,65.21,65.55,64.77,65.23,6068240.0,0.0,1.0,65.21,65.55,64.77,65.23,6068240.0 +2017-12-06,64.64,65.68,64.36,64.98,6907606.0,0.0,1.0,64.64,65.68,64.36,64.98,6907606.0 +2017-12-05,64.85,65.03,64.4,64.69,9492637.0,0.0,1.0,64.85,65.03,64.4,64.69,9492637.0 +2017-12-04,65.6,65.7,63.8,64.56,17057274.0,0.0,1.0,65.6,65.7,63.8,64.56,17057274.0 +2017-12-01,65.2,66.12,64.6,65.49,15286995.0,0.0,1.0,65.2,66.12,64.6,65.49,15286995.0 +2017-11-30,66.51,67.1,65.72,66.34,14675004.0,0.0,1.0,66.51,67.1,65.72,66.34,14675004.0 +2017-11-29,68.1,68.2,66.03,66.52,16841361.0,0.0,1.0,68.1,68.2,66.03,66.52,16841361.0 +2017-11-28,67.59,68.41,67.22,68.38,12641308.0,0.57,1.0,67.59,68.41,67.22,68.38,12641308.0 +2017-11-27,68.6,68.92,68.04,68.14,20112979.0,0.0,1.0,68.032893401015,68.350248005801,67.47752284264,67.576696156635,20112979.0 +2017-11-24,68.51,69.28,68.45,68.91,9233010.0,0.0,1.0,67.943637418419,68.707271936186,67.884133430022,68.340330674402,9233010.0 +2017-11-22,66.37,68.26,66.24,68.13,15165652.0,0.0,1.0,65.821328498912,67.69570413343,65.692403190718,67.566778825236,15165652.0 +2017-11-21,65.35,66.93,65.27,66.67,11062010.0,0.0,1.0,64.809760696157,66.376699057288,64.73042204496,66.118848440899,11062010.0 +2017-11-20,66.18,66.85,65.95,66.47,9677801.0,0.0,1.0,65.632899202321,66.297360406091,65.404800580131,65.920501812908,9677801.0 +2017-11-17,66.37,66.95,66.0,66.72,12134512.0,0.0,1.0,65.821328498912,66.396533720087,65.454387237128,66.168435097897,12134512.0 +2017-11-16,65.77,66.54,65.43,66.11,12142331.0,0.0,1.0,65.226288614938,65.989923132705,64.889099347353,65.563477882524,12142331.0 +2017-11-15,65.55,66.4838,65.24,65.61,10531408.0,0.0,1.0,65.008107324148,65.934187730239,64.700670050761,65.067611312545,10531408.0 +2017-11-14,66.16,66.8,65.55,66.0,13970519.0,0.0,1.0,65.613064539521,66.247773749094,65.008107324148,65.454387237128,13970519.0 +2017-11-13,64.96,66.82,64.75,66.49,24327595.0,0.0,1.0,64.422984771574,66.267608411893,64.214720812183,65.940336475707,24327595.0 +2017-11-10,64.36,65.1,63.92,64.57,9597929.0,0.0,1.0,63.8279448876,64.561827411168,63.391582306019,64.036208846991,9597929.0 +2017-11-09,64.91,65.33,63.93,64.6,15600914.0,0.0,1.0,64.373398114576,64.789926033358,63.401499637418,64.065960841189,15600914.0 +2017-11-07,62.52,64.16,62.45,64.1,23249338.0,0.0,1.0,62.00315591008,63.629598259608,61.933734590283,63.570094271211,23249338.0 +2017-11-06,64.54,65.33,62.15,62.52,58620899.0,0.0,1.0,64.006456852792,64.789926033358,61.636214648296,62.00315591008,58620899.0 +2017-11-03,54.76,64.99,54.21,61.81,78515925.0,0.0,1.0,54.307306744017,64.452736765772,53.761853517041,61.299025380711,78515925.0 +2017-11-02,53.6,55.68,53.6,54.84,17115009.0,0.0,1.0,53.156896301668,55.219701232777,53.156896301668,54.386645395214,17115009.0 +2017-11-01,51.47,53.49,50.51,53.46,14923803.0,0.0,1.0,51.044504713561,53.047805656273,50.092440899202,53.018053662074,14923803.0 +2017-10-31,52.26,52.49,50.02,51.01,28432806.0,0.0,1.0,51.827973894126,52.056072516316,49.606491660624,50.588307469181,28432806.0 +2017-10-30,54.16,54.77,54.08,54.66,6986348.0,0.0,1.0,53.712266860044,54.317224075417,53.632928208847,54.208133430022,6986348.0 +2017-10-27,53.7,54.7,53.36,54.57,8637328.0,0.0,1.0,53.256069615664,54.24780275562,52.918880348078,54.118877447426,8637328.0 +2017-10-26,54.1,54.39,53.665,53.8,5227877.0,0.0,1.0,53.652762871646,53.940365482234,53.221358955765,53.355242929659,5227877.0 +2017-10-25,53.98,54.43,53.475,53.84,7352176.0,0.0,1.0,53.533754894851,53.980034807832,53.032929659173,53.394912255257,7352176.0 +2017-10-24,53.44,54.44,53.4,54.25,10450810.0,0.0,1.0,52.998218999275,53.989952139231,52.958549673677,53.80152284264,10450810.0 +2017-10-23,52.3,53.78,52.13,53.39,9698032.0,0.0,1.0,51.867643219724,53.33540826686,51.699048585932,52.948632342277,9698032.0 +2017-10-20,52.51,52.59,51.94,52.02,8405771.0,0.0,1.0,52.075907179115,52.155245830312,51.51061928934,51.589957940537,8405771.0 +2017-10-19,52.03,52.4,52.01,52.29,6657536.0,0.0,1.0,51.599875271936,51.96681653372,51.580040609137,51.857725888325,6657536.0 +2017-10-18,52.54,52.67,52.02,52.21,5928735.0,0.0,1.0,52.105659173314,52.234584481508,51.589957940537,51.778387237128,5928735.0 +2017-10-17,52.32,52.44,51.8501,52.41,7456659.0,0.0,1.0,51.887477882524,52.006485859318,51.421462480058,51.97673386512,7456659.0 +2017-10-16,52.98,53.0,52.3101,52.38,5749880.0,0.0,1.0,52.542021754895,52.561856417694,51.877659724438,51.946981870921,5749880.0 +2017-10-13,53.38,53.38,52.74,52.82,6293816.0,0.0,1.0,52.938715010877,52.938715010877,52.304005801305,52.383344452502,6293816.0 +2017-10-12,53.88,54.175,52.96,53.0,7000530.0,0.0,1.0,53.434581580856,53.727142857143,52.522187092096,52.561856417694,7000530.0 +2017-10-11,53.79,54.38,53.66,54.12,8679167.0,0.0,1.0,53.34532559826,53.930448150834,53.216400290065,53.672597534445,8679167.0 +2017-10-10,52.95,53.9,52.9,53.87,8701455.0,0.0,1.0,52.512269760696,53.454416243655,52.462683103698,53.424664249456,8701455.0 +2017-10-09,52.68,52.9799,52.38,52.88,5803730.0,0.0,1.0,52.244501812908,52.541922581581,51.946981870921,52.442848440899,5803730.0 +2017-10-06,52.16,52.63,52.16,52.49,4780961.0,0.0,1.0,51.728800580131,52.19491515591,51.728800580131,52.056072516316,4780961.0 +2017-10-05,52.17,52.43,51.96,52.35,5144244.0,0.0,1.0,51.73871791153,51.996568527919,51.530453952139,51.917229876722,5144244.0 +2017-10-04,51.93,52.12,51.67,51.96,4521452.0,0.0,1.0,51.500701957941,51.689131254532,51.242851341552,51.530453952139,4521452.0 +2017-10-03,51.99,52.22,51.65,52.02,4176210.0,0.0,1.0,51.560205946338,51.788304568528,51.223016678753,51.589957940537,4176210.0 +2017-10-02,52.09,52.16,51.7,51.88,4363679.0,0.0,1.0,51.659379260334,51.728800580131,51.272603335751,51.451115300943,4363679.0 +2017-09-29,51.91,52.0447,51.62,51.84,5159612.0,0.0,1.0,51.480867295141,51.614453749094,51.193264684554,51.411445975344,5159612.0 +2017-09-28,51.38,52.04,51.31,51.75,5671994.0,0.0,1.0,50.955248730964,51.609792603336,50.885827411168,51.322189992748,5671994.0 +2017-09-27,51.43,51.61,51.1526,51.55,8122353.0,0.0,1.0,51.004835387962,51.183347353154,50.729728614938,51.123843364757,8122353.0 +2017-09-26,51.75,51.87,50.85,51.13,9148913.0,0.0,1.0,51.322189992748,51.441197969543,50.429630166788,50.707315445975,9148913.0 +2017-09-25,51.9,52.285,51.61,51.63,7931316.0,0.0,1.0,51.470949963742,51.852767222625,51.183347353154,51.203182015954,7931316.0 +2017-09-22,51.82,52.23,51.78,52.09,4077699.0,0.0,1.0,51.391611312545,51.798221899927,51.351941986947,51.659379260334,4077699.0 +2017-09-21,51.86,52.2,51.71,52.03,5192113.0,0.0,1.0,51.431280638144,51.768469905729,51.28252066715,51.599875271936,5192113.0 +2017-09-20,52.43,52.52,51.48,51.98,8273935.0,0.0,1.0,51.996568527919,52.085824510515,51.05442204496,51.550288614938,8273935.0 +2017-09-19,52.4,52.5,52.06,52.3,4897549.0,0.0,1.0,51.96681653372,52.065989847716,51.629627266135,51.867643219724,4897549.0 +2017-09-18,52.24,52.37,51.955,52.25,5951635.0,0.0,1.0,51.808139231327,51.937064539521,51.525495286439,51.818056562727,5951635.0 +2017-09-15,51.95,52.29,51.44,52.19,12717688.0,0.0,1.0,51.52053662074,51.857725888325,51.014752719362,51.758552574329,12717688.0 +2017-09-14,50.97,51.59,50.67,51.48,7677860.0,0.0,1.0,50.548638143582,51.163512690355,50.251118201595,51.05442204496,7677860.0 +2017-09-13,50.8,51.1054,50.72,51.01,6147412.0,0.0,1.0,50.38004350979,50.682918810732,50.300704858593,50.588307469181,6147412.0 +2017-09-12,50.6,51.07,50.52,50.9,4444021.0,0.0,1.0,50.181696881798,50.647811457578,50.102358230602,50.479216823785,4444021.0 +2017-09-11,49.94,50.67,49.91,50.57,7137370.0,0.0,1.0,49.527153009427,50.251118201595,49.497401015228,50.1519448876,7137370.0 +2017-09-08,50.35,50.45,48.92,49.64,12445202.0,0.0,1.0,49.933763596809,50.032936910805,48.515585206672,49.22963306744,12445202.0 +2017-09-07,50.56,50.69,50.25,50.38,8214389.0,0.0,1.0,50.1420275562,50.270952864394,49.834590282814,49.963515591008,8214389.0 +2017-09-06,50.19,50.77,49.83,50.45,16009190.0,0.0,1.0,49.775086294416,50.350291515591,49.418062364032,50.032936910805,16009190.0 +2017-09-05,51.86,51.9,49.83,50.03,17850640.0,0.0,1.0,51.431280638144,51.470949963742,49.418062364032,49.616408992023,17850640.0 +2017-09-01,52.53,52.77,51.925,52.05,5250026.0,0.0,1.0,52.095741841914,52.333757795504,51.495743292241,51.619709934735,5250026.0 +2017-08-31,52.26,52.59,52.12,52.27,7907278.0,0.0,1.0,51.827973894126,52.155245830312,51.689131254532,51.837891225526,7907278.0 +2017-08-30,51.75,52.286,51.56,52.12,4806103.0,0.0,1.0,51.322189992748,51.853758955765,51.133760696157,51.689131254532,4806103.0 +2017-08-29,51.31,51.86,51.28,51.81,4896218.0,0.0,1.0,50.885827411168,51.431280638144,50.856075416969,51.381693981146,4896218.0 +2017-08-28,51.77,51.81,51.46,51.81,4441742.0,0.57,1.0,51.342024655548,51.381693981146,51.034587382161,51.381693981146,4441742.0 +2017-08-25,52.78,52.8545,52.02,52.03,8502179.0,0.0,1.0,51.774070414755,51.847150525515,51.028555190897,51.038364601738,8502179.0 +2017-08-24,52.37,52.71,52.26,52.49,5972821.0,0.0,1.0,51.371884570306,51.705404538873,51.263981051063,51.489597500388,5972821.0 +2017-08-23,52.3,52.405,51.78,52.23,5046782.0,0.0,1.0,51.303218694424,51.406217508246,50.793129330732,51.234552818542,5046782.0 +2017-08-22,52.21,52.62,52.21,52.35,4350136.0,0.0,1.0,51.214933996862,51.617119841311,51.214933996862,51.352265748625,4350136.0 +2017-08-21,52.0,52.08,51.5,51.98,5185851.0,0.0,1.0,51.008936369217,51.087411655939,50.518465827205,50.989317547536,5185851.0 +2017-08-18,52.26,52.415,51.9,51.92,6642109.0,0.0,1.0,51.263981051063,51.416026919087,50.910842260815,50.930461082495,6642109.0 +2017-08-17,53.19,53.41,52.27,52.27,6087867.0,0.0,1.0,52.176256259205,52.39206329769,51.273790461903,51.273790461903,6087867.0 +2017-08-16,54.06,54.1,53.255,53.31,7034292.0,0.0,1.0,53.029675002305,53.068912645666,52.240017429666,52.293969189288,7034292.0 +2017-08-15,53.66,54.08,53.35,53.87,7562385.0,0.0,1.0,52.637298568696,53.049293823986,52.333206832648,52.843296196341,7562385.0 +2017-08-14,53.04,53.64,52.91,53.55,7558235.0,0.0,1.0,52.029115096601,52.617679747015,51.901592755678,52.529395049453,7558235.0 +2017-08-11,52.39,53.13,52.29,52.72,5835863.0,0.0,1.0,51.391503391986,52.117399794163,51.293409283584,51.715213949714,5835863.0 +2017-08-10,52.54,52.75,52.11,52.34,9578948.0,0.0,1.0,51.53864455459,51.744642182234,51.116839888459,51.342456337785,9578948.0 +2017-08-09,52.05,52.8,52.0,52.77,7039352.0,0.0,1.0,51.057983423418,51.793689236436,51.008936369217,51.764261003915,7039352.0 +2017-08-08,52.55,53.33,52.21,52.29,8779415.0,0.0,1.0,51.54845396543,52.313588010968,51.214933996862,51.293409283584,8779415.0 +2017-08-04,53.0,53.0,52.51,52.62,8645879.0,0.0,1.0,51.98987745324,51.98987745324,51.509216322069,51.617119841311,8645879.0 +2017-08-03,53.16,53.3399,52.75,52.95,8481098.0,0.0,1.0,52.146828026684,52.3232993277,51.744642182234,51.940830399039,8481098.0 +2017-08-02,53.295,53.3885,52.78,53.17,19324507.0,0.0,1.0,52.279255073027,52.370973064383,51.774070414755,52.156637437524,19324507.0 +2017-08-01,53.3,53.43,52.91,53.41,7480549.0,0.0,1.0,52.284159778447,52.41168211937,51.901592755678,52.39206329769,7480549.0 +2017-07-31,53.1,53.295,52.75,53.19,10641489.0,0.0,1.0,52.087971561643,52.279255073027,51.744642182234,52.176256259205,10641489.0 +2017-07-28,52.27,52.9865,52.27,52.88,6534345.0,0.0,1.0,51.273790461903,51.976634748606,51.273790461903,51.872164523157,6534345.0 +2017-07-27,53.08,53.37,52.23,52.49,13964311.0,0.0,1.0,52.068352739962,52.352825654329,51.234552818542,51.489597500388,13964311.0 +2017-07-26,53.29,53.35,52.74,53.14,7492633.0,0.0,1.0,52.274350367607,52.333206832648,51.734832771394,52.127209205004,7492633.0 +2017-07-25,53.2,53.65,53.07,53.27,7060158.0,0.0,1.0,52.186065670045,52.627489157855,52.058543329122,52.254731545927,7060158.0 +2017-07-24,53.75,53.88,53.09,53.22,8739769.0,0.0,1.0,52.725583266258,52.853105607181,52.078162150802,52.205684491725,8739769.0 +2017-07-21,53.66,54.0,53.37,53.84,11963407.0,0.0,1.0,52.637298568696,52.970818537264,52.352825654329,52.81386796382,11963407.0 +2017-07-20,55.11,55.43,53.46,53.97,35647961.0,0.0,1.0,54.05966314053,54.373564287417,52.441110351891,52.941390304743,35647961.0 +2017-07-19,56.46,56.9399,56.01,56.78,7437353.0,0.0,1.0,55.383933603961,55.854687230184,54.942510116151,55.697834750849,7437353.0 +2017-07-18,56.34,56.38,56.0,56.29,7329551.0,0.0,1.0,55.266220673878,55.305458317239,54.93270070531,55.217173619677,7329551.0 +2017-07-17,56.73,56.92,56.39,56.45,5067322.0,0.0,1.0,55.648787696648,55.835166502612,55.31526772808,55.374124193121,5067322.0 +2017-07-14,56.5,56.93,56.15,56.81,4365609.0,0.0,1.0,55.423171247322,55.844975913452,55.079841867914,55.727262983369,4365609.0 +2017-07-13,56.38,56.52,56.17,56.23,5884064.0,0.0,1.0,55.305458317239,55.442790069003,55.099460689594,55.158317154636,5884064.0 +2017-07-12,55.79,56.31,55.72,56.2,6082481.0,0.0,1.0,54.726703077666,55.236792441358,54.658037201784,55.128888922115,6082481.0 +2017-07-11,55.63,55.63,55.02,55.33,6009448.0,0.0,1.0,54.569752504222,54.569752504222,53.971378442968,54.275470179015,6009448.0 +2017-07-10,55.37,55.885,55.19,55.64,4973557.0,0.0,1.0,54.314707822376,54.819892480648,54.138138427252,54.579561915062,4973557.0 +2017-07-07,55.04,55.73,54.87,55.35,5156330.0,0.0,1.0,53.990997264648,54.667846612624,53.824237280364,54.295089000695,5156330.0 +2017-07-06,55.02,55.23,54.735,54.79,5557013.0,0.0,1.0,53.971378442968,54.177376070612,53.691810234021,53.745761993642,5557013.0 +2017-07-05,55.01,55.56,54.78,55.45,6624023.0,0.0,1.0,53.961569032127,54.50108662834,53.735952582802,54.393183109098,6624023.0 +2017-07-03,55.53,56.02,54.92,54.95,4379566.0,0.0,1.0,54.471658395819,54.952319526991,53.873284334565,53.902712567086,4379566.0 +2017-06-30,55.6,55.63,55.03,55.22,8596198.0,0.0,1.0,54.540324271701,54.569752504222,53.981187853808,54.167566659772,8596198.0 +2017-06-29,55.93,55.93,54.55,55.08,8333137.0,0.0,1.0,54.864034829429,54.864034829429,53.510336133477,54.030234908009,8333137.0 +2017-06-28,55.4,56.32,55.18,56.16,7231216.0,0.0,1.0,54.344136054896,55.246601852198,54.128329016411,55.089651278754,7231216.0 +2017-06-27,56.29,56.33,55.41,55.43,6734074.0,0.0,1.0,55.217173619677,55.256411263038,54.353945465737,54.373564287417,6734074.0 +2017-06-26,57.09,57.6892,56.21,56.56,7255489.0,0.0,1.0,56.001926486896,56.589706384443,55.138698332955,55.482027712364,7255489.0 +2017-06-23,56.64,57.4365,56.57,56.91,8660612.0,0.0,1.0,55.560502999085,56.34182257251,55.491837123204,55.825357091772,8660612.0 +2017-06-22,56.24,56.745,56.06,56.47,5512097.0,0.0,1.0,55.168126565476,55.663501812908,54.991557170352,55.393743014801,5512097.0 +2017-06-21,56.79,56.84,56.12,56.33,8189893.0,0.0,1.0,55.707644161689,55.75669121589,55.050413635393,55.256411263038,8189893.0 +2017-06-20,57.46,57.61,56.51,56.79,8087133.0,0.0,1.0,56.364874687985,56.512015850588,55.432980658162,55.707644161689,8087133.0 +2017-06-19,56.96,57.66,56.91,57.61,6909034.0,0.0,1.0,55.874404145973,56.561062904789,55.825357091772,56.512015850588,6909034.0 +2017-06-16,56.98,57.01,56.35,56.82,13536039.0,0.0,1.0,55.894022967653,55.923451200174,55.276030084719,55.73707239421,13536039.0 +2017-06-15,56.42,57.17,56.4,56.93,5371464.0,0.0,1.0,55.3446959606,56.080401773618,55.32507713892,55.844975913452,5371464.0 +2017-06-14,57.7,57.97,56.67,57.01,6702810.0,0.0,1.0,56.60030054815,56.865154640837,55.589931231606,55.923451200174,6702810.0 +2017-06-13,57.95,58.065,57.5,57.54,6971106.0,0.0,1.0,56.845535819156,56.958344043819,56.404112331346,56.443349974707,6971106.0 +2017-06-12,56.52,57.675,56.48,57.49,9871291.0,0.0,1.0,55.442790069003,56.57577702105,55.403552425642,56.394302920505,9871291.0 +2017-06-09,58.37,58.49,56.74,57.05,13572264.0,0.0,1.0,57.257531074446,57.375244004529,55.658597107488,55.962688843535,13572264.0 +2017-06-08,57.77,58.15,57.61,58.12,10134415.0,0.0,1.0,56.668966424032,57.041724035961,56.512015850588,57.01229580344,10134415.0 +2017-06-07,58.3,58.49,57.13,57.53,9967746.0,0.0,1.0,57.188865198564,57.375244004529,56.041164130257,56.433540563866,9967746.0 +2017-06-06,58.6,58.91,58.18,58.2,7808482.0,0.0,1.0,57.483147523771,57.787239259819,57.071152268481,57.090771090162,7808482.0 +2017-06-05,58.5,59.05,58.48,58.85,7655063.0,0.0,1.0,57.385053415369,57.924571011582,57.365434593689,57.728382794777,7655063.0 +2017-06-02,58.89,58.96,58.35,58.58,9461824.0,0.0,1.0,57.767620438138,57.83628631402,57.237912252765,57.463528702091,9461824.0 +2017-06-01,57.45,58.65,57.35,58.62,11116224.0,0.0,1.0,56.355065277144,57.532194577972,56.256971168742,57.502766345452,11116224.0 diff --git a/examples/demos/stocqt/content/data/TSLA.csv b/examples/demos/stocqt/content/data/TSLA.csv new file mode 100644 index 000000000..c1343441d --- /dev/null +++ b/examples/demos/stocqt/content/data/TSLA.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,316.18,316.41,310.0,311.35,3727621.0,0.0,1.0,316.18,316.41,310.0,311.35,3727621.0 +2017-12-28,311.75,315.82,309.54,315.36,4294689.0,0.0,1.0,311.75,315.82,309.54,315.36,4294689.0 +2017-12-27,316.0,317.68,310.75,311.64,4645441.0,0.0,1.0,316.0,317.68,310.75,311.64,4645441.0 +2017-12-26,323.83,323.94,316.58,317.29,4321909.0,0.0,1.0,323.83,323.94,316.58,317.29,4321909.0 +2017-12-22,329.51,330.9214,324.82,325.2,4186131.0,0.0,1.0,329.51,330.9214,324.82,325.2,4186131.0 +2017-12-21,329.59,333.74,327.21,331.66,4344701.0,0.0,1.0,329.59,333.74,327.21,331.66,4344701.0 +2017-12-20,332.69,333.1,325.04,328.98,5937684.0,0.0,1.0,332.69,333.1,325.04,328.98,5937684.0 +2017-12-19,340.26,341.4925,330.3,331.1,6792009.0,0.0,1.0,340.26,341.4925,330.3,331.1,6792009.0 +2017-12-18,344.9,346.73,337.58,338.87,5441450.0,0.0,1.0,344.9,346.73,337.58,338.87,5441450.0 +2017-12-15,342.04,343.9,335.76,343.45,6832071.0,0.0,1.0,342.04,343.9,335.76,343.45,6832071.0 +2017-12-14,341.01,347.44,336.9,337.89,5744750.0,0.0,1.0,341.01,347.44,336.9,337.89,5744750.0 +2017-12-13,340.93,344.22,336.5,339.03,6189204.0,0.0,1.0,340.93,344.22,336.5,339.03,6189204.0 +2017-12-12,330.45,341.44,330.03,341.03,8648534.0,0.0,1.0,330.45,341.44,330.03,341.03,8648534.0 +2017-12-11,314.63,329.01,313.75,328.91,7867288.0,0.0,1.0,314.63,329.01,313.75,328.91,7867288.0 +2017-12-08,314.6,316.98,311.26,315.13,3442898.0,0.0,1.0,314.6,316.98,311.26,315.13,3442898.0 +2017-12-07,312.0,318.6341,311.05,311.24,4705140.0,0.0,1.0,312.0,318.6341,311.05,311.24,4705140.0 +2017-12-06,300.1,313.39,300.0,313.26,7160938.0,0.0,1.0,300.1,313.39,300.0,313.26,7160938.0 +2017-12-05,302.0,308.0,301.0,303.7,4628462.0,0.0,1.0,302.0,308.0,301.0,303.7,4628462.0 +2017-12-04,306.5,308.265,300.61,305.2,5811205.0,0.0,1.0,306.5,308.265,300.61,305.2,5811205.0 +2017-12-01,305.44,310.32,305.05,306.53,4256030.0,0.0,1.0,305.44,310.32,305.05,306.53,4256030.0 +2017-11-30,308.56,310.7,304.54,308.85,4288221.0,0.0,1.0,308.56,310.7,304.54,308.85,4288221.0 +2017-11-29,317.3,318.0,301.23,307.54,8732941.0,0.0,1.0,317.3,318.0,301.23,307.54,8732941.0 +2017-11-28,316.36,320.0,313.92,317.55,4916555.0,0.0,1.0,316.36,320.0,313.92,317.55,4916555.0 +2017-11-27,313.25,317.34,309.51,316.81,4524921.0,0.0,1.0,313.25,317.34,309.51,316.81,4524921.0 +2017-11-24,313.79,316.41,311.0,315.55,3242220.0,0.0,1.0,313.79,316.41,311.0,315.55,3242220.0 +2017-11-22,316.77,317.42,311.84,312.6,4890091.0,0.0,1.0,316.77,317.42,311.84,312.6,4890091.0 +2017-11-21,310.86,318.23,308.71,317.81,7230570.0,0.0,1.0,310.86,318.23,308.71,317.81,7230570.0 +2017-11-20,313.79,315.5,304.75,308.74,8220759.0,0.0,1.0,313.79,315.5,304.75,308.74,8220759.0 +2017-11-17,325.67,326.67,313.15,315.05,13682753.0,0.0,1.0,325.67,326.67,313.15,315.05,13682753.0 +2017-11-16,313.99,318.14,311.3,312.5,5757709.0,0.0,1.0,313.99,318.14,311.3,312.5,5757709.0 +2017-11-15,306.01,312.49,301.5,311.3,5909055.0,0.0,1.0,306.01,312.49,301.5,311.3,5909055.0 +2017-11-14,315.0,316.35,306.9,308.7,5641615.0,0.0,1.0,315.0,316.35,306.9,308.7,5641615.0 +2017-11-13,300.13,316.8,299.11,315.4,7536669.0,0.0,1.0,300.13,316.8,299.11,315.4,7536669.0 +2017-11-10,302.5,308.36,301.85,302.99,4600097.0,0.0,1.0,302.5,308.36,301.85,302.99,4600097.0 +2017-11-09,302.5,304.46,296.3,302.99,5419497.0,0.0,1.0,302.5,304.46,296.3,302.99,5419497.0 +2017-11-07,301.02,306.5,300.03,306.05,5209573.0,0.0,1.0,301.02,306.5,300.03,306.05,5209573.0 +2017-11-06,307.0,307.5,299.01,302.78,6463227.0,0.0,1.0,307.0,307.5,299.01,302.78,6463227.0 +2017-11-03,299.5,306.25,295.13,306.09,8835157.0,0.0,1.0,299.5,306.25,295.13,306.09,8835157.0 +2017-11-02,300.13,308.69,292.63,299.26,19731322.0,0.0,1.0,300.13,308.69,292.63,299.26,19731322.0 +2017-11-01,332.25,332.6089,320.26,321.08,7028856.0,0.0,1.0,332.25,332.6089,320.26,321.08,7028856.0 +2017-10-31,320.23,331.95,320.18,331.53,5532647.0,0.0,1.0,320.23,331.95,320.18,331.53,5532647.0 +2017-10-30,319.18,323.78,317.25,320.08,4236029.0,0.0,1.0,319.18,323.78,317.25,320.08,4236029.0 +2017-10-27,319.75,324.59,316.66,320.87,6942493.0,0.0,1.0,319.75,324.59,316.66,320.87,6942493.0 +2017-10-26,327.78,330.23,323.2,326.17,4980316.0,0.0,1.0,327.78,330.23,323.2,326.17,4980316.0 +2017-10-25,336.7,337.5,323.56,325.84,8547764.0,0.0,1.0,336.7,337.5,323.56,325.84,8547764.0 +2017-10-24,338.8,342.8,336.16,337.34,4463807.0,0.0,1.0,338.8,342.8,336.16,337.34,4463807.0 +2017-10-23,349.88,349.95,336.25,337.02,5715817.0,0.0,1.0,349.88,349.95,336.25,337.02,5715817.0 +2017-10-20,352.69,354.55,344.34,345.1,4888221.0,0.0,1.0,352.69,354.55,344.34,345.1,4888221.0 +2017-10-19,355.56,357.1465,348.2,351.81,5032884.0,0.0,1.0,355.56,357.1465,348.2,351.81,5032884.0 +2017-10-18,355.97,363.0,354.13,359.65,4898808.0,0.0,1.0,355.97,363.0,354.13,359.65,4898808.0 +2017-10-17,350.91,356.22,350.07,355.75,3280670.0,0.0,1.0,350.91,356.22,350.07,355.75,3280670.0 +2017-10-16,353.76,354.48,347.16,350.6,5353262.0,0.0,1.0,353.76,354.48,347.16,350.6,5353262.0 +2017-10-13,356.98,358.49,353.68,355.57,3528413.0,0.0,1.0,356.98,358.49,353.68,355.57,3528413.0 +2017-10-12,352.95,359.78,352.64,355.68,4047318.0,0.0,1.0,352.95,359.78,352.64,355.68,4047318.0 +2017-10-11,353.89,357.6,351.15,354.6,4476769.0,0.0,1.0,353.89,357.6,351.15,354.6,4476769.0 +2017-10-10,346.8,355.63,345.5305,355.59,6914972.0,0.0,1.0,346.8,355.63,345.5305,355.59,6914972.0 +2017-10-09,349.65,351.75,342.67,342.94,7406324.0,0.0,1.0,349.65,351.75,342.67,342.94,7406324.0 +2017-10-06,353.1,360.0992,352.25,356.88,4171789.0,0.0,1.0,353.1,360.0992,352.25,356.88,4171789.0 +2017-10-05,356.0,357.435,351.35,355.33,4102286.0,0.0,1.0,356.0,357.435,351.35,355.33,4102286.0 +2017-10-04,351.25,358.62,349.6,355.01,8120353.0,0.0,1.0,351.25,358.62,349.6,355.01,8120353.0 +2017-10-03,335.9,348.55,331.28,348.14,9981885.0,0.0,1.0,335.9,348.55,331.28,348.14,9981885.0 +2017-10-02,342.52,343.7,335.51,341.53,4901453.0,0.0,1.0,342.52,343.7,335.51,341.53,4901453.0 +2017-09-29,341.86,344.68,338.601,341.1,5062297.0,0.0,1.0,341.86,344.68,338.601,341.1,5062297.0 +2017-09-28,339.88,342.75,335.4,339.6,5279310.0,0.0,1.0,339.88,342.75,335.4,339.6,5279310.0 +2017-09-27,349.9,351.489,340.5,340.97,6010631.0,0.0,1.0,349.9,351.489,340.5,340.97,6010631.0 +2017-09-26,350.93,351.24,340.9,345.25,7126550.0,0.0,1.0,350.93,351.24,340.9,345.25,7126550.0 +2017-09-25,353.15,357.469,342.88,344.99,7542161.0,0.0,1.0,353.15,357.469,342.88,344.99,7542161.0 +2017-09-22,366.49,369.8999,350.88,351.09,8105653.0,0.0,1.0,366.49,369.8999,350.88,351.09,8105653.0 +2017-09-21,374.9,376.83,364.51,366.48,4605428.0,0.0,1.0,374.9,376.83,364.51,366.48,4605428.0 +2017-09-20,373.0,378.249,371.07,373.91,4892872.0,0.0,1.0,373.0,378.249,371.07,373.91,4892872.0 +2017-09-19,380.0,382.39,373.57,375.1,6256035.0,0.0,1.0,380.0,382.39,373.57,375.1,6256035.0 +2017-09-18,380.25,389.61,377.68,385.0,7149295.0,0.0,1.0,380.25,389.61,377.68,385.0,7149295.0 +2017-09-15,374.51,380.0,372.7,379.81,5338678.0,0.0,1.0,374.51,380.0,372.7,379.81,5338678.0 +2017-09-14,364.33,377.96,362.63,377.64,7141663.0,0.0,1.0,364.33,377.96,362.63,377.64,7141663.0 +2017-09-13,363.82,368.07,359.59,366.23,4161382.0,0.0,1.0,363.82,368.07,359.59,366.23,4161382.0 +2017-09-12,364.49,368.76,360.4,362.75,5929289.0,0.0,1.0,364.49,368.76,360.4,362.75,5929289.0 +2017-09-11,351.35,363.71,350.0,363.69,7610309.0,0.0,1.0,351.35,363.71,350.0,363.69,7610309.0 +2017-09-08,348.99,349.78,342.3,343.4,3248803.0,0.0,1.0,348.99,349.78,342.3,343.4,3248803.0 +2017-09-07,345.98,352.48,343.45,350.61,4219997.0,0.0,1.0,345.98,352.48,343.45,350.61,4219997.0 +2017-09-06,349.5,350.979,341.56,344.53,4058983.0,0.0,1.0,349.5,350.979,341.56,344.53,4058983.0 +2017-09-05,353.8,355.49,345.89,349.59,3813862.0,0.0,1.0,353.8,355.49,345.89,349.59,3813862.0 +2017-09-01,356.12,357.59,353.6902,355.4,3028578.0,0.0,1.0,356.12,357.59,353.6902,355.4,3028578.0 +2017-08-31,353.55,358.44,352.82,355.9,4019065.0,0.0,1.0,353.55,358.44,352.82,355.9,4019065.0 +2017-08-30,349.67,353.47,347.0,353.18,3390055.0,0.0,1.0,349.67,353.47,347.0,353.18,3390055.0 +2017-08-29,339.48,349.05,338.75,347.36,4032825.0,0.0,1.0,339.48,349.05,338.75,347.36,4032825.0 +2017-08-28,347.28,347.35,339.72,345.66,3718108.0,0.0,1.0,347.28,347.35,339.72,345.66,3718108.0 +2017-08-25,354.24,355.69,347.3,348.05,3461744.0,0.0,1.0,354.24,355.69,347.3,348.05,3461744.0 +2017-08-24,352.52,356.66,349.74,352.93,4540652.0,0.0,1.0,352.52,356.66,349.74,352.93,4540652.0 +2017-08-23,338.99,353.49,338.3041,352.77,4914201.0,0.0,1.0,338.99,353.49,338.3041,352.77,4914201.0 +2017-08-22,341.13,342.24,337.3725,341.35,4288367.0,0.0,1.0,341.13,342.24,337.3725,341.35,4288367.0 +2017-08-21,345.82,345.82,331.85,337.86,6458812.0,0.0,1.0,345.82,345.82,331.85,337.86,6458812.0 +2017-08-18,352.91,354.0,345.8,347.46,5335793.0,0.0,1.0,352.91,354.0,345.8,347.46,5335793.0 +2017-08-17,361.21,363.3,351.59,351.92,4969222.0,0.0,1.0,361.21,363.3,351.59,351.92,4969222.0 +2017-08-16,363.0,366.5,362.52,362.91,3328576.0,0.0,1.0,363.0,366.5,362.52,362.91,3328576.0 +2017-08-15,365.2,365.49,359.37,362.33,3048074.0,0.0,1.0,365.2,365.49,359.37,362.33,3048074.0 +2017-08-14,364.63,367.66,362.6,363.8,4461215.0,0.0,1.0,364.63,367.66,362.6,363.8,4461215.0 +2017-08-11,356.97,361.26,353.62,357.715,4318835.0,0.0,1.0,356.97,361.26,353.62,357.715,4318835.0 +2017-08-10,361.6,366.6504,354.66,355.13,7035192.0,0.0,1.0,361.6,366.6504,354.66,355.13,7035192.0 +2017-08-09,361.0,370.0,358.95,363.525,6847245.0,0.0,1.0,361.0,370.0,358.95,363.525,6847245.0 +2017-08-08,357.53,368.58,357.4,365.22,7363033.0,0.0,1.0,357.53,368.58,357.4,365.22,7363033.0 +2017-08-07,357.35,359.48,352.75,355.17,6265570.0,0.0,1.0,357.35,359.48,352.75,355.17,6265570.0 +2017-08-04,347.0,357.27,343.3,356.91,9151520.0,0.0,1.0,347.0,357.27,343.3,356.91,9151520.0 +2017-08-03,345.33,350.0,343.15,347.09,13448583.0,0.0,1.0,345.33,350.0,343.15,347.09,13448583.0 +2017-08-02,318.94,327.12,311.22,325.89,9911432.0,0.0,1.0,318.94,327.12,311.22,325.89,9911432.0 +2017-08-01,323.0,324.45,316.13,319.57,8247544.0,0.0,1.0,323.0,324.45,316.13,319.57,8247544.0 +2017-07-31,335.5,341.49,321.04,323.47,8499335.0,0.0,1.0,335.5,341.49,321.04,323.47,8499335.0 +2017-07-28,336.89,339.6,332.51,335.07,4841257.0,0.0,1.0,336.89,339.6,332.51,335.07,4841257.0 +2017-07-27,346.0,347.5,326.29,334.46,8259202.0,0.0,1.0,346.0,347.5,326.29,334.46,8259202.0 +2017-07-26,340.36,345.5,338.12,343.85,4750198.0,0.0,1.0,340.36,345.5,338.12,343.85,4750198.0 +2017-07-25,345.0,345.6,334.15,339.6,6958889.0,0.0,1.0,345.0,345.6,334.15,339.6,6958889.0 +2017-07-24,330.24,343.399,330.01,342.52,8552012.0,0.0,1.0,330.24,343.399,330.01,342.52,8552012.0 +2017-07-21,329.46,331.2575,325.8,328.4,4826383.0,0.0,1.0,329.46,331.2575,325.8,328.4,4826383.0 +2017-07-20,326.9,330.22,324.2,329.92,5098707.0,0.0,1.0,326.9,330.22,324.2,329.92,5098707.0 +2017-07-19,328.23,331.65,323.2193,325.26,6300735.0,0.0,1.0,328.23,331.65,323.2193,325.26,6300735.0 +2017-07-18,317.5,329.13,315.66,328.24,6326961.0,0.0,1.0,317.5,329.13,315.66,328.24,6326961.0 +2017-07-17,325.54,327.1,313.45,319.57,9784200.0,0.0,1.0,325.54,327.1,313.45,319.57,9784200.0 +2017-07-14,323.19,328.42,321.22,327.78,5590393.0,0.0,1.0,323.19,328.42,321.22,327.78,5590393.0 +2017-07-13,330.11,331.6,319.97,323.41,8540442.0,0.0,1.0,330.11,331.6,319.97,323.41,8540442.0 +2017-07-12,330.4,333.1,324.5,329.52,10297839.0,0.0,1.0,330.4,333.1,324.5,329.52,10297839.0 +2017-07-11,316.0,327.28,314.3,327.22,11400054.0,0.0,1.0,316.0,327.28,314.3,327.22,11400054.0 +2017-07-10,312.9,317.94,303.13,316.05,13702080.0,0.0,1.0,312.9,317.94,303.13,316.05,13702080.0 +2017-07-07,313.5,317.0,307.38,313.22,14053750.0,0.0,1.0,313.5,317.0,307.38,313.22,14053750.0 +2017-07-06,317.26,320.7899,306.3,308.89,19189195.0,0.0,1.0,317.26,320.7899,306.3,308.89,19189195.0 +2017-07-05,347.2,347.24,326.33,327.09,16883496.0,0.0,1.0,347.2,347.24,326.33,327.09,16883496.0 +2017-07-03,370.24,371.35,351.5,352.62,6297330.0,0.0,1.0,370.24,371.35,351.5,352.62,6297330.0 +2017-06-30,363.71,366.7674,359.6187,361.61,5759458.0,0.0,1.0,363.71,366.7674,359.6187,361.61,5759458.0 +2017-06-29,370.61,371.0,354.1,360.75,8180408.0,0.0,1.0,370.61,371.0,354.1,360.75,8180408.0 +2017-06-28,366.68,371.74,362.52,371.24,6245040.0,0.0,1.0,366.68,371.74,362.52,371.24,6245040.0 +2017-06-27,376.4,376.4,362.02,362.37,6884529.0,0.0,1.0,376.4,376.4,362.02,362.37,6884529.0 +2017-06-26,386.69,386.95,373.1,377.49,6575285.0,0.0,1.0,386.69,386.95,373.1,377.49,6575285.0 +2017-06-23,382.45,386.99,379.345,383.45,6176578.0,0.0,1.0,382.45,386.99,379.345,383.45,6176578.0 +2017-06-22,377.99,385.0,373.57,382.61,7485677.0,0.0,1.0,377.99,385.0,373.57,382.61,7485677.0 +2017-06-21,374.35,376.99,368.02,376.4,4900356.0,0.0,1.0,374.35,376.99,368.02,376.4,4900356.0 +2017-06-20,376.67,378.88,369.73,372.24,7396357.0,0.0,1.0,376.67,378.88,369.73,372.24,7396357.0 +2017-06-19,375.0,376.7,367.8,369.8,6392331.0,0.0,1.0,375.0,376.7,367.8,369.8,6392331.0 +2017-06-16,377.975,378.01,370.1,371.4,6259666.0,0.0,1.0,377.975,378.01,370.1,371.4,6259666.0 +2017-06-15,372.5,375.46,366.49,375.34,10371559.0,0.0,1.0,372.5,375.46,366.49,375.34,10371559.0 +2017-06-14,381.085,384.25,376.31,380.66,12731997.0,0.0,1.0,381.085,384.25,376.31,380.66,12731997.0 +2017-06-13,367.62,376.0,366.61,375.95,11693404.0,0.0,1.0,367.62,376.0,366.61,375.95,11693404.0 +2017-06-12,357.99,364.5,350.62,359.01,10476833.0,0.0,1.0,357.99,364.5,350.62,359.01,10476833.0 +2017-06-09,374.42,376.87,354.8,357.32,17160231.0,0.0,1.0,374.42,376.87,354.8,357.32,17160231.0 +2017-06-08,363.75,371.9,360.22,370.0,8975028.0,0.0,1.0,363.75,371.9,360.22,370.0,8975028.0 +2017-06-07,356.34,360.5,355.14,359.65,9287888.0,0.0,1.0,356.34,360.5,355.14,359.65,9287888.0 +2017-06-06,344.7,359.4929,339.97,352.85,10951473.0,0.0,1.0,344.7,359.4929,339.97,352.85,10951473.0 +2017-06-05,338.5,348.44,334.21,347.32,6737855.0,0.0,1.0,338.5,348.44,334.21,347.32,6737855.0 +2017-06-02,339.77,342.88,335.93,339.85,5570256.0,0.0,1.0,339.77,342.88,335.93,339.85,5570256.0 +2017-06-01,344.0,344.88,337.29,340.37,7580447.0,0.0,1.0,344.0,344.88,337.29,340.37,7580447.0 diff --git a/examples/demos/stocqt/content/data/TXN.csv b/examples/demos/stocqt/content/data/TXN.csv new file mode 100644 index 000000000..d42c304e8 --- /dev/null +++ b/examples/demos/stocqt/content/data/TXN.csv @@ -0,0 +1,148 @@ +Date,Open,High,Low,Close,Volume,Ex-Dividend,Split Ratio,Adj. Open,Adj. High,Adj. Low,Adj. Close,Adj. Volume +2017-12-29,104.58,105.08,104.42,104.44,2767863.0,0.0,1.0,104.58,105.08,104.42,104.44,2767863.0 +2017-12-28,104.92,104.92,104.2194,104.82,1632350.0,0.0,1.0,104.92,104.92,104.2194,104.82,1632350.0 +2017-12-27,104.42,104.9,103.98,104.53,1699287.0,0.0,1.0,104.42,104.9,103.98,104.53,1699287.0 +2017-12-26,103.58,104.19,103.06,104.15,1468127.0,0.0,1.0,103.58,104.19,103.06,104.15,1468127.0 +2017-12-22,104.0,104.34,103.64,104.13,3022033.0,0.0,1.0,104.0,104.34,103.64,104.13,3022033.0 +2017-12-21,105.16,105.33,104.0055,104.07,4505720.0,0.0,1.0,105.16,105.33,104.0055,104.07,4505720.0 +2017-12-20,104.9,105.15,103.48,104.8,5433234.0,0.0,1.0,104.9,105.15,103.48,104.8,5433234.0 +2017-12-19,103.19,104.3,103.08,104.1,5133128.0,0.0,1.0,103.19,104.3,103.08,104.1,5133128.0 +2017-12-18,102.1,103.37,101.65,103.27,5494703.0,0.0,1.0,102.1,103.37,101.65,103.27,5494703.0 +2017-12-15,101.28,101.6,100.07,101.22,7773336.0,0.0,1.0,101.28,101.6,100.07,101.22,7773336.0 +2017-12-14,98.96,100.537,98.78,100.25,6802423.0,0.0,1.0,98.96,100.537,98.78,100.25,6802423.0 +2017-12-13,98.97,99.18,98.21,98.86,5151351.0,0.0,1.0,98.97,99.18,98.21,98.86,5151351.0 +2017-12-12,98.7,99.19,98.23,98.43,5766972.0,0.0,1.0,98.7,99.19,98.23,98.43,5766972.0 +2017-12-11,98.07,98.88,97.77,98.83,5137163.0,0.0,1.0,98.07,98.88,97.77,98.83,5137163.0 +2017-12-08,98.92,99.31,97.78,98.02,5282589.0,0.0,1.0,98.92,99.31,97.78,98.02,5282589.0 +2017-12-07,97.32,98.14,96.94,97.78,4195838.0,0.0,1.0,97.32,98.14,96.94,97.78,4195838.0 +2017-12-06,96.25,97.45,95.87,97.02,4438627.0,0.0,1.0,96.25,97.45,95.87,97.02,4438627.0 +2017-12-05,95.98,98.72,95.36,96.9,4759253.0,0.0,1.0,95.98,98.72,95.36,96.9,4759253.0 +2017-12-04,97.54,97.88,95.27,95.97,4891987.0,0.0,1.0,97.54,97.88,95.27,95.97,4891987.0 +2017-12-01,96.54,97.41,94.72,97.18,4925917.0,0.0,1.0,96.54,97.41,94.72,97.18,4925917.0 +2017-11-30,97.38,98.47,96.7,97.29,7195996.0,0.0,1.0,97.38,98.47,96.7,97.29,7195996.0 +2017-11-29,99.73,99.79,96.45,96.88,5408821.0,0.0,1.0,99.73,99.79,96.45,96.88,5408821.0 +2017-11-28,99.09,99.73,98.62,99.48,3010642.0,0.0,1.0,99.09,99.73,98.62,99.48,3010642.0 +2017-11-27,98.95,99.25,98.61,98.63,2900573.0,0.0,1.0,98.95,99.25,98.61,98.63,2900573.0 +2017-11-24,98.2,99.33,98.19,99.3,1288450.0,0.0,1.0,98.2,99.33,98.19,99.3,1288450.0 +2017-11-22,99.15,99.35,98.07,98.08,2109870.0,0.0,1.0,99.15,99.35,98.07,98.08,2109870.0 +2017-11-21,98.75,99.65,98.65,99.19,3668182.0,0.0,1.0,98.75,99.65,98.65,99.19,3668182.0 +2017-11-20,97.81,98.92,97.8,98.28,2912436.0,0.0,1.0,97.81,98.92,97.8,98.28,2912436.0 +2017-11-17,98.56,98.56,97.61,97.74,3694813.0,0.0,1.0,98.56,98.56,97.61,97.74,3694813.0 +2017-11-16,97.07,98.63,97.05,98.32,3531463.0,0.0,1.0,97.07,98.63,97.05,98.32,3531463.0 +2017-11-15,96.62,98.03,96.28,96.77,3332930.0,0.0,1.0,96.62,98.03,96.28,96.77,3332930.0 +2017-11-14,96.7,97.23,96.35,96.96,2727637.0,0.0,1.0,96.7,97.23,96.35,96.96,2727637.0 +2017-11-13,96.4,97.29,96.35,97.03,2158456.0,0.0,1.0,96.4,97.29,96.35,97.03,2158456.0 +2017-11-10,96.67,97.05,96.4,96.94,3093870.0,0.0,1.0,96.67,97.05,96.4,96.94,3093870.0 +2017-11-09,97.6,98.03,95.63,97.05,4180900.0,0.0,1.0,97.6,98.03,95.63,97.05,4180900.0 +2017-11-07,98.55,99.05,98.28,98.4,3883582.0,0.0,1.0,98.55,99.05,98.28,98.4,3883582.0 +2017-11-06,97.82,98.67,97.67,98.54,4261980.0,0.0,1.0,97.82,98.67,97.67,98.54,4261980.0 +2017-11-03,97.0,98.0,96.34,97.98,3329584.0,0.0,1.0,97.0,98.0,96.34,97.98,3329584.0 +2017-11-02,96.25,96.88,95.6,96.79,3274438.0,0.0,1.0,96.25,96.88,95.6,96.79,3274438.0 +2017-11-01,96.97,97.25,95.77,96.35,3826516.0,0.0,1.0,96.97,97.25,95.77,96.35,3826516.0 +2017-10-31,96.28,97.04,96.18,96.69,3747495.0,0.0,1.0,96.28,97.04,96.18,96.69,3747495.0 +2017-10-30,96.68,97.13,95.92,96.06,4914536.0,0.62,1.0,96.68,97.13,95.92,96.06,4914536.0 +2017-10-27,95.94,97.56,95.71,97.5,5534015.0,0.0,1.0,95.324745552338,96.934356640463,95.096220521307,96.874741414977,5534015.0 +2017-10-26,96.44,96.9399,95.84,96.17,5481993.0,0.0,1.0,95.821539098055,96.318233285064,95.225386843194,95.553270583368,5481993.0 +2017-10-25,95.0,96.7,94.16,95.82,6805958.0,0.0,1.0,94.390773686388,96.079871741829,93.556160529582,95.205515101365,6805958.0 +2017-10-24,96.3,96.62,95.46,96.44,7521218.0,0.0,1.0,95.682436905254,96.000384774514,94.847823748448,95.821539098055,7521218.0 +2017-10-23,96.0,96.7399,95.44,96.21,7248578.0,0.0,1.0,95.384360777824,96.119515866777,94.82795200662,95.593014067025,7248578.0 +2017-10-20,94.05,95.4,94.0,95.18,4775490.0,0.0,1.0,93.446865949524,94.788208522962,93.397186594952,94.569619362847,4775490.0 +2017-10-19,92.97,93.64,92.57,93.45,3890390.0,0.0,1.0,92.373791890774,93.039495242036,91.976357054199,92.850713694663,3890390.0 +2017-10-18,94.26,94.29,93.2,93.43,3528482.0,0.0,1.0,93.655519238726,93.685326851469,92.602316921804,92.830841952834,3528482.0 +2017-10-17,94.17,94.31,93.54,94.27,3136049.0,0.0,1.0,93.566096400496,93.705198593297,92.940136532892,93.66545510964,3136049.0 +2017-10-16,94.21,94.41,93.67,94.23,3109004.0,0.0,1.0,93.605839884154,93.804557302441,93.069302854779,93.625711625983,3109004.0 +2017-10-13,93.09,93.73,92.8,93.59,2666130.0,0.0,1.0,92.493022341746,93.128918080265,92.20488208523,92.989815887464,2666130.0 +2017-10-12,92.88,93.31,92.59,92.62,3415763.0,0.0,1.0,92.284369052544,92.711611501862,91.996228796028,92.026036408771,3415763.0 +2017-10-11,91.99,92.92,91.72,92.87,2996950.0,0.0,1.0,91.400076541167,92.324112536202,91.131808026479,92.27443318163,2996950.0 +2017-10-10,91.97,92.41,91.465,92.38,2805769.0,0.0,1.0,91.380204799338,91.81738311957,90.878443318163,91.787575506827,2805769.0 +2017-10-09,91.61,91.86,91.31,91.57,1636340.0,0.0,1.0,91.022513446421,91.27091021928,90.72443731899,90.982769962764,1636340.0 +2017-10-06,90.74,91.54,90.74,91.35,2300990.0,0.0,1.0,90.158092676872,90.952962350021,90.158092676872,90.764180802648,2300990.0 +2017-10-05,90.55,91.3,90.11,91.14,3105380.0,0.0,1.0,89.969311129499,90.714501448076,89.532132809268,90.555527513446,3105380.0 +2017-10-04,89.9,90.56,89.58,90.49,3781466.0,0.0,1.0,89.323479520066,89.979247000414,89.005531650807,89.909695904013,3781466.0 +2017-10-03,89.65,90.24,89.5,89.94,2330174.0,0.0,1.0,89.075082747207,89.661299131154,88.926044683492,89.363223003724,2330174.0 +2017-10-02,89.88,90.24,89.31,89.65,3134142.0,0.0,1.0,89.303607778237,89.661299131154,88.737263136119,89.075082747207,3134142.0 +2017-09-29,89.77,89.89,89.09,89.64,3144262.0,0.0,1.0,89.19431319818,89.313543649152,88.518673976003,89.065146876293,3144262.0 +2017-09-28,88.44,89.66,88.35,89.65,5054134.0,0.0,1.0,87.87284236657,89.085018618122,87.783419528341,89.075082747207,5054134.0 +2017-09-27,88.48,89.15,87.85,88.81,3611592.0,0.0,1.0,87.912585850228,88.578289201489,87.286625982623,88.240469590401,3611592.0 +2017-09-26,87.99,88.29,87.45,87.7,2961476.0,0.0,1.0,87.425728175424,87.723804302855,86.889191146049,87.137587918908,2961476.0 +2017-09-25,87.65,88.08,86.9188,87.5,5475113.0,0.0,1.0,87.087908564336,87.515151013653,86.361397683078,86.938870500621,5475113.0 +2017-09-22,86.59,88.45,86.5,88.27,6374309.0,0.0,1.0,86.034706247414,87.882778237484,85.945283409185,87.703932561026,6374309.0 +2017-09-21,86.02,86.59,85.67,86.05,3979462.0,0.0,1.0,85.468361605296,86.034706247414,85.120606123293,85.498169218039,3979462.0 +2017-09-20,87.0,87.0,84.48,85.83,4829104.0,0.0,1.0,86.442076954903,86.442076954903,83.938237484485,85.279580057923,4829104.0 +2017-09-19,86.37,87.24,85.64,86.81,3924755.0,0.0,1.0,85.816117087298,86.680537856847,85.09079851055,86.25329540753,3924755.0 +2017-09-18,85.0,86.47,84.89,86.14,5296505.0,0.0,1.0,84.454902772031,85.915475796442,84.345608191974,85.587592056268,5296505.0 +2017-09-15,83.14,85.03,82.87,84.84,9419782.0,0.0,1.0,82.606830781961,84.484710384775,82.338562267273,84.295928837402,9419782.0 +2017-09-14,82.4,83.67,82.4,83.29,3482781.0,0.0,1.0,81.871576334299,83.133431940422,81.871576334299,82.755868845676,3482781.0 +2017-09-13,82.84,82.94,82.28,82.7,2531515.0,0.0,1.0,82.30875465453,82.408113363674,81.752345883326,82.169652461729,2531515.0 +2017-09-12,82.34,82.95,82.155,82.89,4559914.0,0.0,1.0,81.811961108813,82.418049234588,81.628147496897,82.358434009102,4559914.0 +2017-09-11,81.9,82.73,81.81,82.22,3810169.0,0.0,1.0,81.374782788581,82.199460074472,81.285359950352,81.69273065784,3810169.0 +2017-09-08,81.98,82.035,81.25,81.38,2423569.0,0.0,1.0,81.454269755896,81.508917045925,80.728951179148,80.858117501034,2423569.0 +2017-09-07,82.45,83.99,81.79,82.0,3568251.0,0.0,1.0,81.921255688871,83.451379809681,81.265488208523,81.474141497724,3568251.0 +2017-09-06,82.24,82.37,81.59,82.07,3627993.0,0.0,1.0,81.712602399669,81.841768721556,81.066770790236,81.543692594125,3627993.0 +2017-09-05,82.32,82.49,81.27,81.85,3665925.0,0.0,1.0,81.792089366984,81.960999172528,80.748822920976,81.325103434009,3665925.0 +2017-09-01,82.74,83.1137,82.38,82.54,2644706.0,0.0,1.0,82.209395945387,82.580699441456,81.85170459247,82.0106785271,2644706.0 +2017-08-31,82.44,82.95,82.13,82.82,4301382.0,0.0,1.0,81.911319817956,82.418049234588,81.603307819611,82.288882912702,4301382.0 +2017-08-30,81.21,82.41,81.1,82.31,4353457.0,0.0,1.0,80.68920769549,81.881512205213,80.579913115432,81.78215349607,4353457.0 +2017-08-29,80.08,81.25,80.03,81.03,3677615.0,0.0,1.0,79.566454282168,80.728951179148,79.516774927596,80.510362019032,3677615.0 +2017-08-28,81.44,81.66,80.58,80.76,3042730.0,0.0,1.0,80.91773272652,81.136321886636,80.063247827886,80.242093504344,3042730.0 +2017-08-25,81.58,81.9,80.94,80.98,2560280.0,0.0,1.0,81.056834919321,81.374782788581,80.420939180803,80.46068266446,2560280.0 +2017-08-24,81.16,81.495,80.82,81.25,3312832.0,0.0,1.0,80.639528340918,80.972380016549,80.30170872983,80.728951179148,3312832.0 +2017-08-23,80.24,81.12,80.07,80.89,4039288.0,0.0,1.0,79.725428216798,80.599784857261,79.556518411254,80.371259826231,4039288.0 +2017-08-22,80.34,81.13,80.06,80.75,4302975.0,0.0,1.0,79.824786925941,80.609720728175,79.546582540339,80.23215763343,4302975.0 +2017-08-21,80.14,80.24,79.6,79.89,3167966.0,0.0,1.0,79.626069507654,79.725428216798,79.089532478279,79.377672734795,3167966.0 +2017-08-18,80.09,80.69,79.94,79.97,3605319.0,0.0,1.0,79.576390153082,80.172542407944,79.427352089367,79.45715970211,3605319.0 +2017-08-17,81.95,82.16,80.09,80.15,4036391.0,0.0,1.0,81.424462143153,81.633115432354,79.576390153082,79.636005378568,4036391.0 +2017-08-16,82.42,82.66,81.95,82.46,3171387.0,0.0,1.0,81.891448076127,82.129908978072,81.424462143153,81.931191559785,3171387.0 +2017-08-15,82.07,82.31,81.69,81.95,3597596.0,0.0,1.0,81.543692594125,81.78215349607,81.166129499379,81.424462143153,3597596.0 +2017-08-14,81.48,82.21,81.2031,82.05,3449064.0,0.0,1.0,80.957476210178,81.682794786926,80.682351944559,81.523820852296,3449064.0 +2017-08-11,80.58,81.34,80.43,80.89,3348656.0,0.0,1.0,80.063247827886,80.818374017377,79.91420976417,80.371259826231,3348656.0 +2017-08-10,81.8,82.0,80.28,80.36,4260051.0,0.0,1.0,81.275424079437,81.474141497724,79.765171700455,79.84465866777,4260051.0 +2017-08-09,81.97,82.31,81.38,82.28,4083335.0,0.0,1.0,81.444333884981,81.78215349607,80.858117501034,81.752345883326,4083335.0 +2017-08-08,81.99,83.69,81.89,82.45,6995231.0,0.0,1.0,81.46420562681,83.153303682251,81.364846917667,81.921255688871,6995231.0 +2017-08-07,81.44,82.2,81.44,82.17,2808616.0,0.0,1.0,80.91773272652,81.672858916012,80.91773272652,81.643051303269,2808616.0 +2017-08-04,81.63,81.96,81.25,81.43,2293905.0,0.0,1.0,81.106514273893,81.434398014067,80.728951179148,80.907796855606,2293905.0 +2017-08-03,81.3,81.73,80.965,81.36,2704547.0,0.0,1.0,80.778630533719,81.205872983037,80.445778858089,80.838245759206,2704547.0 +2017-08-02,82.01,82.01,80.64,81.31,3121636.0,0.0,1.0,81.484077368639,81.484077368639,80.122863053372,80.788566404634,3121636.0 +2017-08-01,81.6,81.84,81.02,81.71,3243303.0,0.0,1.0,81.07670666115,81.315167563095,80.500426148117,81.186001241208,3243303.0 +2017-07-31,80.83,81.66,80.78,81.38,5780471.0,0.0,1.0,80.311644600745,81.136321886636,80.261965246173,80.858117501034,5780471.0 +2017-07-28,80.42,81.04,80.05,80.71,5188380.0,0.0,1.0,79.904273893256,80.520297889946,79.536646669425,80.192414149772,5188380.0 +2017-07-27,82.125,82.53,80.09,80.97,6842762.0,0.5,1.0,81.598339884154,82.000742656185,79.576390153082,80.450746793546,6842762.0 +2017-07-26,83.0,84.24,81.96,82.55,6633813.0,0.0,1.0,81.9616053009,83.186091934311,80.934616511587,81.517235151678,6633813.0 +2017-07-25,81.05,81.93,80.58,81.39,6302456.0,0.0,1.0,80.036001320939,80.904991834972,79.571881387307,80.371747655906,6302456.0 +2017-07-24,81.86,81.8673,80.6,80.92,4333751.0,0.0,1.0,80.835867589538,80.843076260847,79.591631171717,79.907627722275,4333751.0 +2017-07-21,81.46,82.0,81.0,81.7,4396691.0,0.0,1.0,80.440871901341,80.974116080407,79.986626859914,80.677869314259,4396691.0 +2017-07-20,82.2,82.81,81.8621,82.69,3719865.0,0.0,1.0,81.171613924505,81.773982349006,80.837941316901,81.655483642547,3719865.0 +2017-07-19,82.49,82.7,81.86,82.16,3065398.0,0.0,1.0,81.457985798448,81.665358534752,80.835867589538,81.132114355686,3065398.0 +2017-07-18,81.5,82.205,81.15,82.16,2713549.0,0.0,1.0,80.480371470161,81.176551370608,80.134750242988,81.132114355686,2713549.0 +2017-07-17,81.82,82.0,81.48,81.66,2955424.0,0.0,1.0,80.796368020718,80.974116080407,80.460621685751,80.638369745439,2955424.0 +2017-07-14,80.95,82.11,80.8481,82.0,3597113.0,0.0,1.0,79.937252398889,81.082739894661,79.836627247321,80.974116080407,3597113.0 +2017-07-13,80.41,80.98,80.265,80.54,3323859.0,0.0,1.0,79.404008219823,79.966877075504,79.260822282852,79.532381818487,3323859.0 +2017-07-12,79.46,80.54,79.46,80.52,3839369.0,0.0,1.0,78.465893460355,79.532381818487,78.465893460355,79.512632034078,3839369.0 +2017-07-11,78.78,79.145,78.28,79.04,2673057.0,0.0,1.0,77.79440079042,78.1548343559,77.300656180174,78.051147987748,2673057.0 +2017-07-10,78.43,79.09,77.925,78.78,3266394.0,0.0,1.0,77.448779563248,78.100522448773,76.950097506899,77.79440079042,3266394.0 +2017-07-07,77.31,78.66,77.31,78.48,5215579.0,0.0,1.0,76.342791636296,77.675902083961,76.342791636296,77.498154024272,5215579.0 +2017-07-06,76.19,77.69,76.19,76.86,4998196.0,0.0,1.0,75.236803709344,76.718037540083,75.236803709344,75.898421487074,4998196.0 +2017-07-05,76.63,77.51,76.24,76.91,6552479.0,0.0,1.0,75.671298966361,76.540289480394,75.286178170369,75.947795948099,6552479.0 +2017-07-03,77.45,77.635,76.4,76.41,3493669.0,0.0,1.0,76.481040127165,76.663725632956,75.444176445647,75.454051337852,3493669.0 +2017-06-30,77.69,77.69,76.61,76.93,4618555.0,0.0,1.0,76.718037540083,76.718037540083,75.651549181951,75.967545732509,4618555.0 +2017-06-29,77.5,77.93,75.9199,76.9,6526856.0,0.0,1.0,76.530414588189,76.955034953001,74.970082870889,75.937921055894,6526856.0 +2017-06-28,77.61,78.21,76.95,78.06,6338112.0,0.0,1.0,76.639038402444,77.231531934739,75.987295516918,77.083408551665,6338112.0 +2017-06-27,78.0,78.27,76.94,76.95,5697074.0,0.0,1.0,77.024159198436,77.290781287969,75.977420624713,75.987295516918,5697074.0 +2017-06-26,80.04,80.09,78.24,78.31,4881033.0,0.0,1.0,79.038637208241,79.088011669266,77.261156611354,77.330280856789,4881033.0 +2017-06-23,79.06,80.02,78.64,79.58,3608764.0,0.0,1.0,78.070897772158,79.018887423831,77.656152299551,78.584392166814,3608764.0 +2017-06-22,79.95,80.05,78.95,79.05,3306610.0,0.0,1.0,78.949763178397,79.048512100446,77.962273957904,78.061022879953,3306610.0 +2017-06-21,79.7,79.92,79.23,79.67,4256147.0,0.0,1.0,78.702890873274,78.920138501782,78.238770939642,78.673266196659,4256147.0 +2017-06-20,81.16,81.23,79.54,79.57,3789428.0,0.0,1.0,80.144625135193,80.213749380627,78.544892597995,78.574517274609,3789428.0 +2017-06-19,80.37,81.45,80.28,81.42,3479332.0,0.0,1.0,79.364508651004,80.430997009136,79.275634621159,80.401372332521,3479332.0 +2017-06-16,79.85,80.23,79.02,79.7,5945383.0,0.0,1.0,78.851014256347,79.226260160135,78.031398203338,78.702890873274,5945383.0 +2017-06-15,79.35,80.4,79.22,80.08,3024056.0,0.0,1.0,78.357269646101,79.394133327618,78.228896047437,79.078136777061,3024056.0 +2017-06-14,81.26,81.49,79.44,80.16,3919507.0,0.0,1.0,80.243374057242,80.470496577956,78.446143675945,79.1571359147,3919507.0 +2017-06-13,81.41,81.8,80.6,80.98,4274125.0,0.0,1.0,80.391497440316,80.776618236308,79.591631171717,79.966877075504,4274125.0 +2017-06-12,79.82,81.32,79.6678,81.05,6724786.0,0.0,1.0,78.821389579733,80.302623410472,78.671093720374,80.036001320939,6724786.0 +2017-06-09,84.23,84.65,79.94,80.9,6785300.0,0.0,1.0,83.176217042106,83.590962514713,78.939888286192,79.887877937865,6785300.0 +2017-06-08,83.2,84.36,82.62,84.34,4332428.0,0.0,1.0,82.159103144998,83.30459064077,81.586359397112,83.28484085636,4332428.0 +2017-06-07,82.8,83.43,82.29,82.89,3705908.0,0.0,1.0,81.764107456801,82.386225665712,81.26048795435,81.852981486645,3705908.0 +2017-06-06,81.65,82.875,81.51,82.22,3222387.0,0.0,1.0,80.628494853234,81.838169148338,80.490246362365,81.191363708915,3222387.0 +2017-06-05,81.66,82.38,81.66,81.885,2467546.0,0.0,1.0,80.638369745439,81.349361984194,80.638369745439,80.86055482005,2467546.0 +2017-06-02,81.96,81.97,80.86,81.63,4714171.0,0.0,1.0,80.934616511587,80.944491403792,79.848378369045,80.608745068825,4714171.0 +2017-06-01,82.61,82.8642,81.215,81.49,4292961.0,0.0,1.0,81.576484504907,81.827504264757,80.19893704232,80.470496577956,4292961.0 diff --git a/examples/demos/stocqt/content/images/icon-left-arrow.png b/examples/demos/stocqt/content/images/icon-left-arrow.png Binary files differnew file mode 100644 index 000000000..926938cad --- /dev/null +++ b/examples/demos/stocqt/content/images/icon-left-arrow.png diff --git a/examples/demos/stocqt/content/images/wheel-touch.png b/examples/demos/stocqt/content/images/wheel-touch.png Binary files differnew file mode 100644 index 000000000..11c8120ad --- /dev/null +++ b/examples/demos/stocqt/content/images/wheel-touch.png diff --git a/examples/demos/stocqt/content/images/wheel.png b/examples/demos/stocqt/content/images/wheel.png Binary files differnew file mode 100644 index 000000000..470a675b3 --- /dev/null +++ b/examples/demos/stocqt/content/images/wheel.png diff --git a/examples/demos/stocqt/content/qmldir b/examples/demos/stocqt/content/qmldir new file mode 100644 index 000000000..77f5ed3c5 --- /dev/null +++ b/examples/demos/stocqt/content/qmldir @@ -0,0 +1,12 @@ +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/demos/stocqt/doc/images/qtquick-demo-stocqt.png b/examples/demos/stocqt/doc/images/qtquick-demo-stocqt.png Binary files differnew file mode 100644 index 000000000..38e279d60 --- /dev/null +++ b/examples/demos/stocqt/doc/images/qtquick-demo-stocqt.png diff --git a/examples/demos/stocqt/doc/src/stocqt.qdoc b/examples/demos/stocqt/doc/src/stocqt.qdoc new file mode 100644 index 000000000..e324cf63b --- /dev/null +++ b/examples/demos/stocqt/doc/src/stocqt.qdoc @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - StocQt + \ingroup qtquickdemos + \example demos/stocqt + \brief A configurable stock chart for the NASDAQ-100. + \borderedimage qtquick-demo-stocqt.png + + The \e{StocQt} application presents a trend chart for the first stock in + the list of NASDAQ-100 stocks. It allows the user to choose another stock + from the list, and fetches the required data from the offline dataset + using \c XMLHttpRequest. + + 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 weekly, + monthly, quarterly, or half yearly 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/demos/stocqt/main.cpp b/examples/demos/stocqt/main.cpp new file mode 100644 index 000000000..b91d7543c --- /dev/null +++ b/examples/demos/stocqt/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/stocqt/stocqt) diff --git a/examples/demos/stocqt/stocqt.pro b/examples/demos/stocqt/stocqt.pro new file mode 100644 index 000000000..1051ec3af --- /dev/null +++ b/examples/demos/stocqt/stocqt.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp +RESOURCES += stocqt.qrc +OTHER_FILES += *.qml content/*.qml content/images/*.png + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/stocqt +INSTALLS += target diff --git a/examples/demos/stocqt/stocqt.qml b/examples/demos/stocqt/stocqt.qml new file mode 100644 index 000000000..1657003e5 --- /dev/null +++ b/examples/demos/stocqt/stocqt.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 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/demos/stocqt/stocqt.qmlproject b/examples/demos/stocqt/stocqt.qmlproject new file mode 100644 index 000000000..11ab78418 --- /dev/null +++ b/examples/demos/stocqt/stocqt.qmlproject @@ -0,0 +1,16 @@ +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/demos/stocqt/stocqt.qrc b/examples/demos/stocqt/stocqt.qrc new file mode 100644 index 000000000..a1c3b2549 --- /dev/null +++ b/examples/demos/stocqt/stocqt.qrc @@ -0,0 +1,42 @@ +<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> + <file>content/data/AAPL.csv</file> + <file>content/data/ADSK.csv</file> + <file>content/data/AMZN.csv</file> + <file>content/data/AMD.csv</file> + <file>content/data/CSCO.csv</file> + <file>content/data/FB.csv</file> + <file>content/data/GOOG.csv</file> + <file>content/data/GOOGL.csv</file> + <file>content/data/MSFT.csv</file> + <file>content/data/NCLH.csv</file> + <file>content/data/NFLX.csv</file> + <file>content/data/TXN.csv</file> + <file>content/data/EA.csv</file> + <file>content/data/EBAY.csv</file> + <file>content/data/PYPL.csv</file> + <file>content/data/INTC.csv</file> + <file>content/data/NTAP.csv</file> + <file>content/data/QCOM.csv</file> + <file>content/data/NVDA.csv</file> + <file>content/data/TSLA.csv</file> + </qresource> +</RCC> diff --git a/examples/demos/tweetsearch/content/FlipBar.qml b/examples/demos/tweetsearch/content/FlipBar.qml new file mode 100644 index 000000000..608f5cc08 --- /dev/null +++ b/examples/demos/tweetsearch/content/FlipBar.qml @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 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/demos/tweetsearch/content/LineInput.qml b/examples/demos/tweetsearch/content/LineInput.qml new file mode 100644 index 000000000..1ef8fd9f5 --- /dev/null +++ b/examples/demos/tweetsearch/content/LineInput.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/tweetsearch/content/ListFooter.qml b/examples/demos/tweetsearch/content/ListFooter.qml new file mode 100644 index 000000000..b84496d4c --- /dev/null +++ b/examples/demos/tweetsearch/content/ListFooter.qml @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/tweetsearch/content/ListHeader.qml b/examples/demos/tweetsearch/content/ListHeader.qml new file mode 100644 index 000000000..8c4facf34 --- /dev/null +++ b/examples/demos/tweetsearch/content/ListHeader.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 { + 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/demos/tweetsearch/content/SearchDelegate.qml b/examples/demos/tweetsearch/content/SearchDelegate.qml new file mode 100644 index 000000000..082653657 --- /dev/null +++ b/examples/demos/tweetsearch/content/SearchDelegate.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 + +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/demos/tweetsearch/content/TweetDelegate.qml b/examples/demos/tweetsearch/content/TweetDelegate.qml new file mode 100644 index 000000000..dfcb3dc7f --- /dev/null +++ b/examples/demos/tweetsearch/content/TweetDelegate.qml @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "tweetsearch.mjs" 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/demos/tweetsearch/content/TweetsModel.qml b/examples/demos/tweetsearch/content/TweetsModel.qml new file mode 100644 index 000000000..f2de931a4 --- /dev/null +++ b/examples/demos/tweetsearch/content/TweetsModel.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "tweetsearch.mjs" 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 : "" + + 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.onload = function() { + 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); + } + } + wrapper.isLoaded() + } + 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/demos/tweetsearch/content/resources/anonymous.png b/examples/demos/tweetsearch/content/resources/anonymous.png Binary files differnew file mode 100644 index 000000000..88fba26e9 --- /dev/null +++ b/examples/demos/tweetsearch/content/resources/anonymous.png diff --git a/examples/demos/tweetsearch/content/resources/bird-anim-sprites.png b/examples/demos/tweetsearch/content/resources/bird-anim-sprites.png Binary files differnew file mode 100644 index 000000000..4e8d7e611 --- /dev/null +++ b/examples/demos/tweetsearch/content/resources/bird-anim-sprites.png diff --git a/examples/demos/tweetsearch/content/resources/icon-clear.png b/examples/demos/tweetsearch/content/resources/icon-clear.png Binary files differnew file mode 100644 index 000000000..75672f64c --- /dev/null +++ b/examples/demos/tweetsearch/content/resources/icon-clear.png diff --git a/examples/demos/tweetsearch/content/resources/icon-loading.png b/examples/demos/tweetsearch/content/resources/icon-loading.png Binary files differnew file mode 100644 index 000000000..8dbff8b70 --- /dev/null +++ b/examples/demos/tweetsearch/content/resources/icon-loading.png diff --git a/examples/demos/tweetsearch/content/resources/icon-refresh.png b/examples/demos/tweetsearch/content/resources/icon-refresh.png Binary files differnew file mode 100644 index 000000000..b639a638f --- /dev/null +++ b/examples/demos/tweetsearch/content/resources/icon-refresh.png diff --git a/examples/demos/tweetsearch/content/resources/icon-search.png b/examples/demos/tweetsearch/content/resources/icon-search.png Binary files differnew file mode 100644 index 000000000..e41935a6c --- /dev/null +++ b/examples/demos/tweetsearch/content/resources/icon-search.png diff --git a/examples/demos/tweetsearch/content/tweetsearch.mjs b/examples/demos/tweetsearch/content/tweetsearch.mjs new file mode 100644 index 000000000..3659a390f --- /dev/null +++ b/examples/demos/tweetsearch/content/tweetsearch.mjs @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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$ +** +****************************************************************************/ + +export function formatDate(date) +{ + var da = new Date(date) + return da.toDateString() +} + +export 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)) +} + +export 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/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png b/examples/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png Binary files differnew file mode 100644 index 000000000..930ee3992 --- /dev/null +++ b/examples/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png diff --git a/examples/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png b/examples/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png Binary files differnew file mode 100644 index 000000000..f6496e9e4 --- /dev/null +++ b/examples/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png diff --git a/examples/demos/tweetsearch/doc/src/tweetsearch.qdoc b/examples/demos/tweetsearch/doc/src/tweetsearch.qdoc new file mode 100644 index 000000000..4145ccfc1 --- /dev/null +++ b/examples/demos/tweetsearch/doc/src/tweetsearch.qdoc @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.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/demos/tweetsearch/main.cpp b/examples/demos/tweetsearch/main.cpp new file mode 100644 index 000000000..508d34e91 --- /dev/null +++ b/examples/demos/tweetsearch/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/tweetsearch/tweetsearch) diff --git a/examples/demos/tweetsearch/tweetsearch.pro b/examples/demos/tweetsearch/tweetsearch.pro new file mode 100644 index 000000000..3995a15f6 --- /dev/null +++ b/examples/demos/tweetsearch/tweetsearch.pro @@ -0,0 +1,32 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +content.prefix = /demos/tweetsearch +content.files = \ + tweetsearch.qml \ + content/FlipBar.qml \ + content/LineInput.qml \ + content/ListFooter.qml \ + content/ListHeader.qml \ + content/SearchDelegate.qml \ + content/TweetDelegate.qml \ + content/tweetsearch.mjs \ + content/TweetsModel.qml \ + content/resources/anonymous.png \ + content/resources/bird-anim-sprites.png \ + content/resources/icon-clear.png \ + content/resources/icon-loading.png \ + content/resources/icon-refresh.png \ + content/resources/icon-search.png + +RESOURCES += content + +OTHER_FILES = tweetsearch.qml \ + content/*.qml \ + content/*.mjs \ + content/resources/* + +target.path = $$[QT_INSTALL_EXAMPLES]/demos/tweetsearch +INSTALLS += target diff --git a/examples/demos/tweetsearch/tweetsearch.qml b/examples/demos/tweetsearch/tweetsearch.qml new file mode 100644 index 000000000..82a95c9f2 --- /dev/null +++ b/examples/demos/tweetsearch/tweetsearch.qml @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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$ +** 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 "content" +import "content/tweetsearch.mjs" as Helper + +Rectangle { + id: main + width: 320 + height: 480 + color: "#d6d6d6" + + property int inAnimDur: 250 + property int counter: 0 + 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/demos/tweetsearch/tweetsearch.qmlproject b/examples/demos/tweetsearch/tweetsearch.qmlproject new file mode 100644 index 000000000..5a0f31117 --- /dev/null +++ b/examples/demos/tweetsearch/tweetsearch.qmlproject @@ -0,0 +1,16 @@ +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/examples.pro b/examples/examples.pro new file mode 100644 index 000000000..e959b132d --- /dev/null +++ b/examples/examples.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS = demos + @@ -1,2 +1,3 @@ -TEMPLATE = subdirs -SUBDIRS = doc +load(qt_parts) + +SUBDIRS += doc diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro new file mode 100644 index 000000000..bc6a6dffb --- /dev/null +++ b/tests/auto/auto.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +qtHaveModule(quick) { + SUBDIRS += quick +} +qtHaveModule(qml) { + SUBDIRS += qml +} + diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro new file mode 100644 index 000000000..63775a12a --- /dev/null +++ b/tests/auto/qml/qml.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs +QT_FOR_CONFIG += qml-private + +qtConfig(qml-devtools): + SUBDIRS += qmlmin + +qtConfig(private_tests): \ + SUBDIRS += qqmlparser + diff --git a/tests/auto/qml/qmlmin/qmlmin.pro b/tests/auto/qml/qmlmin/qmlmin.pro new file mode 100644 index 000000000..18dba551d --- /dev/null +++ b/tests/auto/qml/qmlmin/qmlmin.pro @@ -0,0 +1,12 @@ +CONFIG += testcase +TARGET = tst_qmlmin +QT += qml testlib gui-private +macos:CONFIG -= app_bundle + +SOURCES += tst_qmlmin.cpp +DEFINES += SRCDIR=\\\"$$PWD\\\" + +# Boot2qt is cross compiled but it has sources available +!boot2qt { + cross_compile: DEFINES += QTEST_CROSS_COMPILED +} diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp new file mode 100644 index 000000000..fa13ea72b --- /dev/null +++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QLibraryInfo> +#include <QDir> +#if QT_CONFIG(process) +#include <QProcess> +#endif +#include <QDebug> +#include <QQmlError> +#include <cstdlib> + +class tst_qmlmin : public QObject +{ + Q_OBJECT +public: + tst_qmlmin(); + +private slots: + void initTestCase(); +#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled + void qmlMinify_data(); + void qmlMinify(); +#endif + +private: + QString qmlminPath; + QStringList excludedDirs; + QStringList invalidFiles; + + QStringList findFiles(const QDir &); + bool isInvalidFile(const QFileInfo &fileName) const; +}; + +tst_qmlmin::tst_qmlmin() +{ +} + +void tst_qmlmin::initTestCase() +{ + qmlminPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmlmin"); +#ifdef Q_OS_WIN + qmlminPath += QLatin1String(".exe"); +#endif + if (!QFileInfo(qmlminPath).exists()) { + QString message = QString::fromLatin1("qmlmin executable not found (looked for %0)") + .arg(qmlminPath); + QFAIL(qPrintable(message)); + } + + // Add directories you want excluded here + // excludedDirs << "exclude/this/dir"; + + // Add invalid files (i.e. files with syntax errors) + // invalidFiles << "exclude/this/file.txt"; +} + +QStringList tst_qmlmin::findFiles(const QDir &d) +{ + for (int ii = 0; ii < excludedDirs.count(); ++ii) { + QString s = excludedDirs.at(ii); + if (d.absolutePath().endsWith(s)) + return QStringList(); + } + + QStringList rv; + + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), + QDir::Files); + foreach (const QString &file, files) { + rv << d.absoluteFilePath(file); + } + + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + rv << findFiles(sub); + } + + return rv; +} + +bool tst_qmlmin::isInvalidFile(const QFileInfo &fileName) const +{ + foreach (const QString &invalidFile, invalidFiles) { + if (fileName.absoluteFilePath().endsWith(invalidFile)) + return true; + } + return false; +} + +/* +This test runs all the examples in the Qt QML UI source tree and ensures +that they start and exit cleanly. + +Examples are any .qml files under the examples/ directory that start +with a lower case letter. +*/ + +#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled +void tst_qmlmin::qmlMinify_data() +{ + QTest::addColumn<QString>("file"); + + QString examples = QLatin1String(SRCDIR) + "/../../../../examples/"; + QString tests = QLatin1String(SRCDIR) + "/../../../../tests/"; + + QStringList files; + files << findFiles(QDir(examples)); + files << findFiles(QDir(tests)); + + foreach (const QString &file, files) + QTest::newRow(qPrintable(file)) << file; +} +#endif + +#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled +void tst_qmlmin::qmlMinify() +{ + QFETCH(QString, file); + + QProcess qmlminify; + + // Restrict line width to 100 characters + qmlminify.start(qmlminPath, QStringList() << QLatin1String("--verify-only") << QLatin1String("-w100") << file); + qmlminify.waitForFinished(); + + QCOMPARE(qmlminify.error(), QProcess::UnknownError); + QCOMPARE(qmlminify.exitStatus(), QProcess::NormalExit); + + if (isInvalidFile(file)) + QCOMPARE(qmlminify.exitCode(), EXIT_FAILURE); // cannot minify files with syntax errors + else + QCOMPARE(qmlminify.exitCode(), 0); +} +#endif + +QTEST_MAIN(tst_qmlmin) + +#include "tst_qmlmin.moc" diff --git a/tests/auto/qml/qqmlparser/qqmlparser.pro b/tests/auto/qml/qqmlparser/qqmlparser.pro new file mode 100644 index 000000000..fa85b93c4 --- /dev/null +++ b/tests/auto/qml/qqmlparser/qqmlparser.pro @@ -0,0 +1,9 @@ +CONFIG += testcase +TARGET = tst_qqmlparser +QT += qml-private testlib +macos:CONFIG -= app_bundle + +SOURCES += tst_qqmlparser.cpp +DEFINES += SRCDIR=\\\"$$PWD\\\" + +cross_compile: DEFINES += QTEST_CROSS_COMPILED diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp new file mode 100644 index 000000000..e30481e3b --- /dev/null +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <private/qqmljsengine_p.h> +#include <private/qqmljsparser_p.h> +#include <private/qqmljslexer_p.h> +#include <private/qqmljsastvisitor_p.h> +#include <private/qqmljsast_p.h> + +#include <qtest.h> +#include <QDir> +#include <QDebug> +#include <cstdlib> + +class tst_qqmlparser : public QObject +{ + Q_OBJECT +public: + tst_qqmlparser(); + +private slots: + void initTestCase(); +#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled + void qmlParser_data(); + void qmlParser(); +#endif + void invalidEscapeSequence(); + void stringLiteral(); + void noSubstitutionTemplateLiteral(); + void templateLiteral(); + +private: + QStringList excludedDirs; + + QStringList findFiles(const QDir &); +}; + +namespace check { + +using namespace QQmlJS; + +class Check: public AST::Visitor +{ + QList<AST::Node *> nodeStack; + +public: + void operator()(AST::Node *node) + { + AST::Node::accept(node, this); + } + + void checkNode(AST::Node *node) + { + if (! nodeStack.isEmpty()) { + AST::Node *parent = nodeStack.last(); + const quint32 parentBegin = parent->firstSourceLocation().begin(); + const quint32 parentEnd = parent->lastSourceLocation().end(); + + if (node->firstSourceLocation().begin() < parentBegin) + qDebug() << "first source loc failed: node:" << node->kind << "at" << node->firstSourceLocation().startLine << "/" << node->firstSourceLocation().startColumn + << "parent" << parent->kind << "at" << parent->firstSourceLocation().startLine << "/" << parent->firstSourceLocation().startColumn; + if (node->lastSourceLocation().end() > parentEnd) + qDebug() << "first source loc failed: node:" << node->kind << "at" << node->lastSourceLocation().startLine << "/" << node->lastSourceLocation().startColumn + << "parent" << parent->kind << "at" << parent->lastSourceLocation().startLine << "/" << parent->lastSourceLocation().startColumn; + + QVERIFY(node->firstSourceLocation().begin() >= parentBegin); + QVERIFY(node->lastSourceLocation().end() <= parentEnd); + } + } + + virtual bool preVisit(AST::Node *node) + { + checkNode(node); + nodeStack.append(node); + return true; + } + + virtual void postVisit(AST::Node *) + { + nodeStack.removeLast(); + } +}; + +} + +tst_qqmlparser::tst_qqmlparser() +{ +} + +void tst_qqmlparser::initTestCase() +{ + // Add directories you want excluded here: + // excludedDirs << "exclude/this/dir"; +} + +QStringList tst_qqmlparser::findFiles(const QDir &d) +{ + for (int ii = 0; ii < excludedDirs.count(); ++ii) { + QString s = excludedDirs.at(ii); + if (d.absolutePath().endsWith(s)) + return QStringList(); + } + + QStringList rv; + + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), + QDir::Files); + foreach (const QString &file, files) { + rv << d.absoluteFilePath(file); + } + + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + rv << findFiles(sub); + } + + return rv; +} + +/* +This test checks all the qml and js files in the QtQml UI source tree +and ensures that the subnode's source locations are inside parent node's source locations +*/ + +#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled +void tst_qqmlparser::qmlParser_data() +{ + QTest::addColumn<QString>("file"); + + QString examples = QLatin1String(SRCDIR) + "/../../../../examples/"; + QString tests = QLatin1String(SRCDIR) + "/../../../../tests/"; + + QStringList files; + files << findFiles(QDir(examples)); + files << findFiles(QDir(tests)); + + foreach (const QString &file, files) + QTest::newRow(qPrintable(file)) << file; +} +#endif + +#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled +void tst_qqmlparser::qmlParser() +{ + QFETCH(QString, file); + + using namespace QQmlJS; + + QString code; + + QFile f(file); + if (f.open(QFile::ReadOnly)) + code = QString::fromUtf8(f.readAll()); + + const bool qmlMode = file.endsWith(QLatin1String(".qml")); + + Engine engine; + Lexer lexer(&engine); + lexer.setCode(code, 1, qmlMode); + Parser parser(&engine); + bool ok = qmlMode ? parser.parse() : parser.parseProgram(); + + if (ok) { + check::Check chk; + chk(parser.rootNode()); + } +} +#endif + +void tst_qqmlparser::invalidEscapeSequence() +{ + using namespace QQmlJS; + + Engine engine; + Lexer lexer(&engine); + lexer.setCode(QLatin1String("\"\\"), 1); + Parser parser(&engine); + parser.parse(); +} + +void tst_qqmlparser::stringLiteral() +{ + using namespace QQmlJS; + + Engine engine; + Lexer lexer(&engine); + QLatin1String code("'hello string'"); + lexer.setCode(code , 1); + Parser parser(&engine); + QVERIFY(parser.parseExpression()); + AST::ExpressionNode *expression = parser.expression(); + QVERIFY(expression); + auto *literal = QQmlJS::AST::cast<QQmlJS::AST::StringLiteral *>(expression); + QVERIFY(literal); + QCOMPARE(literal->value, "hello string"); + QCOMPARE(literal->firstSourceLocation().begin(), 0); + QCOMPARE(literal->lastSourceLocation().end(), code.size()); +} + +void tst_qqmlparser::noSubstitutionTemplateLiteral() +{ + using namespace QQmlJS; + + Engine engine; + Lexer lexer(&engine); + QLatin1String code("`hello template`"); + lexer.setCode(code, 1); + Parser parser(&engine); + QVERIFY(parser.parseExpression()); + AST::ExpressionNode *expression = parser.expression(); + QVERIFY(expression); + + auto *literal = QQmlJS::AST::cast<QQmlJS::AST::TemplateLiteral *>(expression); + QVERIFY(literal); + + QCOMPARE(literal->value, "hello template"); + QCOMPARE(literal->firstSourceLocation().begin(), 0); + QCOMPARE(literal->lastSourceLocation().end(), code.size()); +} + +void tst_qqmlparser::templateLiteral() +{ + using namespace QQmlJS; + + Engine engine; + Lexer lexer(&engine); + QLatin1String code("`one plus one equals ${1+1}!`"); + lexer.setCode(code, 1); + Parser parser(&engine); + QVERIFY(parser.parseExpression()); + AST::ExpressionNode *expression = parser.expression(); + QVERIFY(expression); + + auto *templateLiteral = QQmlJS::AST::cast<QQmlJS::AST::TemplateLiteral *>(expression); + QVERIFY(templateLiteral); + + QCOMPARE(templateLiteral->firstSourceLocation().begin(), 0); + auto *e = templateLiteral->expression; + QVERIFY(e); +} + +QTEST_MAIN(tst_qqmlparser) + +#include "tst_qqmlparser.moc" diff --git a/tests/auto/quick/examples/data/dummytest.qml b/tests/auto/quick/examples/data/dummytest.qml new file mode 100644 index 000000000..b20e907f2 --- /dev/null +++ b/tests/auto/quick/examples/data/dummytest.qml @@ -0,0 +1,6 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { msec: 0 } + Frame { msec: 10 } +} diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro new file mode 100644 index 000000000..4e7ed1908 --- /dev/null +++ b/tests/auto/quick/examples/examples.pro @@ -0,0 +1,12 @@ +CONFIG += testcase +testcase.timeout = 400 # this test is slow +TARGET = tst_examples +macos:CONFIG -= app_bundle + +SOURCES += tst_examples.cpp +DEFINES += SRCDIR=\\\"$$PWD\\\" + +#temporary +QT += core-private gui-private qml-private quick-private testlib +!qtHaveModule(xmlpatterns): DEFINES += QT_NO_XMLPATTERNS + diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp new file mode 100644 index 000000000..02dc70429 --- /dev/null +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -0,0 +1,281 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QLibraryInfo> +#include <QDir> +#include <QDebug> +#include <QtQuick/QQuickItem> +#include <QtQuick/QQuickView> +#include <QQmlComponent> +#include <QQmlEngine> +#include <QQmlError> + +static QtMessageHandler testlibMsgHandler = nullptr; +void msgHandlerFilter(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg) +{ + if (type == QtCriticalMsg || type == QtFatalMsg) + (*testlibMsgHandler)(type, ctxt, msg); +} + +class tst_examples : public QObject +{ + Q_OBJECT +public: + tst_examples(); + ~tst_examples(); + +private slots: + void init(); + void cleanup(); + + void sgexamples_data(); + void sgexamples(); + + void namingConvention(); +private: + QStringList excludedDirs; + QStringList excludedFiles; + + void namingConvention(const QDir &); + QStringList findQmlFiles(const QDir &); + + QQmlEngine engine; +}; + +tst_examples::tst_examples() +{ + // Add files to exclude here + excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem + excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item + + // Add directories you want excluded here + excludedDirs << "shared"; //Not an example + excludedDirs << "snippets/qml/path"; //No root QQuickItem + excludedDirs << "examples/qml/qmlextensionplugins"; //Requires special import search path + excludedDirs << "examples/quick/tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir + + // These snippets are not expected to run on their own. + excludedDirs << "snippets/qml/visualdatamodel_rootindex"; + excludedDirs << "snippets/qml/qtbinding"; + excludedDirs << "snippets/qml/imports"; + excludedFiles << "snippets/qml/image-ext.qml"; + excludedFiles << "examples/quick/shapes/content/main.qml"; // relies on resources + excludedFiles << "examples/quick/shapes/content/interactive.qml"; // relies on resources + +#ifdef QT_NO_XMLPATTERNS + excludedDirs << "demos/twitter"; + excludedDirs << "demos/flickr"; + excludedDirs << "demos/photoviewer"; + excludedFiles << "snippets/qml/xmlrole.qml"; + excludedFiles << "particles/itemparticle/particleview.qml"; + excludedFiles << "views/visualdatamodel/slideshow.qml"; +#endif + +#if !QT_CONFIG(opengl) + //No support for Particles + excludedFiles << "examples/qml/dynamicscene/dynamicscene.qml"; + excludedFiles << "examples/quick/animation/basics/color-animation.qml"; + excludedFiles << "examples/quick/particles/affectors/content/age.qml"; + excludedFiles << "examples/quick/touchinteraction/multipointtouch/bearwhack.qml"; + excludedFiles << "examples/quick/touchinteraction/multipointtouch/multiflame.qml"; + excludedDirs << "examples/quick/particles"; + // No Support for ShaderEffect + excludedFiles << "src/quick/doc/snippets/qml/animators.qml"; +#endif + +} + +tst_examples::~tst_examples() +{ +} + +void tst_examples::init() +{ + if (!qstrcmp(QTest::currentTestFunction(), "sgsnippets")) + testlibMsgHandler = qInstallMessageHandler(msgHandlerFilter); +} + +void tst_examples::cleanup() +{ + if (!qstrcmp(QTest::currentTestFunction(), "sgsnippets")) + qInstallMessageHandler(testlibMsgHandler); +} + +/* +This tests that the examples follow the naming convention required +to have them tested by the examples() test. +*/ +void tst_examples::namingConvention(const QDir &d) +{ + for (int ii = 0; ii < excludedDirs.count(); ++ii) { + QString s = excludedDirs.at(ii); + if (d.absolutePath().endsWith(s)) + return; + } + + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QDir::Files); + + bool seenQml = !files.isEmpty(); + bool seenLowercase = false; + + foreach (const QString &file, files) { + if (file.at(0).isLower()) + seenLowercase = true; + } + + if (!seenQml) { + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + namingConvention(sub); + } + } else if (!seenLowercase) { + // QTBUG-28271 don't fail, but rather warn only + qWarning() << QString( + "Directory %1 violates naming convention; expected at least one qml file " + "starting with lower case, got: %2" + ).arg(d.absolutePath()).arg(files.join(",")); + +// QFAIL(qPrintable(QString( +// "Directory %1 violates naming convention; expected at least one qml file " +// "starting with lower case, got: %2" +// ).arg(d.absolutePath()).arg(files.join(",")))); + } +} + +void tst_examples::namingConvention() +{ + QStringList examplesLocations; + examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qml"); + examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/quick"); + + foreach (const QString &examples, examplesLocations) { + QDir d(examples); + if (d.exists()) + namingConvention(d); + } +} + +QStringList tst_examples::findQmlFiles(const QDir &d) +{ + for (int ii = 0; ii < excludedDirs.count(); ++ii) { + QString s = excludedDirs.at(ii); + if (d.absolutePath().endsWith(s)) + return QStringList(); + } + + QStringList rv; + + QStringList cppfiles = d.entryList(QStringList() << QLatin1String("*.cpp"), QDir::Files); + if (cppfiles.isEmpty()) { + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QDir::Files); + foreach (const QString &file, files) { + if (file.at(0).isLower()) { + bool superContinue = false; + for (int ii = 0; ii < excludedFiles.count(); ++ii) { + QString e = excludedFiles.at(ii); + if (d.absoluteFilePath(file).endsWith(e)) { + superContinue = true; + break; + } + } + if (superContinue) + continue; + rv << d.absoluteFilePath(file); + } + } + } + + + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + rv << findQmlFiles(sub); + } + + return rv; +} + +/* +This test runs all the examples in the QtQml UI source tree and ensures +that they start and exit cleanly. + +Examples are any .qml files under the examples/ directory that start +with a lower case letter. +*/ +void tst_examples::sgexamples_data() +{ + QTest::addColumn<QString>("file"); + + QString examples = QLatin1String(SRCDIR) + "/../../../../examples/"; + + QStringList files; + files << findQmlFiles(QDir(examples)); + + foreach (const QString &file, files) + QTest::newRow(qPrintable(file)) << file; +} + +void tst_examples::sgexamples() +{ + QFETCH(QString, file); + QQuickWindow window; + window.setPersistentOpenGLContext(true); + window.setPersistentSceneGraph(true); + + QQmlComponent component(&engine, QUrl::fromLocalFile(file)); + if (component.status() == QQmlComponent::Error) + qWarning() << component.errors(); + QCOMPARE(component.status(), QQmlComponent::Ready); + + QScopedPointer<QObject> object(component.beginCreate(engine.rootContext())); + QQuickItem *root = qobject_cast<QQuickItem *>(object.data()); + if (!root) + component.completeCreate(); + QVERIFY(root); + + window.resize(240, 320); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + root->setParentItem(window.contentItem()); + component.completeCreate(); + + qApp->processEvents(); +} + +QTEST_MAIN(tst_examples) + +#include "tst_examples.moc" diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro new file mode 100644 index 000000000..b2542cf2f --- /dev/null +++ b/tests/auto/quick/quick.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs + +!cross_compile: PRIVATETESTS += examples + +qtConfig(private_tests) { + SUBDIRS += $$PRIVATETESTS +} diff --git a/tests/tests.pro b/tests/tests.pro new file mode 100644 index 000000000..85e4f3a53 --- /dev/null +++ b/tests/tests.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += auto |