« get me outta code hell

Rename queue event -> queue (at end), clean up logic - 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>2018-07-25 13:39:50 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-25 13:39:50 -0300
commitc6109e10e52c1dba3989be4b993c67830969338a (patch)
treef7defe71700f26ff4bfc9235188327e171ce4fdc /ui.js
parentf65b272760048331e142bf9c97be952dc87166ed (diff)
Rename queue event -> queue (at end), clean up logic
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/ui.js b/ui.js
index f92d259..273f43d 100644
--- a/ui.js
+++ b/ui.js
@@ -120,7 +120,7 @@ class AppElement extends FocusElement {
     grouplikeListing.on('select (enter)', item => handleSelectFromMain(item))
     grouplikeListing.on('select (space)', item => this.handleSpacePressed(
       () => handleSelectFromMain(item)))
-    grouplikeListing.on('queue', item => this.queueGrouplikeItem(item))
+    grouplikeListing.on('queue (at end)', item => this.queueGrouplikeItem(item))
     grouplikeListing.on('queue (shuffled)', item => this.shuffleQueueGrouplikeItem(item))
     grouplikeListing.on('queue (play next)', item => this.queueGrouplikeItem(item, true, this.playingTrack))
     grouplikeListing.on('menu', (item, opts) => this.menu.show(opts))
@@ -771,7 +771,7 @@ class GrouplikeListingElement extends FocusElement {
     if (this.grouplike.items.length) {
       for (const item of this.grouplike.items) {
         const itemElement = new GrouplikeItemElement(item, this.recordStore)
-        for (const evtName of ['download', 'remove (backspace)', 'remove (x)', 'mark', 'select (space)', 'select (enter)', 'queue', 'queue (shuffled)', 'queue (play next)', 'menu']) {
+        for (const evtName of ['download', 'remove (backspace)', 'remove (x)', 'mark', 'select (space)', 'select (enter)', 'queue (at end)', 'queue (shuffled)', 'queue (play next)', 'menu']) {
           itemElement.on(evtName, (...data) => this.emit(evtName, item, ...data))
         }
         form.addInput(itemElement)
@@ -937,15 +937,13 @@ class GrouplikeItemElement extends Button {
   keyPressed(keyBuf) {
     if (telc.isCaselessLetter(keyBuf, 'd')) {
       this.emit('download')
-    } else if (telc.isCaselessLetter(keyBuf, 'q')) {
-      if (keyBuf[0] === 'q'.charCodeAt(0)) {
-        this.emit('queue')
+    } else if (telc.isCharacter(keyBuf, 'q')) {
+        this.emit('queue (at end)')
+    } else if (telc.isCharacter(keyBuf, 'Q')) {
+      if (isGroup(this.item)) {
+        this.emit('queue (shuffled)')
       } else {
-        if (isGroup(this.item)) {
-          this.emit('queue (shuffled)')
-        } else {
-          this.emit('queue (play next)')
-        }
+        this.emit('queue (play next)')
       }
     } else if (telc.isSpace(keyBuf)) {
       this.emit('select (space)')