Source /tmp/session_bus_address.user before invoking dbus-send in postinst script
[harmattan/cameraplus] / qml / CameraInfoBanner.qml
1 // -*- qml -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 import QtQuick 1.1
24
25 Rectangle {
26     property alias text: label.text
27     property bool shown: false
28
29     width: parent.width - 16
30     height: label.height * 2
31     y: shown ? 8 : - (height + 8)
32     anchors.horizontalCenter: parent.horizontalCenter
33     color: "black"
34     border.color: "gray"
35     radius: 20
36
37     Behavior on y {
38         NumberAnimation {duration: 200}
39     }
40
41     Timer {
42         id: timer
43         repeat: false
44         interval: 3000
45         onTriggered: hide()
46     }
47
48     MouseArea {
49         anchors.fill: parent
50         onClicked: parent.hide()
51     }
52
53     CameraLabel {
54         id: label
55         anchors.verticalCenter: parent.verticalCenter
56         elide: Text.ElideRight
57         maximumLineCount: 1
58         x: 16
59     }
60
61     function show() {
62         shown = true
63         timer.restart()
64     }
65
66     function hide() {
67         shown = false
68         timer.stop()
69     }
70 }