Added copyright headers and COPYING file.
[harmattan/cameraplus] / qml / ZoomSlider.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 Slider {
28         id: slider
29         property alias camera: zoom.camera
30         platformStyle: SliderStyle {
31                 // HACK
32                 handleBackground: " "
33                 handleBackgroundPressed: " "
34         }
35
36         Zoom {
37                 id: zoom
38                 value: slider.value
39         }
40
41         Connections {
42                 target: camera
43                 onModeChanged: slider.value = zoom.minimum;
44         }
45
46         orientation: Qt.Horizontal
47         width: 500
48         height: 50
49         stepSize:0.1
50         minimumValue: zoom.minimum
51         maximumValue: zoom.maximum
52
53         state: "hidden"
54         states: [
55         State {
56                 name: "visible"
57                 when: slider.pressed
58                 PropertyChanges { target: slider; opacity: 1.0 }
59         },
60         State {
61                 name: "hidden"
62                 when: !slider.pressed
63                 PropertyChanges { target: slider; opacity: 0.2 }
64         }]
65
66         transitions: Transition {
67                 to: "hidden"
68                 SequentialAnimation {
69                         PauseAnimation { duration: 2000 }
70                         NumberAnimation { target: slider; property: "opacity"; duration: 250 }
71                 }
72         }
73 }