show the multiple document icon on Leopard when multiple files selected

This commit is contained in:
Mitchell Livingston 2007-10-27 18:40:43 +00:00
parent 35303821d1
commit 04b3a94ca0
3 changed files with 11 additions and 26 deletions

View File

@ -32,7 +32,6 @@
@interface InfoWindowController : NSWindowController @interface InfoWindowController : NSWindowController
{ {
NSArray * fTorrents, * fPeers, * fFiles; NSArray * fTorrents, * fPeers, * fFiles;
NSImage * fAppIcon, * fLockImage;
IBOutlet NSView * fInfoView, * fActivityView, * fPeersView, * fFilesView, * fOptionsView; IBOutlet NSView * fInfoView, * fActivityView, * fPeersView, * fFilesView, * fOptionsView;
int fCurrentTabTag; int fCurrentTabTag;

View File

@ -24,6 +24,7 @@
#import "InfoWindowController.h" #import "InfoWindowController.h"
#import "InfoTabButtonCell.h" #import "InfoTabButtonCell.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h" #import "NSStringAdditions.h"
#define FILE_ROW_SMALL_HEIGHT 18.0 #define FILE_ROW_SMALL_HEIGHT 18.0
@ -76,9 +77,6 @@ typedef enum
- (void) awakeFromNib - (void) awakeFromNib
{ {
//get images
fAppIcon = [NSImage imageNamed: @"NSApplicationIcon"];
//window location and size //window location and size
NSPanel * window = (NSPanel *)[self window]; NSPanel * window = (NSPanel *)[self window];
@ -183,6 +181,9 @@ typedef enum
{ {
if (numberSelected > 0) if (numberSelected > 0)
{ {
[fImageView setImage: [NSImage imageNamed: [NSApp isOnLeopardOrBetter]
? NSImageNameMultipleDocuments : @"NSApplicationIcon"]];
[fNameField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d Torrents Selected", [fNameField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d Torrents Selected",
"Inspector -> above tabs -> selected torrents"), numberSelected]]; "Inspector -> above tabs -> selected torrents"), numberSelected]];
@ -197,6 +198,8 @@ typedef enum
} }
else else
{ {
[fImageView setImage: [NSImage imageNamed: @"NSApplicationIcon"]];
[fNameField setStringValue: NSLocalizedString(@"No Torrents Selected", "Inspector -> above tabs -> selected torrents")]; [fNameField setStringValue: NSLocalizedString(@"No Torrents Selected", "Inspector -> above tabs -> selected torrents")];
[fSizeField setStringValue: @""]; [fSizeField setStringValue: @""];
@ -230,8 +233,6 @@ typedef enum
[fFileOutline setTorrent: nil]; [fFileOutline setTorrent: nil];
[fImageView setImage: fAppIcon];
[fNameField setToolTip: nil]; [fNameField setToolTip: nil];
[fTrackerField setStringValue: @""]; [fTrackerField setStringValue: @""];
@ -657,16 +658,7 @@ typedef enum
NSDictionary * peer = [fPeers objectAtIndex: row]; NSDictionary * peer = [fPeers objectAtIndex: row];
if ([ident isEqualToString: @"Encryption"]) if ([ident isEqualToString: @"Encryption"])
{ return [[peer objectForKey: @"Encryption"] boolValue] ? [NSImage imageNamed: @"Lock.tiff"] : nil;
if ([[peer objectForKey: @"Encryption"] boolValue])
{
if (!fLockImage)
fLockImage = [NSImage imageNamed: @"Lock.tiff"];
return fLockImage;
}
else
return nil;
}
else if ([ident isEqualToString: @"Client"]) else if ([ident isEqualToString: @"Client"])
return [peer objectForKey: @"Client"]; return [peer objectForKey: @"Client"];
else if ([ident isEqualToString: @"Progress"]) else if ([ident isEqualToString: @"Progress"])

View File

@ -304,22 +304,16 @@
text = [text lowercaseString]; text = [text lowercaseString];
//select torrent closest to text that isn't before text alphabetically //select torrent closest to text that isn't before text alphabetically
int row;
NSEnumerator * enumerator = [tempTorrents objectEnumerator]; NSEnumerator * enumerator = [tempTorrents objectEnumerator];
Torrent * torrent; Torrent * torrent;
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
if ([[[torrent name] lowercaseString] hasPrefix: text]) if ([[[torrent name] lowercaseString] hasPrefix: text])
{ {
row = [fTorrents indexOfObject: torrent]; int row = [fTorrents indexOfObject: torrent];
break; [self selectRow: row byExtendingSelection: NO];
[self scrollRowToVisible: row];
return;
} }
//select last torrent alphabetically if no match found
if (!torrent)
row = [fTorrents indexOfObject: [tempTorrents lastObject]];
[self selectRow: row byExtendingSelection: NO];
[self scrollRowToVisible: row];
} }
- (void) displayTorrentMenuForEvent: (NSEvent *) event - (void) displayTorrentMenuForEvent: (NSEvent *) event