From 0a22bb8469218fdaff208e3ecfd402d6f8c76cd6 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 14 Jan 2011 15:34:10 +0100 Subject: [PATCH] Made a few UI fixes. Mostly, it's about main menu item not pointing the appropriate target. --- cocoa/base/AppDelegate.h | 6 +- cocoa/base/AppDelegate.m | 39 ++++++-- cocoa/base/DirectoryPanel.h | 1 - cocoa/base/DirectoryPanel.m | 5 - cocoa/base/ResultWindow.h | 1 - cocoa/base/ResultWindow.m | 17 +--- cocoa/base/xib/MainMenu.xib | 161 ++++++++++++++++---------------- cocoa/base/xib/ResultWindow.xib | 47 ++++++---- cocoa/me/ResultWindow.m | 4 +- cocoa/pe/ResultWindow.h | 1 - cocoa/pe/ResultWindow.m | 6 -- cocoa/se/ResultWindow.m | 4 +- 12 files changed, 143 insertions(+), 149 deletions(-) diff --git a/cocoa/base/AppDelegate.h b/cocoa/base/AppDelegate.h index 315b9a2e..b9739a98 100644 --- a/cocoa/base/AppDelegate.h +++ b/cocoa/base/AppDelegate.h @@ -43,10 +43,12 @@ http://www.hardcoded.net/licenses/bsd_license - (NSMenu *)columnsMenu; /* Actions */ -- (IBAction)showAboutBox:(id)sender; +- (IBAction)loadResults:(id)sender; - (IBAction)openWebsite:(id)sender; - (IBAction)openHelp:(id)sender; +- (IBAction)showAboutBox:(id)sender; +- (IBAction)showDirectoryWindow:(id)sender; - (IBAction)showPreferencesPanel:(id)sender; +- (IBAction)showResultWindow:(id)sender; - (IBAction)startScanning:(id)sender; -- (IBAction)toggleDirectories:(id)sender; @end diff --git a/cocoa/base/AppDelegate.m b/cocoa/base/AppDelegate.m index 61d849ef..d3e9c045 100644 --- a/cocoa/base/AppDelegate.m +++ b/cocoa/base/AppDelegate.m @@ -81,12 +81,20 @@ http://www.hardcoded.net/licenses/bsd_license - (NSMenu *)columnsMenu { return columnsMenu; } /* Actions */ -- (IBAction)showAboutBox:(id)sender +- (IBAction)loadResults:(id)sender { - if (_aboutBox == nil) { - _aboutBox = [[HSAboutBox alloc] initWithApp:py]; + NSOpenPanel *op = [NSOpenPanel openPanel]; + [op setCanChooseFiles:YES]; + [op setCanChooseDirectories:NO]; + [op setCanCreateDirectories:NO]; + [op setAllowsMultipleSelection:NO]; + [op setAllowedFileTypes:[NSArray arrayWithObject:@"dupeguru"]]; + [op setTitle:@"Select a results file to load"]; + if ([op runModal] == NSOKButton) { + NSString *filename = [[op filenames] objectAtIndex:0]; + [py loadResultsFrom:filename]; + [[self recentResults] addFile:filename]; } - [[_aboutBox window] makeKeyAndOrderFront:sender]; } - (IBAction)openWebsite:(id)sender @@ -102,6 +110,19 @@ http://www.hardcoded.net/licenses/bsd_license [[NSWorkspace sharedWorkspace] openURL:u]; } +- (IBAction)showAboutBox:(id)sender +{ + if (_aboutBox == nil) { + _aboutBox = [[HSAboutBox alloc] initWithApp:py]; + } + [[_aboutBox window] makeKeyAndOrderFront:sender]; +} + +- (IBAction)showDirectoryWindow:(id)sender +{ + [[[self directoryPanel] window] makeKeyAndOrderFront:nil]; +} + - (IBAction)showPreferencesPanel:(id)sender { if (_preferencesPanel == nil) { @@ -110,16 +131,16 @@ http://www.hardcoded.net/licenses/bsd_license [_preferencesPanel showWindow:sender]; } +- (IBAction)showResultWindow:(id)sender +{ + [[[self resultWindow] window] makeKeyAndOrderFront:nil]; +} + - (IBAction)startScanning:(id)sender { - [[[self resultWindow] window] makeKeyAndOrderFront:sender]; [[self resultWindow] startDuplicateScan:sender]; } -- (IBAction)toggleDirectories:(id)sender -{ - [[self directoryPanel] toggleVisible:sender]; -} /* Delegate */ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification diff --git a/cocoa/base/DirectoryPanel.h b/cocoa/base/DirectoryPanel.h index 2fbd050f..255345d4 100644 --- a/cocoa/base/DirectoryPanel.h +++ b/cocoa/base/DirectoryPanel.h @@ -30,7 +30,6 @@ http://www.hardcoded.net/licenses/bsd_license - (IBAction)askForDirectory:(id)sender; - (IBAction)popupAddDirectoryMenu:(id)sender; - (IBAction)removeSelectedDirectory:(id)sender; -- (IBAction)toggleVisible:(id)sender; - (void)addDirectory:(NSString *)directory; - (void)refreshRemoveButtonText; diff --git a/cocoa/base/DirectoryPanel.m b/cocoa/base/DirectoryPanel.m index 525d641d..f4c9af82 100644 --- a/cocoa/base/DirectoryPanel.m +++ b/cocoa/base/DirectoryPanel.m @@ -92,11 +92,6 @@ http://www.hardcoded.net/licenses/bsd_license [self refreshRemoveButtonText]; } -- (IBAction)toggleVisible:(id)sender -{ - [[self window] makeKeyAndOrderFront:nil]; -} - /* Public */ - (void)addDirectory:(NSString *)directory { diff --git a/cocoa/base/ResultWindow.h b/cocoa/base/ResultWindow.h index a6dc2d2d..4117595f 100644 --- a/cocoa/base/ResultWindow.h +++ b/cocoa/base/ResultWindow.h @@ -52,7 +52,6 @@ http://www.hardcoded.net/licenses/bsd_license - (IBAction)filter:(id)sender; - (IBAction)ignoreSelected:(id)sender; - (IBAction)invokeCustomCommand:(id)sender; -- (IBAction)loadResults:(id)sender; - (IBAction)markAll:(id)sender; - (IBAction)markInvert:(id)sender; - (IBAction)markNone:(id)sender; diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index c29b3056..f62010d6 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -244,22 +244,6 @@ http://www.hardcoded.net/licenses/bsd_license } } -- (IBAction)loadResults:(id)sender -{ - NSOpenPanel *op = [NSOpenPanel openPanel]; - [op setCanChooseFiles:YES]; - [op setCanChooseDirectories:NO]; - [op setCanCreateDirectories:NO]; - [op setAllowsMultipleSelection:NO]; - [op setAllowedFileTypes:[NSArray arrayWithObject:@"dupeguru"]]; - [op setTitle:@"Select a results file to load"]; - if ([op runModal] == NSOKButton) { - NSString *filename = [[op filenames] objectAtIndex:0]; - [py loadResultsFrom:filename]; - [[app recentResults] addFile:filename]; - } -} - - (IBAction)markAll:(id)sender { [py markAll]; @@ -448,6 +432,7 @@ http://www.hardcoded.net/licenses/bsd_license - (void)jobStarted:(NSNotification *)aNotification { + [[self window] makeKeyAndOrderFront:nil]; NSDictionary *ui = [aNotification userInfo]; NSString *desc = [ui valueForKey:@"desc"]; [[ProgressController mainProgressController] setJobDesc:desc]; diff --git a/cocoa/base/xib/MainMenu.xib b/cocoa/base/xib/MainMenu.xib index eeed2a40..7fc5b0d3 100644 --- a/cocoa/base/xib/MainMenu.xib +++ b/cocoa/base/xib/MainMenu.xib @@ -12,7 +12,7 @@ YES - + YES @@ -461,8 +461,8 @@ Invoke Custom Command - i - 1048576 + C + 262144 2147483647 @@ -541,11 +541,18 @@ Window YES + + + Results Window + + 2147483647 + + + - Directory Panel - 3 - 1048576 + Directories Window + 2147483647 @@ -553,7 +560,7 @@ Details Panel - 4 + i 1048576 2147483647 @@ -750,14 +757,6 @@ 614 - - - toggleDirectories: - - - - 758 - performClose: @@ -966,14 +965,6 @@ 1258 - - - startDuplicateScan: - - - - 1259 - switchSelected: @@ -1046,6 +1037,30 @@ 1270 + + + startScanning: + + + + 1271 + + + + showDirectoryWindow: + + + + 1273 + + + + showResultWindow: + + + + 1274 + @@ -1115,6 +1130,7 @@ + @@ -1565,6 +1581,11 @@ + + 1272 + + + @@ -1603,6 +1624,7 @@ 1239.IBPluginDependency 1240.IBEditorWindowLastContentRect 1240.IBPluginDependency + 1272.IBPluginDependency 134.IBPluginDependency 134.ImportedFromIB2 136.IBPluginDependency @@ -1743,7 +1765,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{242, 685}, {258, 83}} + {{538, 738}, {258, 83}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1753,6 +1775,7 @@ {{500, 742}, {64, 6}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1771,10 +1794,10 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{531, 625}, {193, 143}} + {{827, 658}, {208, 163}} com.apple.InterfaceBuilder.CocoaPlugin - {{140, 768}, {523, 20}} + {{436, 821}, {523, 20}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1798,7 +1821,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{328, 455}, {383, 313}} + {{624, 508}, {383, 313}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1818,7 +1841,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{397, 762}, {64, 6}} + {{693, 815}, {64, 6}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1848,7 +1871,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{475, 725}, {167, 43}} + {{771, 778}, {167, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1857,7 +1880,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{284, 615}, {188, 153}} + {{580, 668}, {188, 153}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1884,7 +1907,7 @@ - 1270 + 1274 @@ -1904,11 +1927,14 @@ YES YES + loadResults: openHelp: openWebsite: showAboutBox: + showDirectoryWindow: showPreferencesPanel: - toggleDirectories: + showResultWindow: + startScanning: YES @@ -1917,20 +1943,30 @@ id id id + id + id + id YES YES + loadResults: openHelp: openWebsite: showAboutBox: + showDirectoryWindow: showPreferencesPanel: - toggleDirectories: + showResultWindow: + startScanning: YES + + loadResults: + id + openHelp: id @@ -1943,12 +1979,20 @@ showAboutBox: id + + showDirectoryWindow: + id + showPreferencesPanel: id - toggleDirectories: + showResultWindow: + id + + + startScanning: id @@ -2129,46 +2173,6 @@ ../PyFairware.h - - ResultWindow - ResultWindowBase - - YES - - YES - resetColumnsToDefault: - startDuplicateScan: - - - YES - id - id - - - - YES - - YES - resetColumnsToDefault: - startDuplicateScan: - - - YES - - resetColumnsToDefault: - id - - - startDuplicateScan: - id - - - - - IBProjectSource - ResultWindow.h - - ResultWindowBase NSWindowController @@ -2185,7 +2189,6 @@ hardlinkMarked: ignoreSelected: invokeCustomCommand: - loadResults: markAll: markInvert: markNone: @@ -2236,7 +2239,6 @@ id id id - id @@ -2252,7 +2254,6 @@ hardlinkMarked: ignoreSelected: invokeCustomCommand: - loadResults: markAll: markInvert: markNone: @@ -2311,10 +2312,6 @@ invokeCustomCommand: id - - loadResults: - id - markAll: id @@ -2956,7 +2953,7 @@ YES - ../../se/dupeguru.xcodeproj + ../../me/dupeguru.xcodeproj 3 YES diff --git a/cocoa/base/xib/ResultWindow.xib b/cocoa/base/xib/ResultWindow.xib index bd6ab385..eb5a87e7 100644 --- a/cocoa/base/xib/ResultWindow.xib +++ b/cocoa/base/xib/ResultWindow.xib @@ -890,14 +890,6 @@ 46 - - - toggleDirectories: - - - - 48 - deleteMarked: @@ -1090,6 +1082,14 @@ 81 + + + showDirectoryWindow: + + + + 82 + @@ -1668,7 +1668,7 @@ - 81 + 82 @@ -1680,12 +1680,14 @@ YES YES + loadResults: openHelp: openWebsite: showAboutBox: + showDirectoryWindow: showPreferencesPanel: + showResultWindow: startScanning: - toggleDirectories: YES @@ -1695,21 +1697,29 @@ id id id + id + id YES YES + loadResults: openHelp: openWebsite: showAboutBox: + showDirectoryWindow: showPreferencesPanel: + showResultWindow: startScanning: - toggleDirectories: YES + + loadResults: + id + openHelp: id @@ -1722,16 +1732,20 @@ showAboutBox: id + + showDirectoryWindow: + id + showPreferencesPanel: id - startScanning: + showResultWindow: id - toggleDirectories: + startScanning: id @@ -1869,7 +1883,6 @@ hardlinkMarked: ignoreSelected: invokeCustomCommand: - loadResults: markAll: markInvert: markNone: @@ -1920,7 +1933,6 @@ id id id - id @@ -1936,7 +1948,6 @@ hardlinkMarked: ignoreSelected: invokeCustomCommand: - loadResults: markAll: markInvert: markNone: @@ -1995,10 +2006,6 @@ invokeCustomCommand: id - - loadResults: - id - markAll: id diff --git a/cocoa/me/ResultWindow.m b/cocoa/me/ResultWindow.m index 976b0bc7..14b55206 100644 --- a/cocoa/me/ResultWindow.m +++ b/cocoa/me/ResultWindow.m @@ -70,10 +70,8 @@ http://www.hardcoded.net/licenses/bsd_license [_py setIgnoreHardlinkMatches:n2b([ud objectForKey:@"ignoreHardlinkMatches"])]; [_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]]; NSInteger r = n2i([py doScan]); - if (r == 3) - { + if (r == 3) { [Dialogs showMessage:@"The selected directories contain no scannable file."]; - [app toggleDirectories:nil]; } } diff --git a/cocoa/pe/ResultWindow.h b/cocoa/pe/ResultWindow.h index 2bc5746d..8aa1a214 100644 --- a/cocoa/pe/ResultWindow.h +++ b/cocoa/pe/ResultWindow.h @@ -11,5 +11,4 @@ http://www.hardcoded.net/licenses/bsd_license @interface ResultWindow : ResultWindowBase {} - (IBAction)clearPictureCache:(id)sender; -- (IBAction)toggleDirectories:(id)sender; @end diff --git a/cocoa/pe/ResultWindow.m b/cocoa/pe/ResultWindow.m index cab7040b..74578df6 100644 --- a/cocoa/pe/ResultWindow.m +++ b/cocoa/pe/ResultWindow.m @@ -67,18 +67,12 @@ http://www.hardcoded.net/licenses/bsd_license } if (r == 3) { [Dialogs showMessage:@"The selected directories contain no scannable file."]; - [app toggleDirectories:nil]; } if (r == 4) { [Dialogs showMessage:@"The iPhoto application couldn't be found."]; } } -- (IBAction)toggleDirectories:(id)sender -{ - [(AppDelegate *)app toggleDirectories:sender]; -} - /* Public */ - (void)initResultColumns { diff --git a/cocoa/se/ResultWindow.m b/cocoa/se/ResultWindow.m index 74c20a43..8f6f036c 100644 --- a/cocoa/se/ResultWindow.m +++ b/cocoa/se/ResultWindow.m @@ -59,10 +59,8 @@ http://www.hardcoded.net/licenses/bsd_license int r = n2i([py doScan]); if (r != 0) [[ProgressController mainProgressController] hide]; - if (r == 3) - { + if (r == 3) { [Dialogs showMessage:@"The selected directories contain no scannable file."]; - [app toggleDirectories:nil]; } }