Added copyright headers and COPYING file.
[harmattan/cameraplus] / qml / Selector.qml
1 // -*- qml -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012 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 import com.nokia.meego 1.1
25 import QtCamera 1.0
26
27 Button {
28         id: button
29         width: 56
30         height: 56
31
32         opacity: 0.5
33
34         property alias widget: __widget.children
35         property bool timerConstraints: false
36         property alias title: label.text
37
38         checkable: true
39
40         function close() {
41                 button.checked = false;
42         }
43
44         Timer {
45                 interval: 2000
46                 running: mouse.enabled && !button.timerConstraints
47                 repeat: false
48                 onTriggered: button.close();
49         }
50
51         MouseArea {
52                 id: mouse
53                 parent: button.parent
54                 anchors.fill: parent
55                 enabled: button.checked
56                 onClicked: button.close();
57
58                 Label {
59                         id: label
60                         y: button.y
61                         x: button.x + button.width + 20
62                         visible: button.checked
63                 }
64
65                 Item {
66                         id: __widget
67                         anchors.top: label.bottom
68                         anchors.topMargin: 10
69 //                        y: button.y
70                         x: button.x + button.width + 20
71                         visible: button.checked
72                 }
73         }
74 }