4 import 'config.js' as Config
8 color: "#" + config.background
9 width: config.main_width
10 height: config.main_height
12 function openContextMenu(items) {
13 contextMenu.state = 'opened'
14 contextMenu.items = [action_add_file, action_add_folder,
15 action_play_one, action_save_playlist, action_clear_playlist, action_delete_bookmarks,
16 action_about, action_quit]
18 function openAboutDialog(items) {
19 aboutDialog.state = 'opened'
20 aboutDialog.items = items
22 function set_text_x() {
23 if (cover.source == "") {
24 artist.x = (config.main_width - artist.width) / 2
25 album.x = (config.main_width - album.width) / 2
27 title_rect.width = config.main_width - 10
28 title.x = (config.main_width - title.width) / 2
31 artist.x = config.cover_height + 5
32 album.x = config.cover_height + 5
33 title_rect.x = config.cover_height + 5
34 title_rect.width = config.main_width - cover.width - 10
38 function start_scrolling_timer(start) {
40 timer_scrolling.start()
42 timer_scrolling.stop()
46 function scrolling_labels() {
47 if (cover.source == "") {
48 title.scrolling_width = config.main_width
49 title.scrolling_margin = 5
52 title.scrolling_width = config.main_width - cover.width
53 title.scrolling_margin = 5 + cover.width
55 if (title.width > title.scrolling_width) {
56 if (title.direction) {
58 if (title.width + 10 < title.scrolling_width - title.x)
59 title.direction = false
64 title.direction = true
70 interval: config.dual_delay
73 onTriggered: image_back.source = "gtk-goto-first-ltr.png"
77 interval: config.dual_delay
80 onTriggered: image_forward.source = "gtk-goto-last-ltr.png"
87 onTriggered: scrolling_labels()
93 width: config.cover_height
94 height: config.cover_height
95 sourceSize.width: config.cover_height
96 sourceSize.height: config.cover_height
98 source: main.cover_string
102 onClicked: {action_player_play.trigger()}
107 x: config.cover_height + 5
108 y: config.cover_height / 4
109 font.pixelSize: config.font_size + 1
110 color: "#" + config.foreground
111 text: main.artist_string
115 x: config.cover_height + 5
116 y: (config.cover_height / 4) + config.font_size + 21
117 font.pixelSize: config.font_size - 1
118 color: "#" + config.foreground
119 text: main.album_string
123 width: config.main_width - 10
124 height: config.font_size + 3
125 x: config.cover_height + 5
126 y: (config.cover_height / 4) + ((config.font_size*2)) + 42
127 color: "#" + config.background
131 font.pixelSize: config.font_size + 1
132 font.weight: Font.Bold
133 color: "#" + config.foreground
134 text: main.title_string
135 property bool direction
137 property int scrolling_width
138 property int scrolling_margin
145 y: config.main_height - config.button_height - config.progress_height - config.button_border_width
146 width: config.main_width
147 height: config.progress_height
148 color: "#" + config.progress_bg_color
152 onClicked: main.on_progress_clicked(mouseX / progressBar.width)
153 //onClicked: console.log(mouseX / progressBar.width)
156 color: "#" + config.progress_color
160 bottom: parent.bottom
163 width: parent.width*main.progress
167 anchors.centerIn: progressBar
168 color: "#" + config.foreground
169 font.pixelSize: config.font_size
170 text: main.time_string
171 verticalAlignment: Text.AlignVCenter
175 y: config.main_height - config.button_height
176 color: "#" + config.button_color
177 width: config.button_width
178 height: config.button_height
179 border.color: "#" + config.button_border_color
180 border.width: config.button_border_width
186 anchors.centerIn: parent
188 source: "media-skip-backward.png"
192 onReleased: image_back.source = "media-skip-backward.png"
193 onPressed: timer_back.start()
194 onClicked: { if (timer_back.running == true) {
196 action_player_rrewind.trigger()
199 action_player_skip_back.trigger()
200 image_back.source = "media-skip-backward.png" }
204 x: config.button_width + config.button_border_width + 2
205 y: config.main_height - config.button_height
206 color: "#" + config.button_color
207 width: config.button_width
208 height: config.button_height
209 border.color: "#" + config.button_border_color
210 border.width: config.button_border_width
215 anchors.centerIn: parent
217 source: "media-seek-backward.png"
221 onClicked: action_player_rewind.trigger()
225 x: (config.button_width + config.button_border_width + 2) * 2
226 y: config.main_height - config.button_height
227 color: "#" + config.button_color
228 width: config.button_width
229 height: config.button_height
230 border.color: "#" + config.button_border_color
231 border.width: config.button_border_width
237 anchors.centerIn: parent
239 source: main.play_pause_icon_path
243 onClicked: action_player_play.trigger()
247 x: (config.button_width + config.button_border_width + 2) * 3
248 y: config.main_height - config.button_height
249 color: "#" + config.button_color
250 width: config.button_width
251 height: config.button_height
252 border.color: "#" + config.button_border_color
253 border.width: config.button_border_width
258 anchors.centerIn: parent
260 source: "media-seek-forward.png"
264 onClicked: action_player_forward.trigger()
268 x: (config.button_width + config.button_border_width + 2) * 4
269 y: config.main_height - config.button_height
270 color: "#" + config.button_color
271 width: config.button_width
272 height: config.button_height
273 border.color: "#" + config.button_border_color
274 border.width: config.button_border_width
280 anchors.centerIn: parent
282 source: "media-skip-forward.png"
286 onReleased: image_forward.source = "media-skip-forward.png"
287 onPressed: timer_forward.start()
288 onClicked: { if (timer_forward.running == true) {
290 action_player_fforward.trigger()
293 action_player_skip_forward.trigger()
294 image_forward.source = "media-skip-forward.png" }
298 x: (config.button_width + config.button_border_width + 2) * 5
299 y: config.main_height - config.button_height
300 color: "#" + config.button_color
301 width: config.button_width
302 height: config.button_height
303 border.color: "#" + config.button_border_color
304 border.width: config.button_border_width
309 anchors.centerIn: parent
311 source: "bookmark-new.png"
315 onClicked: action_bookmark.trigger()
325 bottom: parent.bottom
328 onClose: contextMenu.state = 'closed'
329 //onResponse: controller.contextMenuResponse(index)
333 Behavior on opacity { NumberAnimation { duration: Config.fadeTransition } }
344 anchors.right: root.right
355 anchors.right: root.left
358 //script: controller.contextMenuClosed()
363 transitions: Transition {
364 AnchorAnimation { duration: Config.slowTransition }
374 bottom: parent.bottom
376 onClose: aboutDialog.state = 'closed'
378 Behavior on opacity { NumberAnimation { duration: Config.fadeTransition } }
389 anchors.right: root.right
400 anchors.right: root.left
403 //script: controller.contextMenuClosed()
407 transitions: Transition {
408 AnchorAnimation { duration: Config.slowTransition }