mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
allow quicklook of transfers through the inspector; add a quicklook button; move quicklook code from the file controller to the info controller
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">9C7010</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">652</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">658</string>
|
||||
<string key="IBDocument.AppKitVersion">949.26</string>
|
||||
<string key="IBDocument.HIToolboxVersion">352.00</string>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="1030"/>
|
||||
<integer value="6"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -38,14 +38,14 @@
|
||||
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
|
||||
<string key="NSWindowContentMinSize">{350, 73}</string>
|
||||
<object class="NSView" key="NSWindowView" id="429007171">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSTextField" id="974784210">
|
||||
<reference key="NSNextResponder" ref="429007171"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{47, 47}, {286, 17}}</string>
|
||||
<string key="NSFrame">{{47, 47}, {259, 17}}</string>
|
||||
<reference key="NSSuperview" ref="429007171"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="585844623">
|
||||
@@ -113,7 +113,7 @@
|
||||
<object class="NSTextField" id="843033231">
|
||||
<reference key="NSNextResponder" ref="429007171"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{47, 32}, {286, 14}}</string>
|
||||
<string key="NSFrame">{{47, 33}, {296, 14}}</string>
|
||||
<reference key="NSSuperview" ref="429007171"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="615989236">
|
||||
@@ -401,8 +401,33 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
|
||||
</object>
|
||||
<bool key="NSEditable">YES</bool>
|
||||
</object>
|
||||
<object class="NSButton" id="624970840">
|
||||
<reference key="NSNextResponder" ref="429007171"/>
|
||||
<int key="NSvFlags">265</int>
|
||||
<string key="NSFrame">{{311, 38}, {29, 17}}</string>
|
||||
<reference key="NSSuperview" ref="429007171"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="269704195">
|
||||
<int key="NSCellFlags">-2080244224</int>
|
||||
<int key="NSCellFlags2">134348800</int>
|
||||
<string key="NSContents"/>
|
||||
<reference key="NSSupport" ref="26"/>
|
||||
<reference key="NSControlView" ref="624970840"/>
|
||||
<int key="NSButtonFlags">-2030288641</int>
|
||||
<int key="NSButtonFlags2">164</int>
|
||||
<object class="NSCustomResource" key="NSNormalImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSQuickLookTemplate</string>
|
||||
</object>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">400</int>
|
||||
<int key="NSPeriodicInterval">75</int>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{350, 75}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
|
||||
<string key="NSMinSize">{350, 89}</string>
|
||||
@@ -958,6 +983,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
|
||||
</object>
|
||||
<string key="NSFrame">{{1, 1}, {245, 56}}</string>
|
||||
<reference key="NSSuperview" ref="876850876"/>
|
||||
<reference key="NSNextKeyView" ref="927236344"/>
|
||||
<reference key="NSDocView" ref="927236344"/>
|
||||
<reference key="NSBGColor" ref="880039277"/>
|
||||
<object class="NSCursor" key="NSCursor" id="954883728">
|
||||
@@ -990,6 +1016,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
|
||||
</object>
|
||||
<string key="NSFrame">{{82, 124}, {258, 58}}</string>
|
||||
<reference key="NSSuperview" ref="179482273"/>
|
||||
<reference key="NSNextKeyView" ref="268896745"/>
|
||||
<int key="NSsFlags">18</int>
|
||||
<reference key="NSVScroller" ref="682089170"/>
|
||||
<reference key="NSHScroller" ref="349837992"/>
|
||||
@@ -1308,6 +1335,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
|
||||
</object>
|
||||
<string key="NSFrame">{{1, 1}, {252, 56}}</string>
|
||||
<reference key="NSSuperview" ref="489927889"/>
|
||||
<reference key="NSNextKeyView" ref="54323570"/>
|
||||
<reference key="NSDocView" ref="54323570"/>
|
||||
<reference key="NSBGColor" ref="880039277"/>
|
||||
<reference key="NSCursor" ref="954883728"/>
|
||||
@@ -1337,6 +1365,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
|
||||
</object>
|
||||
<string key="NSFrame">{{85, 82}, {265, 58}}</string>
|
||||
<reference key="NSSuperview" ref="717510682"/>
|
||||
<reference key="NSNextKeyView" ref="556622786"/>
|
||||
<int key="NSsFlags">18</int>
|
||||
<reference key="NSVScroller" ref="274712367"/>
|
||||
<reference key="NSHScroller" ref="963469134"/>
|
||||
@@ -2180,7 +2209,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
|
||||
<string key="NSExtension">NSResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomView" id="180459949">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -4090,7 +4119,6 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{360, 342}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<string key="NSClassName">NSView</string>
|
||||
<string key="NSExtension">NSResponder</string>
|
||||
</object>
|
||||
@@ -5648,6 +5676,14 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
<int key="connectionID">1749</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">toggleQuickLook:</string>
|
||||
<reference key="source" ref="1016287627"/>
|
||||
<reference key="destination" ref="624970840"/>
|
||||
</object>
|
||||
<int key="connectionID">1752</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
@@ -5695,9 +5731,10 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="974784210"/>
|
||||
<reference ref="40615128"/>
|
||||
<reference ref="843033231"/>
|
||||
<reference ref="1020839921"/>
|
||||
<reference ref="80002672"/>
|
||||
<reference ref="843033231"/>
|
||||
<reference ref="624970840"/>
|
||||
</object>
|
||||
<reference key="parent" ref="571546118"/>
|
||||
</object>
|
||||
@@ -7890,6 +7927,20 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
<reference key="object" ref="927236344"/>
|
||||
<reference key="parent" ref="876850876"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1750</int>
|
||||
<reference key="object" ref="624970840"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="269704195"/>
|
||||
</object>
|
||||
<reference key="parent" ref="429007171"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1751</int>
|
||||
<reference key="object" ref="269704195"/>
|
||||
<reference key="parent" ref="624970840"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
@@ -8171,10 +8222,13 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
<string>1747.IBShouldRemoveOnLegacySave</string>
|
||||
<string>1748.IBPluginDependency</string>
|
||||
<string>1748.ImportedFromIB2</string>
|
||||
<string>1750.IBPluginDependency</string>
|
||||
<string>1751.IBPluginDependency</string>
|
||||
<string>28.IBPluginDependency</string>
|
||||
<string>28.ImportedFromIB2</string>
|
||||
<string>29.IBPluginDependency</string>
|
||||
<string>29.ImportedFromIB2</string>
|
||||
<string>5.IBEditorWindowLastContentRect</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>5.IBWindowTemplateEditedContentRect</string>
|
||||
<string>5.ImportedFromIB2</string>
|
||||
@@ -8551,11 +8605,14 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference ref="9"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference ref="9"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference ref="9"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{687, 827}, {350, 75}}</string>
|
||||
<reference ref="9"/>
|
||||
<string>{{0, 926}, {350, 75}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{0, 926}, {350, 75}}</string>
|
||||
<reference ref="9"/>
|
||||
<string>{{687, 827}, {350, 75}}</string>
|
||||
<reference ref="9"/>
|
||||
@@ -8673,7 +8730,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">1749</int>
|
||||
<int key="maxID">1752</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -8733,6 +8790,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">FirstResponder</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
@@ -8770,6 +8828,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
<string>setSpeedLimit:</string>
|
||||
<string>setSpeedMode:</string>
|
||||
<string>setTab:</string>
|
||||
<string>toggleQuickLook:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -8782,6 +8841,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
@@ -8939,6 +8999,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSApplication</string>
|
||||
<string key="superclassName">NSResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
@@ -8946,6 +9007,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSLevelIndicatorCell</string>
|
||||
<string key="superclassName">NSActionCell</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
@@ -8960,18 +9022,12 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSMenu</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/IPCController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
@@ -9002,6 +9058,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSSegmentedControl</string>
|
||||
<string key="superclassName">NSControl</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
@@ -9058,7 +9115,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.LastKnownRelativeProjectPath">../../../Transmission.xcodeproj</string>
|
||||
<string key="IBDocument.LastKnownRelativeProjectPath">../../Transmission.xcodeproj</string>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
</data>
|
||||
</archive>
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
Torrent * fTorrent;
|
||||
|
||||
IBOutlet FileOutlineView * fOutline;
|
||||
|
||||
BOOL fQuickLookAvailable;
|
||||
}
|
||||
|
||||
- (FileOutlineView *) outlineView;
|
||||
|
||||
- (void) setTorrent: (Torrent *) torrent;
|
||||
|
||||
- (void) reloadData;
|
||||
@@ -46,13 +46,4 @@
|
||||
|
||||
- (void) revealFile: (id) sender;
|
||||
|
||||
- (void) userDidPressSpaceInOutlineView: (id) outlineView;
|
||||
- (void) userDidPressRightInOutlineView: (id) outlineView;
|
||||
- (void) userDidPressLeftInOutlineView: (id) outlineView;
|
||||
|
||||
- (BOOL) quickLookSelectedItems;
|
||||
- (int) visibleRowWithURL: (NSURL*) url;
|
||||
|
||||
- (void) fileTabClosed;
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
#import "FilePriorityCell.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
|
||||
#import "QuickLook.h"
|
||||
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
|
||||
|
||||
#define ROW_SMALL_HEIGHT 18.0
|
||||
|
||||
typedef enum
|
||||
@@ -66,12 +63,6 @@ typedef enum
|
||||
"file table -> header tool tip")];
|
||||
[[fOutline tableColumnWithIdentifier: @"Priority"] setHeaderToolTip: NSLocalizedString(@"Priority",
|
||||
"file table -> header tool tip")];
|
||||
|
||||
//load the QuickLook framework and set the delegate, no point on trying this on Tiger
|
||||
//animation types: 0 = none; 1 = fade; 2 = zoom
|
||||
fQuickLookAvailable = [[NSBundle bundleWithPath: @"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load];
|
||||
if (fQuickLookAvailable)
|
||||
[[[QLPreviewPanel sharedPreviewPanel] windowController] setDelegate: self];
|
||||
}
|
||||
|
||||
[fOutline setMenu: [self menu]];
|
||||
@@ -79,116 +70,14 @@ typedef enum
|
||||
[self setTorrent: nil];
|
||||
}
|
||||
|
||||
- (void) fileTabClosed
|
||||
- (FileOutlineView *) outlineView
|
||||
{
|
||||
if (fQuickLookAvailable)
|
||||
{
|
||||
if ([[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 0];
|
||||
}
|
||||
}
|
||||
|
||||
// This is the QuickLook delegate method
|
||||
// It should return the frame for the item represented by the URL
|
||||
// If an empty frame is returned then the panel will fade in/out instead
|
||||
- (NSRect) previewPanel: (NSPanel *) panel frameForURL: (NSURL *) url
|
||||
{
|
||||
NSRect frame = NSZeroRect;
|
||||
int row = [self visibleRowWithURL: url];
|
||||
|
||||
if (row != -1)
|
||||
{
|
||||
frame = [fOutline rectOfRow: row];
|
||||
frame.origin = [fOutline convertPoint: frame.origin toView: nil];
|
||||
frame.origin = [[fOutline window] convertBaseToScreen: frame.origin];
|
||||
frame.origin.y -= frame.size.height;
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
- (int) visibleRowWithURL: (NSURL *) url
|
||||
{
|
||||
NSString * fullPath = [url path];
|
||||
NSString * folder = [fTorrent downloadFolder];
|
||||
NSRange visibleRows = [fOutline rowsInRect: [fOutline bounds]];
|
||||
|
||||
int row;
|
||||
for (row = visibleRows.location; row <= row + visibleRows.length; row++)
|
||||
{
|
||||
id rowItem = [fOutline itemAtRow: row];
|
||||
if ([[folder stringByAppendingPathComponent: [rowItem objectForKey: @"Path"]] isEqualToString: fullPath])
|
||||
return row;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (void) userDidPressSpaceInOutlineView: (id) outlineView
|
||||
{
|
||||
if (fQuickLookAvailable)
|
||||
{
|
||||
if ([[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 2];
|
||||
else
|
||||
{
|
||||
if ([self quickLookSelectedItems])
|
||||
{
|
||||
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFrontWithEffect: 2];
|
||||
// Restore the focus to our window to demo the selection changing, scrolling (left/right)
|
||||
// and closing (space) functionality
|
||||
[[fOutline window] makeKeyWindow];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) userDidPressRightInOutlineView: (id) outlineView
|
||||
{
|
||||
if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] selectNextItem];
|
||||
}
|
||||
|
||||
- (void) userDidPressLeftInOutlineView: (id) outlineView
|
||||
{
|
||||
if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] selectPreviousItem];
|
||||
}
|
||||
|
||||
- (BOOL) quickLookSelectedItems
|
||||
{
|
||||
if (fQuickLookAvailable)
|
||||
{
|
||||
NSString * folder = [fTorrent downloadFolder];
|
||||
NSIndexSet * indexes = [fOutline selectedRowIndexes];
|
||||
NSMutableArray * urlArray = [NSMutableArray arrayWithCapacity: [indexes count]];
|
||||
|
||||
int i;
|
||||
for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
{
|
||||
id item = [fOutline itemAtRow: i];
|
||||
if ([[item objectForKey: @"IsFolder"] boolValue]
|
||||
|| [fTorrent fileProgress: [[item objectForKey: @"Indexes"] firstIndex]] == 1.0)
|
||||
[urlArray addObject: [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [item objectForKey: @"Path"]]]];
|
||||
}
|
||||
|
||||
if ([urlArray count])
|
||||
{
|
||||
[[QLPreviewPanel sharedPreviewPanel] setURLs: urlArray currentIndex: 0 preservingDisplayState: YES];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
return fOutline;
|
||||
}
|
||||
|
||||
- (void) outlineViewSelectionDidChange: (NSNotification *) notification
|
||||
{
|
||||
if (fQuickLookAvailable)
|
||||
{
|
||||
// If the user changes the selection while the panel is open then update the current items
|
||||
if ([[QLPreviewPanel sharedPreviewPanel] isOpen] && ![self quickLookSelectedItems])
|
||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 1];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQuickLook" object: self];
|
||||
}
|
||||
|
||||
- (void) setTorrent: (Torrent *) torrent
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#import "FileOutlineView.h"
|
||||
#import "FileOutlineController.h"
|
||||
#import "InfoWindowController.h"
|
||||
#import "FileNameCell.h"
|
||||
#import "FilePriorityCell.h"
|
||||
#import "Torrent.h"
|
||||
@@ -88,11 +89,11 @@
|
||||
{
|
||||
unichar firstChar = [[event charactersIgnoringModifiers] characterAtIndex: 0];
|
||||
if (firstChar == ' ')
|
||||
[(FileOutlineController *)[super delegate] userDidPressSpaceInOutlineView: self];
|
||||
[(InfoWindowController *)[[self window] windowController] toggleQuickLook: nil];
|
||||
else if (firstChar == NSRightArrowFunctionKey)
|
||||
[(FileOutlineController *)[super delegate] userDidPressRightInOutlineView: self];
|
||||
[(InfoWindowController *)[[self window] windowController] quickLookPressRight];
|
||||
else if (firstChar == NSLeftArrowFunctionKey)
|
||||
[(FileOutlineController *)[super delegate] userDidPressLeftInOutlineView: self];
|
||||
[(InfoWindowController *)[[self window] windowController] quickLookPressLeft];
|
||||
else;
|
||||
|
||||
[super keyDown: event];
|
||||
|
||||
@@ -66,6 +66,8 @@
|
||||
IBOutlet NSTextField * fUploadLimitField, * fDownloadLimitField, * fRatioLimitField, * fPeersConnectField,
|
||||
* fUploadLimitLabel, * fDownloadLimitLabel;
|
||||
|
||||
BOOL fQuickLookAvailable;
|
||||
|
||||
NSString * fInitialString;
|
||||
}
|
||||
|
||||
@@ -78,6 +80,14 @@
|
||||
- (void) setNextTab;
|
||||
- (void) setPreviousTab;
|
||||
|
||||
- (int) visibleRowWithURL: (NSURL*) url;
|
||||
- (BOOL) quickLookSelectItems;
|
||||
- (void) toggleQuickLook: (id) sender;
|
||||
- (void) updateQuickLook;
|
||||
|
||||
- (void) quickLookPressLeft;
|
||||
- (void) quickLookPressRight;
|
||||
|
||||
- (void) setPiecesView: (id) sender;
|
||||
- (void) setPiecesViewForAvailable: (BOOL) available;
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#import "NSApplicationAdditions.h"
|
||||
#import "NSStringAdditions.h"
|
||||
|
||||
#import "QuickLook.h"
|
||||
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
|
||||
|
||||
#define TAB_INFO_IDENT @"Info"
|
||||
#define TAB_ACTIVITY_IDENT @"Activity"
|
||||
#define TAB_TRACKER_IDENT @"Tracker"
|
||||
@@ -138,6 +141,12 @@ typedef enum
|
||||
[revealOn release];
|
||||
[revealOff release];
|
||||
|
||||
//load the QuickLook framework and set the delegate, no point on trying this on Tiger
|
||||
//animation types: 0 = none; 1 = fade; 2 = zoom
|
||||
fQuickLookAvailable = [[NSBundle bundleWithPath: @"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load];
|
||||
if (fQuickLookAvailable)
|
||||
[[[QLPreviewPanel sharedPreviewPanel] windowController] setDelegate: self];
|
||||
|
||||
//initially sort peer table by IP
|
||||
if ([[fPeerTable sortDescriptors] count] == 0)
|
||||
[fPeerTable setSortDescriptors: [NSArray arrayWithObject: [[fPeerTable tableColumnWithIdentifier: @"IP"]
|
||||
@@ -163,6 +172,7 @@ typedef enum
|
||||
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver: self selector: @selector(updateInfoStats) name: @"UpdateStats" object: nil];
|
||||
[nc addObserver: self selector: @selector(updateOptions) name: @"UpdateOptions" object: nil];
|
||||
[nc addObserver: self selector: @selector(updateQuickLook) name: @"UpdateQuickLook" object: nil];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
@@ -592,7 +602,8 @@ typedef enum
|
||||
|
||||
- (void) windowWillClose: (NSNotification *) notification
|
||||
{
|
||||
[fFileController fileTabClosed];
|
||||
if (fQuickLookAvailable)
|
||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 0];
|
||||
}
|
||||
|
||||
- (void) setTab: (id) sender
|
||||
@@ -624,7 +635,7 @@ typedef enum
|
||||
oldResizeSaveKey = @"InspectorContentHeightPeers";
|
||||
break;
|
||||
case TAB_FILES_TAG:
|
||||
[fFileController fileTabClosed];
|
||||
[self updateQuickLook];
|
||||
|
||||
oldResizeSaveKey = @"InspectorContentHeightFiles";
|
||||
break;
|
||||
@@ -891,6 +902,156 @@ typedef enum
|
||||
return nil;
|
||||
}
|
||||
|
||||
// This is the QuickLook delegate method
|
||||
// It should return the frame for the item represented by the URL
|
||||
// If an empty frame is returned then the panel will fade in/out instead
|
||||
- (NSRect) previewPanel: (NSPanel *) panel frameForURL: (NSURL *) url
|
||||
{
|
||||
if (fCurrentTabTag == TAB_FILES_TAG && [[fFileController outlineView] numberOfSelectedRows] > 0)
|
||||
{
|
||||
int row = [self visibleRowWithURL: url];
|
||||
if (row != -1)
|
||||
{
|
||||
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
||||
|
||||
NSRect frame = [fileOutlineView rectOfRow: row];
|
||||
frame.origin = [fileOutlineView convertPoint: frame.origin toView: nil];
|
||||
frame.origin = [[self window] convertBaseToScreen: frame.origin];
|
||||
frame.origin.y -= frame.size.height;
|
||||
return frame;
|
||||
}
|
||||
else
|
||||
return NSZeroRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRect frame = [fImageView frame];
|
||||
frame.origin = [[self window] convertBaseToScreen: frame.origin];
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
#warning needed?
|
||||
- (int) visibleRowWithURL: (NSURL *) url
|
||||
{
|
||||
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
||||
|
||||
NSString * fullPath = [url path];
|
||||
NSString * folder = [[fTorrents objectAtIndex: 0] downloadFolder];
|
||||
NSRange visibleRows = [fileOutlineView rowsInRect: [fileOutlineView bounds]];
|
||||
|
||||
int row;
|
||||
for (row = visibleRows.location; row <= row + visibleRows.length; row++)
|
||||
{
|
||||
id rowItem = [fileOutlineView itemAtRow: row];
|
||||
if ([[folder stringByAppendingPathComponent: [rowItem objectForKey: @"Path"]] isEqualToString: fullPath])
|
||||
return row;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (BOOL) quickLookSelectItems
|
||||
{
|
||||
if (!fQuickLookAvailable)
|
||||
return NO;
|
||||
|
||||
NSMutableArray * urlArray = nil;
|
||||
|
||||
FileOutlineView * fileOutlineView = [fFileController outlineView];
|
||||
if (fCurrentTabTag == TAB_FILES_TAG && [fileOutlineView numberOfSelectedRows] > 0)
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSString * folder = [torrent downloadFolder];
|
||||
NSIndexSet * indexes = [fileOutlineView selectedRowIndexes];
|
||||
urlArray = [NSMutableArray arrayWithCapacity: [indexes count]];
|
||||
|
||||
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)
|
||||
[urlArray addObject: [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [item objectForKey: @"Path"]]]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([fTorrents count] > 0)
|
||||
{
|
||||
urlArray = [NSMutableArray arrayWithCapacity: [fTorrents count]];
|
||||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
Torrent * torrent;
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
{
|
||||
if ([torrent folder] || [torrent progress] == 1.0)
|
||||
[urlArray addObject: [NSURL fileURLWithPath: [torrent dataLocation]]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (urlArray && [urlArray count] > 0)
|
||||
{
|
||||
[[QLPreviewPanel sharedPreviewPanel] setURLs: urlArray currentIndex: 0 preservingDisplayState: YES];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) toggleQuickLook: (id) sender
|
||||
{
|
||||
if (!fQuickLookAvailable)
|
||||
return;
|
||||
|
||||
if ([[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 2];
|
||||
else
|
||||
{
|
||||
if ([self quickLookSelectItems])
|
||||
{
|
||||
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFrontWithEffect: 2];
|
||||
// Restore the focus to our window to demo the selection changing, scrolling (left/right)
|
||||
// and closing (space) functionality
|
||||
[[self window] makeKeyWindow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateQuickLook
|
||||
{
|
||||
if (!fQuickLookAvailable || ![[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
return;
|
||||
|
||||
//if the user changes the selection while the panel is open then update the current items
|
||||
if (![self quickLookSelectItems])
|
||||
[[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 1];
|
||||
}
|
||||
|
||||
- (void) quickLookPressLeft
|
||||
{
|
||||
if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] selectPreviousItem];
|
||||
}
|
||||
|
||||
- (void) quickLookPressRight
|
||||
{
|
||||
if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen])
|
||||
[[QLPreviewPanel sharedPreviewPanel] selectNextItem];
|
||||
}
|
||||
|
||||
- (void) keyDown: (NSEvent *) event
|
||||
{
|
||||
unichar firstChar = [[event charactersIgnoringModifiers] characterAtIndex: 0];
|
||||
if (firstChar == ' ')
|
||||
[self toggleQuickLook: nil];
|
||||
else if (firstChar == NSRightArrowFunctionKey)
|
||||
[self quickLookPressRight];
|
||||
else if (firstChar == NSLeftArrowFunctionKey)
|
||||
[self quickLookPressLeft];
|
||||
else
|
||||
[super keyDown: event];
|
||||
}
|
||||
|
||||
- (void) setPiecesView: (id) sender
|
||||
{
|
||||
[self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE];
|
||||
|
||||
Reference in New Issue
Block a user