Changeset 5939
- Timestamp:
- May 27, 2008, 4:20:25 AM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r5938 r5939 4208 4208 } 4209 4209 4210 /*- (void) ipcQuit4211 {4212 fRemoteQuit = YES;4213 [NSApp terminate: self];4214 }4215 4216 - (NSArray *) ipcGetTorrentsByID: (NSArray *) idlist4217 {4218 if (!idlist)4219 return fTorrents;4220 4221 NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [idlist count]];4222 4223 NSEnumerator * torrentEnum = [fTorrents objectEnumerator];4224 Torrent * torrent;4225 while ((torrent = [torrentEnum nextObject]))4226 {4227 int torId = [torrent torrentID];4228 4229 NSEnumerator * idEnum = [idlist objectEnumerator];4230 NSNumber * tempId;4231 while ((tempId = [idEnum nextObject]))4232 {4233 if ([tempId intValue] == torId)4234 {4235 [torrents addObject: torrent];4236 break;4237 }4238 }4239 }4240 4241 return torrents;4242 }4243 4244 - (NSArray *) ipcGetTorrentsByHash: (NSArray *) hashlist4245 {4246 if (!hashlist)4247 return fTorrents;4248 4249 NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [hashlist count]];4250 4251 NSEnumerator * torrentEnum = [fTorrents objectEnumerator];4252 Torrent * torrent;4253 while ((torrent = [torrentEnum nextObject]))4254 {4255 NSString * torHash = [torrent hashString], * tempHash;4256 4257 NSEnumerator * hashEnum = [hashlist objectEnumerator];4258 while ((tempHash = [hashEnum nextObject]))4259 {4260 if ([torHash caseInsensitiveCompare: tempHash] == NSOrderedSame)4261 {4262 [torrents addObject: torrent];4263 break;4264 }4265 }4266 }4267 4268 return torrents;4269 }4270 4271 - (BOOL) ipcAddTorrents: (NSArray *) torrents4272 {4273 int oldCount = [fTorrents count];4274 4275 [self openFiles: torrents addType: ADD_NORMAL forcePath: nil];4276 4277 return [fTorrents count] > oldCount;4278 }4279 4280 - (BOOL) ipcAddTorrentFile: (NSString *) path directory: (NSString *) directory4281 {4282 int oldCount = [fTorrents count];4283 4284 [self openFiles: [NSArray arrayWithObject: path] addType: ADD_NORMAL forcePath: directory];4285 4286 return [fTorrents count] > oldCount;4287 }4288 4289 - (BOOL) ipcAddTorrentFileAutostart: (NSString *) path directory: (NSString *) directory autostart: (BOOL) autostart4290 {4291 NSArray * torrents = nil;4292 if (autostart)4293 torrents = [fTorrents copy];4294 BOOL success = [self ipcAddTorrentFile: path directory: directory];4295 4296 if (success && autostart)4297 {4298 NSEnumerator * enumerator = [torrents reverseObjectEnumerator];4299 Torrent * torrent;4300 while ((torrent = [enumerator nextObject]))4301 if (![torrents containsObject: torrent])4302 break;4303 4304 if (torrent)4305 [torrent startTransfer];4306 else4307 success = NO;4308 }4309 4310 [torrents release];4311 return success;4312 }4313 4314 - (BOOL) ipcAddTorrentData: (NSData *) data directory: (NSString *) directory4315 {4316 return [self ipcAddTorrentDataAutostart: data directory: directory autostart: [fDefaults boolForKey: @"AutoStartDownload"]];4317 }4318 4319 - (BOOL) ipcAddTorrentDataAutostart: (NSData *) data directory: (NSString *) directory autostart: (BOOL) autostart4320 {4321 Torrent * torrent;4322 if ((torrent = [[Torrent alloc] initWithData: data location: directory lib: fLib]))4323 {4324 [torrent update];4325 [fTorrents addObject: torrent];4326 4327 if (autostart)4328 [torrent startTransfer];4329 4330 [torrent release];4331 4332 [self updateTorrentsInQueue];4333 return YES;4334 }4335 else4336 return NO;4337 }4338 4339 - (BOOL) ipcStartTorrents: (NSArray *) torrents4340 {4341 if (!torrents)4342 [self resumeAllTorrents: self];4343 else4344 [self resumeTorrents: torrents];4345 4346 return YES;4347 }4348 4349 - (BOOL) ipcStopTorrents: (NSArray *) torrents4350 {4351 if (!torrents)4352 [self stopAllTorrents: self];4353 else4354 [self stopTorrents: torrents];4355 4356 return YES;4357 }4358 4359 - (BOOL) ipcVerifyTorrents: (NSArray *) torrents4360 {4361 if (!torrents)4362 return NO;4363 4364 [self verifyTorrents: torrents];4365 return YES;4366 }4367 4368 - (BOOL) ipcRemoveTorrents: (NSArray *) torrents4369 {4370 if (!torrents)4371 torrents = [NSArray arrayWithArray: fTorrents];4372 [torrents retain];4373 4374 [self confirmRemoveTorrents: torrents deleteData: NO deleteTorrent: NO];4375 4376 return YES;4377 }*/4378 4379 4210 @end -
trunk/macosx/TorrentCell.m
r5835 r5939 775 775 pieceColor = fBlue4Color; 776 776 777 if (![pieceColor isEqual: [fBitmap colorAtX: i y: 0]])778 777 //it is faster to just set color instead of checking color 778 [fBitmap setColor: pieceColor atX: i y: 0]; 779 779 } 780 780
Note: See TracChangeset
for help on using the changeset viewer.