These buttons are used in the settings page only so they should not autoclose
[harmattan/cameraplus] / qml / ModeController.qml
1 // -*- qml -*-
2 import QtQuick 1.1
3 import com.nokia.meego 1.1
4 import QtCamera 1.0
5
6 Item {
7         id: controller
8         property int mode: Camera.ImageMode
9         property Camera cam: null
10         property Item dimmer: null
11         property alias animationRunning: animation.running
12
13         SequentialAnimation {
14                 id: animation
15                 property int mode: 0
16
17                 function setMode() {
18                         cam.mode = mode;
19                         controller.mode = mode;
20                 }
21
22                 NumberAnimation { target: dimmer; property: "opacity"; from: 0; to: 1; duration: 250; alwaysRunToEnd: true }
23                 ParallelAnimation {
24                         ScriptAction { script: animation.setMode(); }
25                         PauseAnimation { duration: 100 }
26                 }
27
28                 NumberAnimation { target: dimmer; property: "opacity"; from: 1; to: 0; duration: 250; alwaysRunToEnd: true }
29         }
30
31         function set(newMode) {
32                 if (mode == newMode) {
33                         return;
34                 }
35
36                 animation.start();
37
38                 animation.mode = newMode;
39         }
40 }