1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 05:25:52 +00:00

another if-to-switch

This commit is contained in:
Mitchell Livingston 2007-10-20 19:25:14 +00:00
parent 3aa131a3e9
commit 039eefb06e
2 changed files with 21 additions and 18 deletions

View file

@ -22,8 +22,8 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*****************************************************************************/ *****************************************************************************/
#import "FileOutlineView.h"
#import "FileNameCell.h" #import "FileNameCell.h"
#import "FileOutlineView.h"
#import "Torrent.h" #import "Torrent.h"
#import "NSStringAdditions.h" #import "NSStringAdditions.h"

View file

@ -73,8 +73,8 @@
int count = [priorities count]; int count = [priorities count];
FileOutlineView * view = (FileOutlineView *)[self controlView]; FileOutlineView * view = (FileOutlineView *)[self controlView];
int row = [view hoverRow]; int hoverRow = [view hoverRow];
if (count > 0 && row != -1 && [view itemAtRow: row] == dict) if (count > 0 && hoverRow != -1 && [view itemAtRow: hoverRow] == dict)
{ {
[super setSelected: [priorities containsObject: [NSNumber numberWithInt: TR_PRI_LOW]] forSegment: 0]; [super setSelected: [priorities containsObject: [NSNumber numberWithInt: TR_PRI_LOW]] forSegment: 0];
[super setSelected: [priorities containsObject: [NSNumber numberWithInt: TR_PRI_NORMAL]] forSegment: 1]; [super setSelected: [priorities containsObject: [NSNumber numberWithInt: TR_PRI_NORMAL]] forSegment: 1];
@ -97,23 +97,26 @@
fMixedImage = [NSImage imageNamed: @"PriorityMixed.png"]; fMixedImage = [NSImage imageNamed: @"PriorityMixed.png"];
image = fMixedImage; image = fMixedImage;
} }
else if ([priorities containsObject: [NSNumber numberWithInt: TR_PRI_NORMAL]])
{
if (!fNormalImage)
fNormalImage = [NSImage imageNamed: @"PriorityNormal.png"];
image = fNormalImage;
}
else if ([priorities containsObject: [NSNumber numberWithInt: TR_PRI_LOW]])
{
if (!fLowImage)
fLowImage = [NSImage imageNamed: @"PriorityLow.png"];
image = fLowImage;
}
else else
{ {
if (!fHighImage) switch ([[priorities anyObject] intValue])
fHighImage = [NSImage imageNamed: @"PriorityHigh.png"]; {
image = fHighImage; case TR_PRI_NORMAL:
if (!fNormalImage)
fNormalImage = [NSImage imageNamed: @"PriorityNormal.png"];
image = fNormalImage;
break;
case TR_PRI_LOW:
if (!fLowImage)
fLowImage = [NSImage imageNamed: @"PriorityLow.png"];
image = fLowImage;
break;
case TR_PRI_HIGH:
if (!fHighImage)
fHighImage = [NSImage imageNamed: @"PriorityHigh.png"];
image = fHighImage;
break;
}
} }
NSSize imageSize = [image size]; NSSize imageSize = [image size];