Changeset 2102


Ignore:
Timestamp:
Jun 16, 2007, 9:21:43 PM (15 years ago)
Author:
livings124
Message:

add the ability to change the torrent name

Location:
branches/file_selection/macosx
Files:
2 edited

Legend:

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

    r2100 r2102  
    3030    IBOutlet NSImageView * fIcon, * fLocationIcon;
    3131    IBOutlet NSTextField * fNameField, * fStatusField, * fPiecesField, * fLocationField,
    32                 * fTrackerField;
     32                * fTrackerField, * fTorrentNameField;
    3333    IBOutlet NSTextView * fCommentView;
    3434    IBOutlet NSButton * fPrivateCheck;
  • branches/file_selection/macosx/CreatorWindowController.m

    r2100 r2102  
    9292    [fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
    9393    [fLocationField setToolTip: fLocation];
     94   
     95    [fTorrentNameField setStringValue: [name stringByAppendingPathExtension: @"torrent"]];
    9496}
    9597
     
    132134            [alert setMessageText: NSLocalizedString(@"Tracker address must begin with \"http://\".",
    133135                                                    "Create torrent -> http warning -> title")];
    134             [alert setInformativeText: NSLocalizedString(@"Please change the tracker address to create the torrent.",
     136            [alert setInformativeText: NSLocalizedString(@"Change the tracker address to create the torrent.",
    135137                                                        "Create torrent -> http warning -> warning")];
    136138            [alert setAlertStyle: NSWarningAlertStyle];
     
    144146        trackerString = [@"http://" stringByAppendingString: trackerString];
    145147   
    146     #warning make user-settable
    147     NSString * file = [fLocation stringByAppendingPathComponent:
    148                         [[fPath lastPathComponent] stringByAppendingPathExtension: @"torrent"]];
    149    
    150     tr_makeMetaInfo(fInfo, [file UTF8String], [trackerString UTF8String], [[fCommentView string] UTF8String],
    151                     [fPrivateCheck state] == NSOnState);
     148    NSString * torrentName = [fTorrentNameField stringValue];
     149    if ([[torrentName pathExtension] caseInsensitiveCompare: @"torrent"] != NSOrderedSame)
     150    {
     151        NSAlert * alert = [[[NSAlert alloc] init] autorelease];
     152        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> .torrent warning -> button")];
     153        [alert setMessageText: NSLocalizedString(@"Torrents must end in \".torrent\".",
     154                                                "Create torrent -> .torrent warning -> title")];
     155        [alert setInformativeText: NSLocalizedString(@"Add this file extension to create the torrent.",
     156                                                    "Create torrent -> .torrent warning -> warning")];
     157        [alert setAlertStyle: NSWarningAlertStyle];
     158       
     159        [alert beginSheetModalForWindow: [self window] modalDelegate: self didEndSelector: nil contextInfo: nil];
     160       
     161        return;
     162    }
     163   
     164    tr_makeMetaInfo(fInfo, [[fLocation stringByAppendingPathComponent: torrentName] UTF8String], [trackerString UTF8String],
     165                            [[fCommentView string] UTF8String], [fPrivateCheck state] == NSOnState);
    152166   
    153167    #warning add to T
Note: See TracChangeset for help on using the changeset viewer.