mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Wire up play/queue buttons and display disc no
This commit is contained in:
parent
ec67a19f54
commit
d9caf538ee
@ -300,6 +300,8 @@
|
||||
E4B5AE7E22F4C49600CCEC65 /* MPDServerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */; };
|
||||
E4BB7F8F23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */; };
|
||||
E4BB7F9323E9150A00906E2F /* CoverArtService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BB7F9223E9150A00906E2F /* CoverArtService.swift */; };
|
||||
E4C51F08243422380093FB31 /* AlbumDiscCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C51F07243422380093FB31 /* AlbumDiscCell.swift */; };
|
||||
E4C51F0A243428B60093FB31 /* UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C51F09243428B60093FB31 /* UIFont.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 */; };
|
||||
@ -657,6 +659,8 @@
|
||||
E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDServerDelegate.swift; sourceTree = "<group>"; };
|
||||
E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDAlbumArtImageDataProvider.swift; sourceTree = "<group>"; };
|
||||
E4BB7F9223E9150A00906E2F /* CoverArtService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverArtService.swift; sourceTree = "<group>"; };
|
||||
E4C51F07243422380093FB31 /* AlbumDiscCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDiscCell.swift; sourceTree = "<group>"; };
|
||||
E4C51F09243428B60093FB31 /* UIFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIFont.swift; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
@ -943,6 +947,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E41222272431539800473C1D /* CGSize.swift */,
|
||||
E4C51F09243428B60093FB31 /* UIFont.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
@ -950,9 +955,10 @@
|
||||
E412222A243182F700473C1D /* Album Detail */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E412222F2432B0A300473C1D /* AlbumTracksDataSource.swift */,
|
||||
E4C51F07243422380093FB31 /* AlbumDiscCell.swift */,
|
||||
E4B3B3622432DA4B007E25D2 /* AlbumSongCell.swift */,
|
||||
E4B3B3652432DEDB007E25D2 /* AlbumSongListViewController.swift */,
|
||||
E412222F2432B0A300473C1D /* AlbumTracksDataSource.swift */,
|
||||
);
|
||||
path = "Album Detail";
|
||||
sourceTree = "<group>";
|
||||
@ -1986,6 +1992,7 @@
|
||||
E4805A132426D73600362CF3 /* rplaylist.c in Sources */,
|
||||
E480513024255BDF00362CF3 /* MPDSong.swift in Sources */,
|
||||
E4B3B3642432DB7A007E25D2 /* AlbumSongCell.swift in Sources */,
|
||||
E4C51F0A243428B60093FB31 /* UIFont.swift in Sources */,
|
||||
E480511524255BAF00362CF3 /* DraggedSongType.swift in Sources */,
|
||||
E480512B24255BDF00362CF3 /* MPDAlbum.swift in Sources */,
|
||||
E412221A2431425400473C1D /* AlbumViewController+UICollectionViewDataSource.swift in Sources */,
|
||||
@ -2003,6 +2010,7 @@
|
||||
E4805A1B2426D73600362CF3 /* cmessage.c in Sources */,
|
||||
E48059E52426D73600362CF3 /* run.c in Sources */,
|
||||
E480514D24255E7D00362CF3 /* ServerActions.swift in Sources */,
|
||||
E4C51F08243422380093FB31 /* AlbumDiscCell.swift in Sources */,
|
||||
E480511C24255BBF00362CF3 /* MPDClient.swift in Sources */,
|
||||
E480513B24255E7200362CF3 /* AlbumListState.swift in Sources */,
|
||||
E480512224255BDB00362CF3 /* MPDClient+Connection.swift in Sources */,
|
||||
|
||||
@ -105,23 +105,33 @@
|
||||
<constraint firstAttribute="width" secondItem="vMd-mZ-iq2" secondAttribute="height" multiplier="1:1" id="X9u-bs-kD7"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5gg-Nm-qeI">
|
||||
<rect key="frame" x="19" y="470" width="177" height="45"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5gg-Nm-qeI">
|
||||
<rect key="frame" x="20" y="470" width="177" height="45"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="45" id="Czc-2v-b16"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<state key="normal" title="Play"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
|
||||
<state key="normal" title="Play" image="playButtonLarge">
|
||||
<color key="titleColor" systemColor="linkColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="playAlbumAction:" destination="PiR-R2-zGX" eventType="touchUpInside" id="ZnV-tU-n45"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lvw-rf-UJc">
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lvw-rf-UJc">
|
||||
<rect key="frame" x="217" y="470" width="177" height="45"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="45" id="me8-vL-evB"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<state key="normal" title="Queue"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
|
||||
<state key="normal" title="Queue" image="plus" catalog="system">
|
||||
<color key="titleColor" systemColor="linkColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="addAlbumToQueueAction:" destination="PiR-R2-zGX" eventType="touchUpInside" id="OHR-k8-Cob"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Metadata" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LH5-iT-vfZ">
|
||||
<rect key="frame" x="20" y="55" width="374" height="21"/>
|
||||
@ -152,7 +162,7 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumDiscCell" id="Cgr-Ay-PN6" customClass="AlbumTrackCell" customModule="Persephone" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumDiscCell" id="Cgr-Ay-PN6" customClass="AlbumDiscCell" customModule="Persephone" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="551" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Cgr-Ay-PN6" id="QJR-Pt-aua">
|
||||
@ -171,6 +181,9 @@
|
||||
<constraint firstItem="KZU-KX-MTh" firstAttribute="centerY" secondItem="QJR-Pt-aua" secondAttribute="centerY" id="w9Y-0V-gJb"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="albumDisc" destination="KZU-KX-MTh" id="62Y-Au-3KS"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumSongCell" id="mPK-LP-7dy" customClass="AlbumSongCell" customModule="Persephone" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="594.5" width="414" height="43.5"/>
|
||||
@ -186,9 +199,9 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOC-cU-wMA">
|
||||
<rect key="frame" x="348" y="11.5" width="46" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<rect key="frame" x="350.5" y="12" width="43.5" height="19.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wVS-im-RKW">
|
||||
@ -274,6 +287,8 @@
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="defaultCoverArt" width="128" height="128"/>
|
||||
<image name="playButtonLarge" width="22" height="22"/>
|
||||
<image name="plus" catalog="system" width="128" height="113"/>
|
||||
<image name="square.grid.2x2.fill" catalog="system" width="128" height="114"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
21
iOS/Components/Browser/Album Detail/AlbumDiscCell.swift
Normal file
21
iOS/Components/Browser/Album Detail/AlbumDiscCell.swift
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// AlbumDiscCell.swift
|
||||
// Persephone-iOS
|
||||
//
|
||||
// Created by Daniel Barber on 2020-3-31.
|
||||
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class AlbumDiscCell: UITableViewCell {
|
||||
var albumSongItem: AlbumSongItem?
|
||||
|
||||
func setSongItem(songItem: AlbumSongItem) {
|
||||
albumSongItem = songItem
|
||||
|
||||
albumDisc.text = "Disc \(songItem.disc ?? "0")"
|
||||
}
|
||||
|
||||
@IBOutlet var albumDisc: UILabel!
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
//
|
||||
// AlbumSongCell.swift
|
||||
// Persephone
|
||||
// Persephone-iOS
|
||||
//
|
||||
// Created by Daniel Barber on 2020-3-30.
|
||||
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||
@ -14,8 +14,13 @@ class AlbumSongCell: UITableViewCell {
|
||||
func setSongItem(songItem: AlbumSongItem) {
|
||||
albumSongItem = songItem
|
||||
|
||||
trackNumber.text = songItem.song?.trackNumber
|
||||
songTitle.text = songItem.song?.title
|
||||
guard let song = songItem.song else { return }
|
||||
|
||||
songDuration.font = .timerFont
|
||||
|
||||
trackNumber.text = song.trackNumber
|
||||
songTitle.text = song.title
|
||||
songDuration.text = song.duration.formattedTime
|
||||
}
|
||||
|
||||
@IBOutlet var trackNumber: UILabel!
|
||||
|
||||
@ -95,12 +95,6 @@ class AlbumSongListViewController: UITableViewController {
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
@IBAction func playAlbumAction(_ sender: Any) {
|
||||
guard let album = album else { return }
|
||||
|
||||
App.mpdClient.playAlbum(album.mpdAlbum)
|
||||
}
|
||||
|
||||
func setAppearance() {
|
||||
let darkMode = traitCollection.userInterfaceStyle == .dark
|
||||
@ -108,13 +102,20 @@ class AlbumSongListViewController: UITableViewController {
|
||||
albumCoverView.layer.borderColor = darkMode ? CGColor.albumBorderColorDark : CGColor.albumBorderColorLight
|
||||
}
|
||||
|
||||
// @IBAction func addAlbumToQueueAction(_ sender: Any) {
|
||||
// guard let album = album else { return }
|
||||
//
|
||||
// let queueLength = App.store.state.queueState.queue.count
|
||||
//
|
||||
// App.mpdClient.addAlbumToQueue(album: album.mpdAlbum, at: queueLength)
|
||||
// }
|
||||
@IBAction func playAlbumAction(_ sender: Any) {
|
||||
guard let album = album else { return }
|
||||
|
||||
App.mpdClient.playAlbum(album.mpdAlbum)
|
||||
}
|
||||
|
||||
@IBAction func addAlbumToQueueAction(_ sender: Any) {
|
||||
guard let album = album else { return }
|
||||
|
||||
let queueLength = App.store.state.queueState.queue.count
|
||||
|
||||
App.mpdClient.addAlbumToQueue(album: album.mpdAlbum, at: queueLength)
|
||||
}
|
||||
|
||||
@IBOutlet var addAlbumToQueueButton: UIButton!
|
||||
@IBOutlet var playAlbumButton: UIButton!
|
||||
@IBOutlet var albumTitle: UILabel!
|
||||
|
||||
@ -16,12 +16,25 @@ class AlbumTracksDataSource: NSObject, UITableViewDataSource {
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
guard let albumSongCell = tableView.dequeueReusableCell(withIdentifier: "albumSongCell") as? AlbumSongCell
|
||||
else { return AlbumSongCell() }
|
||||
let albumSongItem = albumSongs[indexPath.row]
|
||||
|
||||
albumSongCell.setSongItem(songItem: albumSongs[indexPath.row])
|
||||
if let song = albumSongItem.song {
|
||||
guard let albumSongCell = tableView.dequeueReusableCell(withIdentifier: "albumSongCell") as? AlbumSongCell
|
||||
else { return AlbumSongCell() }
|
||||
|
||||
albumSongCell.setSongItem(songItem: albumSongItem)
|
||||
|
||||
return albumSongCell
|
||||
return albumSongCell
|
||||
} else if let disc = albumSongItem.disc {
|
||||
guard let albumDiscCell = tableView.dequeueReusableCell(withIdentifier: "albumDiscCell") as? AlbumDiscCell
|
||||
else { return AlbumDiscCell() }
|
||||
|
||||
albumDiscCell.setSongItem(songItem: albumSongItem)
|
||||
|
||||
return albumDiscCell
|
||||
}
|
||||
|
||||
return UITableViewCell()
|
||||
}
|
||||
|
||||
func setAlbumSongs(_ songs: [Song]) {
|
||||
|
||||
13
iOS/Components/Shared/Extensions/UIFont.swift
Normal file
13
iOS/Components/Shared/Extensions/UIFont.swift
Normal file
@ -0,0 +1,13 @@
|
||||
//
|
||||
// UIFont.swift
|
||||
// Persephone-iOS
|
||||
//
|
||||
// Created by Daniel Barber on 2020-3-31.
|
||||
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIFont {
|
||||
static let timerFont = monospacedDigitSystemFont(ofSize: 16, weight: .regular)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user