diff options
Diffstat (limited to 'examples/mobile/qtbubblelevel/qml')
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/BubbleLevel.qml | 226 | ||||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/Button.qml | 72 | ||||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/Tube.qml | 87 | ||||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/board.png | bin | 0 -> 520721 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/bubble.png | bin | 0 -> 4951 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/calibbutton.png | bin | 0 -> 4881 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/exit.png | bin | 0 -> 2308 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/reflection.png | bin | 0 -> 1306 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/scale.png | bin | 0 -> 271 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/signblank.png | bin | 0 -> 41230 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/signwithtext.png | bin | 0 -> 47648 bytes | |||
-rw-r--r-- | examples/mobile/qtbubblelevel/qml/images/taskswitcher.png | bin | 0 -> 767 bytes |
12 files changed, 385 insertions, 0 deletions
diff --git a/examples/mobile/qtbubblelevel/qml/BubbleLevel.qml b/examples/mobile/qtbubblelevel/qml/BubbleLevel.qml new file mode 100644 index 00000000..28917368 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/BubbleLevel.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: bubbleLevel + + //! [0] + // Signaled when task switcher button is pressed + signal minimizeApplication() + + // Signaled when correction angle is saved + signal saveCorrectionAngle(variant angle) + + // These functions are used as Qt slots + function handleRotation(deg) { + horTube.rawangle = deg + } + + function setCorrectionAngle(deg) { + horTube.angleconstant = deg + } + + // Used to show the task switcher button in Maemo targets + property alias taskSwitcherVisible: taskSwitcher.visible + //! [0] + + anchors.fill: parent + source: "images/board.png" + smooth: true + + MouseArea { + anchors.fill: parent + onClicked: sign.frontSide = true + } + + Button { + id: taskSwitcher + + anchors { + left: parent.left + right: horTube.left + verticalCenter: horTube.verticalCenter + margins: (parent.width - (horTube.x + horTube.width)) / 4 + } + + height: width + source: "images/taskswitcher.png" + mouseAreaScale: 2 + onClicked: bubbleLevel.minimizeApplication() + visible: false + } + + Button { + id: exitButton + + anchors { + left: horTube.right + right: parent.right + verticalCenter: horTube.verticalCenter + margins: (parent.width - (horTube.x + horTube.width)) / 4 + } + + height: width + source: "images/exit.png" + mouseAreaScale: 2 + onClicked: Qt.quit() + } + + //! [1] + Tube { + id: horTube + + property real rawangle: 0 + property real angleconstant: 0 + + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width * 0.775; height: parent.height * 0.15625 + deg: rawangle - angleconstant + } + //! [1] + + Flipable { + id: sign + + property bool frontSide: true + + x: parent.width * 0.185; y: parent.height * 0.669 + width: parent.width * 0.63; height: parent.height * 0.258 + + MouseArea { + anchors.fill: parent + onClicked: sign.frontSide = !sign.frontSide + z: -1 + } + + transform: Rotation { + + origin.x: sign.width / 2; origin.y: sign.height / 2 + axis.x: 1; axis.y: 0; axis.z: 0 + angle: sign.frontSide ? 0 : 180 + + Behavior on angle { + RotationAnimation { + direction: RotationAnimation.Clockwise + easing.type: Easing.InOutCubic; duration: 300 + } + } + } + + front: Image { + anchors.fill: parent + source: "images/signwithtext.png" + smooth: true + } + + back: Image { + anchors.fill: parent + source: "images/signblank.png" + smooth: true + + Text { + id: oldValue + + anchors { + left: parent.left; leftMargin: parent.width * 0.10 + right: saveButton.left; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + + text: "Place the device on a level surface and tap Calibrate." + color: "#302020" + wrapMode: Text.WordWrap + font { bold: false; pixelSize: Math.min(parent.width, parent.height) * 0.19 } + } + + Button { + id: saveButton + + anchors { + right: parent.right; rightMargin: parent.width * 0.09 + verticalCenter: parent.verticalCenter + } + + width: parent.width * 0.25; height: parent.height * 0.65 + border { width: 2; color: "#555555" } + radius: 10 + + onClicked: { + horTube.angleconstant = horTube.rawangle + saveCorrectionAngle(horTube.angleconstant) + } + + gradient: Gradient { + GradientStop { position: 0.0; color: "#999999" } + GradientStop { position: 0.2; color: "#BBBBBB" } + GradientStop { position: 0.8; color: "#BBBBBB" } + GradientStop { position: 1.0; color: "#999999" } + } + + Text { + anchors.centerIn: parent + color: "#302020" + text: "Calibrate" + font { bold: true; pixelSize: parent.width * 0.15 } + smooth: true + } + } + } + } + + Button { + anchors { + left: sign.right + right: parent.right + verticalCenter: sign.verticalCenter + margins: (parent.width - (sign.x + sign.width)) / 4 + } + + height: width + source: "images/calibbutton.png" + mouseAreaScale: 2 + smooth: true + + onClicked: sign.frontSide = !sign.frontSide + } +} diff --git a/examples/mobile/qtbubblelevel/qml/Button.qml b/examples/mobile/qtbubblelevel/qml/Button.qml new file mode 100644 index 00000000..42375f6f --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/Button.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: button + + property alias source: image.source + property alias mouseAreaScale: mouseArea.scale + + signal clicked + + width: 50; height: 50 + color: "transparent" + + Behavior on scale { NumberAnimation { duration: 50 } } + + Image { + id: image + + anchors.fill: parent + smooth: true + } + + MouseArea { + id: mouseArea + + anchors.fill: parent + onClicked: { button.clicked() } + onEntered: { button.scale = 0.9 } + onExited: { button.scale = 1.0 } + } +} diff --git a/examples/mobile/qtbubblelevel/qml/Tube.qml b/examples/mobile/qtbubblelevel/qml/Tube.qml new file mode 100644 index 00000000..8c20f121 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/Tube.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +//! [0] +Item { + id: tube + + property real deg + + Image { + id: bubble + + property real center: tube.width / 2 + property real bubbleCenter: bubble.width / 2 + + function calX() { + var newX = center + tube.deg / -20 * center + + if((newX - bubbleCenter) < 0) { + return 0 + } + else if((newX + bubbleCenter) > tube.width) { + return tube.width - 2 * bubbleCenter + } + + return newX - bubbleCenter; + } + + x: calX() + width: 0.16129032 * parent.width; height: 0.66666667 * parent.height + source: "images/bubble.png" + smooth: true + } + + Image { + anchors.horizontalCenter: parent.horizontalCenter + width: 0.36451613 * parent.width; height: 0.66666667 * parent.height + source: "images/scale.png" + } + + Image { + width: parent.width; height: 0.32 * parent.height + opacity: 0.8 + source: "images/reflection.png" + } +} +//! [0] diff --git a/examples/mobile/qtbubblelevel/qml/images/board.png b/examples/mobile/qtbubblelevel/qml/images/board.png Binary files differnew file mode 100644 index 00000000..aaed8d01 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/board.png diff --git a/examples/mobile/qtbubblelevel/qml/images/bubble.png b/examples/mobile/qtbubblelevel/qml/images/bubble.png Binary files differnew file mode 100644 index 00000000..e73be9e5 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/bubble.png diff --git a/examples/mobile/qtbubblelevel/qml/images/calibbutton.png b/examples/mobile/qtbubblelevel/qml/images/calibbutton.png Binary files differnew file mode 100644 index 00000000..5f84dad7 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/calibbutton.png diff --git a/examples/mobile/qtbubblelevel/qml/images/exit.png b/examples/mobile/qtbubblelevel/qml/images/exit.png Binary files differnew file mode 100644 index 00000000..64a61634 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/exit.png diff --git a/examples/mobile/qtbubblelevel/qml/images/reflection.png b/examples/mobile/qtbubblelevel/qml/images/reflection.png Binary files differnew file mode 100644 index 00000000..093781ec --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/reflection.png diff --git a/examples/mobile/qtbubblelevel/qml/images/scale.png b/examples/mobile/qtbubblelevel/qml/images/scale.png Binary files differnew file mode 100644 index 00000000..c75b21e2 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/scale.png diff --git a/examples/mobile/qtbubblelevel/qml/images/signblank.png b/examples/mobile/qtbubblelevel/qml/images/signblank.png Binary files differnew file mode 100644 index 00000000..03b53cc0 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/signblank.png diff --git a/examples/mobile/qtbubblelevel/qml/images/signwithtext.png b/examples/mobile/qtbubblelevel/qml/images/signwithtext.png Binary files differnew file mode 100644 index 00000000..be9c050f --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/signwithtext.png diff --git a/examples/mobile/qtbubblelevel/qml/images/taskswitcher.png b/examples/mobile/qtbubblelevel/qml/images/taskswitcher.png Binary files differnew file mode 100644 index 00000000..89ff7a15 --- /dev/null +++ b/examples/mobile/qtbubblelevel/qml/images/taskswitcher.png |