reverse r13248-r13250, since ARC doesn't support 32-bit.

This commit is contained in:
Mitchell Livingston 2012-03-13 02:52:11 +00:00
parent 21075ebd5d
commit 2406572104
71 changed files with 737 additions and 311 deletions

View File

@ -240,10 +240,10 @@
A29DF8BE0DB2545F00D04E5A /* verify.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D22A110D65EED100007D5F /* verify.h */; };
A29E653613F1603100048D71 /* evutil_rand.c in Sources */ = {isa = PBXBuildFile; fileRef = A29E653513F1603100048D71 /* evutil_rand.c */; };
A2A1CB7A0BF29D5500AE959F /* PeerProgressIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A1CB780BF29D5500AE959F /* PeerProgressIndicatorCell.m */; };
A2A3065C0AAD24A80049E2AC /* UKFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306540AAD24A80049E2AC /* UKFileWatcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
A2A3065E0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306560AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306580AAD24A80049E2AC /* UKKQueue.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
A2A3065C0AAD24A80049E2AC /* UKFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306540AAD24A80049E2AC /* UKFileWatcher.m */; };
A2A3065E0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306560AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m */; };
A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306580AAD24A80049E2AC /* UKKQueue.m */; };
A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */; };
A2A4E9210DE0F7E9000CE197 /* web.h in Headers */ = {isa = PBXBuildFile; fileRef = A29EBE530DC01FC9006CEE80 /* web.h */; };
A2A4E9220DE0F7EB000CE197 /* web.c in Sources */ = {isa = PBXBuildFile; fileRef = A29EBE520DC01FC9006CEE80 /* web.c */; };
A2A4E9870DE10399000CE197 /* json.h in Headers */ = {isa = PBXBuildFile; fileRef = A2A4E9840DE1038C000CE197 /* json.h */; };
@ -1163,8 +1163,8 @@
A2661D3B12D0E51B004F69D5 /* FilterBarView.m */,
A2ED7D8D0CEF431B00970975 /* FilterButton.h */,
A2ED7D8E0CEF431B00970975 /* FilterButton.m */,
A28E1DDF0CFFD8EC00E16385 /* ButtonToolbarItem.h */,
A2C89D5F0CFCBF57004CC2BC /* ButtonToolbarItem.m */,
A28E1DDF0CFFD8EC00E16385 /* ButtonToolbarItem.h */,
A21979890D07B78400438EA7 /* GroupToolbarItem.h */,
A219798A0D07B78400438EA7 /* GroupToolbarItem.m */,
A20BFFB50D091CC700CE5D2B /* ToolbarSegmentedCell.h */,
@ -2730,7 +2730,6 @@
0053D3D50C86774200545606 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = macosx;
GCC_PREFIX_HEADER = macosx/Transmission_Prefix.pch;
INFOPLIST_FILE = macosx/Info.plist;
@ -2889,7 +2888,6 @@
4DF0C599089918A300DD8943 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = macosx;
GCC_PREFIX_HEADER = macosx/Transmission_Prefix.pch;
INFOPLIST_FILE = macosx/Info.plist;
@ -2999,7 +2997,6 @@
A250CFEC0CDA19680068B4B6 /* Release - Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = macosx;
GCC_PREFIX_HEADER = macosx/Transmission_Prefix.pch;
INFOPLIST_FILE = macosx/Info.plist;

View File

@ -43,8 +43,8 @@ AboutWindowController * fAboutBoxInstance = nil;
[fCopyrightField setStringValue: [[NSBundle mainBundle] localizedStringForKey: @"NSHumanReadableCopyright"
value: nil table: @"InfoPlist"]];
[[fTextView textStorage] setAttributedString: [[NSAttributedString alloc] initWithPath:
[[NSBundle mainBundle] pathForResource: @"Credits" ofType: @"rtf"] documentAttributes: nil]];
[[fTextView textStorage] setAttributedString: [[[NSAttributedString alloc] initWithPath:
[[NSBundle mainBundle] pathForResource: @"Credits" ofType: @"rtf"] documentAttributes: nil] autorelease]];
//size license button
const CGFloat oldButtonWidth = NSWidth([fLicenseButton frame]);
@ -65,6 +65,7 @@ AboutWindowController * fAboutBoxInstance = nil;
- (void) windowWillClose: (id) sender
{
[fAboutBoxInstance autorelease];
fAboutBoxInstance = nil;
}

View File

@ -34,7 +34,7 @@
IBOutlet NSButton * fStartCheck;
IBOutlet NSPopUpButton * fGroupPopUp, * fPriorityPopUp;
__unsafe_unretained Controller * fController;
Controller * fController;
Torrent * fTorrent;
NSString * fDestination;

View File

@ -53,7 +53,7 @@
if ((self = [super initWithWindowNibName: @"AddMagnetWindow"]))
{
fTorrent = torrent;
fDestination = [path stringByExpandingTildeInPath];
fDestination = [[path stringByExpandingTildeInPath] retain];
fController = controller;
@ -106,6 +106,10 @@
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fDestination release];
[super dealloc];
}
- (Torrent *) torrent
@ -214,7 +218,8 @@
destination = [destination stringByExpandingTildeInPath];
if (!fDestination || ![fDestination isEqualToString: destination])
{
fDestination = destination;
[fDestination release];
fDestination = [destination retain];
[fTorrent changeDownloadFolderBeforeUsing: fDestination];
}
@ -224,6 +229,7 @@
ExpandedPathToIconTransformer * iconTransformer = [[ExpandedPathToIconTransformer alloc] init];
[fLocationImageView setImage: [iconTransformer transformedValue: fDestination]];
[iconTransformer release];
}
- (void) setGroupsMenu
@ -249,6 +255,7 @@
if ([[alert suppressionButton] state] == NSOnState)
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningFolderDataSameName"];
[alert release];
if (returnCode == NSAlertSecondButtonReturn)
[self performSelectorOnMainThread: @selector(confirmAdd) withObject: nil waitUntilDone: NO];

View File

@ -38,7 +38,7 @@
IBOutlet FileOutlineController * fFileController;
__unsafe_unretained Controller * fController;
Controller * fController;
Torrent * fTorrent;
NSString * fDestination, * fTorrentFile;

View File

@ -60,12 +60,12 @@
if ((self = [super initWithWindowNibName: @"AddWindow"]))
{
fTorrent = torrent;
fDestination = [path stringByExpandingTildeInPath];
fDestination = [[path stringByExpandingTildeInPath] retain];
fLockDestination = lockDestination;
fController = controller;
fTorrentFile = [torrentFile stringByExpandingTildeInPath];
fTorrentFile = [[torrentFile stringByExpandingTildeInPath] retain];
fDeleteTorrentInitial = deleteTorrent;
fDeleteEnableInitial = canToggleDelete;
@ -139,6 +139,11 @@
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fTimer invalidate];
[fDestination release];
[fTorrentFile release];
[super dealloc];
}
- (Torrent *) torrent
@ -311,7 +316,8 @@
destination = [destination stringByExpandingTildeInPath];
if (!fDestination || ![fDestination isEqualToString: destination])
{
fDestination = destination;
[fDestination release];
fDestination = [destination retain];
[fTorrent changeDownloadFolderBeforeUsing: fDestination];
}
@ -321,6 +327,7 @@
ExpandedPathToIconTransformer * iconTransformer = [[ExpandedPathToIconTransformer alloc] init];
[fLocationImageView setImage: [iconTransformer transformedValue: fDestination]];
[iconTransformer release];
}
- (void) setGroupsMenu
@ -349,6 +356,7 @@
if ([[alert suppressionButton] state] == NSOnState)
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningFolderDataSameName"];
[alert release];
if (returnCode == NSAlertSecondButtonReturn)
[self performSelectorOnMainThread: @selector(confirmAdd) withObject: nil waitUntilDone: NO];

View File

@ -48,6 +48,11 @@
return self;
}
- (void) dealloc
{
[fAttributes release];
[super dealloc];
}
- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate
{
@ -108,6 +113,7 @@
[fAttributes setObject: [NSColor whiteColor] forKey: NSForegroundColorAttributeName];
[fAttributes setObject: stringShadow forKey: NSShadowAttributeName];
[stringShadow release];
}
NSRect badgeRect;

View File

@ -37,6 +37,7 @@
BadgeView * view = [[BadgeView alloc] initWithLib: lib];
[[NSApp dockTile] setContentView: view];
[view release];
fHashes = [[NSMutableSet alloc] init];
}
@ -47,6 +48,10 @@
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fHashes release];
[super dealloc];
}
- (void) updateBadgeWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate

View File

@ -37,7 +37,7 @@ typedef enum
{
NSURLDownload * fDownload;
__unsafe_unretained BlocklistDownloaderViewController * fViewController;
BlocklistDownloaderViewController * fViewController;
NSString * fDestination;
NSUInteger fCurrentSize;

View File

@ -31,26 +31,27 @@
- (void) startDownload;
- (void) decompressBlocklist;
- (void) finishDownloadSuccess;
@end
@implementation BlocklistDownloader
BlocklistDownloader * fBLDownloader = nil;
BlocklistDownloader * fDownloader = nil;
+ (BlocklistDownloader *) downloader
{
if (!fBLDownloader)
if (!fDownloader)
{
fBLDownloader = [[BlocklistDownloader alloc] init];
[fBLDownloader startDownload];
fDownloader = [[BlocklistDownloader alloc] init];
[fDownloader startDownload];
}
return fBLDownloader;
return fDownloader;
}
+ (BOOL) isRunning
{
return fBLDownloader != nil;
return fDownloader != nil;
}
- (void) setViewController: (BlocklistDownloaderViewController *) viewController
@ -73,6 +74,12 @@ BlocklistDownloader * fBLDownloader = nil;
}
}
- (void) dealloc
{
[fDownload release];
[fDestination release];
[super dealloc];
}
- (void) cancelDownload
{
@ -82,7 +89,8 @@ BlocklistDownloader * fBLDownloader = nil;
[[BlocklistScheduler scheduler] updateSchedule];
fBLDownloader = nil;
fDownloader = nil;
[self release];
}
//using the actual filename is the best bet
@ -93,7 +101,8 @@ BlocklistDownloader * fBLDownloader = nil;
- (void) download: (NSURLDownload *) download didCreateDestination: (NSString *) path
{
fDestination = path;
[fDestination release];
fDestination = [path retain];
}
- (void) download: (NSURLDownload *) download didReceiveResponse: (NSURLResponse *) response
@ -119,44 +128,14 @@ BlocklistDownloader * fBLDownloader = nil;
[[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: @"BlocklistNewLastUpdate"];
[[BlocklistScheduler scheduler] updateSchedule];
fBLDownloader = nil;
fDownloader = nil;
[self release];
}
- (void) downloadDidFinish: (NSURLDownload *) download
{
fState = BLOCKLIST_DL_PROCESSING;
[fViewController setStatusProcessing];
//process data
NSAssert(fDestination != nil, @"the blocklist file destination has not been specified");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self decompressBlocklist];
dispatch_async(dispatch_get_main_queue(), ^{
const int count = tr_blocklistSetContent([PrefsController handle], [fDestination UTF8String]);
//delete downloaded file
[[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
if (count > 0)
[fViewController setFinished];
else
[fViewController setFailed: NSLocalizedString(@"The specified blocklist file did not contain any valid rules.",
"blocklist fail message")];
//update last updated date for schedule
NSDate * date = [NSDate date];
[[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdate"];
[[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdateSuccess"];
[[BlocklistScheduler scheduler] updateSchedule];
[[NSNotificationCenter defaultCenter] postNotificationName: @"BlocklistUpdated" object: nil];
fBLDownloader = nil;
});
});
[self performSelectorInBackground: @selector(finishDownloadSuccess) withObject: nil];
}
- (BOOL) download: (NSURLDownload *) download shouldDecodeSourceDataOfMIMEType: (NSString *) encodingType
@ -216,6 +195,7 @@ BlocklistDownloader * fBLDownloader = nil;
{
success = NO;
}
[unzip release];
if (success) {
//Now find out what file we actually extracted; don't just assume it matches the zipfile's name
@ -236,19 +216,57 @@ BlocklistDownloader * fBLDownloader = nil;
[zipinfo launch];
[zipinfo waitUntilExit];
NSString * actualFilename = [[NSString alloc] initWithData: [zipinfoOutput readDataToEndOfFile]
encoding: NSUTF8StringEncoding];
NSString * actualFilename = [[[NSString alloc] initWithData: [zipinfoOutput readDataToEndOfFile]
encoding: NSUTF8StringEncoding] autorelease];
actualFilename = [actualFilename stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString * newBlocklistPath = [workingDirectory stringByAppendingPathComponent: actualFilename];
//Finally, delete the ZIP file; we're done with it, and we'll return the unzipped blocklist
[[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
fDestination = newBlocklistPath;
[fDestination release];
fDestination = [newBlocklistPath retain];
}
@catch(id exc) {}
[zipinfo release];
}
}
}
- (void) finishDownloadSuccess
{
@autoreleasepool
{
[fViewController setStatusProcessing];
//process data
NSAssert(fDestination != nil, @"the blocklist file destination has not been specified");
[self decompressBlocklist];
const int count = tr_blocklistSetContent([PrefsController handle], [fDestination UTF8String]);
//delete downloaded file
[[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
if (count > 0)
[fViewController setFinished];
else
[fViewController setFailed: NSLocalizedString(@"The specified blocklist file did not contain any valid rules.",
"blocklist fail message")];
//update last updated date for schedule
NSDate * date = [NSDate date];
[[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdate"];
[[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdateSuccess"];
[[BlocklistScheduler scheduler] updateSchedule];
[[NSNotificationCenter defaultCenter] postNotificationName: @"BlocklistUpdated" object: nil];
}
fDownloader = nil;
[self release];
}
@end

View File

@ -29,7 +29,7 @@
@interface BlocklistDownloaderViewController : NSObject
{
__unsafe_unretained PrefsController * fPrefsController;
PrefsController * fPrefsController;
IBOutlet NSWindow * fStatusWindow;
IBOutlet NSProgressIndicator * fProgressBar;

View File

@ -37,14 +37,10 @@
@implementation BlocklistDownloaderViewController
BlocklistDownloaderViewController * fBLViewController = nil;
+ (void) downloadWithPrefsController: (PrefsController *) prefsController
{
if (!fBLViewController)
{
fBLViewController = [[BlocklistDownloaderViewController alloc] initWithPrefsController: prefsController];
[fBLViewController startDownload];
}
BlocklistDownloaderViewController * downloader = [[BlocklistDownloaderViewController alloc] initWithPrefsController: prefsController];
[downloader startDownload];
}
- (void) awakeFromNib
@ -105,7 +101,7 @@ BlocklistDownloaderViewController * fBLViewController = nil;
[NSApp endSheet: fStatusWindow];
[fStatusWindow orderOut: self];
fBLViewController = nil;
[self release];
}
- (void) setFailed: (NSString *) error
@ -113,7 +109,7 @@ BlocklistDownloaderViewController * fBLViewController = nil;
[NSApp endSheet: fStatusWindow];
[fStatusWindow orderOut: self];
NSAlert * alert = [[NSAlert alloc] init];
NSAlert * alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Blocklist -> button")];
[alert setMessageText: NSLocalizedString(@"Download of the blocklist failed.", "Blocklist -> message")];
[alert setAlertStyle: NSWarningAlertStyle];
@ -152,8 +148,7 @@ BlocklistDownloaderViewController * fBLViewController = nil;
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (NSInteger) code contextInfo: (void *) info
{
[[alert window] orderOut: self];
fBLViewController = nil;
[self release];
}
@end

View File

@ -29,14 +29,16 @@
BonjourController * fDefaultController = nil;
+ (BonjourController *) defaultController
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if (!fDefaultController)
fDefaultController = [[BonjourController alloc] init];
});
return fDefaultController;
}
- (void) dealloc
{
[fService release];
[super dealloc];
}
- (void) startWithPort: (NSInteger) port
{
@ -53,6 +55,7 @@ BonjourController * fDefaultController = nil;
- (void) stop
{
[fService stop];
[fService release];
fService = nil;
}

View File

@ -25,5 +25,7 @@
#import <Cocoa/Cocoa.h>
@interface ButtonToolbarItem : NSToolbarItem
{
}
@end

View File

@ -37,7 +37,7 @@
[menuItem setTarget: [self target]];
[menuItem setEnabled: [[self target] validateToolbarItem: self]];
return menuItem;
return [menuItem autorelease];
}
@end

View File

@ -106,9 +106,6 @@ typedef enum
NSMutableSet * fAddingTransfers;
NSMutableSet * fAddWindows;
URLSheetWindowController * fUrlSheetController;
BOOL fGlobalPopoverShown;
BOOL fSoundPlaying;
}
@ -130,6 +127,7 @@ typedef enum
- (void) openURL: (NSString *) urlString;
- (void) openURLShowSheet: (id) sender;
- (void) urlSheetDidEnd: (URLSheetWindowController *) controller url: (NSString *) urlString returnCode: (NSInteger) returnCode;
- (void) quitSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo;

View File

@ -139,20 +139,20 @@ static void altSpeedToggledCallback(tr_session * handle UNUSED, bool active, boo
{
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [[NSNumber alloc] initWithBool: active], @"Active",
[[NSNumber alloc] initWithBool: byUser], @"ByUser", nil];
[(__bridge Controller *)controller performSelectorOnMainThread: @selector(altSpeedToggledCallbackIsLimited:)
[(Controller *)controller performSelectorOnMainThread: @selector(altSpeedToggledCallbackIsLimited:)
withObject: dict waitUntilDone: NO];
}
static tr_rpc_callback_status rpcCallback(tr_session * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct,
void * controller)
{
[(__bridge Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
[(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
return TR_RPC_NOREMOVE; //we'll do the remove manually
}
static void sleepCallback(void * controller, io_service_t y, natural_t messageType, void * messageArgument)
{
[(__bridge Controller *)controller sleepCallback: messageType argument: messageArgument];
[(Controller *)controller sleepCallback: messageType argument: messageArgument];
}
@implementation Controller
@ -172,6 +172,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[alert setAlertStyle: NSCriticalAlertStyle];
[alert runModal];
[alert release];
//kill ourselves right away
exit(0);
@ -181,10 +182,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]];
//set custom value transformers
ExpandedPathToPathTransformer * pathTransformer = [[ExpandedPathToPathTransformer alloc] init];
ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
[NSValueTransformer setValueTransformer: pathTransformer forName: @"ExpandedPathToPathTransformer"];
ExpandedPathToIconTransformer * iconTransformer = [[ExpandedPathToIconTransformer alloc] init];
ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
[NSValueTransformer setValueTransformer: iconTransformer forName: @"ExpandedPathToIconTransformer"];
//cover our asses
@ -202,6 +203,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if ([alert runModal] == NSAlertSecondButtonReturn)
exit(0);
[alert release];
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningLegal"];
}
@ -340,11 +342,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
fGlobalPopoverShown = NO;
fSoundPlaying = NO;
tr_sessionSetAltSpeedFunc(fLib, altSpeedToggledCallback, (__bridge void *)(self));
tr_sessionSetAltSpeedFunc(fLib, altSpeedToggledCallback, self);
if (usesSpeedLimitSched)
[fDefaults setBool: tr_sessionUsesAltSpeed(fLib) forKey: @"SpeedLimit"];
tr_sessionSetRPCCallback(fLib, rpcCallback, (__bridge void *)(self));
tr_sessionSetRPCCallback(fLib, rpcCallback, self);
[GrowlApplicationBridge setGrowlDelegate: self];
@ -366,6 +368,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[toolbar setAutosavesConfiguration: YES];
[toolbar setDisplayMode: NSToolbarDisplayModeIconOnly];
[fWindow setToolbar: toolbar];
[toolbar release];
[fWindow setDelegate: self]; //do manually to avoid placement issue
@ -435,7 +438,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
//register for sleep notifications
IONotificationPortRef notify;
io_object_t iterator;
if ((fRootPort = IORegisterForSystemPower((__bridge void *)(self), & notify, sleepCallback, &iterator)))
if ((fRootPort = IORegisterForSystemPower(self, & notify, sleepCallback, &iterator)))
CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notify), kCFRunLoopCommonModes);
else
NSLog(@"Could not IORegisterForSystemPower");
@ -465,6 +468,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if (!fPauseOnLaunch && (waitToStart = [historyItem objectForKey: @"WaitToStart"]) && [waitToStart boolValue])
[waitToStartTorrents addObject: torrent];
[torrent release];
}
}
@ -595,6 +599,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if (allowNeverAgain)
[fDefaults setBool: ([[alert suppressionButton] state] != NSOnState) forKey: @"WarningDonate"];
[alert release];
}
}
}
@ -665,6 +670,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
if ([fAutoImportTimer isValid])
[fAutoImportTimer invalidate];
[fAutoImportTimer release];
}
[fBadger setQuitting];
@ -676,7 +682,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
NSURLDownload * download = [downloadDict objectForKey: @"Download"];
[download cancel];
[download release];
}
[fPendingTorrentDownloads release];
}
//remember window states and close all windows
@ -695,6 +703,26 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[self updateTorrentHistory];
[fTableView saveCollapsedGroups];
//remaining calls the same as dealloc
[fInfoController release];
[fMessageController release];
[fPrefsController release];
[fStatusBar release];
[fFilterBar release];
[fTorrents release];
[fDisplayedTorrents release];
[fAddingTransfers release];
[fOverlayWindow release];
[fBadger release];
[fAutoImportedNames release];
[fPreviewPanel release];
//complete cleanup
tr_sessionClose(fLib);
}
@ -723,15 +751,13 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
[download cancel];
[fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
if ([fPendingTorrentDownloads count] == 0)
fPendingTorrentDownloads = nil;
NSRunAlertPanel(NSLocalizedString(@"Torrent download failed", "Download not a torrent -> title"),
[NSString stringWithFormat: NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.",
"Download not a torrent -> message"), suggestedName,
[[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]],
NSLocalizedString(@"OK", "Download not a torrent -> button"), nil, nil);
[download release];
}
else
[download setDestination: [NSTemporaryDirectory() stringByAppendingPathComponent: [suggestedName lastPathComponent]]
@ -740,7 +766,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
-(void) download: (NSURLDownload *) download didCreateDestination: (NSString *) path
{
[(NSMutableDictionary *)[fPendingTorrentDownloads objectForKey: [[download request] URL]] setObject: path forKey: @"Path"];
if (!fPendingTorrentDownloads)
fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
[fPendingTorrentDownloads setObject: [NSDictionary dictionaryWithObjectsAndKeys:
path, @"Path", download, @"Download", nil] forKey: [[download request] URL]];
}
- (void) download: (NSURLDownload *) download didFailWithError: (NSError *) error
@ -753,7 +783,12 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
if ([fPendingTorrentDownloads count] == 0)
{
[fPendingTorrentDownloads release];
fPendingTorrentDownloads = nil;
}
[download release];
}
- (void) downloadDidFinish: (NSURLDownload *) download
@ -767,7 +802,12 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
if ([fPendingTorrentDownloads count] == 0)
{
[fPendingTorrentDownloads release];
fPendingTorrentDownloads = nil;
}
[download release];
}
- (void) application: (NSApplication *) app openFiles: (NSArray *) filenames
@ -861,10 +901,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
lockDestination: lockDestination controller: self torrentFile: torrentPath
deleteTorrent: deleteTorrentFile canToggleDelete: canToggleDelete];
[addController showWindow: self];
if (!fAddWindows)
fAddWindows = [NSMutableSet set];
[fAddWindows addObject: addController];
}
else
{
@ -873,6 +909,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[torrent update];
[fTorrents addObject: torrent];
[torrent release];
if (!fAddingTransfers)
fAddingTransfers = [[NSMutableSet alloc] init];
@ -886,6 +923,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) askOpenConfirmed: (AddWindowController *) addController add: (BOOL) add
{
Torrent * torrent = [addController torrent];
[addController autorelease];
if (add)
{
@ -893,6 +931,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[torrent update];
[fTorrents addObject: torrent];
[torrent release];
if (!fAddingTransfers)
fAddingTransfers = [[NSMutableSet alloc] init];
@ -903,11 +942,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
else
{
[torrent closeRemoveTorrent: NO];
[torrent release];
}
[fAddWindows removeObject: addController];
if ([fAddWindows count] == 0)
fAddWindows = nil;
}
- (void) openMagnet: (NSString *) address
@ -945,10 +981,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
AddMagnetWindowController * addController = [[AddMagnetWindowController alloc] initWithTorrent: torrent destination: location
controller: self];
[addController showWindow: self];
if (!fAddWindows)
fAddWindows = [NSMutableSet set];
[fAddWindows addObject: addController];
}
else
{
@ -957,6 +989,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[torrent update];
[fTorrents addObject: torrent];
[torrent release];
if (!fAddingTransfers)
fAddingTransfers = [[NSMutableSet alloc] init];
@ -969,6 +1002,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) askOpenMagnetConfirmed: (AddMagnetWindowController *) addController add: (BOOL) add
{
Torrent * torrent = [addController torrent];
[addController autorelease];
if (add)
{
@ -976,6 +1010,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[torrent update];
[fTorrents addObject: torrent];
[torrent release];
if (!fAddingTransfers)
fAddingTransfers = [[NSMutableSet alloc] init];
@ -986,22 +1021,23 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
else
{
[torrent closeRemoveTorrent: NO];
[torrent release];
}
[fAddWindows removeObject: addController];
if ([fAddWindows count] == 0)
fAddWindows = nil;
}
- (void) openCreatedFile: (NSNotification *) notification
{
NSDictionary * dict = [notification userInfo];
[self openFiles: [NSArray arrayWithObject: [dict objectForKey: @"File"]] addType: ADD_CREATED forcePath: [dict objectForKey: @"Path"]];
[self openFiles: [NSArray arrayWithObject: [dict objectForKey: @"File"]] addType: ADD_CREATED
forcePath: [dict objectForKey: @"Path"]];
[dict release];
}
- (void) openFilesWithDict: (NSDictionary *) dictionary
{
[self openFiles: [dictionary objectForKey: @"Filenames"] addType: [[dictionary objectForKey: @"AddType"] intValue] forcePath: nil];
[dictionary release];
}
//called on by applescript
@ -1053,6 +1089,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[alert runModal];
if ([[alert suppressionButton] state] == NSOnState)
[fDefaults setBool: NO forKey: @"WarningInvalidOpen"];
[alert release];
}
- (void) invalidOpenMagnetAlert: (NSString *) address
@ -1070,6 +1107,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[alert runModal];
if ([[alert suppressionButton] state] == NSOnState)
[fDefaults setBool: NO forKey: @"WarningInvalidOpen"];
[alert release];
}
- (void) duplicateOpenAlert: (NSString *) name
@ -1090,6 +1128,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[alert runModal];
if ([[alert suppressionButton] state])
[fDefaults setBool: NO forKey: @"WarningDuplicate"];
[alert release];
}
- (void) duplicateOpenMagnetAlert: (NSString *) address transferName: (NSString *) name
@ -1114,6 +1153,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[alert runModal];
if ([[alert suppressionButton] state])
[fDefaults setBool: NO forKey: @"WarningDuplicate"];
[alert release];
}
- (void) openURL: (NSString *) urlString
@ -1140,41 +1180,21 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: urlString]
cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
if ([fPendingTorrentDownloads objectForKey: [request URL]])
{
NSLog(@"Already downloading %@", [request URL]);
return;
}
NSURLDownload * download = [[NSURLDownload alloc] initWithRequest: request delegate: self];
if (!fPendingTorrentDownloads)
fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
[fPendingTorrentDownloads setObject: [NSMutableDictionary dictionaryWithObject: download forKey: @"Download"] forKey: [request URL]];
[[NSURLDownload alloc] initWithRequest: request delegate: self];
}
}
- (void) openURLShowSheet: (id) sender
{
if (!fUrlSheetController)
{
fUrlSheetController = [[URLSheetWindowController alloc] initWithController: self];
[NSApp beginSheet: [fUrlSheetController window] modalForWindow: fWindow modalDelegate: self didEndSelector: @selector(urlSheetDidEnd:returnCode:contextInfo:) contextInfo: nil];
}
[[[URLSheetWindowController alloc] initWithController: self] beginSheetForWindow: fWindow];
}
- (void) urlSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
- (void) urlSheetDidEnd: (URLSheetWindowController *) controller url: (NSString *) urlString returnCode: (NSInteger) returnCode
{
if (returnCode == 1)
{
NSString * urlString = [fUrlSheetController urlString];
[self performSelectorOnMainThread: @selector(openURL:) withObject: urlString waitUntilDone: NO];
}
fUrlSheetController = nil;
[controller release];
}
- (void) createFile: (id) sender
@ -1256,6 +1276,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) removeTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData
{
[torrents retain];
if ([fDefaults boolForKey: @"CheckRemove"])
{
@ -1318,7 +1339,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"),
NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), (__bridge void *)dict, message);
nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, message);
return;
}
}
@ -1331,6 +1352,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
NSArray * torrents = [dict objectForKey: @"Torrents"];
if (returnCode == NSAlertDefaultReturn)
[self confirmRemoveTorrents: torrents deleteData: [[dict objectForKey: @"DeleteData"] boolValue]];
else
[torrents release];
[dict release];
}
- (void) confirmRemoveTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData
@ -1418,6 +1443,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[fTableView selectValues: selectedValues];
[self fullUpdateUI];
#warning why do we need them retained?
[torrents autorelease];
}
- (void) removeNoDelete: (id) sender
@ -1459,7 +1487,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
"Remove completed confirm panel -> message");
}
NSAlert * alert = [[NSAlert alloc] init];
NSAlert * alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText: message];
[alert setInformativeText: info];
[alert setAlertStyle: NSWarningAlertStyle];
@ -1473,6 +1501,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if (returnCode != NSAlertFirstButtonReturn)
{
[torrents release];
return;
}
}
@ -1520,6 +1549,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
if ([torrents count] == 0)
{
[torrents release];
return;
}
@ -1556,6 +1586,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];
[alert release];
}
[torrents removeObjectAtIndex: 0];
@ -2269,7 +2300,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
TorrentGroup * newGroup = [groupsByIndex objectForKey: [NSNumber numberWithInteger: groupValue]];
if (!newGroup)
{
newGroup = [[TorrentGroup alloc] initWithGroup: groupValue];
newGroup = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
[groupsByIndex setObject: newGroup forKey: [NSNumber numberWithInteger: groupValue]];
[fDisplayedTorrents addObject: newGroup];
@ -2315,7 +2346,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
TorrentGroup * group = [groupsByIndex objectForKey: [NSNumber numberWithInteger: groupValue]];
if (!group)
{
group = [[TorrentGroup alloc] initWithGroup: groupValue];
group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
[groupsByIndex setObject: group forKey: [NSNumber numberWithInteger: groupValue]];
[fDisplayedTorrents addObject: group];
@ -2378,7 +2409,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
TorrentGroup * group = [groupsByIndex objectForKey: [NSNumber numberWithInteger: groupValue]];
if (!group)
{
group = [[TorrentGroup alloc] initWithGroup: groupValue];
group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
[groupsByIndex setObject: group forKey: [NSNumber numberWithInteger: groupValue]];
}
@ -2446,6 +2477,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if (fAddingTransfers)
{
[fAddingTransfers release];
fAddingTransfers = nil;
}
}
@ -2470,6 +2502,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[popover showRelativeToRect: [sender frame] ofView: sender preferredEdge: NSMaxYEdge];
[viewController release];
[popover release];
}
else
{
@ -2505,9 +2539,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
const NSInteger groupMenuCount = [groupMenu numberOfItems];
for (NSInteger i = 0; i < groupMenuCount; i++)
{
NSMenuItem * item = [groupMenu itemAtIndex: 0];
NSMenuItem * item = [[groupMenu itemAtIndex: 0] retain];
[groupMenu removeItemAtIndex: 0];
[menu addItem: item];
[item release];
}
}
else if (menu == fUploadMenu || menu == fDownloadMenu)
@ -2526,6 +2561,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
[menu addItem: item];
[item release];
}
}
else if (menu == fRatioStopMenu)
@ -2543,6 +2579,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
[menu addItem: item];
[item release];
}
}
else;
@ -2589,6 +2626,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
[dict release];
}
- (void) setLimitGlobalEnabled: (id) sender
@ -2640,12 +2678,13 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
if ([fAutoImportTimer isValid])
[fAutoImportTimer invalidate];
[fAutoImportTimer release];
fAutoImportTimer = nil;
}
//check again in 10 seconds in case torrent file wasn't complete
fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO];
fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
[self checkAutoImportDirectory];
}
@ -2657,10 +2696,15 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
if ([fAutoImportTimer isValid])
[fAutoImportTimer invalidate];
[fAutoImportTimer release];
fAutoImportTimer = nil;
}
fAutoImportedNames = nil;
if (fAutoImportedNames)
{
[fAutoImportedNames release];
fAutoImportedNames = nil;
}
[self checkAutoImportDirectory];
}
@ -2721,6 +2765,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
tr_ctorFree(ctor);
}
[newNames release];
}
- (void) beginCreateFile: (NSNotification *) notification
@ -3258,6 +3303,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if (!show)
{
[[fStatusBar view] removeFromSuperviewWithoutNeedingDisplay];
[fStatusBar release];
fStatusBar = nil;
}
@ -3355,6 +3401,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if (!show)
{
[[fFilterBar view] removeFromSuperviewWithoutNeedingDisplay];
[fFilterBar release];
fFilterBar = nil;
}
@ -3383,13 +3430,14 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) beginPreviewPanelControl: (QLPreviewPanel *) panel
{
fPreviewPanel = panel;
fPreviewPanel = [panel retain];
[fPreviewPanel setDelegate: self];
[fPreviewPanel setDataSource: self];
}
- (void) endPreviewPanelControl: (QLPreviewPanel *) panel
{
[fPreviewPanel release];
fPreviewPanel = nil;
}
@ -3466,12 +3514,13 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[button setStringValue: @""];
[item setView: button];
[button release];
const NSSize buttonSize = NSMakeSize(36.0, 25.0);
[item setMinSize: buttonSize];
[item setMaxSize: buttonSize];
return item;
return [item autorelease];
}
- (NSToolbarItem *) toolbar: (NSToolbar *) toolbar itemForItemIdentifier: (NSString *) ident willBeInsertedIntoToolbar: (BOOL) flag
@ -3551,7 +3600,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
GroupToolbarItem * groupItem = [[GroupToolbarItem alloc] initWithItemIdentifier: ident];
NSSegmentedControl * segmentedControl = [[NSSegmentedControl alloc] initWithFrame: NSZeroRect];
[segmentedControl setCell: [[ToolbarSegmentedCell alloc] init]];
[segmentedControl setCell: [[[ToolbarSegmentedCell alloc] init] autorelease]];
[groupItem setView: segmentedControl];
NSSegmentedCell * segmentedCell = (NSSegmentedCell *)[segmentedControl cell];
@ -3582,17 +3631,18 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"),
NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
[segmentedControl release];
[groupItem setVisibilityPriority: NSToolbarItemVisibilityPriorityHigh];
return groupItem;
return [groupItem autorelease];
}
else if ([ident isEqualToString: TOOLBAR_PAUSE_RESUME_SELECTED])
{
GroupToolbarItem * groupItem = [[GroupToolbarItem alloc] initWithItemIdentifier: ident];
NSSegmentedControl * segmentedControl = [[NSSegmentedControl alloc] initWithFrame: NSZeroRect];
[segmentedControl setCell: [[ToolbarSegmentedCell alloc] init]];
[segmentedControl setCell: [[[ToolbarSegmentedCell alloc] init] autorelease]];
[groupItem setView: segmentedControl];
NSSegmentedCell * segmentedCell = (NSSegmentedCell *)[segmentedControl cell];
@ -3623,10 +3673,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"),
NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
[segmentedControl release];
[groupItem setVisibilityPriority: NSToolbarItemVisibilityPriorityHigh];
return groupItem;
return [groupItem autorelease];
}
else if ([ident isEqualToString: TOOLBAR_FILTER])
{
@ -4224,7 +4275,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[menu addItem: [NSMenuItem separatorItem]];
[menu addItemWithTitle: NSLocalizedString(@"Speed Limit", "Dock item") action: @selector(toggleSpeedLimit:) keyEquivalent: @""];
return menu;
return [menu autorelease];
}
- (NSRect) windowWillUseStandardFrame: (NSWindow *) window defaultFrame: (NSRect) defaultFrame
@ -4387,6 +4438,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
for (torrent in fTorrents)
if (torrentStruct == [torrent torrentStruct])
{
[torrent retain];
break;
}
@ -4401,7 +4453,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
{
case TR_RPC_TORRENT_ADDED:
[self performSelectorOnMainThread: @selector(rpcAddTorrentStruct:) withObject:
[NSValue valueWithPointer: torrentStruct] waitUntilDone: NO];
[[NSValue valueWithPointer: torrentStruct] retain] waitUntilDone: NO];
break;
case TR_RPC_TORRENT_STARTED:
@ -4440,6 +4492,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
default:
NSAssert1(NO, @"Unknown RPC command received: %d", type);
[torrent release];
}
}
}
@ -4447,6 +4500,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) rpcAddTorrentStruct: (NSValue *) torrentStructPtr
{
tr_torrent * torrentStruct = (tr_torrent *)[torrentStructPtr pointerValue];
[torrentStructPtr release];
NSString * location = nil;
if (tr_torrentGetDownloadDir(torrentStruct) != NULL)
@ -4463,6 +4517,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[torrent update];
[fTorrents addObject: torrent];
[torrent release];
if (!fAddingTransfers)
fAddingTransfers = [[NSMutableSet alloc] init];
@ -4473,17 +4528,20 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) rpcRemoveTorrent: (Torrent *) torrent
{
[self confirmRemoveTorrents: [NSArray arrayWithObject: torrent] deleteData: NO];
[self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO];
[torrent release];
}
- (void) rpcRemoveTorrentDeleteData: (Torrent *) torrent
{
[self confirmRemoveTorrents: [NSArray arrayWithObject: torrent] deleteData: YES];
[self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: YES];
[torrent release];
}
- (void) rpcStartedStoppedTorrent: (Torrent *) torrent
{
[torrent update];
[torrent release];
[self updateUI];
[self applyFilter];
@ -4500,6 +4558,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[fInfoController updateOptions];
}
[torrent release];
}
- (void) rpcMovedTorrent: (Torrent *) torrent
@ -4510,6 +4569,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if ([[fTableView selectedTorrents] containsObject: torrent])
[fInfoController updateInfoStats];
[torrent release];
}
- (void) rpcUpdateQueue

View File

@ -67,7 +67,7 @@
{
fStarted = NO;
fPath = path;
fPath = [path retain];
fInfo = tr_metaInfoBuilderCreate([fPath UTF8String]);
if (fInfo->fileCount == 0)
@ -81,7 +81,9 @@
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];
[alert release];
[self release];
return nil;
}
if (fInfo->totalSize == 0)
@ -95,7 +97,9 @@
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];
[alert release];
[self release];
return nil;
}
@ -166,8 +170,8 @@
[fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d pieces, %@ each", "Create torrent -> info"),
fInfo->pieceCount, [NSString stringForFileSize: fInfo->pieceSize]]];
fLocation = [[[fDefaults stringForKey: @"CreatorLocation"] stringByExpandingTildeInPath] stringByAppendingPathComponent:
[name stringByAppendingPathExtension: @"torrent"]];
fLocation = [[[[fDefaults stringForKey: @"CreatorLocation"] stringByExpandingTildeInPath] stringByAppendingPathComponent:
[name stringByAppendingPathExtension: @"torrent"]] retain];
[fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
[fLocationField setToolTip: fLocation];
@ -180,13 +184,17 @@
- (void) dealloc
{
[fPath release];
[fLocation release];
[fTrackers release];
if (fInfo)
tr_metaInfoBuilderFree(fInfo);
[fTimer invalidate];
[super dealloc];
}
- (void) setLocation: (id) sender
@ -206,7 +214,8 @@
[panel beginSheetModalForWindow: [self window] completionHandler: ^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton)
{
fLocation = [[panel URL] path];
[fLocation release];
fLocation = [[[panel URL] path] retain];
[fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
[fLocationField setToolTip: fLocation];
@ -252,6 +261,11 @@
[[self window] close];
}
- (void) windowWillClose: (NSNotification *) notification
{
[self autorelease];
}
- (void) cancelCreateProgress: (id) sender
{
fInfo->abortFlag = 1;
@ -358,7 +372,7 @@
BOOL added = NO;
for (__strong NSString * tracker in tempTrackers)
for (NSString * tracker in tempTrackers)
{
tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
@ -411,6 +425,7 @@
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningCreatorPrivateBlankAddress"];
}
[alert release];
if (returnCode == NSAlertFirstButtonReturn)
[self performSelectorOnMainThread: @selector(createReal) withObject: nil waitUntilDone: NO];
@ -421,7 +436,7 @@
//check if the location currently exists
if (![[NSFileManager defaultManager] fileExistsAtPath: [fLocation stringByDeletingLastPathComponent]])
{
NSAlert * alert = [[NSAlert alloc] init];
NSAlert * alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> directory doesn't exist warning -> button")];
[alert setMessageText: NSLocalizedString(@"The chosen torrent file location does not exist.",
"Create torrent -> directory doesn't exist warning -> title")];
@ -442,7 +457,7 @@
NSArray * pathComponents = [fLocation pathComponents];
NSInteger count = [pathComponents count];
NSAlert * alert = [[NSAlert alloc] init];
NSAlert * alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> file already exists warning -> button")];
[alert setMessageText: NSLocalizedString(@"A torrent file with this name and directory cannot be created.",
"Create torrent -> file already exists warning -> title")];
@ -507,7 +522,7 @@
break;
default:
alert = [[NSAlert alloc] init];
alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> failed -> button")];
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Creation of \"%@\" failed.",
"Create torrent -> failed -> title"), [fLocation lastPathComponent]]];

View File

@ -54,13 +54,25 @@
smallFont, NSFontAttributeName, stringShadow, NSShadowAttributeName,
paragraphStyle, NSParagraphStyleAttributeName, nil];
[stringShadow release];
[paragraphStyle release];
}
return self;
}
- (void) dealloc
{
[fBadge release];
[fMainLineAttributes release];
[fSubLineAttributes release];
[super dealloc];
}
- (void) setOverlay: (NSImage *) icon mainLine: (NSString *) mainLine subLine: (NSString *) subLine
{
[fBadge release];
//create badge
const NSRect badgeRect = NSMakeRect(0.0, 0.0, 325.0, 84.0);

View File

@ -48,6 +48,7 @@
DragOverlayView * view = [[DragOverlayView alloc] initWithFrame: [self frame]];
[self setContentView: view];
[view release];
[self setReleasedWhenClosed: NO];
[self setIgnoresMouseEvents: YES];
@ -76,7 +77,10 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fFadeInAnimation release];
[fFadeOutAnimation release];
[super dealloc];
}
- (void) setTorrents: (NSArray *) files

View File

@ -25,5 +25,7 @@
#import <Foundation/Foundation.h>
@interface ExpandedPathToIconTransformer : NSValueTransformer
{
}
@end

View File

@ -25,5 +25,7 @@
#import <Foundation/Foundation.h>
@interface ExpandedPathToPathTransformer : NSValueTransformer
{
}
@end

View File

@ -34,7 +34,7 @@
NSString * fName;
NSString * fPath;
Torrent * __unsafe_unretained fTorrent;
Torrent * fTorrent;
uint64_t fSize;
NSImage * fIcon;
BOOL fIsFolder;
@ -43,7 +43,7 @@
@property (nonatomic, readonly) NSString * name;
@property (nonatomic, readonly) NSString * path;
@property (nonatomic, readonly, unsafe_unretained) Torrent * torrent;
@property (nonatomic, readonly) Torrent * torrent;
@property (nonatomic, readonly) uint64_t size;
@property (nonatomic, readonly) NSImage * icon;

View File

@ -80,9 +80,21 @@
- (id) copyWithZone: (NSZone *) zone
{
//this object is essentially immutable after initial setup
return self;
return [self retain];
}
- (void) dealloc
{
[fName release];
[fPath release];
[fIndexes release];
[fIcon release];
[fChildren release];
[super dealloc];
}
- (NSString *) description
{
@ -100,8 +112,8 @@
- (NSImage *) icon
{
if (!fIcon)
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType: fIsFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon)
: [fName pathExtension]];
fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: fIsFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon)
: [fName pathExtension]] retain];
return fIcon;
}
@ -121,8 +133,8 @@
if ((self = [super init]))
{
fIsFolder = isFolder;
fName = name;
fPath = path;
fName = [name retain];
fPath = [path retain];
fIndexes = [[NSMutableIndexSet alloc] init];

View File

@ -69,10 +69,30 @@
[NSFont messageFontOfSize: 9.0], NSFontAttributeName,
statusParagraphStyle, NSParagraphStyleAttributeName, nil];
[paragraphStyle release];
[statusParagraphStyle release];
}
return self;
}
- (void) dealloc
{
[fTitleAttributes release];
[fStatusAttributes release];
[super dealloc];
}
- (id) copyWithZone: (NSZone *) zone
{
FileNameCell * copy = [super copyWithZone: zone];
copy->fTitleAttributes = [fTitleAttributes retain];
copy->fStatusAttributes = [fStatusAttributes retain];
return copy;
}
- (NSImage *) image
{
FileListNode * node = (FileListNode *)[self objectValue];
@ -173,7 +193,7 @@
- (NSAttributedString *) attributedTitle
{
NSString * title = [(FileListNode *)[self objectValue] name];
return [[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes];
return [[[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes] autorelease];
}
- (NSAttributedString *) attributedStatus
@ -187,7 +207,7 @@
NSString * status = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@",
"Inspector -> Files tab -> file status string"), percentString, [NSString stringForFileSize: [node size]]];
return [[NSAttributedString alloc] initWithString: status attributes: fStatusAttributes];
return [[[NSAttributedString alloc] initWithString: status attributes: fStatusAttributes] autorelease];
}
@end

View File

@ -29,7 +29,7 @@
@interface FileOutlineController : NSObject
{
__unsafe_unretained Torrent * fTorrent;
Torrent * fTorrent;
NSMutableArray * fFileList;
IBOutlet FileOutlineView * fOutline;

View File

@ -73,6 +73,14 @@ typedef enum
[self setTorrent: nil];
}
- (void) dealloc
{
[fFileList release];
[fFilterText release];
[super dealloc];
}
- (FileOutlineView *) outlineView
{
return fOutline;
@ -84,6 +92,7 @@ typedef enum
[fFileList setArray: [fTorrent fileList]];
[fFilterText release];
fFilterText = nil;
[fOutline reloadData];
@ -198,7 +207,8 @@ typedef enum
else
[fOutline reloadData];
fFilterText = text;
[fFilterText release];
fFilterText = [text retain];
}
- (void) refresh
@ -511,18 +521,21 @@ typedef enum
[item setTarget: self];
[item setTag: FILE_CHECK_TAG];
[menu addItem: item];
[item release];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Uncheck Selected", "File Outline -> Menu")
action: @selector(setCheck:) keyEquivalent: @""];
[item setTarget: self];
[item setTag: FILE_UNCHECK_TAG];
[menu addItem: item];
[item release];
//only check selected
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Only Check Selected", "File Outline -> Menu")
action: @selector(setOnlySelectedCheck:) keyEquivalent: @""];
[item setTarget: self];
[menu addItem: item];
[item release];
[menu addItem: [NSMenuItem separatorItem]];
@ -531,6 +544,7 @@ typedef enum
NSMenu * priorityMenu = [[NSMenu alloc] initWithTitle: @"File Priority Menu"];
[item setSubmenu: priorityMenu];
[menu addItem: item];
[item release];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"High", "File Outline -> Priority Menu")
action: @selector(setPriority:) keyEquivalent: @""];
@ -538,6 +552,7 @@ typedef enum
[item setTag: FILE_PRIORITY_HIGH_TAG];
[item setImage: [NSImage imageNamed: @"PriorityHighTemplate.png"]];
[priorityMenu addItem: item];
[item release];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Normal", "File Outline -> Priority Menu")
action: @selector(setPriority:) keyEquivalent: @""];
@ -545,6 +560,7 @@ typedef enum
[item setTag: FILE_PRIORITY_NORMAL_TAG];
[item setImage: [NSImage imageNamed: @"PriorityNormalTemplate.png"]];
[priorityMenu addItem: item];
[item release];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Low", "File Outline -> Priority Menu")
action: @selector(setPriority:) keyEquivalent: @""];
@ -552,7 +568,9 @@ typedef enum
[item setTag: FILE_PRIORITY_LOW_TAG];
[item setImage: [NSImage imageNamed: @"PriorityLowTemplate.png"]];
[priorityMenu addItem: item];
[item release];
[priorityMenu release];
[menu addItem: [NSMenuItem separatorItem]];
@ -561,8 +579,9 @@ typedef enum
action: @selector(revealFile:) keyEquivalent: @""];
[item setTarget: self];
[menu addItem: item];
[item release];
return menu;
return [menu autorelease];
}
- (NSUInteger) findFileNode: (FileListNode *) node inList: (NSArray *) list atIndexes: (NSIndexSet *) indexes currentParent: (FileListNode *) currentParent finalParent: (FileListNode **) parent

View File

@ -35,9 +35,11 @@
{
FileNameCell * nameCell = [[FileNameCell alloc] init];
[[self tableColumnWithIdentifier: @"Name"] setDataCell: nameCell];
[nameCell release];
FilePriorityCell * priorityCell = [[FilePriorityCell alloc] init];
[[self tableColumnWithIdentifier: @"Priority"] setDataCell: priorityCell];
[priorityCell release];
[self setAutoresizesOutlineColumn: NO];
[self setIndentationPerLevel: 14.0];
@ -45,6 +47,10 @@
fMouseRow = -1;
}
- (void) dealloc
{
[super dealloc];
}
- (void) mouseDown: (NSEvent *) event
{

View File

@ -101,6 +101,7 @@
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: cellFrame options: options owner: controlView userInfo: userInfo];
[controlView addTrackingArea: area];
[area release];
}
- (void) setHovered: (BOOL) hovered

View File

@ -128,6 +128,7 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[super dealloc];
}
- (void) setFilter: (id) sender
@ -264,9 +265,10 @@
const NSInteger groupMenuCount = [groupMenu numberOfItems];
for (NSInteger i = 0; i < groupMenuCount; i++)
{
NSMenuItem * item = [groupMenu itemAtIndex: 0];
NSMenuItem * item = [[groupMenu itemAtIndex: 0] retain];
[groupMenu removeItemAtIndex: 0];
[menu addItem: item];
[item release];
}
}
}

View File

@ -37,6 +37,11 @@
return self;
}
- (void) dealloc
{
[fGradient release];
[super dealloc];
}
- (BOOL) mouseDownCanMoveWindow
{

View File

@ -140,7 +140,8 @@
- (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor
{
fInitialString = [control stringValue];
[fInitialString release];
fInitialString = [[control stringValue] retain];
return YES;
}
@ -151,6 +152,7 @@
if (fInitialString)
{
[control setStringValue: fInitialString];
[fInitialString release];
fInitialString = nil;
}
return NO;

View File

@ -26,10 +26,16 @@
@implementation GroupToolbarItem
- (void) dealloc
{
[fIdentifiers release];
[super dealloc];
}
- (void) setIdentifiers: (NSArray *) identifiers
{
fIdentifiers = identifiers;
[fIdentifiers release];
fIdentifiers = [identifiers retain];
}
- (void) validate
@ -38,7 +44,7 @@
for (NSInteger i = 0; i < [control segmentCount]; i++)
[control setEnabled: [[self target] validateToolbarItem:
[[NSToolbarItem alloc] initWithItemIdentifier: [fIdentifiers objectAtIndex: i]]] forSegment: i];
[[[NSToolbarItem alloc] initWithItemIdentifier: [fIdentifiers objectAtIndex: i]] autorelease]] forSegment: i];
}
- (void) createMenu: (NSArray *) labels
@ -57,9 +63,12 @@
[addItem setTag: i];
[menu addItem: addItem];
[addItem release];
}
[menu release];
[self setMenuFormRepresentation: menuItem];
[menuItem release];
}
- (NSMenuItem *) menuFormRepresentation
@ -69,7 +78,7 @@
const NSInteger count = [(NSSegmentedControl *)[self view] segmentCount];
for (NSInteger i = 0; i < count; i++)
[[[menuItem submenu] itemAtIndex: i] setEnabled: [[self target] validateToolbarItem:
[[NSToolbarItem alloc] initWithItemIdentifier: [fIdentifiers objectAtIndex: i]]]];
[[[NSToolbarItem alloc] initWithItemIdentifier: [fIdentifiers objectAtIndex: i]] autorelease]]];
return menuItem;
}

View File

@ -54,10 +54,10 @@ GroupsController * fGroupsInstance = nil;
{
NSData * data;
if ((data = [[NSUserDefaults standardUserDefaults] dataForKey: @"GroupDicts"]))
fGroups = [NSKeyedUnarchiver unarchiveObjectWithData: data];
fGroups = [[NSKeyedUnarchiver unarchiveObjectWithData: data] retain];
else if ((data = [[NSUserDefaults standardUserDefaults] dataForKey: @"Groups"])) //handle old groups
{
fGroups = [NSUnarchiver unarchiveObjectWithData: data];
fGroups = [[NSUnarchiver unarchiveObjectWithData: data] retain];
[[NSUserDefaults standardUserDefaults] removeObjectForKey: @"Groups"];
[self saveGroups];
}
@ -107,6 +107,11 @@ GroupsController * fGroupsInstance = nil;
return self;
}
- (void) dealloc
{
[fGroups release];
[super dealloc];
}
- (NSInteger) numberOfGroups
{
@ -299,11 +304,13 @@ GroupsController * fGroupsInstance = nil;
[icon setSize: NSMakeSize(ICON_WIDTH_SMALL, ICON_WIDTH_SMALL)];
[item setImage: icon];
[icon release];
}
else
[item setImage: icon];
[menu addItem: item];
[item release];
for (NSMutableDictionary * dict in fGroups)
{
@ -319,14 +326,16 @@ GroupsController * fGroupsInstance = nil;
[icon setSize: NSMakeSize(ICON_WIDTH_SMALL, ICON_WIDTH_SMALL)];
[item setImage: icon];
[icon release];
}
else
[item setImage: icon];
[menu addItem: item];
[item release];
}
return menu;
return [menu autorelease];
}
- (NSInteger) groupIndexForTorrent: (Torrent *) torrent;
@ -353,6 +362,7 @@ GroupsController * fGroupsInstance = nil;
NSMutableDictionary * tempDict = [dict mutableCopy];
[tempDict removeObjectForKey: @"Icon"];
[groups addObject: tempDict];
[tempDict release];
}
[[NSUserDefaults standardUserDefaults] setObject: [NSKeyedArchiver archivedDataWithRootObject: groups] forKey: @"GroupDicts"];
@ -377,16 +387,19 @@ GroupsController * fGroupsInstance = nil;
NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [color blendedColorWithFraction: 0.45 ofColor:
[NSColor whiteColor]] endingColor: color];
[gradient drawInBezierPath: bp angle: 270.0];
[gradient release];
//inside
bp = [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(rect, 1.0, 1.0) xRadius: 3.0 yRadius: 3.0];
gradient = [[NSGradient alloc] initWithStartingColor: [color blendedColorWithFraction: 0.75 ofColor: [NSColor whiteColor]]
endingColor: [color blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]];
[gradient drawInBezierPath: bp angle: 270.0];
[gradient release];
[icon unlockFocus];
[dict setObject: icon forKey: @"Icon"];
[icon release];
return icon;
}

View File

@ -382,9 +382,9 @@
NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index];
if (location)
{
ExpandedPathToPathTransformer * pathTransformer = [[ExpandedPathToPathTransformer alloc] init];
ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
[[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]];
ExpandedPathToIconTransformer * iconTransformer = [[ExpandedPathToIconTransformer alloc] init];
ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
[[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]];
}
else

View File

@ -62,13 +62,16 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fTorrents release];
[super dealloc];
}
- (void) setInfoForTorrents: (NSArray *) torrents
{
//don't check if it's the same in case the metadata changed
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
fSet = NO;
}

View File

@ -61,11 +61,18 @@
[[fFileFilterField cell] setPlaceholderString: NSLocalizedString(@"Filter", "inspector -> file filter")];
}
- (void) dealloc
{
[fTorrents release];
[super dealloc];
}
- (void) setInfoForTorrents: (NSArray *) torrents
{
//don't check if it's the same in case the metadata changed
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
fSet = NO;
}

View File

@ -44,11 +44,18 @@
return self;
}
- (void) dealloc
{
[fTorrents release];
[super dealloc];
}
- (void) setInfoForTorrents: (NSArray *) torrents
{
//don't check if it's the same in case the metadata changed
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
fSet = NO;
}

View File

@ -68,13 +68,16 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fTorrents release];
[super dealloc];
}
- (void) setInfoForTorrents: (NSArray *) torrents
{
//don't check if it's the same in case the metadata changed
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
fSet = NO;
}
@ -443,7 +446,8 @@
- (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor
{
fInitialString = [control stringValue];
[fInitialString release];
fInitialString = [[control stringValue] retain];
return YES;
}
@ -454,6 +458,7 @@
if (fInitialString)
{
[control setStringValue: fInitialString];
[fInitialString release];
fInitialString = nil;
}
return NO;

View File

@ -98,12 +98,24 @@
[self setWebSeedTableHidden: YES animate: NO];
}
- (void) dealloc
{
[fTorrents release];
[fPeers release];
[fWebSeeds release];
[fWebSeedTableAnimation release];
[super dealloc];
}
#warning subclass?
- (void) setInfoForTorrents: (NSArray *) torrents
{
//don't check if it's the same in case the metadata changed
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
fSet = NO;
}
@ -231,7 +243,9 @@
if (fWebSeedTableAnimation)
[self setWebSeedTableHidden: !fWebSeeds animate: NO];
[fPeers release];
fPeers = nil;
[fWebSeeds release];
fWebSeeds = nil;
}
@ -436,6 +450,7 @@
{
if (animation == fWebSeedTableAnimation)
{
[fWebSeedTableAnimation release];
fWebSeedTableAnimation = nil;
}
}
@ -445,6 +460,7 @@
if (fWebSeedTableAnimation)
{
[fWebSeedTableAnimation stopAnimation]; // jumps to end frame
[fWebSeedTableAnimation release];
fWebSeedTableAnimation = nil;
}
}
@ -459,6 +475,7 @@
if ([fTorrents count] == 0)
{
[fPeers release];
fPeers = nil;
[fPeerTable reloadData];
@ -476,6 +493,7 @@
if (!hasWebSeeds)
{
[fWebSeeds release];
fWebSeeds = nil;
[fWebSeedTable reloadData];
}
@ -492,6 +510,7 @@
if (fWebSeedTableAnimation)
{
[fWebSeedTableAnimation stopAnimation];
[fWebSeedTableAnimation release];
fWebSeedTableAnimation = nil;
}

View File

@ -37,6 +37,11 @@
return self;
}
- (void) dealloc
{
[fGradient release];
[super dealloc];
}
- (void) drawRect: (NSRect) rect
{

View File

@ -37,7 +37,7 @@
fSelected = NO;
//expects the icon to currently be set as the image
fIcon = [self image];
fIcon = [[self image] retain];
[self setSelectedTab: fSelected];
}
@ -45,6 +45,8 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fIcon release];
[super dealloc];
}
- (void) setSelectedTab: (BOOL) selected
@ -83,6 +85,7 @@
tabRect = NSMakeRect(0.0, 1.0, NSWidth(tabRect) - 1.0, NSHeight(tabRect) - 2.0);
[gradient drawInRect: tabRect angle: 270.0];
[gradient release];
if (fIcon)
{
@ -98,6 +101,7 @@
[tabImage unlockFocus];
[self setImage: tabImage];
[tabImage release];
}
- (void) updateControlTint: (NSNotification *) notification

View File

@ -74,11 +74,20 @@
}
}
- (void) dealloc
{
[fTorrents release];
[fTrackers release];
[fTrackerCell release];
[super dealloc];
}
- (void) setInfoForTorrents: (NSArray *) torrents
{
//don't check if it's the same in case the metadata changed
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
fSet = NO;
}
@ -97,7 +106,7 @@
NSArray * oldTrackers = fTrackers;
if ([fTorrents count] == 1)
fTrackers = [[fTorrents objectAtIndex: 0] allTrackerStats];
fTrackers = [[[fTorrents objectAtIndex: 0] allTrackerStats] retain];
else
{
fTrackers = [[NSMutableArray alloc] init];
@ -112,6 +121,7 @@
else
[fTrackerTable reloadData];
[oldTrackers release];
}
else
{
@ -120,7 +130,8 @@
NSIndexSet * addedIndexes = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange([fTrackers count]-2, 2)];
NSArray * tierAndTrackerBeingAdded = [fTrackers objectsAtIndexes: addedIndexes];
fTrackers = [[fTorrents objectAtIndex: 0] allTrackerStats];
[fTrackers release];
fTrackers = [[[fTorrents objectAtIndex: 0] allTrackerStats] retain];
[fTrackers addObjectsFromArray: tierAndTrackerBeingAdded];
[fTrackerTable setTrackers: fTrackers];
@ -138,6 +149,7 @@
- (void) clearView
{
[fTrackers release];
fTrackers = nil;
}
@ -219,7 +231,8 @@
NSBeep();
//reset table with either new or old value
fTrackers = [torrent allTrackerStats];
[fTrackers release];
fTrackers = [[torrent allTrackerStats] retain];
[fTrackerTable setTrackers: fTrackers];
[fTrackerTable reloadData];
@ -253,6 +266,7 @@
{
if (numberSelected == 0)
{
[fTrackers release];
fTrackers = nil;
[fTrackerTable setTrackers: nil];
@ -379,6 +393,7 @@
NSInteger result = [alert runModal];
if ([[alert suppressionButton] state] == NSOnState)
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningRemoveTrackers"];
[alert release];
if (result != NSAlertFirstButtonReturn)
return;
@ -392,6 +407,7 @@
[torrent removeTrackers: [removeIdentifiers objectForKey: torrent]];
//reset table with either new or old value
[fTrackers release];
fTrackers = [[NSMutableArray alloc] init];
for (Torrent * torrent in fTorrents)
[fTrackers addObjectsFromArray: [torrent allTrackerStats]];

View File

@ -140,8 +140,16 @@ typedef enum
if ([fViewController respondsToSelector: @selector(saveViewSize)])
[fViewController saveViewSize];
[fGeneralViewController dealloc];
[fActivityViewController dealloc];
[fTrackersViewController dealloc];
[fPeersViewController dealloc];
[fFileViewController dealloc];
[fOptionsViewController dealloc];
[fTorrents release];
[super dealloc];
}
- (void) setInfoForTorrents: (NSArray *) torrents
@ -149,7 +157,8 @@ typedef enum
if (fTorrents && [fTorrents isEqualToArray: torrents])
return;
fTorrents = torrents;
[fTorrents release];
fTorrents = [torrents retain];
[self resetInfo];
}

View File

@ -104,8 +104,8 @@
filterButtonFrame.origin.x -= NSWidth(clearButtonFrame) - oldClearButtonWidth;
[fFilterField setFrame: filterButtonFrame];
fAttributes = [[[[fMessageTable tableColumnWithIdentifier: @"Message"] dataCell] attributedStringValue]
attributesAtIndex: 0 effectiveRange: NULL];
fAttributes = [[[[[fMessageTable tableColumnWithIdentifier: @"Message"] dataCell] attributedStringValue]
attributesAtIndex: 0 effectiveRange: NULL] retain];
//select proper level in popup button
switch ([[NSUserDefaults standardUserDefaults] integerForKey: @"MessageLevel"])
@ -135,9 +135,14 @@
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fTimer invalidate];
[fLock release];
[fMessages release];
[fDisplayedMessages release];
[fAttributes release];
[super dealloc];
}
- (void) windowDidBecomeKey: (NSNotification *) notification
@ -386,6 +391,7 @@
NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"Index" ascending: YES];
NSArray * descriptors = [[NSArray alloc] initWithObjects: descriptor, nil];
NSArray * sortedMessages = [fDisplayedMessages sortedArrayUsingDescriptors: descriptors];
[descriptors release];
//create the text to output
NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [sortedMessages count]];
@ -405,6 +411,7 @@
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];
[alert release];
}
}
}];

View File

@ -39,7 +39,7 @@
[coloredImage unlockFocus];
return coloredImage;
return [coloredImage autorelease];
}
@end

View File

@ -31,7 +31,7 @@
if (fromIndex == toIndex)
return;
id object = [self objectAtIndex: fromIndex];
id object = [[self objectAtIndex: fromIndex] retain];
//shift objects - more efficient than simply removing the object and re-inserting the object
if (fromIndex < toIndex)
@ -46,6 +46,7 @@
}
[self replaceObjectAtIndex: toIndex withObject: object];
[object release];
}
@end

View File

@ -50,7 +50,7 @@
+ (NSString *) formattedUInteger: (NSUInteger) value
{
NSNumberFormatter * numberFormatter = [[NSNumberFormatter alloc] init];
NSNumberFormatter * numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
[numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
[numberFormatter setMaximumFractionDigits: 0];
@ -238,6 +238,7 @@
[numberFormatter setMaximumFractionDigits: decimals];
NSString * fileSizeString = [numberFormatter stringFromNumber: [NSNumber numberWithFloat: convertedSize]];
[numberFormatter release];
if (!notAllowedUnit || ![unit isEqualToString: notAllowedUnit])
fileSizeString = [fileSizeString stringByAppendingFormat: @" %@", unit];

View File

@ -25,8 +25,25 @@
#import "PeerProgressIndicatorCell.h"
#import "NSStringAdditions.h"
#import "transmission.h" // required by utils.h
#import "utils.h"
@implementation PeerProgressIndicatorCell
- (id) copyWithZone: (NSZone *) zone
{
PeerProgressIndicatorCell * copy = [super copyWithZone: zone];
copy->fAttributes = [fAttributes retain];
return copy;
}
- (void) dealloc
{
[fAttributes release];
[super dealloc];
}
- (void) setSeed: (BOOL) seed
{
fSeed = seed;
@ -43,6 +60,7 @@
fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont systemFontOfSize: 11.0], NSFontAttributeName,
paragraphStyle, NSParagraphStyleAttributeName, nil];
[paragraphStyle release];
}
[[NSString percentString: [self floatValue] longDecimals: NO] drawInRect: cellFrame withAttributes: fAttributes];
@ -50,7 +68,11 @@
else
{
//attributes not needed anymore
fAttributes = nil;
if (fAttributes)
{
[fAttributes release];
fAttributes = nil;
}
[super drawWithFrame: cellFrame inView: controlView];
if (fSeed)

View File

@ -32,7 +32,7 @@
NSColor * fGreenAvailabilityColor, * fBluePieceColor;
__unsafe_unretained Torrent * fTorrent;
Torrent * fTorrent;
NSInteger fNumPieces, fAcross, fWidth, fExtraBorder;
}

View File

@ -48,8 +48,8 @@ enum
- (void) awakeFromNib
{
//store box colors
fGreenAvailabilityColor = [NSColor colorWithCalibratedRed: 0.0 green: 1.0 blue: 0.4 alpha: 1.0];
fBluePieceColor = [NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0];
fGreenAvailabilityColor = [[NSColor colorWithCalibratedRed: 0.0 green: 1.0 blue: 0.4 alpha: 1.0] retain];
fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
//actually draw the box
[self setTorrent: nil];
@ -59,7 +59,10 @@ enum
{
tr_free(fPieces);
[fGreenAvailabilityColor release];
[fBluePieceColor release];
[super dealloc];
}
- (void) setTorrent: (Torrent *) torrent
@ -84,9 +87,11 @@ enum
NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.4]
endingColor: [NSColor colorWithCalibratedWhite: 0.2 alpha: 0.4]];
[gradient drawInRect: [self bounds] angle: 90.0];
[gradient release];
[back unlockFocus];
[self setImage: back];
[back release];
[self setNeedsDisplay];
}

View File

@ -34,7 +34,7 @@ typedef enum
@interface PortChecker : NSObject
{
__unsafe_unretained id fDelegate;
id fDelegate;
port_status_t fStatus;
NSURLConnection * fConnection;

View File

@ -58,6 +58,9 @@
{
[fTimer invalidate];
[fConnection release];
[fPortProbeData release];
[super dealloc];
}
- (port_status_t) status
@ -92,6 +95,7 @@
- (void) connectionDidFinishLoading: (NSURLConnection *) connection
{
NSString * probeString = [[NSString alloc] initWithData: fPortProbeData encoding: NSUTF8StringEncoding];
[fPortProbeData release];
fPortProbeData = nil;
if (probeString)
@ -105,6 +109,7 @@
NSLog(@"Unable to get port status: invalid response (%@)", probeString);
[self callBackWithStatus: PORT_STATUS_ERROR];
}
[probeString release];
}
else
{

View File

@ -25,5 +25,7 @@
#import <Cocoa/Cocoa.h>
@interface PredicateEditorRowTemplateAny : NSPredicateEditorRowTemplate
{
}
@end

View File

@ -127,7 +127,7 @@ tr_session * fHandle;
fRPCWhitelistArray = [[fDefaults arrayForKey: @"RPCWhitelist"] mutableCopy];
if (!fRPCWhitelistArray)
fRPCWhitelistArray = [NSMutableArray arrayWithObject: @"127.0.0.1"];
fRPCWhitelistArray = [[NSMutableArray arrayWithObject: @"127.0.0.1"] retain];
[self updateRPCWhitelist];
//reset old Sparkle settings from previous versions
@ -155,10 +155,14 @@ tr_session * fHandle;
if (fPortChecker)
{
[fPortChecker cancelProbe];
[fPortChecker release];
}
[fRPCWhitelistArray release];
[fRPCPassword release];
[super dealloc];
}
- (void) awakeFromNib
@ -172,6 +176,7 @@ tr_session * fHandle;
[toolbar setSizeMode: NSToolbarSizeModeRegular];
[toolbar setSelectedItemIdentifier: TOOLBAR_GENERAL];
[[self window] setToolbar: toolbar];
[toolbar release];
[self setPrefView: nil];
@ -306,10 +311,11 @@ tr_session * fHandle;
}
else
{
[item release];
return nil;
}
return item;
return [item autorelease];
}
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
@ -391,6 +397,7 @@ tr_session * fHandle;
if (fPortChecker)
{
[fPortChecker cancelProbe];
[fPortChecker release];
}
BOOL delay = natStatusChanged || tr_sessionIsPortForwardingEnabled(fHandle);
fPortChecker = [[PortChecker alloc] initForPort: fPeerPort delay: delay withDelegate: self];
@ -418,6 +425,7 @@ tr_session * fHandle;
NSAssert1(NO, @"Port checker returned invalid status: %d", [fPortChecker status]);
break;
}
[fPortChecker release];
fPortChecker = nil;
}
@ -428,7 +436,7 @@ tr_session * fHandle;
NSArray * directories = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
NSUserDomainMask | NSLocalDomainMask | NSSystemDomainMask, YES);
for (__strong NSString * directory in directories)
for (NSString * directory in directories)
{
directory = [directory stringByAppendingPathComponent: @"Sounds"];
@ -436,7 +444,7 @@ tr_session * fHandle;
if ([[NSFileManager defaultManager] fileExistsAtPath: directory isDirectory: &isDirectory] && isDirectory)
{
NSArray * directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: directory error: NULL];
for (__strong NSString * sound in directoryContents)
for (NSString * sound in directoryContents)
{
sound = [sound stringByDeletingPathExtension];
if ([NSSound soundNamed: sound])
@ -693,7 +701,7 @@ tr_session * fHandle;
+ (NSDate *) timeSumToDate: (NSInteger) sum
{
NSDateComponents * comps = [[NSDateComponents alloc] init];
NSDateComponents * comps = [[[NSDateComponents alloc] init] autorelease];
[comps setHour: sum / 60];
[comps setMinute: sum % 60];
@ -702,7 +710,8 @@ tr_session * fHandle;
- (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor
{
fInitialString = [control stringValue];
[fInitialString release];
fInitialString = [[control stringValue] retain];
return YES;
}
@ -713,6 +722,7 @@ tr_session * fHandle;
if (fInitialString)
{
[control setStringValue: fInitialString];
[fInitialString release];
fInitialString = nil;
}
return NO;
@ -748,7 +758,7 @@ tr_session * fHandle;
- (void) setDefaultForMagnets: (id) sender
{
NSString * bundleID = [[NSBundle mainBundle] bundleIdentifier];
const OSStatus result = LSSetDefaultHandlerForURLScheme((CFStringRef)@"magnet", (__bridge CFStringRef)bundleID);
const OSStatus result = LSSetDefaultHandlerForURLScheme((CFStringRef)@"magnet", (CFStringRef)bundleID);
if (result != noErr)
NSLog(@"Failed setting default magnet link handler");
}
@ -972,6 +982,7 @@ tr_session * fHandle;
- (void) setRPCPassword: (id) sender
{
[fRPCPassword release];
fRPCPassword = [[sender stringValue] copy];
const char * password = [[sender stringValue] UTF8String];
@ -987,6 +998,7 @@ tr_session * fHandle;
SecKeychainFindGenericPassword(NULL, strlen(RPC_KEYCHAIN_SERVICE), RPC_KEYCHAIN_SERVICE,
strlen(RPC_KEYCHAIN_NAME), RPC_KEYCHAIN_NAME, &passwordLength, (void **)&password, NULL);
[fRPCPassword release];
if (password != NULL)
{
char fullPassword[passwordLength+1];

View File

@ -25,5 +25,7 @@
#import <Cocoa/Cocoa.h>
@interface PrefsWindow : NSWindow
{
}
@end

View File

@ -38,7 +38,9 @@
NSColor * color3 = [NSColor colorWithCalibratedRed: redComponent * 0.85 green: greenComponent * 0.85 blue: blueComponent * 0.85
alpha: alpha];
return [[NSGradient alloc] initWithColorsAndLocations: baseColor, 0.0, color2, 0.5, color3, 0.5, baseColor, 1.0, nil];
NSGradient * progressGradient = [[NSGradient alloc] initWithColorsAndLocations: baseColor, 0.0, color2, 0.5, color3, 0.5,
baseColor, 1.0, nil];
return [progressGradient autorelease];
}
@end

View File

@ -126,6 +126,7 @@ tr_session * fLib;
{
[fTimer invalidate];
[fStatsWindowInstance autorelease];
fStatsWindowInstance = nil;
}

View File

@ -90,6 +90,7 @@ typedef enum
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[super dealloc];
}
- (void) updateWithDownload: (CGFloat) dlRate upload: (CGFloat) ulRate

View File

@ -52,6 +52,8 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fGradient release];
[super dealloc];
}
- (BOOL) mouseDownCanMoveWindow

View File

@ -62,7 +62,7 @@
void startQueueCallback(tr_torrent * torrent, void * torrentData)
{
[(__bridge Torrent *)torrentData performSelectorOnMainThread: @selector(startQueue) withObject: nil waitUntilDone: NO];
[(Torrent *)torrentData performSelectorOnMainThread: @selector(startQueue) withObject: nil waitUntilDone: NO];
}
void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, bool wasRunning, void * torrentData)
@ -71,23 +71,23 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, bo
{
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status",
[NSNumber numberWithBool: wasRunning], @"WasRunning", nil];
[(__bridge Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO];
[(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO];
}
}
void ratioLimitHitCallback(tr_torrent * torrent, void * torrentData)
{
[(__bridge Torrent *)torrentData performSelectorOnMainThread: @selector(ratioLimitHit) withObject: nil waitUntilDone: NO];
[(Torrent *)torrentData performSelectorOnMainThread: @selector(ratioLimitHit) withObject: nil waitUntilDone: NO];
}
void idleLimitHitCallback(tr_torrent * torrent, void * torrentData)
{
[(__bridge Torrent *)torrentData performSelectorOnMainThread: @selector(idleLimitHit) withObject: nil waitUntilDone: NO];
[(Torrent *)torrentData performSelectorOnMainThread: @selector(idleLimitHit) withObject: nil waitUntilDone: NO];
}
void metadataCallback(tr_torrent * torrent, void * torrentData)
{
[(__bridge Torrent *)torrentData performSelectorOnMainThread: @selector(metadataRetrieved) withObject: nil waitUntilDone: NO];
[(Torrent *)torrentData performSelectorOnMainThread: @selector(metadataRetrieved) withObject: nil waitUntilDone: NO];
}
int trashDataFile(const char * filename)
@ -211,6 +211,20 @@ int trashDataFile(const char * filename)
if (fFileStat)
tr_torrentFilesFree(fFileStat, [self fileCount]);
[fPreviousFinishedIndexes release];
[fPreviousFinishedIndexesDate release];
[fHashString release];
[fIcon release];
[fFileList release];
[fFlatFileList release];
[fTimeMachineExclude release];
[super dealloc];
}
- (NSString *) description
@ -220,7 +234,7 @@ int trashDataFile(const char * filename)
- (id) copyWithZone: (NSZone *) zone
{
return self;
return [self retain];
}
- (void) closeRemoveTorrent: (BOOL) trashFiles
@ -229,6 +243,7 @@ int trashDataFile(const char * filename)
if (fTimeMachineExclude)
{
[self setTimeMachineExclude: NO forPath: fTimeMachineExclude];
[fTimeMachineExclude release];
fTimeMachineExclude = nil;
}
@ -267,8 +282,10 @@ int trashDataFile(const char * filename)
- (void) setPreviousFinishedPieces: (NSIndexSet *) indexes
{
fPreviousFinishedIndexes = indexes;
[fPreviousFinishedIndexes release];
fPreviousFinishedIndexes = [indexes retain];
[fPreviousFinishedIndexesDate release];
fPreviousFinishedIndexesDate = indexes != nil ? [[NSDate alloc] init] : nil;
}
@ -513,6 +530,7 @@ int trashDataFile(const char * filename)
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Move inside itself alert -> button")];
[alert runModal];
[alert release];
return;
}
@ -534,6 +552,7 @@ int trashDataFile(const char * filename)
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Move error alert -> button")];
[alert runModal];
[alert release];
}
[self updateTimeMachineExclude];
@ -577,6 +596,7 @@ int trashDataFile(const char * filename)
const NSInteger result = [alert runModal];
if ([[alert suppressionButton] state] == NSOnState)
[fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
[alert release];
return result != NSAlertFirstButtonReturn;
}
@ -591,8 +611,8 @@ int trashDataFile(const char * filename)
#warning replace kGenericFolderIcon stuff with NSImageNameFolder on 10.6
if (!fIcon)
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType: [self isFolder] ? NSFileTypeForHFSTypeCode(kGenericFolderIcon)
: [[self name] pathExtension]];
fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: [self isFolder] ? NSFileTypeForHFSTypeCode(kGenericFolderIcon)
: [[self name] pathExtension]] retain];
return fIcon;
}
@ -635,6 +655,7 @@ int trashDataFile(const char * filename)
TrackerNode * tracker = [[TrackerNode alloc] initWithTrackerStat: &stats[i] torrent: self];
[trackers addObject: tracker];
[tracker release];
}
tr_torrentTrackersFree(stats, count);
@ -1527,6 +1548,7 @@ int trashDataFile(const char * filename)
if (fTimeMachineExclude)
{
[self setTimeMachineExclude: NO forPath: fTimeMachineExclude];
[fTimeMachineExclude release];
fTimeMachineExclude = nil;
}
@ -1534,7 +1556,7 @@ int trashDataFile(const char * filename)
if (currentLocation)
{
[self setTimeMachineExclude: YES forPath: currentLocation];
fTimeMachineExclude = currentLocation;
fTimeMachineExclude = [currentLocation retain];
}
}
@ -1629,17 +1651,18 @@ int trashDataFile(const char * filename)
if (!fHandle)
{
[self release];
return nil;
}
}
fInfo = tr_torrentInfo(fHandle);
tr_torrentSetQueueStartCallback(fHandle, startQueueCallback, (__bridge void *)(self));
tr_torrentSetCompletenessCallback(fHandle, completenessChangeCallback, (__bridge void *)(self));
tr_torrentSetRatioLimitHitCallback(fHandle, ratioLimitHitCallback, (__bridge void *)(self));
tr_torrentSetIdleLimitHitCallback(fHandle, idleLimitHitCallback, (__bridge void *)(self));
tr_torrentSetMetadataCallback(fHandle, metadataCallback, (__bridge void *)(self));
tr_torrentSetQueueStartCallback(fHandle, startQueueCallback, self);
tr_torrentSetCompletenessCallback(fHandle, completenessChangeCallback, self);
tr_torrentSetRatioLimitHitCallback(fHandle, ratioLimitHitCallback, self);
tr_torrentSetIdleLimitHitCallback(fHandle, idleLimitHitCallback, self);
tr_torrentSetMetadataCallback(fHandle, metadataCallback, self);
fHashString = [[NSString alloc] initWithUTF8String: fInfo->hashString];
@ -1654,7 +1677,7 @@ int trashDataFile(const char * filename)
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(checkGroupValueForRemoval:)
name: @"GroupValueRemoved" object: nil];
fTimeMachineExclude = timeMachineExclude;
fTimeMachineExclude = [timeMachineExclude retain];
[self update];
return self;
@ -1697,6 +1720,7 @@ int trashDataFile(const char * filename)
{
node = [[FileListNode alloc] initWithFolderName: name path: path torrent: self];
[fileList addObject: node];
[node release];
}
NSMutableArray * trimmedComponents = [NSMutableArray arrayWithArray: [pathComponents subarrayWithRange: NSMakeRange(2, [pathComponents count]-2)]];
@ -1709,6 +1733,7 @@ int trashDataFile(const char * filename)
FileListNode * node = [[FileListNode alloc] initWithFileName: name path: path size: file->length index: i torrent: self];
[fileList addObject: node];
[flatFileList addObject: node];
[node release];
}
}
@ -1721,8 +1746,9 @@ int trashDataFile(const char * filename)
else
{
FileListNode * node = [[FileListNode alloc] initWithFileName: [self name] path: @"" size: [self size] index: 0 torrent: self];
fFileList = [NSArray arrayWithObject: node];
fFlatFileList = fFileList;
fFileList = [[NSArray arrayWithObject: node] retain];
fFlatFileList = [fFileList retain];
[node release];
}
}
@ -1758,6 +1784,7 @@ int trashDataFile(const char * filename)
}
[parent insertChild: node];
[node release];
}
if (isFolder)
@ -1794,7 +1821,6 @@ int trashDataFile(const char * filename)
{
case TR_SEED:
case TR_PARTIAL_SEED:
{
//simpler to create a new dictionary than to use statusInfo - avoids retention chicanery
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self
userInfo: [NSDictionary dictionaryWithObject: [statusInfo objectForKey: @"WasRunning"] forKey: @"WasRunning"]];
@ -1805,19 +1831,19 @@ int trashDataFile(const char * filename)
if (FSPathMakeRef((const UInt8 *)[dataLocation UTF8String], &ref, NULL) == noErr)
{
NSDictionary * quarantineProperties = [NSDictionary dictionaryWithObject: (NSString *)kLSQuarantineTypeOtherDownload forKey: (NSString *)kLSQuarantineTypeKey];
if (LSSetItemAttribute(&ref, kLSRolesAll, kLSItemQuarantineProperties, (__bridge void *)quarantineProperties) != noErr)
if (LSSetItemAttribute(&ref, kLSRolesAll, kLSItemQuarantineProperties, quarantineProperties) != noErr)
NSLog(@"Failed to quarantine: %@", dataLocation);
}
else
NSLog(@"Could not find file to quarantine: %@", dataLocation);
break;
}
case TR_LEECH:
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentRestartedDownloading" object: self];
break;
}
[statusInfo release];
[self update];
[self updateTimeMachineExclude];
@ -1892,7 +1918,7 @@ int trashDataFile(const char * filename)
- (void) setTimeMachineExclude: (BOOL) exclude forPath: (NSString *) path
{
CSBackupSetItemExcluded((__bridge CFURLRef)[NSURL fileURLWithPath: path], exclude, true);
CSBackupSetItemExcluded((CFURLRef)[NSURL fileURLWithPath: path], exclude, true);
}
@end

View File

@ -109,10 +109,11 @@
[fStatusAttributes setObject: [NSFont messageFontOfSize: 9.0] forKey: NSFontAttributeName];
[fStatusAttributes setObject: paragraphStyle forKey: NSParagraphStyleAttributeName];
[paragraphStyle release];
fBluePieceColor = [NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0];
fBarBorderColor = [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.2];
fBarMinimalBorderColor = [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.015];
fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
fBarBorderColor = [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.2] retain];
fBarMinimalBorderColor = [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.015] retain];
}
return self;
}
@ -241,6 +242,8 @@
[rowInfo setObject: @"Row" forKey: @"Type"];
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: cellFrame options: rowOptions owner: controlView userInfo: rowInfo];
[controlView addTrackingArea: area];
[rowInfo release];
[area release];
}
//control button
@ -257,6 +260,8 @@
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: controlButtonRect options: controlOptions owner: controlView
userInfo: controlInfo];
[controlView addTrackingArea: area];
[controlInfo release];
[area release];
//reveal button
NSRect revealButtonRect = [self revealButtonRectForBounds: cellFrame];
@ -272,6 +277,8 @@
area = [[NSTrackingArea alloc] initWithRect: revealButtonRect options: revealOptions owner: controlView
userInfo: revealInfo];
[controlView addTrackingArea: area];
[revealInfo release];
[area release];
//action button
NSRect actionButtonRect = [self iconRectForBounds: cellFrame]; //use the whole icon
@ -286,6 +293,8 @@
[actionInfo setObject: @"Action" forKey: @"Type"];
area = [[NSTrackingArea alloc] initWithRect: actionButtonRect options: actionOptions owner: controlView userInfo: actionInfo];
[controlView addTrackingArea: area];
[actionInfo release];
[area release];
}
- (void) setHover: (BOOL) hover
@ -351,6 +360,7 @@
NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [groupColor blendedColorWithFraction: 0.7
ofColor: [NSColor whiteColor]] endingColor: darkGroupColor];
[gradient drawInBezierPath: bp angle: 90.0];
[gradient release];
}
const BOOL error = [torrent isAnyErrorOrWarning];
@ -683,6 +693,7 @@
[bitmap drawInRect: barRect fromRect: NSZeroRect operation: NSCompositeSourceOver
fraction: ([fDefaults boolForKey: @"SmallView"] ? 0.25 : 1.0) respectFlipped: YES hints: nil];
[bitmap release];
}
- (NSRect) rectForMinimalStatusWithString: (NSAttributedString *) string inBounds: (NSRect) bounds
@ -817,12 +828,12 @@
- (NSAttributedString *) attributedTitle
{
NSString * title = [(Torrent *)[self representedObject] name];
return [[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes];
return [[[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes] autorelease];
}
- (NSAttributedString *) attributedStatusString: (NSString *) string
{
return [[NSAttributedString alloc] initWithString: string attributes: fStatusAttributes];
return [[[NSAttributedString alloc] initWithString: string attributes: fStatusAttributes] autorelease];
}
- (NSString *) buttonString

View File

@ -41,6 +41,11 @@
return self;
}
- (void) dealloc
{
[fTorrents release];
[super dealloc];
}
- (NSString *) description
{

View File

@ -89,6 +89,17 @@
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fCollapsedGroups release];
[fPiecesBarAnimation release];
[fMenuTorrent release];
[fSelectedValues release];
[fTorrentCell release];
[super dealloc];
}
- (void) awakeFromNib
@ -380,10 +391,11 @@
//if pushing a button, don't change the selected rows
if (pushed)
fSelectedValues = [self selectedValues];
fSelectedValues = [[self selectedValues] retain];
[super mouseDown: event];
[fSelectedValues release];
fSelectedValues = nil;
//avoid weird behavior when showing menu by doing this after mouse down
@ -625,11 +637,13 @@
[infoViewController setInfoForTorrents: [NSArray arrayWithObject: torrent]];
[infoViewController updateInfo];
[infoViewController release];
[popover release];
}
else
{
//update file action menu
fMenuTorrent = [self itemAtRow: row];
fMenuTorrent = [[self itemAtRow: row] retain];
//update global limit check
[fGlobalLimitItem setState: [fMenuTorrent usesGlobalSpeedLimit] ? NSOnState : NSOffState];
@ -641,6 +655,7 @@
location = [self convertPoint: location toView: self];
[fActionMenu popUpMenuPositioningItem: nil atLocation: location inView: self];
[fMenuTorrent release];
fMenuTorrent = nil;
}
}
@ -679,6 +694,7 @@
[item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
[menu addItem: item];
[item release];
}
}
@ -707,6 +723,7 @@
[item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
[menu addItem: item];
[item release];
}
}
@ -819,8 +836,12 @@
- (void) togglePiecesBar
{
//stop previous animation
if (fPiecesBarAnimation)
[fPiecesBarAnimation release];
NSMutableArray * progressMarks = [NSMutableArray arrayWithCapacity: 16];
for (NSAnimationProgress i = 1.0/16; i <= 1.0; i += 1.0/16)
for (NSAnimationProgress i = 0.0625; i <= 1.0; i += 0.0625)
[progressMarks addObject: [NSNumber numberWithFloat: i]];
fPiecesBarAnimation = [[NSAnimation alloc] initWithDuration: TOGGLE_PROGRESS_SECONDS animationCurve: NSAnimationEaseIn];
@ -835,6 +856,7 @@
{
if (animation == fPiecesBarAnimation)
{
[fPiecesBarAnimation release];
fPiecesBarAnimation = nil;
}
}

View File

@ -83,10 +83,29 @@ NSMutableSet * fTrackerIconLoading;
[NSFont messageFontOfSize: 9.0], NSFontAttributeName,
paragraphStyle, NSParagraphStyleAttributeName, nil];
[paragraphStyle release];
}
return self;
}
- (void) dealloc
{
[fNameAttributes release];
[fStatusAttributes release];
[super dealloc];
}
- (id) copyWithZone: (NSZone *) zone
{
TrackerCell * copy = [super copyWithZone: zone];
copy->fNameAttributes = [fNameAttributes retain];
copy->fStatusAttributes = [fStatusAttributes retain];
return copy;
}
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
{
//icon
@ -223,6 +242,7 @@ NSMutableSet * fTrackerIconLoading;
if (icon)
{
[fTrackerIconCache setObject: icon forKey: baseAddress];
[icon release];
[[self controlView] setNeedsDisplay: YES];
}
@ -282,18 +302,18 @@ NSMutableSet * fTrackerIconLoading;
- (NSAttributedString *) attributedName
{
NSString * name = [(TrackerNode *)[self objectValue] host];
return [[NSAttributedString alloc] initWithString: name attributes: fNameAttributes];
return [[[NSAttributedString alloc] initWithString: name attributes: fNameAttributes] autorelease];
}
- (NSAttributedString *) attributedStatusWithString: (NSString *) statusString
{
return [[NSAttributedString alloc] initWithString: statusString attributes: fStatusAttributes];
return [[[NSAttributedString alloc] initWithString: statusString attributes: fStatusAttributes] autorelease];
}
- (NSAttributedString *) attributedCount: (NSInteger) count
{
NSString * countString = count != -1 ? [NSString stringWithFormat: @"%d", count] : NSLocalizedString(@"N/A", "tracker peer stat");
return [[NSAttributedString alloc] initWithString: countString attributes: fStatusAttributes];
return [[[NSAttributedString alloc] initWithString: countString attributes: fStatusAttributes] autorelease];
}
@end

View File

@ -31,10 +31,10 @@
{
tr_tracker_stat fStat;
__unsafe_unretained Torrent * fTorrent;
Torrent * fTorrent;
}
@property (nonatomic, readonly, assign) Torrent * torrent;
@property (nonatomic, readonly) Torrent * torrent;
- (id) initWithTrackerStat: (tr_tracker_stat *) stat torrent: (Torrent *) torrent;

View File

@ -28,7 +28,6 @@
@implementation TrackerNode
#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode)
#warning make weak when 10.7-only (not assign)
@synthesize torrent = fTorrent;
- (id) initWithTrackerStat: (tr_tracker_stat *) stat torrent: (Torrent *) torrent
@ -36,8 +35,7 @@
if ((self = [super init]))
{
fStat = *stat;
#warning make __weak when 10.7-only
fTorrent = torrent;
fTorrent = torrent; //weak reference
}
return self;
@ -51,7 +49,7 @@
- (id) copyWithZone: (NSZone *) zone
{
//this object is essentially immutable after initial setup
return self;
return [self retain];
}
- (BOOL) isEqual: (id) object
@ -114,6 +112,7 @@
[dateFormatter setDoesRelativeDateFormatting: YES];
dateString = [dateFormatter stringFromDate: [NSDate dateWithTimeIntervalSince1970: fStat.lastAnnounceTime]];
[dateFormatter release];
}
else
dateString = NSLocalizedString(@"N/A", "Tracker last announce");
@ -184,6 +183,7 @@
[dateFormatter setDoesRelativeDateFormatting: YES];
dateString = [dateFormatter stringFromDate: [NSDate dateWithTimeIntervalSince1970: fStat.lastScrapeTime]];
[dateFormatter release];
}
else
dateString = NSLocalizedString(@"N/A", "Tracker last scrape");

View File

@ -28,8 +28,9 @@
@interface TrackerTableView : NSTableView
{
__unsafe_unretained Torrent * fTorrent;
__unsafe_unretained NSArray * fTrackers;
//weak references
Torrent * fTorrent;
NSArray * fTrackers;
}
- (void) setTorrent: (Torrent *) torrent;

View File

@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">11D50</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<string key="IBDocument.SystemVersion">11B26</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
<string key="NS.object.0">1617</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSTextField</string>
@ -22,10 +22,7 @@
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<dictionary class="NSMutableDictionary" key="IBDocument.Metadata"/>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001">
<string key="NSClassName">URLSheetWindowController</string>
@ -49,7 +46,7 @@
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{400, 177}</string>
<object class="NSView" key="NSWindowView" id="892541411">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSTextField" id="1066788818">
@ -57,8 +54,6 @@
<int key="NSvFlags">274</int>
<string key="NSFrame">{{20, 50}, {360, 80}}</string>
<reference key="NSSuperview" ref="892541411"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="9691643"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="139057847">
<int key="NSCellFlags">-1805517311</int>
@ -96,8 +91,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{304, 12}, {82, 32}}</string>
<reference key="NSSuperview" ref="892541411"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="62424678">
<int key="NSCellFlags">604110336</int>
@ -119,8 +112,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{222, 12}, {82, 32}}</string>
<reference key="NSSuperview" ref="892541411"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="794131740"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="341887532">
<int key="NSCellFlags">67239424</int>
@ -142,8 +133,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{17, 140}, {366, 17}}</string>
<reference key="NSSuperview" ref="892541411"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1066788818"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="830118733">
<int key="NSCellFlags">67239488</int>
@ -170,9 +159,6 @@
</object>
</array>
<string key="NSFrameSize">{400, 177}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="459786882"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{400, 199}</string>
@ -215,21 +201,13 @@
</object>
<int key="connectionID">17</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">fCancelButton</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="9691643"/>
</object>
<int key="connectionID">22</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">openURLEndSheet:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="794131740"/>
</object>
<int key="connectionID">23</int>
<int key="connectionID">18</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
@ -237,7 +215,7 @@
<reference key="source" ref="1001"/>
<reference key="destination" ref="9691643"/>
</object>
<int key="connectionID">24</int>
<int key="connectionID">19</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
@ -247,6 +225,14 @@
</object>
<int key="connectionID">21</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">fCancelButton</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="9691643"/>
</object>
<int key="connectionID">22</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@ -368,27 +354,13 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">24</int>
<int key="maxID">22</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">URLSheetWindowController</string>
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="openURLCancelEndSheet:">id</string>
<string key="openURLEndSheet:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="openURLCancelEndSheet:">
<string key="name">openURLCancelEndSheet:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="openURLEndSheet:">
<string key="name">openURLEndSheet:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="fCancelButton">NSButton</string>
<string key="fLabelField">NSTextField</string>
@ -428,7 +400,7 @@
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1070" key="NS.object.0"/>
<integer value="1060" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>

View File

@ -32,14 +32,13 @@
IBOutlet NSTextField * fTextField;
IBOutlet NSButton * fOpenButton, * fCancelButton;
__unsafe_unretained Controller * fController;
Controller * fController;
}
- (id) initWithController: (Controller *) controller;
- (void) beginSheetForWindow: (NSWindow *) window;
- (IBAction) openURLEndSheet: (id) sender;
- (IBAction) openURLCancelEndSheet: (id) sender;
- (NSString *) urlString;
- (void) openURLEndSheet: (id) sender;
- (void) openURLCancelEndSheet: (id) sender;
@end

View File

@ -80,21 +80,29 @@ NSString * urlString = nil;
[fCancelButton setFrame: cancelFrame];
}
- (IBAction) openURLEndSheet: (id) sender
- (IBAction) beginSheetForWindow: (NSWindow *) window
{
[NSApp beginSheet: [self window] modalForWindow: window modalDelegate: self
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil];
}
- (void) openURLEndSheet: (id) sender
{
[[self window] orderOut: sender];
[NSApp endSheet: [self window] returnCode: 1];
}
- (IBAction) openURLCancelEndSheet: (id) sender
- (void) openURLCancelEndSheet: (id) sender
{
[[self window] orderOut: sender];
[NSApp endSheet: [self window] returnCode: 0];
}
- (NSString *) urlString
- (void) sheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
{
return [fTextField stringValue];
[urlString release];
urlString = [[fTextField stringValue] retain];
[fController urlSheetDidEnd: self url: urlString returnCode: returnCode];
}
- (void) controlTextDidChange: (NSNotification *) notification