Label current download with name of what's being downloaded
This commit is contained in:
parent
131c8244e3
commit
e40fc68afc
@ -1288,7 +1288,9 @@
|
||||
"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.\n\nThere are also many more expansion packs not available through the automatic installer.\n\nImportant: if you have old expansion packs installed in the OXP format, Oolite will not be able to automatically detect that they are the same pack as a new release. When downloading an expansion through this manager, you must first uninstall any old OXP versions of the same expansion to avoid problems.";
|
||||
"oolite-oxzmanager-nothing-removable" = "Oolite can only remove expansion packs which have been added through this system, and there are currently none installed. Expansion packs which you have installed manually must also be removed manually. Oolite is not able to manage old OXP format expansion packs for you.";
|
||||
"oolite-oxzmanager-restart" = "As you have changed the expansion packs you have installed, Oolite now needs to reload the game data. This may take a few seconds or several minutes depending on how fast your computer is and how many packs you have installed. Please be patient while this reload completes: Oolite will not respond to the keyboard or mouse until this is done.";
|
||||
"oolite-oxzmanager-progress-@-of-@" = "Downloading: %@ of %@";
|
||||
"oolite-oxzmanager-progress-@-is-@-of-@" = "Downloading %@: %@ of %@";
|
||||
"oolite-oxzmanager-download-label-list" = "OXZ List";
|
||||
"oolite-oxzmanager-download-label-oxz" = "Expansion";
|
||||
"oolite-oxzmanager-progress-done-%u-%u" = "Download complete. There are now %u expansion packs available for download, and %u pack(s) have been installed here.";
|
||||
"oolite-oxzmanager-removal-done" = "Expansion pack removed";
|
||||
"oolite-oxzmanager-progress-error" = "Download failed! See Latest.log for more details. Using the '[oolite-oxzmanager-update-list]' menu option if you have not done so already and re-attempting the download may sometimes fix the problem.";
|
||||
|
@ -62,6 +62,8 @@ typedef enum {
|
||||
BOOL _changesMade;
|
||||
|
||||
NSURLConnection *_currentDownload;
|
||||
NSString *_currentDownloadName;
|
||||
|
||||
OXZDownloadStatus _downloadStatus;
|
||||
NSUInteger _downloadProgress;
|
||||
NSUInteger _downloadExpected;
|
||||
@ -70,6 +72,8 @@ typedef enum {
|
||||
BOOL _itemIsFiltered;
|
||||
|
||||
NSUInteger _offset;
|
||||
|
||||
NSString *_progressStatus;
|
||||
}
|
||||
|
||||
+ (OOOXZManager *) sharedManager;
|
||||
|
@ -115,7 +115,8 @@ static OOOXZManager *sSingleton = nil;
|
||||
|
||||
|
||||
- (void) setOXZList:(NSArray *)list;
|
||||
- (void) setCurrentDownload:(NSURLConnection *)download;
|
||||
- (void) setCurrentDownload:(NSURLConnection *)download withLabel:(NSString *)label;
|
||||
- (void) setProgressStatus:(NSString *)newStatus;
|
||||
|
||||
- (BOOL) installOXZ:(NSUInteger)item filteredList:(BOOL)filtered;
|
||||
- (BOOL) removeOXZ:(NSUInteger)item;
|
||||
@ -159,6 +160,7 @@ static OOOXZManager *sSingleton = nil;
|
||||
_interfaceState = OXZ_STATE_NODATA;
|
||||
}
|
||||
_changesMade = NO;
|
||||
[self setProgressStatus:@""];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -168,7 +170,7 @@ static OOOXZManager *sSingleton = nil;
|
||||
{
|
||||
if (sSingleton == self) sSingleton = nil;
|
||||
|
||||
[self setCurrentDownload:nil];
|
||||
[self setCurrentDownload:nil withLabel:nil];
|
||||
DESTROY(_oxzList);
|
||||
DESTROY(_managedList);
|
||||
|
||||
@ -287,16 +289,24 @@ static OOOXZManager *sSingleton = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void) setCurrentDownload:(NSURLConnection *)download
|
||||
- (void) setCurrentDownload:(NSURLConnection *)download withLabel:(NSString *)label
|
||||
{
|
||||
if (_currentDownload != nil)
|
||||
{
|
||||
[_currentDownload cancel]; // releases via delegate
|
||||
}
|
||||
_currentDownload = [download retain];
|
||||
DESTROY(_currentDownloadName);
|
||||
_currentDownloadName = [label copy];
|
||||
}
|
||||
|
||||
|
||||
- (void) setProgressStatus:(NSString *)new
|
||||
{
|
||||
DESTROY(_progressStatus);
|
||||
_progressStatus = [new copy];
|
||||
}
|
||||
|
||||
- (BOOL) updateManifests
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[self dataURL]]];
|
||||
@ -320,7 +330,22 @@ static OOOXZManager *sSingleton = nil;
|
||||
{
|
||||
_downloadProgress = 0;
|
||||
_downloadExpected = 0;
|
||||
[self setCurrentDownload:download]; // retains it
|
||||
NSString *label = DESC(@"oolite-oxzmanager-download-label-list");
|
||||
if (_interfaceState != OXZ_STATE_UPDATING)
|
||||
{
|
||||
NSDictionary *expectedManifest = nil;
|
||||
if (_itemIsFiltered)
|
||||
{
|
||||
expectedManifest = [[self managedOXZs] objectAtIndex:_item];
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedManifest = [_oxzList objectAtIndex:_item];
|
||||
}
|
||||
label = [expectedManifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-download-label-oxz")];
|
||||
}
|
||||
|
||||
[self setCurrentDownload:download withLabel:label]; // retains it
|
||||
[download release];
|
||||
OOLog(kOOOXZDebugLog,@"Download request received, using %@ and downloading to %@",[request URL],[self downloadPath]);
|
||||
return YES;
|
||||
@ -656,7 +681,9 @@ static OOOXZManager *sSingleton = nil;
|
||||
case OXZ_STATE_INSTALLING:
|
||||
[gui setTitle:DESC(@"oolite-oxzmanager-title-downloading")];
|
||||
|
||||
[gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-progress-@-of-@"),[self humanSize:_downloadProgress],[self humanSize:_downloadExpected]] startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
|
||||
[gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-progress-@-is-@-of-@"),_currentDownloadName,[self humanSize:_downloadProgress],[self humanSize:_downloadExpected]] startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
|
||||
|
||||
[gui addLongText:_progressStatus startingAtRow:OXZ_GUI_ROW_PROGRESS+2 align:GUI_ALIGN_LEFT];
|
||||
|
||||
[gui setText:DESC(@"oolite-oxzmanager-cancel") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
|
||||
[gui setKey:@"_CANCEL" forRow:OXZ_GUI_ROW_UPDATE];
|
||||
|
Loading…
x
Reference in New Issue
Block a user