mirror of
https://github.com/transmission/transmission
synced 2025-03-03 10:15:45 +00:00
show amount selected in open window
This commit is contained in:
parent
6cbec1912b
commit
78b08324ea
4 changed files with 35 additions and 15 deletions
|
@ -60,6 +60,8 @@
|
|||
|
||||
- (void) verifyLocalData: (id) sender;
|
||||
|
||||
- (void) updateStatusField: (NSNotification *) notification;
|
||||
|
||||
- (void) updateGroupMenu: (NSNotification *) notification;
|
||||
- (void) showGroupsWindow: (id) sender;
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateStatusField:)
|
||||
name: @"TorrentFileCheckChange" object: fTorrent];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateGroupMenu:)
|
||||
name: @"UpdateGroups" object: nil];
|
||||
|
||||
|
@ -83,18 +86,7 @@
|
|||
[fIconView setImage: icon];
|
||||
[icon release];
|
||||
|
||||
NSString * statusString = [NSString stringForFileSize: [fTorrent size]];
|
||||
if ([fTorrent folder])
|
||||
{
|
||||
NSString * fileString;
|
||||
int count = [fTorrent fileCount];
|
||||
if (count != 1)
|
||||
fileString = [NSString stringWithFormat: NSLocalizedString(@"%d Files, ", "Add torrent -> info"), count];
|
||||
else
|
||||
fileString = NSLocalizedString(@"1 File, ", "Add torrent -> info");
|
||||
statusString = [fileString stringByAppendingString: statusString];
|
||||
}
|
||||
[fStatusField setStringValue: statusString];
|
||||
[self updateStatusField: nil];
|
||||
|
||||
[self setGroupsMenu];
|
||||
[fGroupPopUp selectItemWithTag: -1];
|
||||
|
@ -212,6 +204,27 @@
|
|||
[fFileController reloadData];
|
||||
}
|
||||
|
||||
- (void) updateStatusField: (NSNotification *) notification
|
||||
{
|
||||
NSString * statusString = [NSString stringForFileSize: [fTorrent size]];
|
||||
if ([fTorrent folder])
|
||||
statusString = [statusString stringByAppendingFormat: NSLocalizedString(@" (%@ selected)", "Add torrent -> info"),
|
||||
[NSString stringForFileSize: [fTorrent totalSizeSelected]]];
|
||||
|
||||
if ([fTorrent folder])
|
||||
{
|
||||
NSString * fileString;
|
||||
int count = [fTorrent fileCount];
|
||||
if (count != 1)
|
||||
fileString = [NSString stringWithFormat: NSLocalizedString(@"%d Files, ", "Add torrent -> info"), count];
|
||||
else
|
||||
fileString = NSLocalizedString(@"1 File, ", "Add torrent -> info");
|
||||
statusString = [fileString stringByAppendingString: statusString];
|
||||
}
|
||||
|
||||
[fStatusField setStringValue: statusString];
|
||||
}
|
||||
|
||||
- (void) updateGroupMenu: (NSNotification *) notification
|
||||
{
|
||||
[self setGroupsMenu];
|
||||
|
|
|
@ -216,6 +216,7 @@ typedef enum
|
|||
- (float) totalRate;
|
||||
- (uint64_t) haveVerified;
|
||||
- (uint64_t) haveTotal;
|
||||
- (uint64_t) totalSizeSelected;
|
||||
- (uint64_t) downloadedTotal;
|
||||
- (uint64_t) uploadedTotal;
|
||||
- (uint64_t) failedHash;
|
||||
|
|
|
@ -809,7 +809,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
- (float) progress
|
||||
{
|
||||
return fStat->percentComplete;
|
||||
//return (float)[self haveTotal] / [self size];
|
||||
}
|
||||
|
||||
- (float) progressDone
|
||||
|
@ -939,9 +938,8 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
{
|
||||
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
|
||||
{
|
||||
uint64_t have = [self haveTotal];
|
||||
string = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)", "Torrent -> progress string"),
|
||||
[NSString stringForFileSize: have], [NSString stringForFileSize: have + [self sizeLeft]],
|
||||
[NSString stringForFileSize: [self haveTotal]], [NSString stringForFileSize: [self totalSizeSelected]],
|
||||
100.0 * [self progressDone]];
|
||||
}
|
||||
else
|
||||
|
@ -1220,6 +1218,11 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
return [self haveVerified] + fStat->haveUnchecked;
|
||||
}
|
||||
|
||||
- (uint64_t) totalSizeSelected
|
||||
{
|
||||
return [self haveTotal] + [self sizeLeft];
|
||||
}
|
||||
|
||||
- (uint64_t) downloadedTotal
|
||||
{
|
||||
return fStat->downloadedEver;
|
||||
|
@ -1352,6 +1355,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
free(files);
|
||||
|
||||
[self update];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFileCheckChange" object: self];
|
||||
}
|
||||
|
||||
- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet
|
||||
|
|
Loading…
Reference in a new issue