ソースを参照

add basic UI to open network streams (close #8575)

Felix Paul Kühne 12 年 前
コミット
52a63f7473

+ 1 - 0
AspenProject/VLCMovieViewController.h

@@ -52,6 +52,7 @@
 @property (nonatomic, strong) IBOutlet UIButton *resetVideoFilterButton;
 
 @property (nonatomic, strong) MLFile *mediaItem;
+@property (nonatomic, strong) NSURL *url;
 
 - (IBAction)closePlayback:(id)sender;
 - (IBAction)positionSliderAction:(id)sender;

+ 8 - 3
AspenProject/VLCMovieViewController.m

@@ -71,12 +71,17 @@
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
         [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
 
-    if (!self.mediaItem)
+    if (!self.mediaItem && !self.url)
         return;
 
-    self.title = [self.mediaItem title];
+    if (self.mediaItem) {
+        self.title = [self.mediaItem title];
+        [_mediaPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString:self.mediaItem.url]]];
+    } else {
+        [_mediaPlayer setMedia:[VLCMedia mediaWithURL:self.url]];
+        self.title = @"Network Stream";
+    }
 
-    [_mediaPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString:self.mediaItem.url]]];
     [_mediaPlayer play];
 
     if (self.mediaItem.lastPosition && [self.mediaItem.lastPosition floatValue] < 0.99)

+ 8 - 1
AspenProject/VLCPlaylistViewController.h

@@ -12,7 +12,10 @@
 @class VLCMovieViewController;
 @class VLCAboutViewController;
 
-@interface VLCPlaylistViewController : UIViewController <AQGridViewDataSource, AQGridViewDelegate, UITableViewDataSource, UITableViewDelegate>
+@interface VLCPlaylistViewController : UIViewController <AQGridViewDataSource, AQGridViewDelegate, UITableViewDataSource, UITableViewDelegate, UITabBarDelegate>
+{
+    NSURL *_pasteURL;
+}
 
 @property (nonatomic, strong) VLCMovieViewController *movieViewController;
 @property (nonatomic, strong) VLCAboutViewController *aboutViewController;
@@ -20,6 +23,10 @@
 @property (nonatomic, strong) IBOutlet UITableView *tableView;
 @property (nonatomic, strong) IBOutlet AQGridView *gridView;
 
+@property (nonatomic, strong) IBOutlet UITabBar *tabBar;
+@property (nonatomic, strong) IBOutlet UITabBarItem *localFilesBarItem;
+@property (nonatomic, strong) IBOutlet UITabBarItem *networkStreamsBarItem;
+
 - (void)updateViewContents;
 
 @end

+ 48 - 1
AspenProject/VLCPlaylistViewController.m

@@ -46,7 +46,8 @@
         _gridView.separatorStyle = AQGridViewCellSeparatorStyleEmptySpace;
         _gridView.alwaysBounceVertical = YES;
         _gridView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
-    }
+    } else
+        self.tabBar.selectedItem = self.localFilesBarItem;
 }
 
 #pragma mark - Table View
@@ -155,6 +156,19 @@
 }
 
 #pragma mark - UI implementation
+- (void)setEditing:(BOOL)editing animated:(BOOL)animated
+{
+    if (self.tableView.editing) {
+        self.editButtonItem.style = UIBarButtonItemStylePlain;
+        self.editButtonItem.title = NSLocalizedString(@"Edit", @"edit bar button item");
+        [self.tableView setEditing:NO animated:YES];
+    } else {
+        self.editButtonItem.style = UIBarButtonItemStyleDone;
+        self.editButtonItem.title = NSLocalizedString(@"Done", @"edit bar button item");
+        [self.tableView setEditing:YES animated:YES];
+    }
+}
+
 - (void)showAboutView:(id)sender
 {
     if (!self.aboutViewController)
@@ -162,4 +176,37 @@
     [self.navigationController pushViewController:self.aboutViewController animated:YES];
 }
 
+#pragma mark - tab bar
+- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
+{
+    if (item == self.networkStreamsBarItem) {
+        if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:[NSArray arrayWithObjects:@"public.url", @"public.text", nil]]) {
+            _pasteURL = [[UIPasteboard generalPasteboard] valueForPasteboardType:@"public.url"];
+            if (!_pasteURL || [[_pasteURL absoluteString] isEqualToString:@""]) {
+                NSString * pasteString = [[UIPasteboard generalPasteboard] valueForPasteboardType:@"public.text"];
+                _pasteURL = [NSURL URLWithString:pasteString];
+            }
+
+            if (_pasteURL && ![[_pasteURL scheme] isEqualToString:@""] && ![[_pasteURL absoluteString] isEqualToString:@""]) {
+                NSString * messageString = [NSString stringWithFormat:@"Do you want to open %@?", [_pasteURL absoluteString]];
+                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Open URL?" message:messageString delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Open", nil];
+                [alert show];
+            }
+        }
+    }
+
+    self.tabBar.selectedItem = self.localFilesBarItem;
+}
+
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+    if (buttonIndex == 1) {
+        if (!self.movieViewController)
+            self.movieViewController = [[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController" bundle:nil];
+
+        self.movieViewController.url = _pasteURL;
+        [self.navigationController pushViewController:self.movieViewController animated:YES];
+    }
+}
+
 @end

+ 153 - 27
Resources/VLCPlaylistViewController~iphone.xib

@@ -12,7 +12,10 @@
 		</object>
 		<array key="IBDocument.IntegratedClassDependencies">
 			<string>IBProxyObject</string>
+			<string>IBUITabBar</string>
+			<string>IBUITabBarItem</string>
 			<string>IBUITableView</string>
+			<string>IBUIView</string>
 		</array>
 		<array key="IBDocument.PluginDependencies">
 			<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -30,18 +33,70 @@
 				<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
 				<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 			</object>
-			<object class="IBUITableView" id="709618507">
+			<object class="IBUIView" id="220272156">
 				<reference key="NSNextResponder"/>
-				<int key="NSvFlags">274</int>
-				<string key="NSFrame">{{0, 20}, {320, 548}}</string>
+				<int key="NSvFlags">292</int>
+				<array class="NSMutableArray" key="NSSubviews">
+					<object class="IBUITableView" id="886444942">
+						<reference key="NSNextResponder" ref="220272156"/>
+						<int key="NSvFlags">274</int>
+						<string key="NSFrameSize">{320, 519}</string>
+						<reference key="NSSuperview" ref="220272156"/>
+						<reference key="NSWindow"/>
+						<reference key="NSNextKeyView" ref="3538102"/>
+						<string key="NSReuseIdentifierKey">_NS:9</string>
+						<object class="NSColor" key="IBUIBackgroundColor">
+							<int key="NSColorSpace">3</int>
+							<bytes key="NSWhite">MAA</bytes>
+						</object>
+						<bool key="IBUIClipsSubviews">YES</bool>
+						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+						<bool key="IBUIAlwaysBounceVertical">YES</bool>
+						<int key="IBUISeparatorStyle">1</int>
+						<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
+						<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
+						<float key="IBUIRowHeight">44</float>
+						<float key="IBUISectionHeaderHeight">22</float>
+						<float key="IBUISectionFooterHeight">22</float>
+					</object>
+					<object class="IBUITabBar" id="3538102">
+						<reference key="NSNextResponder" ref="220272156"/>
+						<int key="NSvFlags">266</int>
+						<string key="NSFrame">{{0, 519}, {320, 49}}</string>
+						<reference key="NSSuperview" ref="220272156"/>
+						<reference key="NSWindow"/>
+						<string key="NSReuseIdentifierKey">_NS:9</string>
+						<object class="NSColor" key="IBUIBackgroundColor">
+							<int key="NSColorSpace">3</int>
+							<bytes key="NSWhite">MCAwAA</bytes>
+						</object>
+						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+						<array class="NSMutableArray" key="IBUIItems">
+							<object class="IBUITabBarItem" id="822886904">
+								<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+								<reference key="IBUITabBar" ref="3538102"/>
+								<int key="IBUISystemItemIdentifier">2</int>
+							</object>
+							<object class="IBUITabBarItem" id="443941358">
+								<string key="IBUITitle">Network</string>
+								<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+								<reference key="IBUITabBar" ref="3538102"/>
+							</object>
+						</array>
+					</object>
+				</array>
+				<string key="NSFrameSize">{320, 568}</string>
 				<reference key="NSSuperview"/>
 				<reference key="NSWindow"/>
+				<reference key="NSNextKeyView" ref="886444942"/>
+				<string key="NSReuseIdentifierKey">_NS:9</string>
 				<object class="NSColor" key="IBUIBackgroundColor">
 					<int key="NSColorSpace">3</int>
-					<bytes key="NSWhite">MC4wNQA</bytes>
+					<bytes key="NSWhite">MQA</bytes>
+					<object class="NSColorSpace" key="NSCustomColorSpace">
+						<int key="NSID">2</int>
+					</object>
 				</object>
-				<bool key="IBUIClipsSubviews">YES</bool>
-				<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
 				<object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics">
 					<string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string>
 					<object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap">
@@ -60,14 +115,6 @@
 					<int key="IBUIType">2</int>
 				</object>
 				<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
-				<bool key="IBUIAlwaysBounceVertical">YES</bool>
-				<int key="IBUIIndicatorStyle">2</int>
-				<int key="IBUISeparatorStyle">1</int>
-				<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
-				<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
-				<float key="IBUIRowHeight">44</float>
-				<float key="IBUISectionHeaderHeight">22</float>
-				<float key="IBUISectionFooterHeight">22</float>
 			</object>
 		</array>
 		<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -76,33 +123,65 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">view</string>
 						<reference key="source" ref="841351856"/>
-						<reference key="destination" ref="709618507"/>
+						<reference key="destination" ref="220272156"/>
 					</object>
-					<int key="connectionID">3</int>
+					<int key="connectionID">12</int>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">tableView</string>
 						<reference key="source" ref="841351856"/>
-						<reference key="destination" ref="709618507"/>
+						<reference key="destination" ref="886444942"/>
 					</object>
-					<int key="connectionID">6</int>
+					<int key="connectionID">13</int>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchOutletConnection" key="connection">
-						<string key="label">dataSource</string>
-						<reference key="source" ref="709618507"/>
+						<string key="label">tabBar</string>
+						<reference key="source" ref="841351856"/>
+						<reference key="destination" ref="3538102"/>
+					</object>
+					<int key="connectionID">16</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">localFilesBarItem</string>
+						<reference key="source" ref="841351856"/>
+						<reference key="destination" ref="822886904"/>
+					</object>
+					<int key="connectionID">17</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">networkStreamsBarItem</string>
+						<reference key="source" ref="841351856"/>
+						<reference key="destination" ref="443941358"/>
+					</object>
+					<int key="connectionID">18</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">delegate</string>
+						<reference key="source" ref="3538102"/>
 						<reference key="destination" ref="841351856"/>
 					</object>
-					<int key="connectionID">4</int>
+					<int key="connectionID">19</int>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">delegate</string>
-						<reference key="source" ref="709618507"/>
+						<reference key="source" ref="886444942"/>
 						<reference key="destination" ref="841351856"/>
 					</object>
-					<int key="connectionID">5</int>
+					<int key="connectionID">14</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">dataSource</string>
+						<reference key="source" ref="886444942"/>
+						<reference key="destination" ref="841351856"/>
+					</object>
+					<int key="connectionID">15</int>
 				</object>
 			</array>
 			<object class="IBMutableOrderedSet" key="objectRecords">
@@ -125,10 +204,38 @@
 						<reference key="parent" ref="0"/>
 					</object>
 					<object class="IBObjectRecord">
-						<int key="objectID">2</int>
-						<reference key="object" ref="709618507"/>
+						<int key="objectID">7</int>
+						<reference key="object" ref="220272156"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="3538102"/>
+							<reference ref="886444942"/>
+						</array>
 						<reference key="parent" ref="0"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">8</int>
+						<reference key="object" ref="3538102"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="822886904"/>
+							<reference ref="443941358"/>
+						</array>
+						<reference key="parent" ref="220272156"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">9</int>
+						<reference key="object" ref="822886904"/>
+						<reference key="parent" ref="3538102"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">10</int>
+						<reference key="object" ref="443941358"/>
+						<reference key="parent" ref="3538102"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">11</int>
+						<reference key="object" ref="886444942"/>
+						<reference key="parent" ref="220272156"/>
+					</object>
 				</array>
 			</object>
 			<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -136,13 +243,17 @@
 				<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				<string key="-2.CustomClassName">UIResponder</string>
 				<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-				<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="9.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">6</int>
+			<int key="maxID">19</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -173,6 +284,9 @@
 					<string key="superclassName">UIViewController</string>
 					<dictionary class="NSMutableDictionary" key="outlets">
 						<string key="gridView">AQGridView</string>
+						<string key="localFilesBarItem">UITabBarItem</string>
+						<string key="networkStreamsBarItem">UITabBarItem</string>
+						<string key="tabBar">UITabBar</string>
 						<string key="tableView">UITableView</string>
 					</dictionary>
 					<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -180,6 +294,18 @@
 							<string key="name">gridView</string>
 							<string key="candidateClassName">AQGridView</string>
 						</object>
+						<object class="IBToOneOutletInfo" key="localFilesBarItem">
+							<string key="name">localFilesBarItem</string>
+							<string key="candidateClassName">UITabBarItem</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="networkStreamsBarItem">
+							<string key="name">networkStreamsBarItem</string>
+							<string key="candidateClassName">UITabBarItem</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="tabBar">
+							<string key="name">tabBar</string>
+							<string key="candidateClassName">UITabBar</string>
+						</object>
 						<object class="IBToOneOutletInfo" key="tableView">
 							<string key="name">tableView</string>
 							<string key="candidateClassName">UITableView</string>