Add a bitrate column to the playlist

Adds a bitrate column to the playlist view, which is fully sortable.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2023-08-20 23:47:37 -07:00
parent 16c1cf4b65
commit 7ea87f0502
6 changed files with 63 additions and 1 deletions

View file

@ -732,6 +732,50 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="OsB-l4-dFb"/>
</connections>
</tableColumn>
<tableColumn identifier="bitrate" editable="NO" width="64" minWidth="32" maxWidth="1024" hidden="YES" id="PoD-EU-L4X" userLabel="Bitrate">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Bitrate">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="9df-mL-Zgx">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="Wqm-GT-K5a">
<rect key="frame" x="1" y="3" width="0.0" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="L7E-1S-m3b">
<rect key="frame" x="0.0" y="1" width="4" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="cAf-1y-D7M">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="L7E-1S-m3b" secondAttribute="trailing" constant="-2" id="Fn8-gt-4io"/>
<constraint firstItem="L7E-1S-m3b" firstAttribute="leading" secondItem="Wqm-GT-K5a" secondAttribute="leading" constant="2" id="GDJ-WW-3Vb"/>
<constraint firstItem="L7E-1S-m3b" firstAttribute="centerY" secondItem="Wqm-GT-K5a" secondAttribute="centerY" id="O5A-dw-6sx"/>
</constraints>
<connections>
<outlet property="textField" destination="L7E-1S-m3b" id="biP-XR-a2T"/>
</connections>
</tableCellView>
</prototypeCellViews>
<connections>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="eFT-ZC-67y"/>
<binding destination="218" name="value" keyPath="arrangedObjects.bitrate" id="EwM-t3-oO8">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="YES"/>
</dictionary>
</binding>
</connections>
</tableColumn>
</tableColumns>
<connections>
<binding destination="1689" name="rowHeight" keyPath="values.fontSize" id="1927">

View file

@ -48,7 +48,7 @@ static void *playlistControllerContext = &playlistControllerContext;
cellIdentifiers = @[@"index", @"status", @"title", @"albumartist", @"artist",
@"album", @"length", @"year", @"genre", @"track", @"path",
@"filename", @"codec", @"rating", @"samplerate",
@"bitspersample"];
@"bitspersample", @"bitrate"];
NSValueTransformer *repeatNoneTransformer =
[[RepeatModeTransformer alloc] initWithMode:RepeatModeNoRepeat];
@ -518,6 +518,11 @@ static void *playlistControllerContext = &playlistControllerContext;
cellText = [NSString stringWithFormat:@"%u", pe.bitsPerSample];
cellTextAlignment = NSTextAlignmentRight;
break;
case 16:
cellText = [NSString stringWithFormat:@"%u kbps", pe.bitrate];
cellTextAlignment = NSTextAlignmentRight;
break;
}
}
@ -664,6 +669,7 @@ static void *playlistControllerContext = &playlistControllerContext;
break;
case 13:
case 16:
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[tableColumn identifier] ascending:ascending selector:@selector(compare:)];
sortDescriptors = @[sortDescriptor];
break;

View file

@ -811,3 +811,6 @@
/* Class = "NSTableColumn"; title = "Bits Per Sample"; ObjectID = "3no-xo-TpJ"; */
"3no-xo-TpJ.title" = "Bits Per Sample";
/* Class = "NSTableColumn"; title = "Bitrate"; ObjectID = "PoD-EU-L4X"; */
"PoD-EU-L4X.title" = "Bitrate";

View file

@ -811,3 +811,6 @@
/* Class = "NSTableColumn"; title = "Bits Per Sample"; ObjectID = "3no-xo-TpJ"; */
"3no-xo-TpJ.title" = "Bits por muestra";
/* Class = "NSTableColumn"; title = "Bitrate"; ObjectID = "PoD-EU-L4X"; */
"PoD-EU-L4X.title" = "Tasa de bits";

View file

@ -724,3 +724,6 @@
/* Class = "NSTableColumn"; title = "Bits Per Sample"; ObjectID = "3no-xo-TpJ"; */
"3no-xo-TpJ.title" = "Бит на семпл";
/* Class = "NSTableColumn"; title = "Bitrate"; ObjectID = "PoD-EU-L4X"; */
"PoD-EU-L4X.title" = "Битрейт";

View file

@ -838,3 +838,6 @@
/* Class = "NSTableColumn"; title = "Bits Per Sample"; ObjectID = "3no-xo-TpJ"; */
"3no-xo-TpJ.title" = "Örnek başına bit sayısı";
/* Class = "NSTableColumn"; title = "Bitrate"; ObjectID = "PoD-EU-L4X"; */
"PoD-EU-L4X.title" = "Bit hızı";