Add GUI for downloading manifests file
This commit is contained in:
parent
a355327f91
commit
d11b61bde1
@ -1041,7 +1041,7 @@
|
||||
"oolite-start-option-1" = " Start New Commander ";
|
||||
"oolite-start-option-2" = " Load Commander ";
|
||||
"oolite-start-option-3" = " View Ship Library ";
|
||||
"oolite-start-option-4" = " Manage Expansion Packs "; // not yet implemented
|
||||
"oolite-start-option-4" = " Manage Expansion Packs ";
|
||||
"oolite-start-option-5" = " Exit Game ";
|
||||
|
||||
"oolite-newgame-title" = "Start New Commander";
|
||||
@ -1058,7 +1058,18 @@
|
||||
"oolite-scenario-strict-description" = "Strict Mode starts like the normal start, but all expansion packs are permanently disabled for this Commander.";
|
||||
"oolite-scenario-tutorial-description" = "Take a standard Cooperative flight training course, including simulated combat and docking practice.";
|
||||
|
||||
|
||||
"oolite-oxzmanager-title" = "Expansion Pack Manager";
|
||||
"oolite-oxzmanager-exit" = "Return to Menu";
|
||||
"oolite-oxzmanager-acknowledge" = "Continue";
|
||||
"oolite-oxzmanager-download-list" = "Download expansions list";
|
||||
"oolite-oxzmanager-update-list" = "Update expansions list";
|
||||
"oolite-oxzmanager-install" = "Install expansion pack";
|
||||
"oolite-oxzmanager-remove" = "Remove expansion pack";
|
||||
"oolite-oxzmanager-firstrun" = "Before Oolite can install your requested expansions automatically, it needs to retrieve the expansions list. You will need to be connected to the internet for this to work. Use the 'Download expansions list' option when you are ready, or 'Return to Menu' if you do not have internet access now or would rather download and install expansions yourself.";
|
||||
"oolite-oxzmanager-intro" = "Oolite can automatically install some expansions for you if you are connected to the internet. Use the 'Update expansions list' option to retrieve the latest expansions list, and the 'Install expansions' and 'Remove expansions' options to add and remove expansion packs.";
|
||||
"oolite-oxzmanager-progress-@-of-@" = "Downloading: %lu of %lu";
|
||||
"oolite-oxzmanager-progress-done" = "Download complete";
|
||||
"oolite-oxzmanager-progress-error" = "Download failed! See Latest.log for more details.";
|
||||
|
||||
// Loading screen (currently Mac only), also logged under start.progress
|
||||
"loading-ships" = "Loading ship data";
|
||||
|
@ -862,6 +862,7 @@ typedef enum
|
||||
|
||||
- (void) setupStartScreenGui;
|
||||
- (void) setGuiToIntroFirstGo:(BOOL)justCobra;
|
||||
- (void) setGuiToOXZManager;
|
||||
|
||||
- (void) noteGUIWillChangeTo:(OOGUIScreenID)toScreen;
|
||||
- (void) noteGUIDidChangeFrom:(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen;
|
||||
|
@ -53,6 +53,7 @@ MA 02110-1301, USA.
|
||||
#import "OOColor.h"
|
||||
#import "Octree.h"
|
||||
#import "OOCacheManager.h"
|
||||
#import "OOOXZManager.h"
|
||||
#import "OOStringExpander.h"
|
||||
#import "OOStringParsing.h"
|
||||
#import "OOPListParsing.h"
|
||||
@ -2012,7 +2013,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
[self updateTrumbles:delta_t];
|
||||
|
||||
OOEntityStatus status = [self status];
|
||||
if (EXPECT_NOT(status == STATUS_START_GAME && gui_screen != GUI_SCREEN_INTRO1 && gui_screen != GUI_SCREEN_INTRO2 && gui_screen != GUI_SCREEN_NEWGAME && gui_screen != GUI_SCREEN_LOAD))
|
||||
if (EXPECT_NOT(status == STATUS_START_GAME && gui_screen != GUI_SCREEN_INTRO1 && gui_screen != GUI_SCREEN_INTRO2 && gui_screen != GUI_SCREEN_NEWGAME && gui_screen != GUI_SCREEN_OXZMANAGER && gui_screen != GUI_SCREEN_LOAD))
|
||||
{
|
||||
UPDATE_STAGE(@"setGuiToIntroFirstGo:");
|
||||
[self setGuiToIntroFirstGo:YES]; //set up demo mode
|
||||
@ -2617,6 +2618,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
case GUI_SCREEN_INTRO1:
|
||||
case GUI_SCREEN_INTRO2:
|
||||
case GUI_SCREEN_NEWGAME:
|
||||
case GUI_SCREEN_OXZMANAGER:
|
||||
case GUI_SCREEN_MARKET:
|
||||
case GUI_SCREEN_OPTIONS:
|
||||
case GUI_SCREEN_GAMEOPTIONS:
|
||||
@ -8163,13 +8165,10 @@ static NSString *last_outfitting_key=nil;
|
||||
|
||||
++row;
|
||||
|
||||
#if 0
|
||||
// not yet implemented
|
||||
text = DESC(@"oolite-start-option-4");
|
||||
[gui setText:text forRow:row align:GUI_ALIGN_CENTER];
|
||||
[gui setColor:[OOColor yellowColor] forRow:row];
|
||||
[gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
|
||||
#endif
|
||||
|
||||
++row;
|
||||
|
||||
@ -8300,6 +8299,29 @@ static NSString *last_outfitting_key=nil;
|
||||
}
|
||||
|
||||
|
||||
- (void) setGuiToOXZManager
|
||||
{
|
||||
|
||||
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
|
||||
[[UNIVERSE gameView] clearMouse];
|
||||
[UNIVERSE removeDemoShips];
|
||||
|
||||
gui_screen = GUI_SCREEN_OXZMANAGER;
|
||||
|
||||
[[UNIVERSE gui] clearAndKeepBackground:NO];
|
||||
|
||||
OOLog(@"gui.debug",@"OXZMANAGER selected");
|
||||
[[OOOXZManager sharedManager] gui];
|
||||
|
||||
[[OOMusicController sharedController] playThemeMusic];
|
||||
[[UNIVERSE gui] setBackgroundTextureKey:@"oxz-manager"];
|
||||
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- (void) noteGUIWillChangeTo:(OOGUIScreenID)toScreen
|
||||
{
|
||||
JSContext *context = OOJSAcquireContext();
|
||||
|
@ -41,6 +41,7 @@ MA 02110-1301, USA.
|
||||
#import "OOSound.h"
|
||||
#import "OOStringParsing.h"
|
||||
#import "OOCollectionExtractors.h"
|
||||
#import "OOOXZManager.h"
|
||||
#import "ResourceManager.h"
|
||||
#import "HeadUpDisplay.h"
|
||||
#import "OOConstToString.h"
|
||||
@ -3506,6 +3507,10 @@ static BOOL autopilot_pause;
|
||||
{
|
||||
[self setGuiToIntroFirstGo:NO];
|
||||
}
|
||||
else if (([gameView isDown:gvMouseDoubleClick] || [gameView isDown:13]) && [gui selectedRow] == 4+row_zero)
|
||||
{
|
||||
[self setGuiToOXZManager];
|
||||
}
|
||||
else if (([gameView isDown:gvMouseDoubleClick] || [gameView isDown:13]) && [gui selectedRow] == 5+row_zero)
|
||||
{
|
||||
[[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on start screen"];
|
||||
@ -3563,7 +3568,29 @@ static BOOL autopilot_pause;
|
||||
[gameView clearMouse];
|
||||
}
|
||||
break;
|
||||
|
||||
case GUI_SCREEN_OXZMANAGER:
|
||||
if ([self handleGUIUpDownArrowKeys])
|
||||
{
|
||||
// no, but will need to do something similar here later
|
||||
// [[OOOXZManager sharedManager] gui];
|
||||
}
|
||||
|
||||
if (!selectPressed)
|
||||
{
|
||||
if ([gameView isDown:13] || [gameView isDown:gvMouseDoubleClick]) // enter
|
||||
{
|
||||
[[OOOXZManager sharedManager] processSelection];
|
||||
}
|
||||
}
|
||||
selectPressed = [gameView isDown:13];
|
||||
if ([gameView isDown:gvMouseDoubleClick] || [gameView isDown:gvMouseLeftButton])
|
||||
{
|
||||
[gameView clearMouse];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case GUI_SCREEN_MISSION:
|
||||
if ([[self hud] isHidden])
|
||||
|
@ -243,9 +243,6 @@ static GameController *sSharedController = nil;
|
||||
// initialise OXZ manager
|
||||
[OOOXZManager sharedManager];
|
||||
|
||||
// TEMP: just for testing! Should only do this on user request
|
||||
[[OOOXZManager sharedManager] updateManifests];
|
||||
|
||||
// moved here to try to avoid initialising this before having an Open GL context
|
||||
//[self logProgress:DESC(@"Initialising universe")]; // DESC expansions only possible after Universe init
|
||||
[[Universe alloc] initWithGameView:gameView];
|
||||
|
@ -299,51 +299,29 @@ static OOCacheManager *sSingleton = nil;
|
||||
}
|
||||
|
||||
|
||||
#if OOLITE_MAC_OS_X
|
||||
|
||||
- (NSString *)cacheDirectoryPathCreatingIfNecessary:(BOOL)create
|
||||
{
|
||||
/* Construct the path to the directory for cache files, which is:
|
||||
~/Library/Caches/org.aegidian.oolite/
|
||||
or
|
||||
~/GNUStep/Library/Caches/org.aegidian.oolite/
|
||||
In addition to generally being the right place to put caches,
|
||||
~/Library/Caches has the particular advantage of not being indexed by
|
||||
Spotlight or backed up by Time Machine.
|
||||
*/
|
||||
NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
|
||||
if (![self directoryExists:cachePath create:create]) return nil;
|
||||
|
||||
#if !OOLITE_MAC_OS_X
|
||||
// the old cache file on GNUstep was one level up, so remove it if it exists
|
||||
[[NSFileManager defaultManager] removeFileAtPath:[cachePath stringByAppendingPathComponent:@"Oolite-cache.plist"] handler:nil];
|
||||
#endif
|
||||
|
||||
cachePath = [cachePath stringByAppendingPathComponent:@"org.aegidian.oolite"];
|
||||
if (![self directoryExists:cachePath create:create]) return nil;
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
- (NSString *)cacheDirectoryPathCreatingIfNecessary:(BOOL)inCreate
|
||||
{
|
||||
/* Construct the directory path for the cache file, which is probably:
|
||||
~/GNUstep/Library/Caches/
|
||||
*/
|
||||
|
||||
/* Okay, I fixed the hard-coding of GNUStep - NSSearchPath seems
|
||||
* to work just fine. Is there any good reason that we don't
|
||||
* create an org.aegidian.oolite subfolder on GNUStep like Mac
|
||||
* has? If we did, then we could just use the Mac function on all
|
||||
* platforms... - CIM: 2014-01-05 */
|
||||
|
||||
NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);
|
||||
NSString *cachePath = [cachePaths objectAtIndex:0];
|
||||
if (cachePath == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (![self directoryExists:cachePath create:inCreate]) return nil;
|
||||
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -37,11 +37,23 @@ typedef enum {
|
||||
} OXZDownloadStatus;
|
||||
|
||||
|
||||
typedef enum {
|
||||
OXZ_STATE_NODATA,
|
||||
OXZ_STATE_MAIN,
|
||||
OXZ_STATE_UPDATING,
|
||||
OXZ_STATE_PICK_INSTALL,
|
||||
OXZ_STATE_PICK_REMOVE,
|
||||
OXZ_STATE_INSTALLING,
|
||||
OXZ_STATE_REMOVING,
|
||||
OXZ_STATE_TASKDONE
|
||||
} OXZInterfaceState;
|
||||
|
||||
|
||||
@interface OOOXZManager : NSObject
|
||||
{
|
||||
@private
|
||||
NSArray *_oxzList;
|
||||
BOOL _updatingManifests;
|
||||
OXZInterfaceState _interfaceState;
|
||||
|
||||
NSURLConnection *_currentDownload;
|
||||
OXZDownloadStatus _downloadStatus;
|
||||
@ -54,9 +66,14 @@ typedef enum {
|
||||
|
||||
+ (OOOXZManager *) sharedManager;
|
||||
|
||||
- (NSString *) installPath;
|
||||
|
||||
- (BOOL) updateManifests;
|
||||
- (BOOL) cancelUpdateManifests;
|
||||
|
||||
- (NSArray *) manifests;
|
||||
|
||||
- (void) gui;
|
||||
- (void) processSelection;
|
||||
|
||||
@end
|
||||
|
@ -28,9 +28,10 @@ MA 02110-1301, USA.
|
||||
#import "OOPListParsing.h"
|
||||
#import "ResourceManager.h"
|
||||
#import "OOCacheManager.h"
|
||||
|
||||
|
||||
#define OXZ_ASYNC_DOWNLOAD 1
|
||||
#import "OOTypes.h"
|
||||
#import "Universe.h"
|
||||
#import "GuiDisplayGen.h"
|
||||
#import "PlayerEntity.h"
|
||||
|
||||
/* The URL for the manifest.plist array. This one is extremely
|
||||
* temporary, of course */
|
||||
@ -54,7 +55,6 @@ static OOOXZManager *sSingleton = nil;
|
||||
@interface OOOXZManager (NSURLConnectionDataDelegate)
|
||||
#endif
|
||||
|
||||
- (NSString *) installPath;
|
||||
- (NSString *) manifestPath;
|
||||
- (NSString *) manifestDownloadPath;
|
||||
|
||||
@ -87,12 +87,18 @@ static OOOXZManager *sSingleton = nil;
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_updatingManifests = NO;
|
||||
_downloadStatus = OXZ_DOWNLOAD_NONE;
|
||||
// if the file has not been downloaded, this will be nil
|
||||
[self setOXZList:OOArrayFromFile([self manifestPath])];
|
||||
OOLog(kOOOXZDebugLog,@"Initialised with %@",_oxzList);
|
||||
|
||||
if (_oxzList != nil)
|
||||
{
|
||||
_interfaceState = OXZ_STATE_MAIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
_interfaceState = OXZ_STATE_NODATA;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -118,7 +124,16 @@ static OOOXZManager *sSingleton = nil;
|
||||
NSString *appPath = [paths objectAtIndex:0];
|
||||
if (appPath != nil)
|
||||
{
|
||||
appPath = [appPath stringByAppendingPathComponent:@"org.aegidian.oolite"];
|
||||
appPath = [appPath stringByAppendingPathComponent:@"Oolite"];
|
||||
#if OOLITE_MAC_OS_X
|
||||
appPath = [appPath stringByAppendingPathComponent:@"Managed AddOns"];
|
||||
#else
|
||||
/* GNUStep uses "ApplicationSupport" rather than "Application
|
||||
* Support" so match convention by not putting a space in the
|
||||
* path either */
|
||||
appPath = [appPath stringByAppendingPathComponent:@"ManagedAddOns"];
|
||||
#endif
|
||||
return appPath;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
@ -161,27 +176,16 @@ static OOOXZManager *sSingleton = nil;
|
||||
|
||||
- (BOOL) updateManifests
|
||||
{
|
||||
/* The download really should be asynchronous (while it's not so bad for the list, it would be terrible for an actual OXZ), but if I do it this way the delegates never get called - and NSURLDownload never actually puts the file anywhere - and I have no idea why. I'm guessing either something to do with the NSRunLoop not working properly under GNUstep or something wrong with the way I'm interacting with it. - CIM*/
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:kOOOXZDataURL]];
|
||||
#ifndef OXZ_ASYNC_DOWNLOAD
|
||||
NSURLResponse *response = nil;
|
||||
NSError *error = nil;
|
||||
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
|
||||
// TODO: check for errors!
|
||||
[self setOXZList:OOArrayFromData(data,kOOOXZDataURL)];
|
||||
[_oxzList writeToFile:[self manifestPath] atomically:YES];
|
||||
OOLog(kOOOXZDebugLog,@"Downloaded %@",_oxzList);
|
||||
return YES;
|
||||
#else
|
||||
if (_downloadStatus != OXZ_DOWNLOAD_NONE || _updatingManifests)
|
||||
if (_downloadStatus != OXZ_DOWNLOAD_NONE || (_interfaceState != OXZ_STATE_MAIN && _interfaceState != OXZ_STATE_NODATA))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
_downloadStatus = OXZ_DOWNLOAD_STARTED;
|
||||
_interfaceState = OXZ_STATE_UPDATING;
|
||||
NSURLConnection *download = [[NSURLConnection alloc] initWithRequest:request delegate:self];
|
||||
if (download)
|
||||
{
|
||||
_updatingManifests = YES;
|
||||
_downloadProgress = 0;
|
||||
_downloadExpected = 0;
|
||||
[self setCurrentDownload:download]; // retains it
|
||||
@ -192,16 +196,15 @@ static OOOXZManager *sSingleton = nil;
|
||||
else
|
||||
{
|
||||
OOLog(kOOOXZErrorLog,@"Unable to start downloading manifests file at %@",[request URL]);
|
||||
_downloadStatus = OXZ_DOWNLOAD_NONE;
|
||||
_downloadStatus = OXZ_DOWNLOAD_ERROR;
|
||||
return NO;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) cancelUpdateManifests
|
||||
{
|
||||
if (!_updatingManifests || _downloadStatus == OXZ_DOWNLOAD_NONE)
|
||||
if (!_interfaceState == OXZ_STATE_UPDATING || _downloadStatus == OXZ_DOWNLOAD_NONE)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
@ -220,12 +223,18 @@ static OOOXZManager *sSingleton = nil;
|
||||
[[NSFileManager defaultManager] removeFileAtPath:[self manifestDownloadPath] handler:nil];
|
||||
#endif
|
||||
}
|
||||
_updatingManifests = NO;
|
||||
_downloadStatus = OXZ_DOWNLOAD_NONE;
|
||||
_interfaceState = OXZ_STATE_MAIN;
|
||||
[self gui];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (NSArray *) manifests
|
||||
{
|
||||
return _oxzList;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) processDownloadedManifests
|
||||
{
|
||||
@ -234,6 +243,7 @@ static OOOXZManager *sSingleton = nil;
|
||||
return NO;
|
||||
}
|
||||
[self setOXZList:OOArrayFromFile([self manifestDownloadPath])];
|
||||
_interfaceState = OXZ_STATE_TASKDONE;
|
||||
if (_oxzList != nil)
|
||||
{
|
||||
[_oxzList writeToFile:[self manifestPath] atomically:YES];
|
||||
@ -245,17 +255,111 @@ static OOOXZManager *sSingleton = nil;
|
||||
// correct for GNUstep's mostly pre-10.5 API
|
||||
[[NSFileManager defaultManager] removeFileAtPath:[self manifestDownloadPath] handler:nil];
|
||||
#endif
|
||||
[self gui];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadStatus = OXZ_DOWNLOAD_ERROR;
|
||||
OOLog(kOOOXZErrorLog,@"Downloaded manifest was not a valid plist, has been left in %@",[self manifestDownloadPath]);
|
||||
// revert to the old one
|
||||
[self setOXZList:OOArrayFromFile([self manifestPath])];
|
||||
[self gui];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: move these constants somewhere better and use an enum instead
|
||||
#define OXZ_GUI_ROW_FIRSTRUN 1
|
||||
#define OXZ_GUI_ROW_PROGRESS 1
|
||||
#define OXZ_GUI_ROW_UPDATE 26
|
||||
#define OXZ_GUI_ROW_EXIT 27
|
||||
|
||||
|
||||
- (void) gui
|
||||
{
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
OOGUIRow startRow = OXZ_GUI_ROW_EXIT;
|
||||
|
||||
[gui clearAndKeepBackground:YES];
|
||||
[gui setTitle:DESC(@"oolite-oxzmanager-title")];
|
||||
|
||||
/* This switch will give warnings until all states are
|
||||
* covered. Not a problem yet. */
|
||||
switch (_interfaceState)
|
||||
{
|
||||
case OXZ_STATE_NODATA:
|
||||
[gui addLongText:DESC(@"oolite-oxzmanager-firstrun") startingAtRow:OXZ_GUI_ROW_FIRSTRUN align:GUI_ALIGN_LEFT];
|
||||
[gui setText:DESC(@"oolite-oxzmanager-download-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
|
||||
|
||||
startRow = OXZ_GUI_ROW_UPDATE;
|
||||
break;
|
||||
case OXZ_STATE_MAIN:
|
||||
[gui addLongText:DESC(@"oolite-oxzmanager-intro") startingAtRow:OXZ_GUI_ROW_FIRSTRUN align:GUI_ALIGN_LEFT];
|
||||
[gui setText:DESC(@"oolite-oxzmanager-update-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
|
||||
|
||||
// TODO: install and remove options
|
||||
|
||||
startRow = OXZ_GUI_ROW_UPDATE;
|
||||
break;
|
||||
case OXZ_STATE_UPDATING:
|
||||
[gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-progress-@-of-@"),_downloadProgress,_downloadExpected] startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
|
||||
// no options yet
|
||||
// TODO: cancel option
|
||||
break;
|
||||
case OXZ_STATE_TASKDONE:
|
||||
if (_downloadStatus == OXZ_DOWNLOAD_COMPLETE)
|
||||
{
|
||||
[gui addLongText:DESC(@"oolite-oxzmanager-progress-done") startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
|
||||
}
|
||||
else
|
||||
{
|
||||
[gui addLongText:DESC(@"oolite-oxzmanager-progress-error") startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
|
||||
}
|
||||
[gui setText:DESC(@"oolite-oxzmanager-acknowledge") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:@"_ACK" forRow:OXZ_GUI_ROW_UPDATE];
|
||||
startRow = OXZ_GUI_ROW_UPDATE;
|
||||
break;
|
||||
}
|
||||
[gui setText:DESC(@"oolite-oxzmanager-exit") forRow:OXZ_GUI_ROW_EXIT align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:@"_EXIT" forRow:OXZ_GUI_ROW_EXIT];
|
||||
[gui setSelectableRange:NSMakeRange(startRow,2+(OXZ_GUI_ROW_EXIT-startRow))];
|
||||
[gui setSelectedRow:startRow];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void) processSelection
|
||||
{
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
OOGUIRow selection = [gui selectedRow];
|
||||
|
||||
if (selection == OXZ_GUI_ROW_EXIT)
|
||||
{
|
||||
[self cancelUpdateManifests]; // doesn't hurt if no update in progress
|
||||
[PLAYER setGuiToIntroFirstGo:YES];
|
||||
return;
|
||||
}
|
||||
else if (selection == OXZ_GUI_ROW_UPDATE)
|
||||
{
|
||||
if (_interfaceState == OXZ_STATE_TASKDONE)
|
||||
{
|
||||
_interfaceState = OXZ_STATE_MAIN;
|
||||
_downloadStatus = OXZ_DOWNLOAD_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self updateManifests];
|
||||
}
|
||||
}
|
||||
[self gui]; // update GUI
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
|
||||
{
|
||||
@ -277,10 +381,11 @@ static OOOXZManager *sSingleton = nil;
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
|
||||
{
|
||||
OOLog(kOOOXZDebugLog,@"Downloaded %ul bytes",[data length]);
|
||||
OOLog(kOOOXZDebugLog,@"Downloaded %lu bytes",[data length]);
|
||||
[_fileWriter seekToEndOfFile];
|
||||
[_fileWriter writeData:data];
|
||||
_downloadProgress += [data length];
|
||||
[self gui]; // update GUI
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,6 +36,7 @@ MA 02110-1301, USA.
|
||||
#import "OOLogOutputHandler.h"
|
||||
#import "NSFileManagerOOExtensions.h"
|
||||
#import "OldSchoolPropertyListWriting.h"
|
||||
#import "OOOXZManager.h"
|
||||
|
||||
#import "OOJSScript.h"
|
||||
#import "OOPListScript.h"
|
||||
@ -153,31 +154,37 @@ static NSMutableDictionary *sOXPManifests;
|
||||
|
||||
sRootPaths = [[NSArray alloc] initWithObjects:[self builtInPath],
|
||||
|
||||
/* 1st path - ensures manually installed OXZs load later than
|
||||
* managed ones, which may be useful for debugging/testing
|
||||
* purposes. */
|
||||
[[OOOXZManager sharedManager] installPath],
|
||||
|
||||
#if OOLITE_MAC_OS_X
|
||||
/* 1st mac path */ [[[[NSHomeDirectory() stringByAppendingPathComponent:@"Library"]
|
||||
/* 2nd mac path */ [[[[NSHomeDirectory() stringByAppendingPathComponent:@"Library"]
|
||||
stringByAppendingPathComponent:@"Application Support"]
|
||||
stringByAppendingPathComponent:@"Oolite"]
|
||||
stringByAppendingPathComponent:@"AddOns"],
|
||||
/* 2nd mac path */ [[[[NSBundle mainBundle] bundlePath]
|
||||
/* 3rd mac path */ [[[[NSBundle mainBundle] bundlePath]
|
||||
stringByDeletingLastPathComponent]
|
||||
stringByAppendingPathComponent:@"AddOns"],
|
||||
|
||||
#elif OOLITE_WINDOWS
|
||||
/* windows path */ @"../AddOns",
|
||||
/* 2nd windows path */ @"../AddOns",
|
||||
#else
|
||||
/* 1st *nix path */ @"AddOns",
|
||||
/* 2nd *nix path */ @"AddOns",
|
||||
#endif
|
||||
|
||||
#if !OOLITE_WINDOWS
|
||||
/* 2nd *nix path, 3rd mac path */
|
||||
/* 3rd *nix path, 4th mac path */
|
||||
[[NSHomeDirectory()
|
||||
stringByAppendingPathComponent:@".Oolite"]
|
||||
stringByAppendingPathComponent:@"AddOns"],
|
||||
#endif
|
||||
|
||||
|
||||
nil];
|
||||
}
|
||||
|
||||
OOLog(@"paths.debug",@"%@",sRootPaths);
|
||||
return sRootPaths;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ ENTRY(GUI_SCREEN_MAIN, -1)
|
||||
ENTRY(GUI_SCREEN_INTRO1, -1)
|
||||
ENTRY(GUI_SCREEN_INTRO2, -1)
|
||||
ENTRY(GUI_SCREEN_NEWGAME, -1)
|
||||
ENTRY(GUI_SCREEN_OXZMANAGER, -1)
|
||||
ENTRY(GUI_SCREEN_STATUS, -1)
|
||||
ENTRY(GUI_SCREEN_MANIFEST, -1)
|
||||
ENTRY(GUI_SCREEN_EQUIP_SHIP, -1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user