diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-04-26 13:15:09 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-16 22:29:25 -0300 |
commit | ebbdaa3473b4885468eb27922e24511c93b962ca (patch) | |
tree | b9e203691a5089edd48fb8b9eadc6a0add38e904 /ui.js | |
parent | 4bee8ad4fc1c315055d0d3377f8140b02cd51621 (diff) |
synchronize shared sources on join + other stuff
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/ui.js b/ui.js index 7e36858..371da80 100644 --- a/ui.js +++ b/ui.js @@ -264,8 +264,6 @@ export default class AppElement extends FocusElement { this.metadataStatusLabel.visible = false this.tabberPane.addChild(this.metadataStatusLabel) - this.newGrouplikeListing() - this.queueListingElement = new QueueListingElement(this) this.setupCommonGrouplikeListingEvents(this.queueListingElement) this.queuePane.addChild(this.queueListingElement) @@ -285,6 +283,11 @@ export default class AppElement extends FocusElement { this.queueListingElement.on('select main listing', () => this.selected()) + if (this.config.showPartyControls) { + const sharedSourcesListing = this.newGrouplikeListing() + sharedSourcesListing.loadGrouplike(this.backend.sharedSourcesGrouplike) + } + this.playbackPane = new Pane() this.addChild(this.playbackPane) @@ -481,8 +484,8 @@ export default class AppElement extends FocusElement { 'handleRemovedQueuePlayer', 'handleSetLoopQueueAtEnd', 'handleLogMessage', - 'handleGotPartyGrouplike', - 'handlePartyGrouplikeUpdated' + 'handleGotSharedSources', + 'handleSharedSourcesUpdated' ]) { this[key] = this[key].bind(this) } @@ -555,8 +558,8 @@ export default class AppElement extends FocusElement { this.backend.on('removed queue player', this.handleRemovedQueuePlayer) this.backend.on('set-loop-queue-at-end', this.handleSetLoopQueueAtEnd) this.backend.on('log message', this.handleLogMessage) - this.backend.on('got party grouplike', this.handleGotPartyGrouplike) - this.backend.on('party grouplike updated', this.handlePartyGrouplikeUpdated) + this.backend.on('got shared sources', this.handleGotSharedSources) + this.backend.on('shared sources updated', this.handleSharedSourcesUpdated) } removeBackendListeners() { @@ -565,8 +568,8 @@ export default class AppElement extends FocusElement { this.backend.removeListener('removed queue player', this.handleRemovedQueuePlayer) this.backend.removeListener('set-loop-queue-at-end', this.handleSetLoopQueueAtEnd) this.backend.removeListener('log message', this.handleLogMessage) - this.backend.removeListener('got party grouplike', this.handleGotPartyGrouplike) - this.backend.removeListener('party grouplike updated', this.handlePartyGrouplikeUpdated) + this.backend.removeListener('got shared sources', this.handleGotSharedSources) + this.backend.removeListener('shared sources updated', this.handleSharedSourcesUpdated) } handleAddedQueuePlayer(queuePlayer) { @@ -588,16 +591,21 @@ export default class AppElement extends FocusElement { this.log.newLogMessage(messageInfo) } - handleGotPartyGrouplike(socketId, partyGrouplike) { - this.newPartyTab(socketId, partyGrouplike) + handleGotSharedSources(socketId, sharedSources) { + for (const grouplikeListing of this.tabber.tabberElements) { + if (grouplikeListing.grouplike === this.backend.sharedSourcesGrouplike) { + grouplikeListing.loadGrouplike(this.backend.sharedSourcesGrouplike, false) + } + } } - handlePartyGrouplikeUpdated(socketId, partyGrouplike) { + handleSharedSourcesUpdated(socketId, partyGrouplike) { for (const grouplikeListing of this.tabber.tabberElements) { if (grouplikeListing.grouplike === partyGrouplike) { grouplikeListing.loadGrouplike(partyGrouplike, false) } } + this.clearCachedMarkStatuses() } async handlePlayingDetails(track, oldTrack, startTime, queuePlayer) { @@ -1093,7 +1101,11 @@ export default class AppElement extends FocusElement { } emitMarkChanged() { + this.clearCachedMarkStatuses() this.emit('mark changed') + } + + clearCachedMarkStatuses() { this.cachedMarkStatuses = new Map() this.scheduleDrawWithoutPropertyChange() } @@ -1961,11 +1973,6 @@ export default class AppElement extends FocusElement { }) } - newPartyTab(socketId, partyGrouplike) { - const listing = this.newGrouplikeListing() - listing.loadGrouplike(partyGrouplike) - } - cloneCurrentTab() { const grouplike = this.tabber.currentElement.grouplike const listing = this.newGrouplikeListing() |