Add "Install from web" "Install from CD" and "Quit" buttons to the install menu. "From CD" prompts a system file picker (osx only).

This commit is contained in:
Paul Chote
2011-01-19 23:24:13 +13:00
parent 6c14b78b7c
commit 908a927929
6 changed files with 60 additions and 12 deletions

View File

@@ -254,7 +254,7 @@ namespace OpenRA
viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer);
modData.WidgetLoader.LoadWidget( new Dictionary<string,object>(), Widget.RootWidget, "PERF_BG" );
Widget.OpenWindow("MAINMENU_INIT");
modData.WidgetLoader.LoadWidget( new Dictionary<string,object>(), Widget.RootWidget, "MAINMENU_INIT" );
Game.orderManager.LastTickTime = Environment.TickCount;
}

View File

@@ -5,7 +5,7 @@
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#import "main.h"
#import "Controller.h"
@implementation Controller
@@ -43,13 +43,17 @@
[[NSApplication sharedApplication] terminate:self];
}
[self launchMod:@"cnc"];
[self launchMod:@"ra"];
[NSApp terminate: nil];
}
- (void)launchFilePicker:(NSArray *)args
{
hide_menubar_if_necessary();
[NSApp activateIgnoringOtherApps:YES];
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setLevel:CGShieldingWindowLevel()];
[op setAllowsMultipleSelection:NO];
NSUInteger a = [args indexOfObject:@"--title"];
@@ -64,6 +68,18 @@
if (a != NSNotFound)
[op setDirectory:[[args objectAtIndex:a+1] stringByExpandingTildeInPath]];
a = [args indexOfObject:@"--require-directory"];
if (a != NSNotFound)
{
[op setCanChooseFiles:NO];
[op setCanChooseDirectories:YES];
}
a = [args indexOfObject:@"--button-text"];
if (a != NSNotFound)
[op setPrompt:[[args objectAtIndex:a+1] stringByExpandingTildeInPath]];
if ([op runModal] == NSFileHandlingPanelOKButton)
printf("%s\n", [[[op URL] path] UTF8String]);

View File

@@ -27,6 +27,7 @@
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
8D1107310486CEB800E47090 /* OpenRA-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OpenRA-Info.plist"; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* OpenRA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRA.app; sourceTree = BUILT_PRODUCTS_DIR; };
DA134CC412E6F131009AA0EF /* main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main.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>"; };
DA81FBDB12910E4900C48F2F /* OpenRA.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenRA.icns; sourceTree = "<group>"; };
@@ -99,6 +100,7 @@
children = (
256AC3F00F4B6AF500CF3369 /* OpenRA_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
DA134CC412E6F131009AA0EF /* main.h */,
);
name = "Other Sources";
sourceTree = "<group>";

View File

@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
#import "main.h"
extern char **environ;
int main(int argc, char *argv[])
@@ -45,11 +46,8 @@ int main(int argc, char *argv[])
setenv("DYLD_LIBRARY_PATH", buf, 1);
}
// Hide the menubar if we are running fullscreen
// TODO: HACK: Parse the settings.yaml / commandline args for fullscreen options
if (YES)
[NSMenu setMenuBarVisible:NO];
hide_menubar_if_necessary();
/* Exec mono */
execve(args[0], args, environ);
}
@@ -57,3 +55,11 @@ int main(int argc, char *argv[])
/* Else, start the launcher */
return NSApplicationMain(argc, (const char **) argv);
}
// Hide the menubar and dock if we are running fullscreen
void hide_menubar_if_necessary()
{
// TODO: HACK: Parse the settings.yaml / commandline args for fullscreen options
if (YES)
[NSMenu setMenuBarVisible:NO];
}

View File

@@ -7,15 +7,39 @@ Background@MAINMENU_INIT:
Visible:true
Delegate:RAInitDelegate
Children:
Button@FINISH_INIT:
Id:FINISH_INIT
Label@MAINMENU_LABEL_TITLE:
Id:MAINMENU_LABEL_TITLE
X:0
Y:20
Width:250
Height:25
Text:Install Game Content
Align:Center
Bold:True
Button@INIT_DOWNLOAD:
Id:INIT_DOWNLOAD
X:45
Y:70
Width:160
Height:25
Text:START
Text:Download
Bold:True
Button@INIT_FROMCD:
Id:INIT_FROMCD
X:45
Y:110
Width:160
Height:25
Text:From CD
Bold:True
Button@INIT_QUIT:
Id:INIT_QUIT
X:45
Y:150
Width:160
Height:25
Text:Quit
Bold:True
Background@MAINMENU_BG:
Id:MAINMENU_BG
X:(WINDOW_RIGHT - WIDTH)/2