move file outline view code to a separate class
This commit is contained in:
parent
6c1c7d5cf7
commit
93c79adef2
|
@ -118,6 +118,7 @@
|
|||
A261F1DC0A69A1610002815A /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
|
||||
A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
|
||||
A26397550D0F714300D36DF2 /* ActionPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A26397540D0F714300D36DF2 /* ActionPopUpButton.m */; };
|
||||
A26AF21A0D2DA35A00FF7140 /* FileOutlineController.m in Sources */ = {isa = PBXBuildFile; fileRef = A26AF2190D2DA35A00FF7140 /* FileOutlineController.m */; };
|
||||
A26E75880CB6AA7500226674 /* InfoOptions.png in Resources */ = {isa = PBXBuildFile; fileRef = A26E75870CB6AA7500226674 /* InfoOptions.png */; };
|
||||
A26E75960CB6AB4800226674 /* InfoGeneral.png in Resources */ = {isa = PBXBuildFile; fileRef = A26E75950CB6AB4800226674 /* InfoGeneral.png */; };
|
||||
A2710E770A86796000CE4F7D /* PrefsWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2710E750A86796000CE4F7D /* PrefsWindow.m */; };
|
||||
|
@ -510,6 +511,8 @@
|
|||
A26AF1090D2855FC00FF7140 /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = macosx/ru.lproj/MessageWindow.xib; sourceTree = "<group>"; };
|
||||
A26AF10A0D2855FC00FF7140 /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = macosx/ru.lproj/PrefsWindow.xib; sourceTree = "<group>"; };
|
||||
A26AF10B0D2855FC00FF7140 /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = macosx/ru.lproj/StatsWindow.xib; sourceTree = "<group>"; };
|
||||
A26AF2180D2DA35A00FF7140 /* FileOutlineController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileOutlineController.h; path = macosx/FileOutlineController.h; sourceTree = "<group>"; };
|
||||
A26AF2190D2DA35A00FF7140 /* FileOutlineController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileOutlineController.m; path = macosx/FileOutlineController.m; sourceTree = "<group>"; };
|
||||
A26E75870CB6AA7500226674 /* InfoOptions.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoOptions.png; path = macosx/Images/InfoOptions.png; sourceTree = "<group>"; };
|
||||
A26E75950CB6AB4800226674 /* InfoGeneral.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoGeneral.png; path = macosx/Images/InfoGeneral.png; sourceTree = "<group>"; };
|
||||
A2710E740A86796000CE4F7D /* PrefsWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PrefsWindow.h; path = macosx/PrefsWindow.h; sourceTree = "<group>"; };
|
||||
|
@ -807,6 +810,7 @@
|
|||
A2085DDA0C53BC74000BC3B7 /* AboutWindowController.m */,
|
||||
A234D0D40C79FB6000A82373 /* Additions */,
|
||||
E1B6FBF80C0D719B0015FE4D /* Info Window */,
|
||||
A26AF2220D2DA42800FF7140 /* File Outline View */,
|
||||
E1B6FBFD0C0D72430015FE4D /* Prefs Window */,
|
||||
E1B6FC000C0D72A00015FE4D /* Overlay Window */,
|
||||
E138A9720C04D88F00C5426C /* CTGradient */,
|
||||
|
@ -821,10 +825,6 @@
|
|||
A219798A0D07B78400438EA7 /* GroupToolbarItem.m */,
|
||||
A20BFFB50D091CC700CE5D2B /* ToolbarSegmentedCell.h */,
|
||||
A20BFFB60D091CC700CE5D2B /* ToolbarSegmentedCell.m */,
|
||||
A257C17F0CAD3003004E121C /* PeerTableView.h */,
|
||||
A257C1800CAD3003004E121C /* PeerTableView.m */,
|
||||
A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */,
|
||||
A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */,
|
||||
A22180960D148A71007D09ED /* GroupsWindowController.h */,
|
||||
A22180970D148A71007D09ED /* GroupsWindowController.m */,
|
||||
);
|
||||
|
@ -1083,6 +1083,21 @@
|
|||
name = Additions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A26AF2220D2DA42800FF7140 /* File Outline View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A26AF2180D2DA35A00FF7140 /* FileOutlineController.h */,
|
||||
A26AF2190D2DA35A00FF7140 /* FileOutlineController.m */,
|
||||
A2AF1C360A3D0F6200F1575D /* FileOutlineView.h */,
|
||||
A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */,
|
||||
A2265F3F0B5EF5F40093DDA5 /* FileNameCell.h */,
|
||||
A2265F400B5EF5F40093DDA5 /* FileNameCell.m */,
|
||||
35F373000C2DA88F00DAA8F2 /* FilePriorityCell.h */,
|
||||
35F373010C2DA88F00DAA8F2 /* FilePriorityCell.m */,
|
||||
);
|
||||
name = "File Outline View";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BE1183410CE15DF00002D0F3 /* libminiupnp */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1185,18 +1200,16 @@
|
|||
E1B6FBF80C0D719B0015FE4D /* Info Window */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A257C17F0CAD3003004E121C /* PeerTableView.h */,
|
||||
A257C1800CAD3003004E121C /* PeerTableView.m */,
|
||||
A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */,
|
||||
A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */,
|
||||
A200B8390A2263BA007BBB1E /* InfoWindowController.h */,
|
||||
A200B83A0A2263BA007BBB1E /* InfoWindowController.m */,
|
||||
A2AF1C360A3D0F6200F1575D /* FileOutlineView.h */,
|
||||
A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */,
|
||||
A2265F3F0B5EF5F40093DDA5 /* FileNameCell.h */,
|
||||
A2265F400B5EF5F40093DDA5 /* FileNameCell.m */,
|
||||
A2A1CB770BF29D5500AE959F /* PeerProgressIndicatorCell.h */,
|
||||
A2A1CB780BF29D5500AE959F /* PeerProgressIndicatorCell.m */,
|
||||
A2AA579A0ADFCAB400CA59F6 /* PiecesView.h */,
|
||||
A2AA579B0ADFCAB400CA59F6 /* PiecesView.m */,
|
||||
35F373000C2DA88F00DAA8F2 /* FilePriorityCell.h */,
|
||||
35F373010C2DA88F00DAA8F2 /* FilePriorityCell.m */,
|
||||
);
|
||||
name = "Info Window";
|
||||
sourceTree = "<group>";
|
||||
|
@ -1737,6 +1750,7 @@
|
|||
A26397550D0F714300D36DF2 /* ActionPopUpButton.m in Sources */,
|
||||
A25AFDE90D1038AD0092A1BA /* MenuLabel.m in Sources */,
|
||||
A22180980D148A71007D09ED /* GroupsWindowController.m in Sources */,
|
||||
A26AF21A0D2DA35A00FF7140 /* FileOutlineController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,53 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2008 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class Torrent;
|
||||
@class FileOutlineView;
|
||||
|
||||
@interface FileOutlineController : NSObject
|
||||
{
|
||||
Torrent * fTorrent;
|
||||
|
||||
IBOutlet FileOutlineView * fOutline;
|
||||
|
||||
#warning generate outside nib
|
||||
IBOutlet NSMenuItem * fFileCheckItem, * fFileUncheckItem,
|
||||
* fFilePriorityNormal, * fFilePriorityHigh, * fFilePriorityLow;
|
||||
}
|
||||
|
||||
- (void) setTorrent: (Torrent *) torrent;
|
||||
|
||||
- (void) reloadData;
|
||||
|
||||
- (void) setHoverRowForEvent: (NSEvent *) event;
|
||||
|
||||
- (void) setCheck: (id) sender;
|
||||
- (void) setOnlySelectedCheck: (id) sender;
|
||||
- (void) setPriority: (id) sender;
|
||||
|
||||
- (void) revealFile: (id) sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,334 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2008 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import "FileOutlineController.h"
|
||||
#import "Torrent.h"
|
||||
#import "FileOutlineView.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
|
||||
#define ROW_SMALL_HEIGHT 18.0
|
||||
|
||||
@implementation FileOutlineController
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[fOutline setDoubleAction: @selector(revealFile:)];
|
||||
|
||||
//set table header tool tips
|
||||
if ([NSApp isOnLeopardOrBetter])
|
||||
{NSLog(@"hafhdash");
|
||||
[[fOutline tableColumnWithIdentifier: @"Check"] setHeaderToolTip: NSLocalizedString(@"Download",
|
||||
"file table -> header tool tip")];
|
||||
[[fOutline tableColumnWithIdentifier: @"Priority"] setHeaderToolTip: NSLocalizedString(@"Priority",
|
||||
"file table -> header tool tip")];
|
||||
}
|
||||
|
||||
//set priority item images
|
||||
[fFilePriorityNormal setImage: [NSImage imageNamed: @"PriorityNormal.png"]];
|
||||
[fFilePriorityLow setImage: [NSImage imageNamed: @"PriorityLow.png"]];
|
||||
[fFilePriorityHigh setImage: [NSImage imageNamed: @"PriorityHigh.png"]];
|
||||
|
||||
[self setTorrent: nil];
|
||||
}
|
||||
|
||||
- (void) setTorrent: (Torrent *) torrent
|
||||
{
|
||||
fTorrent = torrent;
|
||||
[fOutline setTorrent: fTorrent];
|
||||
|
||||
[fOutline deselectAll: nil];
|
||||
[fOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) reloadData
|
||||
{
|
||||
[fOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) setHoverRowForEvent: (NSEvent *) event
|
||||
{
|
||||
[fOutline setHoverRowForEvent: event];
|
||||
}
|
||||
|
||||
- (int) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
|
||||
{
|
||||
if (!item)
|
||||
return [[fTorrent fileList] count];
|
||||
return [[item objectForKey: @"IsFolder"] boolValue] ? [[item objectForKey: @"Children"] count] : 0;
|
||||
}
|
||||
|
||||
- (BOOL) outlineView: (NSOutlineView *) outlineView isItemExpandable: (id) item
|
||||
{
|
||||
return [[item objectForKey: @"IsFolder"] boolValue];
|
||||
}
|
||||
|
||||
- (id) outlineView: (NSOutlineView *) outlineView child: (int) index ofItem: (id) item
|
||||
{
|
||||
return [(item ? [item objectForKey: @"Children"] : [fTorrent fileList]) objectAtIndex: index];
|
||||
}
|
||||
|
||||
- (id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
|
||||
{
|
||||
if ([[tableColumn identifier] isEqualToString: @"Check"])
|
||||
return [NSNumber numberWithInt: [fTorrent checkForFiles: [item objectForKey: @"Indexes"]]];
|
||||
else
|
||||
return item;
|
||||
}
|
||||
|
||||
- (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell
|
||||
forTableColumn: (NSTableColumn *) tableColumn item: (id) item
|
||||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Check"])
|
||||
[cell setEnabled: [fTorrent canChangeDownloadCheckForFiles: [item objectForKey: @"Indexes"]]];
|
||||
else if ([identifier isEqualToString: @"Priority"])
|
||||
[cell setRepresentedObject: item];
|
||||
else;
|
||||
}
|
||||
|
||||
- (void) outlineView: (NSOutlineView *) outlineView setObjectValue: (id) object
|
||||
forTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
|
||||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Check"])
|
||||
{
|
||||
NSIndexSet * indexSet;
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)
|
||||
indexSet = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrent fileCount])];
|
||||
else
|
||||
indexSet = [item objectForKey: @"Indexes"];
|
||||
|
||||
[fTorrent setFileCheckState: [object intValue] != NSOffState ? NSOnState : NSOffState forIndexes: indexSet];
|
||||
[fOutline reloadData];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) outlineView: (NSOutlineView *) outlineView typeSelectStringForTableColumn: (NSTableColumn *) tableColumn item: (id) item
|
||||
{
|
||||
return [item objectForKey: @"Name"];
|
||||
}
|
||||
|
||||
- (NSString *) outlineView: (NSOutlineView *) outlineView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
|
||||
tableColumn: (NSTableColumn *) tableColumn item: (id) item mouseLocation: (NSPoint) mouseLocation
|
||||
{
|
||||
NSString * ident = [tableColumn identifier];
|
||||
if ([ident isEqualToString: @"Name"])
|
||||
return [[fTorrent downloadFolder] stringByAppendingPathComponent: [item objectForKey: @"Path"]];
|
||||
else if ([ident isEqualToString: @"Check"])
|
||||
{
|
||||
switch ([cell state])
|
||||
{
|
||||
case NSOffState:
|
||||
return NSLocalizedString(@"Don't Download", "files tab -> tooltip");
|
||||
case NSOnState:
|
||||
return NSLocalizedString(@"Download", "files tab -> tooltip");
|
||||
case NSMixedState:
|
||||
return NSLocalizedString(@"Download Some", "files tab -> tooltip");
|
||||
}
|
||||
}
|
||||
else if ([ident isEqualToString: @"Priority"])
|
||||
{
|
||||
NSSet * priorities = [fTorrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
|
||||
switch ([priorities count])
|
||||
{
|
||||
case 0:
|
||||
return NSLocalizedString(@"Priority Not Available", "files tab -> tooltip");
|
||||
case 1:
|
||||
switch ([[priorities anyObject] intValue])
|
||||
{
|
||||
case TR_PRI_LOW:
|
||||
return NSLocalizedString(@"Low Priority", "files tab -> tooltip");
|
||||
case TR_PRI_HIGH:
|
||||
return NSLocalizedString(@"High Priority", "files tab -> tooltip");
|
||||
case TR_PRI_NORMAL:
|
||||
return NSLocalizedString(@"Normal Priority", "files tab -> tooltip");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return NSLocalizedString(@"Multiple Priorities", "files tab -> tooltip");
|
||||
}
|
||||
}
|
||||
else;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (float) outlineView: (NSOutlineView *) outlineView heightOfRowByItem: (id) item
|
||||
{
|
||||
if ([[item objectForKey: @"IsFolder"] boolValue])
|
||||
return ROW_SMALL_HEIGHT;
|
||||
else
|
||||
return [outlineView rowHeight];
|
||||
}
|
||||
|
||||
- (void) setCheck: (id) sender
|
||||
{
|
||||
int state = sender == fFileCheckItem ? NSOnState : NSOffState;
|
||||
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
[fTorrent setFileCheckState: state forIndexes: itemIndexes];
|
||||
[fOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) setOnlySelectedCheck: (id) sender
|
||||
{
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
[fTorrent setFileCheckState: NSOnState forIndexes: itemIndexes];
|
||||
|
||||
NSMutableIndexSet * remainingItemIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrent fileCount])];
|
||||
[remainingItemIndexes removeIndexes: itemIndexes];
|
||||
[fTorrent setFileCheckState: NSOffState forIndexes: remainingItemIndexes];
|
||||
|
||||
[fOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) setPriority: (id) sender
|
||||
{
|
||||
int priority;
|
||||
if (sender == fFilePriorityHigh)
|
||||
priority = TR_PRI_HIGH;
|
||||
else if (sender == fFilePriorityLow)
|
||||
priority = TR_PRI_LOW;
|
||||
else
|
||||
priority = TR_PRI_NORMAL;
|
||||
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
[fTorrent setFilePriority: priority forIndexes: itemIndexes];
|
||||
[fOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) revealFile: (id) sender
|
||||
{
|
||||
NSString * folder = [fTorrent downloadFolder];
|
||||
NSIndexSet * indexes = [fOutline selectedRowIndexes];
|
||||
int i;
|
||||
for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
[[NSWorkspace sharedWorkspace] selectFile: [folder stringByAppendingPathComponent:
|
||||
[[fOutline itemAtRow: i] objectForKey: @"Path"]] inFileViewerRootedAtPath: nil];
|
||||
}
|
||||
|
||||
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
||||
{
|
||||
if (!fTorrent)
|
||||
return NO;
|
||||
|
||||
SEL action = [menuItem action];
|
||||
|
||||
if (action == @selector(revealFile:))
|
||||
{
|
||||
NSString * downloadFolder = [fTorrent downloadFolder];
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:
|
||||
[downloadFolder stringByAppendingPathComponent: [[[fTorrent fileList] objectAtIndex: i] objectForKey: @"Path"]]])
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (action == @selector(setCheck:))
|
||||
{
|
||||
if ([fOutline numberOfSelectedRows] <= 0)
|
||||
return NO;
|
||||
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i, state = (menuItem == fFileCheckItem) ? NSOnState : NSOffState;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
return [fTorrent checkForFiles: itemIndexes] != state && [fTorrent canChangeDownloadCheckForFiles: itemIndexes];
|
||||
}
|
||||
|
||||
if (action == @selector(setOnlySelectedCheck:))
|
||||
{
|
||||
if ([fOutline numberOfSelectedRows] <= 0)
|
||||
return NO;
|
||||
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
return [fTorrent canChangeDownloadCheckForFiles: itemIndexes];
|
||||
}
|
||||
|
||||
if (action == @selector(setPriority:))
|
||||
{
|
||||
if ([fOutline numberOfSelectedRows] <= 0)
|
||||
{
|
||||
[menuItem setState: NSOffState];
|
||||
return NO;
|
||||
}
|
||||
|
||||
//determine which priorities are checked
|
||||
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
|
||||
BOOL current = NO, other = NO;
|
||||
int i, priority;
|
||||
|
||||
if (menuItem == fFilePriorityHigh)
|
||||
priority = TR_PRI_HIGH;
|
||||
else if (menuItem == fFilePriorityLow)
|
||||
priority = TR_PRI_LOW;
|
||||
else
|
||||
priority = TR_PRI_NORMAL;
|
||||
|
||||
NSIndexSet * fileIndexSet;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound && (!current || !other); i = [indexSet indexGreaterThanIndex: i])
|
||||
{
|
||||
fileIndexSet = [[fOutline itemAtRow: i] objectForKey: @"Indexes"];
|
||||
if (![fTorrent canChangeDownloadCheckForFiles: fileIndexSet])
|
||||
continue;
|
||||
else if ([fTorrent hasFilePriority: priority forIndexes: fileIndexSet])
|
||||
current = YES;
|
||||
else
|
||||
other = YES;
|
||||
}
|
||||
|
||||
[menuItem setState: current ? NSOnState : NSOffState];
|
||||
return current || other;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
|
@ -24,13 +24,13 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "Torrent.h"
|
||||
#import "FileOutlineView.h"
|
||||
#import "FileOutlineController.h"
|
||||
#import "PiecesView.h"
|
||||
#import <transmission.h>
|
||||
|
||||
@interface InfoWindowController : NSWindowController
|
||||
{
|
||||
NSArray * fTorrents, * fPeers, * fFiles;
|
||||
NSArray * fTorrents, * fPeers;
|
||||
|
||||
IBOutlet NSView * fInfoView, * fActivityView, * fPeersView, * fFilesView, * fOptionsView;
|
||||
int fCurrentTabTag;
|
||||
|
@ -56,9 +56,7 @@
|
|||
IBOutlet PiecesView * fPiecesView;
|
||||
IBOutlet NSSegmentedControl * fPiecesControl;
|
||||
|
||||
IBOutlet FileOutlineView * fFileOutline;
|
||||
IBOutlet NSMenuItem * fFileCheckItem, * fFileUncheckItem,
|
||||
* fFilePriorityNormal, * fFilePriorityHigh, * fFilePriorityLow;
|
||||
IBOutlet FileOutlineController * fFileController;
|
||||
|
||||
IBOutlet NSPopUpButton * fRatioPopUp, * fUploadLimitPopUp, * fDownloadLimitPopUp;
|
||||
IBOutlet NSTextField * fUploadLimitField, * fDownloadLimitField, * fRatioLimitField, * fPeersConnectField,
|
||||
|
@ -81,11 +79,6 @@
|
|||
|
||||
- (void) revealTorrentFile: (id) sender;
|
||||
- (void) revealDataFile: (id) sender;
|
||||
- (void) revealFile: (id) sender;
|
||||
|
||||
- (void) setCheck: (id) sender;
|
||||
- (void) setOnlySelectedCheck: (id) sender;
|
||||
- (void) setPriority: (id) sender;
|
||||
|
||||
- (void) setSpeedMode: (id) sender;
|
||||
- (void) setSpeedLimit: (id) sender;
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#import "NSApplicationAdditions.h"
|
||||
#import "NSStringAdditions.h"
|
||||
|
||||
#define FILE_ROW_SMALL_HEIGHT 18.0
|
||||
|
||||
#define TAB_INFO_IDENT @"Info"
|
||||
#define TAB_ACTIVITY_IDENT @"Activity"
|
||||
#define TAB_PEERS_IDENT @"Peers"
|
||||
|
@ -126,9 +124,6 @@ typedef enum
|
|||
[fPeerTable setSortDescriptors: [NSArray arrayWithObject: [[fPeerTable tableColumnWithIdentifier: @"IP"]
|
||||
sortDescriptorPrototype]]];
|
||||
|
||||
//set file table
|
||||
[fFileOutline setDoubleAction: @selector(revealFile:)];
|
||||
|
||||
//set table header tool tips
|
||||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
|
@ -139,19 +134,9 @@ typedef enum
|
|||
[[fPeerTable tableColumnWithIdentifier: @"UL To"] setHeaderToolTip: NSLocalizedString(@"Uploading To Peer",
|
||||
"inspector -> peer table -> header tool tip")];
|
||||
[[fPeerTable tableColumnWithIdentifier: @"DL From"] setHeaderToolTip: NSLocalizedString(@"Downloading From Peer",
|
||||
"inspector -> peer table -> header tool tip")];
|
||||
|
||||
[[fFileOutline tableColumnWithIdentifier: @"Check"] setHeaderToolTip: NSLocalizedString(@"Download",
|
||||
"inspector -> file table -> header tool tip")];
|
||||
[[fFileOutline tableColumnWithIdentifier: @"Priority"] setHeaderToolTip: NSLocalizedString(@"Priority",
|
||||
"inspector -> file table -> header tool tip")];
|
||||
"inspector -> peer table -> header tool tip")];
|
||||
}
|
||||
|
||||
//set priority item images
|
||||
[fFilePriorityNormal setImage: [NSImage imageNamed: @"PriorityNormal.png"]];
|
||||
[fFilePriorityLow setImage: [NSImage imageNamed: @"PriorityLow.png"]];
|
||||
[fFilePriorityHigh setImage: [NSImage imageNamed: @"PriorityHigh.png"]];
|
||||
|
||||
//set blank inspector
|
||||
[self setInfoForTorrents: [NSArray array]];
|
||||
|
||||
|
@ -172,7 +157,6 @@ typedef enum
|
|||
|
||||
[fTorrents release];
|
||||
[fPeers release];
|
||||
[fFiles release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -243,7 +227,7 @@ typedef enum
|
|||
[fPeersConnectField setStringValue: @""];
|
||||
}
|
||||
|
||||
[fFileOutline setTorrent: nil];
|
||||
[fFileController setTorrent: nil];
|
||||
|
||||
[fNameField setToolTip: nil];
|
||||
|
||||
|
@ -304,18 +288,12 @@ typedef enum
|
|||
[fPeers release];
|
||||
fPeers = nil;
|
||||
}
|
||||
|
||||
if (fFiles)
|
||||
{
|
||||
[fFiles release];
|
||||
fFiles = nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
|
||||
[fFileOutline setTorrent: torrent];
|
||||
[fFileController setTorrent: torrent];
|
||||
|
||||
NSImage * icon = [[torrent icon] copy];
|
||||
[icon setFlipped: NO];
|
||||
|
@ -394,11 +372,6 @@ typedef enum
|
|||
[fPiecesControl setSelected: !piecesAvailableSegment forSegment: PIECES_CONTROL_PROGRESS];
|
||||
[fPiecesControl setEnabled: YES];
|
||||
[fPiecesView setTorrent: torrent];
|
||||
|
||||
//set file table
|
||||
[fFileOutline deselectAll: nil];
|
||||
[fFiles release];
|
||||
fFiles = [[torrent fileList] retain];
|
||||
}
|
||||
|
||||
//update stats and settings
|
||||
|
@ -406,8 +379,7 @@ typedef enum
|
|||
[self updateOptions];
|
||||
|
||||
[fPeerTable reloadData];
|
||||
[fFileOutline deselectAll: nil];
|
||||
[fFileOutline reloadData];
|
||||
[fFileController reloadData];
|
||||
}
|
||||
|
||||
- (void) updateInfoStats
|
||||
|
@ -556,95 +528,6 @@ typedef enum
|
|||
[fPeersConnectField setStringValue: @""];
|
||||
}
|
||||
|
||||
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
||||
{
|
||||
SEL action = [menuItem action];
|
||||
|
||||
if (action == @selector(revealFile:))
|
||||
{
|
||||
if ([fTabMatrix selectedTag] != TAB_FILES_TAG)
|
||||
return NO;
|
||||
|
||||
NSString * downloadFolder = [[fTorrents objectAtIndex: 0] downloadFolder];
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:
|
||||
[downloadFolder stringByAppendingPathComponent: [[fFiles objectAtIndex: i] objectForKey: @"Path"]]])
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (action == @selector(setCheck:))
|
||||
{
|
||||
if ([fFileOutline numberOfSelectedRows] <= 0)
|
||||
return NO;
|
||||
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i, state = (menuItem == fFileCheckItem) ? NSOnState : NSOffState;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
return [torrent checkForFiles: itemIndexes] != state && [torrent canChangeDownloadCheckForFiles: itemIndexes];
|
||||
}
|
||||
|
||||
if (action == @selector(setOnlySelectedCheck:))
|
||||
{
|
||||
if ([fFileOutline numberOfSelectedRows] <= 0)
|
||||
return NO;
|
||||
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
return [torrent canChangeDownloadCheckForFiles: itemIndexes];
|
||||
}
|
||||
|
||||
if (action == @selector(setPriority:))
|
||||
{
|
||||
if ([fFileOutline numberOfSelectedRows] <= 0)
|
||||
{
|
||||
[menuItem setState: NSOffState];
|
||||
return NO;
|
||||
}
|
||||
|
||||
//determine which priorities are checked
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
BOOL current = NO, other = NO;
|
||||
int i, priority;
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
|
||||
if (menuItem == fFilePriorityHigh)
|
||||
priority = TR_PRI_HIGH;
|
||||
else if (menuItem == fFilePriorityLow)
|
||||
priority = TR_PRI_LOW;
|
||||
else
|
||||
priority = TR_PRI_NORMAL;
|
||||
|
||||
NSIndexSet * fileIndexSet;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound && (!current || !other); i = [indexSet indexGreaterThanIndex: i])
|
||||
{
|
||||
fileIndexSet = [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"];
|
||||
if (![torrent canChangeDownloadCheckForFiles: fileIndexSet])
|
||||
continue;
|
||||
else if ([torrent hasFilePriority: priority forIndexes: fileIndexSet])
|
||||
current = YES;
|
||||
else
|
||||
other = YES;
|
||||
}
|
||||
|
||||
[menuItem setState: current ? NSOnState : NSOffState];
|
||||
return current || other;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSRect) windowWillUseStandardFrame: (NSWindow *) window defaultFrame: (NSRect) defaultFrame
|
||||
{
|
||||
NSRect windowRect = [window frame];
|
||||
|
@ -911,123 +794,9 @@ typedef enum
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (int) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
|
||||
{
|
||||
if (!item)
|
||||
return [fFiles count];
|
||||
return [[item objectForKey: @"IsFolder"] boolValue] ? [[item objectForKey: @"Children"] count] : 0;
|
||||
}
|
||||
|
||||
- (BOOL) outlineView: (NSOutlineView *) outlineView isItemExpandable: (id) item
|
||||
{
|
||||
return [[item objectForKey: @"IsFolder"] boolValue];
|
||||
}
|
||||
|
||||
- (id) outlineView: (NSOutlineView *) outlineView child: (int) index ofItem: (id) item
|
||||
{
|
||||
return [(item ? [item objectForKey: @"Children"] : fFiles) objectAtIndex: index];
|
||||
}
|
||||
|
||||
- (id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
|
||||
{
|
||||
if ([[tableColumn identifier] isEqualToString: @"Check"])
|
||||
return [NSNumber numberWithInt: [[fTorrents objectAtIndex: 0] checkForFiles: [item objectForKey: @"Indexes"]]];
|
||||
else
|
||||
return item;
|
||||
}
|
||||
|
||||
- (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell
|
||||
forTableColumn: (NSTableColumn *) tableColumn item: (id) item
|
||||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Check"])
|
||||
[cell setEnabled: [[fTorrents objectAtIndex: 0] canChangeDownloadCheckForFiles: [item objectForKey: @"Indexes"]]];
|
||||
else if ([identifier isEqualToString: @"Priority"])
|
||||
[cell setRepresentedObject: item];
|
||||
else;
|
||||
}
|
||||
|
||||
- (void) outlineView: (NSOutlineView *) outlineView setObjectValue: (id) object
|
||||
forTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
|
||||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Check"])
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSIndexSet * indexSet;
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)
|
||||
indexSet = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [torrent fileCount])];
|
||||
else
|
||||
indexSet = [item objectForKey: @"Indexes"];
|
||||
|
||||
[torrent setFileCheckState: [object intValue] != NSOffState ? NSOnState : NSOffState forIndexes: indexSet];
|
||||
[fFileOutline reloadData];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) outlineView: (NSOutlineView *) outlineView typeSelectStringForTableColumn: (NSTableColumn *) tableColumn item: (id) item
|
||||
{
|
||||
return [item objectForKey: @"Name"];
|
||||
}
|
||||
|
||||
- (NSString *) outlineView: (NSOutlineView *) outlineView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
|
||||
tableColumn: (NSTableColumn *) tableColumn item: (id) item mouseLocation: (NSPoint) mouseLocation
|
||||
{
|
||||
NSString * ident = [tableColumn identifier];
|
||||
if ([ident isEqualToString: @"Name"])
|
||||
return [[[fTorrents objectAtIndex: 0] downloadFolder] stringByAppendingPathComponent: [item objectForKey: @"Path"]];
|
||||
else if ([ident isEqualToString: @"Check"])
|
||||
{
|
||||
switch ([cell state])
|
||||
{
|
||||
case NSOffState:
|
||||
return NSLocalizedString(@"Don't Download", "Inspector -> files tab -> tooltip");
|
||||
case NSOnState:
|
||||
return NSLocalizedString(@"Download", "Inspector -> files tab -> tooltip");
|
||||
case NSMixedState:
|
||||
return NSLocalizedString(@"Download Some", "Inspector -> files tab -> tooltip");
|
||||
}
|
||||
}
|
||||
else if ([ident isEqualToString: @"Priority"])
|
||||
{
|
||||
NSSet * priorities = [[fTorrents objectAtIndex: 0] filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
|
||||
switch([priorities count])
|
||||
{
|
||||
case 0:
|
||||
return NSLocalizedString(@"Priority Not Available", "Inspector -> files tab -> tooltip");
|
||||
case 1:
|
||||
switch ([[priorities anyObject] intValue])
|
||||
{
|
||||
case TR_PRI_LOW:
|
||||
return NSLocalizedString(@"Low Priority", "Inspector -> files tab -> tooltip");
|
||||
case TR_PRI_HIGH:
|
||||
return NSLocalizedString(@"High Priority", "Inspector -> files tab -> tooltip");
|
||||
case TR_PRI_NORMAL:
|
||||
return NSLocalizedString(@"Normal Priority", "Inspector -> files tab -> tooltip");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return NSLocalizedString(@"Multiple Priorities", "Inspector -> files tab -> tooltip");
|
||||
}
|
||||
}
|
||||
else;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (float) outlineView: (NSOutlineView *) outlineView heightOfRowByItem: (id) item
|
||||
{
|
||||
if ([[item objectForKey: @"IsFolder"] boolValue])
|
||||
return FILE_ROW_SMALL_HEIGHT;
|
||||
else
|
||||
return [outlineView rowHeight];
|
||||
}
|
||||
|
||||
- (void) mouseMoved: (NSEvent *) event
|
||||
{
|
||||
[fFileOutline setHoverRowForEvent: fCurrentTabTag == TAB_FILES_TAG ? event : nil];
|
||||
[fFileController setHoverRowForEvent: fCurrentTabTag == TAB_FILES_TAG ? event : nil];
|
||||
}
|
||||
|
||||
- (void) setPiecesView: (id) sender
|
||||
|
@ -1056,73 +825,6 @@ typedef enum
|
|||
[[fTorrents objectAtIndex: 0] revealData];
|
||||
}
|
||||
|
||||
- (void) revealFile: (id) sender
|
||||
{
|
||||
if (!fFiles)
|
||||
return;
|
||||
|
||||
NSString * folder = [[fTorrents objectAtIndex: 0] downloadFolder];
|
||||
NSIndexSet * indexes = [fFileOutline selectedRowIndexes];
|
||||
int i;
|
||||
for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
[[NSWorkspace sharedWorkspace] selectFile: [folder stringByAppendingPathComponent:
|
||||
[[fFileOutline itemAtRow: i] objectForKey: @"Path"]] inFileViewerRootedAtPath: nil];
|
||||
}
|
||||
|
||||
- (void) setCheck: (id) sender
|
||||
{
|
||||
int state = sender == fFileCheckItem ? NSOnState : NSOffState;
|
||||
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
[torrent setFileCheckState: state forIndexes: itemIndexes];
|
||||
[fFileOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) setOnlySelectedCheck: (id) sender
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
[torrent setFileCheckState: NSOnState forIndexes: itemIndexes];
|
||||
|
||||
NSMutableIndexSet * remainingItemIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [torrent fileCount])];
|
||||
[remainingItemIndexes removeIndexes: itemIndexes];
|
||||
[torrent setFileCheckState: NSOffState forIndexes: remainingItemIndexes];
|
||||
|
||||
[fFileOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) setPriority: (id) sender
|
||||
{
|
||||
int priority;
|
||||
if (sender == fFilePriorityHigh)
|
||||
priority = TR_PRI_HIGH;
|
||||
else if (sender == fFilePriorityLow)
|
||||
priority = TR_PRI_LOW;
|
||||
else
|
||||
priority = TR_PRI_NORMAL;
|
||||
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
|
||||
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
|
||||
int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
|
||||
|
||||
[torrent setFilePriority: priority forIndexes: itemIndexes];
|
||||
[fFileOutline reloadData];
|
||||
}
|
||||
|
||||
- (void) setSpeedMode: (id) sender
|
||||
{
|
||||
BOOL upload = sender == fUploadLimitPopUp;
|
||||
|
@ -1386,7 +1088,7 @@ typedef enum
|
|||
if ([fTorrents count] == 1)
|
||||
{
|
||||
[[fTorrents objectAtIndex: 0] updateFileStat];
|
||||
[fFileOutline reloadData];
|
||||
[fFileController reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue