-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.qml
130 lines (116 loc) · 3.96 KB
/
main.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
import QtQuick 2.3
import QtQuick.Window 2.1
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.1
import VetmupPlayerQML 1.0
import vetmup.style 1.0
Window {
id:main
visible: true
width: 480
height: 720
//Load font
FontLoader { id: mainFont; source: "Fonts/Quickhand" }
//Player
VetmupPlayer{
id: myVetmupPlayer
onSongChangedSignal: {
tabPlayer.timeSliderValue = 0;
tabPlayer.timeSliderMinimumValue = 0;
tabPlayer.timeSliderMaximumValue = duration;
tabPlayer.mainTextString= title;
tabPlaylist.listSongsCurrentIndex = index;
tabPlayer.textTimeSliderTotal = durationText;
}
onSongMetaDataChangedSignal:{
if(sourceUrl== "")
tabPlayer.songImageSource = VetmupStyle.defaultSongImage;
else
tabPlayer.songImageSource = sourceUrl;
}
onSliderPositionChangedSignal:{
if(!tabPlayer.children[0].children[1].children[2].children[1].pressed){
tabPlayer.timeSliderValue = position;
tabPlayer.textTimeSliderCurrent = positionText;
}
}
onSongAddedSignal:{
tabPlaylist.listModelSongs.append({"title": title})
}
onDeletePlaylistSignal:{
tabPlayer.mainTextString = VetmupStyle.textDefaultPlayer
tabPlaylist.listModelSongs.remove(0,tabPlaylist.listModelSongs.count);
tabPlayer.textTimeSliderCurrent = VetmupStyle.textDefaultTimeSlider;
tabPlayer.textTimeSliderTotal = VetmupStyle.textDefaultTimeSlider;
}
onDeleteSongSignal:{
if(!myVetmupPlayer.HasSongs()){
tabPlayer.mainTextString = VetmupStyle.textDefaultPlayer
}
tabPlaylist.listModelSongs.remove(index);
}
}
//File Dialog
VetmupFileDialog{
id:fileDialog
onAccepted: {
myVetmupPlayer.OpenFiles(fileDialog.fileUrls)
}
}
//Save Dialog
VetmupSaveDialog{
id:saveDialog
onAccepted: {
myVetmupPlayer.SavePlaylist(saveDialog.fileUrl)
}
}
//Folder Dialog
VetmupFolderDialog{
id:folderDialog
onAccepted: {
myVetmupPlayer.OpenFolder(folderDialog.fileUrl)
}
}
//User Interface
TabView {
id: tabView
anchors.fill: parent
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {
color: styleData.selected ? VetmupStyle.colorHighlight :VetmupStyle.colorNormal
implicitWidth: tabView.width/2
implicitHeight: tabView.height/15
radius: 2
Text {
id: text
anchors.centerIn: parent
text: styleData.title
font.family: mainFont.name
font.pixelSize: tabView.height/20
color: styleData.selected ? VetmupStyle.colorTextSelected :VetmupStyle.colorText
}
}
}
Tab {
id:tabPlayer
title: qsTr("Player")
source: "Player.qml"
property int timeSliderValue:0
property int timeSliderMinimumValue:0
property int timeSliderMaximumValue:100
property string mainTextString: VetmupStyle.textDefaultPlayer
property string textTimeSliderTotal:VetmupStyle.textDefaultTimeSlider
property string textTimeSliderCurrent:VetmupStyle.textDefaultTimeSlider
property string songImageSource:VetmupStyle.defaultSongImage;
}
Tab {
id: tabPlaylist
title: "Playlist"
source: "Playlist.qml"
property int listSongsCurrentIndex
property ListModel listModelSongs: ListModel {}
}
}
}