/**************************************************************************** ** ** Copyright (C) 2011 Nokia Institute of Technology. ** All rights reserved. ** Contact: Manager (renato.chencarek@openbossa.org) ** ** This file is part of the Incredible Circus project. ** ** 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. ** ****************************************************************************/ import QtQuick 1.1 import Circus 1.0 Item { id: root signal clicked() property bool locked: true property int scoreType: LevelModel.NoScore function burn() { sound.play("menu_smoke"); smokeAnimation.start(); } function burnIn() { sound.play("menu_smoke"); smokeInAnimation.start(); } Image { id: image anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter source: { if (locked) return "image://cache/screens/level/level_closed.png"; if (scoreType == LevelModel.NoScore) return "image://cache/screens/level/level_open.png"; else if (scoreType == LevelModel.GoldScore) return "image://cache/screens/level/gold_trophy.png"; else if (scoreType == LevelModel.SilverScore) return "image://cache/screens/level/silver_trophy.png"; else if (scoreType == LevelModel.BronzeScore) return "image://cache/screens/level/bronze_trophy.png"; } Label { effect: SimpleText.LightDigit fontSize: 28 * scaleFactor color: "black" text: (index + 1) anchors.centerIn: parent visible: (scoreType != LevelModel.NoScore) } MouseArea { anchors.fill: parent onClicked: root.clicked() } } Image { id: smoke property int index: 1 visible: false anchors.bottom: image.bottom anchors.horizontalCenter: image.horizontalCenter source: "image://cache/sprites/smoke/large/" + index +".png" } SequentialAnimation { id: smokeAnimation PropertyAction { target: smoke; properties: "visible"; value: true; } PropertyAction { target: image; properties: "visible"; value: false; } NumberAnimation { target: smoke; property: "index"; from: 1; to: 5; duration: 300; } PropertyAction { target: smoke; properties: "visible"; value: false; } PauseAnimation { duration: 300; } // restore PropertyAction { target: smoke; properties: "index"; value: 1; } PropertyAction { target: image; properties: "visible"; value: true; } } SequentialAnimation { id: smokeInAnimation PropertyAction { target: smoke; properties: "visible"; value: true; } PropertyAction { target: image; properties: "visible"; value: true; } ParallelAnimation { NumberAnimation { target: image; properties: "opacity"; from: 0; to: 1; duration: 600; } NumberAnimation { target: smoke; property: "index"; from: 1; to: 5; duration: 300; } } // restore PropertyAction { target: smoke; properties: "visible"; value: false; } PropertyAction { target: smoke; properties: "index"; value: 1; } PropertyAction { target: image; properties: "visible"; value: true; } } }