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:
@@ -7,14 +7,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <WebKit/WebKit.h>
|
||||||
@class ModEntry;
|
@class Mod;
|
||||||
|
@class SidebarEntry;
|
||||||
@class GameInstall;
|
@class GameInstall;
|
||||||
@interface Controller : NSObject
|
@interface Controller : NSObject
|
||||||
{
|
{
|
||||||
ModEntry *sidebarItems;
|
SidebarEntry *sidebarItems;
|
||||||
GameInstall *game;
|
GameInstall *game;
|
||||||
IBOutlet NSOutlineView *outlineView;
|
IBOutlet NSOutlineView *outlineView;
|
||||||
|
IBOutlet WebView *webView;
|
||||||
}
|
}
|
||||||
- (IBAction)launchGame:(id)sender;
|
- (IBAction)launchGame:(id)sender;
|
||||||
|
- (SidebarEntry *)sidebarModsTree;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
#import "ModEntry.h"
|
#import "Mod.h"
|
||||||
|
#import "SidebarEntry.h"
|
||||||
#import "GameInstall.h"
|
#import "GameInstall.h"
|
||||||
#import "ImageAndTextCell.h"
|
#import "ImageAndTextCell.h"
|
||||||
|
|
||||||
@@ -16,9 +17,9 @@
|
|||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
game = [[GameInstall alloc] initWithPath:@"/Users/paul/src/OpenRA"];
|
game = [[GameInstall alloc] initWithPath:@"/Users/paul/src/OpenRA"];
|
||||||
sidebarItems = [[ModEntry headerWithTitle:@""] retain];
|
sidebarItems = [[SidebarEntry headerWithTitle:@""] retain];
|
||||||
[sidebarItems addChild:[game modTree]];
|
[sidebarItems addChild:[self sidebarModsTree]];
|
||||||
|
[sidebarItems addChild:[self sidebarOtherTree]];
|
||||||
NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"];
|
NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"];
|
||||||
ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease];
|
ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease];
|
||||||
[col setDataCell:imageAndTextCell];
|
[col setDataCell:imageAndTextCell];
|
||||||
@@ -28,6 +29,35 @@
|
|||||||
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
|
[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
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[sidebarItems release]; sidebarItems = nil;
|
[sidebarItems release]; sidebarItems = nil;
|
||||||
|
|||||||
@@ -7,8 +7,17 @@
|
|||||||
<string key="IBDocument.AppKitVersion">1038.35</string>
|
<string key="IBDocument.AppKitVersion">1038.35</string>
|
||||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string key="NS.object.0">804</string>
|
<object class="NSArray" key="dict.sortedKeys">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.WebKitIBPlugin</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>804</string>
|
||||||
|
<string>804</string>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
@@ -17,6 +26,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>com.apple.WebKitIBPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||||
@@ -448,7 +458,7 @@
|
|||||||
<object class="NSButton" id="430464371">
|
<object class="NSButton" id="430464371">
|
||||||
<reference key="NSNextResponder" ref="257490795"/>
|
<reference key="NSNextResponder" ref="257490795"/>
|
||||||
<int key="NSvFlags">289</int>
|
<int key="NSvFlags">289</int>
|
||||||
<string key="NSFrame">{{339, 19}, {111, 27}}</string>
|
<string key="NSFrame">{{270, 53}, {111, 27}}</string>
|
||||||
<reference key="NSSuperview" ref="257490795"/>
|
<reference key="NSSuperview" ref="257490795"/>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSButtonCell" key="NSCell" id="492098390">
|
<object class="NSButtonCell" key="NSCell" id="492098390">
|
||||||
@@ -465,6 +475,56 @@
|
|||||||
<int key="NSPeriodicInterval">75</int>
|
<int key="NSPeriodicInterval">75</int>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="WebView" id="90421773">
|
||||||
|
<reference key="NSNextResponder" ref="257490795"/>
|
||||||
|
<int key="NSvFlags">274</int>
|
||||||
|
<object class="NSMutableSet" key="NSDragTypes">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSArray" key="set.sortedObjects">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>Apple HTML pasteboard type</string>
|
||||||
|
<string>Apple PDF pasteboard type</string>
|
||||||
|
<string>Apple PICT pasteboard type</string>
|
||||||
|
<string>Apple URL pasteboard type</string>
|
||||||
|
<string>Apple Web Archive pasteboard type</string>
|
||||||
|
<string>NSColor pasteboard type</string>
|
||||||
|
<string>NSFilenamesPboardType</string>
|
||||||
|
<string>NSStringPboardType</string>
|
||||||
|
<string>NeXT RTFD pasteboard type</string>
|
||||||
|
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
|
||||||
|
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||||
|
<string>WebURLsWithTitlesPboardType</string>
|
||||||
|
<string>public.png</string>
|
||||||
|
<string>public.url</string>
|
||||||
|
<string>public.url-name</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<string key="NSFrameSize">{469, 469}</string>
|
||||||
|
<reference key="NSSuperview" ref="257490795"/>
|
||||||
|
<reference key="NSNextKeyView"/>
|
||||||
|
<string key="FrameName"/>
|
||||||
|
<string key="GroupName"/>
|
||||||
|
<object class="WebPreferences" key="Preferences">
|
||||||
|
<string key="Identifier"/>
|
||||||
|
<object class="NSMutableDictionary" key="Values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSArray" key="dict.sortedKeys">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>WebKitDefaultFixedFontSize</string>
|
||||||
|
<string>WebKitDefaultFontSize</string>
|
||||||
|
<string>WebKitMinimumFontSize</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<integer value="12"/>
|
||||||
|
<integer value="12"/>
|
||||||
|
<integer value="1"/>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<bool key="UseBackForwardList">YES</bool>
|
||||||
|
<bool key="AllowsUndo">YES</bool>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSFrame">{{190, 0}, {469, 469}}</string>
|
<string key="NSFrame">{{190, 0}, {469, 469}}</string>
|
||||||
<reference key="NSSuperview" ref="991115689"/>
|
<reference key="NSSuperview" ref="991115689"/>
|
||||||
@@ -852,6 +912,7 @@
|
|||||||
<object class="NSMutableArray" key="children">
|
<object class="NSMutableArray" key="children">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<reference ref="430464371"/>
|
<reference ref="430464371"/>
|
||||||
|
<reference ref="90421773"/>
|
||||||
</object>
|
</object>
|
||||||
<reference key="parent" ref="991115689"/>
|
<reference key="parent" ref="991115689"/>
|
||||||
</object>
|
</object>
|
||||||
@@ -927,6 +988,11 @@
|
|||||||
<reference key="object" ref="492098390"/>
|
<reference key="object" ref="492098390"/>
|
||||||
<reference key="parent" ref="430464371"/>
|
<reference key="parent" ref="430464371"/>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">589</int>
|
||||||
|
<reference key="object" ref="90421773"/>
|
||||||
|
<reference key="parent" ref="257490795"/>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||||
@@ -1008,6 +1074,8 @@
|
|||||||
<string>586.IBPluginDependency</string>
|
<string>586.IBPluginDependency</string>
|
||||||
<string>586.IBViewBoundsToFrameTransform</string>
|
<string>586.IBViewBoundsToFrameTransform</string>
|
||||||
<string>587.IBPluginDependency</string>
|
<string>587.IBPluginDependency</string>
|
||||||
|
<string>589.IBPluginDependency</string>
|
||||||
|
<string>589.IBViewBoundsToFrameTransform</string>
|
||||||
<string>92.IBPluginDependency</string>
|
<string>92.IBPluginDependency</string>
|
||||||
<string>92.ImportedFromIB2</string>
|
<string>92.ImportedFromIB2</string>
|
||||||
</object>
|
</object>
|
||||||
@@ -1053,9 +1121,9 @@
|
|||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>{74, 862}</string>
|
<string>{74, 862}</string>
|
||||||
<string>{{6, 978}, {478, 20}}</string>
|
<string>{{6, 978}, {478, 20}}</string>
|
||||||
<string>{{174, 257}, {659, 469}}</string>
|
<string>{{611, 949}, {659, 469}}</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>{{174, 257}, {659, 469}}</string>
|
<string>{{611, 949}, {659, 469}}</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>{{33, 99}, {480, 360}}</string>
|
<string>{{33, 99}, {480, 360}}</string>
|
||||||
<string>{3.40282e+38, 3.40282e+38}</string>
|
<string>{3.40282e+38, 3.40282e+38}</string>
|
||||||
@@ -1089,9 +1157,13 @@
|
|||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<object class="NSAffineTransform">
|
<object class="NSAffineTransform">
|
||||||
<bytes key="NSTransformStruct">P4AAAL+AAABDv4AAwiAAAA</bytes>
|
<bytes key="NSTransformStruct">P4AAAL+AAABDegAAwvoAAA</bytes>
|
||||||
</object>
|
</object>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.WebKitIBPlugin</string>
|
||||||
|
<object class="NSAffineTransform">
|
||||||
|
<bytes key="NSTransformStruct">AcJAAABDFwAAA</bytes>
|
||||||
|
</object>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
</object>
|
</object>
|
||||||
@@ -1112,7 +1184,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">588</int>
|
<int key="maxID">589</int>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
@@ -1132,15 +1204,36 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="outlets">
|
<object class="NSMutableDictionary" key="outlets">
|
||||||
<string key="NS.key.0">outlineView</string>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string key="NS.object.0">NSOutlineView</string>
|
<object class="NSArray" key="dict.sortedKeys">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>outlineView</string>
|
||||||
|
<string>webView</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>NSOutlineView</string>
|
||||||
|
<string>WebView</string>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||||
<string key="NS.key.0">outlineView</string>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
<object class="NSArray" key="dict.sortedKeys">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>outlineView</string>
|
||||||
|
<string>webView</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="IBToOneOutletInfo">
|
||||||
<string key="name">outlineView</string>
|
<string key="name">outlineView</string>
|
||||||
<string key="candidateClassName">NSOutlineView</string>
|
<string key="candidateClassName">NSOutlineView</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBToOneOutletInfo">
|
||||||
|
<string key="name">webView</string>
|
||||||
|
<string key="candidateClassName">WebView</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
<string key="majorKey">IBProjectSource</string>
|
<string key="majorKey">IBProjectSource</string>
|
||||||
|
|||||||
@@ -8,14 +8,15 @@
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@class ModEntry;
|
@class Mod;
|
||||||
@interface GameInstall : NSObject {
|
@interface GameInstall : NSObject {
|
||||||
NSString *gamePath;
|
NSString *gamePath;
|
||||||
NSMutableString *utilityBuffer;
|
NSMutableString *utilityBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id)initWithPath:(NSString *)path;
|
-(id)initWithPath:(NSString *)path;
|
||||||
- (ModEntry *)modTree;
|
|
||||||
-(void)launchGame;
|
-(void)launchGame;
|
||||||
- (void)runUtilityApp:(NSString *)arg handleOutput:(id)obj withMethod:(SEL)sel;
|
- (void)runUtilityApp:(NSString *)arg handleOutput:(id)obj withMethod:(SEL)sel;
|
||||||
|
- (NSArray *)installedMods;
|
||||||
|
- (NSArray *)infoForMods:(NSArray *)mods;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import "GameInstall.h"
|
#import "GameInstall.h"
|
||||||
#import "ModEntry.h"
|
#import "Mod.h"
|
||||||
|
|
||||||
@implementation GameInstall
|
@implementation GameInstall
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
{
|
{
|
||||||
// Commit prev mod
|
// Commit prev mod
|
||||||
if (current != nil)
|
if (current != nil)
|
||||||
[ret addObject:[ModEntry modWithId:current fields:fields]];
|
[ret addObject:[Mod modWithId:current fields:fields]];
|
||||||
NSLog(@"Parsing mod %@",value);
|
NSLog(@"Parsing mod %@",value);
|
||||||
current = value;
|
current = value;
|
||||||
fields = [NSMutableDictionary dictionary];
|
fields = [NSMutableDictionary dictionary];
|
||||||
@@ -89,25 +89,6 @@
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ModEntry *)modTree
|
|
||||||
{
|
|
||||||
// Get info for all installed mods
|
|
||||||
id modnames = [self installedMods];
|
|
||||||
NSArray *allMods = [self infoForMods:modnames];
|
|
||||||
|
|
||||||
ModEntry *rootItem = [ModEntry headerWithTitle:@"MODS"];
|
|
||||||
for (id aMod in allMods)
|
|
||||||
{
|
|
||||||
if ([aMod standalone])
|
|
||||||
{
|
|
||||||
[rootItem addChild:aMod];
|
|
||||||
[aMod buildChildTree:allMods];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rootItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)launchGame
|
-(void)launchGame
|
||||||
{
|
{
|
||||||
// Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6
|
// Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6
|
||||||
|
|||||||
@@ -8,19 +8,15 @@
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@interface ModEntry : NSObject {
|
@interface Mod : NSObject {
|
||||||
BOOL isHeader;
|
|
||||||
NSString *mod;
|
NSString *mod;
|
||||||
NSString *title;
|
NSString *title;
|
||||||
NSString *version;
|
NSString *version;
|
||||||
NSString *author;
|
NSString *author;
|
||||||
NSString *requires;
|
NSString *requires;
|
||||||
BOOL standalone;
|
BOOL standalone;
|
||||||
NSMutableArray *children;
|
|
||||||
NSImage *icon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (readonly) BOOL isHeader;
|
|
||||||
@property (readonly) NSString *mod;
|
@property (readonly) NSString *mod;
|
||||||
@property (readonly) NSString *title;
|
@property (readonly) NSString *title;
|
||||||
@property (readonly) NSString *version;
|
@property (readonly) NSString *version;
|
||||||
@@ -28,14 +24,7 @@
|
|||||||
@property (readonly) NSString *description;
|
@property (readonly) NSString *description;
|
||||||
@property (readonly) NSString *requires;
|
@property (readonly) NSString *requires;
|
||||||
@property (readonly) BOOL standalone;
|
@property (readonly) BOOL standalone;
|
||||||
@property (readonly) NSMutableArray* children;
|
|
||||||
@property (readonly) NSImage* icon;
|
|
||||||
|
|
||||||
+ (id)headerWithTitle:(NSString *)aTitle;
|
|
||||||
+ (id)errorWithTitle:(NSString *)aTitle;
|
|
||||||
+ (id)modWithId:(NSString *)mid fields:(id)fields;
|
+ (id)modWithId:(NSString *)mid fields:(id)fields;
|
||||||
- (id)initWithId:(NSString *)mod fields:(NSDictionary *)fields isHeader:(BOOL)header;
|
- (id)initWithId:(NSString *)mod fields:(NSDictionary *)fields;
|
||||||
- (void)addChild:(id)child;
|
|
||||||
- (void)buildChildTree:(NSArray *)allMods;
|
|
||||||
- (id)icon;
|
|
||||||
@end
|
@end
|
||||||
55
OpenRA.Launcher.Mac/Mod.m
Normal file
55
OpenRA.Launcher.Mac/Mod.m
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "Mod.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation Mod
|
||||||
|
@synthesize mod;
|
||||||
|
@synthesize title;
|
||||||
|
@synthesize version;
|
||||||
|
@synthesize author;
|
||||||
|
@synthesize description;
|
||||||
|
@synthesize requires;
|
||||||
|
@synthesize standalone;
|
||||||
|
|
||||||
|
+ (id)modWithId:(NSString *)mod fields:(id)fields
|
||||||
|
{
|
||||||
|
id newObject = [[self alloc] initWithId:mod fields:fields];
|
||||||
|
[newObject autorelease];
|
||||||
|
return newObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
|
mod = anId;
|
||||||
|
title = [[fields objectForKey:@"Title"] retain];
|
||||||
|
version = [[fields objectForKey:@"Version"] retain];
|
||||||
|
author = [[fields objectForKey:@"Author"] retain];
|
||||||
|
description = [[fields objectForKey:@"Description"] retain];
|
||||||
|
requires = [[fields objectForKey:@"Requires"] retain];
|
||||||
|
standalone = ([[fields objectForKey:@"Standalone"] isEqualToString:@"True"]);
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[title release]; title = nil;
|
||||||
|
[version release]; version = nil;
|
||||||
|
[author release]; author = nil;
|
||||||
|
[description release]; description = nil;
|
||||||
|
[requires release]; requires = nil;
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation. For more information,
|
|
||||||
* see LICENSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "ModEntry.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation ModEntry
|
|
||||||
@synthesize mod;
|
|
||||||
@synthesize isHeader;
|
|
||||||
@synthesize title;
|
|
||||||
@synthesize version;
|
|
||||||
@synthesize author;
|
|
||||||
@synthesize description;
|
|
||||||
@synthesize requires;
|
|
||||||
@synthesize standalone;
|
|
||||||
@synthesize children;
|
|
||||||
@synthesize icon;
|
|
||||||
|
|
||||||
+ (id)headerWithTitle:(NSString *)aTitle
|
|
||||||
{
|
|
||||||
id newObject = [[self alloc] initWithId:@"title" fields:[NSDictionary dictionaryWithObject:aTitle forKey:@"Title"] isHeader:YES];
|
|
||||||
[newObject autorelease];
|
|
||||||
return newObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)errorWithTitle:(NSString *)aTitle
|
|
||||||
{
|
|
||||||
id newObject = [[self alloc] initWithId:@"error" fields:[NSDictionary dictionaryWithObject:aTitle forKey:@"Title"] isHeader:NO];
|
|
||||||
[newObject autorelease];
|
|
||||||
return newObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)modWithId:(NSString *)mod fields:(id)fields
|
|
||||||
{
|
|
||||||
id newObject = [[self alloc] initWithId:mod fields:fields isHeader:NO];
|
|
||||||
[newObject autorelease];
|
|
||||||
return newObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields isHeader:(BOOL)header
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
if (self)
|
|
||||||
{
|
|
||||||
mod = anId;
|
|
||||||
isHeader = header;
|
|
||||||
title = [[fields objectForKey:@"Title"] retain];
|
|
||||||
version = [[fields objectForKey:@"Version"] retain];
|
|
||||||
author = [[fields objectForKey:@"Author"] retain];
|
|
||||||
description = [[fields objectForKey:@"Description"] retain];
|
|
||||||
requires = [[fields objectForKey:@"Requires"] retain];
|
|
||||||
standalone = ([[fields objectForKey:@"Standalone"] isEqualToString:@"True"]);
|
|
||||||
|
|
||||||
if (!isHeader)
|
|
||||||
{
|
|
||||||
NSString* imageName = [[NSBundle mainBundle] pathForResource:@"OpenRA" ofType:@"icns"];
|
|
||||||
icon = [[NSImage alloc] initWithContentsOfFile:imageName];
|
|
||||||
}
|
|
||||||
children = [[NSMutableArray alloc] init];
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)addChild:(ModEntry *)child
|
|
||||||
{
|
|
||||||
NSLog(@"Adding child %@ to %@",[child mod], mod);
|
|
||||||
[children addObject:child];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)buildChildTree:(NSArray *)allMods
|
|
||||||
{
|
|
||||||
for (id aMod in allMods)
|
|
||||||
{
|
|
||||||
if (![[aMod requires] isEqualToString:mod])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
[self addChild:aMod];
|
|
||||||
[aMod buildChildTree:allMods];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
[title release]; title = nil;
|
|
||||||
[version release]; version = nil;
|
|
||||||
[author release]; author = nil;
|
|
||||||
[description release]; description = nil;
|
|
||||||
[requires release]; requires = nil;
|
|
||||||
[icon release]; icon = nil;
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
@@ -13,17 +13,18 @@
|
|||||||
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||||
DA81FA821290F5C800C48F2F /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FA811290F5C800C48F2F /* Controller.m */; };
|
DA81FA821290F5C800C48F2F /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FA811290F5C800C48F2F /* Controller.m */; };
|
||||||
DA81FAAA1290FA0000C48F2F /* ModEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FAA91290FA0000C48F2F /* ModEntry.m */; };
|
DA81FAAA1290FA0000C48F2F /* Mod.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FAA91290FA0000C48F2F /* Mod.m */; };
|
||||||
DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */; };
|
DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */; };
|
||||||
DA81FBDC12910E4900C48F2F /* OpenRA.icns in Resources */ = {isa = PBXBuildFile; fileRef = DA81FBDB12910E4900C48F2F /* OpenRA.icns */; };
|
DA81FBDC12910E4900C48F2F /* OpenRA.icns in Resources */ = {isa = PBXBuildFile; fileRef = DA81FBDB12910E4900C48F2F /* OpenRA.icns */; };
|
||||||
DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FC3E12911E2B00C48F2F /* GameInstall.m */; };
|
DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FC3E12911E2B00C48F2F /* GameInstall.m */; };
|
||||||
DA9292C81291DF2D00EDB02E /* OpenRA.app in Resources */ = {isa = PBXBuildFile; fileRef = DA9292C71291DF2D00EDB02E /* OpenRA.app */; };
|
DA9292C81291DF2D00EDB02E /* OpenRA.app in Resources */ = {isa = PBXBuildFile; fileRef = DA9292C71291DF2D00EDB02E /* OpenRA.app */; };
|
||||||
|
DA9295A712921DF900EDB02E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9295A612921DF900EDB02E /* WebKit.framework */; };
|
||||||
|
DA9296901292328200EDB02E /* SidebarEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = DA92968F1292328200EDB02E /* SidebarEntry.m */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||||
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
|
||||||
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
256AC3D80F4B6AC300CF3369 /* OpenRAAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenRAAppDelegate.h; sourceTree = "<group>"; };
|
256AC3D80F4B6AC300CF3369 /* OpenRAAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenRAAppDelegate.h; sourceTree = "<group>"; };
|
||||||
256AC3D90F4B6AC300CF3369 /* OpenRAAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenRAAppDelegate.m; sourceTree = "<group>"; };
|
256AC3D90F4B6AC300CF3369 /* OpenRAAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenRAAppDelegate.m; sourceTree = "<group>"; };
|
||||||
@@ -35,14 +36,17 @@
|
|||||||
8D1107320486CEB800E47090 /* OpenRA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRA.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
8D1107320486CEB800E47090 /* OpenRA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRA.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
DA81FA801290F5C800C48F2F /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = "<group>"; };
|
DA81FA801290F5C800C48F2F /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = "<group>"; };
|
||||||
DA81FA811290F5C800C48F2F /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
|
DA81FA811290F5C800C48F2F /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
|
||||||
DA81FAA81290FA0000C48F2F /* ModEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModEntry.h; sourceTree = "<group>"; };
|
DA81FAA81290FA0000C48F2F /* Mod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mod.h; sourceTree = "<group>"; };
|
||||||
DA81FAA91290FA0000C48F2F /* ModEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModEntry.m; sourceTree = "<group>"; };
|
DA81FAA91290FA0000C48F2F /* Mod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Mod.m; sourceTree = "<group>"; };
|
||||||
DA81FB9112910A8B00C48F2F /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = "<group>"; };
|
DA81FB9112910A8B00C48F2F /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = "<group>"; };
|
||||||
DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = "<group>"; };
|
DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = "<group>"; };
|
||||||
DA81FBDB12910E4900C48F2F /* OpenRA.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenRA.icns; sourceTree = "<group>"; };
|
DA81FBDB12910E4900C48F2F /* OpenRA.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenRA.icns; sourceTree = "<group>"; };
|
||||||
DA81FC3D12911E2B00C48F2F /* GameInstall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameInstall.h; sourceTree = "<group>"; };
|
DA81FC3D12911E2B00C48F2F /* GameInstall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameInstall.h; sourceTree = "<group>"; };
|
||||||
DA81FC3E12911E2B00C48F2F /* GameInstall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameInstall.m; sourceTree = "<group>"; };
|
DA81FC3E12911E2B00C48F2F /* GameInstall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameInstall.m; sourceTree = "<group>"; };
|
||||||
DA9292C71291DF2D00EDB02E /* OpenRA.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = OpenRA.app; sourceTree = "<group>"; };
|
DA9292C71291DF2D00EDB02E /* OpenRA.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = OpenRA.app; sourceTree = "<group>"; };
|
||||||
|
DA9295A612921DF900EDB02E /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
|
||||||
|
DA92968E1292328200EDB02E /* SidebarEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SidebarEntry.h; sourceTree = "<group>"; };
|
||||||
|
DA92968F1292328200EDB02E /* SidebarEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SidebarEntry.m; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -51,6 +55,7 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||||
|
DA9295A712921DF900EDB02E /* WebKit.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -66,10 +71,12 @@
|
|||||||
256AC3D90F4B6AC300CF3369 /* OpenRAAppDelegate.m */,
|
256AC3D90F4B6AC300CF3369 /* OpenRAAppDelegate.m */,
|
||||||
DA81FA801290F5C800C48F2F /* Controller.h */,
|
DA81FA801290F5C800C48F2F /* Controller.h */,
|
||||||
DA81FA811290F5C800C48F2F /* Controller.m */,
|
DA81FA811290F5C800C48F2F /* Controller.m */,
|
||||||
DA81FAA81290FA0000C48F2F /* ModEntry.h */,
|
DA81FAA81290FA0000C48F2F /* Mod.h */,
|
||||||
DA81FAA91290FA0000C48F2F /* ModEntry.m */,
|
DA81FAA91290FA0000C48F2F /* Mod.m */,
|
||||||
DA81FC3D12911E2B00C48F2F /* GameInstall.h */,
|
DA81FC3D12911E2B00C48F2F /* GameInstall.h */,
|
||||||
DA81FC3E12911E2B00C48F2F /* GameInstall.m */,
|
DA81FC3E12911E2B00C48F2F /* GameInstall.m */,
|
||||||
|
DA92968E1292328200EDB02E /* SidebarEntry.h */,
|
||||||
|
DA92968F1292328200EDB02E /* SidebarEntry.m */,
|
||||||
);
|
);
|
||||||
name = Classes;
|
name = Classes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -86,8 +93,8 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
|
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
|
||||||
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
|
|
||||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
|
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
|
||||||
|
DA9295A612921DF900EDB02E /* WebKit.framework */,
|
||||||
);
|
);
|
||||||
name = "Other Frameworks";
|
name = "Other Frameworks";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -209,9 +216,10 @@
|
|||||||
8D11072D0486CEB800E47090 /* main.m in Sources */,
|
8D11072D0486CEB800E47090 /* main.m in Sources */,
|
||||||
256AC3DA0F4B6AC300CF3369 /* OpenRAAppDelegate.m in Sources */,
|
256AC3DA0F4B6AC300CF3369 /* OpenRAAppDelegate.m in Sources */,
|
||||||
DA81FA821290F5C800C48F2F /* Controller.m in Sources */,
|
DA81FA821290F5C800C48F2F /* Controller.m in Sources */,
|
||||||
DA81FAAA1290FA0000C48F2F /* ModEntry.m in Sources */,
|
DA81FAAA1290FA0000C48F2F /* Mod.m in Sources */,
|
||||||
DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */,
|
DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */,
|
||||||
DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */,
|
DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */,
|
||||||
|
DA9296901292328200EDB02E /* SidebarEntry.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
32
OpenRA.Launcher.Mac/SidebarEntry.h
Normal file
32
OpenRA.Launcher.Mac/SidebarEntry.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@class Mod;
|
||||||
|
@interface SidebarEntry : NSObject
|
||||||
|
{
|
||||||
|
BOOL isHeader;
|
||||||
|
NSString *title;
|
||||||
|
NSImage *icon;
|
||||||
|
id object;
|
||||||
|
NSMutableArray *children;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (readonly) BOOL isHeader;
|
||||||
|
@property (readonly) NSString *title;
|
||||||
|
@property (readonly) NSMutableArray* children;
|
||||||
|
@property (readonly) NSImage* icon;
|
||||||
|
|
||||||
|
+ (id)headerWithTitle:(NSString *)aTitle;
|
||||||
|
+ (id)entryWithTitle:(NSString *)aTitle object:(id)anObject icon:(id)anIcon;
|
||||||
|
+ (id)entryWithMod:(Mod *)baseMod allMods:(NSArray *)allMods;
|
||||||
|
- (id)initWithTitle:(NSString *)aTitle object:(id)anObject icon:(id)anIcon isHeader:(BOOL)aHeader;
|
||||||
|
- (void)addChild:(id)child;
|
||||||
|
|
||||||
|
@end
|
||||||
78
OpenRA.Launcher.Mac/SidebarEntry.m
Normal file
78
OpenRA.Launcher.Mac/SidebarEntry.m
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "SidebarEntry.h"
|
||||||
|
#import "Mod.h"
|
||||||
|
|
||||||
|
@implementation SidebarEntry
|
||||||
|
@synthesize isHeader;
|
||||||
|
@synthesize title;
|
||||||
|
@synthesize children;
|
||||||
|
@synthesize icon;
|
||||||
|
|
||||||
|
+ (id)headerWithTitle:(NSString *)aTitle;
|
||||||
|
{
|
||||||
|
id newObject = [[self alloc] initWithTitle:aTitle object:nil icon:nil isHeader:YES];
|
||||||
|
[newObject autorelease];
|
||||||
|
return newObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)entryWithTitle:(NSString *)aTitle object:(id)anObject icon:(id)anIcon
|
||||||
|
{
|
||||||
|
id newObject = [[self alloc] initWithTitle:aTitle object:anObject icon:anIcon isHeader:NO];
|
||||||
|
[newObject autorelease];
|
||||||
|
return newObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)entryWithMod:(Mod *)baseMod allMods:(NSArray *)allMods
|
||||||
|
{
|
||||||
|
// TODO: Get the mod icon from the Mod
|
||||||
|
// Temporary hack until mods define an icon
|
||||||
|
NSString* imageName = [[NSBundle mainBundle] pathForResource:@"OpenRA" ofType:@"icns"];
|
||||||
|
id icon = [[[NSImage alloc] initWithContentsOfFile:imageName] autorelease];
|
||||||
|
id ret = [SidebarEntry entryWithTitle:[baseMod title] object:baseMod icon:icon];
|
||||||
|
|
||||||
|
for (id aMod in allMods)
|
||||||
|
{
|
||||||
|
if (![[aMod requires] isEqualToString:[baseMod mod]])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
id child = [SidebarEntry entryWithMod:aMod allMods:allMods];
|
||||||
|
[ret addChild:child];
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithTitle:(NSString *)aTitle object:(id)anObject icon:(id)anIcon isHeader:(BOOL)isaHeader
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
|
isHeader = isaHeader;
|
||||||
|
title = [aTitle retain];
|
||||||
|
object = [anObject retain];
|
||||||
|
icon = [anIcon retain];
|
||||||
|
children = [[NSMutableArray alloc] init];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addChild:(Mod *)child
|
||||||
|
{
|
||||||
|
NSLog(@"Adding sidebar child %@ to %@",[child title], title);
|
||||||
|
[children addObject:child];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[title release]; title = nil;
|
||||||
|
[object release]; object = nil;
|
||||||
|
[icon release]; icon = nil;
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
@end
|
||||||
Reference in New Issue
Block a user