mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
Convert tabs to spaces, remove trailing whitespace (Mac client)
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
{
|
||||
[self setTitle: NSLocalizedString(@"Activity", "Inspector view -> title")];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
[fTransferSectionLabel sizeToFit];
|
||||
[fDatesSectionLabel sizeToFit];
|
||||
[fTimeSectionLabel sizeToFit];
|
||||
|
||||
|
||||
NSArray * labels = @[ fStateLabel, fProgressLabel, fHaveLabel, fDownloadedLabel, fUploadedLabel, fFailedDLLabel, fRatioLabel, fErrorLabel, fDateAddedLabel, fDateCompletedLabel, fDateActivityLabel, fDownloadTimeLabel, fSeedTimeLabel ];
|
||||
|
||||
|
||||
CGFloat oldMaxWidth = 0.0, originX, newMaxWidth = 0.0;
|
||||
for (NSTextField * label in labels)
|
||||
{
|
||||
@@ -67,22 +67,22 @@
|
||||
oldMaxWidth = oldFrame.size.width;
|
||||
originX = oldFrame.origin.x;
|
||||
}
|
||||
|
||||
|
||||
[label sizeToFit];
|
||||
const CGFloat newWidth = [label bounds].size.width;
|
||||
if (newWidth > newMaxWidth)
|
||||
newMaxWidth = newWidth;
|
||||
}
|
||||
|
||||
|
||||
for (NSTextField * label in labels)
|
||||
{
|
||||
NSRect frame = [label frame];
|
||||
frame.origin.x = originX + (newMaxWidth - frame.size.width);
|
||||
[label setFrame: frame];
|
||||
}
|
||||
|
||||
|
||||
NSArray * fields = @[ fDateAddedField, fDateCompletedField, fDateActivityField, fStateField, fProgressField, fHaveField, fDownloadedTotalField, fUploadedTotalField, fFailedHashField, fRatioField, fDownloadTimeField, fSeedTimeField, fErrorScrollView ];
|
||||
|
||||
|
||||
const CGFloat widthIncrease = newMaxWidth - oldMaxWidth;
|
||||
for (NSView * field in fields) {
|
||||
NSRect frame = [field frame];
|
||||
@@ -90,7 +90,7 @@
|
||||
frame.size.width -= widthIncrease;
|
||||
[field setFrame: frame];
|
||||
}
|
||||
|
||||
|
||||
//set the click action of the pieces view
|
||||
#warning after 2.8 just hook this up in the xib
|
||||
[fPiecesView setAction:@selector(updatePiecesView:)];
|
||||
@@ -100,9 +100,9 @@
|
||||
- (void) dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
|
||||
|
||||
[fTorrents release];
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
//don't check if it's the same in case the metadata changed
|
||||
[fTorrents release];
|
||||
fTorrents = [torrents retain];
|
||||
|
||||
|
||||
fSet = NO;
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
{
|
||||
if (!fSet)
|
||||
[self setupInfo];
|
||||
|
||||
|
||||
const NSInteger numberSelected = [fTorrents count];
|
||||
if (numberSelected == 0)
|
||||
return;
|
||||
|
||||
|
||||
uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0;
|
||||
NSDate * lastActivity = nil;
|
||||
for (Torrent * torrent in fTorrents)
|
||||
@@ -133,12 +133,12 @@
|
||||
downloadedTotal += [torrent downloadedTotal];
|
||||
uploadedTotal += [torrent uploadedTotal];
|
||||
failedHash += [torrent failedHash];
|
||||
|
||||
|
||||
NSDate * nextLastActivity;
|
||||
if ((nextLastActivity = [torrent dateActivity]))
|
||||
lastActivity = lastActivity ? [lastActivity laterDate: nextLastActivity] : nextLastActivity;
|
||||
}
|
||||
|
||||
|
||||
if (have == 0)
|
||||
[fHaveField setStringValue: [NSString stringForFileSize: 0]];
|
||||
else
|
||||
@@ -150,19 +150,19 @@
|
||||
else
|
||||
[fHaveField setStringValue: [NSString stringWithFormat: @"%@ (%@)", [NSString stringForFileSize: have], verifiedString]];
|
||||
}
|
||||
|
||||
|
||||
[fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
|
||||
[fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
|
||||
[fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]];
|
||||
|
||||
|
||||
[fDateActivityField setObjectValue: lastActivity];
|
||||
|
||||
|
||||
if (numberSelected == 1)
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
|
||||
|
||||
[fStateField setStringValue: [torrent stateString]];
|
||||
|
||||
|
||||
NSString * progressString = [NSString percentString: [torrent progress] longDecimals: YES];
|
||||
if ([torrent isFolder])
|
||||
{
|
||||
@@ -172,18 +172,18 @@
|
||||
progressString = [progressString stringByAppendingFormat: @" (%@)", progressSelectedString];
|
||||
}
|
||||
[fProgressField setStringValue: progressString];
|
||||
|
||||
|
||||
[fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
|
||||
|
||||
|
||||
NSString * errorMessage = [torrent errorMessage];
|
||||
if (![errorMessage isEqualToString: [fErrorMessageView string]])
|
||||
[fErrorMessageView setString: errorMessage];
|
||||
|
||||
|
||||
[fDateCompletedField setObjectValue: [torrent dateCompleted]];
|
||||
|
||||
|
||||
//uses a relative date, so can't be set once
|
||||
[fDateAddedField setObjectValue: [torrent dateAdded]];
|
||||
|
||||
|
||||
if ([NSApp isOnYosemiteOrBetter]) {
|
||||
static NSDateComponentsFormatter *timeFormatter;
|
||||
static dispatch_once_t onceToken;
|
||||
@@ -193,7 +193,7 @@
|
||||
timeFormatter.allowedUnits = NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
|
||||
timeFormatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorDropLeading;
|
||||
});
|
||||
|
||||
|
||||
[fDownloadTimeField setStringValue: [timeFormatter stringFromTimeInterval:[torrent secondsDownloading]]];
|
||||
[fSeedTimeField setStringValue: [timeFormatter stringFromTimeInterval:[torrent secondsSeeding]]];
|
||||
}
|
||||
@@ -201,7 +201,7 @@
|
||||
[fDownloadTimeField setStringValue: [NSString timeString: [torrent secondsDownloading] includesTimeRemainingPhrase:NO showSeconds: YES]];
|
||||
[fSeedTimeField setStringValue: [NSString timeString: [torrent secondsSeeding] includesTimeRemainingPhrase:NO showSeconds: YES]];
|
||||
}
|
||||
|
||||
|
||||
[fPiecesView updateView];
|
||||
}
|
||||
else if (numberSelected > 1)
|
||||
@@ -222,10 +222,10 @@
|
||||
- (void) updatePiecesView: (id) sender
|
||||
{
|
||||
const BOOL piecesAvailableSegment = [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"];
|
||||
|
||||
|
||||
[fPiecesControl setSelected: piecesAvailableSegment forSegment: PIECES_CONTROL_AVAILABLE];
|
||||
[fPiecesControl setSelected: !piecesAvailableSegment forSegment: PIECES_CONTROL_PROGRESS];
|
||||
|
||||
|
||||
[fPiecesView updateView];
|
||||
}
|
||||
|
||||
@@ -252,19 +252,19 @@
|
||||
[fDateActivityField setObjectValue: @""]; //using [field setStringValue: @""] causes "December 31, 1969 7:00 PM" to be displayed, at least on 10.7.3
|
||||
[fRatioField setStringValue: @""];
|
||||
}
|
||||
|
||||
|
||||
[fStateField setStringValue: @""];
|
||||
[fProgressField setStringValue: @""];
|
||||
|
||||
|
||||
[fErrorMessageView setString: @""];
|
||||
|
||||
|
||||
//using [field setStringValue: @""] causes "December 31, 1969 7:00 PM" to be displayed, at least on 10.7.3
|
||||
[fDateAddedField setObjectValue: @""];
|
||||
[fDateCompletedField setObjectValue: @""];
|
||||
|
||||
|
||||
[fDownloadTimeField setStringValue: @""];
|
||||
[fSeedTimeField setStringValue: @""];
|
||||
|
||||
|
||||
[fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_AVAILABLE];
|
||||
[fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_PROGRESS];
|
||||
[fPiecesControl setEnabled: NO];
|
||||
@@ -273,15 +273,15 @@
|
||||
else
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
|
||||
|
||||
const BOOL piecesAvailableSegment = [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"];
|
||||
[fPiecesControl setSelected: piecesAvailableSegment forSegment: PIECES_CONTROL_AVAILABLE];
|
||||
[fPiecesControl setSelected: !piecesAvailableSegment forSegment: PIECES_CONTROL_PROGRESS];
|
||||
[fPiecesControl setEnabled: YES];
|
||||
|
||||
|
||||
[fPiecesView setTorrent: torrent];
|
||||
}
|
||||
|
||||
|
||||
fSet = YES;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user