New menu item to start all torrents waiting to start (in queue).

This commit is contained in:
Mitchell Livingston 2006-08-01 23:09:33 +00:00
parent 8121f8bb45
commit d5e6d5a1fd
5 changed files with 55 additions and 25 deletions

View File

@ -100,7 +100,9 @@
- (void) resumeSelectedTorrents: (id) sender;
- (void) resumeAllTorrents: (id) sender;
- (void) resumeWaitingTorrents: (id) sender;
- (void) resumeTorrents: (NSArray *) torrents;
- (void) stopSelectedTorrents: (id) sender;
- (void) stopAllTorrents: (id) sender;
- (void) stopTorrents: (NSArray *) torrents;

View File

@ -553,6 +553,19 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[self resumeTorrents: fTorrents];
}
- (void) resumeWaitingTorrents: (id) sender
{
NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [fTorrents count]];
NSEnumerator * enumerator = [fTorrents objectEnumerator];
Torrent * torrent;
while ((torrent = [enumerator nextObject]))
if ([torrent waitingToStart])
[torrents addObject: torrent];
[self resumeTorrents: torrents];
}
- (void) resumeTorrents: (NSArray *) torrents
{
[torrents makeObjectsPerformSelector: @selector(startTransfer)];
@ -1924,28 +1937,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
return canUseMenu;
}
//enable resume all item
if (action == @selector(resumeAllTorrents:))
{
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isPaused])
return YES;
return NO;
}
//enable pause all item
if (action == @selector(stopAllTorrents:))
{
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isActive])
return YES;
return NO;
}
//enable reveal in finder
if (action == @selector(revealFile:))
return canUseMenu && [fTableView numberOfSelectedRows] > 0;
@ -1994,6 +1985,42 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
return canUseMenu && canDelete && [fTableView numberOfSelectedRows] > 0;
}
//enable pause all item
if (action == @selector(stopAllTorrents:))
{
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isActive])
return YES;
return NO;
}
//enable resume all item
if (action == @selector(resumeAllTorrents:))
{
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent isPaused])
return YES;
return NO;
}
//enable resume waiting item
if (action == @selector(resumeWaitingTorrents:))
{
if (![[fDefaults stringForKey: @"StartSetting"] isEqualToString: @"Wait"])
return NO;
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
if ([torrent waitingToStart])
return YES;
return NO;
}
//enable pause item
if (action == @selector(stopSelectedTorrents:))
{

View File

@ -15,6 +15,7 @@
removeNoDelete = id;
resumeAllTorrents = id;
resumeSelectedTorrents = id;
resumeWaitingTorrents = id;
revealFile = id;
setFilter = id;
setInfoTab = id;

View File

@ -11,9 +11,9 @@
<key>1480</key>
<string>366 546 420 63 0 0 1152 842 </string>
<key>1603</key>
<string>337 544 477 67 0 0 1152 842 </string>
<string>337 545 477 67 0 0 1152 842 </string>
<key>29</key>
<string>9 780 451 44 0 0 1152 842 </string>
<string>207 725 451 44 0 0 1152 842 </string>
<key>456</key>
<string>396 374 216 206 0 0 1152 842 </string>
<key>581</key>
@ -32,7 +32,7 @@
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>1603</integer>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8J135</string>

Binary file not shown.