c25a72257e4bb5a5a2652750829d8367a4977d5f
[harmattan/cameraplus] / qml / CameraSettings.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 2.0
24 import QtCamera 1.0
25
26 Column {
27     property Camera camera: null
28
29     id: col
30     spacing: 10
31     width: parent.width
32
33     CameraLabel {
34         font.pixelSize: 36
35         text: qsTr("Camera settings")
36         width: parent.width
37     }
38
39     SectionHeader {
40         text: qsTr("Camera")
41         width: parent.width
42     }
43
44     CameraButtonRow {
45         anchors.horizontalCenter: parent.horizontalCenter
46         enabled: camera != null && camera.running && camera.idle
47
48         CameraButton {
49             text: qsTr("Back (Primary)");
50             checkable: true
51             checked: settings.device == 0
52             onClicked: settings.device = 0
53         }
54
55         CameraButton {
56             text: qsTr("Front (Secondary)");
57             checkable: true
58             checked: settings.device == 1
59             onClicked: settings.device = 1
60         }
61     }
62
63     CameraTextSwitch {
64         text: qsTr("Show grid lines")
65
66         // We have to do it that way because QML complains about a binding
67         // loop for checked if we bind the checked property to the settings value.
68         Component.onCompleted: checked = settings.gridEnabled
69
70         onCheckedChanged: settings.gridEnabled = checked
71     }
72
73     SectionHeader {
74         text: qsTr("Creator name")
75         width: parent.width
76     }
77
78     CameraTextField {
79         placeholderText: qsTr("Name or copyright")
80         width: parent.width
81         text: settings.creatorName
82         onTextChanged: settings.creatorName = text
83     }
84
85     CameraTextSwitch {
86         text: qsTr("Use zoom keys for capture")
87
88         // We have to do it that way because QML complains about a binding
89         // loop for checked if we bind the checked property to the settings value.
90         Component.onCompleted: checked = settings.zoomAsShutter
91         onCheckedChanged: settings.zoomAsShutter = checked
92     }
93
94     CameraTextSwitch {
95         text: qsTr("Use proximity sensor for capture")
96
97         // We have to do it that way because QML complains about a binding
98         // loop for checked if we bind the checked property to the settings value.
99         Component.onCompleted: checked = settings.proximityAsShutter
100         onCheckedChanged: settings.proximityAsShutter = checked
101     }
102
103     CameraTextSwitch {
104         text: qsTr("Enable camera sounds")
105
106         // We have to do it that way because QML complains about a binding
107         // loop for checked if we bind the checked property to the settings value.
108         Component.onCompleted: checked = settings.soundEnabled
109         onCheckedChanged: settings.soundEnabled = checked
110     }
111
112     CameraTextSwitch {
113         text: qsTr("Preview images and videos after capturing")
114         visible: false
115         // We have to do it that way because QML complains about a binding
116         // loop for checked if we bind the checked property to the settings value.
117         Component.onCompleted: checked = settings.enablePreview
118         onCheckedChanged: settings.enablePreview = checked
119     }
120
121     CameraTextSwitch {
122         id: useGps
123         text: qsTr("Use GPS")
124
125         // We have to do it that way because QML complains about a binding
126         // loop for checked if we bind the checked property to the settings value.
127         Component.onCompleted: checked = settings.useGps
128         onCheckedChanged: settings.useGps = checked
129     }
130
131     CameraTextSwitch {
132         // TODO: transition when hiding/showing and we should scroll a bit to show it
133         visible: useGps.checked
134
135         text: qsTr("Use geotags")
136
137         // We have to do it that way because QML complains about a binding
138         // loop for checked if we bind the checked property to the settings value.
139         Component.onCompleted: checked = settings.useGeotags
140         onCheckedChanged: settings.useGeotags = checked
141     }
142 }