Changeset 2117


Ignore:
Timestamp:
Jun 17, 2007, 4:57:58 AM (15 years ago)
Author:
livings124
Message:

small adjustments here and there to torrent creation

Location:
branches/file_selection/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/macosx/CreatorWindowController.m

    r2113 r2117  
    3333- (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
    3434- (void) checkProgress: (NSTimer *) timer;
     35- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info;
    3536
    3637@end
     
    103104    [fStatusField setStringValue: statusString];
    104105   
    105     [fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d pieces, %@ each", "Create torrent -> info"),
    106                                     fInfo->pieceCount, [NSString stringForFileSize: fInfo->pieceSize]]];
     106    NSString * piecesCountString;
     107    int piecesCount = fInfo->pieceCount;
     108    if (piecesCount == 1)
     109        piecesCountString = NSLocalizedString(@"1 piece", "Create torrent -> info");
     110    else
     111        piecesCountString = [NSString stringWithFormat: NSLocalizedString(@"%d pieces", "Create torrent -> info"),
     112                                                                piecesCount];
     113    [fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@, %@ each", "Create torrent -> info"),
     114                                        piecesCountString, [NSString stringForFileSize: fInfo->pieceSize]]];
    107115   
    108116    fLocation = [[[DEFAULT_SAVE_LOCATION stringByAppendingPathComponent: [name stringByAppendingPathExtension: @"torrent"]]
     
    229237        timer = nil;
    230238       
    231         #warning check failed or not
    232        
    233239        if ([[self window] attachedSheet])
     240        {
    234241            [NSApp endSheet: fProgressWindow];
    235         [fProgressWindow orderOut: nil];
     242            [fProgressWindow orderOut: nil];
     243        }
     244       
     245        if (fInfo->failed /*&& !fInfo->abortFlag*/)
     246        {
     247            NSAlert * alert = [[[NSAlert alloc] init] autorelease];
     248            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> failed -> button")];
     249            [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Creation of \"%@\" failed.",
     250                                            "Create torrent -> failed -> title"), [fLocation lastPathComponent]]];
     251            [alert setInformativeText: NSLocalizedString(@"There was an error parsing the data file. "
     252                                        "The torrent file was not created.", "Create torrent -> failed -> warning")];
     253            [alert setAlertStyle: NSWarningAlertStyle];
     254           
     255            [alert beginSheetModalForWindow: [self window] modalDelegate: self
     256                    didEndSelector: @selector(failureSheetClosed:returnCode:contextInfo:) contextInfo: nil];
     257            return;
     258        }
    236259       
    237260        #warning add to T
     
    248271}
    249272
     273- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info
     274{
     275    [[alert window] orderOut: nil];
     276    [[self window] close: nil];
     277}
     278
    250279@end
Note: See TracChangeset for help on using the changeset viewer.