Changeset 835


Ignore:
Timestamp:
Aug 29, 2006, 12:09:49 AM (17 years ago)
Author:
livings124
Message:

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

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r828 r835  
    117117                A25FCDEF0A3769A6002BCBBE /* PauseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDD0A37695F002BCBBE /* PauseSelected.png */; };
    118118                A25FCDF00A3769AC002BCBBE /* ResumeSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */; };
     119                A260C9AC0AA3B8D700FDC1B7 /* Error.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */; };
    119120                A261F1DC0A69A1610002815A /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
    120121                A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
     
    322323                A25FCDDD0A37695F002BCBBE /* PauseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PauseSelected.png; path = macosx/Images/PauseSelected.png; sourceTree = "<group>"; };
    323324                A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeSelected.png; path = macosx/Images/ResumeSelected.png; sourceTree = "<group>"; };
     325                A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Error.tiff; path = macosx/Images/Error.tiff; sourceTree = "<group>"; };
    324326                A261F1DB0A69A1610002815A /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = macosx/Growl.framework; sourceTree = "<group>"; };
    325327                A2710E740A86796000CE4F7D /* PrefsWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PrefsWindow.h; path = macosx/PrefsWindow.h; sourceTree = "<group>"; };
     
    454456                                A2305A7E0A3DC9E400AB2D77 /* ProgressBarGray.png */,
    455457                                A2305A7F0A3DC9E400AB2D77 /* ProgressBarGreen.png */,
     458                                A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */,
    456459                                A2D4F0840A915F7200890C32 /* GreenDot.tiff */,
    457460                                A2D4F0820A915F6600890C32 /* RedDot.tiff */,
     
    778781                                A2D4F0850A915F7200890C32 /* GreenDot.tiff in Resources */,
    779782                                A21567ED0A9A5034004DECD6 /* MessageWindow.nib in Resources */,
     783                                A260C9AC0AA3B8D700FDC1B7 /* Error.tiff in Resources */,
    780784                        );
    781785                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/macosx/Torrent.h

    r789 r835  
    113113- (BOOL)    isSeeding;
    114114- (BOOL)    isPaused;
     115- (BOOL)    isError;
    115116- (BOOL)    justFinished;
    116117
  • trunk/macosx/Torrent.m

    r805 r835  
    510510}
    511511
     512- (BOOL) isError
     513{
     514    return fStat->error & TR_ETRACKER;
     515}
     516
    512517- (BOOL) justFinished
    513518{
  • trunk/macosx/TorrentCell.h

    r695 r835  
    3333    Torrent * fTorrent;
    3434    BOOL fStatusRegular;
     35   
     36    NSImage * fProgressWhite, * fProgressBlue, * fProgressGray, * fProgressGreen,
     37                    * fProgressAdvanced, * fProgressEndWhite, * fProgressEndBlue,
     38                    * fProgressEndGray, * fProgressEndGreen, * fProgressEndAdvanced,
     39                    * fErrorImage;
    3540
    3641    NSUserDefaults * fDefaults;
  • trunk/macosx/TorrentCell.m

    r729 r835  
    3939@implementation TorrentCell
    4040
    41 static NSImage * fProgressWhite, * fProgressBlue, * fProgressGray, * fProgressGreen,
    42                 * fProgressAdvanced, * fProgressEndWhite, * fProgressEndBlue,
    43                 * fProgressEndGray, * fProgressEndGreen, * fProgressEndAdvanced;
    44 
    4541// Used to optimize drawing. They contain packed RGBA pixels for every color needed.
    4642#define BE OSSwapBigToHostConstInt32
     
    6965   
    7066        NSSize startSize = NSMakeSize(100.0, BAR_HEIGHT);
    71         if (!fProgressWhite)
    72         {
    73             fProgressWhite = [NSImage imageNamed: @"ProgressBarWhite.png"];
    74             [fProgressWhite setScalesWhenResized: YES];
    75         }
    76         if (!fProgressBlue)
    77         {
    78             fProgressBlue = [NSImage imageNamed: @"ProgressBarBlue.png"];
    79             [fProgressBlue setScalesWhenResized: YES];
    80             [fProgressBlue setSize: startSize];
    81         }
    82         if (!fProgressGray)
    83         {
    84             fProgressGray = [NSImage imageNamed: @"ProgressBarGray.png"];
    85             [fProgressGray setScalesWhenResized: YES];
    86             [fProgressGray setSize: startSize];
    87         }
    88         if (!fProgressGreen)
    89         {
    90             fProgressGreen = [NSImage imageNamed: @"ProgressBarGreen.png"];
    91             [fProgressGreen setScalesWhenResized: YES];
    92         }
    93         if (!fProgressAdvanced)
    94         {
    95             fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"];
    96             [fProgressAdvanced setScalesWhenResized: YES];
    97         }
    98        
    99         if (!fProgressEndWhite)
    100             fProgressEndWhite = [NSImage imageNamed: @"ProgressBarEndWhite.png"];
    101         if (!fProgressEndBlue)
    102             fProgressEndBlue = [NSImage imageNamed: @"ProgressBarEndBlue.png"];
    103         if (!fProgressEndGray)
    104             fProgressEndGray = [NSImage imageNamed: @"ProgressBarEndGray.png"];
    105         if (!fProgressEndGreen)
    106             fProgressEndGreen = [NSImage imageNamed: @"ProgressBarEndGreen.png"];
    107         if (!fProgressEndAdvanced)
    108             fProgressEndAdvanced = [NSImage imageNamed: @"ProgressBarEndAdvanced.png"];
     67       
     68        fProgressWhite = [NSImage imageNamed: @"ProgressBarWhite.png"];
     69        [fProgressWhite setScalesWhenResized: YES];
     70       
     71       
     72        fProgressBlue = [NSImage imageNamed: @"ProgressBarBlue.png"];
     73        [fProgressBlue setScalesWhenResized: YES];
     74        [fProgressBlue setSize: startSize];
     75       
     76        fProgressGray = [NSImage imageNamed: @"ProgressBarGray.png"];
     77        [fProgressGray setScalesWhenResized: YES];
     78        [fProgressGray setSize: startSize];
     79       
     80        fProgressGreen = [NSImage imageNamed: @"ProgressBarGreen.png"];
     81        [fProgressGreen setScalesWhenResized: YES];
     82       
     83        fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"];
     84        [fProgressAdvanced setScalesWhenResized: YES];
     85       
     86       
     87        fProgressEndWhite = [NSImage imageNamed: @"ProgressBarEndWhite.png"];
     88        fProgressEndBlue = [NSImage imageNamed: @"ProgressBarEndBlue.png"];
     89        fProgressEndGray = [NSImage imageNamed: @"ProgressBarEndGray.png"];
     90        fProgressEndGreen = [NSImage imageNamed: @"ProgressBarEndGreen.png"];
     91        fProgressEndAdvanced = [NSImage imageNamed: @"ProgressBarEndAdvanced.png"];
     92       
     93        fErrorImage = [NSImage imageNamed: @"Error.tiff"];
     94        [fErrorImage setFlipped: YES];
     95        [fErrorImage setScalesWhenResized: YES];
     96        [fErrorImage setSize: NSMakeSize(16.0, 16.0)];
    10997    }
    11098    return self;
     
    314302        [icon drawAtPoint: pen fromRect: NSMakeRect(0, 0, iconSize.width, iconSize.height)
    315303                operation: NSCompositeSourceOver fraction: 1.0];
     304       
     305        //error badge
     306        if ([fTorrent isError])
     307        {
     308            NSSize errorIconSize = [fErrorImage size];
     309            [fErrorImage drawAtPoint: NSMakePoint(pen.x + iconSize.width - errorIconSize.width,
     310                                                    pen.y + iconSize.height  - errorIconSize.height)
     311                fromRect: NSMakeRect(0, 0, errorIconSize.width, errorIconSize.height)
     312                operation: NSCompositeSourceOver fraction: 1.0];
     313        }
    316314
    317315        float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT;
     
    352350    {
    353351        //icon
    354         NSImage * icon = [fTorrent iconSmall];
     352        NSImage * icon = ![fTorrent isError] ? [fTorrent iconSmall] : fErrorImage;
    355353        NSSize iconSize = [icon size];
    356354       
Note: See TracChangeset for help on using the changeset viewer.