Ignore:
Timestamp:
Sep 9, 2012, 12:58:53 PM (9 years ago)
Author:
livings124
Message:

revert the last commit because of styling changes snuck in from copy/paste

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r13488 r13489  
    11/******************************************************************************
    22 * $Id$
    3  *
     3 * 
    44 * Copyright (c) 2005-2012 Transmission authors and contributors
    55 *
     
    139139{
    140140    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [[NSNumber alloc] initWithBool: active], @"Active",
    141                            [[NSNumber alloc] initWithBool: byUser], @"ByUser", nil];
     141                                [[NSNumber alloc] initWithBool: byUser], @"ByUser", nil];
    142142    [(Controller *)controller performSelectorOnMainThread: @selector(altSpeedToggledCallbackIsLimited:)
    143                                                withObject: dict waitUntilDone: NO];
     143        withObject: dict waitUntilDone: NO];
    144144}
    145145
    146146static tr_rpc_callback_status rpcCallback(tr_session * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct,
    147                                           void * controller)
     147                                            void * controller)
    148148{
    149149    [(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
     
    171171        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Transmission already running alert -> button")];
    172172        [alert setMessageText: NSLocalizedString(@"Transmission is already running.",
    173                                                  "Transmission already running alert -> title")];
     173                                                "Transmission already running alert -> title")];
    174174        [alert setInformativeText: NSLocalizedString(@"There is already a copy of Transmission running. "
    175                                                      "This copy cannot be opened until that instance is quit.", "Transmission already running alert -> message")];
     175            "This copy cannot be opened until that instance is quit.", "Transmission already running alert -> message")];
    176176        [alert setAlertStyle: NSCriticalAlertStyle];
    177177       
     
    184184   
    185185    [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithContentsOfFile:
    186                                                               [[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]];
     186        [[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]];
    187187   
    188188    //set custom value transformers
     
    201201        [alert setMessageText: NSLocalizedString(@"Welcome to Transmission", "Legal alert -> title")];
    202202        [alert setInformativeText: NSLocalizedString(@"Transmission is a file-sharing program."
    203                                                      " When you run a torrent, its data will be made available to others by means of upload."
    204                                                      " You and you alone are fully responsible for exercising proper judgement and abiding by your local laws.",
    205                                                      "Legal alert -> message")];
     203            " When you run a torrent, its data will be made available to others by means of upload."
     204            " You and you alone are fully responsible for exercising proper judgement and abiding by your local laws.",
     205            "Legal alert -> message")];
    206206        [alert setAlertStyle: NSInformationalAlertStyle];
    207207       
     
    248248        tr_bencDictAddBool(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, [fDefaults boolForKey: @"SpeedLimitAuto"]);
    249249        tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN, [PrefsController dateToTimeSum:
    250                                                                          [fDefaults objectForKey: @"SpeedLimitAutoOnDate"]]);
     250                                                                            [fDefaults objectForKey: @"SpeedLimitAutoOnDate"]]);
    251251        tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_END, [PrefsController dateToTimeSum:
    252                                                                        [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]]);
     252                                                                            [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]]);
    253253        tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, [fDefaults integerForKey: @"SpeedLimitAutoDay"]);
    254254       
     
    269269        tr_bencDictAddBool(&settings, TR_PREFS_KEY_DHT_ENABLED, [fDefaults boolForKey: @"DHTGlobal"]);
    270270        tr_bencDictAddStr(&settings, TR_PREFS_KEY_DOWNLOAD_DIR, [[[fDefaults stringForKey: @"DownloadFolder"]
    271                                                                   stringByExpandingTildeInPath] UTF8String]);
     271                                                                    stringByExpandingTildeInPath] UTF8String]);
    272272        tr_bencDictAddBool(&settings, TR_PREFS_KEY_DOWNLOAD_QUEUE_ENABLED, [fDefaults boolForKey: @"Queue"]);
    273273        tr_bencDictAddInt(&settings, TR_PREFS_KEY_DOWNLOAD_QUEUE_SIZE, [fDefaults integerForKey: @"QueueDownloadNumber"]);
     
    311311       
    312312        tr_formatter_size_init(1000, [NSLocalizedString(@"KB", "File size - kilobytes") UTF8String],
    313                                [NSLocalizedString(@"MB", "File size - megabytes") UTF8String],
    314                                [NSLocalizedString(@"GB", "File size - gigabytes") UTF8String],
    315                                [NSLocalizedString(@"TB", "File size - terabytes") UTF8String]);
    316        
     313                                        [NSLocalizedString(@"MB", "File size - megabytes") UTF8String],
     314                                        [NSLocalizedString(@"GB", "File size - gigabytes") UTF8String],
     315                                        [NSLocalizedString(@"TB", "File size - terabytes") UTF8String]);
     316
    317317        tr_formatter_speed_init(1000, [NSLocalizedString(@"KB/s", "Transfer speed (kilobytes per second)") UTF8String],
    318                                 [NSLocalizedString(@"MB/s", "Transfer speed (megabytes per second)") UTF8String],
    319                                 [NSLocalizedString(@"GB/s", "Transfer speed (gigabytes per second)") UTF8String],
    320                                 [NSLocalizedString(@"TB/s", "Transfer speed (terabytes per second)") UTF8String]); //why not?
    321        
     318                                        [NSLocalizedString(@"MB/s", "Transfer speed (megabytes per second)") UTF8String],
     319                                        [NSLocalizedString(@"GB/s", "Transfer speed (gigabytes per second)") UTF8String],
     320                                        [NSLocalizedString(@"TB/s", "Transfer speed (terabytes per second)") UTF8String]); //why not?
     321
    322322        tr_formatter_mem_init(1000, [NSLocalizedString(@"KB", "Memory size - kilobytes") UTF8String],
    323                               [NSLocalizedString(@"MB", "Memory size - megabytes") UTF8String],
    324                               [NSLocalizedString(@"GB", "Memory size - gigabytes") UTF8String],
    325                               [NSLocalizedString(@"TB", "Memory size - terabytes") UTF8String]);
     323                                    [NSLocalizedString(@"MB", "Memory size - megabytes") UTF8String],
     324                                    [NSLocalizedString(@"GB", "Memory size - gigabytes") UTF8String],
     325                                    [NSLocalizedString(@"TB", "Memory size - terabytes") UTF8String]);
    326326       
    327327        const char * configDir = tr_getDefaultConfigDir("Transmission");
     
    335335        //register for magnet URLs (has to be in init)
    336336        [[NSAppleEventManager sharedAppleEventManager] setEventHandler: self andSelector: @selector(handleOpenContentsEvent:replyEvent:)
    337                                                          forEventClass: kInternetEventClass andEventID: kAEGetURL];
     337            forEventClass: kInternetEventClass andEventID: kAEGetURL];
    338338       
    339339        fTorrents = [[NSMutableArray alloc] init];
     
    399399   
    400400    [fActionButton setToolTip: NSLocalizedString(@"Shortcuts for changing global settings.",
    401                                                  "Main window -> 1st bottom left button (action) tooltip")];
     401                                "Main window -> 1st bottom left button (action) tooltip")];
    402402    [fSpeedLimitButton setToolTip: NSLocalizedString(@"Speed Limit overrides the total bandwidth limits with its own limits.",
    403                                                      "Main window -> 2nd bottom left button (turtle) tooltip")];
     403                                "Main window -> 2nd bottom left button (turtle) tooltip")];
    404404    [fClearCompletedButton setToolTip: NSLocalizedString(@"Remove all transfers that have completed seeding.",
    405                                                          "Main window -> 3rd bottom left button (remove all) tooltip")];
     405                                "Main window -> 3rd bottom left button (remove all) tooltip")];
    406406   
    407407    [fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
     
    437437    //this must be called after showStatusBar:
    438438    [fStatusBar updateWithDownload: 0.0 upload: 0.0];
    439    
     439
    440440    //this should also be after the rest of the setup
    441441    [self updateForAutoSize];
     
    492492   
    493493    [nc addObserver: self selector: @selector(updateUI)
    494                name: @"UpdateUI" object: nil];
     494                    name: @"UpdateUI" object: nil];
    495495   
    496496    [nc addObserver: self selector: @selector(torrentFinishedDownloading:)
    497                name: @"TorrentFinishedDownloading" object: nil];
     497                    name: @"TorrentFinishedDownloading" object: nil];
    498498   
    499499    [nc addObserver: self selector: @selector(torrentRestartedDownloading:)
    500                name: @"TorrentRestartedDownloading" object: nil];
     500                    name: @"TorrentRestartedDownloading" object: nil];
    501501   
    502502    [nc addObserver: self selector: @selector(torrentFinishedSeeding:)
    503                name: @"TorrentFinishedSeeding" object: nil];
     503                    name: @"TorrentFinishedSeeding" object: nil];
    504504   
    505505    //avoids need of setting delegate
    506506    [nc addObserver: self selector: @selector(torrentTableViewSelectionDidChange:)
    507                name: NSOutlineViewSelectionDidChangeNotification object: fTableView];
     507                    name: NSOutlineViewSelectionDidChangeNotification object: fTableView];
    508508   
    509509    [nc addObserver: self selector: @selector(changeAutoImport)
    510                name: @"AutoImportSettingChange" object: nil];
     510                    name: @"AutoImportSettingChange" object: nil];
    511511   
    512512    [nc addObserver: self selector: @selector(updateForAutoSize)
    513                name: @"AutoSizeSettingChange" object: nil];
     513                    name: @"AutoSizeSettingChange" object: nil];
    514514   
    515515    [nc addObserver: self selector: @selector(updateForExpandCollape)
    516                name: @"OutlineExpandCollapse" object: nil];
     516                    name: @"OutlineExpandCollapse" object: nil];
    517517   
    518518    [nc addObserver: fWindow selector: @selector(makeKeyWindow)
    519                name: @"MakeWindowKey" object: nil];
     519                    name: @"MakeWindowKey" object: nil];
    520520   
    521521    [nc addObserver: self selector: @selector(fullUpdateUI)
    522                name: @"UpdateQueue" object: nil];
     522                    name: @"UpdateQueue" object: nil];
    523523   
    524524    [nc addObserver: self selector: @selector(applyFilter)
    525                name: @"ApplyFilter" object: nil];
     525                    name: @"ApplyFilter" object: nil];
    526526   
    527527    //open newly created torrent file
    528528    [nc addObserver: self selector: @selector(beginCreateFile:)
    529                name: @"BeginCreateTorrentFile" object: nil];
     529                    name: @"BeginCreateTorrentFile" object: nil];
    530530   
    531531    //open newly created torrent file
    532532    [nc addObserver: self selector: @selector(openCreatedFile:)
    533                name: @"OpenCreatedTorrentFile" object: nil];
     533                    name: @"OpenCreatedTorrentFile" object: nil];
    534534   
    535535    [nc addObserver: self selector: @selector(applyFilter)
    536                name: @"UpdateGroups" object: nil];
    537    
     536                    name: @"UpdateGroups" object: nil];
     537
    538538    //timer to update the interface every second
    539539    [self updateUI];
    540540    fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self
    541                                             selector: @selector(updateUI) userInfo: nil repeats: YES];
     541                selector: @selector(updateUI) userInfo: nil repeats: YES];
    542542    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSModalPanelRunLoopMode];
    543543    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode];
     
    557557    //register for dock icon drags (has to be in applicationDidFinishLaunching: to work)
    558558    [[NSAppleEventManager sharedAppleEventManager] setEventHandler: self andSelector: @selector(handleOpenContentsEvent:replyEvent:)
    559                                                      forEventClass: kCoreEventClass andEventID: kAEOpenContents];
     559        forEventClass: kCoreEventClass andEventID: kAEOpenContents];
    560560   
    561561    //if we were opened from a user notification, do the corresponding action
     
    592592           
    593593            NSString * donateMessage = [NSString stringWithFormat: @"%@\n\n%@",
    594                                         NSLocalizedString(@"Transmission is a full-featured torrent application."
    595                                                           " A lot of time and effort have gone into development, coding, and refinement."
    596                                                           " If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
    597                                         NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
     594                NSLocalizedString(@"Transmission is a full-featured torrent application."
     595                    " A lot of time and effort have gone into development, coding, and refinement."
     596                    " If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
     597                NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
    598598           
    599599            [alert setInformativeText: donateMessage];
     
    646646        {
    647647            NSString * message = active == 1
    648             ? NSLocalizedString(@"There is an active transfer that will be paused on quit."
    649                                 " The transfer will automatically resume on the next launch.", "Confirm Quit panel -> message")
    650             : [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers that will be paused on quit."
    651                                                             " The transfers will automatically resume on the next launch.", "Confirm Quit panel -> message"), active];
    652            
     648                ? NSLocalizedString(@"There is an active transfer that will be paused on quit."
     649                    " The transfer will automatically resume on the next launch.", "Confirm Quit panel -> message")
     650                : [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers that will be paused on quit."
     651                    " The transfers will automatically resume on the next launch.", "Confirm Quit panel -> message"), active];
     652
    653653            NSBeginAlertSheet(NSLocalizedString(@"Are you sure you want to quit?", "Confirm Quit panel -> title"),
    654                               NSLocalizedString(@"Quit", "Confirm Quit panel -> button"),
    655                               NSLocalizedString(@"Cancel", "Confirm Quit panel -> button"), nil, fWindow, self,
    656                               @selector(quitSheetDidEnd:returnCode:contextInfo:), nil, nil, @"%@", message);
     654                                NSLocalizedString(@"Quit", "Confirm Quit panel -> button"),
     655                                NSLocalizedString(@"Cancel", "Confirm Quit panel -> button"), nil, fWindow, self,
     656                                @selector(quitSheetDidEnd:returnCode:contextInfo:), nil, nil, @"%@", message);
    657657            return NSTerminateLater;
    658658        }
     
    673673    //stop the Bonjour service
    674674    [[BonjourController defaultController] stop];
    675    
     675
    676676    //stop blocklist download
    677677    if ([BlocklistDownloader isRunning])
     
    684684   
    685685    if (fAutoImportTimer)
    686     {
     686    {   
    687687        if ([fAutoImportTimer isValid])
    688688            [fAutoImportTimer invalidate];
     
    720720    [fTableView saveCollapsedGroups];
    721721   
    722     //remaining calls the same as dealloc
     722    //remaining calls the same as dealloc 
    723723    [fInfoController release];
    724724    [fMessageController release];
     
    755755{
    756756    NSString * urlString = nil;
    757    
     757
    758758    NSAppleEventDescriptor * directObject = [event paramDescriptorForKeyword: keyDirectObject];
    759759    if ([directObject descriptorType] == typeAEList)
     
    784784       
    785785        NSRunAlertPanel(NSLocalizedString(@"Torrent download failed", "Download not a torrent -> title"),
    786                         [NSString stringWithFormat: NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.",
    787                                                                       "Download not a torrent -> message"), suggestedName,
    788                          [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]],
    789                         NSLocalizedString(@"OK", "Download not a torrent -> button"), nil, nil);
     786            [NSString stringWithFormat: NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.",
     787            "Download not a torrent -> message"), suggestedName,
     788            [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]],
     789            NSLocalizedString(@"OK", "Download not a torrent -> button"), nil, nil);
    790790       
    791791        [download release];
     
    793793    else
    794794        [download setDestination: [NSTemporaryDirectory() stringByAppendingPathComponent: [suggestedName lastPathComponent]]
    795                   allowOverwrite: NO];
     795                    allowOverwrite: NO];
    796796}
    797797
     
    804804{
    805805    NSRunAlertPanel(NSLocalizedString(@"Torrent download failed", "Torrent download error -> title"),
    806                     [NSString stringWithFormat: NSLocalizedString(@"The torrent could not be downloaded from %@: %@.",
    807                                                                   "Torrent download failed -> message"),
    808                      [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding],
    809                      [error localizedDescription]], NSLocalizedString(@"OK", "Torrent download failed -> button"), nil, nil);
     806        [NSString stringWithFormat: NSLocalizedString(@"The torrent could not be downloaded from %@: %@.",
     807        "Torrent download failed -> message"),
     808        [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding],
     809        [error localizedDescription]], NSLocalizedString(@"OK", "Torrent download failed -> button"), nil, nil);
    810810   
    811811    [fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
     
    902902        //determine to show the options window
    903903        const BOOL showWindow = type == ADD_SHOW_OPTIONS || ([fDefaults boolForKey: @"DownloadAsk"]
    904                                                              && (info.isMultifile || ![fDefaults boolForKey: @"DownloadAskMulti"])
    905                                                              && (type != ADD_AUTO || ![fDefaults boolForKey: @"DownloadAskManual"]));
     904                                    && (info.isMultifile || ![fDefaults boolForKey: @"DownloadAskMulti"])
     905                                    && (type != ADD_AUTO || ![fDefaults boolForKey: @"DownloadAskManual"]));
    906906        tr_metainfoFree(&info);
    907907       
    908908        Torrent * torrent;
    909909        if (!(torrent = [[Torrent alloc] initWithPath: torrentPath location: location
    910                                     deleteTorrentFile: showWindow ? NO : deleteTorrentFile lib: fLib]))
     910                            deleteTorrentFile: showWindow ? NO : deleteTorrentFile lib: fLib]))
    911911            continue;
    912912       
     
    926926        {
    927927            AddWindowController * addController = [[AddWindowController alloc] initWithTorrent: torrent destination: location
    928                                                                                lockDestination: lockDestination controller: self torrentFile: torrentPath
    929                                                              deleteTorrentCheckEnableInitially: deleteTorrentFile canToggleDelete: canToggleDelete];
     928                                                    lockDestination: lockDestination controller: self torrentFile: torrentPath
     929                                                    deleteTorrentCheckEnableInitially: deleteTorrentFile canToggleDelete: canToggleDelete];
    930930            [addController showWindow: self];
    931931           
     
    949949        }
    950950    }
    951    
     951
    952952    [self fullUpdateUI];
    953953}
     
    10181018    {
    10191019        AddMagnetWindowController * addController = [[AddMagnetWindowController alloc] initWithTorrent: torrent destination: location
    1020                                                                                             controller: self];
     1020                                                        controller: self];
    10211021        [addController showWindow: self];
    10221022       
     
    10391039        [fAddingTransfers addObject: torrent];
    10401040    }
    1041    
     1041
    10421042    [self fullUpdateUI];
    10431043}
     
    10931093{
    10941094    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: files, @"Filenames",
    1095                            [NSNumber numberWithInt: ADD_MANUAL], @"AddType", nil];
     1095                                [NSNumber numberWithInt: ADD_MANUAL], @"AddType", nil];
    10961096    [self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dict waitUntilDone: NO];
    10971097}
     
    11281128    NSAlert * alert = [[NSAlert alloc] init];
    11291129    [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"\"%@\" is not a valid torrent file.",
    1130                                                                          "Open invalid alert -> title"), filename]];
     1130                            "Open invalid alert -> title"), filename]];
    11311131    [alert setInformativeText:
    1132      NSLocalizedString(@"The torrent file cannot be opened because it contains invalid data.",
    1133                        "Open invalid alert -> message")];
     1132            NSLocalizedString(@"The torrent file cannot be opened because it contains invalid data.",
     1133                            "Open invalid alert -> message")];
    11341134    [alert setAlertStyle: NSWarningAlertStyle];
    11351135    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open invalid alert -> button")];
     
    11491149    [alert setMessageText: NSLocalizedString(@"Adding magnetized transfer failed.", "Magnet link failed -> title")];
    11501150    [alert setInformativeText: [NSString stringWithFormat: NSLocalizedString(@"There was an error when adding the magnet link \"%@\"."
    1151                                                                              " The transfer will not occur.", "Magnet link failed -> message"), address]];
     1151                                " The transfer will not occur.", "Magnet link failed -> message"), address]];
    11521152    [alert setAlertStyle: NSWarningAlertStyle];
    11531153    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Magnet link failed -> button")];
     
    11661166    NSAlert * alert = [[NSAlert alloc] init];
    11671167    [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"A transfer of \"%@\" already exists.",
    1168                                                                          "Open duplicate alert -> title"), name]];
     1168                            "Open duplicate alert -> title"), name]];
    11691169    [alert setInformativeText:
    1170      NSLocalizedString(@"The transfer cannot be added because it is a duplicate of an already existing transfer.",
    1171                        "Open duplicate alert -> message")];
     1170            NSLocalizedString(@"The transfer cannot be added because it is a duplicate of an already existing transfer.",
     1171                            "Open duplicate alert -> message")];
    11721172    [alert setAlertStyle: NSWarningAlertStyle];
    11731173    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open duplicate alert -> button")];
     
    11881188    if (name)
    11891189        [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"A transfer of \"%@\" already exists.",
    1190                                                                              "Open duplicate magnet alert -> title"), name]];
     1190                                "Open duplicate magnet alert -> title"), name]];
    11911191    else
    11921192        [alert setMessageText: NSLocalizedString(@"Magnet link is a duplicate of an existing transfer.",
    1193                                                  "Open duplicate magnet alert -> title")];
     1193                                "Open duplicate magnet alert -> title")];
    11941194    [alert setInformativeText: [NSString stringWithFormat:
    1195                                 NSLocalizedString(@"The magnet link  \"%@\" cannot be added because it is a duplicate of an already existing transfer.",
    1196                                                   "Open duplicate magnet alert -> message"), address]];
     1195            NSLocalizedString(@"The magnet link  \"%@\" cannot be added because it is a duplicate of an already existing transfer.",
     1196                            "Open duplicate magnet alert -> message"), address]];
    11971197    [alert setAlertStyle: NSWarningAlertStyle];
    11981198    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open duplicate magnet alert -> button")];
     
    12181218                if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
    12191219                    urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
    1220                                  [urlString substringToIndex: beforeCom],
    1221                                  [urlString substringFromIndex: beforeCom + 1]];
     1220                                    [urlString substringToIndex: beforeCom],
     1221                                    [urlString substringFromIndex: beforeCom + 1]];
    12221222                else
    12231223                    urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString];
     
    12281228       
    12291229        NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: urlString]
    1230                                                   cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
     1230                                    cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
    12311231       
    12321232        if ([fPendingTorrentDownloads objectForKey: [request URL]])
     
    12491249    {
    12501250        fUrlSheetController = [[URLSheetWindowController alloc] initWithController: self];
    1251        
     1251   
    12521252        [NSApp beginSheet: [fUrlSheetController window] modalForWindow: fWindow modalDelegate: self didEndSelector: @selector(urlSheetDidEnd:returnCode:contextInfo:) contextInfo: nil];
    12531253    }
     
    13341334    //don't want any of these starting then stopping
    13351335    for (Torrent * torrent in torrents)
    1336         if ([torrent waitingToStart])
    1337             [torrent stopTransfer];
     1336         if ([torrent waitingToStart])
     1337             [torrent stopTransfer];
    13381338   
    13391339    for (Torrent * torrent in torrents)
     
    13461346{
    13471347    [torrents retain];
    1348    
     1348
    13491349    if ([fDefaults boolForKey: @"CheckRemove"])
    13501350    {
     
    13571357                    ++downloading;
    13581358            }
    1359        
     1359
    13601360        if ([fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0)
    13611361        {
    13621362            NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
    1363                                    torrents, @"Torrents",
    1364                                    [NSNumber numberWithBool: deleteData], @"DeleteData", nil];
     1363                                    torrents, @"Torrents",
     1364                                    [NSNumber numberWithBool: deleteData], @"DeleteData", nil];
    13651365           
    13661366            NSString * title, * message;
     
    13731373                if (deleteData)
    13741374                    title = [NSString stringWithFormat:
    1375                              NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list"
    1376                                                " and trash the data file?", "Removal confirm panel -> title"), torrentName];
     1375                                NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list"
     1376                                " and trash the data file?", "Removal confirm panel -> title"), torrentName];
    13771377                else
    13781378                    title = [NSString stringWithFormat:
    1379                              NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list?",
    1380                                                "Removal confirm panel -> title"), torrentName];
     1379                                NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list?",
     1380                                "Removal confirm panel -> title"), torrentName];
    13811381               
    13821382                message = NSLocalizedString(@"This transfer is active."
    1383                                             " Once removed, continuing the transfer will require the torrent file or magnet link.",
    1384                                             "Removal confirm panel -> message");
     1383                            " Once removed, continuing the transfer will require the torrent file or magnet link.",
     1384                            "Removal confirm panel -> message");
    13851385            }
    13861386            else
     
    13881388                if (deleteData)
    13891389                    title = [NSString stringWithFormat:
    1390                              NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list"
    1391                                                " and trash the data files?", "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
     1390                                NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list"
     1391                                " and trash the data files?", "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
    13921392                else
    13931393                    title = [NSString stringWithFormat:
    1394                              NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list?",
    1395                                                "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
     1394                                NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list?",
     1395                                "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
    13961396               
    13971397                if (selected == active)
    13981398                    message = [NSString stringWithFormat: NSLocalizedString(@"There are %@ active transfers.",
    1399                                                                             "Removal confirm panel -> message part 1"), [NSString formattedUInteger: active]];
     1399                                "Removal confirm panel -> message part 1"), [NSString formattedUInteger: active]];
    14001400                else
    14011401                    message = [NSString stringWithFormat: NSLocalizedString(@"There are %@ transfers (%@ active).",
    1402                                                                             "Removal confirm panel -> message part 1"), [NSString formattedUInteger: selected], [NSString formattedUInteger: active]];
     1402                                "Removal confirm panel -> message part 1"), [NSString formattedUInteger: selected], [NSString formattedUInteger: active]];
    14031403                message = [message stringByAppendingFormat: @" %@",
    1404                            NSLocalizedString(@"Once removed, continuing the transfers will require the torrent files or magnet links.",
    1405                                              "Removal confirm panel -> message part 2")];
     1404                            NSLocalizedString(@"Once removed, continuing the transfers will require the torrent files or magnet links.",
     1405                            "Removal confirm panel -> message part 2")];
    14061406            }
    14071407           
    14081408            NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"),
    1409                               NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
    1410                               nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, @"%@", message);
     1409                NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
     1410                nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, @"%@", message);
    14111411            return;
    14121412        }
     
    14651465                if (!beganUpdate)
    14661466                {
    1467                     [NSAnimationContext beginGrouping]; //this has to be before we set the completion handler (#4874)
    1468                    
    14691467                    //we can't closeRemoveTorrent: until it's no longer in the GUI at all
    14701468                    [[NSAnimationContext currentContext] setCompletionHandler: ^{
     
    14731471                    }];
    14741472                   
    1475                    
     1473                    [NSAnimationContext beginGrouping];
    14761474                    [fTableView beginUpdates];
    14771475                    beganUpdate = YES;
     
    15141512    [self fullUpdateUI];
    15151513   
    1516 #warning why do we need them retained?
     1514    #warning why do we need them retained?
    15171515    [torrents autorelease];
    15181516}
     
    15431541            NSString * torrentName = [(Torrent *)[torrents objectAtIndex: 0] name];
    15441542            message = [NSString stringWithFormat: NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list?",
    1545                                                                     "Remove completed confirm panel -> title"), torrentName];
     1543                                                                  "Remove completed confirm panel -> title"), torrentName];
    15461544           
    15471545            info = NSLocalizedString(@"Once removed, continuing the transfer will require the torrent file or magnet link.",
     
    15511549        {
    15521550            message = [NSString stringWithFormat: NSLocalizedString(@"Are you sure you want to remove %@ completed transfers from the transfer list?",
    1553                                                                     "Remove completed confirm panel -> title"), [NSString formattedUInteger: [torrents count]]];
     1551                                                                  "Remove completed confirm panel -> title"), [NSString formattedUInteger: [torrents count]]];
    15541552           
    15551553            info = NSLocalizedString(@"Once removed, continuing the transfers will require the torrent files or magnet links.",
     
    15961594    if (count == 1)
    15971595        [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\".",
    1598                                                                          "Move torrent -> select destination folder"), [(Torrent *)[torrents objectAtIndex: 0] name]]];
     1596                            "Move torrent -> select destination folder"), [(Torrent *)[torrents objectAtIndex: 0] name]]];
    15991597    else
    16001598        [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for %d data files.",
    1601                                                                          "Move torrent -> select destination folder"), count]];
     1599                            "Move torrent -> select destination folder"), count]];
    16021600   
    16031601    [panel beginSheetModalForWindow: fWindow completionHandler: ^(NSInteger result) {
     
    16491647            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file copy alert -> button")];
    16501648            [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Copy of \"%@\" Cannot Be Created",
    1651                                                                                  "Torrent file copy alert -> title"), [torrent name]]];
    1652             [alert setInformativeText: [NSString stringWithFormat:
    1653                                         NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"),
     1649                                    "Torrent file copy alert -> title"), [torrent name]]];
     1650            [alert setInformativeText: [NSString stringWithFormat: 
     1651                    NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"),
    16541652                                        [torrent torrentLocation]]];
    16551653            [alert setAlertStyle: NSWarningAlertStyle];
     
    17241722    if (![window isVisible])
    17251723        [window center];
    1726    
     1724
    17271725    [window makeKeyAndOrderFront: nil];
    17281726}
     
    18081806            [fClearCompletedButton setHidden: !anyCompleted];
    18091807        }
    1810        
     1808
    18111809        //update non-constant parts of info window
    18121810        if ([[fInfoController window] isVisible])
     
    18331831    if (totalCount != 1)
    18341832        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%@ transfers", "Status bar transfer count"),
    1835                                [NSString formattedUInteger: totalCount]];
     1833                                [NSString formattedUInteger: totalCount]];
    18361834    else
    18371835        totalTorrentsString = NSLocalizedString(@"1 transfer", "Status bar transfer count");
     
    18441842       
    18451843        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@", "Status bar transfer count"),
    1846                                [NSString formattedUInteger: count], totalTorrentsString];
     1844                                [NSString formattedUInteger: count], totalTorrentsString];
    18471845    }
    18481846   
     
    19261924            NSAssert1(row != -1, @"expected a row to be found for torrent %@", torrent);
    19271925            [fTableView selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection:NO];
    1928 #warning focus the window
     1926            #warning focus the window
    19291927        }
    19301928    }
     
    19941992        [GrowlApplicationBridge notifyWithTitle: notificationTitle
    19951993                                    description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
    1996                                        iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
     1994                                    iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
    19971995       
    19981996        NSLog(@"delegate: %@", [[NSUserNotificationCenterMtLion defaultUserNotificationCenter] delegate]);
     
    20032001        //bounce download stack
    20042002        [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"com.apple.DownloadFileFinished"
    2005                                                                        object: [torrent dataLocation]];
     2003            object: [torrent dataLocation]];
    20062004    }
    20072005   
     
    21732171    {
    21742172        NSSortDescriptor * stateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"stateSortKey" ascending: !asc],
    2175         * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc],
    2176         * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc];
     2173                        * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc],
     2174                        * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc];
    21772175       
    21782176        descriptors = [NSArray arrayWithObjects: stateDescriptor, progressDescriptor, ratioDescriptor, nameDescriptor, nil];
     
    21812179    {
    21822180        NSSortDescriptor * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: asc],
    2183         * ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc],
    2184         * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc];
     2181                        * ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc],
     2182                        * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc];
    21852183       
    21862184        descriptors = [NSArray arrayWithObjects: progressDescriptor, ratioProgressDescriptor, ratioDescriptor, nameDescriptor, nil];
     
    23992397    const BOOL wasGroupRows = [fDisplayedTorrents count] > 0 ? [[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [TorrentGroup class]] : groupRows;
    24002398   
    2401 #warning could probably be merged with later code somehow
     2399    #warning could probably be merged with later code somehow
    24022400    //clear display cache for not-shown torrents
    24032401    if ([fDisplayedTorrents count] > 0)
     
    24342432    {
    24352433        NSMutableIndexSet * addIndexes = [NSMutableIndexSet indexSet],
    2436         * removePreviousIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])];
     2434                        * removePreviousIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])];
    24372435       
    24382436        //for each of the torrents to add, find if it already exists (and keep track of those we've already added & those we need to remove)
     
    24882486        NSAssert(groupRows && wasGroupRows, @"Should have had group rows and should remain with group rows");
    24892487       
    2490 #warning don't always do?
     2488        #warning don't always do?
    24912489        beganUpdates = YES;
    24922490        if (onLion)
     
    26142612       
    26152613        //since we're not doing this the right way (boo buggy animation), we need to remember selected values
    2616 #warning when Lion-only and using views instead of cells, this likely won't be needed
     2614        #warning when Lion-only and using views instead of cells, this likely won't be needed
    26172615        NSArray * selectedValues = [fTableView selectedValues];
    26182616       
     
    26532651            [fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
    26542652       
    2655         if (groupRows)
    2656         {
    2657             //actually expand group rows
    2658             for (TorrentGroup * group in fDisplayedTorrents)
    2659                 [fTableView expandItem: group];
    2660         }
     2653        if (groupRows) 
     2654        { 
     2655            //actually expand group rows 
     2656            for (TorrentGroup * group in fDisplayedTorrents) 
     2657                [fTableView expandItem: group]; 
     2658        } 
    26612659       
    26622660        if (selectedValues)
     
    27812779        {
    27822780            item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
    2783                                                                                                     "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
    2784                                        keyEquivalent: @""];
     2781                    "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
     2782                    keyEquivalent: @""];
    27852783            [item setTarget: self];
    27862784            [item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
     
    28002798        {
    28012799            item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
    2802                                               action: @selector(setQuickRatioGlobal:) keyEquivalent: @""];
     2800                    action: @selector(setQuickRatioGlobal:) keyEquivalent: @""];
    28032801            [item setTarget: self];
    28042802            [item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
     
    28402838{
    28412839    const BOOL isLimited = [[dict objectForKey: @"Active"] boolValue];
    2842    
     2840
    28432841    [fDefaults setBool: isLimited forKey: @"SpeedLimit"];
    28442842    [fStatusBar updateSpeedFieldsToolTips];
     
    28462844    if (![[dict objectForKey: @"ByUser"] boolValue])
    28472845        [GrowlApplicationBridge notifyWithTitle: isLimited
    2848          ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
    2849                                                : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
    2850                                     description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
    2851                                notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
     2846                ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
     2847                : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
     2848            description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
     2849            notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
    28522850   
    28532851    [dict release];
     
    29082906       
    29092907        //check again in 10 seconds in case torrent file wasn't complete
    2910         fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
    2911                                                            selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
     2908        fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self 
     2909            selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
    29122910       
    29132911        [self checkAutoImportDirectory];
     
    29592957       
    29602958        if (!([[[NSWorkspace sharedWorkspace] typeOfFile: fullFile error: NULL] isEqualToString: @"org.bittorrent.torrent"]
    2961               || [[fullFile pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame))
     2959                || [[fullFile pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame))
    29622960            continue;
    29632961       
     
    29842982               
    29852983                [GrowlApplicationBridge notifyWithTitle: notificationTitle
    2986                                             description: file notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO
    2987                                            clickContext: nil];
     2984                    description: file notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO
     2985                    clickContext: nil];
    29882986                break;
    2989                
     2987           
    29902988            case TR_PARSE_ERR:
    29912989                [fAutoImportedNames removeObject: file];
    29922990                break;
    2993                
     2991           
    29942992            case TR_PARSE_DUPLICATE: //let's ignore this (but silence a warning)
    29952993                break;
     
    30083006   
    30093007    NSString * location = [(NSURL *)[notification object] path],
    3010     * path = [fDefaults stringForKey: @"AutoImportDirectory"];
     3008            * path = [fDefaults stringForKey: @"AutoImportDirectory"];
    30113009   
    30123010    if (location && path && [[[location stringByDeletingLastPathComponent] stringByExpandingTildeInPath]
    3013                              isEqualToString: [path stringByExpandingTildeInPath]])
     3011                                    isEqualToString: [path stringByExpandingTildeInPath]])
    30143012        [fAutoImportedNames addObject: [location lastPathComponent]];
    30153013}
     
    30503048            NSInteger group = [item groupIndex];
    30513049            return group != -1 ? [[GroupsController groups] nameForIndex: group]
    3052             : NSLocalizedString(@"No Group", "Group table row");
     3050                                : NSLocalizedString(@"No Group", "Group table row");
    30533051        }
    30543052        else if ([ident isEqualToString: @"Color"])
     
    30613059        else if ([ident isEqualToString: @"UL Image"])
    30623060            return [NSImage imageNamed: [fDefaults boolForKey: @"DisplayGroupRowRatio"]
    3063                     ? @"YingYangGroupTemplate" : @"UpArrowGroupTemplate"];
     3061                                        ? @"YingYangGroupTemplate" : @"UpArrowGroupTemplate"];
    30643062        else
    30653063        {
     
    30993097
    31003098- (NSDragOperation) outlineView: (NSOutlineView *) outlineView validateDrop: (id < NSDraggingInfo >) info proposedItem: (id) item
    3101              proposedChildIndex: (NSInteger) index
     3099    proposedChildIndex: (NSInteger) index
    31023100{
    31033101    NSPasteboard * pasteboard = [info draggingPasteboard];
     
    31533151        if (![NSApp isOnLionOrBetter])
    31543152            selectedValues = [fTableView selectedValues];
    3155        
     3153   
    31563154        NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
    31573155       
     
    32633261        {
    32643262            if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]
    3265                 || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     3263                    || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    32663264            {
    32673265                torrent = YES;
     
    33253323        {
    33263324            if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]
    3327                 || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     3325                    || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    33283326            {
    33293327                torrent = YES;
     
    34373435        //we can't call minSize, since it might be set to the current size (auto size)
    34383436        const CGFloat minHeight = [self minWindowContentSizeAllowed]
    3439         + (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
     3437                                    + (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
    34403438       
    34413439        if (windowSize.height <= minHeight)
     
    34563454        }
    34573455    }
    3458    
     3456
    34593457    //convert points to pixels
    34603458    windowSize = [scrollView convertSize: windowSize toView: nil];
    3461    
     3459
    34623460    windowFrame.origin.y -= (windowSize.height - windowFrame.size.height);
    34633461    windowFrame.size.height = windowSize.height;
     
    35343532   
    35353533    NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
    3536     [fWindow setFrame: frame display: YES animate: animate];
     3534    [fWindow setFrame: frame display: YES animate: animate]; 
    35373535   
    35383536    //re-enable autoresize
     
    36273625   
    36283626    NSScrollView * scrollView = [fTableView enclosingScrollView];
    3629    
     3627
    36303628    //set views to not autoresize
    36313629    const NSUInteger filterMask = [[fFilterBar view] autoresizingMask];
     
    37153713{
    37163714    /*if ([event type] == NSKeyDown)
    3717      {
    3718      [super keyDown: event];
    3719      return YES;
    3720      }*/
     3715    {
     3716        [super keyDown: event];
     3717        return YES;
     3718    }*/
    37213719   
    37223720    return NO;
     
    38643862        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseAllTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
    38653863        [segmentedCell setToolTip: NSLocalizedString(@"Pause all transfers",
    3866                                                      "All toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
     3864                                    "All toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    38673865       
    38683866        [segmentedCell setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    38693867        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarResumeAllTemplate"] forSegment: TOOLBAR_RESUME_TAG];
    38703868        [segmentedCell setToolTip: NSLocalizedString(@"Resume all transfers",
    3871                                                      "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     3869                                    "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
    38723870       
    38733871        [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"),
    3874                                 NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
     3872                                        NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
    38753873       
    38763874        [segmentedControl release];
     
    39063904        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseSelectedTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
    39073905        [segmentedCell setToolTip: NSLocalizedString(@"Pause selected transfers",
    3908                                                      "Selected toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
     3906                                    "Selected toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    39093907       
    39103908        [segmentedCell setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    39113909        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarResumeSelectedTemplate"] forSegment: TOOLBAR_RESUME_TAG];
    39123910        [segmentedCell setToolTip: NSLocalizedString(@"Resume selected transfers",
    3913                                                      "Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     3911                                    "Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
    39143912       
    39153913        [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"),
    3916                                 NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
     3914                                        NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
    39173915       
    39183916        [segmentedControl release];
     
    39583956{
    39593957    NSInteger tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
    3960     ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
     3958                    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
    39613959    switch (tagValue)
    39623960    {
     
    39733971{
    39743972    NSInteger tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
    3975     ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
     3973                    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
    39763974    switch (tagValue)
    39773975    {
     
    40124010    if ([ident isEqualToString: TOOLBAR_REMOVE])
    40134011        return [fTableView numberOfSelectedRows] > 0;
    4014    
     4012
    40154013    //enable pause all item
    40164014    if ([ident isEqualToString: TOOLBAR_PAUSE_ALL])
     
    40214019        return NO;
    40224020    }
    4023    
     4021
    40244022    //enable resume all item
    40254023    if ([ident isEqualToString: TOOLBAR_RESUME_ALL])
     
    40304028        return NO;
    40314029    }
    4032    
     4030
    40334031    //enable pause item
    40344032    if ([ident isEqualToString: TOOLBAR_PAUSE_SELECTED])
     
    40694067        return YES;
    40704068    }
    4071    
     4069
    40724070    return YES;
    40734071}
     
    40854083    //only enable some items if it is in a context menu or the window is useable
    40864084    BOOL canUseTable = [fWindow isKeyWindow] || [[menuItem menu] supermenu] != [NSApp mainMenu];
    4087    
     4085
    40884086    //enable open items
    40894087    if (action == @selector(openShowSheet:) || action == @selector(openURLShowSheet:))
     
    41564154    }
    41574155   
    4158 #warning remove when menu is removed (10.7-only)
     4156    #warning remove when menu is removed (10.7-only)
    41594157    if (action == @selector(toggleStatusString:))
    41604158    {
     
    41854183        if (limit)
    41864184            [menuItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)",
    4187                                                                               "Action menu -> upload/download limit"),
    4188                                  [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]]];
     4185                                    "Action menu -> upload/download limit"),
     4186                                    [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]]];
    41894187       
    41904188        [menuItem setState: [fDefaults boolForKey: upload ? @"CheckUpload" : @"CheckDownload"] ? limit : !limit];
     
    41974195        if (check)
    41984196            [menuItem setTitle: [NSString localizedStringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
    4199                                                                                        "Action menu -> ratio stop"), [fDefaults floatForKey: @"RatioLimit"]]];
     4197                                    "Action menu -> ratio stop"), [fDefaults floatForKey: @"RatioLimit"]]];
    42004198       
    42014199        [menuItem setState: [fDefaults boolForKey: @"RatioCheck"] ? check : !check];
    42024200        return YES;
    42034201    }
    4204    
     4202
    42054203    //enable show info
    42064204    if (action == @selector(showInfo:))
    42074205    {
    42084206        NSString * title = [[fInfoController window] isVisible] ? NSLocalizedString(@"Hide Inspector", "View menu -> Inspector")
    4209         : NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
     4207                            : NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
    42104208        [menuItem setTitle: title];
    4211        
     4209
    42124210        return YES;
    42134211    }
     
    42214219    {
    42224220        NSString * title = !fStatusBar ? NSLocalizedString(@"Show Status Bar", "View menu -> Status Bar")
    4223         : NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
     4221                            : NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
    42244222        [menuItem setTitle: title];
    4225        
     4223
    42264224        return [fWindow isVisible];
    42274225    }
     
    42314229    {
    42324230        NSString * title = !fFilterBar ? NSLocalizedString(@"Show Filter Bar", "View menu -> Filter Bar")
    4233         : NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
     4231                            : NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
    42344232        [menuItem setTitle: title];
    4235        
     4233
    42364234        return [fWindow isVisible];
    42374235    }
     
    42444242    if (action == @selector(revealFile:))
    42454243        return canUseTable && [fTableView numberOfSelectedRows] > 0;
    4246    
     4244
    42474245    //enable remove items
    42484246    if (action == @selector(removeNoDelete:) || action == @selector(removeDeleteData:))
     
    42614259            }
    42624260        }
    4263        
     4261   
    42644262        //append or remove ellipsis when needed
    42654263        NSString * title = [menuItem title], * ellipsis = [NSString ellipsis];
     
    42994297        return NO;
    43004298    }
    4301    
     4299
    43024300    //enable pause all item
    43034301    if (action == @selector(stopAllTorrents:))
     
    43234321        if (![fDefaults boolForKey: @"Queue"] && ![fDefaults boolForKey: @"QueueSeed"])
    43244322            return NO;
    4325        
     4323   
    43264324        for (Torrent * torrent in fTorrents)
    43274325            if ([torrent waitingToStart])
     
    43414339        return NO;
    43424340    }
    4343    
     4341
    43444342    //enable pause item
    43454343    if (action == @selector(stopSelectedTorrents:))
     
    43474345        if (!canUseTable)
    43484346            return NO;
    4349        
     4347   
    43504348        for (Torrent * torrent in [fTableView selectedTorrents])
    43514349            if ([torrent isActive] || [torrent waitingToStart])
     
    43594357        if (!canUseTable)
    43604358            return NO;
    4361        
     4359   
    43624360        for (Torrent * torrent in [fTableView selectedTorrents])
    43634361            if (![torrent isActive] && ![torrent waitingToStart])
     
    43834381        if (!canUseTable)
    43844382            return NO;
    4385        
     4383           
    43864384        for (Torrent * torrent in [fTableView selectedTorrents])
    43874385            if (![torrent isMagnet])
     
    44304428        //text consistent with Finder
    44314429        NSString * title = !visible ? NSLocalizedString(@"Quick Look", "View menu -> Quick Look")
    4432         : NSLocalizedString(@"Close Quick Look", "View menu -> Quick Look");
     4430                                    : NSLocalizedString(@"Close Quick Look", "View menu -> Quick Look");
    44334431        [menuItem setTitle: title];
    44344432       
     
    44544452                    break;
    44554453                }
    4456            
     4454
    44574455            IOAllowPowerChange(fRootPort, (long) messageArgument);
    44584456            break;
    4459            
     4457
    44604458        case kIOMessageCanSystemSleep:
    44614459            if ([fDefaults boolForKey: @"SleepPrevent"])
     
    44724470            IOAllowPowerChange(fRootPort, (long) messageArgument);
    44734471            break;
    4474            
     4472
    44754473        case kIOMessageSystemHasPoweredOn:
    44764474            //resume sleeping transfers after we wake up
     
    45474545{
    45484546    NSUInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
    4549     ? [fDisplayedTorrents count] : 0;
     4547                        ? [fDisplayedTorrents count] : 0;
    45504548   
    45514549    CGFloat heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
    4552     + ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
    4553     - NSHeight([[fTableView enclosingScrollView] frame]);
     4550                        + ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
     4551                        - NSHeight([[fTableView enclosingScrollView] frame]);
    45544552   
    45554553    return [self windowFrameByAddingHeight: heightChange checkLimits: YES];
     
    45784576   
    45794577    NSSize minSize = [fWindow contentMinSize],
    4580     maxSize = [fWindow contentMaxSize];
     4578            maxSize = [fWindow contentMaxSize];
    45814579    minSize.height = height;
    45824580    maxSize.height = height;
     
    45894587{
    45904588    CGFloat contentMinHeight = NSHeight([[fWindow contentView] frame]) - NSHeight([[fTableView enclosingScrollView] frame])
    4591     + [fTableView rowHeight] + [fTableView intercellSpacing].height;
     4589                                + [fTableView rowHeight] + [fTableView intercellSpacing].height;
    45924590    return contentMinHeight;
    45934591}
     
    46534651   
    46544652    return @{GROWL_NOTIFICATIONS_ALL : notifications,
    4655     GROWL_NOTIFICATIONS_DEFAULT : notifications };
     4653                GROWL_NOTIFICATIONS_DEFAULT : notifications };
    46564654}
    46574655
     
    46634661    NSString * type = [clickContext objectForKey: @"Type"], * location;
    46644662    if (([type isEqualToString: GROWL_DOWNLOAD_COMPLETE] || [type isEqualToString: GROWL_SEEDING_COMPLETE])
    4665         && (location = [clickContext objectForKey: @"Location"]))
     4663            && (location = [clickContext objectForKey: @"Location"]))
    46664664    {
    46674665        NSURL * file = [NSURL fileURLWithPath: location];
     
    46964694            case TR_RPC_TORRENT_ADDED:
    46974695                [self performSelectorOnMainThread: @selector(rpcAddTorrentStruct:) withObject:
    4698                  [[NSValue valueWithPointer: torrentStruct] retain] waitUntilDone: NO];
     4696                    [[NSValue valueWithPointer: torrentStruct] retain] waitUntilDone: NO];
    46994697                break;
    4700                
     4698           
    47014699            case TR_RPC_TORRENT_STARTED:
    47024700            case TR_RPC_TORRENT_STOPPED:
    47034701                [self performSelectorOnMainThread: @selector(rpcStartedStoppedTorrent:) withObject: torrent waitUntilDone: NO];
    47044702                break;
    4705                
     4703           
    47064704            case TR_RPC_TORRENT_REMOVING:
    47074705                [self performSelectorOnMainThread: @selector(rpcRemoveTorrent:) withObject: torrent waitUntilDone: NO];
    47084706                break;
    4709                
     4707           
    47104708            case TR_RPC_TORRENT_TRASHING:
    47114709                [self performSelectorOnMainThread: @selector(rpcRemoveTorrentDeleteData:) withObject: torrent waitUntilDone: NO];
    47124710                break;
    4713                
     4711           
    47144712            case TR_RPC_TORRENT_CHANGED:
    47154713                [self performSelectorOnMainThread: @selector(rpcChangedTorrent:) withObject: torrent waitUntilDone: NO];
    47164714                break;
    4717                
     4715           
    47184716            case TR_RPC_TORRENT_MOVED:
    47194717                [self performSelectorOnMainThread: @selector(rpcMovedTorrent:) withObject: torrent waitUntilDone: NO];
    47204718                break;
    4721                
     4719           
    47224720            case TR_RPC_SESSION_QUEUE_POSITIONS_CHANGED:
    47234721                [self performSelectorOnMainThread: @selector(rpcUpdateQueue) withObject: nil waitUntilDone: NO];
    47244722                break;
    4725                
     4723           
    47264724            case TR_RPC_SESSION_CHANGED:
    47274725                [fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
    47284726                break;
    4729                
     4727           
    47304728            case TR_RPC_SESSION_CLOSE:
    47314729                fQuitRequested = YES;
    47324730                [NSApp performSelectorOnMainThread: @selector(terminate:) withObject: self waitUntilDone: NO];
    47334731                break;
    4734                
     4732           
    47354733            default:
    47364734                NSAssert1(NO, @"Unknown RPC command received: %d", type);
Note: See TracChangeset for help on using the changeset viewer.