Added a few comment.
This commit is contained in:
1 parent
d9da44e19b
commit
a9793e2ed8
5 files changed
+65
-18
No files matched your search
@@ -13,6 +13,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@class MP42Track;
|
@class MP42Track;
|
||||||
@class SBMediaTag;
|
@class SBMediaTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A SBMediaTagsControllert takes a MP42Track in input,
|
||||||
|
* and show a windows to configure the media characteristic tags
|
||||||
|
* of the input track. The new set of tags is added to the track
|
||||||
|
* after the user press the OK button.
|
||||||
|
*
|
||||||
|
* Custom media tags are preserved.
|
||||||
|
*/
|
||||||
@interface SBMediaTagsController : NSWindowController {
|
@interface SBMediaTagsController : NSWindowController {
|
||||||
@private
|
@private
|
||||||
MP42Track *_track;
|
MP42Track *_track;
|
||||||
@@ -21,6 +29,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
IBOutlet NSTableView *_tableView;
|
IBOutlet NSTableView *_tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes an SBMediaTagsController with the tags
|
||||||
|
* from the provided track.
|
||||||
|
*
|
||||||
|
* @param track the track
|
||||||
|
*
|
||||||
|
* @return an SBMediaTagsController.
|
||||||
|
*/
|
||||||
- (instancetype)initWithTrack:(MP42Track *)track;
|
- (instancetype)initWithTrack:(MP42Track *)track;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -11,6 +11,11 @@
|
|||||||
|
|
||||||
#pragma mark - Helpers
|
#pragma mark - Helpers
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A SBMediaTag is composed of a tag value and a boolean state.
|
||||||
|
*/
|
||||||
@interface SBMediaTag : NSObject {
|
@interface SBMediaTag : NSObject {
|
||||||
@private
|
@private
|
||||||
BOOL _state;
|
BOOL _state;
|
||||||
@@ -19,17 +24,35 @@
|
|||||||
NSString *_localizedDescription;
|
NSString *_localizedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the complete array of the predefined tags.
|
||||||
|
*/
|
||||||
+ (NSArray<NSString *> *)predefinedTags;
|
+ (NSArray<NSString *> *)predefinedTags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the predefined supported media tags
|
||||||
|
* for a particular media type.
|
||||||
|
*
|
||||||
|
* @param mediaType a MP42MediaType type.
|
||||||
|
*
|
||||||
|
* @return an array of NSString with the supported tags.
|
||||||
|
*/
|
||||||
+ (NSArray<NSString *> *)predefinedTagsForMediaType:(NSString *)mediaType;
|
+ (NSArray<NSString *> *)predefinedTagsForMediaType:(NSString *)mediaType;
|
||||||
+ (nullable NSString *)localizedDescriptionForTag:(NSString *)tag;
|
|
||||||
|
/**
|
||||||
|
* Returns the localized human readable title of a partical tag.
|
||||||
|
*/
|
||||||
|
+ (nullable NSString *)localizedTitleForTag:(NSString *)tag;
|
||||||
|
|
||||||
@property (nonatomic, readwrite) BOOL state;
|
@property (nonatomic, readwrite) BOOL state;
|
||||||
@property (nonatomic, readonly, nonnull) NSString *value;
|
@property (nonatomic, readonly) NSString *value;
|
||||||
@property (nonatomic, readonly, nonnull) NSString *localizedTitle;
|
@property (nonatomic, readonly) NSString *localizedTitle;
|
||||||
@property (nonatomic, readonly, nonnull) NSString *localizedDescription;
|
@property (nonatomic, readonly) NSString *localizedDescription;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
@implementation SBMediaTag
|
@implementation SBMediaTag
|
||||||
|
|
||||||
- (instancetype)initWithValue:(NSString *)value state:(BOOL)state {
|
- (instancetype)initWithValue:(NSString *)value state:(BOOL)state {
|
||||||
@@ -37,7 +60,7 @@
|
|||||||
if (self) {
|
if (self) {
|
||||||
_state = state;
|
_state = state;
|
||||||
_value = [value copy];
|
_value = [value copy];
|
||||||
_localizedTitle = [[SBMediaTag localizedDescriptionForTag:_value] copy];
|
_localizedTitle = [[SBMediaTag localizedTitleForTag:_value] copy];
|
||||||
|
|
||||||
if (_localizedTitle == nil) {
|
if (_localizedTitle == nil) {
|
||||||
_localizedTitle = [_value retain];
|
_localizedTitle = [_value retain];
|
||||||
@@ -76,8 +99,9 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ([mediaType isEqualToString:MP42MediaTypeSubtitle] ||
|
if ([mediaType isEqualToString:MP42MediaTypeSubtitle] ||
|
||||||
[mediaType isEqualToString:MP42MediaTypeClosedCaption]) {
|
[mediaType isEqualToString:MP42MediaTypeClosedCaption] ||
|
||||||
|
[mediaType isEqualToString:MP42MediaTypeAudio]) {
|
||||||
|
|
||||||
[tags addObjectsFromArray:@[@"public.translation"]];
|
[tags addObjectsFromArray:@[@"public.translation"]];
|
||||||
}
|
}
|
||||||
@@ -85,7 +109,7 @@
|
|||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (nullable NSString *)localizedDescriptionForTag:(NSString *)tag {
|
+ (nullable NSString *)localizedTitleForTag:(NSString *)tag {
|
||||||
NSDictionary *localizedDescriptions = @{@"public.main-program-content": NSLocalizedString(@"Main Program Content", nil),
|
NSDictionary *localizedDescriptions = @{@"public.main-program-content": NSLocalizedString(@"Main Program Content", nil),
|
||||||
@"public.auxiliary-content": NSLocalizedString(@"Auxiliary Content", nil),
|
@"public.auxiliary-content": NSLocalizedString(@"Auxiliary Content", nil),
|
||||||
@"public.subtitles.forced-only": NSLocalizedString(@"Contains Only Forced Subtitles", nil),
|
@"public.subtitles.forced-only": NSLocalizedString(@"Contains Only Forced Subtitles", nil),
|
||||||
@@ -117,16 +141,23 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A NSTableCellView that contains a single checkbox.
|
||||||
|
*/
|
||||||
@interface SBCheckBoxTableCellView : NSTableCellView {
|
@interface SBCheckBoxTableCellView : NSTableCellView {
|
||||||
IBOutlet NSButton *_checkBox;
|
IBOutlet NSButton *_checkBox;
|
||||||
SBMediaTag *_representedTag;
|
SBMediaTag *_representedTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain, nonnull) SBMediaTag *representedTag;
|
@property (nonatomic, readwrite, retain) SBMediaTag *representedTag;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
@implementation SBCheckBoxTableCellView
|
@implementation SBCheckBoxTableCellView
|
||||||
|
|
||||||
@synthesize representedTag = _representedTag;
|
@synthesize representedTag = _representedTag;
|
||||||
|
|||||||
Executable → Regular
File mode changed.
@@ -16,20 +16,20 @@
|
|||||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="480" height="238"/>
|
<rect key="contentRect" x="196" y="240" width="480" height="260"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="480" height="238"/>
|
<rect key="frame" x="0.0" y="0.0" width="480" height="260"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zzf-gN-TUn">
|
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zzf-gN-TUn">
|
||||||
<rect key="frame" x="20" y="61" width="440" height="127"/>
|
<rect key="frame" x="20" y="61" width="440" height="149"/>
|
||||||
<clipView key="contentView" id="2tz-9C-6LP">
|
<clipView key="contentView" id="2tz-9C-6LP">
|
||||||
<rect key="frame" x="1" y="1" width="438" height="125"/>
|
<rect key="frame" x="1" y="1" width="438" height="147"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="yBQ-Mz-XbW">
|
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="yBQ-Mz-XbW">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="438" height="125"/>
|
<rect key="frame" x="0.0" y="0.0" width="438" height="0.0"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<animations/>
|
<animations/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
</scroller>
|
</scroller>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4kV-dT-0Ea">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4kV-dT-0Ea">
|
||||||
<rect key="frame" x="18" y="201" width="444" height="17"/>
|
<rect key="frame" x="18" y="223" width="444" height="17"/>
|
||||||
<animations/>
|
<animations/>
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Select the media characteristic tags for this track." id="s8w-ML-LZK">
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Select the media characteristic tags for this track." id="s8w-ML-LZK">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -156,7 +156,7 @@ DQ
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="562" y="-217"/>
|
<point key="canvasLocation" x="562" y="-206"/>
|
||||||
</window>
|
</window>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
@@ -389,10 +389,10 @@
|
|||||||
A961476213F567E10068F161 /* SBPresetManager.m */,
|
A961476213F567E10068F161 /* SBPresetManager.m */,
|
||||||
A9B46A7E12B79B240040517A /* SBFileImport.h */,
|
A9B46A7E12B79B240040517A /* SBFileImport.h */,
|
||||||
A9B46A7F12B79B240040517A /* SBFileImport.m */,
|
A9B46A7F12B79B240040517A /* SBFileImport.m */,
|
||||||
CD71FEA112F1B5AF00F0A98D /* SBMetadataSearchController.h */,
|
|
||||||
CD71FEA212F1B5AF00F0A98D /* SBMetadataSearchController.m */,
|
|
||||||
A96946501BA3F83D0048C004 /* SBMediaTagsController.h */,
|
A96946501BA3F83D0048C004 /* SBMediaTagsController.h */,
|
||||||
A96946511BA3F83D0048C004 /* SBMediaTagsController.m */,
|
A96946511BA3F83D0048C004 /* SBMediaTagsController.m */,
|
||||||
|
CD71FEA112F1B5AF00F0A98D /* SBMetadataSearchController.h */,
|
||||||
|
CD71FEA212F1B5AF00F0A98D /* SBMetadataSearchController.m */,
|
||||||
CD56963012FAAD680029FADB /* SBArtworkSelector.h */,
|
CD56963012FAAD680029FADB /* SBArtworkSelector.h */,
|
||||||
CD56963112FAAD680029FADB /* SBArtworkSelector.m */,
|
CD56963112FAAD680029FADB /* SBArtworkSelector.m */,
|
||||||
A9B46A8212B79B240040517A /* SBPrefsController.h */,
|
A9B46A8212B79B240040517A /* SBPrefsController.h */,
|
||||||
|
|||||||
Reference in new issue
Block a user