a little code cleanup

This commit is contained in:
Mitchell Livingston 2007-07-01 13:27:26 +00:00
parent 0fb5d03514
commit 08879e11f3
5 changed files with 13 additions and 23 deletions

View File

@ -545,10 +545,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fAutoImportTimer release]; [fAutoImportTimer release];
} }
//save history and stop running torrents //save history
[self updateTorrentHistory]; [self updateTorrentHistory];
//make sure torrent is closed //make sure torrents are closed
enumerator = [fTorrents objectEnumerator]; enumerator = [fTorrents objectEnumerator];
Torrent * torrent; Torrent * torrent;
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))

View File

@ -63,7 +63,7 @@
fInfo = tr_metaInfoBuilderCreate(handle, [fPath UTF8String]); fInfo = tr_metaInfoBuilderCreate(handle, [fPath UTF8String]);
if (fInfo->fileCount == 0) if (fInfo->fileCount == 0)
{ {
NSAlert * alert = [[[NSAlert alloc] init] autorelease]; NSAlert * alert = [[NSAlert alloc] init];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> no files -> button")]; [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> no files -> button")];
[alert setMessageText: NSLocalizedString(@"This folder contains no files.", [alert setMessageText: NSLocalizedString(@"This folder contains no files.",
"Create torrent -> no files -> title")]; "Create torrent -> no files -> title")];
@ -72,6 +72,7 @@
[alert setAlertStyle: NSWarningAlertStyle]; [alert setAlertStyle: NSWarningAlertStyle];
[alert runModal]; [alert runModal];
[alert release];
[self release]; [self release];
return nil; return nil;

View File

@ -38,6 +38,7 @@
- (void) setFile: (NSString *) file; - (void) setFile: (NSString *) file;
- (void) setURL: (NSString *) url; - (void) setURL: (NSString *) url;
- (void) fadeIn;
- (void) fadeOut; - (void) fadeOut;
@end @end

View File

@ -125,32 +125,15 @@
secondString = [secondString stringByAppendingString: @" Total"]; secondString = [secondString stringByAppendingString: @" Total"];
} }
[[self contentView] setOverlay: icon mainLine: name subLine: secondString]; [self fadeIn];
//stop other animation and set to same progress
if ([fFadeOutAnimation isAnimating])
{
[fFadeOutAnimation stopAnimation];
[fFadeInAnimation setCurrentProgress: 1.0 - [fFadeOutAnimation currentProgress]];
}
[self setFrame: [[self parentWindow] frame] display: YES];
[fFadeInAnimation startAnimation];
} }
- (void) setFile: (NSString *) file - (void) setFile: (NSString *) file
{ {
[[self contentView] setOverlay: [NSImage imageNamed: @"CreateLarge.png"] [[self contentView] setOverlay: [NSImage imageNamed: @"CreateLarge.png"]
mainLine: NSLocalizedString(@"Create a Torrent File", "Drag overlay -> file") subLine: file]; mainLine: NSLocalizedString(@"Create a Torrent File", "Drag overlay -> file") subLine: file];
//stop other animation and set to same progress [self fadeIn];
if ([fFadeOutAnimation isAnimating])
{
[fFadeOutAnimation stopAnimation];
[fFadeInAnimation setCurrentProgress: 1.0 - [fFadeOutAnimation currentProgress]];
}
[self setFrame: [[self parentWindow] frame] display: YES];
[fFadeInAnimation startAnimation];
} }
@ -159,6 +142,11 @@
[[self contentView] setOverlay: [NSImage imageNamed: @"Globe.png"] [[self contentView] setOverlay: [NSImage imageNamed: @"Globe.png"]
mainLine: NSLocalizedString(@"Web Address", "Drag overlay -> url") subLine: url]; mainLine: NSLocalizedString(@"Web Address", "Drag overlay -> url") subLine: url];
[self fadeIn];
}
- (void) fadeIn
{
//stop other animation and set to same progress //stop other animation and set to same progress
if ([fFadeOutAnimation isAnimating]) if ([fFadeOutAnimation isAnimating])
{ {

View File

@ -192,7 +192,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (void) dealloc - (void) dealloc
{ {
# warning cleanup #warning cleanup
if (fHandle) if (fHandle)
{ {
if (fDownloadFolder) if (fDownloadFolder)