-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.qml
188 lines (152 loc) · 5.2 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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
* Copyright (C) 2021 Beijing Jingling Information System Technology Co., Ltd. All rights reserved.
*
* Authors:
* Yu Jiashu <[email protected]>
*
*/
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.15 as Kirigami
import org.kde.mauikit 1.0 as Maui
import org.kde.mauikit 1.1 as MauiLab
import org.maui.vvave 1.0 as Vvave
import jingos.display 1.0
import Player 1.0
import AlbumsList 1.0
import PlaylistsList 1.0
import org.jingos.media 1.0
import "utils"
import "widgets"
import "db/Queries.js" as Q
import "utils/Help.js" as H
import "utils/Player.js" as PlayerOP
import QtQml 2.12
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Shapes 1.12
import QtQml.Models 2.15
import QtQuick.Window 2.15
Kirigami.ApplicationWindow {
id: root
/***************************************************/
/******************** ALIASES ********************/
/*************************************************/
property alias mainPlaylist: playerview.musicGridView
property alias selectionBar: _selectionBar
property alias progressBar: playerview.progressBar
// property alias dialog : _dialogLoader.item
/***************************************************/
/******************** PLAYBACK ********************/
/*************************************************/
/****** 0--play in order 1--Shuffle Playback 2--Single cycle ********/
property int playType: Maui.FM.loadSettings("SHUFFLE","PLAYBACK", 0)
property var currentTrack: playerview.musicGridView.gridView.itemAtIndex(currentTrackIndex)
property int currentTrackIndex: -1
property int prevTrackIndex: 0
/****** 1--storage 2--del 3--batch storage 4--batch del(video); 5--storage 6--del 7--batch storage 8--batch del(Music) ******/
property int jDialogType: 1
/****** 1--all 2--like 3--lately(video); 4--all 5--like 6--lately(Music) ******/
property int currentPage: 1
/****** ******/
property int currentPlayPage: 4
property alias durationTimeLabel: player.duration
property string progressTimeLabel: "00:00"
property alias isPlaying: player.playing
property int onQueue: 0
property bool mainlistEmpty: !playerview.musicGridView.gridView.count > 0
property string syncPlaylist: ""
property bool sync: false
property bool focusView : false
property bool musicSelectionMode : false
property bool videoSelectionMode : false
property bool noResultState: false
property bool isDarkTheme: Kirigami.JTheme.colorScheme === "jingosDark"
/***************************************************/
/******************** UI COLORS *******************/
/*************************************************/
readonly property color babeColor: "#f84172"
property bool translucency : Maui.Handy.isLinux
property string filterStatus: ""
property var appScaleSize: JDisplay.dp(1.0)
property var appFontSize: JDisplay.sp(1.0)
/*SIGNALS*/
signal missingAlert(var track)
property int playStartIndex: -1
property bool playMusicFlag: false
property int selectAllLength: 0
property bool fav
property var currentCover
property string playlistQuery
property var queryjs: Q
property var helpjs: H
property var playerOP: PlayerOP
property var vvaveControl: Vvave
property var playerMainView: playerview
width: root.screen.width
height: root.screen.height
title: currentTrack ? currentTrack.title + " - " + currentTrack.artist + " | " + currentTrack.album : ""
background.opacity: translucency ? 0.5 : 1
color: Kirigami.JTheme.background
pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.None
pageStack.interactive: false
Component.onCompleted:{
Vvave.JAppControl.setAppstatus(false)
playerview.playerviewleft.setCurrentPage(1, true)
}
/*HANDLE EVENTS*/
onClosing: {
PlayerOP.savePlaylist()
}
onMissingAlert: {
var message = qsTr("Missing file")
var messageBody = track.title + " by " + track.artist + " is missing.\nDo you want to remove it from your collection?"
notify("dialog-question", message, messageBody, function () {
playerview.musicGridView.model.list.remove(playerview.musicGridView.gridView.currentIndex)
})
}
pageStack.initialPage: PlayerView {
id: playerview
}
Loading {
id: _loading
}
Timer {
id: timer
running: false
repeat: false
interval: 800
onTriggered: {
if (!mainlistEmpty) {
if (currentTrack && currentTrack.url)
PlayerOP.nextTrack(true)
playerview.isFav()
}
}
}
Player {
id: player
volume: 100
onFinishedChanged: {
timer.start()
}
}
SelectionBar1 {
id: _selectionBar
}
Loader {
id: _dialogLoader
}
Mpris2 {
id: mpris2Interface
playListModel: playerview.musicGridView.model.list
audioPlayer: player
playerName: 'media'
onRaisePlayer: {
root.raise()
}
}
ListModel {
id:previewimagemodel
}
}