mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-02-04 20:31:38 +00:00
cocoa: get rid of edition-specific ResultWindow overrides
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user