Don't anchor the tool bar menu button.
[harmattan/cameraplus] / qml / CaptureControl.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
25 Item {
26     id: captureControl
27
28     property bool capturePressed: false
29     property bool zoomPressed: false
30     property bool proximityClosed: false
31     property bool canceled: false
32     property bool showCancelBanner: (zoomPressed || proximityClosed) && state == "capturing"
33
34     signal startCapture
35     signal cancelCapture
36
37     states: [
38         State {
39             name: "idle"
40             when: !capturePressed && !zoomPressed && !proximityClosed
41         },
42         State {
43             name: "canceled"
44             when: canceled
45         },
46         State {
47             name: "capturing"
48             when: capturePressed || zoomPressed || proximityClosed
49         }
50     ]
51
52     state: "idle"
53
54     onStateChanged: {
55         if (state == "idle") {
56             captureControl.canceled = false
57         }
58     }
59
60     transitions: [
61         Transition {
62             from: "capturing"
63             to: "idle"
64             ScriptAction {
65                 script: captureControl.startCapture()
66             }
67         },
68         Transition {
69             from: "capturing"
70             to: "canceled"
71             ScriptAction {
72                 script: captureControl.cancelCapture()
73             }
74         }
75     ]
76 }