work around an issue with the connection dialog for now
[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: settings.mode
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                 }
20
21                 NumberAnimation { target: dimmer; property: "opacity"; from: 0; to: 1; duration: 150; alwaysRunToEnd: true }
22
23                 PauseAnimation { duration: 50 }
24
25                 ParallelAnimation {
26                         ScriptAction { script: animation.setMode(); }
27                         PauseAnimation { duration: 200 }
28                 }
29
30                 PauseAnimation { duration: 50 }
31
32                 NumberAnimation { target: dimmer; property: "opacity"; from: 1; to: 0; duration: 150; alwaysRunToEnd: true }
33         }
34
35         onModeChanged: {
36                 set(mode);
37         }
38
39         function set(newMode) {
40                 if (cam.mode == newMode) {
41                         return;
42                 }
43
44                 animation.mode = newMode;
45
46                 animation.start();
47         }
48 }