Changeset 3475


Ignore:
Timestamp:
Oct 20, 2007, 7:13:52 PM (15 years ago)
Author:
livings124
Message:

simplify how the file outline accesses the torrent

Location:
trunk/macosx
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileNameCell.m

    r3083 r3475  
    2323 *****************************************************************************/
    2424
     25#import "FileOutlineView.h"
    2526#import "FileNameCell.h"
    26 #import "InfoWindowController.h"
     27#import "Torrent.h"
    2728#import "NSStringAdditions.h"
    2829
     
    9091                    fraction: 1.0];
    9192   
    92     Torrent * torrent = [[[[self controlView] window] windowController] selectedTorrent];
    93    
    9493    //title
    9594    NSColor * specialColor = nil;
     
    9796            && [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]])
    9897        specialColor = [NSColor whiteColor];
    99     else if ([torrent checkForFiles: [[self objectValue] objectForKey: @"Indexes"]] == NSOffState)
     98    else if ([[(FileOutlineView *)[self controlView] torrent] checkForFiles:
     99                    [[self objectValue] objectForKey: @"Indexes"]] == NSOffState)
    100100        specialColor = [NSColor disabledControlTextColor];
    101101    else;
     
    196196        [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName];
    197197   
    198     Torrent * torrent = [[[[self controlView] window] windowController] selectedTorrent];
     198    Torrent * torrent = [(FileOutlineView *)[self controlView] torrent];
    199199    float percent = [torrent fileProgress: [[[self objectValue] objectForKey: @"Indexes"] firstIndex]] * 100.0;
    200200   
  • trunk/macosx/FileOutlineView.h

    r3366 r3475  
    2525#import <Cocoa/Cocoa.h>
    2626
     27@class Torrent;
     28
    2729@interface FileOutlineView : NSOutlineView
    2830{
     31    Torrent * fTorrent;
     32   
    2933    NSColor * fHighPriorityColor, * fLowPriorityColor, * fMixedPriorityColor;
    3034   
     
    3236}
    3337
     38- (void) setTorrent: (Torrent *) torrent;
     39- (Torrent *) torrent;
     40
    3441- (void) setHoverRowForEvent: (NSEvent *) event;
    3542- (int) hoverRow;
  • trunk/macosx/FileOutlineView.m

    r3366 r3475  
    2626#import "FileNameCell.h"
    2727#import "FilePriorityCell.h"
    28 #import "InfoWindowController.h"
    2928#import "Torrent.h"
    3029
     
    5857   
    5958    [super dealloc];
     59}
     60
     61- (void) setTorrent: (Torrent *) torrent
     62{
     63    fTorrent = torrent;
     64}
     65
     66- (Torrent *) torrent
     67{
     68    return fTorrent;
    6069}
    6170
     
    111120    {
    112121        NSDictionary * item = [self itemAtRow: row];
    113         Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent];
    114122        NSIndexSet * indexes = [item objectForKey: @"Indexes"];
    115123       
    116         if ([torrent checkForFiles: indexes] != NSOffState)
     124        if ([fTorrent checkForFiles: indexes] != NSOffState)
    117125        {
    118             NSSet * priorities = [torrent filePrioritiesForIndexes: indexes];
     126            NSSet * priorities = [fTorrent filePrioritiesForIndexes: indexes];
    119127            int count = [priorities count];
    120128            if (count > 0)
  • trunk/macosx/FilePriorityCell.m

    r3083 r3475  
    2424
    2525#import "FilePriorityCell.h"
    26 #import "InfoWindowController.h"
     26#import "FileOutlineView.h"
    2727#import "Torrent.h"
    2828
     
    5252   
    5353    //only for when clicking manually
    54     Torrent * torrent = [[[[self controlView] window] windowController] selectedTorrent];
    55    
    5654    int priority;
    5755    if (segment == 0)
     
    6260        priority = TR_PRI_NORMAL;
    6361   
     62    Torrent * torrent = [(FileOutlineView *)[self controlView] torrent];
    6463    [torrent setFilePriority: priority forIndexes: [[self representedObject] objectForKey: @"Indexes"]];
    6564    [(FileOutlineView *)[self controlView] reloadData];
     
    6867- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
    6968{
    70     Torrent * torrent = [(InfoWindowController *)[[[self controlView] window] windowController] selectedTorrent];
     69    Torrent * torrent = [(FileOutlineView *)[self controlView] torrent];
    7170    NSDictionary * dict = [self representedObject];
    7271    NSSet * priorities = [torrent filePrioritiesForIndexes: [dict objectForKey: @"Indexes"]];
  • trunk/macosx/InfoWindowController.h

    r3304 r3475  
    7171
    7272- (void) updateInfoForTorrents: (NSArray *) torrents;
    73 - (Torrent *) selectedTorrent;
    7473- (void) updateInfoStats;
    7574
  • trunk/macosx/InfoWindowController.m

    r3438 r3475  
    229229        }
    230230       
     231        [fFileOutline setTorrent: nil];
     232       
    231233        [fImageView setImage: fAppIcon];
    232234       
     
    302304    {   
    303305        Torrent * torrent = [fTorrents objectAtIndex: 0];
     306       
     307        [fFileOutline setTorrent: torrent];
    304308       
    305309        NSImage * icon = [[torrent icon] copy];
     
    379383    [fFileOutline deselectAll: nil];
    380384    [fFileOutline reloadData];
    381 }
    382 
    383 - (Torrent *) selectedTorrent
    384 {
    385     return fTorrents && [fTorrents count] == 1 ? [fTorrents objectAtIndex: 0] : nil;
    386385}
    387386
  • trunk/macosx/TransmissionHelp/html/FAQ.html

    r3472 r3475  
    6161                        </div>
    6262                                <p>Growl is a notification system. Lots of applications can interface with it.<br>
    63                                 <a href="http://growl.info">http://growl.info</a>
     63                                <a href="http://growl.info/">http://growl.info/</a>
    6464                                <p>
    6565                        <div id="pagetitle">
Note: See TracChangeset for help on using the changeset viewer.