project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m
changeset 3697 d5b30d6373fc
parent 3662 a44406f4369b
child 3737 2ba6ac8a114b
--- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m	Sat Jul 31 10:52:43 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m	Sat Jul 31 11:24:53 2010 +0200
@@ -21,24 +21,24 @@
 #pragma mark View lifecycle
 -(void) viewDidLoad {
     [super viewDidLoad];
-    
+
     UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"from the weapon panel")
                                                                    style:UIBarButtonItemStyleBordered
                                                                   target:self
                                                                   action:@selector(toggleEdit:)];
     self.navigationItem.rightBarButtonItem = editButton;
     [editButton release];
-    
+
 }
 
 -(void) viewWillAppear:(BOOL) animated {
     [super viewWillAppear:animated];
-    
+
     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
     NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
     self.listOfWeapons = array;
     [array release];
-    
+
     [self.tableView reloadData];
 }
 
@@ -46,7 +46,7 @@
 -(void) toggleEdit:(id) sender {
     BOOL isEditing = self.tableView.editing;
     [self.tableView setEditing:!isEditing animated:YES];
-    
+
     if (isEditing) {
         [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Edit",@"from the scheme panel")];
         [self.navigationItem.rightBarButtonItem setStyle: UIBarButtonItemStyleBordered];
@@ -65,15 +65,15 @@
 
 -(void) addWeapon:(id) sender {
     NSString *fileName = [[NSString alloc] initWithFormat:@"Weapon %u.plist", [self.listOfWeapons count]];
-    
+
     createWeaponNamed([fileName stringByDeletingPathExtension]);
-    
+
     [self.listOfWeapons addObject:fileName];
     [fileName release];
-    
+
     // order the array alphabetically, so schemes will keep their position
     [self.listOfWeapons sortUsingSelector:@selector(compare:)];
-    
+
     [self.tableView reloadData];
 }
 
@@ -89,28 +89,28 @@
 
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     static NSString *CellIdentifier = @"Cell";
-    
+
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil) {
         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
     }
-    
-    NSUInteger row = [indexPath row]; 
-    NSString *rowString = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension]; 
-    cell.textLabel.text = rowString; 
+
+    NSUInteger row = [indexPath row];
+    NSString *rowString = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension];
+    cell.textLabel.text = rowString;
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
-    
+
     return cell;
 }
 
 // delete the row and the file
 -(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
     NSUInteger row = [indexPath row];
-    
+
     NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
     [[NSFileManager defaultManager] removeItemAtPath:schemeFile error:NULL];
     [schemeFile release];
-    
+
     [self.listOfWeapons removeObjectAtIndex:row];
     [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
 }
@@ -121,10 +121,10 @@
     if (childController == nil) {
         childController = [[SingleWeaponViewController alloc] initWithStyle:UITableViewStyleGrouped];
     }
-    
+
     NSInteger row = [indexPath row];
     NSString *selectedWeaponFile = [self.listOfWeapons objectAtIndex:row];
-    
+
     // this must be set so childController can load the correct plist
     childController.weaponName = [selectedWeaponFile stringByDeletingPathExtension];
     [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];