From ef10e1b16f9d79789cdbc8f60a1aa71854d8f762 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 20 Aug 2018 10:16:01 -0300 Subject: 'Remove from queue' menu option --- ui.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index ac7154d..9154390 100644 --- a/ui.js +++ b/ui.js @@ -122,6 +122,8 @@ class AppElement extends FocusElement { } }) + grouplikeListing.on('unqueue', item => this.unqueueGrouplikeItem(item)) + const updateListingsFor = item => { for (const grouplikeListing of this.tabber.tabberElements) { if (grouplikeListing.grouplike === item) { @@ -475,11 +477,9 @@ class AppElement extends FocusElement { } unqueueGrouplikeItem(topItem) { - // This function has support to unqueue groups (it removes all tracks in - // the group recursively), but there's no UI for that yet. That is, there - // isn't a key to unqueue an item from the main listing. (You can never - // unqueue a group from the queue listing because groups can't be added - // directly to the queue.) + // This function has support to unqueue groups - it removes all tracks in + // the group recursively. (You can never unqueue a group itself from the + // queue listing because groups can't be added directly to the queue.) const recursivelyUnqueueTracks = item => { // For groups, just unqueue all children. (Groups themselves can't be @@ -788,7 +788,7 @@ class GrouplikeListingElement extends Form { } for (const itemElement of itemElements) { - for (const evtName of ['download', 'remove', 'mark', 'paste', 'browse', 'queue', 'menu']) { + for (const evtName of ['download', 'remove', 'mark', 'paste', 'browse', 'queue', 'unqueue', 'menu']) { itemElement.on(evtName, (...data) => this.emit(evtName, itemElement.item, ...data)) } form.addInput(itemElement) @@ -990,7 +990,8 @@ class GrouplikeItemElement extends Button { this.isReal && {label: 'Play next', action: () => this.emit('queue', {where: 'next'})}, this.isReal && {label: 'Play at end', action: () => this.emit('queue', {where: 'end'})}, this.isGroup && {label: 'Play next, shuffled', action: () => this.emit('queue', {where: 'next', shuffle: true})}, - this.isGroup && {label: 'Play at end, shuffled', action: () => this.emit('queue', {where: 'end', shuffle: true})} + this.isGroup && {label: 'Play at end, shuffled', action: () => this.emit('queue', {where: 'end', shuffle: true})}, + this.isReal && {label: 'Remove from queue', action: () => this.emit('unqueue')} ] }) } -- cgit 1.3.0-6-gf8a5