mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 21:24:36 +00:00
dgpe cocoa: extracted the pref pane from MainMenu.xib into Preferences.xib, Removed code duplicated with dgbase.
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40235
This commit is contained in:
parent
024e3c380f
commit
6d5f6a0c3c
@ -8,15 +8,12 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "dgbase/AppDelegate.h"
|
||||
#import "ResultWindow.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "DetailsPanel.h"
|
||||
#import "PyDupeGuru.h"
|
||||
|
||||
@interface AppDelegate : AppDelegateBase
|
||||
{
|
||||
IBOutlet ResultWindow *result;
|
||||
|
||||
DetailsPanel *_detailsPanel;
|
||||
DirectoryPanel *_directoryPanel;
|
||||
}
|
||||
|
@ -75,19 +75,12 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
//Delegate
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
[[ProgressController mainProgressController] setWorker:py];
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
//Restore Columns
|
||||
NSArray *columnsOrder = [ud arrayForKey:@"columnsOrder"];
|
||||
NSDictionary *columnsWidth = [ud dictionaryForKey:@"columnsWidth"];
|
||||
if ([columnsOrder count])
|
||||
[result restoreColumnsPosition:columnsOrder widths:columnsWidth];
|
||||
//Reg stuff
|
||||
if ([RegistrationInterface showNagWithApp:[self py] name:APPNAME limitDescription:LIMIT_DESC])
|
||||
[unlockMenuItem setTitle:@"Thanks for buying dupeGuru Picture Edition!"];
|
||||
//Restore results
|
||||
[py loadIgnoreList];
|
||||
[py loadResults];
|
||||
NSMenu *actionsMenu = [[[NSApp mainMenu] itemWithTitle:@"Actions"] submenu];
|
||||
// index 2 is just after "Clear Ingore List"
|
||||
NSMenuItem *mi = [actionsMenu insertItemWithTitle:@"Clear Picture Cache" action:@selector(clearPictureCache:) keyEquivalent:@"P" atIndex:2];
|
||||
[mi setTarget:result];
|
||||
[mi setKeyEquivalentModifierMask:NSCommandKeyMask|NSShiftKeyMask];
|
||||
[super applicationDidFinishLaunching:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
||||
|
@ -9,15 +9,11 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "Outline.h"
|
||||
#import "dgbase/ResultWindow.h"
|
||||
#import "DirectoryPanel.h"
|
||||
|
||||
@interface ResultWindow : ResultWindowBase
|
||||
{
|
||||
IBOutlet NSMenu *columnsMenu;
|
||||
IBOutlet NSSearchField *filterField;
|
||||
IBOutlet NSWindow *preferencesPanel;
|
||||
|
||||
NSMutableArray *_resultColumns;
|
||||
NSMutableIndexSet *_deltaColumns;
|
||||
}
|
||||
- (IBAction)clearIgnoreList:(id)sender;
|
||||
@ -34,16 +30,9 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
- (IBAction)removeMarked:(id)sender;
|
||||
- (IBAction)removeSelected:(id)sender;
|
||||
- (IBAction)renameSelected:(id)sender;
|
||||
- (IBAction)resetColumnsToDefault:(id)sender;
|
||||
- (IBAction)revealSelected:(id)sender;
|
||||
- (IBAction)showPreferencesPanel:(id)sender;
|
||||
- (IBAction)startDuplicateScan:(id)sender;
|
||||
- (IBAction)toggleColumn:(id)sender;
|
||||
- (IBAction)toggleDelta:(id)sender;
|
||||
- (IBAction)toggleDetailsPanel:(id)sender;
|
||||
- (IBAction)toggleDirectories:(id)sender;
|
||||
|
||||
- (NSTableColumn *)getColumnForIdentifier:(int)aIdentifier title:(NSString *)aTitle width:(int)aWidth refCol:(NSTableColumn *)aColumn;
|
||||
- (void)initResultColumns;
|
||||
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;
|
||||
@end
|
||||
|
@ -19,6 +19,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
[[self window] setTitle:@"dupeGuru Picture Edition"];
|
||||
_displayDelta = NO;
|
||||
_powerMode = NO;
|
||||
_deltaColumns = [[NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(2,5)] retain];
|
||||
@ -29,7 +30,6 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
[py setDisplayDeltaValues:b2n(_displayDelta)];
|
||||
[matches setTarget:self];
|
||||
[matches setDoubleAction:@selector(openSelected:)];
|
||||
[self initResultColumns];
|
||||
[self refreshStats];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resultsMarkingChanged:) name:ResultsMarkingChangedNotification object:nil];
|
||||
}
|
||||
@ -156,7 +156,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
[columnsOrder addObject:@"4"];
|
||||
[columnsOrder addObject:@"7"];
|
||||
NSMutableDictionary *columnsWidth = [NSMutableDictionary dictionary];
|
||||
[columnsWidth setObject:i2n(125) forKey:@"0"];
|
||||
[columnsWidth setObject:i2n(121) forKey:@"0"];
|
||||
[columnsWidth setObject:i2n(120) forKey:@"1"];
|
||||
[columnsWidth setObject:i2n(63) forKey:@"2"];
|
||||
[columnsWidth setObject:i2n(73) forKey:@"4"];
|
||||
@ -170,11 +170,6 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
[py revealSelected];
|
||||
}
|
||||
|
||||
- (IBAction)showPreferencesPanel:(id)sender
|
||||
{
|
||||
[preferencesPanel makeKeyAndOrderFront:sender];
|
||||
}
|
||||
|
||||
- (IBAction)startDuplicateScan:(id)sender
|
||||
{
|
||||
if ([matches numberOfRows] > 0)
|
||||
@ -201,26 +196,6 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)toggleColumn:(id)sender
|
||||
{
|
||||
NSMenuItem *mi = sender;
|
||||
NSString *colId = [NSString stringWithFormat:@"%d",[mi tag]];
|
||||
NSTableColumn *col = [matches tableColumnWithIdentifier:colId];
|
||||
if (col == nil)
|
||||
{
|
||||
//Add Column
|
||||
col = [_resultColumns objectAtIndex:[mi tag]];
|
||||
[matches addTableColumn:col];
|
||||
[mi setState:NSOnState];
|
||||
}
|
||||
else
|
||||
{
|
||||
//Remove column
|
||||
[matches removeTableColumn:col];
|
||||
[mi setState:NSOffState];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)toggleDelta:(id)sender
|
||||
{
|
||||
if ([deltaSwitch selectedSegment] == 1)
|
||||
@ -242,63 +217,23 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
}
|
||||
|
||||
/* Public */
|
||||
- (NSTableColumn *)getColumnForIdentifier:(int)aIdentifier title:(NSString *)aTitle width:(int)aWidth refCol:(NSTableColumn *)aColumn
|
||||
{
|
||||
NSNumber *n = [NSNumber numberWithInt:aIdentifier];
|
||||
NSTableColumn *col = [[NSTableColumn alloc] initWithIdentifier:[n stringValue]];
|
||||
[col setWidth:aWidth];
|
||||
[col setEditable:NO];
|
||||
[[col dataCell] setFont:[[aColumn dataCell] font]];
|
||||
[[col headerCell] setStringValue:aTitle];
|
||||
[col setResizingMask:NSTableColumnUserResizingMask];
|
||||
[col setSortDescriptorPrototype:[[NSSortDescriptor alloc] initWithKey:[n stringValue] ascending:YES]];
|
||||
return col;
|
||||
}
|
||||
|
||||
- (void)initResultColumns
|
||||
{
|
||||
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
|
||||
_resultColumns = [[NSMutableArray alloc] init];
|
||||
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name
|
||||
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"1"]]; // Directory
|
||||
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"2"]]; // Size
|
||||
[_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:@"Creation" width:120 refCol:refCol]];
|
||||
[_resultColumns addObject:[self getColumnForIdentifier:6 title:@"Modification" width:120 refCol:refCol]];
|
||||
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"7"]]; // Match %
|
||||
[_resultColumns addObject:[self getColumnForIdentifier:7 title:@"Match %" width:58 refCol:refCol]];
|
||||
[_resultColumns addObject:[self getColumnForIdentifier:8 title:@"Dupe Count" width:80 refCol:refCol]];
|
||||
}
|
||||
|
||||
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth
|
||||
{
|
||||
NSTableColumn *col;
|
||||
NSString *colId;
|
||||
NSNumber *width;
|
||||
NSMenuItem *mi;
|
||||
//Remove all columns
|
||||
NSEnumerator *e = [[columnsMenu itemArray] objectEnumerator];
|
||||
while (mi = [e nextObject])
|
||||
{
|
||||
if ([mi state] == NSOnState)
|
||||
[self toggleColumn:mi];
|
||||
}
|
||||
//Add columns and set widths
|
||||
e = [aColumnsOrder objectEnumerator];
|
||||
while (colId = [e nextObject])
|
||||
{
|
||||
if (![colId isEqual:@"mark"])
|
||||
{
|
||||
col = [_resultColumns objectAtIndex:[colId intValue]];
|
||||
width = [aColumnsWidth objectForKey:[col identifier]];
|
||||
mi = [columnsMenu itemWithTag:[colId intValue]];
|
||||
if (width)
|
||||
[col setWidth:[width floatValue]];
|
||||
[self toggleColumn:mi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Delegate */
|
||||
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
||||
{
|
||||
|
@ -9,6 +9,8 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
CE031751109B340A00517EE6 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE031750109B340A00517EE6 /* Preferences.xib */; };
|
||||
CE031754109B345200517EE6 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE031753109B345200517EE6 /* MainMenu.xib */; };
|
||||
CE073F6309CAE1A3005C1D2F /* dupeguru_pe_help in Resources */ = {isa = PBXBuildFile; fileRef = CE073F5409CAE1A3005C1D2F /* dupeguru_pe_help */; };
|
||||
CE0C46AA0FA0647E000BE99B /* PictureBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0C46A90FA0647E000BE99B /* PictureBlocks.m */; };
|
||||
CE15C8A80ADEB8B50061D4A5 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE15C8A70ADEB8B50061D4A5 /* Sparkle.framework */; };
|
||||
@ -20,7 +22,6 @@
|
||||
CE68EE6809ABC48000971085 /* DirectoryPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = CE68EE6609ABC48000971085 /* DirectoryPanel.m */; };
|
||||
CE6E0F3D1054EC62008D9390 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = CE6E0F3C1054EC62008D9390 /* dsa_pub.pem */; };
|
||||
CE77C89E10946C6D0078B0DB /* DirectoryPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE77C89C10946C6D0078B0DB /* DirectoryPanel.xib */; };
|
||||
CE77C8A110946C840078B0DB /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE77C8A010946C840078B0DB /* MainMenu.xib */; };
|
||||
CE77C8A810946CE20078B0DB /* DetailsPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE77C8A710946CE20078B0DB /* DetailsPanel.xib */; };
|
||||
CE80DB2E0FC192D60086DCA6 /* Dialogs.m in Sources */ = {isa = PBXBuildFile; fileRef = CE80DB1C0FC192D60086DCA6 /* Dialogs.m */; };
|
||||
CE80DB2F0FC192D60086DCA6 /* HSErrorReportWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = CE80DB1E0FC192D60086DCA6 /* HSErrorReportWindow.m */; };
|
||||
@ -74,6 +75,8 @@
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
|
||||
8D1107320486CEB800E47090 /* dupeGuru PE.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "dupeGuru PE.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CE031750109B340A00517EE6 /* Preferences.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Preferences.xib; path = ../../xib/Preferences.xib; sourceTree = "<group>"; };
|
||||
CE031753109B345200517EE6 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
|
||||
CE073F5409CAE1A3005C1D2F /* dupeguru_pe_help */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dupeguru_pe_help; path = help/dupeguru_pe_help; sourceTree = SOURCE_ROOT; };
|
||||
CE0C46A80FA0647E000BE99B /* PictureBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureBlocks.h; sourceTree = "<group>"; };
|
||||
CE0C46A90FA0647E000BE99B /* PictureBlocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureBlocks.m; sourceTree = "<group>"; };
|
||||
@ -89,7 +92,6 @@
|
||||
CE68EE6609ABC48000971085 /* DirectoryPanel.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = DirectoryPanel.m; sourceTree = SOURCE_ROOT; };
|
||||
CE6E0F3C1054EC62008D9390 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dsa_pub.pem; path = dgbase/dsa_pub.pem; sourceTree = "<group>"; };
|
||||
CE77C89C10946C6D0078B0DB /* DirectoryPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DirectoryPanel.xib; sourceTree = "<group>"; };
|
||||
CE77C8A010946C840078B0DB /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = ../../xib/MainMenu.xib; sourceTree = "<group>"; };
|
||||
CE77C8A710946CE20078B0DB /* DetailsPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DetailsPanel.xib; path = ../../xib/DetailsPanel.xib; sourceTree = "<group>"; };
|
||||
CE80DB1B0FC192D60086DCA6 /* Dialogs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Dialogs.h; path = cocoalib/Dialogs.h; sourceTree = SOURCE_ROOT; };
|
||||
CE80DB1C0FC192D60086DCA6 /* Dialogs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Dialogs.m; path = cocoalib/Dialogs.m; sourceTree = SOURCE_ROOT; };
|
||||
@ -247,9 +249,10 @@
|
||||
CE77C89A10946C6D0078B0DB /* xib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CE77C8A010946C840078B0DB /* MainMenu.xib */,
|
||||
CE031753109B345200517EE6 /* MainMenu.xib */,
|
||||
CE77C8A710946CE20078B0DB /* DetailsPanel.xib */,
|
||||
CE77C89C10946C6D0078B0DB /* DirectoryPanel.xib */,
|
||||
CE031750109B340A00517EE6 /* Preferences.xib */,
|
||||
);
|
||||
name = xib;
|
||||
path = dgbase/xib;
|
||||
@ -385,8 +388,9 @@
|
||||
CE80DB780FC194760086DCA6 /* registration.nib in Resources */,
|
||||
CE6E0F3D1054EC62008D9390 /* dsa_pub.pem in Resources */,
|
||||
CE77C89E10946C6D0078B0DB /* DirectoryPanel.xib in Resources */,
|
||||
CE77C8A110946C840078B0DB /* MainMenu.xib in Resources */,
|
||||
CE77C8A810946CE20078B0DB /* DetailsPanel.xib in Resources */,
|
||||
CE031751109B340A00517EE6 /* Preferences.xib in Resources */,
|
||||
CE031754109B345200517EE6 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
1650
pe/cocoa/xib/Preferences.xib
Normal file
1650
pe/cocoa/xib/Preferences.xib
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user