mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 17:59:50 +00:00
Cleaned ResultWindow's code up.
This commit is contained in:
parent
9da9c269c1
commit
ad3114c56b
@ -32,12 +32,17 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
ProblemDialog *problemDialog;
|
ProblemDialog *problemDialog;
|
||||||
}
|
}
|
||||||
- (id)initWithParentApp:(AppDelegateBase *)app;
|
- (id)initWithParentApp:(AppDelegateBase *)app;
|
||||||
|
|
||||||
|
/* Virtual */
|
||||||
|
- (void)initResultColumns;
|
||||||
|
- (void)setScanOptions;
|
||||||
|
- (NSString *)getScanErrorMessageForCode:(NSInteger)errorCode;
|
||||||
|
|
||||||
/* Helpers */
|
/* Helpers */
|
||||||
- (void)fillColumnsMenu;
|
- (void)fillColumnsMenu;
|
||||||
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn;
|
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn;
|
||||||
- (NSArray *)getColumnsOrder;
|
- (NSArray *)getColumnsOrder;
|
||||||
- (NSDictionary *)getColumnsWidth;
|
- (NSDictionary *)getColumnsWidth;
|
||||||
- (void)initResultColumns;
|
|
||||||
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;
|
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;
|
||||||
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted;
|
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted;
|
||||||
- (void)updateOptionSegments;
|
- (void)updateOptionSegments;
|
||||||
|
@ -44,6 +44,26 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Virtual */
|
||||||
|
- (void)initResultColumns
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setScanOptions
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)getScanErrorMessageForCode:(NSInteger)errorCode
|
||||||
|
{
|
||||||
|
if (errorCode == 0) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
if (errorCode == 3) {
|
||||||
|
return @"The selected directories contain no scannable file.";
|
||||||
|
}
|
||||||
|
return @"Unknown Error.";
|
||||||
|
}
|
||||||
|
|
||||||
/* Helpers */
|
/* Helpers */
|
||||||
- (void)fillColumnsMenu
|
- (void)fillColumnsMenu
|
||||||
{
|
{
|
||||||
@ -96,11 +116,6 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initResultColumns
|
|
||||||
{
|
|
||||||
// Virtual
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth
|
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth
|
||||||
{
|
{
|
||||||
for (NSMenuItem *mi in [columnsMenu itemArray]) {
|
for (NSMenuItem *mi in [columnsMenu itemArray]) {
|
||||||
@ -344,7 +359,17 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
- (IBAction)startDuplicateScan:(id)sender
|
- (IBAction)startDuplicateScan:(id)sender
|
||||||
{
|
{
|
||||||
// Virtual
|
if ([py resultsAreModified]) {
|
||||||
|
if ([Dialogs askYesNo:@"You have unsaved results, do you really want to continue?"] == NSAlertSecondButtonReturn) // NO
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[self setScanOptions];
|
||||||
|
NSInteger r = n2i([py doScan]);
|
||||||
|
NSString *errorMsg = [self getScanErrorMessageForCode:r];
|
||||||
|
if (errorMsg != nil) {
|
||||||
|
[[ProgressController mainProgressController] hide];
|
||||||
|
[Dialogs showMessage:errorMsg];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)switchSelected:(id)sender
|
- (IBAction)switchSelected:(id)sender
|
||||||
|
@ -8,7 +8,6 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "../base/ResultWindow.h"
|
#import "../base/ResultWindow.h"
|
||||||
#import "DirectoryPanel.h"
|
|
||||||
|
|
||||||
@interface ResultWindow : ResultWindowBase {}
|
@interface ResultWindow : ResultWindowBase {}
|
||||||
- (IBAction)removeDeadTracks:(id)sender;
|
- (IBAction)removeDeadTracks:(id)sender;
|
||||||
|
@ -7,10 +7,9 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import "ResultWindow.h"
|
#import "ResultWindow.h"
|
||||||
#import "../../cocoalib/Dialogs.h"
|
#import "Dialogs.h"
|
||||||
#import "../../cocoalib/ProgressController.h"
|
#import "Utils.h"
|
||||||
#import "../../cocoalib/Utils.h"
|
#import "PyDupeGuru.h"
|
||||||
#import "AppDelegate.h"
|
|
||||||
#import "Consts.h"
|
#import "Consts.h"
|
||||||
|
|
||||||
@implementation ResultWindow
|
@implementation ResultWindow
|
||||||
@ -24,37 +23,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actions */
|
- (void)setScanOptions
|
||||||
- (IBAction)removeDeadTracks:(id)sender
|
|
||||||
{
|
{
|
||||||
[(PyDupeGuru *)py scanDeadTracks];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)resetColumnsToDefault:(id)sender
|
|
||||||
{
|
|
||||||
NSMutableArray *columnsOrder = [NSMutableArray array];
|
|
||||||
[columnsOrder addObject:@"0"];
|
|
||||||
[columnsOrder addObject:@"2"];
|
|
||||||
[columnsOrder addObject:@"3"];
|
|
||||||
[columnsOrder addObject:@"4"];
|
|
||||||
[columnsOrder addObject:@"6"];
|
|
||||||
[columnsOrder addObject:@"15"];
|
|
||||||
NSMutableDictionary *columnsWidth = [NSMutableDictionary dictionary];
|
|
||||||
[columnsWidth setObject:i2n(235) forKey:@"0"];
|
|
||||||
[columnsWidth setObject:i2n(63) forKey:@"2"];
|
|
||||||
[columnsWidth setObject:i2n(50) forKey:@"3"];
|
|
||||||
[columnsWidth setObject:i2n(50) forKey:@"4"];
|
|
||||||
[columnsWidth setObject:i2n(40) forKey:@"6"];
|
|
||||||
[columnsWidth setObject:i2n(57) forKey:@"15"];
|
|
||||||
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)startDuplicateScan:(id)sender
|
|
||||||
{
|
|
||||||
if ([py resultsAreModified]) {
|
|
||||||
if ([Dialogs askYesNo:@"You have unsaved results, do you really want to continue?"] == NSAlertSecondButtonReturn) // NO
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||||
PyDupeGuru *_py = (PyDupeGuru *)py;
|
PyDupeGuru *_py = (PyDupeGuru *)py;
|
||||||
[_py setScanType:[ud objectForKey:@"scanType"]];
|
[_py setScanType:[ud objectForKey:@"scanType"]];
|
||||||
@ -69,13 +39,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[_py setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
[_py setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||||
[_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
[_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||||
[_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]];
|
[_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]];
|
||||||
NSInteger r = n2i([py doScan]);
|
|
||||||
if (r == 3) {
|
|
||||||
[Dialogs showMessage:@"The selected directories contain no scannable file."];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Public */
|
|
||||||
- (void)initResultColumns
|
- (void)initResultColumns
|
||||||
{
|
{
|
||||||
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
||||||
@ -106,6 +71,31 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[_resultColumns addObject:[self getColumnForIdentifier:17 title:@"Dupe Count" width:80 refCol:refCol]];
|
[_resultColumns addObject:[self getColumnForIdentifier:17 title:@"Dupe Count" width:80 refCol:refCol]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Actions */
|
||||||
|
- (IBAction)removeDeadTracks:(id)sender
|
||||||
|
{
|
||||||
|
[(PyDupeGuru *)py scanDeadTracks];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)resetColumnsToDefault:(id)sender
|
||||||
|
{
|
||||||
|
NSMutableArray *columnsOrder = [NSMutableArray array];
|
||||||
|
[columnsOrder addObject:@"0"];
|
||||||
|
[columnsOrder addObject:@"2"];
|
||||||
|
[columnsOrder addObject:@"3"];
|
||||||
|
[columnsOrder addObject:@"4"];
|
||||||
|
[columnsOrder addObject:@"6"];
|
||||||
|
[columnsOrder addObject:@"15"];
|
||||||
|
NSMutableDictionary *columnsWidth = [NSMutableDictionary dictionary];
|
||||||
|
[columnsWidth setObject:i2n(235) forKey:@"0"];
|
||||||
|
[columnsWidth setObject:i2n(63) forKey:@"2"];
|
||||||
|
[columnsWidth setObject:i2n(50) forKey:@"3"];
|
||||||
|
[columnsWidth setObject:i2n(50) forKey:@"4"];
|
||||||
|
[columnsWidth setObject:i2n(40) forKey:@"6"];
|
||||||
|
[columnsWidth setObject:i2n(57) forKey:@"15"];
|
||||||
|
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
||||||
|
}
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
- (void)jobCompleted:(NSNotification *)aNotification
|
- (void)jobCompleted:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
|
@ -8,10 +8,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
#import "ResultWindow.h"
|
#import "ResultWindow.h"
|
||||||
#import "Dialogs.h"
|
#import "Dialogs.h"
|
||||||
#import "ProgressController.h"
|
|
||||||
#import "Utils.h"
|
#import "Utils.h"
|
||||||
#import "AppDelegate.h"
|
#import "PyDupeGuru.h"
|
||||||
#import "Consts.h"
|
|
||||||
|
|
||||||
@implementation ResultWindow
|
@implementation ResultWindow
|
||||||
/* Override */
|
/* Override */
|
||||||
@ -24,6 +22,40 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)initResultColumns
|
||||||
|
{
|
||||||
|
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
||||||
|
_resultColumns = [[NSMutableArray alloc] init];
|
||||||
|
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:1 title:@"Directory" width:120 refCol:refCol]];
|
||||||
|
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:@"Size (KB)" width:63 refCol:refCol];
|
||||||
|
[[sizeCol dataCell] setAlignment:NSRightTextAlignment];
|
||||||
|
[_resultColumns addObject:sizeCol];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:3 title:@"Kind" width:40 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:4 title:@"Dimensions" width:80 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:5 title:@"Modification" width:120 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:6 title:@"Match %" width:58 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:7 title:@"Dupe Count" width:80 refCol:refCol]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setScanOptions
|
||||||
|
{
|
||||||
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
PyDupeGuru *_py = (PyDupeGuru *)py;
|
||||||
|
[_py setMinMatchPercentage:[ud objectForKey:@"minMatchPercentage"]];
|
||||||
|
[_py setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||||
|
[_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||||
|
[_py setMatchScaled:[ud objectForKey:@"matchScaled"]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)getScanErrorMessageForCode:(NSInteger)errorCode
|
||||||
|
{
|
||||||
|
if (errorCode == 4) {
|
||||||
|
return @"The iPhoto application couldn't be found.";
|
||||||
|
}
|
||||||
|
return [super getScanErrorMessageForCode:errorCode];
|
||||||
|
}
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
- (IBAction)clearPictureCache:(id)sender
|
- (IBAction)clearPictureCache:(id)sender
|
||||||
{
|
{
|
||||||
@ -48,45 +80,4 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[columnsWidth setObject:i2n(58) forKey:@"6"];
|
[columnsWidth setObject:i2n(58) forKey:@"6"];
|
||||||
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)startDuplicateScan:(id)sender
|
|
||||||
{
|
|
||||||
if ([py resultsAreModified]) {
|
|
||||||
if ([Dialogs askYesNo:@"You have unsaved results, do you really want to continue?"] == NSAlertSecondButtonReturn) // NO
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
|
||||||
PyDupeGuru *_py = (PyDupeGuru *)py;
|
|
||||||
[_py setMinMatchPercentage:[ud objectForKey:@"minMatchPercentage"]];
|
|
||||||
[_py setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
|
||||||
[_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
|
||||||
[_py setMatchScaled:[ud objectForKey:@"matchScaled"]];
|
|
||||||
int r = n2i([py doScan]);
|
|
||||||
if (r != 0) {
|
|
||||||
[[ProgressController mainProgressController] hide];
|
|
||||||
}
|
|
||||||
if (r == 3) {
|
|
||||||
[Dialogs showMessage:@"The selected directories contain no scannable file."];
|
|
||||||
}
|
|
||||||
if (r == 4) {
|
|
||||||
[Dialogs showMessage:@"The iPhoto application couldn't be found."];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Public */
|
|
||||||
- (void)initResultColumns
|
|
||||||
{
|
|
||||||
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
|
||||||
_resultColumns = [[NSMutableArray alloc] init];
|
|
||||||
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:1 title:@"Directory" width:120 refCol:refCol]];
|
|
||||||
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:@"Size (KB)" width:63 refCol:refCol];
|
|
||||||
[[sizeCol dataCell] setAlignment:NSRightTextAlignment];
|
|
||||||
[_resultColumns addObject:sizeCol];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:3 title:@"Kind" width:40 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:4 title:@"Dimensions" width:80 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:5 title:@"Modification" width:120 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:6 title:@"Match %" width:58 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:7 title:@"Dupe Count" width:80 refCol:refCol]];
|
|
||||||
}
|
|
||||||
@end
|
@end
|
@ -8,11 +8,6 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "../base/ResultWindow.h"
|
#import "../base/ResultWindow.h"
|
||||||
#import "DirectoryPanel.h"
|
|
||||||
|
|
||||||
@interface ResultWindow : ResultWindowBase
|
@interface ResultWindow : ResultWindowBase {}
|
||||||
{
|
|
||||||
NSString *_lastAction;
|
|
||||||
}
|
|
||||||
- (IBAction)resetColumnsToDefault:(id)sender;
|
|
||||||
@end
|
@end
|
||||||
|
@ -7,20 +7,49 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import "ResultWindow.h"
|
#import "ResultWindow.h"
|
||||||
#import "../../cocoalib/Dialogs.h"
|
#import "Utils.h"
|
||||||
#import "../../cocoalib/ProgressController.h"
|
#import "PyDupeGuru.h"
|
||||||
#import "../../cocoalib/Utils.h"
|
|
||||||
#import "AppDelegate.h"
|
|
||||||
#import "Consts.h"
|
|
||||||
|
|
||||||
@implementation ResultWindow
|
@implementation ResultWindow
|
||||||
/* Override */
|
/* Override */
|
||||||
- (void)awakeFromNib
|
- (id)initWithParentApp:(AppDelegateBase *)aApp;
|
||||||
{
|
{
|
||||||
[super awakeFromNib];
|
self = [super initWithParentApp:aApp];
|
||||||
NSMutableIndexSet *deltaColumns = [NSMutableIndexSet indexSetWithIndex:2];
|
NSMutableIndexSet *deltaColumns = [NSMutableIndexSet indexSetWithIndex:2];
|
||||||
[deltaColumns addIndex:4];
|
[deltaColumns addIndex:4];
|
||||||
[table setDeltaColumns:deltaColumns];
|
[table setDeltaColumns:deltaColumns];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initResultColumns
|
||||||
|
{
|
||||||
|
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
||||||
|
_resultColumns = [[NSMutableArray alloc] init];
|
||||||
|
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:1 title:@"Directory" width:120 refCol:refCol]];
|
||||||
|
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:@"Size (KB)" width:63 refCol:refCol];
|
||||||
|
[[sizeCol dataCell] setAlignment:NSRightTextAlignment];
|
||||||
|
[_resultColumns addObject:sizeCol];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:3 title:@"Kind" width:40 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:4 title:@"Modification" width:120 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:5 title:@"Match %" width:60 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:6 title:@"Words Used" width:120 refCol:refCol]];
|
||||||
|
[_resultColumns addObject:[self getColumnForIdentifier:7 title:@"Dupe Count" width:80 refCol:refCol]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setScanOptions
|
||||||
|
{
|
||||||
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
PyDupeGuru *_py = (PyDupeGuru *)py;
|
||||||
|
[_py setScanType:[ud objectForKey:@"scanType"]];
|
||||||
|
[_py setMinMatchPercentage:[ud objectForKey:@"minMatchPercentage"]];
|
||||||
|
[_py setWordWeighting:[ud objectForKey:@"wordWeighting"]];
|
||||||
|
[_py setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||||
|
[_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||||
|
[_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]];
|
||||||
|
int smallFileThreshold = [ud integerForKey:@"smallFileThreshold"]; // In KB
|
||||||
|
int sizeThreshold = [ud boolForKey:@"ignoreSmallFiles"] ? smallFileThreshold * 1024 : 0; // The py side wants bytes
|
||||||
|
[_py setSizeThreshold:sizeThreshold];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
@ -38,47 +67,4 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[columnsWidth setObject:i2n(60) forKey:@"5"];
|
[columnsWidth setObject:i2n(60) forKey:@"5"];
|
||||||
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)startDuplicateScan:(id)sender
|
|
||||||
{
|
|
||||||
if ([py resultsAreModified]) {
|
|
||||||
if ([Dialogs askYesNo:@"You have unsaved results, do you really want to continue?"] == NSAlertSecondButtonReturn) // NO
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
|
||||||
PyDupeGuru *_py = (PyDupeGuru *)py;
|
|
||||||
[_py setScanType:[ud objectForKey:@"scanType"]];
|
|
||||||
[_py setMinMatchPercentage:[ud objectForKey:@"minMatchPercentage"]];
|
|
||||||
[_py setWordWeighting:[ud objectForKey:@"wordWeighting"]];
|
|
||||||
[_py setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
|
||||||
[_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
|
||||||
[_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]];
|
|
||||||
int smallFileThreshold = [ud integerForKey:@"smallFileThreshold"]; // In KB
|
|
||||||
int sizeThreshold = [ud boolForKey:@"ignoreSmallFiles"] ? smallFileThreshold * 1024 : 0; // The py side wants bytes
|
|
||||||
[_py setSizeThreshold:sizeThreshold];
|
|
||||||
int r = n2i([py doScan]);
|
|
||||||
if (r != 0)
|
|
||||||
[[ProgressController mainProgressController] hide];
|
|
||||||
if (r == 3) {
|
|
||||||
[Dialogs showMessage:@"The selected directories contain no scannable file."];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Public */
|
|
||||||
- (void)initResultColumns
|
|
||||||
{
|
|
||||||
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
|
||||||
_resultColumns = [[NSMutableArray alloc] init];
|
|
||||||
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:1 title:@"Directory" width:120 refCol:refCol]];
|
|
||||||
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:@"Size (KB)" width:63 refCol:refCol];
|
|
||||||
[[sizeCol dataCell] setAlignment:NSRightTextAlignment];
|
|
||||||
[_resultColumns addObject:sizeCol];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:3 title:@"Kind" width:40 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:4 title:@"Modification" width:120 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:5 title:@"Match %" width:60 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:6 title:@"Words Used" width:120 refCol:refCol]];
|
|
||||||
[_resultColumns addObject:[self getColumnForIdentifier:7 title:@"Dupe Count" width:80 refCol:refCol]];
|
|
||||||
}
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user