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

Display icon next to playing track

This commit is contained in:
Daniel Barber 2019-02-05 21:54:33 -05:00
parent 24cc5181b8
commit db4c223b4b
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
3 changed files with 10 additions and 12 deletions

View File

@ -3,6 +3,7 @@
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@ -799,7 +800,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="QUEUE" id="Mqf-uh-ibl">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="headerColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlAccentColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
@ -814,7 +815,7 @@
<constraints>
<constraint firstAttribute="width" constant="17" id="UFf-Fg-9Qg"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" imageScaling="proportionallyDown" image="NSActionTemplate" id="ckK-gW-Vhx"/>
<imageCell key="cell" refusesFirstResponder="YES" imageScaling="proportionallyDown" image="playButton" id="ckK-gW-Vhx"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="i0h-bn-auJ">
<rect key="frame" x="25" y="0.0" width="197" height="17"/>

View File

@ -13,9 +13,6 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
var queue: [MPDClient.Song] = []
var queuePos: Int32 = -1
let songTitleColumn = NSUserInterfaceItemIdentifier("songTitleColumm")
let songArtistColumn = NSUserInterfaceItemIdentifier("songArtistColumm")
struct SongItem {
var song: MPDClient.Song
var queuePos: Int
@ -60,9 +57,6 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
let oldSongArtistCell = oldSongRow?.view(atColumn: 1) as! NSTableCellView
oldSongTitleCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .regular)
oldSongArtistCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .regular)
//oldSongTitleCell.needsDisplay = true
//oldSongArtistCell.needsDisplay = true
}
let oldQueuePos = self.queuePos
@ -74,8 +68,6 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
songTitleCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .bold)
songArtistCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .bold)
//songTitleCell.needsDisplay = true
//songArtistCell.needsDisplay = true
queueView.reloadData(
forRowIndexes: [Int(oldQueuePos + 1), Int(queuePos + 1)],
columnIndexes: [0, 1]
@ -108,6 +100,11 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
) as! NSTableCellView
cellView.textField?.stringValue = songItem.song.getTag(MPD_TAG_TITLE)
if songItem.queuePos == self.queuePos {
cellView.imageView?.image = NSImage(named: NSImage.Name("playButton"))
} else {
cellView.imageView?.image = nil
}
return cellView
case "songArtistColumn":

View File

@ -43,9 +43,9 @@ class WindowController: NSWindowController {
transportControls.setEnabled([MPD_STATE_PLAY, MPD_STATE_PAUSE].contains(state), forSegment: 3)
if [MPD_STATE_PAUSE, MPD_STATE_STOP, MPD_STATE_UNKNOWN].contains(state) {
transportControls.setImage(NSImage(named: NSImage.Name(rawValue: "playButton")), forSegment: 1)
transportControls.setImage(NSImage(named: NSImage.Name("playButton")), forSegment: 1)
} else {
transportControls.setImage(NSImage(named: NSImage.Name(rawValue: "pauseButton")), forSegment: 1)
transportControls.setImage(NSImage(named: NSImage.Name("pauseButton")), forSegment: 1)
}
}