From deb34d6c3de29f36719677f9bad5151e6bbd7f5c Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Fri, 27 Sep 2019 10:39:51 -0400 Subject: [PATCH] WIP --- Persephone.xcodeproj/project.pbxproj | 24 ++ .../xcshareddata/swiftpm/Package.resolved | 70 ------ .../Controllers/ArtistViewController.swift | 13 + Persephone/Controllers/ArtistViewItem.swift | 26 ++ Persephone/Controllers/BrowseController.swift | 32 +++ Persephone/Resources/ArtistViewItem.xib | 37 +++ .../Resources/Base.lproj/Main.storyboard | 225 ++++++++++++++++-- Persephone/State/ArtistListState.swift | 13 + Persephone/Views/BrowseViewButton.swift | 23 ++ 9 files changed, 368 insertions(+), 95 deletions(-) delete mode 100644 Persephone.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Persephone/Controllers/ArtistViewController.swift create mode 100644 Persephone/Controllers/ArtistViewItem.swift create mode 100644 Persephone/Controllers/BrowseController.swift create mode 100644 Persephone/Resources/ArtistViewItem.xib create mode 100644 Persephone/State/ArtistListState.swift create mode 100644 Persephone/Views/BrowseViewButton.swift diff --git a/Persephone.xcodeproj/project.pbxproj b/Persephone.xcodeproj/project.pbxproj index 1decbdb..78aabe2 100644 --- a/Persephone.xcodeproj/project.pbxproj +++ b/Persephone.xcodeproj/project.pbxproj @@ -103,6 +103,12 @@ E4B11BC02275EE150075461B /* QueueActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B11BBF2275EE150075461B /* QueueActions.swift */; }; E4B11BC22275EE410075461B /* AlbumListActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B11BC12275EE410075461B /* AlbumListActions.swift */; }; E4B5AE7E22F4C49600CCEC65 /* MPDServerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */; }; + E4BBD2E923356DC100702C16 /* BrowseViewButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BBD2E823356DC100702C16 /* BrowseViewButton.swift */; }; + E4BBD2EB2335735500702C16 /* BrowseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BBD2EA2335735500702C16 /* BrowseController.swift */; }; + E4BBD2ED2335798E00702C16 /* ArtistViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BBD2EC2335798E00702C16 /* ArtistViewController.swift */; }; + E4BBD2F0233579EF00702C16 /* ArtistViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BBD2EE233579EF00702C16 /* ArtistViewItem.swift */; }; + E4BBD2F1233579EF00702C16 /* ArtistViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = E4BBD2EF233579EF00702C16 /* ArtistViewItem.xib */; }; + E4BBD2F323357C0700702C16 /* ArtistListState.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BBD2F223357C0700702C16 /* ArtistListState.swift */; }; 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 */; }; @@ -296,6 +302,12 @@ E4B11BBF2275EE150075461B /* QueueActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueActions.swift; sourceTree = ""; }; E4B11BC12275EE410075461B /* AlbumListActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumListActions.swift; sourceTree = ""; }; E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDServerDelegate.swift; sourceTree = ""; }; + E4BBD2E823356DC100702C16 /* BrowseViewButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseViewButton.swift; sourceTree = ""; }; + E4BBD2EA2335735500702C16 /* BrowseController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseController.swift; sourceTree = ""; }; + E4BBD2EC2335798E00702C16 /* ArtistViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArtistViewController.swift; sourceTree = ""; }; + E4BBD2EE233579EF00702C16 /* ArtistViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArtistViewItem.swift; sourceTree = ""; }; + E4BBD2EF233579EF00702C16 /* ArtistViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ArtistViewItem.xib; sourceTree = ""; }; + E4BBD2F223357C0700702C16 /* ArtistListState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArtistListState.swift; sourceTree = ""; }; E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = ""; }; E4C8B53D22349002009A20F3 /* MPDIdle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDIdle.swift; sourceTree = ""; }; E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueueViewController+NSOutlineViewDelegate.swift"; sourceTree = ""; }; @@ -462,6 +474,7 @@ E423563F228623D2001216D6 /* QueueSongTitleView.swift */, E4120D6B22AD8139004CB1F8 /* QueueView.swift */, E43AC1F722C7065A001E483C /* AlbumCoverButton.swift */, + E4BBD2E823356DC100702C16 /* BrowseViewButton.swift */, ); path = Views; sourceTree = ""; @@ -615,6 +628,7 @@ E4B11B67226A4FA00075461B /* QueueState.swift */, E4B11B69226A4FBC0075461B /* AlbumListState.swift */, E4FF718D2276010E00D4C412 /* PreferencesState.swift */, + E4BBD2F223357C0700702C16 /* ArtistListState.swift */, ); path = State; sourceTree = ""; @@ -661,6 +675,9 @@ E408D3C1220E134F0006D9BE /* AlbumViewController.swift */, E43AC1F222C6A439001E483C /* AlbumViewController+NSCollectionViewDelegate.swift */, E47E2FD4222071FD00F747E6 /* AlbumViewItem.swift */, + E4BBD2EC2335798E00702C16 /* ArtistViewController.swift */, + E4BBD2EE233579EF00702C16 /* ArtistViewItem.swift */, + E4BBD2EA2335735500702C16 /* BrowseController.swift */, E47E2FD022205C4600F747E6 /* MainSplitViewController.swift */, E4405191227644340090CD6F /* MPDServerController.swift */, E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */, @@ -675,6 +692,7 @@ E4D1B598220BA3C90026F233 /* Resources */ = { isa = PBXGroup; children = ( + E4BBD2EF233579EF00702C16 /* ArtistViewItem.xib */, E43B67A922909793007DCF55 /* AlbumDetailView.xib */, E408D3C9220E341D0006D9BE /* AlbumViewItem.xib */, E489E3A322B9D31800CA8CBD /* DraggedSongView.xib */, @@ -854,6 +872,7 @@ E40786202110CE70006887B1 /* Assets.xcassets in Resources */, E42A8F3C22176D6400A13ED9 /* README.md in Resources */, E408D3CB220E341D0006D9BE /* AlbumViewItem.xib in Resources */, + E4BBD2F1233579EF00702C16 /* ArtistViewItem.xib in Resources */, E40786232110CE70006887B1 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -910,12 +929,14 @@ E43AC1F622C6AD0B001E483C /* AlbumViewController+NSCollectionViewDelegate.swift in Sources */, E4B11B68226A4FA00075461B /* QueueState.swift in Sources */, E4928E0B2218D62A001D4BEA /* CGColor.swift in Sources */, + E4BBD2ED2335798E00702C16 /* ArtistViewController.swift in Sources */, E4D3BFA622B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift in Sources */, E4405192227644340090CD6F /* MPDServerController.swift in Sources */, E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */, E4F6B460221E119B00ACF42A /* QueueDataSource.swift in Sources */, E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */, E4B11B63226A4C510075461B /* AppReducer.swift in Sources */, + E4BBD2F0233579EF00702C16 /* ArtistViewItem.swift in Sources */, E41E5307223C019100173814 /* MPDClient+Status.swift in Sources */, E41E5310223EF6CE00173814 /* CoverArtService+Remote.swift in Sources */, E41E530B223C033700173814 /* MPDClient+Album.swift in Sources */, @@ -951,13 +972,16 @@ E47E2FDD2220A6D100F747E6 /* Time.swift in Sources */, E419E2872249B96600216A8C /* Song.swift in Sources */, E451E36B22BD214D008BE9B2 /* DraggedSongType.swift in Sources */, + E4BBD2F323357C0700702C16 /* ArtistListState.swift in Sources */, E44051A0227BB0AB0090CD6F /* UIState.swift in Sources */, E4FF718E2276010E00D4C412 /* PreferencesState.swift in Sources */, E439109822640213002982E9 /* SongNotifierService.swift in Sources */, E407861C2110CE6E006887B1 /* AppDelegate.swift in Sources */, E4B11B75226CC4D30075461B /* QueueReducer.swift in Sources */, E41E5309223C020400173814 /* MPDClient+Command.swift in Sources */, + E4BBD2E923356DC100702C16 /* BrowseViewButton.swift in Sources */, E4B11B73226A6C770075461B /* TrackTimer.swift in Sources */, + E4BBD2EB2335735500702C16 /* BrowseController.swift in Sources */, E44051942278765A0090CD6F /* App.swift in Sources */, E4B11B79226D346B0075461B /* AlbumListReducer.swift in Sources */, E47E2FE52220AA0700F747E6 /* AlbumViewLayout.swift in Sources */, diff --git a/Persephone.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Persephone.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 6bea6d9..0000000 --- a/Persephone.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,70 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "CryptoSwift", - "repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift", - "state": { - "branch": null, - "revision": "3a2acbb32ab68215ee1596ee6004da8e90c3721b", - "version": "1.0.0" - } - }, - { - "package": "Differ", - "repositoryURL": "https://github.com/tonyarnold/Differ", - "state": { - "branch": null, - "revision": "e2cca36e7258dd8add88ae46b5ea56509b066e21", - "version": "1.4.3" - } - }, - { - "package": "PMKFoundation", - "repositoryURL": "https://github.com/PromiseKit/Foundation", - "state": { - "branch": null, - "revision": "ee06d95342a5007de2fffd898f4f35de026842ac", - "version": "3.3.3" - } - }, - { - "package": "MediaKeyTap", - "repositoryURL": "https://github.com/danbee/MediaKeyTap", - "state": { - "branch": "add-package-swift", - "revision": "b6b83b1a3e78d25ad9c86a55babce4f60caf6fa4", - "version": null - } - }, - { - "package": "PromiseKit", - "repositoryURL": "https://github.com/mxcl/PromiseKit", - "state": { - "branch": null, - "revision": "4d8d1287d2e50c53a9f8430ffe88925292838c57", - "version": "6.11.0" - } - }, - { - "package": "ReSwift", - "repositoryURL": "https://github.com/ReSwift/ReSwift", - "state": { - "branch": null, - "revision": "b92762b5aa85c5e94053d942fbd37124ee939e5b", - "version": "5.0.0" - } - }, - { - "package": "SwiftyJSON", - "repositoryURL": "https://github.com/SwiftyJSON/SwiftyJSON", - "state": { - "branch": null, - "revision": "2b6054efa051565954e1d2b9da831680026cd768", - "version": "5.0.0" - } - } - ] - }, - "version": 1 -} diff --git a/Persephone/Controllers/ArtistViewController.swift b/Persephone/Controllers/ArtistViewController.swift new file mode 100644 index 0000000..b274021 --- /dev/null +++ b/Persephone/Controllers/ArtistViewController.swift @@ -0,0 +1,13 @@ +// +// ArtistViewController.swift +// Persephone +// +// Created by Daniel Barber on 2019/9/20. +// Copyright © 2019 Dan Barber. All rights reserved. +// + +import AppKit + +class ArtistViewController: NSViewController { + +} diff --git a/Persephone/Controllers/ArtistViewItem.swift b/Persephone/Controllers/ArtistViewItem.swift new file mode 100644 index 0000000..9119fad --- /dev/null +++ b/Persephone/Controllers/ArtistViewItem.swift @@ -0,0 +1,26 @@ +// +// ArtistViewItem.swift +// Persephone +// +// Created by Daniel Barber on 2019/9/20. +// Copyright © 2019 Dan Barber. All rights reserved. +// + +import Cocoa + +class ArtistViewItem: NSViewController { + var artist: String? + + @IBOutlet var artistName: NSTextField! + + override func viewDidLoad() { + super.viewDidLoad() + // Do view setup here. + } + + func setArtist(_ artist: String) { + self.artist = artist + + artistName.stringValue = artist + } +} diff --git a/Persephone/Controllers/BrowseController.swift b/Persephone/Controllers/BrowseController.swift new file mode 100644 index 0000000..3e2c314 --- /dev/null +++ b/Persephone/Controllers/BrowseController.swift @@ -0,0 +1,32 @@ +// +// BrowseController.swift +// Persephone +// +// Created by Daniel Barber on 2019/9/20. +// Copyright © 2019 Dan Barber. All rights reserved. +// + +import AppKit + +class BrowseController: NSViewController { + @IBOutlet var artistsButton: NSButton! + @IBOutlet var albumsButton: NSButton! + + @IBOutlet var browseTabView: NSTabView! + + @IBAction func switchToTab(_ sender: NSButton) { + artistsButton.state = .off + albumsButton.state = .off + + switch sender.identifier?.rawValue { + case "artists": + artistsButton.state = .on + browseTabView.selectTabViewItem(at: 0) + case "albums": + albumsButton.state = .on + browseTabView.selectTabViewItem(at: 1) + default: + return + } + } +} diff --git a/Persephone/Resources/ArtistViewItem.xib b/Persephone/Resources/ArtistViewItem.xib new file mode 100644 index 0000000..cdef285 --- /dev/null +++ b/Persephone/Resources/ArtistViewItem.xib @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Persephone/Resources/Base.lproj/Main.storyboard b/Persephone/Resources/Base.lproj/Main.storyboard index af4eb28..dbcda5f 100644 --- a/Persephone/Resources/Base.lproj/Main.storyboard +++ b/Persephone/Resources/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -187,7 +187,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -353,12 +353,12 @@ - + - + @@ -378,7 +378,7 @@ - + @@ -405,7 +405,7 @@ - + @@ -416,7 +416,7 @@ - + @@ -424,7 +424,7 @@ - + @@ -435,7 +435,7 @@ - + @@ -466,7 +466,7 @@ - + @@ -498,7 +498,136 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -509,7 +638,7 @@ - + @@ -520,7 +649,7 @@ - + @@ -538,7 +667,7 @@ - + @@ -546,7 +675,7 @@ - + @@ -576,7 +705,7 @@ - + @@ -646,7 +775,7 @@ - + @@ -654,7 +783,7 @@ - + @@ -699,7 +828,7 @@ - + @@ -787,7 +916,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -849,7 +1024,7 @@ - + diff --git a/Persephone/State/ArtistListState.swift b/Persephone/State/ArtistListState.swift new file mode 100644 index 0000000..f5df586 --- /dev/null +++ b/Persephone/State/ArtistListState.swift @@ -0,0 +1,13 @@ +// +// ArtistListState.swift +// Persephone +// +// Created by Daniel Barber on 2019/9/20. +// Copyright © 2019 Dan Barber. All rights reserved. +// + +import ReSwift + +struct ArtistListState: StateType, Equatable { + var artists: [String] = [] +} diff --git a/Persephone/Views/BrowseViewButton.swift b/Persephone/Views/BrowseViewButton.swift new file mode 100644 index 0000000..5e679c5 --- /dev/null +++ b/Persephone/Views/BrowseViewButton.swift @@ -0,0 +1,23 @@ +// +// BrowseViewButton.swift +// Persephone +// +// Created by Daniel Barber on 2019/9/20. +// Copyright © 2019 Dan Barber. All rights reserved. +// + +import AppKit + +class BrowseViewButton: NSButton { + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + // Drawing code here. + self.layer?.cornerRadius = 4 + self.layer?.masksToBounds = true + if #available(OSX 10.14, *) { + self.layer?.backgroundColor = NSColor.controlAccentColor.cgColor + } else { + // Fallback on earlier versions + } + } +}