VLCAddMediaViewController.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // VLCAddMediaViewController.m
  3. // VLC for iOS
  4. //
  5. // Created by Felix Paul Kühne on 19.05.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. #import "VLCAddMediaViewController.h"
  9. #import "VLCAppDelegate.h"
  10. #import "VLCPlaylistViewController.h"
  11. #import "VLCAboutViewController.h"
  12. #import "VLCMovieViewController.h"
  13. @interface VLCAddMediaViewController ()
  14. @end
  15. @implementation VLCAddMediaViewController
  16. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  17. {
  18. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  19. return self;
  20. }
  21. - (void)viewDidLoad
  22. {
  23. [super viewDidLoad];
  24. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
  25. self.dismissButton.titleLabel.text = NSLocalizedString(@"BUTTON_DONE", @"");
  26. self.aboutButton.titleLabel.text = NSLocalizedString(@"ABOUT_APP", @"");
  27. self.openNetworkStreamButton.titleLabel.text = NSLocalizedString(@"OPEN_NETWORK", @"");
  28. self.downloadFromHTTPServerButton.titleLabel.text = NSLocalizedString(@"DOWNLOAD_FROM_HTTP", @"");
  29. }
  30. - (void)viewWillAppear:(BOOL)animated
  31. {
  32. [super viewWillAppear:animated];
  33. }
  34. - (void)_hideAnimated:(BOOL)animated
  35. {
  36. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  37. VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
  38. [appDelegate.playlistViewController.addMediaPopoverController dismissPopoverAnimated:YES];
  39. } else
  40. [self dismissViewControllerAnimated:animated completion:NULL];
  41. }
  42. - (IBAction)dismiss:(id)sender
  43. {
  44. [self _hideAnimated:YES];
  45. }
  46. - (IBAction)openAboutPanel:(id)sender
  47. {
  48. VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
  49. if (!appDelegate.playlistViewController.aboutViewController)
  50. appDelegate.playlistViewController.aboutViewController = [[VLCAboutViewController alloc] initWithNibName:@"VLCAboutViewController" bundle:nil];
  51. [appDelegate.playlistViewController.navigationController pushViewController:appDelegate.playlistViewController.aboutViewController animated:YES];
  52. [self _hideAnimated:NO];
  53. }
  54. - (IBAction)openNetworkStream:(id)sender
  55. {
  56. if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:[NSArray arrayWithObjects:@"public.url", @"public.text", nil]]) {
  57. _pasteURL = [[UIPasteboard generalPasteboard] valueForPasteboardType:@"public.url"];
  58. if (!_pasteURL || [[_pasteURL absoluteString] isEqualToString:@""]) {
  59. NSString * pasteString = [[UIPasteboard generalPasteboard] valueForPasteboardType:@"public.text"];
  60. _pasteURL = [NSURL URLWithString:pasteString];
  61. }
  62. if (_pasteURL && ![[_pasteURL scheme] isEqualToString:@""] && ![[_pasteURL absoluteString] isEqualToString:@""]) {
  63. NSString * messageString = [NSString stringWithFormat:@"Do you want to open %@?", [_pasteURL absoluteString]];
  64. UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"OPEN_URL", @"") message:messageString delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_OPEN", @""), nil];
  65. [alert show];
  66. }
  67. }
  68. }
  69. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  70. {
  71. if (buttonIndex == 1) {
  72. VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
  73. [appDelegate.playlistViewController openMovieFromURL:_pasteURL];
  74. }
  75. [self _hideAnimated:NO];
  76. }
  77. - (IBAction)downloadFromHTTPServer:(id)sender
  78. {
  79. //TODO
  80. }
  81. - (IBAction)showSettings:(id)sender
  82. {
  83. }
  84. - (IBAction)showInformationOnHTTPServer:(id)sender
  85. {
  86. }
  87. - (IBAction)toggleHTTPServer:(id)sender
  88. {
  89. }
  90. @end