Add a WebView in preparation for the page info. Refactor SidebarEntry out of Mod. Add an "Other" category with links for support/credits+legal.

This commit is contained in:
Paul Chote
2010-11-16 17:02:34 +13:00
parent 7271dd5248
commit de7668e8ff
11 changed files with 334 additions and 162 deletions

View File

@@ -7,7 +7,8 @@
*/
#import "Controller.h"
#import "ModEntry.h"
#import "Mod.h"
#import "SidebarEntry.h"
#import "GameInstall.h"
#import "ImageAndTextCell.h"
@@ -16,9 +17,9 @@
- (void) awakeFromNib
{
game = [[GameInstall alloc] initWithPath:@"/Users/paul/src/OpenRA"];
sidebarItems = [[ModEntry headerWithTitle:@""] retain];
[sidebarItems addChild:[game modTree]];
sidebarItems = [[SidebarEntry headerWithTitle:@""] retain];
[sidebarItems addChild:[self sidebarModsTree]];
[sidebarItems addChild:[self sidebarOtherTree]];
NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"];
ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease];
[col setDataCell:imageAndTextCell];
@@ -28,6 +29,35 @@
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
}
- (SidebarEntry *)sidebarModsTree
{
// Get info for all installed mods
id modnames = [game installedMods];
NSArray *allMods = [game infoForMods:modnames];
SidebarEntry *rootItem = [SidebarEntry headerWithTitle:@"MODS"];
for (id aMod in allMods)
{
if ([aMod standalone])
{
id child = [SidebarEntry entryWithMod:aMod allMods:allMods];
[rootItem addChild:child];
}
}
return rootItem;
}
- (SidebarEntry *)sidebarOtherTree
{
SidebarEntry *rootItem = [SidebarEntry headerWithTitle:@"OTHER"];
[rootItem addChild:[SidebarEntry entryWithTitle:@"Support" object:nil icon:nil]];
[rootItem addChild:[SidebarEntry entryWithTitle:@"Credits" object:nil icon:nil]];
return rootItem;
}
- (void) dealloc
{
[sidebarItems release]; sidebarItems = nil;