diff --git a/macosx/English.lproj/InfoWindow.nib/classes.nib b/macosx/English.lproj/InfoWindow.nib/classes.nib index f85f3aae6..5c1bd0bb7 100644 --- a/macosx/English.lproj/InfoWindow.nib/classes.nib +++ b/macosx/English.lproj/InfoWindow.nib/classes.nib @@ -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; diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index 3a2800563..368e8ff51 100644 Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index 7d985b60d..5f8f81f1b 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -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; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 8f8e7076a..c2769da5a 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -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) diff --git a/macosx/PiecesView.m b/macosx/PiecesView.m index 811890e26..3d726285c 100644 --- a/macosx/PiecesView.m +++ b/macosx/PiecesView.m @@ -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 diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 3c8854933..dafd8c00e 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -157,6 +157,7 @@ - (NSString *) stateString; - (float) progress; +- (float) progressDone; - (int) eta; - (BOOL) isActive; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index f76e5706e..bf460f9fc 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -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;