Changeset 5873


Ignore:
Timestamp:
May 21, 2008, 3:45:27 PM (14 years ago)
Author:
livings124
Message:

add QuickLook? to the main window (keeping it in the info window as well)

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r5858 r5873  
    256256- (void) showMainWindow: (id) sender;
    257257
     258- (NSArray *) quickLookURLs;
     259- (NSRect) quickLookFrameWithURL: (NSURL*) url;
     260
    258261- (void) linkHomepage: (id) sender;
    259262- (void) linkForums: (id) sender;
  • trunk/macosx/Controller.m

    r5872 r5873  
    27312731{
    27322732    [fInfoController setInfoForTorrents: [fTableView selectedTorrents]];
     2733    [[QuickLookController quickLook] updateQuickLook];
    27332734}
    27342735
     
    40174018}
    40184019
     4020- (NSArray *) quickLookURLs
     4021{
     4022    NSArray * selectedTorrents = [fTableView selectedTorrents];
     4023    NSMutableArray * urlArray = [NSMutableArray arrayWithCapacity: [selectedTorrents count]];
     4024   
     4025    NSEnumerator * enumerator = [selectedTorrents objectEnumerator];
     4026    Torrent * torrent;
     4027   
     4028    while ((torrent = [enumerator nextObject]))
     4029        [urlArray addObject: [NSURL fileURLWithPath: [torrent dataLocation]]];
     4030   
     4031    return urlArray;
     4032}
     4033
     4034- (NSRect) quickLookFrameWithURL: (NSURL *) url
     4035{
     4036    NSString * fullPath = [url path];
     4037    NSRange visibleRows = [fTableView rowsInRect: [fTableView bounds]];
     4038   
     4039    //do in reverse to find torrent before group
     4040    int row;
     4041    for (row = NSMaxRange(visibleRows) - 1; row >= visibleRows.location; row--)
     4042    {
     4043        id item = [fTableView itemAtRow: row];
     4044        if ([item isKindOfClass: [Torrent class]] && [[(Torrent *)item dataLocation] isEqualToString: fullPath])
     4045        {
     4046            NSRect frame = [fTableView rectOfRow: row];
     4047            frame.origin = [fTableView convertPoint: frame.origin toView: nil];
     4048            frame.origin = [fWindow convertBaseToScreen: frame.origin];
     4049            frame.origin.y -= frame.size.height;
     4050            return frame;
     4051        }
     4052    }
     4053   
     4054    return NSZeroRect;
     4055}
     4056
    40194057- (void) linkHomepage: (id) sender
    40204058{
  • trunk/macosx/InfoWindowController.m

    r5872 r5873  
    925925   
    926926    int row;
    927     for (row = visibleRows.location; row <= row + visibleRows.length; row++)
     927    for (row = visibleRows.location; row < NSMaxRange(visibleRows); row++)
    928928    {
    929929        id rowItem = [fileOutlineView itemAtRow: row];
  • trunk/macosx/QuickLookController.m

    r5872 r5873  
    6969        return [fInfoController quickLookFrameWithURL: url];
    7070    else
    71     {
    72         /*NSRect frame = [fImageView frame];
    73         frame.origin = [[self window] convertBaseToScreen: frame.origin];
    74         return frame;*/
    75     }
    76    
    77     return NSZeroRect;
     71        return [fMainController quickLookFrameWithURL: url];
    7872}
    7973
     
    8882        urlArray = [fInfoController quickLookURLs];
    8983    else
    90     {
    91         /*if ([fTorrents count] > 0)
    92         {
    93             urlArray = [NSMutableArray arrayWithCapacity: [fTorrents count]];
    94             NSEnumerator * enumerator = [fTorrents objectEnumerator];
    95             Torrent * torrent;
    96             while ((torrent = [enumerator nextObject]))
    97             {
    98                 if ([torrent folder] || [torrent progress] == 1.0)
    99                     [urlArray addObject: [NSURL fileURLWithPath: [torrent dataLocation]]];
    100             }
    101         }*/
    102     }
     84        urlArray = [fMainController quickLookURLs];
    10385   
    10486    if (urlArray && [urlArray count] > 0)
  • trunk/macosx/TorrentTableView.m

    r5814 r5873  
    2626#import "TorrentCell.h"
    2727#import "Torrent.h"
     28#import "QuickLookController.h"
    2829#import "NSApplicationAdditions.h"
    2930
     
    525526- (void) keyDown: (NSEvent *) event
    526527{
    527     if ([[event charactersIgnoringModifiers] isEqualToString: @"f"] && [event modifierFlags] & NSAlternateKeyMask
     528    unichar firstChar = [[event charactersIgnoringModifiers] characterAtIndex: 0];
     529   
     530    if (firstChar == 'f' && [event modifierFlags] & NSAlternateKeyMask
    528531        && [event modifierFlags] & NSCommandKeyMask)
    529532        [fController focusFilterField];
    530533    else
     534    {
     535        //handle quicklook
     536        if (firstChar == ' ')
     537            [[QuickLookController quickLook] toggleQuickLook];
     538        else if (firstChar == NSRightArrowFunctionKey)
     539            [[QuickLookController quickLook] pressRight];
     540        else if (firstChar == NSLeftArrowFunctionKey)
     541            [[QuickLookController quickLook] pressLeft];
     542        else;
     543       
    531544        [super keyDown: event];
     545    }
    532546}
    533547
Note: See TracChangeset for help on using the changeset viewer.