add ability to enable/disable the ability to prevent sleeping with active transfers
This commit is contained in:
parent
8252e12434
commit
c443e88444
|
@ -1842,12 +1842,13 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
filtering = YES;
|
||||
|
||||
#warning check multiple trackers
|
||||
NSString * filterType = [fDefaults stringForKey: @"FilterSearchType"];
|
||||
NSString * fullString;
|
||||
Torrent * torrent;
|
||||
|
||||
int i;
|
||||
for (i = [tempTorrents count] - 1; i >= 0; i--)
|
||||
for (i = [tempTorrents count]-1; i >= 0; i--)
|
||||
{
|
||||
torrent = [tempTorrents objectAtIndex: i];
|
||||
if ([filterType isEqualToString: FILTER_TYPE_TRACKER])
|
||||
|
@ -3034,7 +3035,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
NSEnumerator * enumerator;
|
||||
Torrent * torrent;
|
||||
BOOL active;
|
||||
BOOL active, canSleep;
|
||||
|
||||
switch (messageType)
|
||||
{
|
||||
|
@ -3058,20 +3059,24 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
break;
|
||||
|
||||
case kIOMessageCanSystemSleep:
|
||||
//pevent idle sleep unless all paused
|
||||
active = NO;
|
||||
|
||||
canSleep = YES;
|
||||
if ([fDefaults boolForKey: @"SleepPrevent"])
|
||||
{
|
||||
//prevent idle sleep unless all inactive
|
||||
enumerator = [fTorrents objectEnumerator];
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
if ([torrent isActive] && ![torrent isStalled] && ![torrent isError])
|
||||
{
|
||||
active = YES;
|
||||
canSleep = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (active)
|
||||
IOCancelPowerChange(fRootPort, (long) messageArgument);
|
||||
else
|
||||
if (canSleep)
|
||||
IOAllowPowerChange(fRootPort, (long) messageArgument);
|
||||
else
|
||||
IOCancelPowerChange(fRootPort, (long) messageArgument);
|
||||
break;
|
||||
|
||||
case kIOMessageSystemHasPoweredOn:
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
<string>Submarine</string>
|
||||
<key>ShowInspector</key>
|
||||
<false/>
|
||||
<key>SleepPrevent</key>
|
||||
<true/>
|
||||
<key>SmallStatusRegular</key>
|
||||
<true/>
|
||||
<key>SmallView</key>
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>19 79 356 240 0 0 1152 842 </string>
|
||||
<string>32 103 356 240 0 0 1680 1028 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>153</key>
|
||||
<string>294 444 563 268 0 0 1152 842 </string>
|
||||
<string>558 568 583 268 0 0 1680 1028 </string>
|
||||
<key>28</key>
|
||||
<string>138 430 563 313 0 0 1152 842 </string>
|
||||
<string>558 511 583 348 0 0 1680 1028 </string>
|
||||
<key>41</key>
|
||||
<string>294 426 563 305 0 0 1152 842 </string>
|
||||
<string>548 550 583 305 0 0 1680 1028 </string>
|
||||
<key>66</key>
|
||||
<string>294 506 563 144 0 0 1152 842 </string>
|
||||
<string>334 527 583 144 0 0 1680 1028 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>446.1</string>
|
||||
|
@ -23,9 +23,9 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>28</integer>
|
||||
<integer>153</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8R218</string>
|
||||
<string>8R4031</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue