-
Notifications
You must be signed in to change notification settings - Fork 2
/
ContentArea.qml
162 lines (135 loc) · 4.08 KB
/
ContentArea.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import QtQuick 2.12
import QtQuick.Window 2.2
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12
import QtMultimedia 5.12
import Qt.labs.settings 1.1
Pane {
id: contentArea
z: 0
padding: 0
property MediaPlayer musicPlayer: audioPlayer
property string contentTitle: "Sounds"
property int currentContentID: 1
Pane {
id: title
width: parent.width
height: parent.height/10
leftPadding: height/5
rightPadding: height/5
topPadding: height/10
bottomPadding: height/10
opacity: 0.93
z: 9
Material.background: application.lightThemeOn ? "#e6e6e6" : "#1a1a1a"
Label {
id: titleText
text: contentArea.contentTitle
opacity: 1
//font.bold: true
color: application.Material.foreground
font.pointSize: 18
}
}
Pane {
id: soundsControl
z: 1
width: parent.width
anchors.top: title.bottom
anchors.bottom: parent.bottom
visible: false
RowLayout {
width: parent.width*(2.5/3)
height: parent.height/10
anchors.horizontalCenter: parent.horizontalCenter
spacing: 10
Image {
id: volumedown
source: application.lightThemeOn ? "qrc:/Dark/volume-down-dark" : "qrc:/Light/volume-down-light"
sourceSize.height: parent.height/2
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
onClicked: {
var v= musicPlayer.volume
v-=0.1
if(v<0.0) v=0.0
musicPlayer.volume=v
}
}
}
Slider {
id: soundsSlider
from: 0
to: 100
stepSize: 1
value: musicPlayer.volume*100
Layout.fillWidth: true
Layout.fillHeight: true
onMoved: {
musicPlayer.volume=value/100
}
}
Image {
id: volumeadd
source: application.lightThemeOn ? "qrc:/Dark/volume-add-dark" : "qrc:/Light/volume-add-light"
sourceSize.height: parent.height/2
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
onClicked: {
var v= musicPlayer.volume
v+=0.1
if(v>1.0) v=1.0
musicPlayer.volume=v
}
}
}
}
states: [
State {
name: "active"
when: contentArea.currentContentID== 3
PropertyChanges {
target: contentArea
contentTitle: "Sound : "+parseInt(soundsSlider.value)
}
PropertyChanges {
target: soundsControl
visible: true
}
}
]
}
MusicPlaylist {
id: musicList
z: 1
musicPlayer: audioPlayer
playlist: audioPlaylist
playlistName: "Now Playing"
property string title: "Playlist : "+playlistName
visible: false
states: [
State {
name: "active"
when: contentArea.currentContentID== 1
PropertyChanges {
target: contentArea
contentTitle: "Playlist : "+musicList.playlistName
}
PropertyChanges {
target: musicList
visible: true
}
}
]
}
function hideAll() {
musicList.visible= false
soundsControl.visible= false
}
function showContent(contentID) {
currentContentID= contentID
}
}