mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Add Queue heading
This commit is contained in:
parent
e6b3aff3bb
commit
21c77cd243
@ -736,7 +736,7 @@
|
||||
<objects>
|
||||
<splitViewController id="fnD-7K-pHK" sceneMemberID="viewController">
|
||||
<splitViewItems>
|
||||
<splitViewItem holdingPriority="260" behavior="sidebar" id="CWo-v7-gd2"/>
|
||||
<splitViewItem canCollapse="YES" holdingPriority="260" behavior="sidebar" id="CWo-v7-gd2"/>
|
||||
<splitViewItem id="y8g-4F-czS"/>
|
||||
</splitViewItems>
|
||||
<splitView key="splitView" dividerStyle="thin" vertical="YES" id="g34-ef-XN0">
|
||||
@ -790,9 +790,24 @@
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="songTitleCell" id="5rR-Gz-AcP">
|
||||
<tableCellView identifier="queueHeadingCell" id="GOd-cg-juD">
|
||||
<rect key="frame" x="1" y="1" width="222" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xgd-Cz-np3">
|
||||
<rect key="frame" x="0.0" y="1" width="447" height="14"/>
|
||||
<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="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="songTitleCell" id="5rR-Gz-AcP">
|
||||
<rect key="frame" x="1" y="20" width="222" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="o8i-cz-hIP">
|
||||
<rect key="frame" x="3" y="0.0" width="17" height="17"/>
|
||||
@ -842,8 +857,9 @@
|
||||
<rect key="frame" x="226" y="1" width="222" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw">
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tBe-Q9-3Rw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="222" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Ceb-ec-ydU">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -851,11 +867,6 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="tBe-Q9-3Rw" firstAttribute="leading" secondItem="JSk-Vc-Y7e" secondAttribute="leading" constant="2" id="BOs-0C-qCf"/>
|
||||
<constraint firstItem="tBe-Q9-3Rw" firstAttribute="centerX" secondItem="JSk-Vc-Y7e" secondAttribute="centerX" id="MUL-DZ-5vL"/>
|
||||
<constraint firstItem="tBe-Q9-3Rw" firstAttribute="centerY" secondItem="JSk-Vc-Y7e" secondAttribute="centerY" id="V5l-bF-vkW"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="textField" destination="tBe-Q9-3Rw" id="2e6-zi-tKj"/>
|
||||
</connections>
|
||||
|
||||
@ -35,7 +35,7 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
|
||||
}
|
||||
|
||||
func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
|
||||
return queue.count
|
||||
return queue.count + 1
|
||||
}
|
||||
|
||||
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
|
||||
@ -43,33 +43,50 @@ class QueueController: NSViewController, NSOutlineViewDataSource, NSOutlineViewD
|
||||
}
|
||||
|
||||
func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
|
||||
return queue[index]
|
||||
if index > 0 {
|
||||
return queue[index - 1]
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
|
||||
guard let song = item as? MPDClient.Song else { return nil }
|
||||
if let song = item as? MPDClient.Song {
|
||||
switch tableColumn?.identifier.rawValue {
|
||||
case "songTitleColumn":
|
||||
let cellView = outlineView.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "songTitleCell"),
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
|
||||
switch tableColumn?.identifier.rawValue {
|
||||
case "songTitleColumn":
|
||||
let cellView = outlineView.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "songTitleCell"),
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
cellView.textField?.stringValue = song.getTag(MPD_TAG_TITLE)
|
||||
|
||||
cellView.textField?.stringValue = song.getTag(MPD_TAG_TITLE)
|
||||
return cellView
|
||||
case "songArtistColumn":
|
||||
let cellView = outlineView.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "songArtistCell"),
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
|
||||
return cellView
|
||||
case "songArtistColumn":
|
||||
let cellView = outlineView.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "songArtistCell"),
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
|
||||
cellView.textField?.stringValue = song.getTag(MPD_TAG_ARTIST)
|
||||
cellView.textField?.stringValue = song.getTag(MPD_TAG_ARTIST)
|
||||
|
||||
return cellView
|
||||
default:
|
||||
return nil
|
||||
return cellView
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
if tableColumn?.identifier.rawValue == "songTitleColumn" {
|
||||
let cellView = outlineView.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "queueHeadingCell"),
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
|
||||
cellView.textField?.stringValue = "QUEUE"
|
||||
|
||||
return cellView
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user