Changeset 2137
- Timestamp:
- Jun 17, 2007, 5:04:13 PM (15 years ago)
- Location:
- branches/file_selection/macosx
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/file_selection/macosx/Controller.m
r2136 r2137 2128 2128 if ([[pasteboard types] containsObject: NSFilenamesPboardType]) 2129 2129 { 2130 //check if any files can be added2130 //check if any torrent files can be added 2131 2131 NSArray * files = [pasteboard propertyListForType: NSFilenamesPboardType]; 2132 2132 NSEnumerator * enumerator = [files objectEnumerator]; 2133 2133 NSString * file; 2134 2134 tr_torrent_t * tempTor; 2135 BOOL torrent = NO; 2135 2136 while ((file = [enumerator nextObject])) 2136 2137 { … … 2146 2147 return NSDragOperationCopy; 2147 2148 } 2149 else 2150 { 2151 if (error == TR_EUNSUPPORTED || error == TR_EDUPLICATE) 2152 torrent = YES; 2153 } 2154 } 2155 2156 //create a torrent file if a single file 2157 if (!torrent && [files count] == 1) 2158 { 2159 if (!fOverlayWindow) 2160 fOverlayWindow = [[DragOverlayWindow alloc] initWithLib: fLib forWindow: fWindow]; 2161 [fOverlayWindow setFile: [[files objectAtIndex: 0] lastPathComponent]]; 2162 2163 return NSDragOperationCopy; 2148 2164 } 2149 2165 } … … 2175 2191 if ([[pasteboard types] containsObject: NSFilenamesPboardType]) 2176 2192 { 2193 BOOL torrent = NO, accept = YES; 2194 2177 2195 //create an array of files that can be opened 2178 2196 NSMutableArray * filesToOpen = [[NSMutableArray alloc] init]; 2179 NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator]; 2197 NSArray * files = [pasteboard propertyListForType: NSFilenamesPboardType]; 2198 NSEnumerator * enumerator = [files objectEnumerator]; 2180 2199 NSString * file; 2181 2200 tr_torrent_t * tempTor; … … 2187 2206 tr_torrentClose(tempTor); 2188 2207 [filesToOpen addObject: file]; 2208 2209 torrent = YES; 2189 2210 } 2190 } 2191 2192 [self application: NSApp openFiles: filesToOpen]; 2211 else 2212 { 2213 if (error == TR_EUNSUPPORTED || error == TR_EDUPLICATE) 2214 torrent = YES; 2215 } 2216 } 2217 2218 if ([filesToOpen count] > 0) 2219 [self application: NSApp openFiles: filesToOpen]; 2220 else 2221 { 2222 if (!torrent && [files count] == 1) 2223 [CreatorWindowController createTorrentFile: fLib forFile: [files objectAtIndex: 0]]; 2224 else 2225 accept = NO; 2226 } 2193 2227 [filesToOpen release]; 2194 2228 2195 return YES;2229 return accept; 2196 2230 } 2197 2231 else if ([[pasteboard types] containsObject: NSURLPboardType]) -
branches/file_selection/macosx/CreatorWindowController.h
r2130 r2137 45 45 46 46 + (void) createTorrentFile: (tr_handle_t *) handle; 47 + (void) createTorrentFile: (tr_handle_t *) handle forFile: (NSString *) file; 47 48 48 49 - (id) initWithWindowNibName: (NSString *) name handle: (tr_handle_t *) handle path: (NSString *) path; -
branches/file_selection/macosx/CreatorWindowController.m
r2134 r2137 50 50 } 51 51 52 + (void) createTorrentFile: (tr_handle_t *) handle forFile: (NSString *) file 53 { 54 CreatorWindowController * creator = [[self alloc] initWithWindowNibName: @"Creator" handle: handle path: file]; 55 [creator showWindow: nil]; 56 } 57 52 58 - (id) initWithWindowNibName: (NSString *) name handle: (tr_handle_t *) handle path: (NSString *) path 53 59 { -
branches/file_selection/macosx/DragOverlayWindow.h
r2136 r2137 34 34 35 35 - (id) initWithLib: (tr_handle_t *) lib forWindow: (NSWindow *) window; 36 36 37 - (void) setTorrents: (NSArray *) files; 38 - (void) setFile: (NSString *) file; 37 39 - (void) setURL: (NSString *) url; 38 40 -
branches/file_selection/macosx/DragOverlayWindow.m
r2136 r2137 143 143 } 144 144 145 - (void) setFile: (NSString *) file 146 { 147 148 [[self contentView] setOverlay: [NSImage imageNamed: @"Create.png"] 149 mainLine: NSLocalizedString(@"Create a Torrent File", "Drag overlay -> file") subLine: file]; 150 151 //stop other animation and set to same progress 152 if ([fFadeOutAnimation isAnimating]) 153 { 154 [fFadeOutAnimation stopAnimation]; 155 [fFadeInAnimation setCurrentProgress: 1.0 - [fFadeOutAnimation currentProgress]]; 156 } 157 [self setFrame: [[self parentWindow] frame] display: YES]; 158 [fFadeInAnimation startAnimation]; 159 } 160 161 145 162 - (void) setURL: (NSString *) url 146 163 {
Note: See TracChangeset
for help on using the changeset viewer.