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

Compare commits

...

4 Commits

5 changed files with 40 additions and 8 deletions

View File

@ -19,6 +19,8 @@ class AlbumViewController: NSViewController,
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
albumScrollView.postsBoundsChangedNotifications = true
NotificationCenter.default.addObserver( NotificationCenter.default.addObserver(
self, self,
selector: #selector(updateAlbums(_:)), selector: #selector(updateAlbums(_:)),
@ -73,5 +75,6 @@ class AlbumViewController: NSViewController,
return NSSize(width: itemWidth, height: itemHeight) return NSSize(width: itemWidth, height: itemHeight)
} }
@IBOutlet var albumScrollView: NSScrollView!
@IBOutlet var albumCollectionView: NSCollectionView! @IBOutlet var albumCollectionView: NSCollectionView!
} }

View File

@ -114,9 +114,10 @@ class QueueViewController: NSViewController, NSOutlineViewDataSource, NSOutlineV
if oldSongRowPos >= 0 { if oldSongRowPos >= 0 {
queue[oldSongRowPos].isPlaying = false queue[oldSongRowPos].isPlaying = false
} }
if newSongRowPos >= 0 {
queue[newSongRowPos].isPlaying = true queue[newSongRowPos].isPlaying = true
} }
}
func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int { func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
return queue.count + 1 return queue.count + 1

View File

@ -842,7 +842,7 @@
</tableCellView> </tableCellView>
</prototypeCellViews> </prototypeCellViews>
</tableColumn> </tableColumn>
<tableColumn identifier="songArtistColumn" width="144" minWidth="128" maxWidth="1000" id="SPM-QP-DX8"> <tableColumn identifier="songArtistColumn" width="144" minWidth="64" maxWidth="1000" id="SPM-QP-DX8">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Artist"> <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Artist">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@ -859,9 +859,8 @@
<rect key="frame" x="204" y="1" width="144" height="17"/> <rect key="frame" x="204" y="1" width="144" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw">
<rect key="frame" x="0.0" y="0.0" width="222" height="17"/> <rect key="frame" x="0.0" y="0.0" width="149" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Ceb-ec-ydU"> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Ceb-ec-ydU">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@ -869,6 +868,11 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
</subviews> </subviews>
<constraints>
<constraint firstItem="tBe-Q9-3Rw" firstAttribute="centerY" secondItem="JSk-Vc-Y7e" secondAttribute="centerY" id="Tkg-cb-Bg6"/>
<constraint firstAttribute="trailing" secondItem="tBe-Q9-3Rw" secondAttribute="trailing" constant="-3" id="VhZ-ua-QQX"/>
<constraint firstItem="tBe-Q9-3Rw" firstAttribute="leading" secondItem="JSk-Vc-Y7e" secondAttribute="leading" constant="2" id="cTy-tR-Grg"/>
</constraints>
<connections> <connections>
<outlet property="textField" destination="tBe-Q9-3Rw" id="2e6-zi-tKj"/> <outlet property="textField" destination="tBe-Q9-3Rw" id="2e6-zi-tKj"/>
</connections> </connections>
@ -962,6 +966,7 @@
</view> </view>
<connections> <connections>
<outlet property="albumCollectionView" destination="lfq-AB-epE" id="p69-Fs-hCN"/> <outlet property="albumCollectionView" destination="lfq-AB-epE" id="p69-Fs-hCN"/>
<outlet property="albumScrollView" destination="i5f-35-7x8" id="jmd-Sa-Bxt"/>
</connections> </connections>
</viewController> </viewController>
<customObject id="uex-Ws-5X4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> <customObject id="uex-Ws-5X4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>

View File

@ -31,15 +31,38 @@ class AlbumItemView: NSView {
addTrackingArea(trackingArea) addTrackingArea(trackingArea)
} }
required init?(coder decoder: NSCoder) {
super.init(coder: decoder)
NotificationCenter.default.addObserver(
self,
selector: #selector(viewWillScroll(_:)),
name: NSScrollView.willStartLiveScrollNotification,
object: nil
)
}
@objc func viewWillScroll(_ notification: Notification) {
hidePlayButton()
}
override func resize(withOldSuperviewSize oldSize: NSSize) { override func resize(withOldSuperviewSize oldSize: NSSize) {
playButton.isHidden = true hidePlayButton()
} }
override func mouseEntered(with event: NSEvent) { override func mouseEntered(with event: NSEvent) {
playButton.isHidden = false showPlayButton()
} }
override func mouseExited(with event: NSEvent) { override func mouseExited(with event: NSEvent) {
hidePlayButton()
}
func showPlayButton() {
playButton.isHidden = false
}
func hidePlayButton() {
playButton.isHidden = true playButton.isHidden = true
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 179 KiB