1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

Extracted ResultWindow.xib from MainMenu.xib.

This commit is contained in:
Virgil Dupras
2011-01-14 13:56:50 +01:00
parent 3ef118c9fa
commit 50b6948250
13 changed files with 3368 additions and 2235 deletions

View File

@@ -17,20 +17,31 @@ http://www.hardcoded.net/licenses/bsd_license
@interface AppDelegateBase : NSObject
{
IBOutlet PyDupeGuruBase *py;
IBOutlet ResultWindowBase *result;
IBOutlet NSMenu *recentResultsMenu;
IBOutlet NSMenu *columnsMenu;
ResultWindowBase *_resultWindow;
DirectoryPanel *_directoryPanel;
DetailsPanel *_detailsPanel;
HSAboutBox *_aboutBox;
HSRecentFiles *_recentResults;
}
/* Virtual */
- (PyDupeGuruBase *)py;
- (ResultWindowBase *)createResultWindow;
- (DirectoryPanel *)createDirectoryPanel;
- (DetailsPanel *)createDetailsPanel;
- (NSString *)homepageURL;
/* Public */
- (ResultWindowBase *)resultWindow;
- (DirectoryPanel *)directoryPanel;
- (DetailsPanel *)detailsPanel;
- (HSRecentFiles *)recentResults;
- (NSString *)homepageURL;
- (NSMenu *)columnsMenu;
/* Actions */
- (IBAction)showAboutBox:(id)sender;
- (IBAction)openWebsite:(id)sender;
- (IBAction)openHelp:(id)sender;

View File

@@ -17,22 +17,57 @@ http://www.hardcoded.net/licenses/bsd_license
@implementation AppDelegateBase
- (void)awakeFromNib
{
_resultWindow = nil;
_directoryPanel = nil;
_detailsPanel = nil;
_aboutBox = nil;
_recentResults = [[HSRecentFiles alloc] initWithName:@"recentResults" menu:recentResultsMenu];
[_recentResults setDelegate:self];
}
/* Virtual */
- (PyDupeGuruBase *)py { return py; }
- (ResultWindowBase *)createResultWindow
{
return nil; // must be overriden by all editions
}
- (DirectoryPanel *)createDirectoryPanel
{
return [[DirectoryPanel alloc] initWithParentApp:self];
}
- (DetailsPanel *)createDetailsPanel
{
return [[DetailsPanel alloc] initWithPy:py];
}
- (NSString *)homepageURL
{
return @""; // must be overriden by all editions
}
/* Public */
- (ResultWindowBase *)resultWindow
{
if (!_resultWindow)
_resultWindow = [self createResultWindow];
return _resultWindow;
}
- (DirectoryPanel *)directoryPanel
{
if (!_directoryPanel)
_directoryPanel = [[DirectoryPanel alloc] initWithParentApp:self];
_directoryPanel = [self createDirectoryPanel];
return _directoryPanel;
}
- (DetailsPanel *)detailsPanel
{
if (!_detailsPanel)
_detailsPanel = [[DetailsPanel alloc] initWithPy:py];
_detailsPanel = [self createDetailsPanel];
return _detailsPanel;
}
@@ -41,11 +76,9 @@ http://www.hardcoded.net/licenses/bsd_license
return _recentResults;
}
- (NSString *)homepageURL
{
return @""; // Virtual
}
- (NSMenu *)columnsMenu { return columnsMenu; }
/* Actions */
- (IBAction)showAboutBox:(id)sender
{
if (_aboutBox == nil) {
@@ -81,17 +114,17 @@ http://www.hardcoded.net/licenses/bsd_license
NSArray *columnsOrder = [ud arrayForKey:@"columnsOrder"];
NSDictionary *columnsWidth = [ud dictionaryForKey:@"columnsWidth"];
if ([columnsOrder count])
[result restoreColumnsPosition:columnsOrder widths:columnsWidth];
[[self resultWindow] restoreColumnsPosition:columnsOrder widths:columnsWidth];
else
[result resetColumnsToDefault:nil];
[[self resultWindow] resetColumnsToDefault:nil];
[HSFairwareReminder showNagWithApp:[self py]];
[py loadSession];
}
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
{
if (![[result window] isVisible])
[result showWindow:NSApp];
if (![[[self resultWindow] window] isVisible])
[[self resultWindow] showWindow:NSApp];
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
@@ -108,8 +141,8 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setObject: [result getColumnsOrder] forKey:@"columnsOrder"];
[ud setObject: [result getColumnsWidth] forKey:@"columnsWidth"];
[ud setObject: [[self resultWindow] getColumnsOrder] forKey:@"columnsOrder"];
[ud setObject: [[self resultWindow] getColumnsWidth] forKey:@"columnsWidth"];
NSInteger sc = [ud integerForKey:@"sessionCountSinceLastIgnorePurge"];
if (sc >= 10) {
sc = -1;

View File

@@ -13,23 +13,26 @@ http://www.hardcoded.net/licenses/bsd_license
#import "HSTableView.h"
#import "PyDupeGuru.h"
@class AppDelegateBase;
@interface ResultWindowBase : NSWindowController
{
@protected
IBOutlet PyDupeGuruBase *py;
IBOutlet id app;
IBOutlet NSSegmentedControl *optionsSwitch;
IBOutlet HSTableView *matches;
IBOutlet NSTextField *stats;
IBOutlet NSMenu *columnsMenu;
IBOutlet NSSearchField *filterField;
IBOutlet NSTextField *stats;
IBOutlet NSSearchField *filterField;
AppDelegateBase *app;
PyDupeGuruBase *py;
NSMenu *columnsMenu;
NSMutableArray *_resultColumns;
NSWindowController *preferencesPanel;
ResultTable *table;
StatsLabel *statsLabel;
ProblemDialog *problemDialog;
}
- (id)initWithParentApp:(AppDelegateBase *)app;
/* Helpers */
- (void)fillColumnsMenu;
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn;

View File

@@ -14,9 +14,12 @@ http://www.hardcoded.net/licenses/bsd_license
#import "Consts.h"
@implementation ResultWindowBase
- (void)awakeFromNib
- (id)initWithParentApp:(AppDelegateBase *)aApp;
{
[self window];
self = [super initWithWindowNibName:@"ResultWindow"];
app = aApp;
py = [app py];
columnsMenu = [app columnsMenu];
/* Put a cute iTunes-like bottom bar */
[[self window] setContentBorderThickness:28 forEdge:NSMinYEdge];
preferencesPanel = [[NSWindowController alloc] initWithWindowNibName:@"Preferences"];
@@ -31,6 +34,7 @@ http://www.hardcoded.net/licenses/bsd_license
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobStarted:) name:JobStarted object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobInProgress:) name:JobInProgress object:nil];
return self;
}
- (void)dealloc
@@ -147,7 +151,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)updateOptionSegments
{
[optionsSwitch setSelected:[[(AppDelegateBase *)app detailsPanel] isVisible] forSegment:0];
[optionsSwitch setSelected:[[app detailsPanel] isVisible] forSegment:0];
[optionsSwitch setSelected:[table powerMarkerMode] forSegment:1];
[optionsSwitch setSelected:[table deltaValuesMode] forSegment:2];
}
@@ -254,7 +258,7 @@ http://www.hardcoded.net/licenses/bsd_license
if ([op runModal] == NSOKButton) {
NSString *filename = [[op filenames] objectAtIndex:0];
[py loadResultsFrom:filename];
[[(AppDelegateBase *)app recentResults] addFile:filename];
[[app recentResults] addFile:filename];
}
}
@@ -357,7 +361,7 @@ http://www.hardcoded.net/licenses/bsd_license
[sp setTitle:@"Select a file to save your results to"];
if ([sp runModal] == NSOKButton) {
[py saveResultsAs:[sp filename]];
[[(AppDelegateBase *)app recentResults] addFile:[sp filename]];
[[app recentResults] addFile:[sp filename]];
}
}
@@ -393,7 +397,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)toggleDetailsPanel:(id)sender
{
[[(AppDelegateBase *)app detailsPanel] toggleVisibility];
[[app detailsPanel] toggleVisibility];
[self updateOptionSegments];
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff