Removal of libhomescreen and appfw deps
[apps/homescreen.git] / homescreen / qml / MediaAreaBlank.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 import QtQuick 2.2
19 import QtQuick.Layouts 1.1
20 import QtQuick.Controls 2.0
21 //import AGL.Demo.Controls 1.0
22 //import MasterVolume 1.0
23
24 Image {
25     anchors.fill: parent
26     source: './images/Utility_Logo_Background-01.svg'
27     property bool displayVolume: false;
28
29     MouseArea {
30         anchors.fill: parent
31         function enableVolumeDisplay() {
32             if (!displayVolume) {
33                 displayVolume = true
34                 master_volume.visible = true
35                 volume_timer.restart()
36             }
37         }
38         onClicked: enableVolumeDisplay()
39     }
40
41     Image {
42         id: logo_image
43         anchors.centerIn: parent
44         source: './images/Utility_Logo_Grey-01.svg'
45     }
46
47     Timer {
48         id: volume_timer
49         interval: 3000; running: false; repeat: false
50         onTriggered: displayVolume = false
51     }
52
53     states: [
54     State { when: displayVolume;
55     PropertyChanges { target: master_volume; opacity: 1.0 }
56     PropertyChanges { target: slider; enabled: true }
57     PropertyChanges { target: logo_image; opacity: 0.0 }
58     },
59     State { when: !displayVolume;
60     PropertyChanges { target: master_volume; opacity: 0.0 }
61     PropertyChanges { target: slider; enabled: false }
62     PropertyChanges { target: logo_image; opacity: 1.0 }
63     }
64     ]
65
66     transitions: Transition {
67     NumberAnimation { property: "opacity"; duration: 500}
68     }
69
70     //MasterVolume {
71     //    id: mv
72     //    objectName: "mv"
73     //    onVolumeChanged: slider.value = volume
74     //    Component.onCompleted: {
75     //        mv.open(bindingAddress);
76     //    }
77     //}
78
79     Item {
80         id: mv
81         property double volume: 0
82     }
83
84     Item {
85         id: master_volume
86         anchors.fill: parent
87         anchors.centerIn: parent
88         visible: false
89
90         Label {
91             font.pixelSize: 36
92             anchors.horizontalCenter: parent.horizontalCenter
93             color: "white"
94             text: qsTr("Master Volume")
95         }
96
97         RowLayout {
98             anchors.fill: parent
99             anchors.centerIn: parent
100             anchors.margins: 20
101             spacing: 20
102             Label {
103                 font.pixelSize: 36
104                 color: "white"
105                 text: "0 %"
106             }
107             Slider {
108                 id: slider
109                 Layout.fillWidth: true
110                 from: 0
111                 to: 100
112                 stepSize: 1
113                 snapMode: Slider.SnapOnRelease
114                 onValueChanged: mv.volume = value
115                 Component.onCompleted: value = mv.volume
116                 onPressedChanged: {
117                     if (pressed) {volume_timer.stop()}
118                     else {volume_timer.restart()}
119                 }
120             }
121             Label {
122                 font.pixelSize: 36
123                 color: "white"
124                 text: "100 %"
125             }
126         }
127     }
128
129     //SpeechChrome {
130     //    id: speech_chrome
131     //    anchors.left: parent.left
132     //    anchors.right: parent.right
133     //    anchors.bottom: parent.bottom
134     //    height: parent.height
135     //}
136 }