diff --git a/macosx/FileOutlineController.h b/macosx/FileOutlineController.h index 0c24fd288..6d6f119c6 100644 --- a/macosx/FileOutlineController.h +++ b/macosx/FileOutlineController.h @@ -47,6 +47,8 @@ - (void) setCheck: (id) sender; - (void) setOnlySelectedCheck: (id) sender; +- (void) checkAll; +- (void) uncheckAll; - (void) setPriority: (id) sender; - (void) revealFile: (id) sender; diff --git a/macosx/FileOutlineController.m b/macosx/FileOutlineController.m index 6d074b913..805860356 100644 --- a/macosx/FileOutlineController.m +++ b/macosx/FileOutlineController.m @@ -378,6 +378,20 @@ typedef enum [fOutline setNeedsDisplay: YES]; } +- (void) checkAll +{ + NSIndexSet * indexSet = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrent fileCount])]; + [fTorrent setFileCheckState: NSOnState forIndexes: indexSet]; + [fOutline setNeedsDisplay: YES]; +} + +- (void) uncheckAll +{ + NSIndexSet * indexSet = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrent fileCount])]; + [fTorrent setFileCheckState: NSOffState forIndexes: indexSet]; + [fOutline setNeedsDisplay: YES]; +} + - (void) setPriority: (id) sender { tr_priority_t priority; diff --git a/macosx/InfoFileView.xib b/macosx/InfoFileView.xib index 9b6b231c0..64be73dee 100644 --- a/macosx/InfoFileView.xib +++ b/macosx/InfoFileView.xib @@ -2,19 +2,20 @@ 1060 - 11B26 - 1617 - 1138 - 566.00 + 11E53 + 2182 + 1138.47 + 569.00 com.apple.InterfaceBuilder.CocoaPlugin - 1617 + 2182 NSTextFieldCell NSOutlineView NSScrollView NSSearchField + NSButton NSCustomView NSButtonCell NSTableColumn @@ -25,7 +26,10 @@ com.apple.InterfaceBuilder.CocoaPlugin - + + PluginDependencyRecalculationVersion + + InfoFileViewController @@ -37,9 +41,61 @@ NSApplication - + 274 + + + 289 + {{238, 10}, {42, 17}} + + + + _NS:9 + YES + + -2080244224 + 134348800 + All + + LucidaGrande + 11 + 3100 + + _NS:9 + + -2038152961 + 164 + + + 400 + 75 + + + + + 289 + {{288, 10}, {42, 17}} + + + + _NS:9 + YES + + -2080244224 + 134348800 + None + + _NS:9 + + -2038152961 + 164 + + + 400 + 75 + + 274 @@ -53,6 +109,8 @@ 256 {318, 324} + + YES @@ -69,11 +127,7 @@ 75628096 2048 Name - - LucidaGrande - 11 - 3100 - + 3 MC4zMzMzMzI5OQA @@ -212,6 +266,7 @@ {{1, 1}, {318, 324}} + @@ -222,6 +277,8 @@ 256 {{304, 1}, {15, 324}} + + _doScroller: 0.99692307692307691 @@ -231,6 +288,8 @@ -2147483392 {{-100, -100}, {328, 15}} + + 1 _doScroller: @@ -239,7 +298,8 @@ {{10, 34}, {320, 326}} - + + 133138 @@ -251,6 +311,8 @@ 292 {{10, 10}, {110, 19}} + + YES 343014976 @@ -305,6 +367,9 @@ {340, 365} + + + NSView @@ -324,30 +389,6 @@ 16 - - - fOutline - - - - 18 - - - - dataSource - - - - 19 - - - - delegate - - - - 20 - setFileFilterText: @@ -372,6 +413,62 @@ 24 + + + checkAll: + + + + 29 + + + + uncheckAll: + + + + 30 + + + + fCheckAllButton + + + + 31 + + + + fUncheckAllButton + + + + 32 + + + + dataSource + + + + 19 + + + + delegate + + + + 20 + + + + fOutline + + + + 18 + @@ -405,6 +502,8 @@ + + Files @@ -497,6 +596,32 @@ File Outline Controller + + 25 + + + + + + + + 26 + + + + + 27 + + + + + + + + 28 + + + @@ -512,6 +637,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -527,9 +656,90 @@ - 24 + 32 + + + + + FileOutlineController + NSObject + + fOutline + FileOutlineView + + + fOutline + + fOutline + FileOutlineView + + + + IBProjectSource + ./Classes/FileOutlineController.h + + + + FileOutlineView + NSOutlineView + + IBProjectSource + ./Classes/FileOutlineView.h + + + + InfoFileViewController + NSViewController + + id + id + id + + + + checkAll: + id + + + setFileFilterText: + id + + + uncheckAll: + id + + + + NSButton + FileOutlineController + NSSearchField + NSButton + + + + fCheckAllButton + NSButton + + + fFileController + FileOutlineController + + + fFileFilterField + NSSearchField + + + fUncheckAllButton + NSButton + + + + IBProjectSource + ./Classes/InfoFileViewController.h + + + - 0 IBCocoaFramework @@ -538,7 +748,7 @@ com.apple.InterfaceBuilder.CocoaPlugin.macosx - + YES 3 diff --git a/macosx/InfoFileViewController.h b/macosx/InfoFileViewController.h index 265b45073..c19f4b131 100644 --- a/macosx/InfoFileViewController.h +++ b/macosx/InfoFileViewController.h @@ -37,6 +37,7 @@ IBOutlet FileOutlineController * fFileController; IBOutlet NSSearchField * fFileFilterField; + IBOutlet NSButton * fCheckAllButton, *fUncheckAllButton; } - (void) setInfoForTorrents: (NSArray *) torrents; @@ -44,7 +45,9 @@ - (void) saveViewSize; -- (void) setFileFilterText: (id) sender; +- (IBAction) setFileFilterText: (id) sender; +- (IBAction) checkAll: (id) sender; +- (IBAction) uncheckAll: (id) sender; - (NSArray *) quickLookURLs; - (BOOL) canQuickLook; diff --git a/macosx/InfoFileViewController.m b/macosx/InfoFileViewController.m index 94df61dc2..8a9e54e21 100644 --- a/macosx/InfoFileViewController.m +++ b/macosx/InfoFileViewController.m @@ -83,7 +83,17 @@ [self setupInfo]; if ([fTorrents count] == 1) + { [fFileController refresh]; + + Torrent * torrent = [fTorrents objectAtIndex: 0]; + if ([torrent isFolder]) + { + const NSInteger filesCheckState = [torrent checkForFiles: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [torrent fileCount])]]; + [fCheckAllButton setEnabled: filesCheckState != NSOnState]; //if anything is unchecked + [fUncheckAllButton setEnabled: ![torrent allDownloaded]]; //if there are any checked files that aren't finished + } + } } - (void) saveViewSize @@ -96,6 +106,16 @@ [fFileController setFilterText: [sender stringValue]]; } +- (IBAction) checkAll: (id) sender +{ + [fFileController checkAll]; +} + +- (IBAction) uncheckAll: (id) sender +{ + [fFileController uncheckAll]; +} + - (NSArray *) quickLookURLs { FileOutlineView * fileOutlineView = [fFileController outlineView]; @@ -173,12 +193,24 @@ Torrent * torrent = [fTorrents objectAtIndex: 0]; [fFileController setTorrent: torrent]; - [fFileFilterField setEnabled: [torrent isFolder]]; + + const BOOL isFolder = [torrent isFolder]; + [fFileFilterField setEnabled: isFolder]; + + if (!isFolder) + { + [fCheckAllButton setEnabled: NO]; + [fUncheckAllButton setEnabled: NO]; + } } else { [fFileController setTorrent: nil]; + [fFileFilterField setEnabled: NO]; + + [fCheckAllButton setEnabled: NO]; + [fUncheckAllButton setEnabled: NO]; } fSet = YES;