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:
parent
24cc5181b8
commit
db4c223b4b
@ -3,6 +3,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
|
<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"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
@ -799,7 +800,7 @@
|
|||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="QUEUE" id="Mqf-uh-ibl">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="QUEUE" id="Mqf-uh-ibl">
|
||||||
<font key="font" metaFont="smallSystemBold"/>
|
<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"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
@ -814,7 +815,7 @@
|
|||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="17" id="UFf-Fg-9Qg"/>
|
<constraint firstAttribute="width" constant="17" id="UFf-Fg-9Qg"/>
|
||||||
</constraints>
|
</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>
|
</imageView>
|
||||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="i0h-bn-auJ">
|
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="i0h-bn-auJ">
|
||||||
<rect key="frame" x="25" y="0.0" width="197" height="17"/>
|
<rect key="frame" x="25" y="0.0" width="197" height="17"/>
|
||||||
|
|||||||
@ -13,9 +13,6 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
|
|||||||
var queue: [MPDClient.Song] = []
|
var queue: [MPDClient.Song] = []
|
||||||
var queuePos: Int32 = -1
|
var queuePos: Int32 = -1
|
||||||
|
|
||||||
let songTitleColumn = NSUserInterfaceItemIdentifier("songTitleColumm")
|
|
||||||
let songArtistColumn = NSUserInterfaceItemIdentifier("songArtistColumm")
|
|
||||||
|
|
||||||
struct SongItem {
|
struct SongItem {
|
||||||
var song: MPDClient.Song
|
var song: MPDClient.Song
|
||||||
var queuePos: Int
|
var queuePos: Int
|
||||||
@ -60,9 +57,6 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
|
|||||||
let oldSongArtistCell = oldSongRow?.view(atColumn: 1) as! NSTableCellView
|
let oldSongArtistCell = oldSongRow?.view(atColumn: 1) as! NSTableCellView
|
||||||
oldSongTitleCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .regular)
|
oldSongTitleCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .regular)
|
||||||
oldSongArtistCell.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
|
let oldQueuePos = self.queuePos
|
||||||
@ -74,8 +68,6 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
|
|||||||
songTitleCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .bold)
|
songTitleCell.textField?.font = NSFont.systemFont(ofSize: 13, weight: .bold)
|
||||||
songArtistCell.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(
|
queueView.reloadData(
|
||||||
forRowIndexes: [Int(oldQueuePos + 1), Int(queuePos + 1)],
|
forRowIndexes: [Int(oldQueuePos + 1), Int(queuePos + 1)],
|
||||||
columnIndexes: [0, 1]
|
columnIndexes: [0, 1]
|
||||||
@ -108,6 +100,11 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
|
|||||||
) as! NSTableCellView
|
) as! NSTableCellView
|
||||||
|
|
||||||
cellView.textField?.stringValue = songItem.song.getTag(MPD_TAG_TITLE)
|
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
|
return cellView
|
||||||
case "songArtistColumn":
|
case "songArtistColumn":
|
||||||
|
|||||||
@ -43,9 +43,9 @@ class WindowController: NSWindowController {
|
|||||||
transportControls.setEnabled([MPD_STATE_PLAY, MPD_STATE_PAUSE].contains(state), forSegment: 3)
|
transportControls.setEnabled([MPD_STATE_PLAY, MPD_STATE_PAUSE].contains(state), forSegment: 3)
|
||||||
|
|
||||||
if [MPD_STATE_PAUSE, MPD_STATE_STOP, MPD_STATE_UNKNOWN].contains(state) {
|
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 {
|
} else {
|
||||||
transportControls.setImage(NSImage(named: NSImage.Name(rawValue: "pauseButton")), forSegment: 1)
|
transportControls.setImage(NSImage(named: NSImage.Name("pauseButton")), forSegment: 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user