Reworked how we create items for toolbar.
[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         // TODO: test this
47         enabled: camera != null && camera.running && camera.idle
48
49         CameraButton {
50             text: qsTr("Back (Primary)");
51             checkable: true
52             checked: settings.device == 0
53             onClicked: settings.device = 0
54         }
55
56         CameraButton {
57             text: qsTr("Front (Secondary)");
58             checkable: true
59             checked: settings.device == 1
60             onClicked: settings.device = 1
61         }
62     }
63
64     TextSwitch {
65         text: qsTr("Show grid lines")
66
67         // We have to do it that way because QML complains about a binding
68         // loop for checked if we bind the checked property to the settings value.
69         Component.onCompleted: checked = settings.gridEnabled
70
71         onCheckedChanged: settings.gridEnabled = checked
72     }
73
74     SectionHeader {
75         text: qsTr("Creator name")
76         width: parent.width
77     }
78
79     CameraTextField {
80         placeholderText: qsTr("Name or copyright")
81         width: parent.width
82         text: settings.creatorName
83         onTextChanged: settings.creatorName = text
84     }
85
86     TextSwitch {
87         text: qsTr("Use zoom keys for capture")
88
89         // We have to do it that way because QML complains about a binding
90         // loop for checked if we bind the checked property to the settings value.
91         Component.onCompleted: checked = settings.zoomAsShutter
92         onCheckedChanged: settings.zoomAsShutter = checked
93     }
94
95     TextSwitch {
96         text: qsTr("Enable camera sounds")
97
98         // We have to do it that way because QML complains about a binding
99         // loop for checked if we bind the checked property to the settings value.
100         Component.onCompleted: checked = settings.soundEnabled
101         onCheckedChanged: settings.soundEnabled = checked
102     }
103
104     TextSwitch {
105         id: useGps
106         text: qsTr("Use GPS")
107
108         // We have to do it that way because QML complains about a binding
109         // loop for checked if we bind the checked property to the settings value.
110         Component.onCompleted: checked = settings.useGps
111         onCheckedChanged: settings.useGps = checked
112     }
113
114     TextSwitch {
115         // TODO: transition when hiding/showing and we should scroll a bit to show it
116         visible: useGps.checked
117
118         text: qsTr("Use geotags")
119
120         // We have to do it that way because QML complains about a binding
121         // loop for checked if we bind the checked property to the settings value.
122         Component.onCompleted: checked = settings.useGeotags
123         onCheckedChanged: settings.useGeotags = checked
124     }
125 }