- (void) showMainWindow: (id) sender;
- (NSArray *) quickLookURLs;
+- (BOOL) canQuickLook;
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
- (void) toggleQuickLook: (id) sender;
[toolbarItem setImage: ![fFilterBar isHidden] ? [NSImage imageNamed: @"FilterBlue.png"] : [NSImage imageNamed: @"Filter.png"]];
return YES;
}
+
+ //enable quicklook item
+ if ([ident isEqualToString: TOOLBAR_QUICKLOOK])
+ return [[QuickLookController quickLook] canQuickLook];
return YES;
}
//enable prev/next filter button
if (action == @selector(switchFilter:))
return [fWindow isVisible] && ![fFilterBar isHidden];
-
+
+ //enable quicklook item
+ if (action == @selector(toggleQuickLook:))
+ return [[QuickLookController quickLook] canQuickLook];
+
//enable reveal in finder
if (action == @selector(revealFile:))
return canUseTable && [fTableView numberOfSelectedRows] > 0;
{
NSArray * selectedTorrents = [fTableView selectedTorrents];
NSMutableArray * urlArray = [NSMutableArray arrayWithCapacity: [selectedTorrents count]];
-
NSEnumerator * enumerator = [selectedTorrents objectEnumerator];
Torrent * torrent;
return urlArray;
}
+- (BOOL) canQuickLook
+{
+ NSArray * selectedTorrents = [fTableView selectedTorrents];
+ NSEnumerator * enumerator = [selectedTorrents objectEnumerator];
+ Torrent * torrent;
+
+ while ((torrent = [enumerator nextObject]))
+ {
+ if ([torrent folder] || [torrent isComplete])
+ return YES;
+ }
+
+ return NO;
+}
+
- (NSRect) quickLookFrameWithURL: (NSURL *) url
{
if ([fWindow isVisible])
- (BOOL) shouldQuickLookFileView;
- (NSArray *) quickLookURLs;
+- (BOOL) canQuickLook;
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
- (void) setPiecesView: (id) sender;
for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
{
NSDictionary * item = [fileOutlineView itemAtRow: i];
- if ([[item objectForKey: @"IsFolder"] boolValue]
- || [torrent fileProgress: [[item objectForKey: @"Indexes"] firstIndex]] == 1.0)
+ if ([[item objectForKey: @"IsFolder"] boolValue] || [torrent fileProgress: [[item objectForKey: @"Indexes"] firstIndex]] == 1.0)
[urlArray addObject: [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [item objectForKey: @"Path"]]]];
}
return urlArray;
}
+- (BOOL) canQuickLook
+{
+ FileOutlineView * fileOutlineView = [fFileController outlineView];
+ Torrent * torrent = [fTorrents objectAtIndex: 0];
+ NSIndexSet * indexes = [fileOutlineView selectedRowIndexes];
+
+ int i;
+ for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
+ {
+ NSDictionary * item = [fileOutlineView itemAtRow: i];
+ if ([[item objectForKey: @"IsFolder"] boolValue] || [torrent fileProgress: [[item objectForKey: @"Indexes"] firstIndex]] == 1.0)
+ return YES;
+ }
+
+ return NO;
+}
+
- (NSRect) quickLookFrameWithURL: (NSURL *) url
{
FileOutlineView * fileOutlineView = [fFileController outlineView];
+ (QuickLookController *) quickLook;
- (BOOL) quickLookSelectItems;
+- (BOOL) canQuickLook;
- (void) toggleQuickLook;
- (void) updateQuickLook;
return NO;
}
+- (BOOL) canQuickLook
+{
+ if ([fInfoController shouldQuickLookFileView])
+ return [fInfoController canQuickLook];
+ else
+ return [fMainController canQuickLook];
+}
+
- (void) toggleQuickLook
{
if (!fQuickLookAvailable)