mirror of
https://github.com/transmission/transmission
synced 2025-03-10 14:13:23 +00:00
only show the eta string for idle seeding time remaining if the time is less than 2 minutes
This commit is contained in:
parent
c3715ca6ce
commit
ef3865ec45
3 changed files with 22 additions and 10 deletions
|
@ -1817,7 +1817,7 @@ typedef struct tr_stat
|
|||
/** If downloading, estimated number of seconds left until the torrent is done.
|
||||
If seeding, estimated number of seconds left until seed ratio is reached. */
|
||||
int eta;
|
||||
/** If seeding, number of seconds left until the idle time limit is reached.. */
|
||||
/** If seeding, number of seconds left until the idle time limit is reached. */
|
||||
int etaIdle;
|
||||
|
||||
/** Number of peers that the tracker says this torrent has */
|
||||
|
|
|
@ -90,8 +90,6 @@
|
|||
- (BOOL) isMagnet;
|
||||
- (NSString *) magnetLink;
|
||||
|
||||
- (BOOL) seedLimitSet;
|
||||
|
||||
- (CGFloat) ratio;
|
||||
- (tr_ratiolimit) ratioSetting;
|
||||
- (void) setRatioSetting: (tr_ratiolimit) setting;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#import "transmission.h" // required by utils.h
|
||||
#import "utils.h" // tr_new()
|
||||
|
||||
#define ETA_IDLE_DISPLAY_MIN 2
|
||||
|
||||
@interface Torrent (Private)
|
||||
|
||||
- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
|
||||
|
@ -48,6 +50,7 @@
|
|||
- (void) idleLimitHit;
|
||||
- (void) metadataRetrieved;
|
||||
|
||||
- (BOOL) shouldShowEta;
|
||||
- (NSString *) etaString;
|
||||
|
||||
- (void) setTimeMachineExclude: (BOOL) exclude forPath: (NSString *) path;
|
||||
|
@ -357,11 +360,6 @@ int trashDataFile(const char * filename)
|
|||
return [NSString stringWithUTF8String: tr_torrentGetMagnetLink(fHandle)];
|
||||
}
|
||||
|
||||
- (BOOL) seedLimitSet
|
||||
{
|
||||
return tr_torrentGetSeedRatio(fHandle, NULL) || tr_torrentGetSeedIdle(fHandle, NULL);
|
||||
}
|
||||
|
||||
- (CGFloat) ratio
|
||||
{
|
||||
return fStat->ratio;
|
||||
|
@ -1003,7 +1001,7 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
|
||||
//add time when downloading or seed limit set
|
||||
if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding] && [self seedLimitSet]))
|
||||
if ([self shouldShowEta])
|
||||
string = [string stringByAppendingFormat: @" - %@", [self etaString]];
|
||||
|
||||
return string;
|
||||
|
@ -1151,7 +1149,7 @@ int trashDataFile(const char * filename)
|
|||
|
||||
- (NSString *) remainingTimeString
|
||||
{
|
||||
if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding] && [self seedLimitSet]))
|
||||
if ([self shouldShowEta])
|
||||
return [self etaString];
|
||||
else
|
||||
return [self shortStatusString];
|
||||
|
@ -1808,6 +1806,22 @@ int trashDataFile(const char * filename)
|
|||
[[NSNotificationCenter defaultCenter] postNotificationName: @"ResetInspector" object: self];
|
||||
}
|
||||
|
||||
- (BOOL) shouldShowEta
|
||||
{
|
||||
if (fStat->activity == TR_STATUS_DOWNLOAD)
|
||||
return YES;
|
||||
else if ([self isSeeding])
|
||||
{
|
||||
if (tr_torrentGetSeedRatio(fHandle, NULL))
|
||||
return YES;
|
||||
|
||||
if (tr_torrentGetSeedIdle(fHandle, NULL))
|
||||
return (fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle != TR_ETA_UNKNOWN) && fStat->etaIdle < ETA_IDLE_DISPLAY_MIN * 60;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
#warning don't show idle minutes when very large
|
||||
- (NSString *) etaString
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue