diff --git a/macOS/Source/UI/Search/Search.xib b/macOS/Source/UI/Search/Search.xib
index 5693ad176..268a034c9 100644
--- a/macOS/Source/UI/Search/Search.xib
+++ b/macOS/Source/UI/Search/Search.xib
@@ -241,47 +241,15 @@ Gw
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -292,12 +260,12 @@ Gw
-
-
+
+
-
+
@@ -312,26 +280,26 @@ Gw
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
@@ -339,7 +307,7 @@ Gw
-
+
diff --git a/macOS/Source/UI/Search/SearchViewController+TableView.swift b/macOS/Source/UI/Search/SearchViewController+TableView.swift
index f6399dc12..fc0fe1cad 100644
--- a/macOS/Source/UI/Search/SearchViewController+TableView.swift
+++ b/macOS/Source/UI/Search/SearchViewController+TableView.swift
@@ -20,33 +20,61 @@ extension SearchViewController: NSTableViewDataSource {
extension SearchViewController: NSTableViewDelegate {
+ // Adjust row height based on if the text wraps over to the next line
+ func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
+ 30
+ }
+
+ func tableView(_ tableView: NSTableView, shouldSelectRow row: Int) -> Bool {
+ false
+ }
+
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
- guard let columnId = tableColumn?.identifier,
- let cell = tableView.makeView(withIdentifier: columnId, owner: nil) as? NSTableCellView,
+ guard let column = tableColumn?.identifier,
let result = searchResults?.results[row] else {return nil}
- switch columnId {
+ let builder = TableCellBuilder()
+ let track = result.location.track
+
+ switch column {
+
+ case .cid_index:
- case .cid_searchResultTrackColumn:
- cell.text = result.location.track.displayName
+// if track == playQueueDelegate.currentTrack {
+// builder.withImage(image: .imgPlayFilled, inColor: systemColorScheme.activeControlColor)
+//
+// } else {
- case .cid_searchResultLocationColumn:
- cell.text = result.location.description
+ builder.withText(text: "\(row + 1)",
+ inFont: systemFontScheme.normalFont, andColor: systemColorScheme.tertiaryTextColor,
+ selectedTextColor: systemColorScheme.tertiarySelectedTextColor,
+ bottomYOffset: systemFontScheme.tableYOffset)
+// }
- case .cid_searchResultMatchedFieldColumn:
- cell.text = result.match.fieldKey
+ case .cid_trackName:
+
+ let titleAndArtist = track.titleAndArtist
+
+ if let artist = titleAndArtist.artist {
+
+ builder.withAttributedText(strings: [(text: artist + " ", font: systemFontScheme.normalFont, color: systemColorScheme.secondaryTextColor),
+ (text: titleAndArtist.title, font: systemFontScheme.normalFont, color: systemColorScheme.primaryTextColor)],
+ selectedTextColors: [systemColorScheme.secondarySelectedTextColor, systemColorScheme.primarySelectedTextColor],
+ bottomYOffset: systemFontScheme.tableYOffset)
+
+ } else {
+
+ builder.withText(text: titleAndArtist.title, inFont: systemFontScheme.normalFont, andColor: systemColorScheme.primaryTextColor,
+ selectedTextColor: systemColorScheme.primarySelectedTextColor, bottomYOffset: systemFontScheme.tableYOffset)
+ }
default:
+
return nil
}
- return cell
- }
-
- // Adjust row height based on if the text wraps over to the next line
- func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
- 26
+ return builder.buildCell(forTableView: tableView, forColumnWithId: column, inRow: row)
}
}