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 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 {
|
||||
@private
|
||||
MP42Track *_track;
|
||||
@@ -21,6 +29,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
IBOutlet NSTableView *_tableView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an SBMediaTagsController with the tags
|
||||
* from the provided track.
|
||||
*
|
||||
* @param track the track
|
||||
*
|
||||
* @return an SBMediaTagsController.
|
||||
*/
|
||||
- (instancetype)initWithTrack:(MP42Track *)track;
|
||||
|
||||
@end
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A SBMediaTag is composed of a tag value and a boolean state.
|
||||
*/
|
||||
@interface SBMediaTag : NSObject {
|
||||
@private
|
||||
BOOL _state;
|
||||
@@ -19,17 +24,35 @@
|
||||
NSString *_localizedDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the complete array of the predefined tags.
|
||||
*/
|
||||
+ (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;
|
||||
+ (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, readonly, nonnull) NSString *value;
|
||||
@property (nonatomic, readonly, nonnull) NSString *localizedTitle;
|
||||
@property (nonatomic, readonly, nonnull) NSString *localizedDescription;
|
||||
@property (nonatomic, readonly) NSString *value;
|
||||
@property (nonatomic, readonly) NSString *localizedTitle;
|
||||
@property (nonatomic, readonly) NSString *localizedDescription;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@implementation SBMediaTag
|
||||
|
||||
- (instancetype)initWithValue:(NSString *)value state:(BOOL)state {
|
||||
@@ -37,7 +60,7 @@
|
||||
if (self) {
|
||||
_state = state;
|
||||
_value = [value copy];
|
||||
_localizedTitle = [[SBMediaTag localizedDescriptionForTag:_value] copy];
|
||||
_localizedTitle = [[SBMediaTag localizedTitleForTag:_value] copy];
|
||||
|
||||
if (_localizedTitle == nil) {
|
||||
_localizedTitle = [_value retain];
|
||||
@@ -76,8 +99,9 @@
|
||||
|
||||
}
|
||||
|
||||
else if ([mediaType isEqualToString:MP42MediaTypeSubtitle] ||
|
||||
[mediaType isEqualToString:MP42MediaTypeClosedCaption]) {
|
||||
if ([mediaType isEqualToString:MP42MediaTypeSubtitle] ||
|
||||
[mediaType isEqualToString:MP42MediaTypeClosedCaption] ||
|
||||
[mediaType isEqualToString:MP42MediaTypeAudio]) {
|
||||
|
||||
[tags addObjectsFromArray:@[@"public.translation"]];
|
||||
}
|
||||
@@ -85,7 +109,7 @@
|
||||
return tags;
|
||||
}
|
||||
|
||||
+ (nullable NSString *)localizedDescriptionForTag:(NSString *)tag {
|
||||
+ (nullable NSString *)localizedTitleForTag:(NSString *)tag {
|
||||
NSDictionary *localizedDescriptions = @{@"public.main-program-content": NSLocalizedString(@"Main Program Content", nil),
|
||||
@"public.auxiliary-content": NSLocalizedString(@"Auxiliary Content", nil),
|
||||
@"public.subtitles.forced-only": NSLocalizedString(@"Contains Only Forced Subtitles", nil),
|
||||
@@ -117,16 +141,23 @@
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A NSTableCellView that contains a single checkbox.
|
||||
*/
|
||||
@interface SBCheckBoxTableCellView : NSTableCellView {
|
||||
IBOutlet NSButton *_checkBox;
|
||||
SBMediaTag *_representedTag;
|
||||
}
|
||||
|
||||
|
||||
@property (nonatomic, readwrite, retain, nonnull) SBMediaTag *representedTag;
|
||||
@property (nonatomic, readwrite, retain) SBMediaTag *representedTag;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@implementation SBCheckBoxTableCellView
|
||||
|
||||
@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">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="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"/>
|
||||
<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"/>
|
||||
<subviews>
|
||||
<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">
|
||||
<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"/>
|
||||
<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">
|
||||
<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"/>
|
||||
<animations/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
@@ -101,7 +101,7 @@
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<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/>
|
||||
<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"/>
|
||||
@@ -156,7 +156,7 @@ DQ
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="562" y="-217"/>
|
||||
<point key="canvasLocation" x="562" y="-206"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -389,10 +389,10 @@
|
||||
A961476213F567E10068F161 /* SBPresetManager.m */,
|
||||
A9B46A7E12B79B240040517A /* SBFileImport.h */,
|
||||
A9B46A7F12B79B240040517A /* SBFileImport.m */,
|
||||
CD71FEA112F1B5AF00F0A98D /* SBMetadataSearchController.h */,
|
||||
CD71FEA212F1B5AF00F0A98D /* SBMetadataSearchController.m */,
|
||||
A96946501BA3F83D0048C004 /* SBMediaTagsController.h */,
|
||||
A96946511BA3F83D0048C004 /* SBMediaTagsController.m */,
|
||||
CD71FEA112F1B5AF00F0A98D /* SBMetadataSearchController.h */,
|
||||
CD71FEA212F1B5AF00F0A98D /* SBMetadataSearchController.m */,
|
||||
CD56963012FAAD680029FADB /* SBArtworkSelector.h */,
|
||||
CD56963112FAAD680029FADB /* SBArtworkSelector.m */,
|
||||
A9B46A8212B79B240040517A /* SBPrefsController.h */,
|
||||
|
||||
Reference in new issue
Block a user