summaryrefslogtreecommitdiff
path: root/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'main.qml')
-rw-r--r--main.qml30
1 files changed, 24 insertions, 6 deletions
diff --git a/main.qml b/main.qml
index ab7a07a..12a0f3d 100644
--- a/main.qml
+++ b/main.qml
@@ -9,6 +9,8 @@ import BassPlayer 0.1
ApplicationWindow {
visible: true
+ height: 400
+ width: 600
title: "Bass Player!"
@@ -35,9 +37,9 @@ ApplicationWindow {
title: "Duration"
}
onClicked: {
- console.log(song.current_song)
- song.song_selected(row)
- console.log(song.current_song)
+ var tmp = song.song_selected(row)
+ audioInterface.source = tmp.path
+ durationText.text = song.ms_to_time(tmp.duration)
}
}
@@ -62,6 +64,9 @@ ApplicationWindow {
role: "to"
title: "To"
}
+ onClicked: {
+ song.segment_selected(row)
+ }
}
}
FileDialog {
@@ -84,6 +89,11 @@ ApplicationWindow {
Layout.fillWidth: true
}
Text {
+ id: currentPositionText
+ text: { '--:--' }
+ }
+ Text { text: '/' }
+ Text {
id: durationText
text: { '--:--' }
}
@@ -101,7 +111,6 @@ ApplicationWindow {
onClicked: {
audioInterface.play()
timer.start()
- durationText.text = song.ms_to_time(audioInterface.duration)
}
}
Button {
@@ -142,7 +151,16 @@ ApplicationWindow {
running: false
repeat: true
onTriggered: {
+ currentPositionText.text = song.ms_to_time(audioInterface.position)
slider.value = audioInterface.position / audioInterface.duration
+
+ // Cool segment
+ if (song.current_segment) {
+ if(audioInterface.position < song.current_segment.from ||
+ audioInterface.position > song.current_segment.to) {
+ audioInterface.seek(song.current_segment.from)
+ }
+ }
}
}
@@ -166,11 +184,11 @@ ApplicationWindow {
}
TextField {
id: textviewFrom
- placeholderText: "From"
+ placeholderText: "00:00"
}
TextField {
id: textviewTo
- placeholderText: "To"
+ placeholderText: "00:00"
}
}
}