Display an error image on the torrent icon when there is an error with the torrent.

This commit is contained in:
Mitchell Livingston 2006-08-29 00:09:49 +00:00
parent 8daa719b04
commit e94e0e72f4
6 changed files with 55 additions and 42 deletions

View File

@ -116,6 +116,7 @@
A25FCDE00A37695F002BCBBE /* ResumeSelected.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */; };
A25FCDEF0A3769A6002BCBBE /* PauseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDD0A37695F002BCBBE /* PauseSelected.png */; };
A25FCDF00A3769AC002BCBBE /* ResumeSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */; };
A260C9AC0AA3B8D700FDC1B7 /* Error.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */; };
A261F1DC0A69A1610002815A /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
A26D450B0A0503AC00A10BB3 /* peermessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1838A309DEC0430047D688 /* peermessages.h */; };
@ -321,6 +322,7 @@
A259316A0A73B2CC002F4FE7 /* Transmission Help */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Transmission Help"; path = "macosx/Transmission Help"; sourceTree = "<group>"; };
A25FCDDD0A37695F002BCBBE /* PauseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PauseSelected.png; path = macosx/Images/PauseSelected.png; sourceTree = "<group>"; };
A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeSelected.png; path = macosx/Images/ResumeSelected.png; sourceTree = "<group>"; };
A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Error.tiff; path = macosx/Images/Error.tiff; sourceTree = "<group>"; };
A261F1DB0A69A1610002815A /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = macosx/Growl.framework; sourceTree = "<group>"; };
A2710E740A86796000CE4F7D /* PrefsWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PrefsWindow.h; path = macosx/PrefsWindow.h; sourceTree = "<group>"; };
A2710E750A86796000CE4F7D /* PrefsWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PrefsWindow.m; path = macosx/PrefsWindow.m; sourceTree = "<group>"; };
@ -453,6 +455,7 @@
A2305A7D0A3DC9E400AB2D77 /* ProgressBarBlue.png */,
A2305A7E0A3DC9E400AB2D77 /* ProgressBarGray.png */,
A2305A7F0A3DC9E400AB2D77 /* ProgressBarGreen.png */,
A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */,
A2D4F0840A915F7200890C32 /* GreenDot.tiff */,
A2D4F0820A915F6600890C32 /* RedDot.tiff */,
A20AB97A0A5C622A004F81FA /* SmallTurtle.png */,
@ -777,6 +780,7 @@
A2D4F0830A915F6600890C32 /* RedDot.tiff in Resources */,
A2D4F0850A915F7200890C32 /* GreenDot.tiff in Resources */,
A21567ED0A9A5034004DECD6 /* MessageWindow.nib in Resources */,
A260C9AC0AA3B8D700FDC1B7 /* Error.tiff in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

BIN
macosx/Images/Error.tiff Normal file

Binary file not shown.

View File

@ -112,6 +112,7 @@
- (BOOL) isActive;
- (BOOL) isSeeding;
- (BOOL) isPaused;
- (BOOL) isError;
- (BOOL) justFinished;
- (NSArray *) peers;

View File

@ -509,6 +509,11 @@
return fStat->status == TR_STATUS_PAUSE;
}
- (BOOL) isError
{
return fStat->error & TR_ETRACKER;
}
- (BOOL) justFinished
{
return tr_getFinished(fHandle);

View File

@ -32,6 +32,11 @@
{
Torrent * fTorrent;
BOOL fStatusRegular;
NSImage * fProgressWhite, * fProgressBlue, * fProgressGray, * fProgressGreen,
* fProgressAdvanced, * fProgressEndWhite, * fProgressEndBlue,
* fProgressEndGray, * fProgressEndGreen, * fProgressEndAdvanced,
* fErrorImage;
NSUserDefaults * fDefaults;
}

View File

@ -38,10 +38,6 @@
@implementation TorrentCell
static NSImage * fProgressWhite, * fProgressBlue, * fProgressGray, * fProgressGreen,
* fProgressAdvanced, * fProgressEndWhite, * fProgressEndBlue,
* fProgressEndGray, * fProgressEndGreen, * fProgressEndAdvanced;
// Used to optimize drawing. They contain packed RGBA pixels for every color needed.
#define BE OSSwapBigToHostConstInt32
static uint32_t kBorder[] =
@ -68,44 +64,36 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fStatusRegular = [fDefaults boolForKey: @"SmallStatusRegular"];
NSSize startSize = NSMakeSize(100.0, BAR_HEIGHT);
if (!fProgressWhite)
{
fProgressWhite = [NSImage imageNamed: @"ProgressBarWhite.png"];
[fProgressWhite setScalesWhenResized: YES];
}
if (!fProgressBlue)
{
fProgressBlue = [NSImage imageNamed: @"ProgressBarBlue.png"];
[fProgressBlue setScalesWhenResized: YES];
[fProgressBlue setSize: startSize];
}
if (!fProgressGray)
{
fProgressGray = [NSImage imageNamed: @"ProgressBarGray.png"];
[fProgressGray setScalesWhenResized: YES];
[fProgressGray setSize: startSize];
}
if (!fProgressGreen)
{
fProgressGreen = [NSImage imageNamed: @"ProgressBarGreen.png"];
[fProgressGreen setScalesWhenResized: YES];
}
if (!fProgressAdvanced)
{
fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"];
[fProgressAdvanced setScalesWhenResized: YES];
}
if (!fProgressEndWhite)
fProgressEndWhite = [NSImage imageNamed: @"ProgressBarEndWhite.png"];
if (!fProgressEndBlue)
fProgressEndBlue = [NSImage imageNamed: @"ProgressBarEndBlue.png"];
if (!fProgressEndGray)
fProgressEndGray = [NSImage imageNamed: @"ProgressBarEndGray.png"];
if (!fProgressEndGreen)
fProgressEndGreen = [NSImage imageNamed: @"ProgressBarEndGreen.png"];
if (!fProgressEndAdvanced)
fProgressEndAdvanced = [NSImage imageNamed: @"ProgressBarEndAdvanced.png"];
fProgressWhite = [NSImage imageNamed: @"ProgressBarWhite.png"];
[fProgressWhite setScalesWhenResized: YES];
fProgressBlue = [NSImage imageNamed: @"ProgressBarBlue.png"];
[fProgressBlue setScalesWhenResized: YES];
[fProgressBlue setSize: startSize];
fProgressGray = [NSImage imageNamed: @"ProgressBarGray.png"];
[fProgressGray setScalesWhenResized: YES];
[fProgressGray setSize: startSize];
fProgressGreen = [NSImage imageNamed: @"ProgressBarGreen.png"];
[fProgressGreen setScalesWhenResized: YES];
fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"];
[fProgressAdvanced setScalesWhenResized: YES];
fProgressEndWhite = [NSImage imageNamed: @"ProgressBarEndWhite.png"];
fProgressEndBlue = [NSImage imageNamed: @"ProgressBarEndBlue.png"];
fProgressEndGray = [NSImage imageNamed: @"ProgressBarEndGray.png"];
fProgressEndGreen = [NSImage imageNamed: @"ProgressBarEndGreen.png"];
fProgressEndAdvanced = [NSImage imageNamed: @"ProgressBarEndAdvanced.png"];
fErrorImage = [NSImage imageNamed: @"Error.tiff"];
[fErrorImage setFlipped: YES];
[fErrorImage setScalesWhenResized: YES];
[fErrorImage setSize: NSMakeSize(16.0, 16.0)];
}
return self;
}
@ -313,6 +301,16 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[icon drawAtPoint: pen fromRect: NSMakeRect(0, 0, iconSize.width, iconSize.height)
operation: NSCompositeSourceOver fraction: 1.0];
//error badge
if ([fTorrent isError])
{
NSSize errorIconSize = [fErrorImage size];
[fErrorImage drawAtPoint: NSMakePoint(pen.x + iconSize.width - errorIconSize.width,
pen.y + iconSize.height - errorIconSize.height)
fromRect: NSMakeRect(0, 0, errorIconSize.width, errorIconSize.height)
operation: NSCompositeSourceOver fraction: 1.0];
}
float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT;
@ -351,7 +349,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
else //small size
{
//icon
NSImage * icon = [fTorrent iconSmall];
NSImage * icon = ![fTorrent isError] ? [fTorrent iconSmall] : fErrorImage;
NSSize iconSize = [icon size];
pen.x += PADDING;