Changeset 5864
- Timestamp:
- May 20, 2008, 11:04:23 PM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/English.lproj/InfoWindow.xib
r5716 r5864 4 4 <int key="IBDocument.SystemTarget">1050</int> 5 5 <string key="IBDocument.SystemVersion">9C7010</string> 6 <string key="IBDocument.InterfaceBuilderVersion">65 2</string>6 <string key="IBDocument.InterfaceBuilderVersion">658</string> 7 7 <string key="IBDocument.AppKitVersion">949.26</string> 8 8 <string key="IBDocument.HIToolboxVersion">352.00</string> 9 9 <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> 10 10 <bool key="EncodedWithXMLCoder">YES</bool> 11 <integer value=" 1030"/>11 <integer value="6"/> 12 12 </object> 13 13 <object class="NSArray" key="IBDocument.PluginDependencies"> … … 39 39 <string key="NSWindowContentMinSize">{350, 73}</string> 40 40 <object class="NSView" key="NSWindowView" id="429007171"> 41 < nilkey="NSNextResponder"/>41 <reference key="NSNextResponder"/> 42 42 <int key="NSvFlags">256</int> 43 43 <object class="NSMutableArray" key="NSSubviews"> … … 46 46 <reference key="NSNextResponder" ref="429007171"/> 47 47 <int key="NSvFlags">266</int> 48 <string key="NSFrame">{{47, 47}, {2 86, 17}}</string>48 <string key="NSFrame">{{47, 47}, {259, 17}}</string> 49 49 <reference key="NSSuperview" ref="429007171"/> 50 50 <bool key="NSEnabled">YES</bool> … … 114 114 <reference key="NSNextResponder" ref="429007171"/> 115 115 <int key="NSvFlags">266</int> 116 <string key="NSFrame">{{47, 3 2}, {286, 14}}</string>116 <string key="NSFrame">{{47, 33}, {296, 14}}</string> 117 117 <reference key="NSSuperview" ref="429007171"/> 118 118 <bool key="NSEnabled">YES</bool> … … 402 402 <bool key="NSEditable">YES</bool> 403 403 </object> 404 <object class="NSButton" id="624970840"> 405 <reference key="NSNextResponder" ref="429007171"/> 406 <int key="NSvFlags">265</int> 407 <string key="NSFrame">{{311, 38}, {29, 17}}</string> 408 <reference key="NSSuperview" ref="429007171"/> 409 <bool key="NSEnabled">YES</bool> 410 <object class="NSButtonCell" key="NSCell" id="269704195"> 411 <int key="NSCellFlags">-2080244224</int> 412 <int key="NSCellFlags2">134348800</int> 413 <string key="NSContents"/> 414 <reference key="NSSupport" ref="26"/> 415 <reference key="NSControlView" ref="624970840"/> 416 <int key="NSButtonFlags">-2030288641</int> 417 <int key="NSButtonFlags2">164</int> 418 <object class="NSCustomResource" key="NSNormalImage"> 419 <string key="NSClassName">NSImage</string> 420 <string key="NSResourceName">NSQuickLookTemplate</string> 421 </object> 422 <string key="NSAlternateContents"/> 423 <string key="NSKeyEquivalent"/> 424 <int key="NSPeriodicDelay">400</int> 425 <int key="NSPeriodicInterval">75</int> 426 </object> 427 </object> 404 428 </object> 405 429 <string key="NSFrameSize">{350, 75}</string> 430 <reference key="NSSuperview"/> 406 431 </object> 407 432 <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> … … 959 984 <string key="NSFrame">{{1, 1}, {245, 56}}</string> 960 985 <reference key="NSSuperview" ref="876850876"/> 986 <reference key="NSNextKeyView" ref="927236344"/> 961 987 <reference key="NSDocView" ref="927236344"/> 962 988 <reference key="NSBGColor" ref="880039277"/> … … 991 1017 <string key="NSFrame">{{82, 124}, {258, 58}}</string> 992 1018 <reference key="NSSuperview" ref="179482273"/> 1019 <reference key="NSNextKeyView" ref="268896745"/> 993 1020 <int key="NSsFlags">18</int> 994 1021 <reference key="NSVScroller" ref="682089170"/> … … 1309 1336 <string key="NSFrame">{{1, 1}, {252, 56}}</string> 1310 1337 <reference key="NSSuperview" ref="489927889"/> 1338 <reference key="NSNextKeyView" ref="54323570"/> 1311 1339 <reference key="NSDocView" ref="54323570"/> 1312 1340 <reference key="NSBGColor" ref="880039277"/> … … 1338 1366 <string key="NSFrame">{{85, 82}, {265, 58}}</string> 1339 1367 <reference key="NSSuperview" ref="717510682"/> 1368 <reference key="NSNextKeyView" ref="556622786"/> 1340 1369 <int key="NSsFlags">18</int> 1341 1370 <reference key="NSVScroller" ref="274712367"/> … … 2181 2210 </object> 2182 2211 <object class="NSCustomView" id="180459949"> 2183 < referencekey="NSNextResponder"/>2212 <nil key="NSNextResponder"/> 2184 2213 <int key="NSvFlags">274</int> 2185 2214 <object class="NSMutableArray" key="NSSubviews"> … … 4091 4120 </object> 4092 4121 <string key="NSFrameSize">{360, 342}</string> 4093 <reference key="NSSuperview"/>4094 4122 <string key="NSClassName">NSView</string> 4095 4123 <string key="NSExtension">NSResponder</string> … … 5649 5677 <int key="connectionID">1749</int> 5650 5678 </object> 5679 <object class="IBConnectionRecord"> 5680 <object class="IBActionConnection" key="connection"> 5681 <string key="label">toggleQuickLook:</string> 5682 <reference key="source" ref="1016287627"/> 5683 <reference key="destination" ref="624970840"/> 5684 </object> 5685 <int key="connectionID">1752</int> 5686 </object> 5651 5687 </object> 5652 5688 <object class="IBMutableOrderedSet" key="objectRecords"> … … 5696 5732 <reference ref="974784210"/> 5697 5733 <reference ref="40615128"/> 5698 <reference ref="843033231"/>5699 5734 <reference ref="1020839921"/> 5700 5735 <reference ref="80002672"/> 5736 <reference ref="843033231"/> 5737 <reference ref="624970840"/> 5701 5738 </object> 5702 5739 <reference key="parent" ref="571546118"/> … … 7890 7927 <reference key="object" ref="927236344"/> 7891 7928 <reference key="parent" ref="876850876"/> 7929 </object> 7930 <object class="IBObjectRecord"> 7931 <int key="objectID">1750</int> 7932 <reference key="object" ref="624970840"/> 7933 <object class="NSMutableArray" key="children"> 7934 <bool key="EncodedWithXMLCoder">YES</bool> 7935 <reference ref="269704195"/> 7936 </object> 7937 <reference key="parent" ref="429007171"/> 7938 </object> 7939 <object class="IBObjectRecord"> 7940 <int key="objectID">1751</int> 7941 <reference key="object" ref="269704195"/> 7942 <reference key="parent" ref="624970840"/> 7892 7943 </object> 7893 7944 </object> … … 8172 8223 <string>1748.IBPluginDependency</string> 8173 8224 <string>1748.ImportedFromIB2</string> 8225 <string>1750.IBPluginDependency</string> 8226 <string>1751.IBPluginDependency</string> 8174 8227 <string>28.IBPluginDependency</string> 8175 8228 <string>28.ImportedFromIB2</string> 8176 8229 <string>29.IBPluginDependency</string> 8177 8230 <string>29.ImportedFromIB2</string> 8231 <string>5.IBEditorWindowLastContentRect</string> 8178 8232 <string>5.IBPluginDependency</string> 8179 8233 <string>5.IBWindowTemplateEditedContentRect</string> … … 8552 8606 <reference ref="9"/> 8553 8607 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8554 <reference ref="9"/> 8555 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8556 <reference ref="9"/> 8557 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8558 <string>{{687, 827}, {350, 75}}</string> 8608 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8609 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8610 <reference ref="9"/> 8611 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8612 <reference ref="9"/> 8613 <string>{{0, 926}, {350, 75}}</string> 8614 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 8615 <string>{{0, 926}, {350, 75}}</string> 8559 8616 <reference ref="9"/> 8560 8617 <string>{{687, 827}, {350, 75}}</string> … … 8674 8731 </object> 8675 8732 <nil key="sourceID"/> 8676 <int key="maxID">17 49</int>8733 <int key="maxID">1752</int> 8677 8734 </object> 8678 8735 <object class="IBClassDescriber" key="IBDocument.Classes"> … … 8734 8791 <object class="IBPartialClassDescription"> 8735 8792 <string key="className">FirstResponder</string> 8793 <string key="superclassName">NSObject</string> 8736 8794 <object class="IBClassDescriptionSource" key="sourceIdentifier"> 8737 8795 <string key="majorKey">IBUserSource</string> … … 8771 8829 <string>setSpeedMode:</string> 8772 8830 <string>setTab:</string> 8831 <string>toggleQuickLook:</string> 8773 8832 </object> 8774 8833 <object class="NSMutableArray" key="dict.values"> 8775 8834 <bool key="EncodedWithXMLCoder">YES</bool> 8835 <string>id</string> 8776 8836 <string>id</string> 8777 8837 <string>id</string> … … 8940 9000 <object class="IBPartialClassDescription"> 8941 9001 <string key="className">NSApplication</string> 9002 <string key="superclassName">NSResponder</string> 8942 9003 <object class="IBClassDescriptionSource" key="sourceIdentifier"> 8943 9004 <string key="majorKey">IBUserSource</string> … … 8947 9008 <object class="IBPartialClassDescription"> 8948 9009 <string key="className">NSLevelIndicatorCell</string> 9010 <string key="superclassName">NSActionCell</string> 8949 9011 <object class="IBClassDescriptionSource" key="sourceIdentifier"> 8950 9012 <string key="majorKey">IBUserSource</string> … … 8961 9023 <object class="IBPartialClassDescription"> 8962 9024 <string key="className">NSMenu</string> 9025 <string key="superclassName">NSObject</string> 8963 9026 <object class="IBClassDescriptionSource" key="sourceIdentifier"> 8964 9027 <string key="majorKey">IBUserSource</string> 8965 9028 <string key="minorKey"/> 8966 </object>8967 </object>8968 <object class="IBPartialClassDescription">8969 <string key="className">NSObject</string>8970 <object class="IBClassDescriptionSource" key="sourceIdentifier">8971 <string key="majorKey">IBProjectSource</string>8972 <string key="minorKey">macosx/IPCController.h</string>8973 9029 </object> 8974 9030 </object> … … 9003 9059 <object class="IBPartialClassDescription"> 9004 9060 <string key="className">NSSegmentedControl</string> 9061 <string key="superclassName">NSControl</string> 9005 9062 <object class="IBClassDescriptionSource" key="sourceIdentifier"> 9006 9063 <string key="majorKey">IBUserSource</string> … … 9059 9116 </object> 9060 9117 <int key="IBDocument.localizationMode">0</int> 9061 <string key="IBDocument.LastKnownRelativeProjectPath">../../ ../Transmission.xcodeproj</string>9118 <string key="IBDocument.LastKnownRelativeProjectPath">../../Transmission.xcodeproj</string> 9062 9119 <int key="IBDocument.defaultPropertyAccessControl">3</int> 9063 9120 </data> -
trunk/macosx/FileOutlineController.h
r5862 r5864 33 33 34 34 IBOutlet FileOutlineView * fOutline; 35 36 BOOL fQuickLookAvailable;37 35 } 36 37 - (FileOutlineView *) outlineView; 38 38 39 39 - (void) setTorrent: (Torrent *) torrent; … … 47 47 - (void) revealFile: (id) sender; 48 48 49 - (void) userDidPressSpaceInOutlineView: (id) outlineView;50 - (void) userDidPressRightInOutlineView: (id) outlineView;51 - (void) userDidPressLeftInOutlineView: (id) outlineView;52 53 - (BOOL) quickLookSelectedItems;54 - (int) visibleRowWithURL: (NSURL*) url;55 56 - (void) fileTabClosed;57 58 49 @end -
trunk/macosx/FileOutlineController.m
r5863 r5864 29 29 #import "NSApplicationAdditions.h" 30 30 31 #import "QuickLook.h"32 #define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")33 34 31 #define ROW_SMALL_HEIGHT 18.0 35 32 … … 67 64 [[fOutline tableColumnWithIdentifier: @"Priority"] setHeaderToolTip: NSLocalizedString(@"Priority", 68 65 "file table -> header tool tip")]; 69 70 //load the QuickLook framework and set the delegate, no point on trying this on Tiger71 //animation types: 0 = none; 1 = fade; 2 = zoom72 fQuickLookAvailable = [[NSBundle bundleWithPath: @"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load];73 if (fQuickLookAvailable)74 [[[QLPreviewPanel sharedPreviewPanel] windowController] setDelegate: self];75 66 } 76 67 … … 80 71 } 81 72 82 - (void) fileTabClosed 83 { 84 if (fQuickLookAvailable) 85 { 86 if ([[QLPreviewPanel sharedPreviewPanel] isOpen]) 87 [[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 0]; 88 } 89 } 90 91 // This is the QuickLook delegate method 92 // It should return the frame for the item represented by the URL 93 // If an empty frame is returned then the panel will fade in/out instead 94 - (NSRect) previewPanel: (NSPanel *) panel frameForURL: (NSURL *) url 95 { 96 NSRect frame = NSZeroRect; 97 int row = [self visibleRowWithURL: url]; 98 99 if (row != -1) 100 { 101 frame = [fOutline rectOfRow: row]; 102 frame.origin = [fOutline convertPoint: frame.origin toView: nil]; 103 frame.origin = [[fOutline window] convertBaseToScreen: frame.origin]; 104 frame.origin.y -= frame.size.height; 105 } 106 107 return frame; 108 } 109 110 - (int) visibleRowWithURL: (NSURL *) url 111 { 112 NSString * fullPath = [url path]; 113 NSString * folder = [fTorrent downloadFolder]; 114 NSRange visibleRows = [fOutline rowsInRect: [fOutline bounds]]; 115 116 int row; 117 for (row = visibleRows.location; row <= row + visibleRows.length; row++) 118 { 119 id rowItem = [fOutline itemAtRow: row]; 120 if ([[folder stringByAppendingPathComponent: [rowItem objectForKey: @"Path"]] isEqualToString: fullPath]) 121 return row; 122 } 123 return -1; 124 } 125 126 - (void) userDidPressSpaceInOutlineView: (id) outlineView 127 { 128 if (fQuickLookAvailable) 129 { 130 if ([[QLPreviewPanel sharedPreviewPanel] isOpen]) 131 [[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 2]; 132 else 133 { 134 if ([self quickLookSelectedItems]) 135 { 136 [[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFrontWithEffect: 2]; 137 // Restore the focus to our window to demo the selection changing, scrolling (left/right) 138 // and closing (space) functionality 139 [[fOutline window] makeKeyWindow]; 140 } 141 } 142 } 143 } 144 145 - (void) userDidPressRightInOutlineView: (id) outlineView 146 { 147 if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen]) 148 [[QLPreviewPanel sharedPreviewPanel] selectNextItem]; 149 } 150 151 - (void) userDidPressLeftInOutlineView: (id) outlineView 152 { 153 if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen]) 154 [[QLPreviewPanel sharedPreviewPanel] selectPreviousItem]; 155 } 156 157 - (BOOL) quickLookSelectedItems 158 { 159 if (fQuickLookAvailable) 160 { 161 NSString * folder = [fTorrent downloadFolder]; 162 NSIndexSet * indexes = [fOutline selectedRowIndexes]; 163 NSMutableArray * urlArray = [NSMutableArray arrayWithCapacity: [indexes count]]; 164 165 int i; 166 for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i]) 167 { 168 id item = [fOutline itemAtRow: i]; 169 if ([[item objectForKey: @"IsFolder"] boolValue] 170 || [fTorrent fileProgress: [[item objectForKey: @"Indexes"] firstIndex]] == 1.0) 171 [urlArray addObject: [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [item objectForKey: @"Path"]]]]; 172 } 173 174 if ([urlArray count]) 175 { 176 [[QLPreviewPanel sharedPreviewPanel] setURLs: urlArray currentIndex: 0 preservingDisplayState: YES]; 177 return YES; 178 } 179 else 180 return NO; 181 } 73 - (FileOutlineView *) outlineView 74 { 75 return fOutline; 182 76 } 183 77 184 78 - (void) outlineViewSelectionDidChange: (NSNotification *) notification 185 79 { 186 if (fQuickLookAvailable) 187 { 188 // If the user changes the selection while the panel is open then update the current items 189 if ([[QLPreviewPanel sharedPreviewPanel] isOpen] && ![self quickLookSelectedItems]) 190 [[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 1]; 191 } 80 [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQuickLook" object: self]; 192 81 } 193 82 -
trunk/macosx/FileOutlineView.m
r5862 r5864 25 25 #import "FileOutlineView.h" 26 26 #import "FileOutlineController.h" 27 #import "InfoWindowController.h" 27 28 #import "FileNameCell.h" 28 29 #import "FilePriorityCell.h" … … 89 90 unichar firstChar = [[event charactersIgnoringModifiers] characterAtIndex: 0]; 90 91 if (firstChar == ' ') 91 [( FileOutlineController *)[super delegate] userDidPressSpaceInOutlineView: self];92 [(InfoWindowController *)[[self window] windowController] toggleQuickLook: nil]; 92 93 else if (firstChar == NSRightArrowFunctionKey) 93 [( FileOutlineController *)[super delegate] userDidPressRightInOutlineView: self];94 [(InfoWindowController *)[[self window] windowController] quickLookPressRight]; 94 95 else if (firstChar == NSLeftArrowFunctionKey) 95 [( FileOutlineController *)[super delegate] userDidPressLeftInOutlineView: self];96 [(InfoWindowController *)[[self window] windowController] quickLookPressLeft]; 96 97 else; 97 98 -
trunk/macosx/InfoWindowController.h
r5139 r5864 67 67 * fUploadLimitLabel, * fDownloadLimitLabel; 68 68 69 BOOL fQuickLookAvailable; 70 69 71 NSString * fInitialString; 70 72 } … … 78 80 - (void) setNextTab; 79 81 - (void) setPreviousTab; 82 83 - (int) visibleRowWithURL: (NSURL*) url; 84 - (BOOL) quickLookSelectItems; 85 - (void) toggleQuickLook: (id) sender; 86 - (void) updateQuickLook; 87 88 - (void) quickLookPressLeft; 89 - (void) quickLookPressRight; 80 90 81 91 - (void) setPiecesView: (id) sender; -
trunk/macosx/InfoWindowController.m
r5862 r5864 28 28 #import "NSStringAdditions.h" 29 29 30 #import "QuickLook.h" 31 #define QLPreviewPanel NSClassFromString(@"QLPreviewPanel") 32 30 33 #define TAB_INFO_IDENT @"Info" 31 34 #define TAB_ACTIVITY_IDENT @"Activity" … … 139 142 [revealOff release]; 140 143 144 //load the QuickLook framework and set the delegate, no point on trying this on Tiger 145 //animation types: 0 = none; 1 = fade; 2 = zoom 146 fQuickLookAvailable = [[NSBundle bundleWithPath: @"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load]; 147 if (fQuickLookAvailable) 148 [[[QLPreviewPanel sharedPreviewPanel] windowController] setDelegate: self]; 149 141 150 //initially sort peer table by IP 142 151 if ([[fPeerTable sortDescriptors] count] == 0) … … 164 173 [nc addObserver: self selector: @selector(updateInfoStats) name: @"UpdateStats" object: nil]; 165 174 [nc addObserver: self selector: @selector(updateOptions) name: @"UpdateOptions" object: nil]; 175 [nc addObserver: self selector: @selector(updateQuickLook) name: @"UpdateQuickLook" object: nil]; 166 176 } 167 177 … … 593 603 - (void) windowWillClose: (NSNotification *) notification 594 604 { 595 [fFileController fileTabClosed]; 605 if (fQuickLookAvailable) 606 [[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 0]; 596 607 } 597 608 … … 625 636 break; 626 637 case TAB_FILES_TAG: 627 [ fFileController fileTabClosed];638 [self updateQuickLook]; 628 639 629 640 oldResizeSaveKey = @"InspectorContentHeightFiles"; … … 890 901 } 891 902 return nil; 903 } 904 905 // This is the QuickLook delegate method 906 // It should return the frame for the item represented by the URL 907 // If an empty frame is returned then the panel will fade in/out instead 908 - (NSRect) previewPanel: (NSPanel *) panel frameForURL: (NSURL *) url 909 { 910 if (fCurrentTabTag == TAB_FILES_TAG && [[fFileController outlineView] numberOfSelectedRows] > 0) 911 { 912 int row = [self visibleRowWithURL: url]; 913 if (row != -1) 914 { 915 FileOutlineView * fileOutlineView = [fFileController outlineView]; 916 917 NSRect frame = [fileOutlineView rectOfRow: row]; 918 frame.origin = [fileOutlineView convertPoint: frame.origin toView: nil]; 919 frame.origin = [[self window] convertBaseToScreen: frame.origin]; 920 frame.origin.y -= frame.size.height; 921 return frame; 922 } 923 else 924 return NSZeroRect; 925 } 926 else 927 { 928 NSRect frame = [fImageView frame]; 929 frame.origin = [[self window] convertBaseToScreen: frame.origin]; 930 return frame; 931 } 932 } 933 934 #warning needed? 935 - (int) visibleRowWithURL: (NSURL *) url 936 { 937 FileOutlineView * fileOutlineView = [fFileController outlineView]; 938 939 NSString * fullPath = [url path]; 940 NSString * folder = [[fTorrents objectAtIndex: 0] downloadFolder]; 941 NSRange visibleRows = [fileOutlineView rowsInRect: [fileOutlineView bounds]]; 942 943 int row; 944 for (row = visibleRows.location; row <= row + visibleRows.length; row++) 945 { 946 id rowItem = [fileOutlineView itemAtRow: row]; 947 if ([[folder stringByAppendingPathComponent: [rowItem objectForKey: @"Path"]] isEqualToString: fullPath]) 948 return row; 949 } 950 return -1; 951 } 952 953 - (BOOL) quickLookSelectItems 954 { 955 if (!fQuickLookAvailable) 956 return NO; 957 958 NSMutableArray * urlArray = nil; 959 960 FileOutlineView * fileOutlineView = [fFileController outlineView]; 961 if (fCurrentTabTag == TAB_FILES_TAG && [fileOutlineView numberOfSelectedRows] > 0) 962 { 963 Torrent * torrent = [fTorrents objectAtIndex: 0]; 964 NSString * folder = [torrent downloadFolder]; 965 NSIndexSet * indexes = [fileOutlineView selectedRowIndexes]; 966 urlArray = [NSMutableArray arrayWithCapacity: [indexes count]]; 967 968 int i; 969 for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i]) 970 { 971 NSDictionary * item = [fileOutlineView itemAtRow: i]; 972 if ([[item objectForKey: @"IsFolder"] boolValue] 973 || [torrent fileProgress: [[item objectForKey: @"Indexes"] firstIndex]] == 1.0) 974 [urlArray addObject: [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [item objectForKey: @"Path"]]]]; 975 } 976 } 977 else 978 { 979 if ([fTorrents count] > 0) 980 { 981 urlArray = [NSMutableArray arrayWithCapacity: [fTorrents count]]; 982 NSEnumerator * enumerator = [fTorrents objectEnumerator]; 983 Torrent * torrent; 984 while ((torrent = [enumerator nextObject])) 985 { 986 if ([torrent folder] || [torrent progress] == 1.0) 987 [urlArray addObject: [NSURL fileURLWithPath: [torrent dataLocation]]]; 988 } 989 } 990 } 991 992 if (urlArray && [urlArray count] > 0) 993 { 994 [[QLPreviewPanel sharedPreviewPanel] setURLs: urlArray currentIndex: 0 preservingDisplayState: YES]; 995 return YES; 996 } 997 else 998 return NO; 999 } 1000 1001 - (void) toggleQuickLook: (id) sender 1002 { 1003 if (!fQuickLookAvailable) 1004 return; 1005 1006 if ([[QLPreviewPanel sharedPreviewPanel] isOpen]) 1007 [[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 2]; 1008 else 1009 { 1010 if ([self quickLookSelectItems]) 1011 { 1012 [[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFrontWithEffect: 2]; 1013 // Restore the focus to our window to demo the selection changing, scrolling (left/right) 1014 // and closing (space) functionality 1015 [[self window] makeKeyWindow]; 1016 } 1017 } 1018 } 1019 1020 - (void) updateQuickLook 1021 { 1022 if (!fQuickLookAvailable || ![[QLPreviewPanel sharedPreviewPanel] isOpen]) 1023 return; 1024 1025 //if the user changes the selection while the panel is open then update the current items 1026 if (![self quickLookSelectItems]) 1027 [[QLPreviewPanel sharedPreviewPanel] closeWithEffect: 1]; 1028 } 1029 1030 - (void) quickLookPressLeft 1031 { 1032 if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen]) 1033 [[QLPreviewPanel sharedPreviewPanel] selectPreviousItem]; 1034 } 1035 1036 - (void) quickLookPressRight 1037 { 1038 if (fQuickLookAvailable && [[QLPreviewPanel sharedPreviewPanel] isOpen]) 1039 [[QLPreviewPanel sharedPreviewPanel] selectNextItem]; 1040 } 1041 1042 - (void) keyDown: (NSEvent *) event 1043 { 1044 unichar firstChar = [[event charactersIgnoringModifiers] characterAtIndex: 0]; 1045 if (firstChar == ' ') 1046 [self toggleQuickLook: nil]; 1047 else if (firstChar == NSRightArrowFunctionKey) 1048 [self quickLookPressRight]; 1049 else if (firstChar == NSLeftArrowFunctionKey) 1050 [self quickLookPressLeft]; 1051 else 1052 [super keyDown: event]; 892 1053 } 893 1054
Note: See TracChangeset
for help on using the changeset viewer.