mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
add a control to the pieces view
This commit is contained in:
parent
54ec3716cc
commit
8547e53c79
7 changed files with 38 additions and 33 deletions
3
macosx/English.lproj/InfoWindow.nib/classes.nib
generated
3
macosx/English.lproj/InfoWindow.nib/classes.nib
generated
|
@ -10,6 +10,7 @@
|
|||
setCheck = id;
|
||||
setLimitSetting = id;
|
||||
setPex = id;
|
||||
setPiecesView = id;
|
||||
setPriority = id;
|
||||
setRatioLimit = id;
|
||||
setRatioSetting = id;
|
||||
|
@ -47,8 +48,10 @@
|
|||
fNameField = NSTextField;
|
||||
fPeerTable = NSTableView;
|
||||
fPexCheck = NSButton;
|
||||
fPiecesControl = NSSegmentedControl;
|
||||
fPiecesField = NSTextField;
|
||||
fPiecesView = PiecesView;
|
||||
fProgressField = NSTextField;
|
||||
fRatioField = NSTextField;
|
||||
fRatioLimitField = NSTextField;
|
||||
fRatioPopUp = NSPopUpButton;
|
||||
|
|
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -40,7 +40,7 @@
|
|||
* fTorrentLocationField, * fDataLocationField,
|
||||
* fDateAddedField, * fDateCompletedField, * fDateActivityField,
|
||||
* fCreatorField, * fDateCreatedField,
|
||||
* fStateField,
|
||||
* fStateField, * fProgressField,
|
||||
* fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField,
|
||||
* fRatioField, * fSwarmSpeedField;
|
||||
IBOutlet NSTextView * fCommentView;
|
||||
|
@ -51,6 +51,7 @@
|
|||
* fDownloadingFromField, * fUploadingToField, * fCompletedFromTrackerField;
|
||||
IBOutlet NSTextView * fErrorMessageView;
|
||||
IBOutlet PiecesView * fPiecesView;
|
||||
IBOutlet NSSegmentedControl * fPiecesControl;
|
||||
|
||||
IBOutlet NSOutlineView * fFileOutline;
|
||||
IBOutlet NSTextField * fFileTableStatusField;
|
||||
|
@ -71,6 +72,8 @@
|
|||
- (void) setNextTab;
|
||||
- (void) setPreviousTab;
|
||||
|
||||
- (void) setPiecesView: (id) sender;
|
||||
|
||||
- (void) revealTorrentFile: (id) sender;
|
||||
- (void) revealDataFile: (id) sender;
|
||||
- (void) revealFile: (id) sender;
|
||||
|
|
|
@ -39,11 +39,14 @@
|
|||
|
||||
//15 spacing at the bottom of each tab
|
||||
#define TAB_INFO_HEIGHT 268.0
|
||||
#define TAB_ACTIVITY_HEIGHT 258.0
|
||||
#define TAB_ACTIVITY_HEIGHT 274.0
|
||||
#define TAB_PEERS_HEIGHT 279.0
|
||||
#define TAB_FILES_HEIGHT 279.0
|
||||
#define TAB_OPTIONS_HEIGHT 158.0
|
||||
|
||||
#define PIECES_CONTROL_PROGRESS 0
|
||||
#define PIECES_CONTROL_AVAILABLE 1
|
||||
|
||||
#define OPTION_POPUP_GLOBAL 0
|
||||
#define OPTION_POPUP_NO_LIMIT 1
|
||||
#define OPTION_POPUP_LIMIT 2
|
||||
|
@ -97,6 +100,10 @@
|
|||
[fTabView selectTabViewItemWithIdentifier: identifier];
|
||||
[self setWindowForTab: identifier animate: NO];
|
||||
|
||||
//set pieces control
|
||||
[fPiecesControl setSelectedSegment: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]
|
||||
? PIECES_CONTROL_AVAILABLE : PIECES_CONTROL_PROGRESS];
|
||||
|
||||
//initially sort peer table by IP
|
||||
if ([[fPeerTable sortDescriptors] count] == 0)
|
||||
[fPeerTable setSortDescriptors: [NSArray arrayWithObject: [[fPeerTable tableColumnWithIdentifier: @"IP"]
|
||||
|
@ -196,6 +203,7 @@
|
|||
[fDataLocationField setSelectable: NO];
|
||||
|
||||
[fStateField setStringValue: @""];
|
||||
[fProgressField setStringValue: @""];
|
||||
[fRatioField setStringValue: @""];
|
||||
|
||||
[fSeedersField setStringValue: @""];
|
||||
|
@ -212,6 +220,7 @@
|
|||
[fDateCompletedField setStringValue: @""];
|
||||
[fDateActivityField setStringValue: @""];
|
||||
|
||||
[fPiecesControl setEnabled: NO];
|
||||
[fPiecesView setTorrent: nil];
|
||||
|
||||
if (fPeers)
|
||||
|
@ -276,6 +285,7 @@
|
|||
[fTorrentLocationField setSelectable: YES];
|
||||
[fDataLocationField setSelectable: YES];
|
||||
|
||||
[fPiecesControl setEnabled: YES];
|
||||
[fPiecesView setTorrent: torrent];
|
||||
|
||||
//set file table
|
||||
|
@ -357,11 +367,9 @@
|
|||
{
|
||||
torrent = [fTorrents objectAtIndex: 0];
|
||||
|
||||
//append percentage to amount downloaded if 1 torrent
|
||||
[fDownloadedValidField setStringValue: [[fDownloadedValidField stringValue]
|
||||
stringByAppendingFormat: @" (%.2f%%)", 100.0 * [torrent progress]]];
|
||||
|
||||
[fStateField setStringValue: [torrent stateString]];
|
||||
[fProgressField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",
|
||||
"Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]];
|
||||
[fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
|
||||
[fSwarmSpeedField setStringValue: [torrent isActive] ? [NSString stringForSpeed: [torrent swarmSpeed]] : @""];
|
||||
|
||||
|
@ -977,6 +985,13 @@
|
|||
return descriptors;
|
||||
}
|
||||
|
||||
- (void) setPiecesView: (id) sender
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setBool: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE
|
||||
forKey: @"PiecesViewShowAvailability"];
|
||||
[fPiecesView updateView: YES];
|
||||
}
|
||||
|
||||
- (void) revealTorrentFile: (id) sender
|
||||
{
|
||||
if ([fTorrents count] > 0)
|
||||
|
|
|
@ -134,10 +134,6 @@
|
|||
[bp fill];
|
||||
[fBluePiece unlockFocus];
|
||||
|
||||
[self setToolTip: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]
|
||||
? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
|
||||
: NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
|
||||
|
||||
//actually draw the box
|
||||
[self setTorrent: nil];
|
||||
}
|
||||
|
@ -193,8 +189,11 @@
|
|||
|
||||
[self updateView: YES];
|
||||
}
|
||||
|
||||
[self setHidden: torrent == nil];
|
||||
else
|
||||
{
|
||||
[self setImage: [[fBack copy] autorelease]];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateView: (BOOL) first
|
||||
|
@ -376,25 +375,4 @@
|
|||
free(piecesPercent);
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *) event
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent *) event
|
||||
{
|
||||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||
BOOL showAvailability = ![defaults boolForKey: @"PiecesViewShowAvailability"];
|
||||
|
||||
[defaults setBool: showAvailability forKey: @"PiecesViewShowAvailability"];
|
||||
|
||||
[self setToolTip: showAvailability
|
||||
? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
|
||||
: NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
|
||||
|
||||
[self updateView: YES];
|
||||
|
||||
[super mouseDown: event];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -157,6 +157,7 @@
|
|||
- (NSString *) stateString;
|
||||
|
||||
- (float) progress;
|
||||
- (float) progressDone;
|
||||
- (int) eta;
|
||||
|
||||
- (BOOL) isActive;
|
||||
|
|
|
@ -1086,6 +1086,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
return fStat->percentComplete;
|
||||
}
|
||||
|
||||
- (float) progressDone
|
||||
{
|
||||
return fStat->percentDone;
|
||||
}
|
||||
|
||||
- (int) eta
|
||||
{
|
||||
return fStat->eta;
|
||||
|
|
Loading…
Reference in a new issue