Commit 8e57c4e3 authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne

Formatting: replaces tabs with space and apply code rules

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent dae89c60
......@@ -209,7 +209,8 @@
#pragma mark - media discovering
- (void)mediaFileAdded:(NSString *)fileName loading:(BOOL)isLoading {
- (void)mediaFileAdded:(NSString *)fileName loading:(BOOL)isLoading
{
if (!isLoading) {
MLMediaLibrary *sharedLibrary = [MLMediaLibrary sharedMediaLibrary];
[sharedLibrary addFilePaths:@[fileName]];
......@@ -224,7 +225,8 @@
}
}
- (void)mediaFileDeleted:(NSString *)name {
- (void)mediaFileDeleted:(NSString *)name
{
[[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
[_playlistViewController updateViewContents];
}
......@@ -352,5 +354,4 @@
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
}
@end
......@@ -394,7 +394,8 @@
}
#pragma mark - text view delegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[self.urlField resignFirstResponder];
return NO;
}
......
......@@ -122,13 +122,15 @@
[fileHandle closeFile];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
APLog(@"http file download complete");
[self _downloadEnded];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
APLog(@"http file download failed (%li)", (long)error.code);
if ([self.delegate respondsToSelector:@selector(downloadFailedWithErrorDescription:)])
......
......@@ -161,7 +161,7 @@
{
if (tableView == self.searchDisplayController.searchResultsTableView)
return _searchData.count;
else {
else {
if (_serverType == kVLCServerTypeUPNP)
return _mutableObjectList.count;
......
......@@ -346,15 +346,17 @@
#pragma mark - custom table view appearance
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 21.f;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSObject *headerText = NSLocalizedString(_sectionHeaderTexts[section], @"");
UIView *headerView = nil;
if (headerText != [NSNull null]) {
headerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 21.0f)];
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSObject *headerText = NSLocalizedString(_sectionHeaderTexts[section], @"");
UIView *headerView = nil;
if (headerText != [NSNull null]) {
headerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 21.0f)];
if (!SYSTEM_RUNS_IOS7_OR_LATER) {
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = headerView.bounds;
......@@ -366,24 +368,24 @@
} else
headerView.backgroundColor = [UIColor colorWithWhite:.122 alpha:1.];
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectInset(headerView.bounds, 12.0f, 5.0f)];
textLabel.text = (NSString *) headerText;
textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:([UIFont systemFontSize] * 0.8f)];
textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f];
textLabel.textColor = [UIColor colorWithRed:(118.0f/255.0f) green:(118.0f/255.0f) blue:(118.0f/255.0f) alpha:1.0f];
textLabel.backgroundColor = [UIColor clearColor];
[headerView addSubview:textLabel];
UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
topLine.backgroundColor = [UIColor colorWithRed:(95.0f/255.0f) green:(95.0f/255.0f) blue:(95.0f/255.0f) alpha:1.0f];
[headerView addSubview:topLine];
UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 21.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
bottomLine.backgroundColor = [UIColor colorWithRed:(16.0f/255.0f) green:(16.0f/255.0f) blue:(16.0f/255.0f) alpha:1.0f];
[headerView addSubview:bottomLine];
}
return headerView;
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectInset(headerView.bounds, 12.0f, 5.0f)];
textLabel.text = (NSString *) headerText;
textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:([UIFont systemFontSize] * 0.8f)];
textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f];
textLabel.textColor = [UIColor colorWithRed:(118.0f/255.0f) green:(118.0f/255.0f) blue:(118.0f/255.0f) alpha:1.0f];
textLabel.backgroundColor = [UIColor clearColor];
[headerView addSubview:textLabel];
UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
topLine.backgroundColor = [UIColor colorWithRed:(95.0f/255.0f) green:(95.0f/255.0f) blue:(95.0f/255.0f) alpha:1.0f];
[headerView addSubview:topLine];
UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 21.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
bottomLine.backgroundColor = [UIColor colorWithRed:(16.0f/255.0f) green:(16.0f/255.0f) blue:(16.0f/255.0f) alpha:1.0f];
[headerView addSubview:bottomLine];
}
return headerView;
}
#pragma mark - bonjour discovery
......@@ -424,10 +426,12 @@
#pragma mark - UPNP details
//protocol UPnPDBObserver
- (void)UPnPDBWillUpdate:(UPnPDB*)sender{
- (void)UPnPDBWillUpdate:(UPnPDB*)sender
{
}
- (void)UPnPDBUpdated:(UPnPDB*)sender{
- (void)UPnPDBUpdated:(UPnPDB*)sender
{
NSUInteger count = _UPNPdevices.count;
BasicUPnPDevice *device;
NSMutableArray *mutArray = [[NSMutableArray alloc] init];
......
......@@ -66,7 +66,7 @@
[super viewDidLoad];
self.view.frame = CGRectMake(0.0f, 0.0f, kGHRevealSidebarWidth, CGRectGetHeight(self.view.bounds));
self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_sectionHeaderTexts = @[@"SECTION_HEADER_LIBRARY", @"SECTION_HEADER_NETWORK", @"Settings"];
_menuItemsSectionOne = @[@"LIBRARY_ALL_FILES", @"LIBRARY_MUSIC", @"LIBRARY_SERIES"];
......@@ -75,10 +75,10 @@
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0f, 44.0f + 20.0f, kGHRevealSidebarWidth, CGRectGetHeight(self.view.bounds) - (44.0f + 20.0f)) style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_tableView.backgroundColor = [UIColor colorWithRed:(43.0f/255.0f) green:(43.0f/255.0f) blue:(43.0f/255.0f) alpha:1.0f];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.dataSource = self;
_tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_tableView.backgroundColor = [UIColor colorWithRed:(43.0f/255.0f) green:(43.0f/255.0f) blue:(43.0f/255.0f) alpha:1.0f];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.rowHeight = [VLCWiFiUploadTableViewCell heightOfCell];
_tableView.scrollsToTop = NO;
......@@ -120,8 +120,9 @@
[self updateHTTPServerAddress];
}
- (void)viewWillAppear:(BOOL)animated {
self.view.frame = CGRectMake(0.0f, 0.0f,kGHRevealSidebarWidth, CGRectGetHeight(self.view.bounds));
- (void)viewWillAppear:(BOOL)animated
{
self.view.frame = CGRectMake(0.0f, 0.0f,kGHRevealSidebarWidth, CGRectGetHeight(self.view.bounds));
[self netReachabilityChanged:nil];
}
......@@ -142,14 +143,16 @@
- (BOOL)shouldAutorotate
{
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
return (orientation == UIInterfaceOrientationPortraitUpsideDown) ? (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) : YES;
return (orientation == UIInterfaceOrientationPortraitUpsideDown) ? (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) : YES;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0) // media
return _menuItemsSectionOne.count;
else if (section == 1) // network
......@@ -160,7 +163,8 @@
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"VLCMenuCell";
static NSString *WiFiCellIdentifier = @"VLCMenuWiFiCell";
......@@ -224,17 +228,19 @@
}
#pragma mark - tv delegate
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section < 3)
return 21.f;
return 0.;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSObject *headerText = NSLocalizedString(_sectionHeaderTexts[section], @"");
UIView *headerView = nil;
if (headerText != [NSNull null]) {
headerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 21.0f)];
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSObject *headerText = NSLocalizedString(_sectionHeaderTexts[section], @"");
UIView *headerView = nil;
if (headerText != [NSNull null]) {
headerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 21.0f)];
if (!SYSTEM_RUNS_IOS7_OR_LATER) {
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = headerView.bounds;
......@@ -246,24 +252,24 @@
} else
headerView.backgroundColor = [UIColor colorWithWhite:.122 alpha:1.];
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectInset(headerView.bounds, 12.0f, 5.0f)];
textLabel.text = (NSString *) headerText;
textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:([UIFont systemFontSize] * 0.8f)];
textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f];
textLabel.textColor = [UIColor colorWithRed:(118.0f/255.0f) green:(118.0f/255.0f) blue:(118.0f/255.0f) alpha:1.0f];
textLabel.backgroundColor = [UIColor clearColor];
[headerView addSubview:textLabel];
UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
topLine.backgroundColor = [UIColor colorWithRed:(95.0f/255.0f) green:(95.0f/255.0f) blue:(95.0f/255.0f) alpha:1.0f];
[headerView addSubview:topLine];
UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 21.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
bottomLine.backgroundColor = [UIColor colorWithRed:(16.0f/255.0f) green:(16.0f/255.0f) blue:(16.0f/255.0f) alpha:1.0f];
[headerView addSubview:bottomLine];
}
return headerView;
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectInset(headerView.bounds, 12.0f, 5.0f)];
textLabel.text = (NSString *) headerText;
textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:([UIFont systemFontSize] * 0.8f)];
textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f];
textLabel.textColor = [UIColor colorWithRed:(118.0f/255.0f) green:(118.0f/255.0f) blue:(118.0f/255.0f) alpha:1.0f];
textLabel.backgroundColor = [UIColor clearColor];
[headerView addSubview:textLabel];
UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
topLine.backgroundColor = [UIColor colorWithRed:(95.0f/255.0f) green:(95.0f/255.0f) blue:(95.0f/255.0f) alpha:1.0f];
[headerView addSubview:topLine];
UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 21.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
bottomLine.backgroundColor = [UIColor colorWithRed:(16.0f/255.0f) green:(16.0f/255.0f) blue:(16.0f/255.0f) alpha:1.0f];
[headerView addSubview:bottomLine];
}
return headerView;
}
#pragma mark - menu implementation
......@@ -357,29 +363,33 @@
_revealController.contentViewController = navCon;
}
[_revealController toggleSidebar:NO duration:kGHRevealSidebarDefaultAnimationDuration];
[_revealController toggleSidebar:NO duration:kGHRevealSidebarDefaultAnimationDuration];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self _revealItem:indexPath.row inSection:indexPath.section];
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self _revealItem:indexPath.row inSection:indexPath.section];
}
#pragma mark Public Methods
- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition {
[self.tableView selectRowAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition];
if (scrollPosition == UITableViewScrollPositionNone)
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated];
- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition
{
[self.tableView selectRowAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition];
if (scrollPosition == UITableViewScrollPositionNone)
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated];
[self _revealItem:indexPath.row inSection:indexPath.section];
}
#pragma mark - shake to support
- (BOOL)canBecomeFirstResponder {
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (motion == UIEventSubtypeMotionShake)
[[VLCBugreporter sharedInstance] handleBugreportRequest];
}
......
......@@ -975,7 +975,8 @@
[_subtitleActionSheet showInView:(UIButton *)sender];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == [actionSheet cancelButtonIndex])
return;
......@@ -1360,7 +1361,8 @@
|| toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
......
......@@ -156,24 +156,18 @@
}
#pragma mark - text view delegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if ([self.serverAddressField isFirstResponder])
{
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if ([self.serverAddressField isFirstResponder]) {
[self.serverAddressField resignFirstResponder];
[self.usernameField becomeFirstResponder];
}
else if ([self.usernameField isFirstResponder])
{
} else if ([self.usernameField isFirstResponder]) {
[self.usernameField resignFirstResponder];
[self.passwordField becomeFirstResponder];
}
else if ([self.passwordField isFirstResponder])
{
} else if ([self.passwordField isFirstResponder]) {
[self.passwordField resignFirstResponder];
//[self connectToServer:nil];
}
return NO;
}
......
......@@ -182,7 +182,8 @@
}
#pragma mark - text view delegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[self.urlField resignFirstResponder];
return NO;
}
......
......@@ -59,7 +59,8 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
[defaults registerDefaults:@{kDisplayedFirstSteps : [NSNumber numberWithBool:NO]}];
}
- (void)loadView {
- (void)loadView
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
_tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain];
_tableView.backgroundColor = [UIColor colorWithWhite:.122 alpha:1.];
......@@ -749,7 +750,8 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
// RootController is responsible for supporting interface orientation(iOS6.0+), i.e. navigation controller
// so this will not work as intended without "voodoo magic"(UINavigationController category, subclassing, etc)
/* introduced in iOS 6 */
- (NSUInteger)supportedInterfaceOrientations {
- (NSUInteger)supportedInterfaceOrientations
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
......@@ -758,11 +760,13 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
}
/* introduced in iOS 6 */
- (BOOL)shouldAutorotate {
- (BOOL)shouldAutorotate
{
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) || (_foundMedia.count > 0);
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment