feat: Align active filter macOS (#3944)
This commit is contained in:
parent
91e5cf31f6
commit
d2ee0d2d08
|
@ -2823,7 +2823,7 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
|
|||
//check status
|
||||
if (torrent.active && !torrent.checkingWaiting)
|
||||
{
|
||||
BOOL const isActive = !torrent.stalled;
|
||||
BOOL const isActive = torrent.transmitting;
|
||||
if (isActive)
|
||||
{
|
||||
std::atomic_fetch_add_explicit(activeRef, 1, std::memory_order_relaxed);
|
||||
|
|
|
@ -127,7 +127,10 @@ extern NSString* const kTorrentDidChangeGroupNotification;
|
|||
|
||||
@property(nonatomic, readonly) CGFloat availableDesired;
|
||||
|
||||
/// True if non-paused. Running.
|
||||
@property(nonatomic, getter=isActive, readonly) BOOL active;
|
||||
/// True if downloading or uploading.
|
||||
@property(nonatomic, getter=isTransmitting, readonly) BOOL transmitting;
|
||||
@property(nonatomic, getter=isSeeding, readonly) BOOL seeding;
|
||||
@property(nonatomic, getter=isChecking, readonly) BOOL checking;
|
||||
@property(nonatomic, getter=isCheckingWaiting, readonly) BOOL checkingWaiting;
|
||||
|
@ -200,6 +203,7 @@ extern NSString* const kTorrentDidChangeGroupNotification;
|
|||
@property(nonatomic, readonly) NSInteger secondsSeeding;
|
||||
|
||||
@property(nonatomic, readonly) NSInteger stalledMinutes;
|
||||
/// True if the torrent is running, but has been idle for long enough to be considered stalled.
|
||||
@property(nonatomic, getter=isStalled, readonly) BOOL stalled;
|
||||
|
||||
- (void)updateTimeMachineExclude;
|
||||
|
|
|
@ -264,12 +264,12 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
|
|||
- (void)update
|
||||
{
|
||||
//get previous stalled value before update
|
||||
BOOL const wasStalled = self.fStat != NULL && self.stalled;
|
||||
BOOL const wasTransmitting = self.fStat != NULL && self.transmitting;
|
||||
|
||||
self.fStat = tr_torrentStat(self.fHandle);
|
||||
|
||||
//make sure the "active" filter is updated when stalled-ness changes
|
||||
if (wasStalled != self.stalled)
|
||||
//make sure the "active" filter is updated when transmitting changes
|
||||
if (wasTransmitting != self.transmitting)
|
||||
{
|
||||
//posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time
|
||||
[NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateQueue" object:self]
|
||||
|
@ -869,6 +869,12 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
|
|||
self.fStat->activity != TR_STATUS_SEED_WAIT;
|
||||
}
|
||||
|
||||
- (BOOL)isTransmitting
|
||||
{
|
||||
return self.fStat->peersGettingFromUs > 0 || self.fStat->peersSendingToUs > 0 || self.fStat->webseedsSendingToUs > 0 ||
|
||||
self.fStat->activity == TR_STATUS_CHECK;
|
||||
}
|
||||
|
||||
- (BOOL)isSeeding
|
||||
{
|
||||
return self.fStat->activity == TR_STATUS_SEED;
|
||||
|
|
Loading…
Reference in New Issue