« get me outta code hell

'Clear past / up to this track' queue menu options - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-09-10 12:23:41 -0300
committerFlorrie <towerofnix@gmail.com>2019-09-10 12:23:41 -0300
commit47bd859d1a02683395bbf941d7dc0375d7ef8334 (patch)
tree484c6fdc82af9b14a2ff1e6894d2ad3b060aa3c6 /ui.js
parent366b6e90f1d237a8e1e0d92224f65990157d0cd6 (diff)
'Clear past / up to this track' queue menu options
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index 8d13f57..fb73061 100644
--- a/ui.js
+++ b/ui.js
@@ -565,6 +565,24 @@ class AppElement extends FocusElement {
     this.queueListingElement.selectAndShow(item)
   }
 
+  clearQueuePast(item) {
+    if (!this.config.canControlQueue) {
+      return
+    }
+
+    this.backend.clearQueuePast(item)
+    this.queueListingElement.selectAndShow(item)
+  }
+
+  clearQueueUpTo(item) {
+    if (!this.config.canControlQueue) {
+      return
+    }
+
+    this.backend.clearQueueUpTo(item)
+    this.queueListingElement.selectAndShow(item)
+  }
+
   deselectAll() {
     this.markGrouplike.items.splice(0)
   }
@@ -599,6 +617,10 @@ class AppElement extends FocusElement {
         {divider: true},
         canControlQueue && {label: 'Play later', action: () => this.playLater(item)},
         canControlQueue && {label: 'Play sooner', action: () => this.playSooner(item)},
+        {divider: true},
+        canControlQueue && {label: 'Clear past this track', action: () => this.clearQueuePast(item)},
+        canControlQueue && {label: 'Clear up to this track', action: () => this.clearQueueUpTo(item)},
+        {divider: true},
         canControlQueue && {label: 'Remove from queue', action: () => this.unqueue(item)}
       ]
     } else {