From 623b12f5fbf387d97bbc0776bd1dc1d808c573a9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 17 Apr 2010 00:11:55 +1200 Subject: [PATCH] Use a tableview for the mod list --- packaging/osx/launcher/Controller.h | 8 +- packaging/osx/launcher/Controller.m | 41 +- .../osx/launcher/English.lproj/MainMenu.xib | 470 +++++++++++++----- .../launcher/OpenRA.xcodeproj/project.pbxproj | 4 + packaging/osx/launcher/mods.plist | 41 ++ 5 files changed, 436 insertions(+), 128 deletions(-) create mode 100644 packaging/osx/launcher/mods.plist diff --git a/packaging/osx/launcher/Controller.h b/packaging/osx/launcher/Controller.h index 9c9aa583ce..ca58595574 100644 --- a/packaging/osx/launcher/Controller.h +++ b/packaging/osx/launcher/Controller.h @@ -20,9 +20,12 @@ @class Settings; @interface Controller : NSObject { + // Main Window - NSDictionary *modButtonMappings; + IBOutlet NSWindow *mainWindow; Settings *settings; + IBOutlet id modsList; + NSArray *mods; // Package Downloader NSString *localDownloadPath; @@ -31,9 +34,6 @@ long long expectedData; long long downloadedData; BOOL downloading; - - - IBOutlet NSWindow *mainWindow; // Download Sheet IBOutlet NSWindow *downloadSheet; diff --git a/packaging/osx/launcher/Controller.m b/packaging/osx/launcher/Controller.m index 86f5032448..357ed65570 100644 --- a/packaging/osx/launcher/Controller.m +++ b/packaging/osx/launcher/Controller.m @@ -25,24 +25,49 @@ { NSURL *settingsFile = [NSURL fileURLWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"launcher.ini"]]; settings = [[Settings alloc] init]; - [settings loadSettingsFile:settingsFile]; - - modButtonMappings = [[NSDictionary dictionaryWithObjectsAndKeys: - @"cnc",@"C&C", - @"ra",@"Red Alert", - nil] retain]; + + mods = [[NSArray arrayWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"mods.plist"]] retain]; } +#pragma mark Main window -(IBAction)launchApp:(id)sender { - [settings setValue:[modButtonMappings objectForKey:[sender title]] forSetting:@"InitialMods"]; + NSString *modString = [[mods objectAtIndex:[modsList selectedRow]] objectForKey:@"Mods"]; + [settings setValue:modString forSetting:@"InitialMods"]; [settings save]; [[NSWorkspace sharedWorkspace] launchApplication:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"OpenRA.app"]]; [NSApp terminate: nil]; } +- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView +{ + return [mods count]; +} + +- (id)tableView:(NSTableView *)table + objectValueForTableColumn:(NSTableColumn *)column + row:(NSInteger)row +{ + if (row >= [mods count]) + return @""; + + if ([[column identifier] isEqualToString:@"name"]) + { + return [[mods objectAtIndex:row] objectForKey:@"Name"]; + } + + if ([[column identifier] isEqualToString:@"status"]) + { + // Todo: get mod status + return @"Todo";//[[mods objectAtIndex:row] objectForKey:@"Name"]; + } + + return @""; +} + +#pragma mark Downloads sheet -(IBAction)showDownloadSheet:(id)sender { [NSApp beginSheet:downloadSheet modalForWindow:mainWindow @@ -158,7 +183,7 @@ - (void) dealloc { - [modButtonMappings release]; + [mods release]; [settings release]; [super dealloc]; } diff --git a/packaging/osx/launcher/English.lproj/MainMenu.xib b/packaging/osx/launcher/English.lproj/MainMenu.xib index 2ebe447a29..420aaa8af9 100644 --- a/packaging/osx/launcher/English.lproj/MainMenu.xib +++ b/packaging/osx/launcher/English.lproj/MainMenu.xib @@ -2,19 +2,19 @@ 1050 - 10C540 + 10D573 740 - 1038.25 - 458.00 + 1038.29 + 460.00 com.apple.InterfaceBuilder.CocoaPlugin 740 YES - - + + YES @@ -265,11 +265,11 @@ _NSMainMenu - 7 + 5 2 - {{855, 474}, {424, 149}} + {{855, 438}, {324, 185}} 1954022400 - OpenRA Launcher + Select Game NSWindow {3.40282e+38, 3.40282e+38} @@ -278,41 +278,21 @@ 256 YES - - - 289 - {{109, 60}, {96, 32}} - - YES - - -2080244224 - 134217728 - C&C - - LucidaGrande - 13 - 1044 - - - -2038284033 - 129 - - - 200 - 25 - - 289 - {{285, 4}, {103, 32}} + {{109, 12}, {103, 32}} YES 67239424 134217984 Download - + + LucidaGrande + 13 + 1044 + -2038284033 129 @@ -325,13 +305,13 @@ 289 - {{222, 60}, {98, 32}} + {{212, 12}, {98, 32}} YES -2080244224 134217728 - Red Alert + Play -2038284033 @@ -342,40 +322,201 @@ 25 - + - 266 - {{117, 107}, {190, 17}} - - YES - - 68288064 - 138413056 - Select Game - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2ODY1AA + 274 + + YES + + + 2304 + + YES + + + 256 + {282, 87} + + YES + + + 256 + {282, 17} + + + + + + -2147483392 + {{224, 0}, {16, 17}} + + + + YES + + name + 186 + 40 + 1000 + + 75628096 + 2048 + Mod + + LucidaGrande + 11 + 3100 + + + 3 + MC4zMzMzMzI5ODU2AA + + + 6 + System + headerTextColor + + 3 + MAA + + + + + 337772096 + 2048 + Text Cell + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2ODY1AA + + + + 6 + System + controlTextColor + + + + 3 + YES + YES + + + + status + 90 + 40 + 1000 + + 75628096 + 2048 + Status + + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + YES + + + + 3 + 2 + + 3 + MQA + + + 6 + System + gridColor + + 3 + MC41AA + + + 17 + -700448768 + + + 4 + 15 + 0 + YES + 0 + + {{1, 17}, {282, 87}} + + + + + 4 - - 6 - System - controlTextColor - - 3 - MAA + + + -2147483392 + {{224, 17}, {15, 102}} + + + _doScroller: + 0.8913043737411499 + + + + -2147483392 + {{1, 140}, {282, 15}} + + 1 + + _doScroller: + 0.97577852010726929 + + + + 2304 + + YES + + {{1, 0}, {282, 17}} + + + + + 4 + + {{20, 60}, {284, 105}} + + + 562 + + + + + + QSAAAEEgAABBmAAAQZgAAA - {424, 149} + {324, 185} {{0, 0}, {1680, 1028}} @@ -477,7 +618,12 @@ 16 - + + 6 + System + controlColor + + @@ -589,14 +735,6 @@ 493 - - - launchApp: - - - - 536 - launchApp: @@ -701,6 +839,22 @@ 597 + + + modsList + + + + 617 + + + + dataSource + + + + 618 + @@ -887,10 +1041,9 @@ YES - + - - + @@ -917,21 +1070,6 @@ - - 533 - - - YES - - - - cnc - - - 534 - - - 535 @@ -952,20 +1090,6 @@ - - 551 - - - YES - - - - - - 552 - - - 558 @@ -1083,6 +1207,71 @@ + + 598 + + + YES + + + + + + + + + 599 + + + + + 600 + + + + + 601 + + + YES + + + + + + + 602 + + + + + 603 + + + YES + + + + + + 604 + + + YES + + + + + + 605 + + + + + 606 + + + @@ -1144,12 +1333,8 @@ 492.IBPluginDependency 5.IBPluginDependency 5.ImportedFromIB2 - 533.IBPluginDependency - 534.IBPluginDependency 548.IBPluginDependency 549.IBPluginDependency - 551.IBPluginDependency - 552.IBPluginDependency 553.IBPluginDependency 554.IBPluginDependency 557.IBPluginDependency @@ -1178,6 +1363,15 @@ 590.IBPluginDependency 595.IBPluginDependency 596.IBPluginDependency + 598.IBPluginDependency + 599.IBPluginDependency + 600.IBPluginDependency + 601.IBPluginDependency + 602.IBPluginDependency + 603.IBPluginDependency + 604.IBPluginDependency + 605.IBPluginDependency + 606.IBPluginDependency 92.IBPluginDependency 92.ImportedFromIB2 @@ -1217,14 +1411,14 @@ com.apple.InterfaceBuilder.CocoaPlugin {{525, 802}, {197, 73}} - {{226, 836}, {221, 20}} + {{226, 933}, {221, 20}} com.apple.InterfaceBuilder.CocoaPlugin {74, 862} {{6, 978}, {478, 20}} - {{740, 575}, {424, 149}} + {{740, 539}, {324, 185}} com.apple.InterfaceBuilder.CocoaPlugin - {{740, 575}, {424, 149}} + {{740, 539}, {324, 185}} {{33, 99}, {480, 360}} @@ -1245,10 +1439,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1273,6 +1463,15 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -1292,7 +1491,7 @@ - 597 + 621 @@ -1330,6 +1529,7 @@ downloadSheet infoText mainWindow + modsList statusText @@ -1342,6 +1542,7 @@ id NSWindow id + id @@ -1559,7 +1760,7 @@ NSObject - + IBFrameworkSource AppKit.framework/Headers/NSTableView.h @@ -1742,6 +1943,43 @@ AppKit.framework/Headers/NSResponder.h + + NSScrollView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSScrollView.h + + + + NSScroller + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSScroller.h + + + + NSTableColumn + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableColumn.h + + + + NSTableHeaderView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSTableHeaderView.h + + + + NSTableView + NSControl + + NSTextField NSControl diff --git a/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj b/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj index 0eae321e17..0b05aeea1b 100644 --- a/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj +++ b/packaging/osx/launcher/OpenRA.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; DA1241101151F194002EFE2B /* OpenRa.icns in Resources */ = {isa = PBXBuildFile; fileRef = DA12410F1151F194002EFE2B /* OpenRa.icns */; }; + DA28A92A117878EC00342835 /* mods.plist in Resources */ = {isa = PBXBuildFile; fileRef = DA28A929117878EC00342835 /* mods.plist */; }; DAAB5C7911536D6500DCCB80 /* Settings.m in Sources */ = {isa = PBXBuildFile; fileRef = DAAB5C7811536D6500DCCB80 /* Settings.m */; }; DAFD657B11520799001F4C97 /* launcher.ini in Resources */ = {isa = PBXBuildFile; fileRef = DAFD657A11520799001F4C97 /* launcher.ini */; }; /* End PBXBuildFile section */ @@ -31,6 +32,7 @@ 8D1107310486CEB800E47090 /* OpenRA-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OpenRA-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* OpenRA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRA.app; sourceTree = BUILT_PRODUCTS_DIR; }; DA12410F1151F194002EFE2B /* OpenRa.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenRa.icns; sourceTree = ""; }; + DA28A929117878EC00342835 /* mods.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = mods.plist; sourceTree = ""; }; DAAB5C7711536D6500DCCB80 /* Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Settings.h; sourceTree = ""; }; DAAB5C7811536D6500DCCB80 /* Settings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Settings.m; sourceTree = ""; }; DAFD657A11520799001F4C97 /* launcher.ini */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = launcher.ini; sourceTree = ""; }; @@ -114,6 +116,7 @@ DA12410F1151F194002EFE2B /* OpenRa.icns */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + DA28A929117878EC00342835 /* mods.plist */, ); name = Resources; sourceTree = ""; @@ -175,6 +178,7 @@ 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, DA1241101151F194002EFE2B /* OpenRa.icns in Resources */, DAFD657B11520799001F4C97 /* launcher.ini in Resources */, + DA28A92A117878EC00342835 /* mods.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/packaging/osx/launcher/mods.plist b/packaging/osx/launcher/mods.plist new file mode 100644 index 0000000000..6d82725b27 --- /dev/null +++ b/packaging/osx/launcher/mods.plist @@ -0,0 +1,41 @@ + + + + + + Name + Command & Conquer + Mods + cnc + RequiredFiles + + mods/ra/packages/conquer.mix + http://open-ra.org/packages/cnc-packages.zip + + + + Name + Red Alert + Mods + ra + RequiredFiles + + mods/ra/packages/main.mix + http://open-ra.org/packages/ra-packages.zip + + + + Name + Red Alert with The Aftermath + Mods + ra,aftermath + RequiredFiles + + mods/ra/packages/main.mix + http://open-ra.org/packages/ra-packages.zip + mods/aftermath/packages/expand2.mix + http://open-ra.org/packages/aftermath-packages.zip + + + +