0111dd9a61c8847fac12eb073d88f5f0d8e4f7ee
[harmattan/cameraplus] / qml / ImageSettingsDialog.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 import com.nokia.meego 1.1
25 import QtCamera 1.0
26
27 Dialog {
28         id: dialog
29
30         content: item
31
32         Connections {
33                 target: Qt.application
34                 onActiveChanged: {
35                         if (!Qt.application.active) {
36                                 dialog.close();
37                         }
38                 }
39         }
40
41         onStatusChanged: {
42                 if (status == DialogStatus.Open) {
43                         cam.renderingEnabled = false;
44                 }
45                 else if (status == DialogStatus.Closing) {
46                         cam.renderingEnabled = true;
47                 }
48         }
49
50         Item {
51                 id: item
52                 width: parent.width
53                 height: root.height
54
55                 Flickable {
56                         id: flickable
57                         anchors.fill: parent
58                         anchors.margins: 10
59                         contentHeight: col.height
60
61                         Column {
62                                 id: col
63
64                                 width: parent.width
65                                 spacing: 10
66
67                                 Label {
68                                         font.pixelSize: 36
69                                         text: qsTr("Image settings");
70                                 }
71
72                                 ImageResolutionSettings {
73                                         width: parent.width
74                                 }
75
76                                 TextSwitch {
77                                         text: qsTr("Enable face detection");
78                                         // We have to do it that way because QML complains about a binding
79                                         // loop for checked if we bind the checked property to the settings value.
80                                         Component.onCompleted: checked = settings.faceDetectionEnabled;
81                                         onCheckedChanged: settings.faceDetectionEnabled = checked;
82                                 }
83
84                                 CameraSettings {
85                                         anchors.horizontalCenter: parent.horizontalCenter
86                                 }
87                         }
88                 }
89         }
90 }