/**************************************************************************** ** ** 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.0 import Circus 1.0 import "widgets" ImageButton { id: achievementPopup source: "image://cache/widgets/notification/achievement.png" state: "popupHidden" Item { width: parent.width height: parent.height anchors { top: parent.top topMargin: 6 left: parent.left leftMargin: 12 } smooth: true Image { id: achievementIcon } Label { id: achievementName width: achievementPopup.width - (75 * scaleFactor) height: achievementIcon.height anchors { top: achievementIcon.top left: achievementIcon.right leftMargin: 10 * scaleFactor } horizontalAlignment: SimpleText.AlignLeft verticalAlignment: SimpleText.AlignVCenter fontSize: 17 * scaleFactor color: "#a56d26" } } function popupAchievement(name, icon, startTime) { achievementName.text = name achievementIcon.source = "image://cache/achievements/" + icon + "_small.png" popupShowTimer.interval = 800 + startTime popupHideTimer.interval = 2800 + startTime popupShowTimer.start() popupHideTimer.start() } Timer { id: popupShowTimer running: false; repeat: false onTriggered: achievementPopup.state = "popupVisible" } Timer { id: popupHideTimer running: false; repeat: false onTriggered: achievementPopup.state = "popupHidden" } states: [ State { name: "popupVisible" PropertyChanges { target: achievementPopup; opacity: 0.8 } AnchorChanges { target: achievementPopup; anchors.top: stage.top; } }, State { name: "popupHidden" PropertyChanges { target: achievementPopup; opacity: 0 } AnchorChanges { target: achievementPopup; anchors.bottom: stage.top; } } ] Behavior on opacity { NumberAnimation { duration: 200 } } transitions: Transition { id: popupTransition AnchorAnimation { duration: 600 } } }