mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Create constants for sizes
This commit is contained in:
parent
555a99d5be
commit
f878daad2c
@ -104,6 +104,7 @@
|
||||
E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */; };
|
||||
E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53D22349002009A20F3 /* MPDIdle.swift */; };
|
||||
E4D3BFA622B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */; };
|
||||
E4DA820623D6236200C1EE58 /* NSSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4DA820523D6236200C1EE58 /* NSSize.swift */; };
|
||||
E4E7A6AD22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */; };
|
||||
E4E8CC902204EC7F0024217A /* Delegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E8CC8F2204EC7F0024217A /* Delegate.swift */; };
|
||||
E4E8CC922204F4B80024217A /* QueueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E8CC912204F4B80024217A /* QueueViewController.swift */; };
|
||||
@ -297,6 +298,7 @@
|
||||
E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; };
|
||||
E4C8B53D22349002009A20F3 /* MPDIdle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDIdle.swift; sourceTree = "<group>"; };
|
||||
E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueueViewController+NSOutlineViewDelegate.swift"; sourceTree = "<group>"; };
|
||||
E4DA820523D6236200C1EE58 /* NSSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSSize.swift; sourceTree = "<group>"; };
|
||||
E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AlbumDetailView+NSTableViewDelegate.swift"; sourceTree = "<group>"; };
|
||||
E4E8CC8F2204EC7F0024217A /* Delegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Delegate.swift; sourceTree = "<group>"; };
|
||||
E4E8CC912204F4B80024217A /* QueueViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueViewController.swift; sourceTree = "<group>"; };
|
||||
@ -424,6 +426,7 @@
|
||||
E489E39822B85D0400CA8CBD /* NSPasteboard.swift */,
|
||||
E489E39C22B9CF0000CA8CBD /* NSView.swift */,
|
||||
E43AC1F022C68E6A001E483C /* NSPasteboardItem.swift */,
|
||||
E4DA820523D6236200C1EE58 /* NSSize.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
@ -940,6 +943,7 @@
|
||||
E43B67AD229194CD007DCF55 /* AlbumTracksDataSource.swift in Sources */,
|
||||
E41E52FD223BF87300173814 /* MPDClient+Connection.swift in Sources */,
|
||||
E450AD7E222620A10091BED3 /* Album.swift in Sources */,
|
||||
E4DA820623D6236200C1EE58 /* NSSize.swift in Sources */,
|
||||
E408D3B6220DD8970006D9BE /* Notification.swift in Sources */,
|
||||
E43AC1F822C7065A001E483C /* AlbumCoverButton.swift in Sources */,
|
||||
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
||||
|
||||
@ -64,7 +64,7 @@ class AlbumViewItem: NSCollectionViewItem {
|
||||
with: .provider(provider),
|
||||
placeholder: NSImage.defaultCoverArt,
|
||||
options: [
|
||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 180, height: 180))),
|
||||
.processor(DownsamplingImageProcessor(size: .albumListCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
)
|
||||
|
||||
@ -141,7 +141,7 @@ class AlbumDetailView: NSViewController {
|
||||
with: .provider(provider),
|
||||
placeholder: NSImage.defaultCoverArt,
|
||||
options: [
|
||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 500, height: 500))),
|
||||
.processor(DownsamplingImageProcessor(size: .albumDetailCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
)
|
||||
|
||||
@ -24,11 +24,11 @@ class CurrentCoverArtView: NSImageView {
|
||||
|
||||
let imageURL = URL(fileURLWithPath: imagePath)
|
||||
let provider = LocalFileImageDataProvider(fileURL: imageURL)
|
||||
self.kf.setImage(
|
||||
kf.setImage(
|
||||
with: .provider(provider),
|
||||
placeholder: NSImage.defaultCoverArt,
|
||||
options: [
|
||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 500, height: 500))),
|
||||
.processor(DownsamplingImageProcessor(size: .currentlyPlayingCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
)
|
||||
@ -39,10 +39,11 @@ extension CurrentCoverArtView: StoreSubscriber {
|
||||
typealias StoreSubscriberStateType = Song?
|
||||
|
||||
func newState(state: Song?) {
|
||||
if let song = state {
|
||||
setAlbumImage(song.album)
|
||||
} else {
|
||||
guard let song = state else {
|
||||
image = .defaultCoverArt
|
||||
return
|
||||
}
|
||||
|
||||
setAlbumImage(song.album)
|
||||
}
|
||||
}
|
||||
|
||||
16
Persephone/Components/Shared/Extensions/NSSize.swift
Normal file
16
Persephone/Components/Shared/Extensions/NSSize.swift
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// NSSize.swift
|
||||
// Persephone
|
||||
//
|
||||
// Created by Daniel Barber on 1/20/20.
|
||||
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
|
||||
extension NSSize {
|
||||
static let albumListCoverSize = NSSize(width: 180, height: 180)
|
||||
static let albumDetailCoverSize = NSSize(width: 500, height: 500)
|
||||
static let currentlyPlayingCoverSize = albumDetailCoverSize
|
||||
static let notificationCoverSize = albumListCoverSize
|
||||
}
|
||||
@ -29,7 +29,7 @@ class UserNotificationsController {
|
||||
_ = KingfisherManager.shared.retrieveImage(
|
||||
with: .provider(provider),
|
||||
options: [
|
||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 180, height: 180))),
|
||||
.processor(DownsamplingImageProcessor(size: .notificationCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
) { result in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user