This commit is contained in:
parent
ae675f3d6f
commit
5e2ef3aa89
|
@ -211,7 +211,6 @@
|
||||||
A2DA362B0CBC674900C2ED41 /* InfoFiles.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36280CBC674900C2ED41 /* InfoFiles.png */; };
|
A2DA362B0CBC674900C2ED41 /* InfoFiles.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36280CBC674900C2ED41 /* InfoFiles.png */; };
|
||||||
A2DA362C0CBC674900C2ED41 /* InfoPeers.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36290CBC674900C2ED41 /* InfoPeers.png */; };
|
A2DA362C0CBC674900C2ED41 /* InfoPeers.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36290CBC674900C2ED41 /* InfoPeers.png */; };
|
||||||
A2DF37070C220D03006523C1 /* CreatorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2DF37050C220D03006523C1 /* CreatorWindowController.m */; };
|
A2DF37070C220D03006523C1 /* CreatorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2DF37050C220D03006523C1 /* CreatorWindowController.m */; };
|
||||||
A2DF57740DE46A6A000795D5 /* QuickLookController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2DF57730DE46A6A000795D5 /* QuickLookController.m */; };
|
|
||||||
A2DF58580DE4B2B0000795D5 /* JSON_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = A2DF576A0DE468C6000795D5 /* JSON_parser.c */; };
|
A2DF58580DE4B2B0000795D5 /* JSON_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = A2DF576A0DE468C6000795D5 /* JSON_parser.c */; };
|
||||||
A2DF58590DE4B2B1000795D5 /* JSON_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = A2DF576B0DE468C6000795D5 /* JSON_parser.h */; };
|
A2DF58590DE4B2B1000795D5 /* JSON_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = A2DF576B0DE468C6000795D5 /* JSON_parser.h */; };
|
||||||
A2E23AC60CB5E1930002BB25 /* InfoTabButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */; };
|
A2E23AC60CB5E1930002BB25 /* InfoTabButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */; };
|
||||||
|
@ -701,8 +700,6 @@
|
||||||
A2DF37050C220D03006523C1 /* CreatorWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CreatorWindowController.m; path = macosx/CreatorWindowController.m; sourceTree = "<group>"; };
|
A2DF37050C220D03006523C1 /* CreatorWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CreatorWindowController.m; path = macosx/CreatorWindowController.m; sourceTree = "<group>"; };
|
||||||
A2DF576A0DE468C6000795D5 /* JSON_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = JSON_parser.c; path = libtransmission/JSON_parser.c; sourceTree = "<group>"; };
|
A2DF576A0DE468C6000795D5 /* JSON_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = JSON_parser.c; path = libtransmission/JSON_parser.c; sourceTree = "<group>"; };
|
||||||
A2DF576B0DE468C6000795D5 /* JSON_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_parser.h; path = libtransmission/JSON_parser.h; sourceTree = "<group>"; };
|
A2DF576B0DE468C6000795D5 /* JSON_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_parser.h; path = libtransmission/JSON_parser.h; sourceTree = "<group>"; };
|
||||||
A2DF57720DE46A6A000795D5 /* QuickLookController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuickLookController.h; path = macosx/QuickLookController.h; sourceTree = "<group>"; };
|
|
||||||
A2DF57730DE46A6A000795D5 /* QuickLookController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QuickLookController.m; path = macosx/QuickLookController.m; sourceTree = "<group>"; };
|
|
||||||
A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = InfoTabButtonCell.h; path = macosx/InfoTabButtonCell.h; sourceTree = "<group>"; };
|
A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = InfoTabButtonCell.h; path = macosx/InfoTabButtonCell.h; sourceTree = "<group>"; };
|
||||||
A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = InfoTabButtonCell.m; path = macosx/InfoTabButtonCell.m; sourceTree = "<group>"; };
|
A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = InfoTabButtonCell.m; path = macosx/InfoTabButtonCell.m; sourceTree = "<group>"; };
|
||||||
A2E2EA910EE321C200EB6308 /* Groups.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Groups.png; path = macosx/Images/Groups.png; sourceTree = "<group>"; };
|
A2E2EA910EE321C200EB6308 /* Groups.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Groups.png; path = macosx/Images/Groups.png; sourceTree = "<group>"; };
|
||||||
|
@ -968,8 +965,6 @@
|
||||||
A222E9860E6B21D9009FB003 /* BlocklistDownloaderViewController.m */,
|
A222E9860E6B21D9009FB003 /* BlocklistDownloaderViewController.m */,
|
||||||
A222EA790E6C32C4009FB003 /* BlocklistScheduler.h */,
|
A222EA790E6C32C4009FB003 /* BlocklistScheduler.h */,
|
||||||
A222EA7A0E6C32C4009FB003 /* BlocklistScheduler.m */,
|
A222EA7A0E6C32C4009FB003 /* BlocklistScheduler.m */,
|
||||||
A2DF57720DE46A6A000795D5 /* QuickLookController.h */,
|
|
||||||
A2DF57730DE46A6A000795D5 /* QuickLookController.m */,
|
|
||||||
);
|
);
|
||||||
name = Sources;
|
name = Sources;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1982,7 +1977,6 @@
|
||||||
A26AF2840D2DC27C00FF7140 /* AddWindowController.m in Sources */,
|
A26AF2840D2DC27C00FF7140 /* AddWindowController.m in Sources */,
|
||||||
A2FB701C0D95CAEA0001F331 /* GroupsController.m in Sources */,
|
A2FB701C0D95CAEA0001F331 /* GroupsController.m in Sources */,
|
||||||
A2D307A40D9EC6870051FD27 /* BlocklistDownloader.m in Sources */,
|
A2D307A40D9EC6870051FD27 /* BlocklistDownloader.m in Sources */,
|
||||||
A2DF57740DE46A6A000795D5 /* QuickLookController.m in Sources */,
|
|
||||||
A2725B6E0DE5C4F5003445E7 /* FileListNode.m in Sources */,
|
A2725B6E0DE5C4F5003445E7 /* FileListNode.m in Sources */,
|
||||||
A2725D5D0DE7507C003445E7 /* TrackerTableView.m in Sources */,
|
A2725D5D0DE7507C003445E7 /* TrackerTableView.m in Sources */,
|
||||||
A28F4F770E085BDC003A3882 /* ColorTextField.m in Sources */,
|
A28F4F770E085BDC003A3882 /* ColorTextField.m in Sources */,
|
||||||
|
|
|
@ -247,10 +247,6 @@ typedef enum
|
||||||
|
|
||||||
- (void) showMainWindow: (id) sender;
|
- (void) showMainWindow: (id) sender;
|
||||||
|
|
||||||
- (NSArray *) quickLookURLs;
|
|
||||||
- (BOOL) canQuickLook;
|
|
||||||
- (BOOL) canQuickLookTorrent: (Torrent *) torrent;
|
|
||||||
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
|
|
||||||
- (void) toggleQuickLook: (id) sender;
|
- (void) toggleQuickLook: (id) sender;
|
||||||
|
|
||||||
- (void) linkHomepage: (id) sender;
|
- (void) linkHomepage: (id) sender;
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#import "TorrentTableView.h"
|
#import "TorrentTableView.h"
|
||||||
#import "CreatorWindowController.h"
|
#import "CreatorWindowController.h"
|
||||||
#import "StatsWindowController.h"
|
#import "StatsWindowController.h"
|
||||||
#import "QuickLookController.h"
|
|
||||||
#import "GroupsController.h"
|
#import "GroupsController.h"
|
||||||
#import "AboutWindowController.h"
|
#import "AboutWindowController.h"
|
||||||
#import "ButtonToolbarItem.h"
|
#import "ButtonToolbarItem.h"
|
||||||
|
@ -294,8 +293,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
[PrefsController setHandle: fLib];
|
[PrefsController setHandle: fLib];
|
||||||
fPrefsController = [[PrefsController alloc] init];
|
fPrefsController = [[PrefsController alloc] init];
|
||||||
|
|
||||||
[QuickLookController quickLookControllerInitializeWithController: self infoController: fInfoController];
|
|
||||||
|
|
||||||
fSoundPlaying = NO;
|
fSoundPlaying = NO;
|
||||||
|
|
||||||
tr_sessionSetAltSpeedFunc(fLib, altSpeedToggledCallback, self);
|
tr_sessionSetAltSpeedFunc(fLib, altSpeedToggledCallback, self);
|
||||||
|
@ -1476,7 +1473,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
- (void) resetInfo
|
- (void) resetInfo
|
||||||
{
|
{
|
||||||
[fInfoController setInfoForTorrents: [fTableView selectedTorrents]];
|
[fInfoController setInfoForTorrents: [fTableView selectedTorrents]];
|
||||||
[[QuickLookController quickLook] updateQuickLook];
|
|
||||||
|
if ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible])
|
||||||
|
[[QLPreviewPanel sharedPreviewPanel] reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setInfoTab: (id) sender
|
- (void) setInfoTab: (id) sender
|
||||||
|
@ -3367,10 +3366,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//enable quicklook item
|
|
||||||
if ([ident isEqualToString: TOOLBAR_QUICKLOOK])
|
|
||||||
return [[QuickLookController quickLook] canQuickLook];
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3564,10 +3559,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
if (action == @selector(switchFilter:))
|
if (action == @selector(switchFilter:))
|
||||||
return [fWindow isVisible] && ![fFilterBar isHidden];
|
return [fWindow isVisible] && ![fFilterBar isHidden];
|
||||||
|
|
||||||
//enable quicklook item
|
|
||||||
if (action == @selector(toggleQuickLook:))
|
|
||||||
return [[QuickLookController quickLook] canQuickLook];
|
|
||||||
|
|
||||||
//enable reveal in finder
|
//enable reveal in finder
|
||||||
if (action == @selector(revealFile:))
|
if (action == @selector(revealFile:))
|
||||||
return canUseTable && [fTableView numberOfSelectedRows] > 0;
|
return canUseTable && [fTableView numberOfSelectedRows] > 0;
|
||||||
|
@ -3971,62 +3962,12 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) quickLookURLs
|
|
||||||
{
|
|
||||||
NSArray * selectedTorrents = [fTableView selectedTorrents];
|
|
||||||
NSMutableArray * urlArray = [NSMutableArray arrayWithCapacity: [selectedTorrents count]];
|
|
||||||
|
|
||||||
for (Torrent * torrent in selectedTorrents)
|
|
||||||
if ([self canQuickLookTorrent: torrent])
|
|
||||||
[urlArray addObject: [NSURL fileURLWithPath: [torrent dataLocation]]];
|
|
||||||
|
|
||||||
return urlArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) canQuickLook
|
|
||||||
{
|
|
||||||
for (Torrent * torrent in [fTableView selectedTorrents])
|
|
||||||
if ([self canQuickLookTorrent: torrent])
|
|
||||||
return YES;
|
|
||||||
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) canQuickLookTorrent: (Torrent *) torrent
|
|
||||||
{
|
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath: [torrent dataLocation]])
|
|
||||||
return NO;
|
|
||||||
|
|
||||||
return [torrent isFolder] || [torrent isComplete];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSRect) quickLookFrameWithURL: (NSURL *) url
|
|
||||||
{
|
|
||||||
if ([fWindow isVisible])
|
|
||||||
{
|
|
||||||
NSString * fullPath = [url path];
|
|
||||||
NSRange visibleRows = [fTableView rowsInRect: [fTableView bounds]];
|
|
||||||
|
|
||||||
for (NSInteger row = 0; row < NSMaxRange(visibleRows); row++)
|
|
||||||
{
|
|
||||||
id item = [fTableView itemAtRow: row];
|
|
||||||
if ([item isKindOfClass: [Torrent class]] && [[(Torrent *)item dataLocation] isEqualToString: fullPath])
|
|
||||||
{
|
|
||||||
NSRect frame = [fTableView iconRectForRow: row];
|
|
||||||
frame.origin = [fTableView convertPoint: frame.origin toView: nil];
|
|
||||||
frame.origin = [fWindow convertBaseToScreen: frame.origin];
|
|
||||||
frame.origin.y -= frame.size.height;
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NSZeroRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) toggleQuickLook: (id) sender
|
- (void) toggleQuickLook: (id) sender
|
||||||
{
|
{
|
||||||
[[QuickLookController quickLook] toggleQuickLook];
|
if ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible])
|
||||||
|
[[QLPreviewPanel sharedPreviewPanel] orderOut: nil];
|
||||||
|
else
|
||||||
|
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) linkHomepage: (id) sender
|
- (void) linkHomepage: (id) sender
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#import "FilePriorityCell.h"
|
#import "FilePriorityCell.h"
|
||||||
#import "FileListNode.h"
|
#import "FileListNode.h"
|
||||||
#import "NSApplicationAdditions.h"
|
#import "NSApplicationAdditions.h"
|
||||||
#import "QuickLookController.h"
|
#import <Quartz/Quartz.h>
|
||||||
|
|
||||||
#define ROW_SMALL_HEIGHT 18.0
|
#define ROW_SMALL_HEIGHT 18.0
|
||||||
|
|
||||||
|
@ -132,7 +132,8 @@ typedef enum
|
||||||
|
|
||||||
- (void) outlineViewSelectionDidChange: (NSNotification *) notification
|
- (void) outlineViewSelectionDidChange: (NSNotification *) notification
|
||||||
{
|
{
|
||||||
[[QuickLookController quickLook] updateQuickLook];
|
if ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible])
|
||||||
|
[[QLPreviewPanel sharedPreviewPanel] reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
|
- (NSInteger) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#import "FilePriorityCell.h"
|
#import "FilePriorityCell.h"
|
||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
#import "FileListNode.h"
|
#import "FileListNode.h"
|
||||||
#import "QuickLookController.h"
|
|
||||||
|
|
||||||
@implementation FileOutlineView
|
@implementation FileOutlineView
|
||||||
|
|
||||||
|
@ -85,22 +84,6 @@
|
||||||
[super mouseDown: event];
|
[super mouseDown: event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) keyDown: (NSEvent *) event
|
|
||||||
{
|
|
||||||
const unichar firstChar = [[event charactersIgnoringModifiers] characterAtIndex: 0];
|
|
||||||
|
|
||||||
//don't allow quick look on add window
|
|
||||||
if (firstChar == ' ' && [[[self window] windowController] isKindOfClass: [InfoWindowController class]])
|
|
||||||
[[QuickLookController quickLook] toggleQuickLook];
|
|
||||||
else if (firstChar == NSRightArrowFunctionKey)
|
|
||||||
[[QuickLookController quickLook] pressRight];
|
|
||||||
else if (firstChar == NSLeftArrowFunctionKey)
|
|
||||||
[[QuickLookController quickLook] pressLeft];
|
|
||||||
else;
|
|
||||||
|
|
||||||
[super keyDown: event];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSMenu *) menuForEvent: (NSEvent *) event
|
- (NSMenu *) menuForEvent: (NSEvent *) event
|
||||||
{
|
{
|
||||||
int row = [self rowAtPoint: [self convertPoint: [event locationInWindow] fromView: nil]];
|
int row = [self rowAtPoint: [self convertPoint: [event locationInWindow] fromView: nil]];
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <transmission.h>
|
#import <transmission.h>
|
||||||
|
#import <Quartz/Quartz.h>
|
||||||
|
|
||||||
@class Torrent;
|
@class Torrent;
|
||||||
@class TrackerTableView;
|
@class TrackerTableView;
|
||||||
@class FileOutlineController;
|
@class FileOutlineController;
|
||||||
@class PiecesView;
|
@class PiecesView;
|
||||||
|
|
||||||
@interface InfoWindowController : NSWindowController
|
@interface InfoWindowController : NSWindowController <QLPreviewPanelDataSource, QLPreviewPanelDelegate>
|
||||||
{
|
{
|
||||||
NSArray * fTorrents;
|
NSArray * fTorrents;
|
||||||
NSMutableArray * fTrackers;
|
NSMutableArray * fTrackers;
|
||||||
|
@ -77,6 +78,8 @@
|
||||||
* fPeersConnectField;
|
* fPeersConnectField;
|
||||||
|
|
||||||
NSString * fInitialString;
|
NSString * fInitialString;
|
||||||
|
|
||||||
|
QLPreviewPanel * fPreviewPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setInfoForTorrents: (NSArray *) torrents;
|
- (void) setInfoForTorrents: (NSArray *) torrents;
|
||||||
|
@ -90,7 +93,6 @@
|
||||||
|
|
||||||
- (void) addRemoveTracker: (id) sender;
|
- (void) addRemoveTracker: (id) sender;
|
||||||
|
|
||||||
- (BOOL) shouldQuickLookFileView;
|
|
||||||
- (NSArray *) quickLookURLs;
|
- (NSArray *) quickLookURLs;
|
||||||
- (BOOL) canQuickLook;
|
- (BOOL) canQuickLook;
|
||||||
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
|
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#import "PeerProgressIndicatorCell.h"
|
#import "PeerProgressIndicatorCell.h"
|
||||||
#import "TrackerTableView.h"
|
#import "TrackerTableView.h"
|
||||||
#import "PiecesView.h"
|
#import "PiecesView.h"
|
||||||
#import "QuickLookController.h"
|
|
||||||
#import "NSApplicationAdditions.h"
|
#import "NSApplicationAdditions.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#include "utils.h" //tr_getRatio()
|
#include "utils.h" //tr_getRatio()
|
||||||
|
@ -228,6 +227,8 @@ typedef enum
|
||||||
|
|
||||||
[fWebSeedTableAnimation release];
|
[fWebSeedTableAnimation release];
|
||||||
|
|
||||||
|
[fPreviewPanel release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +686,7 @@ typedef enum
|
||||||
|
|
||||||
- (void) setTab: (id) sender
|
- (void) setTab: (id) sender
|
||||||
{
|
{
|
||||||
NSInteger oldTabTag = fCurrentTabTag;
|
const NSInteger oldTabTag = fCurrentTabTag;
|
||||||
fCurrentTabTag = [fTabMatrix selectedTag];
|
fCurrentTabTag = [fTabMatrix selectedTag];
|
||||||
if (fCurrentTabTag == oldTabTag)
|
if (fCurrentTabTag == oldTabTag)
|
||||||
return;
|
return;
|
||||||
|
@ -724,8 +725,6 @@ typedef enum
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TAB_FILES_TAG:
|
case TAB_FILES_TAG:
|
||||||
[[QuickLookController quickLook] updateQuickLook];
|
|
||||||
|
|
||||||
oldResizeSaveKey = @"InspectorContentHeightFiles";
|
oldResizeSaveKey = @"InspectorContentHeightFiles";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -821,8 +820,9 @@ typedef enum
|
||||||
[[window contentView] addSubview: view];
|
[[window contentView] addSubview: view];
|
||||||
[view setHidden: NO];
|
[view setHidden: NO];
|
||||||
|
|
||||||
if (fCurrentTabTag == TAB_FILES_TAG)
|
if (fCurrentTabTag == TAB_FILES_TAG || oldTabTag == TAB_FILES_TAG
|
||||||
[[QuickLookController quickLook] updateQuickLook];
|
&& ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible]))
|
||||||
|
[[QLPreviewPanel sharedPreviewPanel] reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setNextTab
|
- (void) setNextTab
|
||||||
|
@ -1102,11 +1102,69 @@ typedef enum
|
||||||
return [[fTrackers objectAtIndex: i] intValue] == 0;
|
return [[fTrackers objectAtIndex: i] intValue] == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) shouldQuickLookFileView
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL) acceptsPreviewPanelControl: (QLPreviewPanel *) panel
|
||||||
{
|
{
|
||||||
return [[self window] isVisible] && fCurrentTabTag == TAB_FILES_TAG && [[fFileController outlineView] numberOfSelectedRows] > 0;
|
return fCurrentTabTag == TAB_FILES_TAG && [[fFileController outlineView] numberOfSelectedRows] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) beginPreviewPanelControl: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
fPreviewPanel = [panel retain];
|
||||||
|
fPreviewPanel.delegate = self;
|
||||||
|
fPreviewPanel.dataSource = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) endPreviewPanelControl: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
[fPreviewPanel release];
|
||||||
|
fPreviewPanel = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger) numberOfPreviewItemsInPreviewPanel: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
return [[self quickLookURLs] count];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id <QLPreviewItem>) previewPanel: (QLPreviewPanel *)panel previewItemAtIndex: (NSInteger) index
|
||||||
|
{
|
||||||
|
return [[self quickLookURLs] objectAtIndex: index];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) previewPanel: (QLPreviewPanel *) panel handleEvent: (NSEvent *) event
|
||||||
|
{
|
||||||
|
if ([event type] == NSKeyDown)
|
||||||
|
{
|
||||||
|
[super keyDown: event];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
#warning fix!
|
||||||
|
- (NSRect) previewPanel: (QLPreviewPanel *) panel sourceFrameOnScreenForPreviewItem: (id <QLPreviewItem>) item
|
||||||
|
{
|
||||||
|
const NSInteger row = [[fFileController outlineView] rowForItem: item];
|
||||||
|
if (row == -1)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
|
NSRect frame = [[fFileController outlineView] iconRectForRow: row];
|
||||||
|
frame.origin = [[fFileController outlineView] convertPoint: frame.origin toView: nil];
|
||||||
|
frame.origin = [[self window] convertBaseToScreen: frame.origin];
|
||||||
|
frame.origin.y -= frame.size.height;
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#warning private
|
||||||
- (NSArray *) quickLookURLs
|
- (NSArray *) quickLookURLs
|
||||||
{
|
{
|
||||||
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
||||||
|
@ -1125,6 +1183,7 @@ typedef enum
|
||||||
return urlArray;
|
return urlArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning need? private?
|
||||||
- (BOOL) canQuickLook
|
- (BOOL) canQuickLook
|
||||||
{
|
{
|
||||||
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
||||||
|
@ -1137,29 +1196,8 @@ typedef enum
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSRect) quickLookFrameWithURL: (NSURL *) url
|
|
||||||
{
|
|
||||||
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
|
||||||
|
|
||||||
NSString * fullPath = [url path];
|
|
||||||
NSString * folder = [[fTorrents objectAtIndex: 0] downloadFolder];
|
|
||||||
NSRange visibleRows = [fileOutlineView rowsInRect: [fileOutlineView bounds]];
|
|
||||||
|
|
||||||
for (NSUInteger row = visibleRows.location; row < NSMaxRange(visibleRows); row++)
|
|
||||||
{
|
|
||||||
FileListNode * rowItem = [fileOutlineView itemAtRow: row];
|
|
||||||
if ([[folder stringByAppendingPathComponent: [rowItem fullPath]] isEqualToString: fullPath])
|
|
||||||
{
|
|
||||||
NSRect frame = [fileOutlineView iconRectForRow: row];
|
|
||||||
frame.origin = [fileOutlineView convertPoint: frame.origin toView: nil];
|
|
||||||
frame.origin = [[self window] convertBaseToScreen: frame.origin];
|
|
||||||
frame.origin.y -= frame.size.height;
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NSZeroRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setPiecesView: (id) sender
|
- (void) setPiecesView: (id) sender
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2009 Transmission authors and contributors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
@class Controller;
|
|
||||||
@class InfoWindowController;
|
|
||||||
|
|
||||||
@interface QuickLookController : NSObject
|
|
||||||
{
|
|
||||||
BOOL fQuickLookAvailable;
|
|
||||||
|
|
||||||
Controller * fMainController;
|
|
||||||
InfoWindowController * fInfoController;
|
|
||||||
}
|
|
||||||
|
|
||||||
//call once at startup
|
|
||||||
+ (void) quickLookControllerInitializeWithController: (Controller *) controller infoController: (InfoWindowController *) infoController;
|
|
||||||
|
|
||||||
//assumes quickLookControllerInitializeWithController:infoController: has already been called!
|
|
||||||
+ (QuickLookController *) quickLook;
|
|
||||||
|
|
||||||
- (BOOL) quickLookSelectItems;
|
|
||||||
- (BOOL) canQuickLook;
|
|
||||||
|
|
||||||
- (void) toggleQuickLook;
|
|
||||||
- (void) updateQuickLook;
|
|
||||||
|
|
||||||
- (void) pressLeft;
|
|
||||||
- (void) pressRight;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,160 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2009 Transmission authors and contributors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#import "QuickLookController.h"
|
|
||||||
#import "QuickLook.h"
|
|
||||||
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
|
|
||||||
|
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "Controller.h"
|
|
||||||
#import "InfoWindowController.h"
|
|
||||||
|
|
||||||
@interface QuickLookController (Private)
|
|
||||||
|
|
||||||
- (id) initWithMainController: (Controller *) controller infoController: (InfoWindowController *) infoController;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation QuickLookController
|
|
||||||
|
|
||||||
QuickLookController * fQuickLookInstance = nil;
|
|
||||||
+ (void) quickLookControllerInitializeWithController: (Controller *) controller infoController: (InfoWindowController *) infoController
|
|
||||||
{
|
|
||||||
if (!fQuickLookInstance)
|
|
||||||
fQuickLookInstance = [[QuickLookController alloc] initWithMainController: controller infoController: infoController];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (QuickLookController *) quickLook
|
|
||||||
{
|
|
||||||
return fQuickLookInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
//QuickLook delegate method
|
|
||||||
//returns the frame for the item represented by the URL, or an empty frame to fade in/out instead
|
|
||||||
- (NSRect) previewPanel: (NSPanel *) panel frameForURL: (NSURL *) url
|
|
||||||
{
|
|
||||||
if ([fInfoController shouldQuickLookFileView])
|
|
||||||
return [fInfoController quickLookFrameWithURL: url];
|
|
||||||
else
|
|
||||||
return [fMainController quickLookFrameWithURL: url];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) quickLookSelectItems
|
|
||||||
{
|
|
||||||
if (!fQuickLookAvailable)
|
|
||||||
return NO;
|
|
||||||
|
|
||||||
NSArray * urlArray;
|
|
||||||
if ([fInfoController shouldQuickLookFileView])
|
|
||||||
urlArray = [fInfoController quickLookURLs];
|
|
||||||
else
|
|
||||||
urlArray = [fMainController quickLookURLs];
|
|
||||||
|
|
||||||
if (urlArray && [urlArray count] > 0)
|
|
||||||
{
|
|
||||||
[[QLPreviewPanel sharedPreviewPanel] setURLs: urlArray];
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) canQuickLook
|
|
||||||
{
|
|
||||||
if (!fQuickLookAvailable)
|
|
||||||
return NO;
|
|
||||||
|
|
||||||
if ([fInfoController shouldQuickLookFileView])
|
|
||||||
return [fInfoController canQuickLook];
|
|
||||||
else
|
|
||||||
return [fMainController canQuickLook];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) toggleQuickLook
|
|
||||||
{
|
|
||||||
if (!fQuickLookAvailable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ([[QLPreviewPanel sharedPreviewPanel] isOpen])
|
|
||||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 2];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ([self quickLookSelectItems])
|
|
||||||
{
|
|
||||||
NSWindow * keyWindow = [NSApp keyWindow];
|
|
||||||
|
|
||||||
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFrontWithEffect: 2];
|
|
||||||
|
|
||||||
//restore the focus to previous key window
|
|
||||||
[keyWindow makeKeyWindow];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) updateQuickLook
|
|
||||||
{
|
|
||||||
//only update when window is open or in the middle of opening (visible)
|
|
||||||
if (!fQuickLookAvailable || !([[QLPreviewPanel sharedPreviewPanel] isOpen] || [[QLPreviewPanel sharedPreviewPanel] isVisible]))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (![self quickLookSelectItems])
|
|
||||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) pressLeft
|
|
||||||
{
|
|
||||||
if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen])
|
|
||||||
[[QLPreviewPanel sharedPreviewPanel] selectPreviousItem];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) pressRight
|
|
||||||
{
|
|
||||||
if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen])
|
|
||||||
[[QLPreviewPanel sharedPreviewPanel] selectNextItem];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation QuickLookController (Private)
|
|
||||||
|
|
||||||
- (id) initWithMainController: (Controller *) controller infoController: (InfoWindowController *) infoController
|
|
||||||
{
|
|
||||||
if ((self = [super init]))
|
|
||||||
{
|
|
||||||
fMainController = controller;
|
|
||||||
fInfoController = infoController;
|
|
||||||
|
|
||||||
//load the QuickLook framework and set the delegate
|
|
||||||
//animation types: 0 = none; 1 = fade; 2 = zoom
|
|
||||||
//disable on Snow Leopard for now
|
|
||||||
fQuickLookAvailable = ![NSApp isOnSnowLeopardOrBetter]
|
|
||||||
&& [[NSBundle bundleWithPath: @"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load];
|
|
||||||
if (fQuickLookAvailable)
|
|
||||||
[[[QLPreviewPanel sharedPreviewPanel] windowController] setDelegate: self];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1559,6 +1559,16 @@ int trashDataFile(const char * filename)
|
||||||
return fHandle;
|
return fHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSURL *) previewItemURL
|
||||||
|
{
|
||||||
|
return [NSURL fileURLWithPath: [self dataLocation]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) previewItemTitle
|
||||||
|
{
|
||||||
|
return [self name];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation Torrent (Private)
|
@implementation Torrent (Private)
|
||||||
|
|
|
@ -25,12 +25,13 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <transmission.h>
|
#import <transmission.h>
|
||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
|
#import <Quartz/Quartz.h>
|
||||||
|
|
||||||
@class TorrentCell;
|
@class TorrentCell;
|
||||||
|
|
||||||
#define GROUP_SEPARATOR_HEIGHT 18.0
|
#define GROUP_SEPARATOR_HEIGHT 18.0
|
||||||
|
|
||||||
@interface TorrentTableView : NSOutlineView
|
@interface TorrentTableView : NSOutlineView <QLPreviewPanelDataSource, QLPreviewPanelDelegate>
|
||||||
{
|
{
|
||||||
IBOutlet Controller * fController;
|
IBOutlet Controller * fController;
|
||||||
|
|
||||||
|
@ -51,6 +52,8 @@
|
||||||
|
|
||||||
CGFloat fPiecesBarPercent;
|
CGFloat fPiecesBarPercent;
|
||||||
NSAnimation * fPiecesBarAnimation;
|
NSAnimation * fPiecesBarAnimation;
|
||||||
|
|
||||||
|
QLPreviewPanel * fPreviewPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isGroupCollapsed: (NSInteger) value;
|
- (BOOL) isGroupCollapsed: (NSInteger) value;
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#import "TorrentGroup.h"
|
#import "TorrentGroup.h"
|
||||||
#import "FileListNode.h"
|
#import "FileListNode.h"
|
||||||
#import "NSApplicationAdditions.h"
|
#import "NSApplicationAdditions.h"
|
||||||
#import "QuickLookController.h"
|
|
||||||
|
|
||||||
#define MAX_GROUP 999999
|
#define MAX_GROUP 999999
|
||||||
|
|
||||||
|
@ -53,6 +52,8 @@
|
||||||
|
|
||||||
- (void) createFileMenu: (NSMenu *) menu forFiles: (NSArray *) files;
|
- (void) createFileMenu: (NSMenu *) menu forFiles: (NSArray *) files;
|
||||||
|
|
||||||
|
- (NSArray *) quickLookableTorrents;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation TorrentTableView
|
@implementation TorrentTableView
|
||||||
|
@ -86,6 +87,8 @@
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
[fPreviewPanel release];
|
||||||
|
|
||||||
[fCollapsedGroups release];
|
[fCollapsedGroups release];
|
||||||
|
|
||||||
[fPiecesBarAnimation release];
|
[fPiecesBarAnimation release];
|
||||||
|
@ -497,20 +500,11 @@
|
||||||
|
|
||||||
if (firstChar == 'f' && [event modifierFlags] & NSAlternateKeyMask && [event modifierFlags] & NSCommandKeyMask)
|
if (firstChar == 'f' && [event modifierFlags] & NSAlternateKeyMask && [event modifierFlags] & NSCommandKeyMask)
|
||||||
[fController focusFilterField];
|
[fController focusFilterField];
|
||||||
|
else if (firstChar == ' ')
|
||||||
|
[fController toggleQuickLook: self];
|
||||||
else
|
else
|
||||||
{
|
|
||||||
//handle quicklook
|
|
||||||
if (firstChar == ' ')
|
|
||||||
[[QuickLookController quickLook] toggleQuickLook];
|
|
||||||
else if (firstChar == NSRightArrowFunctionKey)
|
|
||||||
[[QuickLookController quickLook] pressRight];
|
|
||||||
else if (firstChar == NSLeftArrowFunctionKey)
|
|
||||||
[[QuickLookController quickLook] pressLeft];
|
|
||||||
else;
|
|
||||||
|
|
||||||
[super keyDown: event];
|
[super keyDown: event];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (NSRect) iconRectForRow: (NSInteger) row
|
- (NSRect) iconRectForRow: (NSInteger) row
|
||||||
{
|
{
|
||||||
|
@ -875,6 +869,71 @@
|
||||||
return fPiecesBarPercent;
|
return fPiecesBarPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL) acceptsPreviewPanelControl: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) beginPreviewPanelControl: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
fPreviewPanel = [panel retain];
|
||||||
|
fPreviewPanel.delegate = self;
|
||||||
|
fPreviewPanel.dataSource = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) endPreviewPanelControl: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
[fPreviewPanel release];
|
||||||
|
fPreviewPanel = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger) numberOfPreviewItemsInPreviewPanel: (QLPreviewPanel *) panel
|
||||||
|
{
|
||||||
|
return [[self quickLookableTorrents] count];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id <QLPreviewItem>) previewPanel: (QLPreviewPanel *)panel previewItemAtIndex: (NSInteger) index
|
||||||
|
{
|
||||||
|
return [[self quickLookableTorrents] objectAtIndex: index];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) previewPanel: (QLPreviewPanel *) panel handleEvent: (NSEvent *) event
|
||||||
|
{
|
||||||
|
if ([event type] == NSKeyDown)
|
||||||
|
{
|
||||||
|
[super keyDown: event];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect) previewPanel: (QLPreviewPanel *) panel sourceFrameOnScreenForPreviewItem: (id <QLPreviewItem>) item
|
||||||
|
{
|
||||||
|
const NSInteger row = [self rowForItem: item];
|
||||||
|
if (row == -1)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
|
NSRect frame = [self iconRectForRow: row];
|
||||||
|
frame.origin = [self convertPoint: frame.origin toView: nil];
|
||||||
|
frame.origin = [[self window] convertBaseToScreen: frame.origin];
|
||||||
|
frame.origin.y -= frame.size.height;
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation TorrentTableView (Private)
|
@implementation TorrentTableView (Private)
|
||||||
|
@ -945,4 +1004,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) quickLookableTorrents
|
||||||
|
{
|
||||||
|
NSArray * selectedTorrents = [self selectedTorrents];
|
||||||
|
NSMutableArray * qlArray = [NSMutableArray arrayWithCapacity: [selectedTorrents count]];
|
||||||
|
|
||||||
|
for (Torrent * torrent in selectedTorrents)
|
||||||
|
if (([torrent isFolder] || [torrent isComplete]) && [[NSFileManager defaultManager] fileExistsAtPath: [torrent dataLocation]])
|
||||||
|
[qlArray addObject: torrent];
|
||||||
|
|
||||||
|
return qlArray;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue