mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
add a control to the pieces view
This commit is contained in:
3
macosx/English.lproj/InfoWindow.nib/classes.nib
generated
3
macosx/English.lproj/InfoWindow.nib/classes.nib
generated
@@ -10,6 +10,7 @@
|
|||||||
setCheck = id;
|
setCheck = id;
|
||||||
setLimitSetting = id;
|
setLimitSetting = id;
|
||||||
setPex = id;
|
setPex = id;
|
||||||
|
setPiecesView = id;
|
||||||
setPriority = id;
|
setPriority = id;
|
||||||
setRatioLimit = id;
|
setRatioLimit = id;
|
||||||
setRatioSetting = id;
|
setRatioSetting = id;
|
||||||
@@ -47,8 +48,10 @@
|
|||||||
fNameField = NSTextField;
|
fNameField = NSTextField;
|
||||||
fPeerTable = NSTableView;
|
fPeerTable = NSTableView;
|
||||||
fPexCheck = NSButton;
|
fPexCheck = NSButton;
|
||||||
|
fPiecesControl = NSSegmentedControl;
|
||||||
fPiecesField = NSTextField;
|
fPiecesField = NSTextField;
|
||||||
fPiecesView = PiecesView;
|
fPiecesView = PiecesView;
|
||||||
|
fProgressField = NSTextField;
|
||||||
fRatioField = NSTextField;
|
fRatioField = NSTextField;
|
||||||
fRatioLimitField = NSTextField;
|
fRatioLimitField = NSTextField;
|
||||||
fRatioPopUp = NSPopUpButton;
|
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,
|
* fTorrentLocationField, * fDataLocationField,
|
||||||
* fDateAddedField, * fDateCompletedField, * fDateActivityField,
|
* fDateAddedField, * fDateCompletedField, * fDateActivityField,
|
||||||
* fCreatorField, * fDateCreatedField,
|
* fCreatorField, * fDateCreatedField,
|
||||||
* fStateField,
|
* fStateField, * fProgressField,
|
||||||
* fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField,
|
* fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField,
|
||||||
* fRatioField, * fSwarmSpeedField;
|
* fRatioField, * fSwarmSpeedField;
|
||||||
IBOutlet NSTextView * fCommentView;
|
IBOutlet NSTextView * fCommentView;
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
* fDownloadingFromField, * fUploadingToField, * fCompletedFromTrackerField;
|
* fDownloadingFromField, * fUploadingToField, * fCompletedFromTrackerField;
|
||||||
IBOutlet NSTextView * fErrorMessageView;
|
IBOutlet NSTextView * fErrorMessageView;
|
||||||
IBOutlet PiecesView * fPiecesView;
|
IBOutlet PiecesView * fPiecesView;
|
||||||
|
IBOutlet NSSegmentedControl * fPiecesControl;
|
||||||
|
|
||||||
IBOutlet NSOutlineView * fFileOutline;
|
IBOutlet NSOutlineView * fFileOutline;
|
||||||
IBOutlet NSTextField * fFileTableStatusField;
|
IBOutlet NSTextField * fFileTableStatusField;
|
||||||
@@ -71,6 +72,8 @@
|
|||||||
- (void) setNextTab;
|
- (void) setNextTab;
|
||||||
- (void) setPreviousTab;
|
- (void) setPreviousTab;
|
||||||
|
|
||||||
|
- (void) setPiecesView: (id) sender;
|
||||||
|
|
||||||
- (void) revealTorrentFile: (id) sender;
|
- (void) revealTorrentFile: (id) sender;
|
||||||
- (void) revealDataFile: (id) sender;
|
- (void) revealDataFile: (id) sender;
|
||||||
- (void) revealFile: (id) sender;
|
- (void) revealFile: (id) sender;
|
||||||
|
|||||||
@@ -39,11 +39,14 @@
|
|||||||
|
|
||||||
//15 spacing at the bottom of each tab
|
//15 spacing at the bottom of each tab
|
||||||
#define TAB_INFO_HEIGHT 268.0
|
#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_PEERS_HEIGHT 279.0
|
||||||
#define TAB_FILES_HEIGHT 279.0
|
#define TAB_FILES_HEIGHT 279.0
|
||||||
#define TAB_OPTIONS_HEIGHT 158.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_GLOBAL 0
|
||||||
#define OPTION_POPUP_NO_LIMIT 1
|
#define OPTION_POPUP_NO_LIMIT 1
|
||||||
#define OPTION_POPUP_LIMIT 2
|
#define OPTION_POPUP_LIMIT 2
|
||||||
@@ -97,6 +100,10 @@
|
|||||||
[fTabView selectTabViewItemWithIdentifier: identifier];
|
[fTabView selectTabViewItemWithIdentifier: identifier];
|
||||||
[self setWindowForTab: identifier animate: NO];
|
[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
|
//initially sort peer table by IP
|
||||||
if ([[fPeerTable sortDescriptors] count] == 0)
|
if ([[fPeerTable sortDescriptors] count] == 0)
|
||||||
[fPeerTable setSortDescriptors: [NSArray arrayWithObject: [[fPeerTable tableColumnWithIdentifier: @"IP"]
|
[fPeerTable setSortDescriptors: [NSArray arrayWithObject: [[fPeerTable tableColumnWithIdentifier: @"IP"]
|
||||||
@@ -196,6 +203,7 @@
|
|||||||
[fDataLocationField setSelectable: NO];
|
[fDataLocationField setSelectable: NO];
|
||||||
|
|
||||||
[fStateField setStringValue: @""];
|
[fStateField setStringValue: @""];
|
||||||
|
[fProgressField setStringValue: @""];
|
||||||
[fRatioField setStringValue: @""];
|
[fRatioField setStringValue: @""];
|
||||||
|
|
||||||
[fSeedersField setStringValue: @""];
|
[fSeedersField setStringValue: @""];
|
||||||
@@ -212,6 +220,7 @@
|
|||||||
[fDateCompletedField setStringValue: @""];
|
[fDateCompletedField setStringValue: @""];
|
||||||
[fDateActivityField setStringValue: @""];
|
[fDateActivityField setStringValue: @""];
|
||||||
|
|
||||||
|
[fPiecesControl setEnabled: NO];
|
||||||
[fPiecesView setTorrent: nil];
|
[fPiecesView setTorrent: nil];
|
||||||
|
|
||||||
if (fPeers)
|
if (fPeers)
|
||||||
@@ -276,6 +285,7 @@
|
|||||||
[fTorrentLocationField setSelectable: YES];
|
[fTorrentLocationField setSelectable: YES];
|
||||||
[fDataLocationField setSelectable: YES];
|
[fDataLocationField setSelectable: YES];
|
||||||
|
|
||||||
|
[fPiecesControl setEnabled: YES];
|
||||||
[fPiecesView setTorrent: torrent];
|
[fPiecesView setTorrent: torrent];
|
||||||
|
|
||||||
//set file table
|
//set file table
|
||||||
@@ -357,11 +367,9 @@
|
|||||||
{
|
{
|
||||||
torrent = [fTorrents objectAtIndex: 0];
|
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]];
|
[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]]];
|
[fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
|
||||||
[fSwarmSpeedField setStringValue: [torrent isActive] ? [NSString stringForSpeed: [torrent swarmSpeed]] : @""];
|
[fSwarmSpeedField setStringValue: [torrent isActive] ? [NSString stringForSpeed: [torrent swarmSpeed]] : @""];
|
||||||
|
|
||||||
@@ -977,6 +985,13 @@
|
|||||||
return descriptors;
|
return descriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setPiecesView: (id) sender
|
||||||
|
{
|
||||||
|
[[NSUserDefaults standardUserDefaults] setBool: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE
|
||||||
|
forKey: @"PiecesViewShowAvailability"];
|
||||||
|
[fPiecesView updateView: YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) revealTorrentFile: (id) sender
|
- (void) revealTorrentFile: (id) sender
|
||||||
{
|
{
|
||||||
if ([fTorrents count] > 0)
|
if ([fTorrents count] > 0)
|
||||||
|
|||||||
@@ -134,10 +134,6 @@
|
|||||||
[bp fill];
|
[bp fill];
|
||||||
[fBluePiece unlockFocus];
|
[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
|
//actually draw the box
|
||||||
[self setTorrent: nil];
|
[self setTorrent: nil];
|
||||||
}
|
}
|
||||||
@@ -193,8 +189,11 @@
|
|||||||
|
|
||||||
[self updateView: YES];
|
[self updateView: YES];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
[self setHidden: torrent == nil];
|
{
|
||||||
|
[self setImage: [[fBack copy] autorelease]];
|
||||||
|
[self setNeedsDisplay];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) updateView: (BOOL) first
|
- (void) updateView: (BOOL) first
|
||||||
@@ -376,25 +375,4 @@
|
|||||||
free(piecesPercent);
|
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
|
@end
|
||||||
|
|||||||
@@ -157,6 +157,7 @@
|
|||||||
- (NSString *) stateString;
|
- (NSString *) stateString;
|
||||||
|
|
||||||
- (float) progress;
|
- (float) progress;
|
||||||
|
- (float) progressDone;
|
||||||
- (int) eta;
|
- (int) eta;
|
||||||
|
|
||||||
- (BOOL) isActive;
|
- (BOOL) isActive;
|
||||||
|
|||||||
@@ -1086,6 +1086,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||||||
return fStat->percentComplete;
|
return fStat->percentComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (float) progressDone
|
||||||
|
{
|
||||||
|
return fStat->percentDone;
|
||||||
|
}
|
||||||
|
|
||||||
- (int) eta
|
- (int) eta
|
||||||
{
|
{
|
||||||
return fStat->eta;
|
return fStat->eta;
|
||||||
|
|||||||
Reference in New Issue
Block a user