forked from HandBrake/HandBrake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@BradleyS thanks @Rodeo314 for his help with this.
- Loading branch information
1 parent
afc34ed
commit d1a3d95
Showing
7 changed files
with
267 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> | ||
<dependencies> | ||
<deployment identifier="macosx"/> | ||
<development version="8000" identifier="xcode"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<objects> | ||
<customObject id="-2" userLabel="File's Owner" customClass="HBRenamePresetController"> | ||
<connections> | ||
<outlet property="name" destination="UXm-yG-bgW" id="htS-T7-qP0"/> | ||
<outlet property="renameButton" destination="WEv-SR-3sw" id="lRz-JT-RDG"/> | ||
<outlet property="window" destination="C4G-OG-ksc" id="oNS-V8-CBz"/> | ||
</connections> | ||
</customObject> | ||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> | ||
<customObject id="-3" userLabel="Application" customClass="NSObject"/> | ||
<window title="Rename Preset" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="C4G-OG-ksc"> | ||
<windowStyleMask key="styleMask" titled="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="283" y="305" width="290" height="132"/> | ||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/> | ||
<view key="contentView" id="3oN-GT-JmW"> | ||
<rect key="frame" x="0.0" y="0.0" width="290" height="132"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A8w-ij-o7q"> | ||
<rect key="frame" x="18" y="95" width="114" height="17"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="New preset name:" id="Pe0-gr-Yv4"> | ||
<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> | ||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UXm-yG-bgW"> | ||
<rect key="frame" x="20" y="65" width="250" height="22"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" title="Untitled" drawsBackground="YES" id="NQn-fS-Rbd"> | ||
<font key="font" metaFont="system"/> | ||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="Iwm-TQ-ug8"/> | ||
</connections> | ||
</textField> | ||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HkI-lC-Q2A"> | ||
<rect key="frame" x="106" y="13" width="82" height="32"/> | ||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="N2f-jz-YyX"> | ||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> | ||
<font key="font" metaFont="system"/> | ||
<string key="keyEquivalent" base64-UTF8="YES"> | ||
Gw | ||
</string> | ||
</buttonCell> | ||
<connections> | ||
<action selector="dismiss:" target="-2" id="LVI-0f-38c"/> | ||
</connections> | ||
</button> | ||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WEv-SR-3sw" userLabel="Rename Button"> | ||
<rect key="frame" x="187" y="13" width="89" height="32"/> | ||
<buttonCell key="cell" type="push" title="Rename" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Z9M-dc-5Ml"> | ||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> | ||
<font key="font" metaFont="system"/> | ||
<string key="keyEquivalent" base64-UTF8="YES"> | ||
DQ | ||
</string> | ||
</buttonCell> | ||
<connections> | ||
<action selector="rename:" target="-2" id="BAK-gD-GHH"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
<constraints> | ||
<constraint firstItem="UXm-yG-bgW" firstAttribute="trailing" secondItem="WEv-SR-3sw" secondAttribute="trailing" id="FMb-6L-akr"/> | ||
<constraint firstItem="HkI-lC-Q2A" firstAttribute="baseline" secondItem="WEv-SR-3sw" secondAttribute="baseline" id="SxI-wa-yJV"/> | ||
<constraint firstItem="A8w-ij-o7q" firstAttribute="leading" secondItem="UXm-yG-bgW" secondAttribute="leading" id="TKi-pl-2oX"/> | ||
<constraint firstItem="A8w-ij-o7q" firstAttribute="leading" secondItem="3oN-GT-JmW" secondAttribute="leading" constant="20" symbolic="YES" id="Tnf-NN-kbG"/> | ||
<constraint firstAttribute="bottom" secondItem="HkI-lC-Q2A" secondAttribute="bottom" constant="20" symbolic="YES" id="UNd-bY-NCa"/> | ||
<constraint firstItem="A8w-ij-o7q" firstAttribute="top" secondItem="3oN-GT-JmW" secondAttribute="top" constant="20" symbolic="YES" id="ds6-hB-jKz"/> | ||
<constraint firstItem="WEv-SR-3sw" firstAttribute="leading" secondItem="HkI-lC-Q2A" secondAttribute="trailing" constant="11" id="iPl-sl-4rt"/> | ||
<constraint firstAttribute="trailing" secondItem="UXm-yG-bgW" secondAttribute="trailing" constant="20" symbolic="YES" id="nUT-Cq-nKu"/> | ||
<constraint firstItem="UXm-yG-bgW" firstAttribute="top" secondItem="A8w-ij-o7q" secondAttribute="bottom" constant="8" symbolic="YES" id="y1i-GD-vKr"/> | ||
</constraints> | ||
</view> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="7b1-8k-MIb"/> | ||
</connections> | ||
<point key="canvasLocation" x="66" y="176"/> | ||
</window> | ||
</objects> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* HBRenamePresetController.h | ||
This file is part of the HandBrake source code. | ||
Homepage: <http://handbrake.fr/>. | ||
It may be used under the terms of the GNU General Public License. */ | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class HBPreset; | ||
@class HBPresetsManager; | ||
|
||
@interface HBRenamePresetController : NSWindowController | ||
|
||
- (instancetype)initWithPreset:(HBPreset *)preset presetManager:(HBPresetsManager *)manager; | ||
|
||
@property (nonatomic, readonly) HBPreset *preset; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* HBRenamePresetController.m | ||
This file is part of the HandBrake source code. | ||
Homepage: <http://handbrake.fr/>. | ||
It may be used under the terms of the GNU General Public License. */ | ||
|
||
#import "HBRenamePresetController.h" | ||
|
||
#import "HBPresetsManager.h" | ||
#import "HBPreset.h" | ||
|
||
@import HandBrakeKit; | ||
|
||
@interface HBRenamePresetController () <NSTextFieldDelegate> | ||
|
||
@property (nonatomic, strong) IBOutlet NSTextField *name; | ||
@property (nonatomic, strong) IBOutlet NSButton *renameButton; | ||
|
||
@property (nonatomic, strong) HBPreset *preset; | ||
|
||
@property (nonatomic, strong) HBPresetsManager *manager; | ||
|
||
@end | ||
|
||
@implementation HBRenamePresetController | ||
|
||
- (instancetype)initWithPreset:(HBPreset *)preset presetManager:(HBPresetsManager *)manager | ||
{ | ||
self = [super initWithWindowNibName:@"HBRenamePresetController"]; | ||
if (self) | ||
{ | ||
NSParameterAssert(preset); | ||
NSParameterAssert(manager); | ||
_preset = preset; | ||
_manager = manager; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)windowDidLoad | ||
{ | ||
[super windowDidLoad]; | ||
|
||
self.name.stringValue = self.name.placeholderString = self.preset.name; | ||
|
||
[[NSNotificationCenter defaultCenter] addObserver:self | ||
selector:@selector(controlTextDidChange:) | ||
name:NSControlTextDidChangeNotification object:nil]; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSControlTextDidChangeNotification object:nil]; | ||
} | ||
|
||
- (void)controlTextDidChange:(NSNotification *)obj { | ||
self.renameButton.enabled = self.name.stringValue.length > 0 ? YES : NO; | ||
} | ||
|
||
- (IBAction)dismiss:(id)sender | ||
{ | ||
[self.window orderOut:nil]; | ||
[NSApp endSheet:self.window returnCode:NSModalResponseCancel]; | ||
} | ||
|
||
- (IBAction)rename:(id)sender | ||
{ | ||
if (self.name.stringValue.length == 0) | ||
{ | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
[alert setMessageText:NSLocalizedString(@"The preset name cannot be empty.", @"")]; | ||
[alert setInformativeText:NSLocalizedString(@"Please enter a name.", @"")]; | ||
[alert runModal]; | ||
} | ||
else | ||
{ | ||
[self.preset setName:self.name.stringValue]; | ||
|
||
[self.window orderOut:nil]; | ||
[NSApp endSheet:self.window returnCode:NSModalResponseContinue]; | ||
} | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters