1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

Brought DirectoryPanel in ME and PE up to speed with latest developments and fixed ResultsWindow.awakeFromNib (in ME and PE also).

This commit is contained in:
Virgil Dupras 2011-01-14 15:07:11 +01:00
parent 90e2a1cda0
commit 19b40d45c0
8 changed files with 55 additions and 122 deletions

View File

@ -21,9 +21,12 @@ http://www.hardcoded.net/licenses/bsd_license
PyDupeGuruBase *_py;
HSRecentFiles *_recentDirectories;
DirectoryOutline *outline;
BOOL _alwaysShowPopUp;
}
- (id)initWithParentApp:(id)aParentApp;
- (void)fillPopUpMenu; // Virtual
- (IBAction)askForDirectory:(id)sender;
- (IBAction)popupAddDirectoryMenu:(id)sender;
- (IBAction)removeSelectedDirectory:(id)sender;

View File

@ -18,6 +18,8 @@ http://www.hardcoded.net/licenses/bsd_license
[self window];
AppDelegateBase *app = aParentApp;
_py = [app py];
_alwaysShowPopUp = NO;
[self fillPopUpMenu];
_recentDirectories = [[HSRecentFiles alloc] initWithName:@"recentDirectories" menu:[addButtonPopUp menu]];
[_recentDirectories setDelegate:self];
outline = [[DirectoryOutline alloc] initWithPyParent:_py view:outlineView];
@ -34,6 +36,16 @@ http://www.hardcoded.net/licenses/bsd_license
[super dealloc];
}
/* Virtual */
- (void)fillPopUpMenu
{
NSMenu *m = [addButtonPopUp menu];
NSMenuItem *mi = [m addItemWithTitle:@"Add New Directory..." action:@selector(askForDirectory:) keyEquivalent:@""];
[mi setTarget:self];
[m addItem:[NSMenuItem separatorItem]];
}
/* Actions */
- (IBAction)askForDirectory:(id)sender
@ -53,7 +65,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)popupAddDirectoryMenu:(id)sender
{
if ([[_recentDirectories filepaths] count] == 0) {
if ((!_alwaysShowPopUp) && ([[_recentDirectories filepaths] count] == 0)) {
[self askForDirectory:sender];
}
else {

View File

@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="6"/>
<integer value="7"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -38,7 +38,7 @@
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{387, 290}, {369, 269}}</string>
<int key="NSWTFlags">1886913536</int>
<string key="NSWindowTitle">Directories</string>
<string key="NSWindowTitle">dupeGuru</string>
<string key="NSWindowClass">NSWindow</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
@ -317,25 +317,7 @@
</object>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
<object class="NSMenuItem" key="NSMenuItem" id="808696042">
<reference key="NSMenu" ref="910678368"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int>
<object class="NSCustomResource" key="NSOnImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="429063917"/>
</object>
<nil key="NSMenuItem"/>
<bool key="NSMenuItemRespectAlignment">YES</bool>
<object class="NSMenu" key="NSMenu" id="910678368">
<object class="NSMutableString" key="NSTitle">
@ -343,18 +325,9 @@
</object>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="688039571">
<reference key="NSMenu" ref="910678368"/>
<string key="NSTitle"> Add New Directory...</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="429063917"/>
</object>
<reference ref="808696042"/>
</object>
</object>
<int key="NSSelectedIndex">1</int>
<int key="NSSelectedIndex">-1</int>
<int key="NSPreferredEdge">3</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<bool key="NSAltersState">YES</bool>
@ -495,14 +468,6 @@
</object>
<int key="connectionID">54</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">askForDirectory:</string>
<reference key="source" ref="566600593"/>
<reference key="destination" ref="688039571"/>
</object>
<int key="connectionID">58</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">startScanning:</string>
@ -683,16 +648,9 @@
<reference key="object" ref="910678368"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="688039571"/>
<reference ref="808696042"/>
</object>
<reference key="parent" ref="429063917"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="688039571"/>
<reference key="parent" ref="910678368"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">50</int>
<reference key="object" ref="104112446"/>
@ -734,11 +692,6 @@
<reference key="object" ref="142495353"/>
<reference key="parent" ref="104112446"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">59</int>
<reference key="object" ref="808696042"/>
<reference key="parent" ref="910678368"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -790,7 +743,6 @@
<string>55.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>57.IBPluginDependency</string>
<string>59.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
<string>6.ImportedFromIB2</string>
<string>7.IBPluginDependency</string>
@ -798,8 +750,6 @@
<string>8.IBEditorWindowLastContentRect</string>
<string>8.IBPluginDependency</string>
<string>8.ImportedFromIB2</string>
<string>9.IBPluginDependency</string>
<string>9.ImportedFromIB2</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -855,15 +805,12 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{95, 586}, {197, 33}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@ -1697,18 +1644,5 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../../se/dupeguru.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{9, 8}</string>
<string>{7, 2}</string>
</object>
</object>
</data>
</archive>

View File

@ -116,7 +116,7 @@
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{47, 310}, {557, 400}}</string>
<int key="NSWTFlags">1618477056</int>
<string key="NSWindowTitle">dupeGuru</string>
<string key="NSWindowTitle">dupeGuru Results</string>
<string key="NSWindowClass">NSWindow</string>
<object class="NSToolbar" key="NSViewClass" id="983262794">
<object class="NSMutableString" key="NSToolbarIdentifier">

View File

@ -9,23 +9,25 @@ http://www.hardcoded.net/licenses/bsd_license
#import "DirectoryPanel.h"
@implementation DirectoryPanelME
- (id)initWithParentApp:(id)aParentApp
{
self = [super initWithParentApp:aParentApp];
[[self window] setTitle:@"dupeGuru Music Edition"];
_alwaysShowPopUp = YES;
return self;
}
- (void)fillPopUpMenu
{
[super fillPopUpMenu];
NSMenu *m = [addButtonPopUp menu];
NSMenuItem *mi = [m insertItemWithTitle:@"Add iTunes Directory" action:@selector(addiTunes:)
keyEquivalent:@"" atIndex:1];
[mi setTarget:self];
}
- (IBAction)addiTunes:(id)sender
{
[self addDirectory:[@"~/Music/iTunes/iTunes Music" stringByExpandingTildeInPath]];
}
- (IBAction)popupAddDirectoryMenu:(id)sender
{
NSMenu *m = [addButtonPopUp menu];
while ([m numberOfItems] > 0)
[m removeItemAtIndex:0];
NSMenuItem *mi = [m addItemWithTitle:@"Add New Directory..." action:@selector(askForDirectory:) keyEquivalent:@""];
[mi setTarget:self];
mi = [m addItemWithTitle:@"Add iTunes Directory" action:@selector(addiTunes:) keyEquivalent:@""];
[mi setTarget:self];
[m addItem:[NSMenuItem separatorItem]];
[_recentDirectories fillMenu:m];
[addButtonPopUp selectItem: nil];
[[addButtonPopUp cell] performClickWithFrame:[sender frame] inView:[sender superview]];
}
@end

View File

@ -15,13 +15,13 @@ http://www.hardcoded.net/licenses/bsd_license
@implementation ResultWindow
/* Override */
- (void)awakeFromNib
- (id)initWithParentApp:(AppDelegateBase *)aApp;
{
[super awakeFromNib];
[[self window] setTitle:@"dupeGuru Music Edition"];
self = [super initWithParentApp:aApp];
NSMutableIndexSet *deltaColumns = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(2,6)];
[deltaColumns removeIndex:6];
[table setDeltaColumns:deltaColumns];
return self;
}
/* Actions */

View File

@ -7,45 +7,27 @@ http://www.hardcoded.net/licenses/bsd_license
*/
#import "DirectoryPanel.h"
#import "ProgressController.h"
static NSString* jobAddIPhoto = @"jobAddIPhoto";
@implementation DirectoryPanelPE
- (id)initWithParentApp:(id)aParentApp
{
self = [super initWithParentApp:aParentApp];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil];
[[self window] setTitle:@"dupeGuru Picture Edition"];
_alwaysShowPopUp = YES;
return self;
}
- (void)fillPopUpMenu
{
[super fillPopUpMenu];
NSMenu *m = [addButtonPopUp menu];
NSMenuItem *mi = [m insertItemWithTitle:@"Add iPhoto Library" action:@selector(addiPhoto:)
keyEquivalent:@"" atIndex:1];
[mi setTarget:self];
}
- (IBAction)addiPhoto:(id)sender
{
[[ProgressController mainProgressController] setJobDesc:@"Adding iPhoto Library..."];
[[ProgressController mainProgressController] setJobId:jobAddIPhoto];
[[ProgressController mainProgressController] showSheetForParent:[self window]];
[self addDirectory:@"iPhoto Library"];
}
- (IBAction)popupAddDirectoryMenu:(id)sender
{
NSMenu *m = [addButtonPopUp menu];
while ([m numberOfItems] > 0)
[m removeItemAtIndex:0];
NSMenuItem *mi = [m addItemWithTitle:@"Add New Directory..." action:@selector(askForDirectory:) keyEquivalent:@""];
[mi setTarget:self];
mi = [m addItemWithTitle:@"Add iPhoto Directory" action:@selector(addiPhoto:) keyEquivalent:@""];
[mi setTarget:self];
[m addItem:[NSMenuItem separatorItem]];
[_recentDirectories fillMenu:m];
[addButtonPopUp selectItem:nil];
[[addButtonPopUp cell] performClickWithFrame:[sender frame] inView:[sender superview]];
}
- (void)jobCompleted:(NSNotification *)aNotification
{
if ([[ProgressController mainProgressController] jobId] == jobAddIPhoto) {
[outlineView reloadData];
}
}
@end

View File

@ -15,13 +15,13 @@ http://www.hardcoded.net/licenses/bsd_license
@implementation ResultWindow
/* Override */
- (void)awakeFromNib
- (id)initWithParentApp:(AppDelegateBase *)aApp;
{
[super awakeFromNib];
[[self window] setTitle:@"dupeGuru Picture Edition"];
self = [super initWithParentApp:aApp];
NSMutableIndexSet *deltaColumns = [NSMutableIndexSet indexSetWithIndex:2];
[deltaColumns addIndex:5];
[table setDeltaColumns:deltaColumns];
return self;
}
/* Actions */