1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00

Wire up album browser context menu

This commit is contained in:
Daniel Barber 2020-01-31 13:52:17 -05:00
parent 109ab0e30e
commit 72379a1bad
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
4 changed files with 44 additions and 23 deletions

View File

@ -1188,7 +1188,7 @@
"$(inherited)",
"$(PROJECT_DIR)/libmpdclient/output",
);
MARKETING_VERSION = "0.15.0-alpha";
MARKETING_VERSION = "0.15.1-alpha";
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -1205,7 +1205,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 8E7TQ638ZD;
DEVELOPMENT_TEAM = 54DPC63K8R;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Persephone/Info.plist;
@ -1217,7 +1217,7 @@
"$(inherited)",
"$(PROJECT_DIR)/libmpdclient/output",
);
MARKETING_VERSION = "0.15.0-alpha";
MARKETING_VERSION = "0.15.1-alpha";
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -107,4 +107,18 @@ class AlbumViewItem: NSCollectionViewItem {
@IBOutlet var albumCoverView: NSButton!
@IBOutlet var albumTitle: NSTextField!
@IBOutlet var albumArtist: NSTextField!
@IBAction func playAlbumMenuAction(_ sender: NSMenuItem) {
guard let album = album else { return }
App.mpdClient.playAlbum(album.mpdAlbum)
}
@IBAction func addAlbumToQueueMenuAction(_ sender: NSMenuItem) {
guard let album = album else { return }
let queueLength = App.store.state.queueState.queue.count
App.mpdClient.addAlbumToQueue(album: album.mpdAlbum, at: queueLength)
}
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -35,10 +35,11 @@
</shadow>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="defaultCoverArt" imagePosition="only" alignment="center" lineBreakMode="truncatingTail" refusesFirstResponder="YES" state="on" transparent="YES" imageScaling="proportionallyUpOrDown" inset="2" id="t8A-Hz-L38">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<font key="font" metaFont="label" size="13"/>
</buttonCell>
<connections>
<action selector="showAlbumDetail:" target="-2" id="A4Q-gb-B45"/>
<outlet property="menu" destination="HIQ-ig-PeQ" id="Dwf-9g-U9a"/>
</connections>
</button>
</subviews>
@ -53,7 +54,7 @@
<textField identifier="albumTitle" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KEh-NL-c2W">
<rect key="frame" x="8" y="28" width="142" height="17"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="pDs-0t-e1j">
<font key="font" metaFont="system"/>
<font key="font" metaFont="label" size="13"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@ -61,7 +62,7 @@
<textField identifier="albumArtist" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5Uu-j1-qyT">
<rect key="frame" x="8" y="10" width="142" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="yZn-e9-zyP">
<font key="font" metaFont="system"/>
<font key="font" metaFont="label" size="13"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@ -83,6 +84,23 @@
<point key="canvasLocation" x="-20" y="112"/>
</customView>
<collectionViewItem id="Qgu-aI-55A" customClass="AlbumViewItem" customModule="Persephone" customModuleProvider="target"/>
<menu id="HIQ-ig-PeQ">
<items>
<menuItem title="Play album" id="caG-XV-Jy6">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="playAlbumMenuAction:" target="-2" id="sfI-FH-YaW"/>
</connections>
</menuItem>
<menuItem title="Add album to queue" id="F6c-oO-oBw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="addAlbumToQueueMenuAction:" target="-2" id="6wW-oR-ykh"/>
</connections>
</menuItem>
</items>
<point key="canvasLocation" x="191" y="38"/>
</menu>
</objects>
<resources>
<image name="defaultCoverArt" width="128" height="128"/>

View File

@ -666,7 +666,7 @@
<tableColumns>
<tableColumn identifier="songCoverColumn" width="43" minWidth="42" maxWidth="1000" id="0Co-uF-CCB" userLabel="Position">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="menu" size="11"/>
<font key="font" metaFont="message" size="11"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
@ -712,7 +712,7 @@
</tableColumn>
<tableColumn identifier="songInfoColumn" width="213" minWidth="10" maxWidth="3.4028234663852886e+38" id="HP0-ty-PFY" userLabel="Song Info">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="menu" size="11"/>
<font key="font" metaFont="message" size="11"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
@ -730,7 +730,7 @@
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw" userLabel="Song Artist View">
<rect key="frame" x="1" y="7" width="219" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Song Artist" id="Ceb-ec-ydU">
<font key="font" metaFont="cellTitle"/>
<font key="font" metaFont="label" size="12"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@ -761,7 +761,7 @@
</tableColumn>
<tableColumn identifier="songDurationColumn" width="64" minWidth="64" maxWidth="64" id="8O6-ox-kx2" userLabel="Duration">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="menu" size="11"/>
<font key="font" metaFont="message" size="11"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
@ -892,7 +892,6 @@
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="delegate" destination="gPn-fP-LFc" id="LQ2-Vl-r08"/>
<outlet property="menu" destination="Rif-KP-4xb" id="f7w-Ot-TKf"/>
</connections>
</collectionView>
</subviews>
@ -920,16 +919,6 @@
</connections>
</viewController>
<customObject id="uex-Ws-5X4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<menu id="Rif-KP-4xb">
<items>
<menuItem title="Play album" id="Cuu-eF-cPb">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Add album to queue" id="pUA-0C-zhs">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</objects>
<point key="canvasLocation" x="2038" y="87"/>
</scene>