Changeset 2179


Ignore:
Timestamp:
Jun 21, 2007, 11:21:19 PM (15 years ago)
Author:
livings124
Message:

cleaned up the pieces view segment control code a bit, and clicking the view will toggle it

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/InfoWindow.nib/info.nib

    r2178 r2179  
    88        <dict>
    99                <key>549</key>
    10                 <string>565 283 144 118 0 0 1152 842 </string>
     10                <string>565 283 174 149 0 0 1152 842 </string>
    1111        </dict>
    1212        <key>IBFramework Version</key>
     
    2222        <key>IBOpenObjects</key>
    2323        <array>
    24                 <integer>549</integer>
    2524                <integer>5</integer>
    2625        </array>
  • trunk/macosx/InfoWindowController.h

    r2178 r2179  
    7474
    7575- (void) setPiecesView: (id) sender;
     76- (void) setPiecesViewForAvailable: (BOOL) available;
    7677
    7778- (void) revealTorrentFile: (id) sender;
  • trunk/macosx/InfoWindowController.m

    r2178 r2179  
    101101    [self setWindowForTab: identifier animate: NO];
    102102   
    103     //set pieces control
    104     [fPiecesControl setSelectedSegment: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]
    105                                             ? PIECES_CONTROL_AVAILABLE : PIECES_CONTROL_PROGRESS];
    106    
    107103    //initially sort peer table by IP
    108104    if ([[fPeerTable sortDescriptors] count] == 0)
     
    221217        [fDateActivityField setStringValue: @""];
    222218       
     219        [fPiecesControl setEnabled: NO];
     220        [fPiecesView setTorrent: nil];
     221       
     222        [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_AVAILABLE];
     223        [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_PROGRESS];
    223224        [fPiecesControl setEnabled: NO];
    224225        [fPiecesView setTorrent: nil];
     
    286287        [fDataLocationField setSelectable: YES];
    287288       
     289        //set pieces view
     290        BOOL piecesAvailableSegment = [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"];
     291        [fPiecesControl setSelected: piecesAvailableSegment forSegment: PIECES_CONTROL_AVAILABLE];
     292        [fPiecesControl setSelected: !piecesAvailableSegment forSegment: PIECES_CONTROL_PROGRESS];
    288293        [fPiecesControl setEnabled: YES];
     294       
    289295        [fPiecesView setTorrent: torrent];
    290296       
     
    9941000- (void) setPiecesView: (id) sender
    9951001{
    996     [[NSUserDefaults standardUserDefaults] setBool: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE
    997                             forKey: @"PiecesViewShowAvailability"];
     1002    [self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE];
     1003}
     1004
     1005- (void) setPiecesViewForAvailable: (BOOL) available
     1006{
     1007    [fPiecesControl setSelected: available forSegment: PIECES_CONTROL_AVAILABLE];
     1008    [fPiecesControl setSelected: !available forSegment: PIECES_CONTROL_PROGRESS];
     1009   
     1010    [[NSUserDefaults standardUserDefaults] setBool: available forKey: @"PiecesViewShowAvailability"];
    9981011    [fPiecesView updateView: YES];
    9991012}
  • trunk/macosx/PiecesView.m

    r2174 r2179  
    2424
    2525#import "PiecesView.h"
     26#import "InfoWindowController.h"
    2627
    2728#define MAX_ACROSS 18
     
    376377}
    377378
     379- (BOOL) acceptsFirstMouse: (NSEvent *) event
     380{
     381    return YES;
     382}
     383
     384- (void) mouseDown: (NSEvent *) event
     385{
     386    if (fTorrent)
     387        [[[self window] windowController] setPiecesViewForAvailable:
     388            ![[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]];
     389    [super mouseDown: event];
     390}
     391
    378392@end
Note: See TracChangeset for help on using the changeset viewer.