More work on the metadata preferences.

This commit is contained in:
Damiano Galassi committed 2016-07-28 13:32:15 +02:00
1 parent e92b1e96ec
commit bc773092f8
7 files changed
+465 -41

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
//
// SBMetadataDefaultSet.h
// Subler
//
// Created by Damiano Galassi on 28/07/2016.
//
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SBMetadataDefaultItem : NSObject
+ (instancetype)itemWithKey:(NSString *)key value:(NSArray *)value;
- (instancetype)initWithKey:(NSString *)key value:(NSArray *)value;
@property (nonatomic, readonly) NSString *key;
@property (nonatomic, readwrite, copy) NSArray *value;
@end
NS_ASSUME_NONNULL_END
+28
View File
@@ -0,0 +1,28 @@
//
// SBMetadataDefaultSet.m
// Subler
//
// Created by Damiano Galassi on 28/07/2016.
//
//
#import "SBMetadataDefaultItem.h"
@implementation SBMetadataDefaultItem
- (instancetype)initWithKey:(NSString *)key value:(NSArray *)value
{
self = [super init];
if (self) {
_key = [key copy];
_value = [value copy];
}
return self;
}
+ (instancetype)itemWithKey:(NSString *)key value:(NSArray *)value
{
return [[self alloc] initWithKey:key value:value];
}
@end
+258 -4
View File
@@ -8,15 +8,269 @@
#import "SBMetadataPrefsViewController.h"
@interface SBMetadataPrefsViewController ()
#import "SBMetadataDefaultItem.h"
#import <MP42Foundation/MP42Metadata.h>
@interface SBMetadataPrefsViewController () <NSTableViewDelegate>
@property (nonatomic, weak) IBOutlet NSTokenField *builtInTokenField;
@property (nonatomic, weak) IBOutlet NSPopUpButton *addMetadataPopUpButton;
@property (nonatomic, weak) IBOutlet NSButton *removeMetadataButton;
@property (nonatomic, weak) IBOutlet NSTableView *tableView;
@property (nonatomic, readonly) NSArray<NSString *> *movieTokens;
@property (nonatomic, readonly) NSArray<NSString *> *tvShowTokens;
@property (nonatomic, readwrite) NSArray<NSString *> *currentTokens;
@property (nonatomic) NSArray<NSString *> *matches;
@property (nonatomic, readwrite) NSMutableArray<SBMetadataDefaultItem *> *items;
@property (nonatomic, strong) IBOutlet NSArrayController *itemsController;
@end
@implementation SBMetadataPrefsViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do view setup here.
- (void)loadView
{
[super loadView];
for (NSString *tag in [MP42Metadata writableMetadata]) {
[self.addMetadataPopUpButton addItemWithTitle:tag];
}
_items = [[NSMutableArray alloc] init];
NSArray<NSString *> *context = [MP42Metadata availableMetadata];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"key"
ascending:YES
comparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
NSInteger right = [context indexOfObject:obj2];
NSInteger left = [context indexOfObject:obj1];
return (right < left) ? NSOrderedDescending : NSOrderedAscending;
}];
[self.itemsController setSortDescriptors:@[sortDescriptor]];
[self.itemsController addObjects:[self movieDefaults]];
self.itemsController.selectionIndexes = [NSIndexSet indexSet];
self.currentTokens = self.movieTokens;
[self.builtInTokenField setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@"%%"]];
self.builtInTokenField.stringValue = [self.currentTokens componentsJoinedByString:@"%%"];
}
#pragma mark - Defaults
- (NSArray<NSString *> *)movieTokens
{
return @[@"{Title}",
@"{Composer}",
@"{Genre}",
@"{Release Date}",
@"{Description}",
@"{Long Description}",
@"{Rating}",
@"{Studio}",
@"{Cast}",
@"{Director}",
@"{Producers}",
@"{Screenwriters}",
@"{Copyright}",
@"{contentID}",
@"{iTunes Country}",
@"{Executive Producer}"];
}
- (NSArray<NSString *> *)tvShowTokens
{
return @[@"{Episode Name}",
@"{Series Name}",
@"{Composer}",
@"{Genre}",
@"{Release Date}",
@"{Track #}",
@"{Disk #}",
@"{TV Show}",
@"{TV Episode #}",
@"{TV Network}",
@"{TV Episode ID}",
@"{TV Season}",
@"{Description}",
@"{Long Description}",
@"{Series Description}",
@"{Rating}",
@"{Studio}",
@"{Cast}",
@"{Director}",
@"{Producers}",
@"{Screenwriters}",
@"{Copyright}",
@"{contentID}",
@"{artistID}",
@"{playlistID}",
@"{iTunes Country}",
@"{Executive Producer}"];
}
- (NSArray<SBMetadataDefaultItem *> *)movieDefaults
{
return @[
[SBMetadataDefaultItem itemWithKey:@"Name" value:@[@"{Title}"]],
[SBMetadataDefaultItem itemWithKey:@"Artist" value:@[@"{Director}"]],
[SBMetadataDefaultItem itemWithKey:@"Composer" value:@[@"{Composer}"]],
[SBMetadataDefaultItem itemWithKey:@"Genre" value:@[@"{Genre}"]],
[SBMetadataDefaultItem itemWithKey:@"Release Date" value:@[@"{Release Date}"]],
[SBMetadataDefaultItem itemWithKey:@"Description" value:@[@"{Description}"]],
[SBMetadataDefaultItem itemWithKey:@"Long Description" value:@[@"{Long Description}"]],
[SBMetadataDefaultItem itemWithKey:@"Rating" value:@[@"{Rating}"]],
[SBMetadataDefaultItem itemWithKey:@"Studio" value:@[@"{Studio}"]],
[SBMetadataDefaultItem itemWithKey:@"Cast" value:@[@"{Cast}"]],
[SBMetadataDefaultItem itemWithKey:@"Director" value:@[@"{Director}"]],
[SBMetadataDefaultItem itemWithKey:@"Producers" value:@[@"{Producers}"]],
[SBMetadataDefaultItem itemWithKey:@"Screenwriters" value:@[@"{Screenwriters}"]],
[SBMetadataDefaultItem itemWithKey:@"Copyright" value:@[@"{Copyright}"]],
[SBMetadataDefaultItem itemWithKey:@"contentID" value:@[@"{contentID}"]],
[SBMetadataDefaultItem itemWithKey:@"iTunes Country" value:@[@"{iTunes Country}"]],
[SBMetadataDefaultItem itemWithKey:@"Executive Producer" value:@[@"{Executive Producer}"]],
];
}
- (NSArray<SBMetadataDefaultItem *> *)tvShowDefaults
{
return @[
[SBMetadataDefaultItem itemWithKey:@"Name" value:@[@"{Episode Name}"]],
[SBMetadataDefaultItem itemWithKey:@"Artist" value:@[@"{Series Name}"]],
[SBMetadataDefaultItem itemWithKey:@"Album Artist" value:@[@"{Series Name}"]],
[SBMetadataDefaultItem itemWithKey:@"Album" value:@[@"{Series Name}"]],
[SBMetadataDefaultItem itemWithKey:@"Composer" value:@[@"{Composer}"]],
[SBMetadataDefaultItem itemWithKey:@"Genre" value:@[@"{Genre}"]],
[SBMetadataDefaultItem itemWithKey:@"Release Date" value:@[@"{Release Date}"]],
[SBMetadataDefaultItem itemWithKey:@"Track #" value:@[@"{Track #}"]],
[SBMetadataDefaultItem itemWithKey:@"Disk #" value:@[@"{Disk #}"]],
[SBMetadataDefaultItem itemWithKey:@"TV Show" value:@[@"{TV Show}"]],
[SBMetadataDefaultItem itemWithKey:@"TV Episode #" value:@[@"{TV Episode #}"]],
[SBMetadataDefaultItem itemWithKey:@"TV Network" value:@[@"{TV Network}"]],
[SBMetadataDefaultItem itemWithKey:@"TV Episode ID" value:@[@"{TV Episode ID}"]],
[SBMetadataDefaultItem itemWithKey:@"TV Season" value:@[@"{TV Season}"]],
[SBMetadataDefaultItem itemWithKey:@"Description" value:@[@"{Description}"]],
[SBMetadataDefaultItem itemWithKey:@"Long Description" value:@[@"{Long Description}"]],
[SBMetadataDefaultItem itemWithKey:@"Series Description" value:@[@"{Series Description}"]],
[SBMetadataDefaultItem itemWithKey:@"Rating" value:@[@"{Rating}"]],
[SBMetadataDefaultItem itemWithKey:@"Studio" value:@[@"{Studio}"]],
[SBMetadataDefaultItem itemWithKey:@"Cast" value:@[@"{Cast}"]],
[SBMetadataDefaultItem itemWithKey:@"Director" value:@[@"{Director}"]],
[SBMetadataDefaultItem itemWithKey:@"Producers" value:@[@"{Producers}"]],
[SBMetadataDefaultItem itemWithKey:@"Screenwriters" value:@[@"{Screenwriters}"]],
[SBMetadataDefaultItem itemWithKey:@"Executive Producer" value:@[@"{Executive Producer}"]],
[SBMetadataDefaultItem itemWithKey:@"Copyright" value:@[@"{Copyright}"]],
[SBMetadataDefaultItem itemWithKey:@"contentID" value:@[@"{contentID}"]],
[SBMetadataDefaultItem itemWithKey:@"artistID" value:@[@"{artistID}"]],
[SBMetadataDefaultItem itemWithKey:@"playlistID" value:@[@"{playlistID}"]],
[SBMetadataDefaultItem itemWithKey:@"iTunes Country" value:@[@"{iTunes Country}"]],
[SBMetadataDefaultItem itemWithKey:@"Sort Album" value:@[@"{Series Name}", @", Season ", @"{TV Season}"]],
];
}
- (IBAction)addMetadataItem:(id)sender
{
NSString *key = [sender selectedItem].title;
if (key.length) {
SBMetadataDefaultItem *item = [[SBMetadataDefaultItem alloc] initWithKey:key value:@[@""]];
[self.itemsController addObject:item];
[self.itemsController rearrangeObjects];
}
}
#pragma mark - Type selector
- (IBAction)setType:(NSPopUpButton *)sender
{
if (sender.selectedTag) {
self.currentTokens = self.tvShowTokens;
self.items = [[self tvShowDefaults] mutableCopy];
}
else {
self.currentTokens = self.movieTokens;
self.items = [[self movieDefaults] mutableCopy];
}
self.itemsController.selectionIndexes = [NSIndexSet indexSet];
self.builtInTokenField.stringValue = [self.currentTokens componentsJoinedByString:@"%%"];
}
#pragma mark - Table View
- (void)tableView:(NSTableView *)tableView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row
{
NSTableCellView *view = [rowView viewAtColumn:1];
NSTokenField *tokenField = view.subviews.firstObject;
if ([tokenField isKindOfClass:[NSTokenField class]]) {
tokenField.tokenizingCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"%%"];
}
}
#pragma mark - Format Token Field Delegate
- (NSString *)tokenField:(NSTokenField *)tokenField displayStringForRepresentedObject:(id)representedObject
{
if ([representedObject rangeOfString: @"{"].location == 0) {
return [(NSString *)representedObject substringWithRange:NSMakeRange(1, [(NSString*)representedObject length]-2)];
}
return representedObject;
}
- (NSTokenStyle)tokenField:(NSTokenField *)tokenField styleForRepresentedObject:(id)representedObject
{
if ([representedObject rangeOfString: @"{"].location == 0) {
return NSRoundedTokenStyle;
}
else {
return NSPlainTextTokenStyle;
}
}
- (id)tokenField:(NSTokenField *)tokenField representedObjectForEditingString:(NSString *)editingString
{
return editingString;
}
- (NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex
indexOfSelectedItem:(NSInteger *)selectedIndex
{
self.matches = [self.currentTokens filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@", substring]];
return self.matches;
}
- (NSString *)tokenField:(NSTokenField *)tokenField editingStringForRepresentedObject:(id)representedObject
{
if ([representedObject rangeOfString: @"{"].location == 0) {
return [NSString stringWithFormat:@"%%%@%%", representedObject];
}
else {
return representedObject;
}
}
- (NSArray *)tokenField:(NSTokenField *)tokenField shouldAddObjects:(NSArray *)tokens atIndex:(NSUInteger)index
{
return tokens;
}
- (BOOL)tokenField:(NSTokenField *)tokenField writeRepresentedObjects:(NSArray *)objects toPasteboard:(NSPasteboard *)pboard
{
NSString *format = [objects componentsJoinedByString:@"%%"];
[pboard setString:format forType:NSPasteboardTypeString];
return YES;
}
@end
+147 -36
View File
@@ -1,37 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11173.2" systemVersion="16A238m" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" generatesPrototypingConstraints="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11173.2" systemVersion="16A238m" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11173.2"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SBMetadataPrefsViewController">
<connections>
<outlet property="addMetadataPopUpButton" destination="Jdh-Cj-6ef" id="Ph0-fz-ZY3"/>
<outlet property="builtInTokenField" destination="Y15-gP-AOw" id="ac2-6x-h6b"/>
<outlet property="itemsController" destination="4Wq-Wo-sl2" id="eTI-Pm-iTj"/>
<outlet property="removeMetadataButton" destination="sd5-qb-K5v" id="B6v-8K-9aR"/>
<outlet property="tableView" destination="Tid-Rc-Ljr" id="Y8N-pm-La7"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="480" height="383"/>
<rect key="frame" x="0.0" y="0.0" width="500" height="475"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1XK-zr-YdW">
<rect key="frame" x="20" y="111" width="440" height="252"/>
<rect key="frame" x="20" y="99" width="460" height="317"/>
<clipView key="contentView" id="mho-zw-2Ud">
<rect key="frame" x="1" y="0.0" width="438" height="251"/>
<rect key="frame" x="1" y="0.0" width="458" height="316"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="REl-53-Sku" viewBased="YES" id="Tid-Rc-Ljr">
<rect key="frame" x="0.0" y="0.0" width="438" height="228"/>
<rect key="frame" x="0.0" y="0.0" width="458" height="293"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="116" minWidth="40" maxWidth="1000" id="6um-Rw-luk">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<tableColumn width="149" minWidth="40" maxWidth="1000" id="6um-Rw-luk">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Annotations">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -44,20 +48,27 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="vYq-3Z-IEz">
<rect key="frame" x="1" y="1" width="116" height="17"/>
<rect key="frame" x="1" y="1" width="149" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mve-P9-Jqq">
<rect key="frame" x="0.0" y="0.0" width="116" height="17"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Table View Cell" id="ko1-Cf-TEq">
<font key="font" metaFont="system"/>
<rect key="frame" x="0.0" y="0.0" width="149" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="tPk-Fn-5Rw"/>
</constraints>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Table View Cell" id="ko1-Cf-TEq">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="vYq-3Z-IEz" name="value" keyPath="objectValue.key" id="0fC-Hm-woV"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="Mve-P9-Jqq" firstAttribute="leading" secondItem="vYq-3Z-IEz" secondAttribute="leading" constant="2" id="7Jx-2D-7Ki"/>
<constraint firstAttribute="trailing" secondItem="Mve-P9-Jqq" secondAttribute="trailing" constant="2" id="bZ5-O5-vsh"/>
<constraint firstItem="Mve-P9-Jqq" firstAttribute="centerY" secondItem="vYq-3Z-IEz" secondAttribute="centerY" id="ijV-6C-DJR"/>
<constraint firstItem="Mve-P9-Jqq" firstAttribute="centerX" secondItem="vYq-3Z-IEz" secondAttribute="centerX" id="tY7-ot-Ear"/>
</constraints>
@@ -67,8 +78,8 @@
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn width="316" minWidth="40" maxWidth="1000" id="Aj4-bk-6RK">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<tableColumn width="303" minWidth="40" maxWidth="1000" id="Aj4-bk-6RK">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Value">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -81,23 +92,28 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="5Ey-Te-51o">
<rect key="frame" x="120" y="1" width="316" height="17"/>
<rect key="frame" x="153" y="1" width="303" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tokenField verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3sj-gY-zSo">
<rect key="frame" x="3" y="0.0" width="310" height="17"/>
<rect key="frame" x="1" y="0.0" width="301" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="jWi-jm-bOD"/>
</constraints>
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" drawsBackground="YES" allowsEditingTextAttributes="YES" id="BaM-xn-Wzr">
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" allowsEditingTextAttributes="YES" id="BaM-xn-Wzr">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</tokenFieldCell>
<connections>
<binding destination="5Ey-Te-51o" name="value" keyPath="objectValue.value" id="abE-Cv-9mt"/>
<outlet property="delegate" destination="-2" id="2P5-NS-pMb"/>
</connections>
</tokenField>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="3sj-gY-zSo" secondAttribute="trailing" constant="3" id="5R9-8J-dvW"/>
<constraint firstItem="3sj-gY-zSo" firstAttribute="centerX" secondItem="5Ey-Te-51o" secondAttribute="centerX" id="EXW-NW-hal"/>
<constraint firstItem="3sj-gY-zSo" firstAttribute="leading" secondItem="5Ey-Te-51o" secondAttribute="leading" constant="3" id="Q7b-Vw-1vj"/>
<constraint firstItem="3sj-gY-zSo" firstAttribute="centerY" secondItem="5Ey-Te-51o" secondAttribute="centerY" id="ee7-eP-eFc"/>
</constraints>
@@ -105,11 +121,16 @@
</prototypeCellViews>
</tableColumn>
</tableColumns>
<connections>
<binding destination="4Wq-Wo-sl2" name="content" keyPath="arrangedObjects" id="RaQ-JH-c1I"/>
<binding destination="4Wq-Wo-sl2" name="selectionIndexes" keyPath="selectionIndexes" previousBinding="RaQ-JH-c1I" id="VZH-su-D0I"/>
<outlet property="delegate" destination="-2" id="9Dc-Qd-Jhm"/>
</connections>
</tableView>
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="htB-dN-ZBI">
<rect key="frame" x="1" y="7" width="0.0" height="16"/>
<rect key="frame" x="1" y="235" width="438" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="V85-a0-dUm">
@@ -117,12 +138,12 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" id="REl-53-Sku">
<rect key="frame" x="0.0" y="0.0" width="438" height="23"/>
<rect key="frame" x="0.0" y="0.0" width="458" height="23"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8sr-aI-VZy">
<rect key="frame" x="18" y="20" width="442" height="17"/>
<rect key="frame" x="18" y="20" width="462" height="17"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Drag the preferred tokens above." id="OYx-Dd-YIf">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -130,30 +151,120 @@
</textFieldCell>
</textField>
<tokenField verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Y15-gP-AOw">
<rect key="frame" x="16" y="45" width="444" height="57"/>
<constraints>
<constraint firstAttribute="height" constant="57" id="EoB-Gb-aBs"/>
</constraints>
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" allowsEditingTextAttributes="YES" id="rG5-g2-YmU">
<rect key="frame" x="16" y="45" width="464" height="16"/>
<tokenFieldCell key="cell" selectable="YES" allowsUndo="NO" alignment="left" allowsEditingTextAttributes="YES" id="rG5-g2-YmU">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</tokenFieldCell>
<connections>
<outlet property="delegate" destination="-2" id="vWU-Nj-Joo"/>
</connections>
</tokenField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sd5-qb-K5v">
<rect key="frame" x="51" y="68" width="26" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="BAV-kq-PiC"/>
<constraint firstAttribute="width" constant="26" id="oQm-pY-3B4"/>
</constraints>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="9UV-xM-L5F">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="remove:" target="4Wq-Wo-sl2" id="LfP-AS-NCc"/>
<binding destination="4Wq-Wo-sl2" name="enabled" keyPath="selectionIndexes.count" id="K6b-sv-ld3"/>
</connections>
</button>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Jdh-Cj-6ef">
<rect key="frame" x="20" y="68" width="32" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="T0Q-gO-rKg"/>
</constraints>
<popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" alignment="center" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" pullsDown="YES" selectedItem="5wF-Yq-18d" id="Hfq-XE-kzZ">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
<menu key="menu" title="OtherViews" id="ywu-nj-9bP">
<items>
<menuItem image="NSAddTemplate" hidden="YES" id="5wF-Yq-18d">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="addMetadataItem:" target="-2" id="wQl-dy-iQm"/>
</connections>
</popUpButton>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="s8h-Of-e4s">
<rect key="frame" x="150" y="424" width="212" height="51"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rna-gA-Ye5">
<rect key="frame" x="18" y="13" width="38" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Type:" id="sEl-ux-WNp">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VhJ-E3-nre">
<rect key="frame" x="60" y="7" width="135" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="1cT-Nf-sF5"/>
</constraints>
<popUpButtonCell key="cell" type="push" title="Movie" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="vN1-gZ-5Ql" id="l8l-61-5wi">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="FUZ-7p-093">
<items>
<menuItem title="Movie" state="on" id="vN1-gZ-5Ql"/>
<menuItem title="TV Show" tag="1" id="XNN-Ip-mwC"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="setType:" target="-2" id="iX0-fs-zLz"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstItem="VhJ-E3-nre" firstAttribute="leading" secondItem="rna-gA-Ye5" secondAttribute="trailing" constant="8" symbolic="YES" id="2ci-5W-fDk"/>
<constraint firstAttribute="trailing" secondItem="VhJ-E3-nre" secondAttribute="trailing" constant="20" symbolic="YES" id="EbE-Un-7bj"/>
<constraint firstItem="rna-gA-Ye5" firstAttribute="baseline" secondItem="VhJ-E3-nre" secondAttribute="baseline" id="J0k-dm-HvI"/>
<constraint firstItem="rna-gA-Ye5" firstAttribute="top" secondItem="s8h-Of-e4s" secondAttribute="top" constant="21" id="ly0-u8-u2s"/>
<constraint firstItem="rna-gA-Ye5" firstAttribute="leading" secondItem="s8h-Of-e4s" secondAttribute="leading" constant="20" symbolic="YES" id="wVT-oI-0mq"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="8sr-aI-VZy" firstAttribute="top" secondItem="Y15-gP-AOw" secondAttribute="bottom" constant="8" id="7h5-VE-zqQ"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" symbolic="YES" id="GOc-p2-SzS"/>
<constraint firstItem="Y15-gP-AOw" firstAttribute="trailing" secondItem="8sr-aI-VZy" secondAttribute="trailing" id="HOb-w5-EHD"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="NyJ-eY-ZFC"/>
<constraint firstAttribute="trailing" secondItem="Y15-gP-AOw" secondAttribute="trailing" constant="22" id="Oly-XE-KiI"/>
<constraint firstAttribute="trailing" secondItem="1XK-zr-YdW" secondAttribute="trailing" constant="20" symbolic="YES" id="QZy-AY-F0A"/>
<constraint firstItem="Y15-gP-AOw" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="18" id="Sq8-Y2-Qpp"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="leading" secondItem="8sr-aI-VZy" secondAttribute="leading" id="aak-4s-bsZ"/>
<constraint firstAttribute="bottom" secondItem="Y15-gP-AOw" secondAttribute="bottom" constant="45" id="amT-vc-c7k"/>
<constraint firstItem="Y15-gP-AOw" firstAttribute="top" secondItem="1XK-zr-YdW" secondAttribute="bottom" constant="9" id="jsS-ky-LCw"/>
<constraint firstItem="sd5-qb-K5v" firstAttribute="top" secondItem="Jdh-Cj-6ef" secondAttribute="top" id="0wu-tB-LBD"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="BWX-Z9-vgq"/>
<constraint firstItem="s8h-Of-e4s" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" constant="6" id="DAl-VK-d7i"/>
<constraint firstItem="Jdh-Cj-6ef" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="Fhc-bW-PL1"/>
<constraint firstAttribute="trailing" secondItem="Y15-gP-AOw" secondAttribute="trailing" constant="22" id="MSC-cm-mQK"/>
<constraint firstItem="Y15-gP-AOw" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="18" id="Mqb-SN-Ti0"/>
<constraint firstItem="Y15-gP-AOw" firstAttribute="trailing" secondItem="8sr-aI-VZy" secondAttribute="trailing" id="Q0g-UM-FuG"/>
<constraint firstAttribute="trailing" secondItem="1XK-zr-YdW" secondAttribute="trailing" constant="20" symbolic="YES" id="SB7-wE-aJH"/>
<constraint firstItem="Jdh-Cj-6ef" firstAttribute="top" secondItem="1XK-zr-YdW" secondAttribute="bottom" constant="8" symbolic="YES" id="SWg-So-TIX"/>
<constraint firstItem="Y15-gP-AOw" firstAttribute="top" secondItem="Jdh-Cj-6ef" secondAttribute="bottom" constant="8" id="UGu-eh-QeN"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="top" secondItem="s8h-Of-e4s" secondAttribute="bottom" constant="8" symbolic="YES" id="ewh-VY-2Ze"/>
<constraint firstItem="8sr-aI-VZy" firstAttribute="top" secondItem="Y15-gP-AOw" secondAttribute="bottom" constant="8" symbolic="YES" id="hB4-Mu-Jef"/>
<constraint firstAttribute="bottom" secondItem="8sr-aI-VZy" secondAttribute="bottom" constant="20" symbolic="YES" id="haJ-r5-7gq"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="leading" secondItem="8sr-aI-VZy" secondAttribute="leading" id="mwY-WX-5t4"/>
<constraint firstItem="sd5-qb-K5v" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="51" id="p0m-KY-KAD"/>
<constraint firstItem="1XK-zr-YdW" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="59" id="pmj-ye-CSF"/>
<constraint firstItem="s8h-Of-e4s" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="vu5-JL-s1d"/>
</constraints>
<point key="canvasLocation" x="139" y="224.5"/>
<point key="canvasLocation" x="-252" y="-244"/>
</customView>
<arrayController objectClassName="SBMetadataDefaultItem" id="4Wq-Wo-sl2">
<connections>
<binding destination="-2" name="contentArray" keyPath="self.items" id="4xU-KX-jfc"/>
</connections>
</arrayController>
</objects>
<resources>
<image name="NSAddTemplate" width="11" height="11"/>
<image name="NSRemoveTemplate" width="11" height="11"/>
</resources>
</document>
+2 -1
View File
@@ -65,11 +65,12 @@
- (instancetype)init
{
if ((self = [super initWithWindowNibName:@"Prefs"])) {
_metadataController = [[SBMetadataPrefsViewController alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(updateTableView:)
name:@"SBPresetManagerUpdatedNotification" object:nil];
}
_metadataController = [[SBMetadataPrefsViewController alloc] init];
return self;
}