Use a view-based NSTableView in SBDocument.

This commit is contained in:
Damiano Galassi committed 2016-10-11 18:13:07 +02:00
1 parent 6c1b470be7
commit fe6e0d7218
2 files changed
+160 -13

No files matched your search

+135 -8
View File
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11535.1" systemVersion="16B2338c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11535.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SBDocument">
@@ -53,7 +54,7 @@
<rect key="frame" x="1" y="0.0" width="690" height="144"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" headerView="100032" id="100031" customClass="SBTableView">
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="100032" viewBased="YES" id="100031" customClass="SBTableView">
<rect key="frame" x="0.0" y="0.0" width="690" height="121"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
@@ -72,6 +73,26 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="IdCell" id="pxy-uZ-6b2">
<rect key="frame" x="1" y="1" width="37" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3M2-80-rYQ">
<rect key="frame" x="0.0" y="0.0" width="37" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="DTn-O5-qNK">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="3M2-80-rYQ" id="krr-8y-c4P"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="trackEnabled" width="18" minWidth="18" maxWidth="50" id="100244">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Enabled">
@@ -84,8 +105,30 @@
<font key="font" metaFont="system"/>
</buttonCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="CheckCell" id="OXq-OQ-QE3" customClass="SBCheckBoxCellView">
<rect key="frame" x="41" y="1" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mPW-kC-RQT">
<rect key="frame" x="0.0" y="-2" width="23" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="2z0-pR-IWm">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<action selector="setTrackEnabled:" target="-2" id="hye-KQ-7cT"/>
</connections>
</button>
</subviews>
<connections>
<outlet property="checkboxButton" destination="mPW-kC-RQT" id="tRt-jF-45b"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="trackName" width="222" minWidth="100" maxWidth="1000" id="100034">
<tableColumn identifier="trackName" width="222" minWidth="100" maxWidth="3000" id="100034">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Name">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -97,6 +140,29 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="NameCell" id="jfS-3o-3iB">
<rect key="frame" x="62" y="1" width="222" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SHZ-wS-KHp">
<rect key="frame" x="0.0" y="0.0" width="222" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" title="Table View Cell" id="voc-Ho-i53">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<action selector="setTrackName:" target="-2" id="7Na-8r-ObE"/>
</connections>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="SHZ-wS-KHp" id="bek-kE-Qo9"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="trackDuration" editable="NO" width="92" minWidth="92" maxWidth="92" id="100042">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Duration">
@@ -110,6 +176,26 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="DurationCell" id="OTa-na-4bI">
<rect key="frame" x="287" y="1" width="92" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="206-PB-nxg">
<rect key="frame" x="0.0" y="0.0" width="92" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="00:00:00" id="NiT-jo-7tv">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="206-PB-nxg" id="7wc-C5-8sU"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="trackLanguage" width="138" minWidth="130" maxWidth="150" id="100044">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Language">
@@ -121,11 +207,32 @@
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="dataSource" destination="-2" id="100125"/>
</connections>
</comboBoxCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="ComboCell" id="Yb8-DO-WWM" customClass="SBComboBoxCellView">
<rect key="frame" x="382" y="1" width="138" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<comboBox verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xf4-ll-Tkp">
<rect key="frame" x="3" y="-5" width="135" height="26"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="right" buttonBordered="NO" completes="NO" usesDataSource="YES" numberOfVisibleItems="8" id="FqY-5W-MnQ">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</comboBoxCell>
<connections>
<action selector="setTrackLanguage:" target="-2" id="fbm-Hd-zg3"/>
<outlet property="dataSource" destination="-2" id="y6y-yH-VsB"/>
</connections>
</comboBox>
</subviews>
<connections>
<outlet property="comboBox" destination="Xf4-ll-Tkp" id="Iah-5G-58x"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="trackInfo" editable="NO" width="165" minWidth="80" maxWidth="440" id="100040">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Format">
@@ -139,6 +246,26 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="FormatCell" id="cWa-bG-vg7">
<rect key="frame" x="523" y="1" width="165" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zF5-nA-gdc">
<rect key="frame" x="0.0" y="0.0" width="165" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Table View Cell" id="B0B-3e-m7b">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="zF5-nA-gdc" id="ISn-FR-5ap"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
</tableColumns>
<connections>
@@ -369,7 +496,7 @@
<connections>
<outlet property="delegate" destination="-2" id="17"/>
</connections>
<point key="canvasLocation" x="197" y="-104"/>
<point key="canvasLocation" x="176" y="-245"/>
</window>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="100175" userLabel="Saving">
+25 -5
View File
@@ -167,20 +167,40 @@ NSString *const SBMetadataResultNetwork = @"{Network}";
}
}
MP42MetadataItem *metadataItem = [MP42MetadataItem metadataItemWithIdentifier:item.key
value:result
dataType:MP42MetadataItemDataTypeUnspecified
extendedLanguageTag:nil];
if (result.length) {
[metadata setTag:result forKey:item.key];
[metadata addMetadataItem:metadataItem];
}
else if (keep) {
[metadata setTag:result forKey:item.key];
[metadata addMetadataItem:metadataItem];
}
}
for (MP42Image *artwork in self.artworks) {
[metadata.artworks addObject:artwork];
MP42MetadataItem *metadataItem = [MP42MetadataItem metadataItemWithIdentifier:MP42MetadataKeyCoverArt
value:(id)artwork
dataType:MP42MetadataItemDataTypeImage
extendedLanguageTag:nil];
[metadata addMetadataItem:metadataItem];
}
metadata.mediaKind = self.mediaKind;
metadata.contentRating = self.contentRating;
MP42MetadataItem *mediaKind = [MP42MetadataItem metadataItemWithIdentifier:MP42MetadataKeyMediaKind
value:@(self.mediaKind)
dataType:MP42MetadataItemDataTypeInteger
extendedLanguageTag:nil];
[metadata addMetadataItem:mediaKind];
if (self.contentRating || keep) {
MP42MetadataItem *contentRating = [MP42MetadataItem metadataItemWithIdentifier:MP42MetadataKeyContentRating
value:@(self.contentRating)
dataType:MP42MetadataItemDataTypeInteger
extendedLanguageTag:nil];
[metadata addMetadataItem:contentRating];
}
return metadata;
}