Update of /cvsroot/macattrick/macattrick In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21944 Modified Files: MainWindowController.h MainWindowController.m PlayerList.h PlayerList.m Team.h Team.m Added Files: PlayerListsViewController.h PlayerListsViewController.m Log Message: started to implement user defined player lists, currently in a drawer --- NEW FILE: PlayerListsViewController.h --- //---- license ---------------------------------------------------------------// // // // Macattrick: a Manager Assistant Tool for the online Game Hattrick.org // // Copyright (C) 2004 Roman Bertolami // // // // this file is part of Macattrick application // // http://sourceforge.net/macattrick // // // // Macattrick is free software; you can redistribute it and/or // // modify it under the terms of the GNU General Public License // // as published by the Free Software Foundation; either version 2 // // of the License, or (at your option) any later version. // // // // Macattrick is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place - Suite 330, // // Boston, MA 02111-1307, USA. // // // // Macattrick, Copyright (C) 2004 Roman Bertolami // // Macattrick comes with ABSOLUTELY NO WARRANTY! // // // //---- eo licence ------------------------------------------------------------// #import <Cocoa/Cocoa.h> @interface PlayerListsViewController : NSObject { NSMutableArray *playerLists; IBOutlet NSView *playerListsView; IBOutlet NSTableView *tableView; IBOutlet NSArrayController *playerListsArrayController; } - (IBAction) clicked: (id) sender; - (NSMutableArray *) playerLists; - (void) setPlayerLists: (NSMutableArray *) newPlayerLists; - (NSView *) playerListsView; - (void) setPlayerListsView: (NSView *) newPlayerListsView; - (NSTableView *) tableView; - (void) setTableView: (NSTableView *) newTableView; @end Index: MainWindowController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/MainWindowController.m,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MainWindowController.m 18 Jan 2005 21:05:45 -0000 1.8 --- MainWindowController.m 3 Jul 2005 19:52:13 -0000 1.9 *************** *** 46,49 **** --- 46,57 ---- - (Team *) team { return team; } + - (NSDrawer *) playerListsDrawer { return playerListsDrawer; } + - (void) setPlayerListsDrawer: (NSDrawer *) newPlayerListsDrawer { + [newPlayerListsDrawer retain]; + [playerListsDrawer release]; + playerListsDrawer = newPlayerListsDrawer; + } + + //Toolbar *************** *** 92,96 **** --- 100,108 ---- positionsController = [[PositionsController alloc] init]; lineUpController = [[LineUpController alloc] init]; + playerListsViewController = [[PlayerListsViewController alloc] init]; + [playerListsDrawer setContentView:[playerListsViewController playerListsView]]; + [playerListsDrawer open]; [self setupToolbar]; + int startPanel = [[NSUserDefaults standardUserDefaults] integerForKey:@"startPanel"]; if(startPanel == 0) {[self showTeamInfo];} Index: PlayerList.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/PlayerList.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PlayerList.h 30 May 2005 19:59:59 -0000 1.7 --- PlayerList.h 3 Jul 2005 19:52:13 -0000 1.8 *************** *** 37,40 **** --- 37,41 ---- */ @interface PlayerList : NSObject { + NSString *listName; NSMutableArray* playerList; *************** *** 46,49 **** --- 47,51 ---- } + -(PlayerList*) initWithListName:(NSString*) aListName; /*! *************** *** 57,64 **** @abstract init a new PlayerList using the playerFile of Properties */ ! - (PlayerList*) init; - (void) loadFormerPlayerStates; /*! @method playerList --- 59,69 ---- @abstract init a new PlayerList using the playerFile of Properties */ ! - (PlayerList*) initFromLocalFile; - (void) loadFormerPlayerStates; + - (NSString *) listName; + - (void) setListName: (NSString *) newListName; + /*! @method playerList Index: MainWindowController.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/MainWindowController.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MainWindowController.h 4 Jan 2005 18:23:29 -0000 1.5 --- MainWindowController.h 3 Jul 2005 19:52:13 -0000 1.6 *************** *** 33,36 **** --- 33,37 ---- #import "TeamInfoController.h" #import "Team.h" + #import "PlayerListsViewController.h" @interface MainWindowController : NSWindowController *************** *** 41,45 **** --- 42,50 ---- PositionsController *positionsController; PlayerTableController *playerTableController; + PlayerListsViewController *playerListsViewController; + IBOutlet NSDrawer *playerListsDrawer; } + - (NSDrawer *) playerListsDrawer; + - (void) setPlayerListsDrawer: (NSDrawer *) newPlayerListsDrawer; -(void)setTeam: (Team*) team; --- NEW FILE: PlayerListsViewController.m --- //---- license ---------------------------------------------------------------// // // // Macattrick: a Manager Assistant Tool for the online Game Hattrick.org // // Copyright (C) 2004 Roman Bertolami // // // // this file is part of Macattrick application // // http://sourceforge.net/macattrick // // // // Macattrick is free software; you can redistribute it and/or // // modify it under the terms of the GNU General Public License // // as published by the Free Software Foundation; either version 2 // // of the License, or (at your option) any later version. // // // // Macattrick is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place - Suite 330, // // Boston, MA 02111-1307, USA. // // // // Macattrick, Copyright (C) 2004 Roman Bertolami // // Macattrick comes with ABSOLUTELY NO WARRANTY! // // // //---- eo licence ------------------------------------------------------------// #import "PlayerListsViewController.h" #import "Team.h" @implementation PlayerListsViewController - (id) init { self = [super init]; if(self) { [self setPlayerLists: [[Team currentTeam] userDefinedPlayerLists]]; [NSBundle loadNibNamed:@"PlayerListsView" owner: self]; } return self; } - (IBAction) clicked: (id) sender { NSArray *selected = [playerListsArrayController selectedObjects]; if([selected count]>0) { [[Team currentTeam] setPlayerList: [selected objectAtIndex:0]]; } } - (NSMutableArray *) playerLists { return playerLists; } - (void) setPlayerLists: (NSMutableArray *) newPlayerLists { [newPlayerLists retain]; [playerLists release]; playerLists = newPlayerLists; } - (NSView *) playerListsView { return playerListsView; } - (void) setPlayerListsView: (NSView *) newPlayerListsView { [newPlayerListsView retain]; [playerListsView release]; playerListsView = newPlayerListsView; } - (NSTableView *) tableView { return tableView; } - (void) setTableView: (NSTableView *) newTableView { [newTableView retain]; [tableView release]; tableView = newTableView; } @end Index: Team.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Team.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Team.h 20 Jan 2005 20:46:01 -0000 1.14 --- Team.h 3 Jul 2005 19:52:13 -0000 1.15 *************** *** 53,56 **** --- 53,58 ---- League* league; PlayerList* playerList; + NSMutableArray *userDefinedPlayerLists; + PlayerList *allPlayersList; Economy* economy; Arena* arena; *************** *** 62,66 **** } - /*! @method init --- 64,67 ---- *************** *** 81,84 **** --- 82,92 ---- - (NSString *) teamName; + + - (NSMutableArray *) userDefinedPlayerLists; + + - (PlayerList *) allPlayersList; + - (void) setAllPlayersList: (PlayerList *) newAllPlayersList; + + /*! @method homepage *************** *** 111,119 **** - (User *) user; ! /*! ! @method playerList ! @abstract accessor to the the player list ! */ ! - (PlayerList *)playerList; --- 119,125 ---- - (User *) user; ! - (PlayerList *) playerList; ! - (void) setPlayerList: (PlayerList *) newPlayerList; ! Index: PlayerList.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/PlayerList.m,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PlayerList.m 21 Jun 2005 17:44:50 -0000 1.9 --- PlayerList.m 3 Jul 2005 19:52:13 -0000 1.10 *************** *** 39,42 **** --- 39,57 ---- // Constructor + -(PlayerList*) init { + self = [super init]; + if(self) { + playerList = [[NSMutableArray alloc] init]; + formerDates = [[NSMutableArray alloc] init]; + [self setListName:NSLocalizedString(@"New List", @"New List")]; + } + return self; + } + - (PlayerList*) initFromLocalFile;{ + NSURL *url = [[NSURL alloc] initFileURLWithPath: [Properties playersFile]]; + self = [[PlayerList alloc] initFromXML: url]; + [url release]; + return self; + } - (PlayerList*) initFromXML: (NSURL*) url { *************** *** 56,59 **** --- 71,75 ---- } } + [self setListName:NSLocalizedString(@"Team", @"Team")]; } return self; *************** *** 83,86 **** --- 99,111 ---- + - (NSString *) listName { return listName; } + - (void) setListName: (NSString *) newListName { + [newListName retain]; + [listName release]; + listName = newListName; + } + + + - (void) loadStatesFromFormerPlayerList: (PlayerList*) formerPlayerList date: (NSString*) date{ NSEnumerator *en = [[self playerList] objectEnumerator]; *************** *** 95,104 **** } ! - (PlayerList*) init{ ! NSURL *url = [[NSURL alloc] initFileURLWithPath: [Properties playersFile]]; ! self = [[PlayerList alloc] initFromXML: url]; ! [url release]; ! return self; ! } - (NSArray *)playersWithInjured: (BOOL) injured diqualified: (BOOL) disqualified { --- 120,124 ---- } ! - (NSArray *)playersWithInjured: (BOOL) injured diqualified: (BOOL) disqualified { Index: Team.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Team.m,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Team.m 21 Jun 2005 17:44:50 -0000 1.24 --- Team.m 3 Jul 2005 19:52:13 -0000 1.25 *************** *** 39,42 **** --- 39,43 ---- - (void) setNumberOfUndefeated: (int) newNumberOfUndefeated; - (void) setLogo: (NSImage *) newLogo; + - (void) setUserDefinedPlayerLists: (NSMutableArray *) newUserDefinedPlayerLists; @end *************** *** 64,68 **** return nil; } ! playerList = [[PlayerList alloc] init]; [playerList loadFormerPlayerStates]; arena = [[Arena alloc] init]; --- 65,69 ---- return nil; } ! playerList = [[PlayerList alloc] initFromLocalFile]; [playerList loadFormerPlayerStates]; arena = [[Arena alloc] init]; *************** *** 73,76 **** --- 74,80 ---- } [url release]; + userDefinedPlayerLists = [[NSMutableArray alloc] init]; + [userDefinedPlayerLists addObject: playerList]; + [self setAllPlayersList:playerList]; } return self; *************** *** 79,82 **** --- 83,92 ---- // Accessors + - (PlayerList *) allPlayersList { return allPlayersList; } + - (void) setAllPlayersList: (PlayerList *) newAllPlayersList{ + [newAllPlayersList retain]; + [allPlayersList release]; + allPlayersList = newAllPlayersList; + } *************** *** 97,100 **** --- 107,118 ---- } + - (NSMutableArray *) userDefinedPlayerLists { return userDefinedPlayerLists; } + - (void) setUserDefinedPlayerLists: (NSMutableArray *) newUserDefinedPlayerLists { + [newUserDefinedPlayerLists retain]; + [userDefinedPlayerLists release]; + userDefinedPlayerLists = newUserDefinedPlayerLists; + } + + - (NSURL *) homepage { return homepage; } *************** *** 130,134 **** ! - (PlayerList *)playerList { return playerList; } - (Economy *) economy { return economy; } --- 148,159 ---- ! - (PlayerList *) playerList { return playerList; } ! - (void) setPlayerList: (PlayerList *) newPlayerList { ! [newPlayerList retain]; ! [playerList release]; ! playerList = newPlayerList; ! } ! ! - (Economy *) economy { return economy; } *************** *** 142,153 **** - (Club *) club { return club; } ! - (void) dealloc { ! [playerList release]; ! [economy release]; ! [arena release]; ! [training release]; ! [league release]; ! [super dealloc]; ! } + (Team*) currentTeam { --- 167,171 ---- - (Club *) club { return club; } ! + (Team*) currentTeam { *************** *** 200,203 **** --- 218,236 ---- currentStringValue = nil; } + - (void) dealloc { + [teamName release]; + [homepage release]; + [logo release]; + [user release]; + [league release]; + [playerList release]; + [userDefinedPlayerLists release]; + [economy release]; + [arena release]; + [training release]; + [club release]; + [super dealloc]; + } + |