clicking on the peer progress indicator will toggle between progress bar and a number for progress, inspired by beelsebob
This commit is contained in:
parent
c5a6b6b111
commit
6a976eed1c
|
@ -102,6 +102,8 @@
|
|||
A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
||||
A253F6F30A698970008EE24F /* FilterBarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F6F20A698970008EE24F /* FilterBarBackground.png */; };
|
||||
A256588D0A9A695400E8A03B /* MessageWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A256588B0A9A695400E8A03B /* MessageWindowController.m */; };
|
||||
A257C1810CAD3003004E121C /* PeerTableView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A257C17F0CAD3003004E121C /* PeerTableView.h */; };
|
||||
A257C1820CAD3003004E121C /* PeerTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A257C1800CAD3003004E121C /* PeerTableView.m */; };
|
||||
A259317E0A73B2CC002F4FE7 /* TransmissionHelp in Resources */ = {isa = PBXBuildFile; fileRef = A259316A0A73B2CC002F4FE7 /* TransmissionHelp */; };
|
||||
A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */; };
|
||||
A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */; };
|
||||
|
@ -281,6 +283,7 @@
|
|||
files = (
|
||||
A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */,
|
||||
A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */,
|
||||
A257C1810CAD3003004E121C /* PeerTableView.h in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -427,6 +430,8 @@
|
|||
A253F6F20A698970008EE24F /* FilterBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterBarBackground.png; path = macosx/Images/FilterBarBackground.png; sourceTree = "<group>"; };
|
||||
A256588A0A9A695400E8A03B /* MessageWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MessageWindowController.h; path = macosx/MessageWindowController.h; sourceTree = "<group>"; };
|
||||
A256588B0A9A695400E8A03B /* MessageWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = MessageWindowController.m; path = macosx/MessageWindowController.m; sourceTree = "<group>"; };
|
||||
A257C17F0CAD3003004E121C /* PeerTableView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PeerTableView.h; path = macosx/PeerTableView.h; sourceTree = "<group>"; };
|
||||
A257C1800CAD3003004E121C /* PeerTableView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PeerTableView.m; path = macosx/PeerTableView.m; sourceTree = "<group>"; };
|
||||
A259316A0A73B2CC002F4FE7 /* TransmissionHelp */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TransmissionHelp; path = macosx/TransmissionHelp; sourceTree = "<group>"; };
|
||||
A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ExpandedPathToPathTransformer.m; path = macosx/ExpandedPathToPathTransformer.m; sourceTree = "<group>"; };
|
||||
A25E74450AF5089E006F11AE /* ExpandedPathToPathTransformer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ExpandedPathToPathTransformer.h; path = macosx/ExpandedPathToPathTransformer.h; sourceTree = "<group>"; };
|
||||
|
@ -712,6 +717,8 @@
|
|||
E1B6FBEB0C0D70AC0015FE4D /* UKKQueue */,
|
||||
A21282A50CA6C66800EAEE0F /* StatusBarView.h */,
|
||||
A21282A60CA6C66800EAEE0F /* StatusBarView.m */,
|
||||
A257C17F0CAD3003004E121C /* PeerTableView.h */,
|
||||
A257C1800CAD3003004E121C /* PeerTableView.m */,
|
||||
);
|
||||
name = Sources;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1483,6 +1490,7 @@
|
|||
A2085DDC0C53BC74000BC3B7 /* AboutWindowController.m in Sources */,
|
||||
A234D0D20C79FB3600A82373 /* NSMenuAdditions.m in Sources */,
|
||||
A21282A80CA6C66800EAEE0F /* StatusBarView.m in Sources */,
|
||||
A257C1820CAD3003004E121C /* PeerTableView.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
<true/>
|
||||
<key>DisplayStatusProgressSelected</key>
|
||||
<false/>
|
||||
<key>DisplayPeerProgressBarNumber</key>
|
||||
<false/>
|
||||
<key>DisplayProgressBarAvailable</key>
|
||||
<false/>
|
||||
<key>DownloadChoice</key>
|
||||
<string>Constant</string>
|
||||
<key>DownloadFolder</key>
|
||||
|
|
|
@ -29,4 +29,5 @@
|
|||
BOOL fIsHidden;
|
||||
NSImage * fCheckImage;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,19 +40,31 @@
|
|||
{
|
||||
if (!fIsHidden)
|
||||
{
|
||||
[super drawWithFrame: cellFrame inView: controlView];
|
||||
if ([self floatValue] >= 1.0)
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DisplayPeerProgressBarNumber"])
|
||||
{
|
||||
if (!fCheckImage)
|
||||
{
|
||||
fCheckImage = [NSImage imageNamed: @"CompleteCheck.png"];
|
||||
[fCheckImage setFlipped: YES];
|
||||
}
|
||||
NSMutableParagraphStyle *centeredStyle = [[[NSMutableParagraphStyle alloc] init] autorelease];
|
||||
[centeredStyle setAlignment:NSCenterTextAlignment];
|
||||
|
||||
NSSize imageSize = [fCheckImage size];
|
||||
NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5,
|
||||
[[NSString stringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame
|
||||
withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSFont systemFontOfSize: 11.0], NSFontAttributeName, nil]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[super drawWithFrame: cellFrame inView: controlView];
|
||||
if ([self floatValue] >= 1.0)
|
||||
{
|
||||
if (!fCheckImage)
|
||||
{
|
||||
fCheckImage = [NSImage imageNamed: @"CompleteCheck.png"];
|
||||
[fCheckImage setFlipped: YES];
|
||||
}
|
||||
|
||||
NSSize imageSize = [fCheckImage size];
|
||||
NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5,
|
||||
cellFrame.origin.y + (cellFrame.size.height - imageSize.height) * 0.5, imageSize.width, imageSize.height);
|
||||
[fCheckImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
|
||||
[fCheckImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2007 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface PeerTableView : NSTableView
|
||||
{
|
||||
}
|
||||
@end
|
|
@ -0,0 +1,40 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2007 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import "PeerTableView.h"
|
||||
|
||||
@implementation PeerTableView
|
||||
|
||||
- (void) mouseDown: (NSEvent *) event
|
||||
{
|
||||
NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
|
||||
if ([self rowAtPoint: point] != -1 && [self columnAtPoint: point] == [self columnWithIdentifier: @"Progress"])
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setBool: ![[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"DisplayPeerProgressBarNumber"] forKey: @"DisplayPeerProgressBarNumber"];
|
||||
[self reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -270,13 +270,36 @@
|
|||
|
||||
if (rightWidth > 0)
|
||||
{
|
||||
NSRect includeRect = barRect;
|
||||
includeRect.origin.x += leftWidth;
|
||||
includeRect.size.width = rightWidth;
|
||||
if (![fDefaults boolForKey: @"DisplayProgressBarAvailable"])
|
||||
{
|
||||
int notAvailableWidth = barRect.size.width * [torrent notAvailableDesired];
|
||||
//NSLog(@"notAvailableWidth %d rightWidth %d", notAvailableWidth, rightWidth);
|
||||
notAvailableWidth = MIN(notAvailableWidth, rightWidth);
|
||||
|
||||
if (notAvailableWidth > 0)
|
||||
{
|
||||
rightWidth -= notAvailableWidth;
|
||||
|
||||
NSRect notAvailableRect = barRect;
|
||||
notAvailableRect.origin.x += leftWidth + rightWidth;
|
||||
notAvailableRect.size.width = notAvailableWidth;
|
||||
|
||||
if (!fYellowGradient)
|
||||
fYellowGradient = [[CTGradient progressYellowGradient] retain];
|
||||
[fYellowGradient fillRect: notAvailableRect angle: -90];
|
||||
}
|
||||
}
|
||||
|
||||
if (!fWhiteGradient)
|
||||
fWhiteGradient = [[CTGradient progressWhiteGradient] retain];
|
||||
[fWhiteGradient fillRect: includeRect angle: -90];
|
||||
if (rightWidth > 0)
|
||||
{
|
||||
NSRect includeRect = barRect;
|
||||
includeRect.origin.x += leftWidth;
|
||||
includeRect.size.width = rightWidth;
|
||||
|
||||
if (!fWhiteGradient)
|
||||
fWhiteGradient = [[CTGradient progressWhiteGradient] retain];
|
||||
[fWhiteGradient fillRect: includeRect angle: -90];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
LANGUAGE = ObjC;
|
||||
SUPERCLASS = NSLevelIndicatorCell;
|
||||
},
|
||||
{CLASS = PeerTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; },
|
||||
{CLASS = PiecesView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue