mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
feat: Align active filter macOS (#3944)
This commit is contained in:
@@ -2823,7 +2823,7 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
|
|||||||
//check status
|
//check status
|
||||||
if (torrent.active && !torrent.checkingWaiting)
|
if (torrent.active && !torrent.checkingWaiting)
|
||||||
{
|
{
|
||||||
BOOL const isActive = !torrent.stalled;
|
BOOL const isActive = torrent.transmitting;
|
||||||
if (isActive)
|
if (isActive)
|
||||||
{
|
{
|
||||||
std::atomic_fetch_add_explicit(activeRef, 1, std::memory_order_relaxed);
|
std::atomic_fetch_add_explicit(activeRef, 1, std::memory_order_relaxed);
|
||||||
|
|||||||
@@ -127,7 +127,10 @@ extern NSString* const kTorrentDidChangeGroupNotification;
|
|||||||
|
|
||||||
@property(nonatomic, readonly) CGFloat availableDesired;
|
@property(nonatomic, readonly) CGFloat availableDesired;
|
||||||
|
|
||||||
|
/// True if non-paused. Running.
|
||||||
@property(nonatomic, getter=isActive, readonly) BOOL active;
|
@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=isSeeding, readonly) BOOL seeding;
|
||||||
@property(nonatomic, getter=isChecking, readonly) BOOL checking;
|
@property(nonatomic, getter=isChecking, readonly) BOOL checking;
|
||||||
@property(nonatomic, getter=isCheckingWaiting, readonly) BOOL checkingWaiting;
|
@property(nonatomic, getter=isCheckingWaiting, readonly) BOOL checkingWaiting;
|
||||||
@@ -200,6 +203,7 @@ extern NSString* const kTorrentDidChangeGroupNotification;
|
|||||||
@property(nonatomic, readonly) NSInteger secondsSeeding;
|
@property(nonatomic, readonly) NSInteger secondsSeeding;
|
||||||
|
|
||||||
@property(nonatomic, readonly) NSInteger stalledMinutes;
|
@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;
|
@property(nonatomic, getter=isStalled, readonly) BOOL stalled;
|
||||||
|
|
||||||
- (void)updateTimeMachineExclude;
|
- (void)updateTimeMachineExclude;
|
||||||
|
|||||||
@@ -264,12 +264,12 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
|
|||||||
- (void)update
|
- (void)update
|
||||||
{
|
{
|
||||||
//get previous stalled value before 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);
|
self.fStat = tr_torrentStat(self.fHandle);
|
||||||
|
|
||||||
//make sure the "active" filter is updated when stalled-ness changes
|
//make sure the "active" filter is updated when transmitting changes
|
||||||
if (wasStalled != self.stalled)
|
if (wasTransmitting != self.transmitting)
|
||||||
{
|
{
|
||||||
//posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time
|
//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]
|
[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;
|
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
|
- (BOOL)isSeeding
|
||||||
{
|
{
|
||||||
return self.fStat->activity == TR_STATUS_SEED;
|
return self.fStat->activity == TR_STATUS_SEED;
|
||||||
|
|||||||
Reference in New Issue
Block a user