Просмотр исходного кода

add a really basic UI to select the desired subtitle text encoding

there is room for improvement, as the UIPickerView is both ugly and unnecessary huge
Felix Paul Kühne 12 лет назад
Родитель
Сommit
5b06d48c7d

+ 1 - 1
AspenProject/VLCAppDelegate.m

@@ -18,7 +18,7 @@
 {
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 
-    NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @0, kVLCSettingContinueAudioInBackgroundKey : @1, kVLCSettingStretchAudio : kVLCSettingStretchAudioDefaultValue, kVLCSettingVerboseOutput : kVLCSettingVerboseOutputDefaultValue};
+    NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @0, kVLCSettingContinueAudioInBackgroundKey : @1, kVLCSettingStretchAudio : kVLCSettingStretchAudioDefaultValue, kVLCSettingVerboseOutput : kVLCSettingVerboseOutputDefaultValue, kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue};
 
     [defaults registerDefaults:appDefaults];
 }

+ 2 - 0
AspenProject/VLCConstants.h

@@ -15,3 +15,5 @@
 #define kVLCSettingStretchAudioDefaultValue @"--no-audio-time-stretch"
 #define kVLCSettingVerboseOutput @"VerboseLogs"
 #define kVLCSettingVerboseOutputDefaultValue @"--verbose=3"
+#define kVLCSettingTextEncoding @"subsdec-encoding"
+#define kVLCSettingTextEncodingDefaultValue @""

+ 4 - 1
AspenProject/VLCSettingsViewController.h

@@ -8,7 +8,7 @@
 
 #import <UIKit/UIKit.h>
 
-@interface VLCSettingsViewController : UIViewController
+@interface VLCSettingsViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>
 
 @property (nonatomic, strong) IBOutlet UIBarButtonItem *dismissButton;
 @property (nonatomic, strong) IBOutlet UISwitch *passcodeLockSwitch;
@@ -23,6 +23,9 @@
 @property (nonatomic, strong) IBOutlet UISwitch *debugOutputSwitch;
 @property (nonatomic, strong) IBOutlet UILabel *debugOutputLabel;
 
+@property (nonatomic, strong) IBOutlet UIPickerView *textEncodingPicker;
+@property (nonatomic, strong) IBOutlet UILabel *textEncodingLabel;
+
 - (IBAction)toggleSetting:(id)sender;
 
 - (IBAction)dismiss:(id)sender;

Разница между файлами не показана из-за своего большого размера
+ 44 - 0
AspenProject/VLCSettingsViewController.m


+ 137 - 50
Resources/VLCSettingsViewController.xib

@@ -14,6 +14,7 @@
 			<string>IBProxyObject</string>
 			<string>IBUIBarButtonItem</string>
 			<string>IBUILabel</string>
+			<string>IBUIPickerView</string>
 			<string>IBUISwitch</string>
 			<string>IBUIToolbar</string>
 			<string>IBUIView</string>
@@ -71,7 +72,7 @@
 					<object class="IBUILabel" id="890162779">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{20, 75}, {415, 21}}</string>
+						<string key="NSFrame">{{20, 69}, {415, 21}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
 						<reference key="NSNextKeyView" ref="268284080"/>
@@ -82,17 +83,17 @@
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<string key="IBUIText">Passcode Lock</string>
-						<object class="NSColor" key="IBUITextColor" id="631617158">
+						<object class="NSColor" key="IBUITextColor" id="143882257">
 							<int key="NSColorSpace">3</int>
 							<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
 						</object>
 						<nil key="IBUIHighlightedColor"/>
 						<int key="IBUIBaselineAdjustment">0</int>
-						<object class="IBUIFontDescription" key="IBUIFontDescription" id="728981146">
+						<object class="IBUIFontDescription" key="IBUIFontDescription" id="732816504">
 							<int key="type">1</int>
 							<double key="pointSize">17</double>
 						</object>
-						<object class="NSFont" key="IBUIFont" id="558070035">
+						<object class="NSFont" key="IBUIFont" id="15938098">
 							<string key="NSName">Helvetica</string>
 							<double key="NSSize">17</double>
 							<int key="NSfFlags">16</int>
@@ -102,23 +103,23 @@
 					<object class="IBUISwitch" id="268284080">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">289</int>
-						<string key="NSFrame">{{428, 72}, {94, 27}}</string>
+						<string key="NSFrame">{{428, 66}, {94, 27}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
-						<reference key="NSNextKeyView" ref="905762506"/>
+						<reference key="NSNextKeyView" ref="232517451"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<int key="IBUIContentHorizontalAlignment">0</int>
 						<int key="IBUIContentVerticalAlignment">0</int>
 					</object>
-					<object class="IBUILabel" id="145618128">
+					<object class="IBUILabel" id="796381961">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{20, 169}, {415, 21}}</string>
+						<string key="NSFrame">{{20, 154}, {415, 21}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
-						<reference key="NSNextKeyView" ref="932104012"/>
+						<reference key="NSNextKeyView" ref="115169191"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -126,17 +127,17 @@
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<string key="IBUIText">Time-stretching audio</string>
-						<reference key="IBUITextColor" ref="631617158"/>
+						<reference key="IBUITextColor" ref="143882257"/>
 						<nil key="IBUIHighlightedColor"/>
 						<int key="IBUIBaselineAdjustment">0</int>
-						<reference key="IBUIFontDescription" ref="728981146"/>
-						<reference key="IBUIFont" ref="558070035"/>
+						<reference key="IBUIFontDescription" ref="732816504"/>
+						<reference key="IBUIFont" ref="15938098"/>
 						<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
 					</object>
-					<object class="IBUISwitch" id="932104012">
+					<object class="IBUISwitch" id="115169191">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">289</int>
-						<string key="NSFrame">{{428, 166}, {94, 27}}</string>
+						<string key="NSFrame">{{428, 151}, {94, 27}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
@@ -145,13 +146,13 @@
 						<int key="IBUIContentHorizontalAlignment">0</int>
 						<int key="IBUIContentVerticalAlignment">0</int>
 					</object>
-					<object class="IBUILabel" id="905762506">
+					<object class="IBUILabel" id="232517451">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">290</int>
-						<string key="NSFrame">{{20, 116}, {415, 42}}</string>
+						<string key="NSFrame">{{20, 101}, {415, 42}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
-						<reference key="NSNextKeyView" ref="474049433"/>
+						<reference key="NSNextKeyView" ref="670606907"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -159,20 +160,20 @@
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<string key="IBUIText">Continue audio playback in background</string>
-						<reference key="IBUITextColor" ref="631617158"/>
+						<reference key="IBUITextColor" ref="143882257"/>
 						<nil key="IBUIHighlightedColor"/>
 						<int key="IBUIBaselineAdjustment">0</int>
 						<int key="IBUINumberOfLines">2</int>
 						<int key="IBUILineBreakMode">0</int>
-						<reference key="IBUIFontDescription" ref="728981146"/>
-						<reference key="IBUIFont" ref="558070035"/>
+						<reference key="IBUIFontDescription" ref="732816504"/>
+						<reference key="IBUIFont" ref="15938098"/>
 						<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
 						<double key="preferredMaxLayoutWidth">415</double>
 					</object>
-					<object class="IBUISwitch" id="474049433">
+					<object class="IBUISwitch" id="670606907">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">289</int>
-						<string key="NSFrame">{{428, 123}, {94, 27}}</string>
+						<string key="NSFrame">{{428, 108}, {94, 27}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
@@ -181,13 +182,13 @@
 						<int key="IBUIContentHorizontalAlignment">0</int>
 						<int key="IBUIContentVerticalAlignment">0</int>
 					</object>
-					<object class="IBUILabel" id="291130099">
+					<object class="IBUILabel" id="604519838">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{20, 212}, {415, 21}}</string>
+						<string key="NSFrame">{{20, 196}, {415, 21}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
-						<reference key="NSNextKeyView" ref="238127833"/>
+						<reference key="NSNextKeyView" ref="723892894"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -195,17 +196,37 @@
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<string key="IBUIText">Verbose debug logs</string>
-						<reference key="IBUITextColor" ref="631617158"/>
+						<reference key="IBUITextColor" ref="143882257"/>
 						<nil key="IBUIHighlightedColor"/>
 						<int key="IBUIBaselineAdjustment">0</int>
-						<reference key="IBUIFontDescription" ref="728981146"/>
-						<reference key="IBUIFont" ref="558070035"/>
+						<reference key="IBUIFontDescription" ref="732816504"/>
+						<reference key="IBUIFont" ref="15938098"/>
 						<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
 					</object>
-					<object class="IBUISwitch" id="238127833">
+					<object class="IBUILabel" id="645076836">
+						<reference key="NSNextResponder" ref="1058981638"/>
+						<int key="NSvFlags">292</int>
+						<string key="NSFrame">{{20, 236}, {415, 21}}</string>
+						<reference key="NSSuperview" ref="1058981638"/>
+						<reference key="NSWindow"/>
+						<string key="NSReuseIdentifierKey">_NS:9</string>
+						<bool key="IBUIOpaque">NO</bool>
+						<bool key="IBUIClipsSubviews">YES</bool>
+						<int key="IBUIContentMode">7</int>
+						<bool key="IBUIUserInteractionEnabled">NO</bool>
+						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+						<string key="IBUIText">Subtitle Text Encoding</string>
+						<reference key="IBUITextColor" ref="143882257"/>
+						<nil key="IBUIHighlightedColor"/>
+						<int key="IBUIBaselineAdjustment">0</int>
+						<reference key="IBUIFontDescription" ref="732816504"/>
+						<reference key="IBUIFont" ref="15938098"/>
+						<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
+					</object>
+					<object class="IBUISwitch" id="723892894">
 						<reference key="NSNextResponder" ref="1058981638"/>
 						<int key="NSvFlags">289</int>
-						<string key="NSFrame">{{428, 209}, {94, 27}}</string>
+						<string key="NSFrame">{{428, 193}, {94, 27}}</string>
 						<reference key="NSSuperview" ref="1058981638"/>
 						<reference key="NSWindow"/>
 						<string key="NSReuseIdentifierKey">_NS:9</string>
@@ -214,6 +235,16 @@
 						<int key="IBUIContentHorizontalAlignment">0</int>
 						<int key="IBUIContentVerticalAlignment">0</int>
 					</object>
+					<object class="IBUIPickerView" id="1021216954">
+						<reference key="NSNextResponder" ref="1058981638"/>
+						<int key="NSvFlags">290</int>
+						<string key="NSFrame">{{20, 271}, {500, 216}}</string>
+						<reference key="NSSuperview" ref="1058981638"/>
+						<reference key="NSWindow"/>
+						<string key="NSReuseIdentifierKey">_NS:9</string>
+						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+						<bool key="IBUIShowsSelectionIndicator">YES</bool>
+					</object>
 				</array>
 				<string key="NSFrameSize">{540, 568}</string>
 				<reference key="NSSuperview"/>
@@ -270,7 +301,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">audioPlaybackInBackgroundLabel</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="905762506"/>
+						<reference key="destination" ref="232517451"/>
 					</object>
 					<int key="connectionID">42</int>
 				</object>
@@ -278,7 +309,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">audioPlaybackInBackgroundSwitch</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="474049433"/>
+						<reference key="destination" ref="670606907"/>
 					</object>
 					<int key="connectionID">43</int>
 				</object>
@@ -286,7 +317,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">audioStretchingSwitch</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="932104012"/>
+						<reference key="destination" ref="115169191"/>
 					</object>
 					<int key="connectionID">53</int>
 				</object>
@@ -294,11 +325,27 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">debugOutputSwitch</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="238127833"/>
+						<reference key="destination" ref="723892894"/>
 					</object>
 					<int key="connectionID">54</int>
 				</object>
 				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">textEncodingPicker</string>
+						<reference key="source" ref="372490531"/>
+						<reference key="destination" ref="1021216954"/>
+					</object>
+					<int key="connectionID">57</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">textEncodingLabel</string>
+						<reference key="source" ref="372490531"/>
+						<reference key="destination" ref="645076836"/>
+					</object>
+					<int key="connectionID">60</int>
+				</object>
+				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">dismiss:</string>
 						<reference key="source" ref="320254837"/>
@@ -318,7 +365,7 @@
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">toggleSetting:</string>
-						<reference key="source" ref="474049433"/>
+						<reference key="source" ref="670606907"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">13</int>
 					</object>
@@ -327,7 +374,7 @@
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">toggleSetting:</string>
-						<reference key="source" ref="932104012"/>
+						<reference key="source" ref="115169191"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">13</int>
 					</object>
@@ -336,12 +383,28 @@
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">toggleSetting:</string>
-						<reference key="source" ref="238127833"/>
+						<reference key="source" ref="723892894"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">13</int>
 					</object>
 					<int key="connectionID">52</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">delegate</string>
+						<reference key="source" ref="1021216954"/>
+						<reference key="destination" ref="372490531"/>
+					</object>
+					<int key="connectionID">58</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">dataSource</string>
+						<reference key="source" ref="1021216954"/>
+						<reference key="destination" ref="372490531"/>
+					</object>
+					<int key="connectionID">59</int>
+				</object>
 			</array>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<array key="orderedObjects">
@@ -369,12 +432,14 @@
 							<reference ref="222768752"/>
 							<reference ref="890162779"/>
 							<reference ref="268284080"/>
-							<reference ref="905762506"/>
-							<reference ref="474049433"/>
-							<reference ref="145618128"/>
-							<reference ref="932104012"/>
-							<reference ref="291130099"/>
-							<reference ref="238127833"/>
+							<reference ref="232517451"/>
+							<reference ref="670606907"/>
+							<reference ref="796381961"/>
+							<reference ref="115169191"/>
+							<reference ref="604519838"/>
+							<reference ref="723892894"/>
+							<reference ref="645076836"/>
+							<reference ref="1021216954"/>
 						</array>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -411,32 +476,42 @@
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">39</int>
-						<reference key="object" ref="905762506"/>
+						<reference key="object" ref="232517451"/>
 						<reference key="parent" ref="1058981638"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">40</int>
-						<reference key="object" ref="474049433"/>
+						<reference key="object" ref="670606907"/>
 						<reference key="parent" ref="1058981638"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">47</int>
-						<reference key="object" ref="145618128"/>
+						<reference key="object" ref="796381961"/>
 						<reference key="parent" ref="1058981638"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">48</int>
-						<reference key="object" ref="932104012"/>
+						<reference key="object" ref="115169191"/>
 						<reference key="parent" ref="1058981638"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">50</int>
-						<reference key="object" ref="291130099"/>
+						<reference key="object" ref="604519838"/>
 						<reference key="parent" ref="1058981638"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">51</int>
-						<reference key="object" ref="238127833"/>
+						<reference key="object" ref="723892894"/>
+						<reference key="parent" ref="1058981638"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">56</int>
+						<reference key="object" ref="645076836"/>
+						<reference key="parent" ref="1058981638"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">55</int>
+						<reference key="object" ref="1021216954"/>
 						<reference key="parent" ref="1058981638"/>
 					</object>
 				</array>
@@ -458,12 +533,14 @@
 				<string key="48.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				<string key="50.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				<string key="51.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="55.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 			</dictionary>
 			<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
 			<nil key="activeLocalization"/>
 			<dictionary class="NSMutableDictionary" key="localizations"/>
 			<nil key="sourceID"/>
-			<int key="maxID">54</int>
+			<int key="maxID">60</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -494,6 +571,8 @@
 						<string key="dismissButton">UIBarButtonItem</string>
 						<string key="passcodeLockLabel">UILabel</string>
 						<string key="passcodeLockSwitch">UISwitch</string>
+						<string key="textEncodingLabel">UILabel</string>
+						<string key="textEncodingPicker">UIPickerView</string>
 					</dictionary>
 					<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
 						<object class="IBToOneOutletInfo" key="audioPlaybackInBackgroundLabel">
@@ -532,6 +611,14 @@
 							<string key="name">passcodeLockSwitch</string>
 							<string key="candidateClassName">UISwitch</string>
 						</object>
+						<object class="IBToOneOutletInfo" key="textEncodingLabel">
+							<string key="name">textEncodingLabel</string>
+							<string key="candidateClassName">UILabel</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="textEncodingPicker">
+							<string key="name">textEncodingPicker</string>
+							<string key="candidateClassName">UIPickerView</string>
+						</object>
 					</dictionary>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>