mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
No commits in common. "4d2129e6e865efef5d1ae33763603db5b7429fe1" and "202a4f0ae3de2f72bf129c44b99574e13e064920" have entirely different histories.
4d2129e6e8
...
202a4f0ae3
@ -22,6 +22,7 @@ class QueueViewController: NSViewController {
|
|||||||
$0.select { $0.queueState }
|
$0.select { $0.queueState }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// queueView.dataSource = dataSource
|
||||||
queueView.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle
|
queueView.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle
|
||||||
queueView.registerForDraggedTypes([REORDER_PASTEBOARD_TYPE])
|
queueView.registerForDraggedTypes([REORDER_PASTEBOARD_TYPE])
|
||||||
queueView.draggingDestinationFeedbackStyle = .regular
|
queueView.draggingDestinationFeedbackStyle = .regular
|
||||||
|
|||||||
@ -45,26 +45,17 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource {
|
|||||||
guard let queueItem = item as? QueueItem
|
guard let queueItem = item as? QueueItem
|
||||||
else { return nil }
|
else { return nil }
|
||||||
|
|
||||||
let pasteboardItem = NSPasteboardItem()
|
let pbItem = NSPasteboardItem()
|
||||||
|
|
||||||
pasteboardItem.setPropertyList(["queuePos": queueItem.queuePos], forType: REORDER_PASTEBOARD_TYPE)
|
pbItem.setPropertyList(["queuePos": queueItem.queuePos], forType: REORDER_PASTEBOARD_TYPE)
|
||||||
|
|
||||||
return pasteboardItem
|
return pbItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {
|
func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {
|
||||||
var newQueuePos = index - 1
|
|
||||||
|
|
||||||
guard let draggingTypes = info.draggingPasteboard.types,
|
guard let draggingTypes = info.draggingPasteboard.types,
|
||||||
draggingTypes.contains(REORDER_PASTEBOARD_TYPE),
|
draggingTypes.contains(REORDER_PASTEBOARD_TYPE),
|
||||||
let payload = info.draggingPasteboard.propertyList(forType: REORDER_PASTEBOARD_TYPE) as? [String: Int],
|
index >= 0
|
||||||
let queuePos = payload["queuePos"],
|
|
||||||
newQueuePos >= 0
|
|
||||||
else { return [] }
|
|
||||||
|
|
||||||
if newQueuePos > queuePos { newQueuePos -= 1 }
|
|
||||||
|
|
||||||
guard queuePos != newQueuePos
|
|
||||||
else { return [] }
|
else { return [] }
|
||||||
|
|
||||||
return .move
|
return .move
|
||||||
@ -79,8 +70,7 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource {
|
|||||||
|
|
||||||
if newQueuePos > queuePos { newQueuePos -= 1 }
|
if newQueuePos > queuePos { newQueuePos -= 1 }
|
||||||
|
|
||||||
guard queuePos != newQueuePos
|
guard queuePos != newQueuePos else { return false }
|
||||||
else { return false }
|
|
||||||
|
|
||||||
App.store.dispatch(MPDMoveSongInQueue(oldQueuePos: queuePos, newQueuePos: newQueuePos))
|
App.store.dispatch(MPDMoveSongInQueue(oldQueuePos: queuePos, newQueuePos: newQueuePos))
|
||||||
|
|
||||||
|
|||||||
@ -37,12 +37,7 @@ extension MPDClient {
|
|||||||
}
|
}
|
||||||
if mpdIdle.contains(.queue) {
|
if mpdIdle.contains(.queue) {
|
||||||
self.fetchQueue()
|
self.fetchQueue()
|
||||||
self.fetchStatus()
|
|
||||||
|
|
||||||
self.delegate?.didUpdateQueue(mpdClient: self, queue: self.queue)
|
self.delegate?.didUpdateQueue(mpdClient: self, queue: self.queue)
|
||||||
if let status = self.status {
|
|
||||||
self.delegate?.didUpdateQueuePos(mpdClient: self, song: status.song)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if mpdIdle.contains(.player) || mpdIdle.contains(.options) {
|
if mpdIdle.contains(.player) || mpdIdle.contains(.options) {
|
||||||
self.fetchStatus()
|
self.fetchStatus()
|
||||||
|
|||||||
@ -8,14 +8,8 @@
|
|||||||
|
|
||||||
import AppKit
|
import AppKit
|
||||||
|
|
||||||
struct QueueItem: Hashable {
|
struct QueueItem: Equatable {
|
||||||
var song: Song
|
var song: Song
|
||||||
var queuePos: Int
|
var queuePos: Int
|
||||||
var isPlaying: Bool
|
var isPlaying: Bool
|
||||||
|
|
||||||
func hash(into hasher: inout Hasher) {
|
|
||||||
hasher.combine(song)
|
|
||||||
hasher.combine(queuePos)
|
|
||||||
hasher.combine(isPlaying)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,13 +43,3 @@ extension Song: Equatable {
|
|||||||
(lhs.album == rhs.album)
|
(lhs.album == rhs.album)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Song: Hashable {
|
|
||||||
func hash(into hasher: inout Hasher) {
|
|
||||||
hasher.combine(mpdSong.uriString)
|
|
||||||
hasher.combine(trackNumber)
|
|
||||||
hasher.combine(title)
|
|
||||||
hasher.combine(artist)
|
|
||||||
hasher.combine(album.title)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -578,17 +578,17 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="328" height="548"/>
|
<rect key="frame" x="0.0" y="0.0" width="328" height="548"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="22" horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="S3o-nF-NN7">
|
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="S3o-nF-NN7">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
|
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<clipView key="contentView" drawsBackground="NO" id="WI8-Pw-03L">
|
<clipView key="contentView" drawsBackground="NO" id="WI8-Pw-03L">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
|
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowHeight="22" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="14" outlineTableColumn="0Co-uF-CCB" id="jEJ-jg-fll" customClass="QueueView" customModule="Persephone" customModuleProvider="target">
|
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="16" outlineTableColumn="0Co-uF-CCB" id="jEJ-jg-fll" customClass="QueueView" customModule="Persephone" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
|
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<size key="intercellSpacing" width="3" height="0.0"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
<color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||||
<tableColumns>
|
<tableColumns>
|
||||||
@ -606,7 +606,7 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="queueHeadingCell" id="GOd-cg-juD">
|
<tableCellView identifier="queueHeadingCell" id="GOd-cg-juD">
|
||||||
<rect key="frame" x="1" y="0.0" width="200" height="17"/>
|
<rect key="frame" x="1" y="1" width="200" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xgd-Cz-np3">
|
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xgd-Cz-np3">
|
||||||
@ -627,7 +627,7 @@
|
|||||||
</constraints>
|
</constraints>
|
||||||
</tableCellView>
|
</tableCellView>
|
||||||
<tableCellView identifier="songTitleCell" id="5rR-Gz-AcP" customClass="QueueSongTitleView" customModule="Persephone" customModuleProvider="target">
|
<tableCellView identifier="songTitleCell" id="5rR-Gz-AcP" customClass="QueueSongTitleView" customModule="Persephone" customModuleProvider="target">
|
||||||
<rect key="frame" x="1" y="17" width="200" height="17"/>
|
<rect key="frame" x="1" y="20" width="200" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView identifier="queuePlayerState" translatesAutoresizingMaskIntoConstraints="NO" id="o8i-cz-hIP" userLabel="Player State View">
|
<imageView identifier="queuePlayerState" translatesAutoresizingMaskIntoConstraints="NO" id="o8i-cz-hIP" userLabel="Player State View">
|
||||||
@ -687,7 +687,7 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="songArtistCell" id="JSk-Vc-Y7e">
|
<tableCellView identifier="songArtistCell" id="JSk-Vc-Y7e">
|
||||||
<rect key="frame" x="204" y="0.0" width="122" height="17"/>
|
<rect key="frame" x="204" y="1" width="122" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user