« get me outta code hell

reveal in queue - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-08-06 15:57:42 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-08-06 15:57:42 -0300
commit341a34320e89ed1ebc29c5a9c8675d18dd02e185 (patch)
tree1ee07efa5ebb2240e15f1de1e28ca8475b1f68fe
parent4e0cb3a38deb8600cbcacb3f87b9e6dba8930aa1 (diff)
reveal in queue
-rw-r--r--todo.txt5
-rw-r--r--ui.js17
2 files changed, 18 insertions, 4 deletions
diff --git a/todo.txt b/todo.txt
index 7e5fa1c..3b29b7e 100644
--- a/todo.txt
+++ b/todo.txt
@@ -626,3 +626,8 @@ TODO: "Alphabetize order of groups" order option. Listen to the releases of
       an artist, or your whole library, alphabetically - or prefix group names
       with the date of release and play works chronologically! Or do whatever
       other shenanigansy inline metadata you like.
+      (Done!)
+
+TODO: "Reveal in queue" option in the context menu for tracks that are part of
+      the queue! Also, rename existing "Reveal" option to "Reveal in library".
+      (Done!)
diff --git a/ui.js b/ui.js
index b586335..49308fe 100644
--- a/ui.js
+++ b/ui.js
@@ -772,12 +772,12 @@ class AppElement extends FocusElement {
     // (made by newGrouplikeListing) as well as the queue grouplike listing.
 
     grouplikeListing.on('timestamp', (item, time) => this.playOrSeek(item, time))
-    grouplikeListing.pathElement.on('select', (item, child) => this.reveal(item, child))
+    grouplikeListing.pathElement.on('select', (item, child) => this.revealInLibrary(item, child))
     grouplikeListing.on('menu', (item, el) => this.showMenuForItemElement(el, grouplikeListing))
     /*
     grouplikeListing.on('select', item => this.editNotesFile(item, false))
     grouplikeListing.on('edit-notes', item => {
-      this.reveal(item)
+      this.revealInLibrary(item)
       this.editNotesFile(item, true)
     })
     */
@@ -798,7 +798,7 @@ class AppElement extends FocusElement {
     grouplikeListing.loadGrouplike(grouplike, ...args)
   }
 
-  reveal(item, child) {
+  revealInLibrary(item, child) {
     if (!this.tabberPane.visible) {
       return
     }
@@ -820,6 +820,13 @@ class AppElement extends FocusElement {
     }
   }
 
+  revealInQueue(item) {
+    const queueListing = this.queueListingElement
+    if (queueListing.selectAndShow(item)) {
+      this.root.select(queueListing)
+    }
+  }
+
   play(item) {
     if (!this.config.canControlQueue) {
       return
@@ -1353,10 +1360,11 @@ class AppElement extends FocusElement {
         ? {label: 'Collapse saved timestamps', action: () => this.collapseTimestamps(item, listing)}
         : {label: 'Expand saved timestamps', action: () => this.expandTimestamps(item, listing)}
       )
+      const isQueued = this.SQP.queueGrouplike.items.includes(item)
 
       if (listing.grouplike.isTheQueue && isTrack(item)) {
         return [
-          item[parentSymbol] && this.tabberPane.visible && {label: 'Reveal', action: () => this.reveal(item)},
+          item[parentSymbol] && this.tabberPane.visible && {label: 'Reveal in library', action: () => this.revealInLibrary(item)},
           timestampsItem,
           {divider: true},
           canControlQueue && {label: 'Play later', action: () => this.playLater(item)},
@@ -1415,6 +1423,7 @@ class AppElement extends FocusElement {
           hasNotesFile && isPlayable(item) && {label: 'Edit notes file', action: () => this.editNotesFile(item, true)},
           */
           canControlQueue && isPlayable(item) && {label: 'Remove from queue', action: () => this.unqueue(item)},
+          isTrack(item) && isQueued && {label: 'Reveal in queue', action: () => this.revealInQueue(item)},
           {divider: true},
 
           timestampsItem,