mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
cocoa: get rid of edition-specific ResultWindow overrides
This commit is contained in:
parent
2be4ae8f65
commit
fb8a384a6a
@ -10,6 +10,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
#import <Sparkle/SUUpdater.h>
|
||||
#import "PyDupeGuru.h"
|
||||
#import "ResultWindow.h"
|
||||
#import "ResultTable.h"
|
||||
#import "DetailsPanel.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "IgnoreListDialog.h"
|
||||
@ -24,7 +25,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
SUUpdater *updater;
|
||||
|
||||
PyDupeGuru *model;
|
||||
ResultWindowBase *_resultWindow;
|
||||
ResultWindow *_resultWindow;
|
||||
DirectoryPanel *_directoryPanel;
|
||||
DetailsPanel *_detailsPanel;
|
||||
IgnoreListDialog *_ignoreListDialog;
|
||||
@ -41,14 +42,14 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
/* Virtual */
|
||||
+ (NSDictionary *)defaultPreferences;
|
||||
- (PyDupeGuru *)model;
|
||||
- (ResultWindowBase *)createResultWindow;
|
||||
- (DirectoryPanel *)createDirectoryPanel;
|
||||
- (DetailsPanel *)createDetailsPanel;
|
||||
- (NSString *)homepageURL;
|
||||
- (void)setScanOptions;
|
||||
- (void)initResultColumns:(ResultTable *)aTable;
|
||||
|
||||
/* Public */
|
||||
- (void)finalizeInit;
|
||||
- (ResultWindowBase *)resultWindow;
|
||||
- (ResultWindow *)resultWindow;
|
||||
- (DirectoryPanel *)directoryPanel;
|
||||
- (DetailsPanel *)detailsPanel;
|
||||
- (HSRecentFiles *)recentResults;
|
||||
|
@ -69,12 +69,12 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
}
|
||||
_recentResults = [[HSRecentFiles alloc] initWithName:@"recentResults" menu:recentResultsMenu];
|
||||
[_recentResults setDelegate:self];
|
||||
_resultWindow = [self createResultWindow];
|
||||
_directoryPanel = [self createDirectoryPanel];
|
||||
_resultWindow = [[ResultWindow alloc] initWithParentApp:self];
|
||||
_directoryPanel = [[DirectoryPanel alloc] initWithParentApp:self];
|
||||
_detailsPanel = [self createDetailsPanel];
|
||||
_ignoreListDialog = [[IgnoreListDialog alloc] initWithPyRef:[model ignoreListDialog]];
|
||||
_progressWindow = [[HSProgressWindow alloc] initWithPyRef:[[self model] progressWindow] view:nil];
|
||||
[_progressWindow setParentWindow:[_resultWindow window]];
|
||||
[_progressWindow setParentWindow:[_directoryPanel window]];
|
||||
_aboutBox = nil; // Lazily loaded
|
||||
_preferencesPanel = nil; // Lazily loaded
|
||||
[[[self directoryPanel] window] makeKeyAndOrderFront:self];
|
||||
@ -87,16 +87,6 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
return model;
|
||||
}
|
||||
|
||||
- (ResultWindowBase *)createResultWindow
|
||||
{
|
||||
return nil; // must be overriden by all editions
|
||||
}
|
||||
|
||||
- (DirectoryPanel *)createDirectoryPanel
|
||||
{
|
||||
return [[DirectoryPanel alloc] initWithParentApp:self];
|
||||
}
|
||||
|
||||
- (DetailsPanel *)createDetailsPanel
|
||||
{
|
||||
return [[DetailsPanel alloc] initWithPyRef:[model detailsPanel]];
|
||||
@ -107,8 +97,16 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
return @""; // must be overriden by all editions
|
||||
}
|
||||
|
||||
- (void)setScanOptions
|
||||
{
|
||||
}
|
||||
|
||||
- (void)initResultColumns:(ResultTable *)aTable
|
||||
{
|
||||
}
|
||||
|
||||
/* Public */
|
||||
- (ResultWindowBase *)resultWindow
|
||||
- (ResultWindow *)resultWindow
|
||||
{
|
||||
return _resultWindow;
|
||||
}
|
||||
@ -191,7 +189,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
- (void)startScanning
|
||||
{
|
||||
[[self resultWindow] startDuplicateScan];
|
||||
[[self directoryPanel] startDuplicateScan];
|
||||
}
|
||||
|
||||
|
||||
@ -254,6 +252,11 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
return [Dialogs askYesNo:prompt] == NSAlertFirstButtonReturn;
|
||||
}
|
||||
|
||||
- (void)showResultsWindow
|
||||
{
|
||||
[[[self resultWindow] window] makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)showProblemDialog
|
||||
{
|
||||
[[self resultWindow] showProblemDialog];
|
||||
|
@ -45,6 +45,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
- (void)popupAddDirectoryMenu:(id)sender;
|
||||
- (void)popupLoadRecentMenu:(id)sender;
|
||||
- (void)removeSelectedDirectory;
|
||||
- (void)startDuplicateScan;
|
||||
|
||||
- (void)addDirectory:(NSString *)directory;
|
||||
- (void)refreshRemoveButtonText;
|
||||
|
@ -137,6 +137,16 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
[self refreshRemoveButtonText];
|
||||
}
|
||||
|
||||
- (void)startDuplicateScan
|
||||
{
|
||||
if ([model resultsAreModified]) {
|
||||
if ([Dialogs askYesNo:NSLocalizedString(@"You have unsaved results, do you really want to continue?", @"")] == NSAlertSecondButtonReturn) // NO
|
||||
return;
|
||||
}
|
||||
[_app setScanOptions];
|
||||
[model doScan];
|
||||
}
|
||||
|
||||
/* Public */
|
||||
- (void)addDirectory:(NSString *)directory
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
@class AppDelegateBase;
|
||||
|
||||
@interface ResultWindowBase : NSWindowController
|
||||
@interface ResultWindow : NSWindowController
|
||||
{
|
||||
@protected
|
||||
NSSegmentedControl *optionsSwitch;
|
||||
@ -43,10 +43,6 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
- (id)initWithParentApp:(AppDelegateBase *)app;
|
||||
|
||||
/* Virtual */
|
||||
- (void)initResultColumns;
|
||||
- (void)setScanOptions;
|
||||
|
||||
/* Helpers */
|
||||
- (void)fillColumnsMenu;
|
||||
- (void)updateOptionSegments;
|
||||
@ -75,7 +71,6 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
- (void)resetColumnsToDefault;
|
||||
- (void)revealSelected;
|
||||
- (void)saveResults;
|
||||
- (void)startDuplicateScan;
|
||||
- (void)switchSelected;
|
||||
- (void)toggleColumn:(id)sender;
|
||||
- (void)toggleDelta;
|
@ -6,7 +6,7 @@ which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import "ResultWindowBase.h"
|
||||
#import "ResultWindow.h"
|
||||
#import "ResultWindow_UI.h"
|
||||
#import "Dialogs.h"
|
||||
#import "ProgressController.h"
|
||||
@ -15,7 +15,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
#import "Consts.h"
|
||||
#import "PrioritizeDialog.h"
|
||||
|
||||
@implementation ResultWindowBase
|
||||
@implementation ResultWindow
|
||||
|
||||
@synthesize optionsSwitch;
|
||||
@synthesize optionsToolbarItem;
|
||||
@ -36,7 +36,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
statsLabel = [[StatsLabel alloc] initWithPyRef:[model statsLabel] view:stats];
|
||||
problemDialog = [[ProblemDialog alloc] initWithPyRef:[model problemDialog]];
|
||||
deletionOptions = [[DeletionOptions alloc] initWithPyRef:[model deletionOptions]];
|
||||
[self initResultColumns];
|
||||
[aApp initResultColumns:table];
|
||||
[[table columns] setColumnsAsReadOnly];
|
||||
[self fillColumnsMenu];
|
||||
[matches setTarget:self];
|
||||
@ -53,15 +53,6 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* Virtual */
|
||||
- (void)initResultColumns
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setScanOptions
|
||||
{
|
||||
}
|
||||
|
||||
/* Helpers */
|
||||
- (void)fillColumnsMenu
|
||||
{
|
||||
@ -263,16 +254,6 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
}
|
||||
}
|
||||
|
||||
- (void)startDuplicateScan
|
||||
{
|
||||
if ([model resultsAreModified]) {
|
||||
if ([Dialogs askYesNo:NSLocalizedString(@"You have unsaved results, do you really want to continue?", @"")] == NSAlertSecondButtonReturn) // NO
|
||||
return;
|
||||
}
|
||||
[self setScanOptions];
|
||||
[model doScan];
|
||||
}
|
||||
|
||||
- (void)switchSelected
|
||||
{
|
||||
[model makeSelectedReference];
|
@ -1,5 +1,5 @@
|
||||
ownerclass = 'ResultWindowBase'
|
||||
ownerimport = 'ResultWindowBase.h'
|
||||
ownerclass = 'ResultWindow'
|
||||
ownerimport = 'ResultWindow.h'
|
||||
|
||||
result = Window(557, 400, "dupeGuru Results")
|
||||
toolbar = result.createToolbar('ResultsToolbar')
|
||||
|
@ -6,6 +6,7 @@ from cocoa.inter import PyBaseApp, BaseAppView
|
||||
|
||||
class DupeGuruView(BaseAppView):
|
||||
def askYesNoWithPrompt_(self, prompt: str) -> bool: pass
|
||||
def showResultsWindow(self): pass
|
||||
def showProblemDialog(self): pass
|
||||
def selectDestFolderWithPrompt_(self, prompt: str) -> str: pass
|
||||
def selectDestFileWithPrompt_extension_(self, prompt: str, extension: str) -> str: pass
|
||||
@ -152,10 +153,7 @@ class PyDupeGuruBase(PyBaseApp):
|
||||
|
||||
@dontwrap
|
||||
def show_results_window(self):
|
||||
# Not needed yet because our progress dialog is shown as a sheet of the results window,
|
||||
# which causes it to be already visible when the scan/load ends.
|
||||
# XXX Make progress sheet be a child of the folder selection window.
|
||||
pass
|
||||
self.callback.showResultsWindow()
|
||||
|
||||
@dontwrap
|
||||
def show_problem_dialog(self):
|
||||
|
@ -50,8 +50,57 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
return @"https://www.hardcoded.net/dupeguru_me/";
|
||||
}
|
||||
|
||||
- (ResultWindowBase *)createResultWindow
|
||||
- (void)setScanOptions
|
||||
{
|
||||
return [[ResultWindow alloc] initWithParentApp:self];
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[model setScanType:n2i([ud objectForKey:@"scanType"])];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagTrack"]) scanForTag:@"track"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagArtist"]) scanForTag:@"artist"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagAlbum"]) scanForTag:@"album"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagTitle"]) scanForTag:@"title"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagGenre"]) scanForTag:@"genre"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagYear"]) scanForTag:@"year"];
|
||||
[model setMinMatchPercentage:n2i([ud objectForKey:@"minMatchPercentage"])];
|
||||
[model setWordWeighting:n2b([ud objectForKey:@"wordWeighting"])];
|
||||
[model setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||
[model setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||
[model setMatchSimilarWords:n2b([ud objectForKey:@"matchSimilarWords"])];
|
||||
}
|
||||
|
||||
- (void)initResultColumns:(ResultTable *)aTable
|
||||
{
|
||||
HSColumnDef defs[] = {
|
||||
{@"marked", 26, 26, 26, YES, [NSButtonCell class]},
|
||||
{@"name", 235, 16, 0, YES, nil},
|
||||
{@"folder_path", 120, 16, 0, YES, nil},
|
||||
{@"size", 63, 16, 0, YES, nil},
|
||||
{@"duration", 50, 16, 0, YES, nil},
|
||||
{@"bitrate", 50, 16, 0, YES, nil},
|
||||
{@"samplerate", 60, 16, 0, YES, nil},
|
||||
{@"extension", 40, 16, 0, YES, nil},
|
||||
{@"mtime", 120, 16, 0, YES, nil},
|
||||
{@"title", 120, 16, 0, YES, nil},
|
||||
{@"artist", 120, 16, 0, YES, nil},
|
||||
{@"album", 120, 16, 0, YES, nil},
|
||||
{@"genre", 80, 16, 0, YES, nil},
|
||||
{@"year", 40, 16, 0, YES, nil},
|
||||
{@"track", 40, 16, 0, YES, nil},
|
||||
{@"comment", 120, 16, 0, YES, nil},
|
||||
{@"percentage", 57, 16, 0, YES, nil},
|
||||
{@"words", 120, 16, 0, YES, nil},
|
||||
{@"dupe_count", 80, 16, 0, YES, nil},
|
||||
nil
|
||||
};
|
||||
[[aTable columns] initializeColumns:defs];
|
||||
NSTableColumn *c = [[aTable view] tableColumnWithIdentifier:@"marked"];
|
||||
[[c dataCell] setButtonType:NSSwitchButton];
|
||||
[[c dataCell] setControlSize:NSSmallControlSize];
|
||||
c = [[aTable view] tableColumnWithIdentifier:@"size"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
c = [[aTable view] tableColumnWithIdentifier:@"duration"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
c = [[aTable view] tableColumnWithIdentifier:@"bitrate"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
[[aTable columns] restoreColumns];
|
||||
}
|
||||
@end
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ResultWindowBase.h"
|
||||
|
||||
@interface ResultWindow : ResultWindowBase {}
|
||||
@end
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import "ResultWindow.h"
|
||||
#import "Dialogs.h"
|
||||
#import "Utils.h"
|
||||
#import "PyDupeGuru.h"
|
||||
#import "Consts.h"
|
||||
#import "ProgressController.h"
|
||||
|
||||
@implementation ResultWindow
|
||||
/* Override */
|
||||
- (void)setScanOptions
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[model setScanType:n2i([ud objectForKey:@"scanType"])];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagTrack"]) scanForTag:@"track"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagArtist"]) scanForTag:@"artist"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagAlbum"]) scanForTag:@"album"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagTitle"]) scanForTag:@"title"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagGenre"]) scanForTag:@"genre"];
|
||||
[model enable:n2b([ud objectForKey:@"scanTagYear"]) scanForTag:@"year"];
|
||||
[model setMinMatchPercentage:n2i([ud objectForKey:@"minMatchPercentage"])];
|
||||
[model setWordWeighting:n2b([ud objectForKey:@"wordWeighting"])];
|
||||
[model setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||
[model setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||
[model setMatchSimilarWords:n2b([ud objectForKey:@"matchSimilarWords"])];
|
||||
}
|
||||
|
||||
- (void)initResultColumns
|
||||
{
|
||||
HSColumnDef defs[] = {
|
||||
{@"marked", 26, 26, 26, YES, [NSButtonCell class]},
|
||||
{@"name", 235, 16, 0, YES, nil},
|
||||
{@"folder_path", 120, 16, 0, YES, nil},
|
||||
{@"size", 63, 16, 0, YES, nil},
|
||||
{@"duration", 50, 16, 0, YES, nil},
|
||||
{@"bitrate", 50, 16, 0, YES, nil},
|
||||
{@"samplerate", 60, 16, 0, YES, nil},
|
||||
{@"extension", 40, 16, 0, YES, nil},
|
||||
{@"mtime", 120, 16, 0, YES, nil},
|
||||
{@"title", 120, 16, 0, YES, nil},
|
||||
{@"artist", 120, 16, 0, YES, nil},
|
||||
{@"album", 120, 16, 0, YES, nil},
|
||||
{@"genre", 80, 16, 0, YES, nil},
|
||||
{@"year", 40, 16, 0, YES, nil},
|
||||
{@"track", 40, 16, 0, YES, nil},
|
||||
{@"comment", 120, 16, 0, YES, nil},
|
||||
{@"percentage", 57, 16, 0, YES, nil},
|
||||
{@"words", 120, 16, 0, YES, nil},
|
||||
{@"dupe_count", 80, 16, 0, YES, nil},
|
||||
nil
|
||||
};
|
||||
[[table columns] initializeColumns:defs];
|
||||
NSTableColumn *c = [matches tableColumnWithIdentifier:@"marked"];
|
||||
[[c dataCell] setButtonType:NSSwitchButton];
|
||||
[[c dataCell] setControlSize:NSSmallControlSize];
|
||||
c = [matches tableColumnWithIdentifier:@"size"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
c = [matches tableColumnWithIdentifier:@"duration"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
c = [matches tableColumnWithIdentifier:@"bitrate"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
[[table columns] restoreColumns];
|
||||
}
|
||||
@end
|
@ -9,6 +9,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
#import "AppDelegate.h"
|
||||
#import "ProgressController.h"
|
||||
#import "Utils.h"
|
||||
#import "Dialogs.h"
|
||||
#import "ValueTransformers.h"
|
||||
#import "Consts.h"
|
||||
#import "DetailsPanel.h"
|
||||
@ -38,18 +39,50 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
return @"https://www.hardcoded.net/dupeguru_pe/";
|
||||
}
|
||||
|
||||
- (ResultWindowBase *)createResultWindow
|
||||
{
|
||||
return [[ResultWindow alloc] initWithParentApp:self];
|
||||
}
|
||||
|
||||
- (DetailsPanel *)createDetailsPanel
|
||||
{
|
||||
return [[DetailsPanel alloc] initWithApp:model];
|
||||
}
|
||||
|
||||
- (void)setScanOptions
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[model setScanType:n2i([ud objectForKey:@"scanType"])];
|
||||
[model setMinMatchPercentage:n2i([ud objectForKey:@"minMatchPercentage"])];
|
||||
[model setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||
[model setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||
[model setMatchScaled:n2b([ud objectForKey:@"matchScaled"])];
|
||||
}
|
||||
|
||||
- (void)initResultColumns:(ResultTable *)aTable
|
||||
{
|
||||
HSColumnDef defs[] = {
|
||||
{@"marked", 26, 26, 26, YES, [NSButtonCell class]},
|
||||
{@"name", 162, 16, 0, YES, nil},
|
||||
{@"folder_path", 142, 16, 0, YES, nil},
|
||||
{@"size", 63, 16, 0, YES, nil},
|
||||
{@"extension", 40, 16, 0, YES, nil},
|
||||
{@"dimensions", 73, 16, 0, YES, nil},
|
||||
{@"exif_timestamp", 120, 16, 0, YES, nil},
|
||||
{@"mtime", 120, 16, 0, YES, nil},
|
||||
{@"percentage", 58, 16, 0, YES, nil},
|
||||
{@"dupe_count", 80, 16, 0, YES, nil},
|
||||
nil
|
||||
};
|
||||
[[aTable columns] initializeColumns:defs];
|
||||
NSTableColumn *c = [[aTable view] tableColumnWithIdentifier:@"marked"];
|
||||
[[c dataCell] setButtonType:NSSwitchButton];
|
||||
[[c dataCell] setControlSize:NSSmallControlSize];
|
||||
c = [[aTable view] tableColumnWithIdentifier:@"size"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
[[aTable columns] restoreColumns];
|
||||
}
|
||||
|
||||
- (void)clearPictureCache
|
||||
{
|
||||
[(ResultWindow *)[self resultWindow] clearPictureCache];
|
||||
NSString *msg = NSLocalizedString(@"Do you really want to remove all your cached picture analysis?", @"");
|
||||
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
|
||||
return;
|
||||
[model clearPictureCache];
|
||||
}
|
||||
@end
|
||||
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ResultWindowBase.h"
|
||||
|
||||
@interface ResultWindow : ResultWindowBase {}
|
||||
- (void)clearPictureCache;
|
||||
@end
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import "ResultWindow.h"
|
||||
#import "Dialogs.h"
|
||||
#import "Utils.h"
|
||||
#import "PyDupeGuru.h"
|
||||
|
||||
@implementation ResultWindow
|
||||
/* Override */
|
||||
- (void)initResultColumns
|
||||
{
|
||||
HSColumnDef defs[] = {
|
||||
{@"marked", 26, 26, 26, YES, [NSButtonCell class]},
|
||||
{@"name", 162, 16, 0, YES, nil},
|
||||
{@"folder_path", 142, 16, 0, YES, nil},
|
||||
{@"size", 63, 16, 0, YES, nil},
|
||||
{@"extension", 40, 16, 0, YES, nil},
|
||||
{@"dimensions", 73, 16, 0, YES, nil},
|
||||
{@"exif_timestamp", 120, 16, 0, YES, nil},
|
||||
{@"mtime", 120, 16, 0, YES, nil},
|
||||
{@"percentage", 58, 16, 0, YES, nil},
|
||||
{@"dupe_count", 80, 16, 0, YES, nil},
|
||||
nil
|
||||
};
|
||||
[[table columns] initializeColumns:defs];
|
||||
NSTableColumn *c = [matches tableColumnWithIdentifier:@"marked"];
|
||||
[[c dataCell] setButtonType:NSSwitchButton];
|
||||
[[c dataCell] setControlSize:NSSmallControlSize];
|
||||
c = [matches tableColumnWithIdentifier:@"size"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
[[table columns] restoreColumns];
|
||||
}
|
||||
|
||||
- (void)setScanOptions
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[model setScanType:n2i([ud objectForKey:@"scanType"])];
|
||||
[model setMinMatchPercentage:n2i([ud objectForKey:@"minMatchPercentage"])];
|
||||
[model setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||
[model setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||
[model setMatchScaled:n2b([ud objectForKey:@"matchScaled"])];
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
- (void)clearPictureCache
|
||||
{
|
||||
NSString *msg = NSLocalizedString(@"Do you really want to remove all your cached picture analysis?", @"");
|
||||
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
|
||||
return;
|
||||
[model clearPictureCache];
|
||||
}
|
||||
@end
|
@ -45,8 +45,41 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
||||
return @"http://www.hardcoded.net/dupeguru/";
|
||||
}
|
||||
|
||||
- (ResultWindowBase *)createResultWindow
|
||||
- (void)setScanOptions
|
||||
{
|
||||
return [[ResultWindow alloc] initWithParentApp:self];
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[model setScanType:n2i([ud objectForKey:@"scanType"])];
|
||||
[model setMinMatchPercentage:n2i([ud objectForKey:@"minMatchPercentage"])];
|
||||
[model setWordWeighting:n2b([ud objectForKey:@"wordWeighting"])];
|
||||
[model setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||
[model setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||
[model setMatchSimilarWords:n2b([ud objectForKey:@"matchSimilarWords"])];
|
||||
int smallFileThreshold = [ud integerForKey:@"smallFileThreshold"]; // In KB
|
||||
int sizeThreshold = [ud boolForKey:@"ignoreSmallFiles"] ? smallFileThreshold * 1024 : 0; // The py side wants bytes
|
||||
[model setSizeThreshold:sizeThreshold];
|
||||
}
|
||||
|
||||
- (void)initResultColumns:(ResultTable *)aTable
|
||||
{
|
||||
HSColumnDef defs[] = {
|
||||
{@"marked", 26, 26, 26, YES, [NSButtonCell class]},
|
||||
{@"name", 195, 16, 0, YES, nil},
|
||||
{@"folder_path", 183, 16, 0, YES, nil},
|
||||
{@"size", 63, 16, 0, YES, nil},
|
||||
{@"extension", 40, 16, 0, YES, nil},
|
||||
{@"mtime", 120, 16, 0, YES, nil},
|
||||
{@"percentage", 60, 16, 0, YES, nil},
|
||||
{@"words", 120, 16, 0, YES, nil},
|
||||
{@"dupe_count", 80, 16, 0, YES, nil},
|
||||
nil
|
||||
};
|
||||
[[aTable columns] initializeColumns:defs];
|
||||
NSTableColumn *c = [[aTable view] tableColumnWithIdentifier:@"marked"];
|
||||
[[c dataCell] setButtonType:NSSwitchButton];
|
||||
[[c dataCell] setControlSize:NSSmallControlSize];
|
||||
c = [[aTable view] tableColumnWithIdentifier:@"size"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
[[aTable columns] restoreColumns];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ResultWindowBase.h"
|
||||
|
||||
@interface ResultWindow : ResultWindowBase {}
|
||||
@end
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
#import "ResultWindow.h"
|
||||
#import "Utils.h"
|
||||
#import "Consts.h"
|
||||
#import "PyDupeGuru.h"
|
||||
|
||||
@implementation ResultWindow
|
||||
/* Override */
|
||||
- (void)initResultColumns
|
||||
{
|
||||
HSColumnDef defs[] = {
|
||||
{@"marked", 26, 26, 26, YES, [NSButtonCell class]},
|
||||
{@"name", 195, 16, 0, YES, nil},
|
||||
{@"folder_path", 183, 16, 0, YES, nil},
|
||||
{@"size", 63, 16, 0, YES, nil},
|
||||
{@"extension", 40, 16, 0, YES, nil},
|
||||
{@"mtime", 120, 16, 0, YES, nil},
|
||||
{@"percentage", 60, 16, 0, YES, nil},
|
||||
{@"words", 120, 16, 0, YES, nil},
|
||||
{@"dupe_count", 80, 16, 0, YES, nil},
|
||||
nil
|
||||
};
|
||||
[[table columns] initializeColumns:defs];
|
||||
NSTableColumn *c = [matches tableColumnWithIdentifier:@"marked"];
|
||||
[[c dataCell] setButtonType:NSSwitchButton];
|
||||
[[c dataCell] setControlSize:NSSmallControlSize];
|
||||
c = [matches tableColumnWithIdentifier:@"size"];
|
||||
[[c dataCell] setAlignment:NSRightTextAlignment];
|
||||
[[table columns] restoreColumns];
|
||||
}
|
||||
|
||||
- (void)setScanOptions
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[model setScanType:n2i([ud objectForKey:@"scanType"])];
|
||||
[model setMinMatchPercentage:n2i([ud objectForKey:@"minMatchPercentage"])];
|
||||
[model setWordWeighting:n2b([ud objectForKey:@"wordWeighting"])];
|
||||
[model setMixFileKind:n2b([ud objectForKey:@"mixFileKind"])];
|
||||
[model setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])];
|
||||
[model setMatchSimilarWords:n2b([ud objectForKey:@"matchSimilarWords"])];
|
||||
int smallFileThreshold = [ud integerForKey:@"smallFileThreshold"]; // In KB
|
||||
int sizeThreshold = [ud boolForKey:@"ignoreSmallFiles"] ? smallFileThreshold * 1024 : 0; // The py side wants bytes
|
||||
[model setSizeThreshold:sizeThreshold];
|
||||
}
|
||||
@end
|
Loading…
x
Reference in New Issue
Block a user