[Playlist View] Add Sample Rate and BPS fields

Add Sample Rate and Bits Per Sample columns, hidden by default.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-07-24 19:35:10 -07:00
parent 9d2d29d0f4
commit 360464ceec
3 changed files with 112 additions and 11 deletions

View File

@ -25,17 +25,17 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2123">
<rect key="frame" x="0.0" y="372" width="1105" height="28"/>
<rect key="frame" x="0.0" y="372" width="1135" height="28"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="0.0" verticalLineScroll="24" verticalPageScroll="0.0" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="206" userLabel="Scroll View - Playlist View">
<rect key="frame" x="0.0" y="0.0" width="1105" height="28"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="28"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="KWC-Ti-8KY">
<rect key="frame" x="0.0" y="0.0" width="1105" height="28"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="28"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveName="Playlist" rowHeight="18" headerView="1517" viewBased="YES" id="207" customClass="PlaylistView">
<rect key="frame" x="0.0" y="0.0" width="1105" height="24"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="11"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="6"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -273,7 +273,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="gpC-Oe-Rog">
<rect key="frame" x="301.5" y="3" width="149" height="18"/>
<rect key="frame" x="302" y="3" width="149" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="1WK-qN-Mgj">
@ -360,7 +360,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="hhB-nv-e78">
<rect key="frame" x="607.5" y="3" width="95" height="18"/>
<rect key="frame" x="608" y="3" width="95" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tHy-sM-HDB">
@ -445,7 +445,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="rRl-p9-Awr">
<rect key="frame" x="802.5" y="3" width="64" height="18"/>
<rect key="frame" x="803" y="3" width="64" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="yW6-2w-6mN">
@ -485,7 +485,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="hgh-VE-5kl">
<rect key="frame" x="869.5" y="3" width="38" height="18"/>
<rect key="frame" x="870" y="3" width="38" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="yEY-MI-d3o">
@ -644,6 +644,94 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="VQf-MC-VR1"/>
</connections>
</tableColumn>
<tableColumn identifier="samplerate" editable="NO" width="64" minWidth="32" maxWidth="1024" hidden="YES" id="et9-zH-awt" userLabel="Sample Rate">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Sample Rate">
<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="vAq-NH-dpx">
<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="gxz-eZ-ydV">
<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="3V9-dD-ecy">
<rect key="frame" x="0.0" y="1" width="4" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="2ha-ys-sRi">
<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 firstItem="3V9-dD-ecy" firstAttribute="leading" secondItem="gxz-eZ-ydV" secondAttribute="leading" constant="2" id="dba-hi-HeI"/>
<constraint firstAttribute="trailing" secondItem="3V9-dD-ecy" secondAttribute="trailing" constant="-2" id="gKV-3b-yxd"/>
<constraint firstItem="3V9-dD-ecy" firstAttribute="centerY" secondItem="gxz-eZ-ydV" secondAttribute="centerY" id="y5e-tN-ftx"/>
</constraints>
<connections>
<outlet property="textField" destination="3V9-dD-ecy" id="4vK-XL-Fur"/>
</connections>
</tableCellView>
</prototypeCellViews>
<connections>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="36z-Tr-B4G"/>
<binding destination="218" name="value" keyPath="arrangedObjects.sampleRate" id="5lo-d8-LCy">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="YES"/>
</dictionary>
</binding>
</connections>
</tableColumn>
<tableColumn identifier="bitspersample" editable="NO" width="64" minWidth="32" maxWidth="1024" hidden="YES" id="3no-xo-TpJ" userLabel="Bits Per Sample">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Bits Per Sample">
<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="ols-kE-jvg">
<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="Shd-2v-psn">
<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="1rT-Fe-Pho">
<rect key="frame" x="0.0" y="1" width="4" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="DdU-ro-7Yi">
<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="1rT-Fe-Pho" secondAttribute="trailing" constant="-2" id="ehR-9P-yhp"/>
<constraint firstItem="1rT-Fe-Pho" firstAttribute="leading" secondItem="Shd-2v-psn" secondAttribute="leading" constant="2" id="jGH-kM-uJY"/>
<constraint firstItem="1rT-Fe-Pho" firstAttribute="centerY" secondItem="Shd-2v-psn" secondAttribute="centerY" id="kcA-6X-Nhf"/>
</constraints>
<connections>
<outlet property="textField" destination="1rT-Fe-Pho" id="8gM-l3-O0k"/>
</connections>
</tableCellView>
</prototypeCellViews>
<connections>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="OsB-l4-dFb"/>
<binding destination="218" name="value" keyPath="arrangedObjects.bitsPerSample" id="qVg-Ph-8TQ">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="YES"/>
</dictionary>
</binding>
</connections>
</tableColumn>
</tableColumns>
<connections>
<binding destination="1689" name="rowHeight" keyPath="values.fontSize" id="1927">
@ -672,7 +760,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" wantsLayer="YES" id="1517">
<rect key="frame" x="0.0" y="0.0" width="1105" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="17"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
@ -685,7 +773,7 @@
</connections>
</splitView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="778">
<rect key="frame" x="422" y="4" width="261" height="14"/>
<rect key="frame" x="437" y="4" width="261" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="center" title="Total Duration: 00 hours 00 minutes 00 seconds" bezelStyle="round" id="1473">
<font key="font" metaFont="controlContent" size="11"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>

View File

@ -47,6 +47,7 @@ typedef NS_ENUM(NSInteger, URLOrigin) {
IBOutlet AppController *appController;
NSValueTransformer *statusImageTransformer;
NSValueTransformer *numberHertzToStringTransformer;
NSMutableArray *shuffleList;
NSMutableArray *queueList;

View File

@ -49,7 +49,8 @@ static void *playlistControllerContext = &playlistControllerContext;
+ (void)initialize {
cellIdentifiers = @[@"index", @"status", @"title", @"albumartist", @"artist",
@"album", @"length", @"year", @"genre", @"track", @"path",
@"filename", @"codec", @"rating"];
@"filename", @"codec", @"rating", @"samplerate",
@"bitspersample"];
NSValueTransformer *repeatNoneTransformer =
[[RepeatModeTransformer alloc] initWithMode:RepeatModeNoRepeat];
@ -151,6 +152,7 @@ static void *playlistControllerContext = &playlistControllerContext;
[super awakeFromNib];
statusImageTransformer = [NSValueTransformer valueTransformerForName:@"StatusImageTransformer"];
numberHertzToStringTransformer = [NSValueTransformer valueTransformerForName:@"NumberHertzToStringTransformer"];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"index" ascending:YES];
[self.tableView setSortDescriptors:@[sortDescriptor]];
@ -509,6 +511,16 @@ static void *playlistControllerContext = &playlistControllerContext;
cellRating = YES;
break;
}
case 14:
cellText = [numberHertzToStringTransformer transformedValue:@(pe.sampleRate)];
cellTextAlignment = NSTextAlignmentRight;
break;
case 15:
cellText = [NSString stringWithFormat:@"%u", pe.bitsPerSample];
cellTextAlignment = NSTextAlignmentRight;
break;
}
}