diff options
Diffstat (limited to 'chicken-wranglers/src/qml/widgets')
17 files changed, 1816 insertions, 0 deletions
diff --git a/chicken-wranglers/src/qml/widgets/BaseDialog.qml b/chicken-wranglers/src/qml/widgets/BaseDialog.qml new file mode 100644 index 0000000..e1cea04 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/BaseDialog.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +import game.types 1.0 + +Item { + id: dialog + + property alias box: box + + signal showFinished + signal hideFinished + + anchors.fill: parent + + function show() { + dialog.opacity = 1 + } + + function hide() { + dialog.opacity = 0 + } + + onOpacityChanged: { + if (dialog.opacity == 1) + showFinished() + else if (dialog.opacity == 0) + hideFinished() + } + + Rectangle { + id: background + + anchors.fill: parent + color: "black" + opacity: 0.7 + + MouseArea { + anchors.fill: parent + } + } + + function backgroundSize() { + var res = {}; + res["height"] = 376 + res["width"] = 622 + + // XXX: if in symbian, make the dialog smaller + if (game.environment() == Global.Symbian) { + res.height = 0.9 * dialog.height + res.width = 0.9 * dialog.width + } + return res; + } + + Image { + id: box + + source: { + if (game.environment() == Global.Symbian) + "qrc:/images/general/symbian/bg_dialog.png" + else + "qrc:/images/general/bg_dialog.png" + } + anchors.centerIn: parent + } + + Behavior on opacity { + NumberAnimation { duration: 200 } + } +} diff --git a/chicken-wranglers/src/qml/widgets/Button.qml b/chicken-wranglers/src/qml/widgets/Button.qml new file mode 100644 index 0000000..6ccd512 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/Button.qml @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +BorderImage { + id: button + + property int leftBorder: 18 + property int rightBorder: 18 + property int horizontalCenterOffset: 0 + property string sourceName: "bt" + property string text: "" + property bool blink: false + property bool enabled: true + property bool italic: false + + signal clicked + + source: { + if (!enabled) + return "qrc:/images/general/" + sourceName + "_disabled.png" + + if (mouseArea.pressed) + return "qrc:/images/general/" + sourceName + "_pressed.png" + else + return "qrc:/images/general/" + sourceName + ".png" + } + + smooth: true + + border { + left: leftBorder + right: rightBorder + } + + width: buttonText.width + 40 + + PropertyAnimation { + id: blinkAnimation + + target: button + properties: "opacity" + loops: 2 + from: 0 + to: 1 + duration: 200 + + onRunningChanged: { + if (!running) + button.clicked() + } + } + + Text { + id: buttonText + + text: button.text + smooth: true + + color: { + if (button.enabled) + "#77262d" + else + "#666666" + } + + anchors { + centerIn: parent + verticalCenterOffset: -3 + horizontalCenterOffset: button.horizontalCenterOffset + } + + font { + family: "Nokia Sans" + pixelSize: 26 + bold: true + italic: button.italic + } + } + + MouseArea { + id: mouseArea + + enabled: button.enabled + anchors.fill: parent + onClicked: { + if (blink) + blinkAnimation.running = true + else + button.clicked() + } + } +} diff --git a/chicken-wranglers/src/qml/widgets/ConfirmationDialog.qml b/chicken-wranglers/src/qml/widgets/ConfirmationDialog.qml new file mode 100644 index 0000000..90e922d --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/ConfirmationDialog.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +BaseDialog { + id: dialog + + property string text: "Confirmation Dialog" + property string rejectText: "No" + property string acceptText: "Yes" + property int buttonWidth: 160 + + signal rejected() + signal accepted() + + Text { + color: "#4d908f" + text: dialog.text + style: Text.Raised + styleColor: "white" + + anchors.fill: box + anchors.margins: 60 + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + + font { + family: "Nokia Sans" + pixelSize: 34 + } + } + + Button { + id: rejectButton + + width: buttonWidth + text: dialog.rejectText + source: "qrc:/images/general/bt.png" + anchors { + verticalCenter: box.bottom + verticalCenterOffset: -25 + right: box.horizontalCenter + rightMargin: 20 + } + + onClicked: rejected() + } + + Button { + id: acceptButton + + width: buttonWidth + text: dialog.acceptText + source: "qrc:/images/general/bt.png" + anchors { + verticalCenter: box.bottom + verticalCenterOffset: -25 + left: box.horizontalCenter + leftMargin: 20 + } + + onClicked: accepted() + } +} diff --git a/chicken-wranglers/src/qml/widgets/ConnectivityDialog.qml b/chicken-wranglers/src/qml/widgets/ConnectivityDialog.qml new file mode 100644 index 0000000..c7a4f99 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/ConnectivityDialog.qml @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 +import game.types 1.0 + +BaseDialog { + id: dialog + + property string buttonText: "Use it" + property string cancelText: "Cancel" + property ConnectivityListModel model: ConnectivityListModel {} + signal cancel() + + Connections { + target: dialog + onHideFinished: { + title.text = "Scanning..." + button.enabled = true + quitButton.enabled = true + } + } + + ConfirmationDialog { + id: quitDialog + + text: "Do you want to cancel scanning?" + opacity: 0 + + onRejected: { + quitDialog.hide() + } + + onAccepted: { + quitDialog.hide() + dialog.cancel() + } + + z: 10 + } + + Text { + id: title + + text: "Scanning..." + style: Text.Raised + styleColor: "white" + color: "#4d908f" + + font { + family: "Nokia Sans" + bold: true + pixelSize: 34 + } + + anchors.top: box.top + anchors.topMargin: 60 + anchors.left: parent.left + anchors.right: parent.right + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + ConnectivityListView { + id: listView + + property real scrollSize: 200 + + width: 400 + height: 200 + model: dialog.model + anchors.top: title.bottom + anchors.topMargin: 15 + anchors.bottom: box.bottom + anchors.bottomMargin: 80 + anchors.horizontalCenter: parent.horizontalCenter + + onContentYChanged: { + scrollbar.setValue((contentY / scrollSize) * 100) + } + + onMovingChanged: { + if (moving) + scrollbar.opacity = 1; + else + scrollbar.opacity = 0; + } + } + + Scrollbar { + id: scrollbar + + opacity: 0 + anchors.top: title.bottom + anchors.bottom: box.bottom + anchors.left: listView.right + anchors.leftMargin: 20 + + Behavior on opacity { + NumberAnimation { + duration: 500 + easing.type: Easing.OutCirc + } + } + } + + Button { + id: button + + text: dialog.buttonText + anchors { + verticalCenter: box.bottom + verticalCenterOffset: -25 + horizontalCenter: box.horizontalCenter + horizontalCenterOffset: 90 + } + + onClicked: { + button.enabled = false + quitButton.enabled = false + title.text = "Connecting..." + + if (listView.currentIndex != -1) + listView.model.selectedIndex = listView.currentIndex + } + } + + Button { + id: quitButton + text: dialog.cancelText + anchors { + verticalCenter: box.bottom + verticalCenterOffset: -25 + horizontalCenter: box.horizontalCenter + horizontalCenterOffset: -90 + } + + onClicked: { + if (quitDialog.opacity == 0) { + quitDialog.show() + } + } + } +} + diff --git a/chicken-wranglers/src/qml/widgets/ConnectivityListModel.qml b/chicken-wranglers/src/qml/widgets/ConnectivityListModel.qml new file mode 100644 index 0000000..df1449f --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/ConnectivityListModel.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +ListModel { + ListElement { + // N8 cellphone + name: "cw"; address: "18:14:56:44:F4:DB" + category: 2; pairing: 1 + } + + ListElement { + name: "5800gard"; address: "00:25:CF:11:2B:8A" + category: 2; pairing: 1 + } + + ListElement { + name: "FabyAAAAAAAAAAAAAAAAAAAAAAAAAA"; address: "00:24:03:DA:45:00" + category: 1; pairing: 0 + } + + ListElement { + name: "device-0BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"; address: "00:24:03:DA:45:00" + category: 1; pairing: 0 + } + + ListElement { + name: "pc-1"; address: "00:24:03:DA:45:00" + category: 1; pairing: 0 + } + + ListElement { + name: "device-1"; address: "00:24:03:DA:45:00" + category: 1; pairing: 0 + } + + ListElement { + name: "mobile-0"; address: "00:24:03:DA:45:00" + category: 1; pairing: 0 + } +} + diff --git a/chicken-wranglers/src/qml/widgets/ConnectivityListView.qml b/chicken-wranglers/src/qml/widgets/ConnectivityListView.qml new file mode 100644 index 0000000..ca04c5b --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/ConnectivityListView.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 +import game.types 1.0 + +ListView { + id: listView + + Component { + id: delegate + + Item { + width: lineDivisor.width + height: 43 + + Image { + id: lineDivisor + + source: "qrc:/images/general/list_line_divisor.png" + + anchors.top: parent.top + } + + Text { + text: name + + width: parent.width - 110 + + style: Text.Raised + styleColor: "white" + + color: "#4d908f" + + font { + family: "Nokia Sans" + bold: true + pixelSize: 21 + } + + elide: Text.ElideRight + + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 23 + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + MouseArea { + anchors.fill: parent + + onClicked: { + var pos = mapToItem(listView.contentItem, mouseX, mouseY) + var selectedIndex = listView.indexAt(pos.x, pos.y) + + if (selectedIndex == listView.currentIndex) { + listView.currentIndex = -1 + } else { + listView.currentIndex = selectedIndex + } + } + } + } + } + + model: ConnectivityListModel {} + delegate: delegate + + focus: false + clip: true + + Component { + id: highlightIcon + + Item { + width: listView.width + height: 43 + + Image { + source: "qrc:/images/general/list_selected_icon.png" + + anchors.left: parent.right + anchors.leftMargin: -70 + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 1 + } + } + } + + currentIndex: model.selectedIndex + + highlight: highlightIcon + highlightMoveDuration: 100 + + snapMode: ListView.SnapToItem +} + diff --git a/chicken-wranglers/src/qml/widgets/Countdown.qml b/chicken-wranglers/src/qml/widgets/Countdown.qml new file mode 100644 index 0000000..31b5ad9 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/Countdown.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Item { + id: countdown + + property int startValue: 3 + property int currentValue: startValue + property int interval: 800 + property string timeoutText: "Go!" + + signal timeout + + function start() { + countdown.opacity = 1 + animation.start() + } + + function decrement() { + if (currentValue - 1 > 0) { + currentValue-- + return + } + + if (currentValue == 1) { + number.text = countdown.timeoutText + currentValue-- + return + } + + countdown.opacity = 0 + countdown.timeout() + } + + Text { + id: number + + text: currentValue + smooth: true + anchors.centerIn: parent + color: "white" + + font { + family: "Nokia Sans" + pointSize: 100 + bold: true + } + + style: Text.Outline + styleColor: "darkgreen" + } + + SequentialAnimation { + id: animation + + loops: startValue + 1 + + ParallelAnimation { + PropertyAnimation { duration: countdown.interval; target: number; property: "scale"; from: 1; to: 2 } + PropertyAnimation { duration: countdown.interval; target: number; property: "opacity"; from: 1; to: 0 } + } + + PropertyAction { target: number; properties: "scale,opacity"; value: 1 } + ScriptAction { script: countdown.decrement() } + } +} diff --git a/chicken-wranglers/src/qml/widgets/Feather.qml b/chicken-wranglers/src/qml/widgets/Feather.qml new file mode 100644 index 0000000..b46585c --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/Feather.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +import game.types 1.0 +import "featherfall.js" as Feather + +Image { + id: feather + + property int xMax: 0 + property int xMin: 0 + property int yMax: 768 + + // the delay offset for the initial creation of each feather. + property real delay: 0 + + source: { + if (game.environment() == Global.Symbian) + "qrc:/images/general/symbian/feather1.png" + else + "qrc:/images/general/feather1.png" + } + smooth: true + y: -feather.height + + function startAnimation() { + animY.running = true + animX.running = true + animRotation.running = true + } + + function stopAnimation() { + animY.running = false + animX.running = false + animRotation.running = false + } + + SequentialAnimation on y { + id: animY + + running: false + + PauseAnimation { duration: delay } + NumberAnimation { to: 100; easing.type: Easing.InOutSine; duration: 1050 } + NumberAnimation { to: 300; easing.type: Easing.InOutSine; duration: 950 } + NumberAnimation { to: 500; easing.type: Easing.InOutSine; duration: 1050 } + NumberAnimation { to: 700; easing.type: Easing.InOutSine; duration: 950 } + NumberAnimation { to: 900; easing.type: Easing.InOutSine; duration: 1050 } + NumberAnimation { to: yMax + 2 * feather.height; easing.type: Easing.InOutSine; duration: 950 } + + onRunningChanged: { + if (!running) + feather.destroy() + } + } + + SequentialAnimation on x { + id: animX + + running: false + + PauseAnimation { duration: delay } + NumberAnimation { to: xMax; easing.type: Easing.InOutSine; duration: 950 } + NumberAnimation { to: xMin; easing.type: Easing.InOutSine; duration: 1050 } + NumberAnimation { to: xMax; easing.type: Easing.InOutSine; duration: 950 } + NumberAnimation { to: xMin; easing.type: Easing.InOutSine; duration: 1050 } + NumberAnimation { to: xMax; easing.type: Easing.InOutSine; duration: 950 } + NumberAnimation { to: xMin; easing.type: Easing.InOutSine; duration: 1050 } + } + + SequentialAnimation on rotation { + id: animRotation + + running: false + + PauseAnimation { duration: delay } + NumberAnimation { to: -40; easing.type: Easing.InOutSine; duration: 1000 } + NumberAnimation { to: 25; easing.type: Easing.InOutSine; duration: 1000 } + NumberAnimation { to: -40; easing.type: Easing.InOutSine; duration: 1000 } + NumberAnimation { to: 25; easing.type: Easing.InOutSine; duration: 1000 } + NumberAnimation { to: -40; easing.type: Easing.InOutSine; duration: 1000 } + NumberAnimation { to: 25; easing.type: Easing.InOutSine; duration: 1000 } + NumberAnimation { to: -40; easing.type: Easing.InOutSine; duration: 1000 } + } +} diff --git a/chicken-wranglers/src/qml/widgets/FeatherFall.qml b/chicken-wranglers/src/qml/widgets/FeatherFall.qml new file mode 100644 index 0000000..d8b49d7 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/FeatherFall.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +import game.types 1.0 +import "featherfall.js" as FeatherFall + +Item { + id: featherFall + + property real fallWidth: 800 + property real fallHeight: 768 + property int number: 5 + + function start() { + timer.start() + } + + function stop() { + timer.stop() + FeatherFall.destroy() + } + + Timer { + id: timer + + triggeredOnStart: true + repeat: true + interval: 6000 + onTriggered: { + FeatherFall.create(featherFall.width, featherFall.height) + } + } +} diff --git a/chicken-wranglers/src/qml/widgets/ImageButton.qml b/chicken-wranglers/src/qml/widgets/ImageButton.qml new file mode 100644 index 0000000..2ccdbf1 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/ImageButton.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Image { + id: button + + property bool blink: false + property string name: "" + property string path: "qrc:/images/general" + property alias buttonPressed: mouseArea.pressed + + signal clicked + + smooth: true + source: { + if (path == "") + return "" + + if (mouseArea.pressed) + path + "/bt_" + name + "_pressed.png" + else + path + "/bt_" + name + ".png" + } + + PropertyAnimation { + id: blinkAnimation + + target: button + properties: "opacity" + loops: 2 + from: 0 + to: 1 + duration: 200 + + onRunningChanged: { + if (!running) + button.clicked() + } + } + + MouseArea { + id: mouseArea + + anchors.fill: parent + onClicked: { + if (blink) + blinkAnimation.running = true + else + button.clicked() + } + } +} diff --git a/chicken-wranglers/src/qml/widgets/Loading.qml b/chicken-wranglers/src/qml/widgets/Loading.qml new file mode 100644 index 0000000..19eeff5 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/Loading.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Item { + id: loading + + property int count: 0 + + width: row.width + height: row.height + + Component { + id: dot + + Rectangle { + id: outer + + width: 15 + height: 15 + color: "#e0fce5" + radius: 50 + smooth: true + + Rectangle { + id: inner + + anchors.centerIn: parent + + smooth: true + color: "#9bbaae" + radius: 50 + + anchors.fill: parent + anchors.margins: 3 + } + + states { + State { + name: "off" + PropertyChanges { target: outer; scale: 1 } + PropertyChanges { target: inner; color: "#9bbaae" } + } + State { + name: "on" + PropertyChanges { target: outer; scale: 1.33 } + PropertyChanges { target: inner; color: "#f6c200" } + } + } + + transitions: Transition { + ParallelAnimation { + NumberAnimation { target: outer; property: "scale"; easing.type: Easing.InOutQuad } + ColorAnimation { target: inner; property: "color"; easing.type: Easing.InOutQuad } + } + } + } + } + + Row { + id: row + + spacing: 4 + + children: [ + Loader { sourceComponent: dot }, + Loader { sourceComponent: dot }, + Loader { sourceComponent: dot } + ] + } + + Timer { + id: timer + + repeat: true + interval: 200 + running: true + + onTriggered: { + if (count > 0) + row.children[count - 1].item.state = "off" + + if (count < row.children.length) + row.children[count].item.state = "on" + + count = (count + 1) % (row.children.length + 1) + } + } + + onOpacityChanged: { + if (opacity == 1 && !timer.running) { + timer.start() + } + else if (opacity == 0 && timer.running) { + timer.stop() + } + } +} diff --git a/chicken-wranglers/src/qml/widgets/MessageDialog.qml b/chicken-wranglers/src/qml/widgets/MessageDialog.qml new file mode 100644 index 0000000..44cc8d1 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/MessageDialog.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +BaseDialog { + id: dialog + + property string text: "Message Dialog" + property string buttonText: "Ok" + + signal buttonClicked + + Text { + color: "#4d908f" + text: dialog.text + style: Text.Raised + styleColor: "white" + + anchors.fill: box + anchors.margins: 60 + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + + font { + family: "Nokia Sans" + pixelSize: 34 + } + } + + Button { + id: button + + text: dialog.buttonText + anchors { + verticalCenter: box.bottom + verticalCenterOffset: -25 + horizontalCenter: box.horizontalCenter + } + + onClicked: buttonClicked() + } +} + diff --git a/chicken-wranglers/src/qml/widgets/OptionSlider.qml b/chicken-wranglers/src/qml/widgets/OptionSlider.qml new file mode 100644 index 0000000..205f299 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/OptionSlider.qml @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Item { + id: slider + + property string option: "Wifi" + + signal selected(string option) + + width: sliderSelector.width + height: sliderPath.height + + Image { + id: sliderPath + + anchors.centerIn: parent + + source: "qrc:/images/general/slider_path.png" + } + + Image { + anchors { + horizontalCenter: slider.horizontalCenter + bottom: slider.verticalCenter + bottomMargin: 21 + } + + source: "qrc:/images/general/slider_wifi_icon.png" + } + + Image { + anchors { + horizontalCenter: slider.horizontalCenter + horizontalCenterOffset: 3 + top: slider.verticalCenter + topMargin: 16 + } + + source: "qrc:/images/general/slider_bluetooth_icon.png" + } + + Image { + id: sliderSelector + + source: "qrc:/images/general/slider_selector.png" + + x: 0 + y: 10 + + Behavior on y { + NumberAnimation { + id: slideAnimation + + duration: 500 + easing.type: Easing.OutCirc + } + } + } + + MouseArea { + anchors.fill: parent + + enabled: !slideAnimation.running + + onReleased: { + // Wifi selected + if (mouse.y <= ((slider.height / 2) - 1)) { + if (slider.option != "Wifi") { + slider.option = "Wifi" + + selected(slider.option) + + sliderSelector.y = 10 + } + + // Bluetooth selected + } else { + if (slider.option != "Bluetooth") { + slider.option = "Bluetooth" + + selected(slider.option) + + sliderSelector.y = (slider.height / 2) - 10 + } + } + } + } +} + diff --git a/chicken-wranglers/src/qml/widgets/Screen.qml b/chicken-wranglers/src/qml/widgets/Screen.qml new file mode 100644 index 0000000..967f443 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/Screen.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Rectangle { + id: screen + + signal transitionFinished(bool visible) + + anchors.fill: parent + opacity: 0 + + function show() { + screen.state = "visible" + } + + function hide() { + screen.state = "hidden" + } + + states { + State { + name: "visible" + PropertyChanges { target: screen; opacity: 1 } + } + State { + name: "hidden" + PropertyChanges { target: screen; opacity: 0 } + } + } + + Behavior on opacity { + NumberAnimation { + duration: 200 + + onRunningChanged: { + if (!running) { + if (opacity == 1) + transitionFinished(true) + else + transitionFinished(false) + } + } + } + } +} diff --git a/chicken-wranglers/src/qml/widgets/Scrollbar.qml b/chicken-wranglers/src/qml/widgets/Scrollbar.qml new file mode 100644 index 0000000..0d59208 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/Scrollbar.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Item { + id: scrollbar + + property real value: 0.0 + property real minimumValue: 0.0 + property real maximumValue: 100.0 + property real offset: 8.0 + property real minimumPos: offset + property real maximumPos: scrollbarPath.height - scrollbarKnob.height - offset + property real scrollSize: maximumPos - minimumPos + 1 + + width: scrollbarKnob.width + height: scrollbarPath.height + + function setValue(newValue) { + if (newValue <= minimumValue) { + value = minimumValue; + } else if (newValue >= maximumValue) { + value = maximumValue; + } else { + value = newValue; + } + } + + Image { + id: scrollbarPath + + anchors.centerIn: parent + + source: "qrc:/images/general/list_scrollbar_path.png" + } + + Image { + id: scrollbarKnob + + anchors.horizontalCenter: parent.horizontalCenter + + y: ((scrollbar.value / scrollbar.maximumValue) * scrollbar.scrollSize) + scrollbar.offset + + source: "qrc:/images/general/list_scrollbar_knob.png" + } +} + diff --git a/chicken-wranglers/src/qml/widgets/ToggleButton.qml b/chicken-wranglers/src/qml/widgets/ToggleButton.qml new file mode 100644 index 0000000..939602f --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/ToggleButton.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** This file is a part of QtChickenWranglers. +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).* +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + + +import Qt 4.7 + +Image { + id: button + signal clicked + property string mode: "bluetooth" + source: "qrc:/images/general/toggle_bt.png" + + MouseArea { + id: mouseArea + + anchors.fill: parent + onClicked: { + if (button.mode == "bluetooth") { + button.mode = "lan" + button.source = "qrc:/images/general/toggle_lan.png" + } else { + button.mode = "bluetooth" + button.source = "qrc:/images/general/toggle_bt.png" + } + + game.setConnectivity(button.mode) + } + } +} diff --git a/chicken-wranglers/src/qml/widgets/featherfall.js b/chicken-wranglers/src/qml/widgets/featherfall.js new file mode 100644 index 0000000..6ae51a4 --- /dev/null +++ b/chicken-wranglers/src/qml/widgets/featherfall.js @@ -0,0 +1,66 @@ +var component; +var featherObjList = new Array; + +function create(fallWidth, fallHeight) { + var i, range, lowRange, highRange; + + if (component == null) + component = Qt.createComponent("Feather.qml"); + + range = fallWidth / featherFall.number; + lowRange = -range; + highRange = 0; + + var resourcePath = ""; + if (game.environment() == Global.Symbian) + resourcePath = "qrc:/images/general/symbian/feather" + else + resourcePath = "qrc:/images/general/feather" + + for (i = 0; i < featherFall.number; i++) { + if (component.status == Component.Ready) { + + featherObjList[i] = component.createObject(background); + + if (featherObjList[i] == null) { + console.log("error creating featherObj"); + console.log(component.errorString()); + return false; + } + + lowRange = lowRange + range; + highRange = highRange + range; + + var xpos = (highRange - range) * Math.random() + lowRange; + featherObjList[i].x = xpos; + + featherObjList[i].delay = Math.random() * 3000 * i; + + var swing = Math.random() * range; + if (swing < 100) + swing += 100; + + featherObjList[i].xMax = xpos + swing; + featherObjList[i].xMin = xpos - swing; + featherObjList[i].yMax = fallHeight; + featherObjList[i].source = resourcePath + (Math.floor(5 * Math.random()) + 1) + ".png"; + + featherObjList[i].startAnimation(); + } else { + console.log("error loading featherObj component"); + console.log(component.errorString()); + return false; + } + } + + return true; +} + +function destroy() { + for (var i = 0; i < featherFall.number; i++) { + if (featherObjList[i] == null) + continue; + + featherObjList[i].destroy() + } +} |