getting mac version working with the changes from [3178], and specify total have and verified have in inspector

This commit is contained in:
Mitchell Livingston 2007-09-26 03:27:00 +00:00
parent b63a505c6d
commit 5c5be42659
7 changed files with 35 additions and 20 deletions

View File

@ -356,7 +356,7 @@
4DFBC2DD09C0970D00D5C571 /* Torrent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Torrent.h; path = macosx/Torrent.h; sourceTree = "<group>"; };
4DFBC2DE09C0970D00D5C571 /* Torrent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Torrent.m; path = macosx/Torrent.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = Info.plist; path = macosx/Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; };
8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; };
A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = "<group>"; };
A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = "<group>"; };
A2041D520C9AC523000ACFFB /* Lock.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Lock.tiff; path = macosx/Images/Lock.tiff; sourceTree = "<group>"; };

View File

@ -44,7 +44,7 @@
* fDateAddedField, * fDateCompletedField, * fDateActivityField,
* fCreatorField, * fDateCreatedField,
* fStateField, * fProgressField,
* fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField,
* fHaveField, * fDownloadedTotalField, * fUploadedTotalField,
* fRatioField, * fSwarmSpeedField;
IBOutlet NSTextView * fCommentView;
IBOutlet NSButton * fRevealDataButton, * fRevealTorrentButton;

View File

@ -154,7 +154,7 @@
"Inspector -> above tabs -> selected torrents")];
[fSizeField setStringValue: @""];
[fDownloadedValidField setStringValue: @""];
[fHaveField setStringValue: @""];
[fDownloadedTotalField setStringValue: @""];
[fUploadedTotalField setStringValue: @""];
@ -374,17 +374,26 @@
if (numberSelected == 0)
return;
uint64_t downloadedValid = 0, downloadedTotal = 0, uploadedTotal = 0;
uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0;
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
{
downloadedValid += [torrent downloadedValid];
have += [torrent haveTotal];
haveVerified += [torrent haveVerified];
downloadedTotal += [torrent downloadedTotal];
uploadedTotal += [torrent uploadedTotal];
}
[fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]];
if (have == 0)
[fHaveField setStringValue: [NSString stringForFileSize: 0]];
else if (have == haveVerified)
[fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified", "Inspector -> Activity tab -> have"),
[NSString stringForFileSize: haveVerified]]];
else
[fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)", "Inspector -> Activity tab -> have"),
[NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]];
[fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
[fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];

View File

@ -188,7 +188,8 @@ typedef enum
- (float) downloadRate;
- (float) uploadRate;
- (uint64_t) downloadedValid;
- (uint64_t) haveVerified;
- (uint64_t) haveTotal;
- (uint64_t) downloadedTotal;
- (uint64_t) uploadedTotal;
- (float) swarmSpeed;

View File

@ -281,25 +281,25 @@ static int static_lastid = 0;
{
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
{
uint64_t downloadedValid = [self downloadedValid];
uint64_t have = [self haveTotal];
[progressString appendFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)", "Torrent -> progress string"),
[NSString stringForFileSize: downloadedValid],
[NSString stringForFileSize: downloadedValid + fStat->left], 100.0 * [self progressDone]];
[NSString stringForFileSize: have], [NSString stringForFileSize: have + fStat->leftUntilDone],
100.0 * [self progressDone]];
}
else
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
[NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self haveTotal]],
[NSString stringForFileSize: [self size]], 100.0 * [self progress]];
}
else if (![self isComplete])
{
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
[progressString appendFormat: NSLocalizedString(@"%@ selected, uploaded %@ (Ratio: %@)",
"Torrent -> progress string"), [NSString stringForFileSize: [self downloadedValid]],
"Torrent -> progress string"), [NSString stringForFileSize: [self haveTotal]],
[NSString stringForFileSize: [self uploadedTotal]], [NSString stringForRatio: [self ratio]]];
else
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)",
"Torrent -> progress string"), [NSString stringForFileSize: [self downloadedValid]],
"Torrent -> progress string"), [NSString stringForFileSize: [self haveTotal]],
[NSString stringForFileSize: [self size]], 100.0 * [self progress],
[NSString stringForFileSize: [self uploadedTotal]], [NSString stringForRatio: [self ratio]]];
}
@ -971,7 +971,7 @@ static int static_lastid = 0;
- (float) progressLeft
{
return (float)fStat->left/[self size];
return (float)fStat->leftUntilDone/[self size];
}
- (int) eta
@ -1150,19 +1150,24 @@ static int static_lastid = 0;
return fStat->rateUpload;
}
- (uint64_t) downloadedValid
- (uint64_t) haveVerified
{
return fStat->downloadedValid;
return fStat->haveValid;
}
- (uint64_t) haveTotal
{
return [self haveVerified] + fStat->haveUnchecked;
}
- (uint64_t) downloadedTotal
{
return fStat->downloaded;
return fStat->downloadedEver;
}
- (uint64_t) uploadedTotal
{
return fStat->uploaded;
return fStat->uploadedEver;
}
- (float) swarmSpeed

View File

@ -33,7 +33,6 @@
fDownloadLimitLabel = NSTextField;
fDownloadLimitPopUp = NSPopUpButton;
fDownloadedTotalField = NSTextField;
fDownloadedValidField = NSTextField;
fDownloadingFromField = NSTextField;
fErrorMessageView = NSTextView;
fFileCheckItem = NSMenuItem;
@ -44,6 +43,7 @@
fFileTableStatusField = NSTextField;
fFileUncheckItem = NSMenuItem;
fHashField = NSTextField;
fHaveField = NSTextField;
fImageView = NSImageView;
fLeechersField = NSTextField;
fNameField = NSTextField;

Binary file not shown.