diff --git a/Persephone/Assets.xcassets/songIcon.imageset/Contents.json b/Persephone/Assets.xcassets/songIcon.imageset/Contents.json new file mode 100644 index 0000000..0ad888d --- /dev/null +++ b/Persephone/Assets.xcassets/songIcon.imageset/Contents.json @@ -0,0 +1,25 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "songIcon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "songIcon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/Persephone/Assets.xcassets/songIcon.imageset/songIcon.png b/Persephone/Assets.xcassets/songIcon.imageset/songIcon.png new file mode 100644 index 0000000..9be02f4 Binary files /dev/null and b/Persephone/Assets.xcassets/songIcon.imageset/songIcon.png differ diff --git a/Persephone/Assets.xcassets/songIcon.imageset/songIcon@2x.png b/Persephone/Assets.xcassets/songIcon.imageset/songIcon@2x.png new file mode 100644 index 0000000..cdfaaad Binary files /dev/null and b/Persephone/Assets.xcassets/songIcon.imageset/songIcon@2x.png differ diff --git a/Persephone/DataSources/QueueDataSource.swift b/Persephone/DataSources/QueueDataSource.swift index 1156240..cdfb4b4 100644 --- a/Persephone/DataSources/QueueDataSource.swift +++ b/Persephone/DataSources/QueueDataSource.swift @@ -104,8 +104,6 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource { App.store.dispatch(MPDAddSongToQueue(songUri: uri, queuePos: newQueuePos)) return true } - - return false } func outlineView(_ outlineView: NSOutlineView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forItems draggedItems: [Any]) { @@ -125,8 +123,10 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource { let component = NSDraggingImageComponent(key: NSDraggingItem.ImageComponentKey.icon) let draggedSongView = DraggedSongView(title: title, artist: artist) - component.contents = draggedSongView.view.image() - component.frame = NSRect(origin: CGPoint(), size: draggedSongView.view.image().size) + let view = draggedSongView.view + let image = view.image() + component.contents = image + component.frame = NSRect(origin: CGPoint(), size: view.frame.size) return [component] } } diff --git a/Persephone/Extensions/NSView.swift b/Persephone/Extensions/NSView.swift index 5a0bfa4..06c6142 100644 --- a/Persephone/Extensions/NSView.swift +++ b/Persephone/Extensions/NSView.swift @@ -10,8 +10,9 @@ import AppKit extension NSView { func image() -> NSImage { - let imageRepresentation = bitmapImageRepForCachingDisplay(in: bounds)! - cacheDisplay(in: bounds, to: imageRepresentation) - return NSImage(cgImage: imageRepresentation.cgImage!, size: bounds.size) + layoutSubtreeIfNeeded() + let imageRepresentation = bitmapImageRepForCachingDisplay(in: frame)! + cacheDisplay(in: frame, to: imageRepresentation) + return NSImage(cgImage: imageRepresentation.cgImage!, size: frame.size) } } diff --git a/Persephone/Resources/DraggedSongView.xib b/Persephone/Resources/DraggedSongView.xib index 5b10e05..a8259d6 100644 --- a/Persephone/Resources/DraggedSongView.xib +++ b/Persephone/Resources/DraggedSongView.xib @@ -3,50 +3,90 @@ - + - - + + - + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + diff --git a/Persephone/Views/DraggedSongView.swift b/Persephone/Views/DraggedSongView.swift index e1c24de..7c9f1c0 100644 --- a/Persephone/Views/DraggedSongView.swift +++ b/Persephone/Views/DraggedSongView.swift @@ -10,6 +10,7 @@ import Cocoa class DraggedSongView: NSViewController { @IBOutlet var titleLabel: NSTextField! + @IBOutlet var artistLabel: NSTextField! private let songTitle: String private let songArtist: String @@ -27,5 +28,6 @@ class DraggedSongView: NSViewController { override func viewDidLoad() { super.viewDidLoad() titleLabel.stringValue = songTitle + artistLabel.stringValue = songArtist } } diff --git a/Resources/export/songIcon.png b/Resources/export/songIcon.png new file mode 100644 index 0000000..9be02f4 Binary files /dev/null and b/Resources/export/songIcon.png differ diff --git a/Resources/export/songIcon@2x.png b/Resources/export/songIcon@2x.png new file mode 100644 index 0000000..cdfaaad Binary files /dev/null and b/Resources/export/songIcon@2x.png differ diff --git a/Resources/icons.sketch b/Resources/icons.sketch index f7c8c5d..0a3f564 100644 Binary files a/Resources/icons.sketch and b/Resources/icons.sketch differ