diff --git a/build.py b/build.py index a2acf0c7..df48bf3e 100644 --- a/build.py +++ b/build.py @@ -63,6 +63,7 @@ def build_xibless(edition): xibless.generate('cocoa/base/ui/problem_dialog.py', 'cocoa/autogen/ProblemDialog_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/directory_panel.py', 'cocoa/autogen/DirectoryPanel_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/prioritize_dialog.py', 'cocoa/autogen/PrioritizeDialog_UI', localizationTable='Localizable') + xibless.generate('cocoa/base/ui/result_window.py', 'cocoa/autogen/ResultWindow_UI', localizationTable='Localizable') def build_cocoa(edition, dev): build_xibless(edition) diff --git a/cocoa/base/ResultWindow.h b/cocoa/base/ResultWindow.h index 28d6041b..59772542 100644 --- a/cocoa/base/ResultWindow.h +++ b/cocoa/base/ResultWindow.h @@ -20,11 +20,11 @@ http://www.hardcoded.net/licenses/bsd_license @interface ResultWindowBase : NSWindowController { @protected - IBOutlet NSSegmentedControl *optionsSwitch; - IBOutlet NSToolbarItem *optionsToolbarItem; - IBOutlet HSTableView *matches; - IBOutlet NSTextField *stats; - IBOutlet NSSearchField *filterField; + NSSegmentedControl *optionsSwitch; + NSToolbarItem *optionsToolbarItem; + HSTableView *matches; + NSTextField *stats; + NSSearchField *filterField; AppDelegateBase *app; PyDupeGuru *model; @@ -35,6 +35,13 @@ http://www.hardcoded.net/licenses/bsd_license DeletionOptions *deletionOptions; QLPreviewPanel* previewPanel; } + +@property (readwrite, retain) NSSegmentedControl *optionsSwitch; +@property (readwrite, retain) NSToolbarItem *optionsToolbarItem; +@property (readwrite, retain) HSTableView *matches; +@property (readwrite, retain) NSTextField *stats; +@property (readwrite, retain) NSSearchField *filterField; + - (id)initWithParentApp:(AppDelegateBase *)app; /* Virtual */ diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index c0a0e6d8..44c6dd13 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -7,6 +7,7 @@ http://www.hardcoded.net/licenses/bsd_license */ #import "ResultWindow.h" +#import "ResultWindow_UI.h" #import "Dialogs.h" #import "ProgressController.h" #import "Utils.h" @@ -15,11 +16,19 @@ http://www.hardcoded.net/licenses/bsd_license #import "PrioritizeDialog.h" @implementation ResultWindowBase + +@synthesize optionsSwitch; +@synthesize optionsToolbarItem; +@synthesize matches; +@synthesize stats; +@synthesize filterField; + - (id)initWithParentApp:(AppDelegateBase *)aApp; { - self = [super initWithWindowNibName:@"ResultWindow"]; + self = [super initWithWindow:nil]; app = aApp; model = [app model]; + [self setWindow:createResultWindow_UI(self)]; [[self window] setTitle:fmt(@"%@ Results", [model appName])]; columnsMenu = [app columnsMenu]; /* Put a cute iTunes-like bottom bar */ diff --git a/cocoa/base/ui/result_window.py b/cocoa/base/ui/result_window.py new file mode 100644 index 00000000..5bb0e051 --- /dev/null +++ b/cocoa/base/ui/result_window.py @@ -0,0 +1,85 @@ +wnerclass = 'ResultWindow' +ownerimport = 'ResultWindow.h' + +result = Window(557, 400, "dupeGuru Results") +toolbar = result.createToolbar('ResultsToolbar') +table = TableView(result) +table.OBJC_CLASS = 'HSTableView' +statsLabel = Label(result, "Hello") +contextMenu = Menu("") + +#Setup toolbar items +toolbar.displayMode = const.NSToolbarDisplayModeIconOnly +directoriesToolItem = toolbar.addItem('Directories', "Directories", image='folder32') +actionToolItem = toolbar.addItem('Action', "Action") +filterToolItem = toolbar.addItem('Filter', "Filter") +optionsToolItem = toolbar.addItem('Options', "Options") +quicklookToolItem = toolbar.addItem('QuickLook', "Quick Look") +toolbar.defaultItems = [actionToolItem, optionsToolItem, quicklookToolItem, directoriesToolItem, + toolbar.flexibleSpace(), filterToolItem] +actionPopup = Popup(None) +actionPopup.pullsdown = True +actionPopup.bezelStyle = const.NSTexturedRoundedBezelStyle +item = actionPopup.menu.addItem("") # First item is invisible +item.hidden = True +item.image = 'NSActionTemplate' +actionPopup.width = 44 +actionToolItem.view = actionPopup +filterField = SearchField(None, "Filter") +filterField.action = Action(owner, 'filter:') +filterToolItem.view = filterField +filterToolItem.minSize = Size(80, 22) +filterToolItem.maxSize = Size(300, 22) +quickLookButton = Button(None, "") +quickLookButton.bezelStyle = const.NSTexturedRoundedBezelStyle +quickLookButton.image = 'NSQuickLookTemplate' +quickLookButton.width = 44 +quickLookButton.action = Action(owner, 'toggleQuicklookPanel:') +quicklookToolItem.view = quickLookButton +optionsSegments = SegmentedControl(None) +optionsSegments.segmentStyle = const.NSSegmentStyleCapsule +optionsSegments.trackingMode = const.NSSegmentSwitchTrackingSelectAny +optionsSegments.font = Font(FontFamily.System, 11) +optionsSegments.addSegment("Details", 57) +optionsSegments.addSegment("Dupes Only", 82) +optionsSegments.addSegment("Delta", 48) +optionsSegments.action = Action(owner, 'changeOptions:') +optionsToolItem.view = optionsSegments + +# Popuplate menus +actionPopup.menu.addItem("Send Marked to Trash...", action=Action(owner, 'trashMarked:')) +actionPopup.menu.addItem("Move Marked to...", action=Action(owner, 'moveMarked:')) +actionPopup.menu.addItem("Copy Marked to...", action=Action(owner, 'moveMarked:')) +actionPopup.menu.addItem("Remove Marked from Results", action=Action(owner, 'removeMarked:')) +actionPopup.menu.addSeparator() +for menu in (actionPopup.menu, contextMenu): + menu.addItem("Remove Selected from Results", action=Action(owner, 'removeSelected:')) + menu.addItem("Add Selected to Ignore List", action=Action(owner, 'ignoreSelected:')) + menu.addItem("Make Selected Reference", action=Action(owner, 'switchSelected:')) + menu.addSeparator() + menu.addItem("Open Selected with Default Application", action=Action(owner, 'openSelected:')) + menu.addItem("Reveal Selected in Finder", action=Action(owner, 'revealSelected:')) + menu.addItem("Rename Selected", action=Action(owner, 'renameSelected:')) + +# Doing connections +owner.filterField = filterField +owner.matches = table +owner.optionsSwitch = optionsSegments +owner.optionsToolbarItem = optionsToolItem +owner.stats = statsLabel + +# Rest of the setup +result.minSize = Size(340, 340) +result.autosaveName = 'MainWindow' +statsLabel.alignment = TextAlignment.Center +table.alternatingRows = True +table.menu = contextMenu +table.setAnchor(Pack.UpperLeft, growX=True, growY=True) +statsLabel.setAnchor(Pack.LowerLeft, growX=True) + +# Layout +table.packToCorner(Pack.UpperLeft, margin=0) +table.fill(Pack.Right, margin=0) +statsLabel.packRelativeTo(table, Pack.Below, margin=6) +statsLabel.fill(Pack.Right, margin=0) +table.fill(Pack.Below, margin=6) diff --git a/cocoa/se/dupeguru.xcodeproj/project.pbxproj b/cocoa/se/dupeguru.xcodeproj/project.pbxproj index 5dd2dba2..36805a07 100644 --- a/cocoa/se/dupeguru.xcodeproj/project.pbxproj +++ b/cocoa/se/dupeguru.xcodeproj/project.pbxproj @@ -71,6 +71,7 @@ CEE49F4315B9F4E1002BD78B /* HSErrorReportWindow_UI.m in Sources */ = {isa = PBXBuildFile; fileRef = CEE49F3B15B9F4E1002BD78B /* HSErrorReportWindow_UI.m */; }; CEE49F4415B9F4E1002BD78B /* HSFairwareReminder_UI.m in Sources */ = {isa = PBXBuildFile; fileRef = CEE49F3D15B9F4E1002BD78B /* HSFairwareReminder_UI.m */; }; CEE49F4515B9F4E1002BD78B /* ProgressController_UI.m in Sources */ = {isa = PBXBuildFile; fileRef = CEE49F3F15B9F4E1002BD78B /* ProgressController_UI.m */; }; + CEE5B05415C1A2B20077BA7A /* ResultWindow_UI.m in Sources */ = {isa = PBXBuildFile; fileRef = CEE5B05315C1A2B20077BA7A /* ResultWindow_UI.m */; }; CEE7EA130FE675C80004E467 /* DetailsPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = CEE7EA120FE675C80004E467 /* DetailsPanel.m */; }; CEEACCF615BC63E200960A6A /* IgnoreListDialog_UI.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEACCF515BC63E200960A6A /* IgnoreListDialog_UI.m */; }; CEEB135209C837A2004D2330 /* dupeguru.icns in Resources */ = {isa = PBXBuildFile; fileRef = CEEB135109C837A2004D2330 /* dupeguru.icns */; }; @@ -261,6 +262,8 @@ CEE49F3D15B9F4E1002BD78B /* HSFairwareReminder_UI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSFairwareReminder_UI.m; path = ../../cocoalib/autogen/HSFairwareReminder_UI.m; sourceTree = ""; }; CEE49F3E15B9F4E1002BD78B /* ProgressController_UI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProgressController_UI.h; path = ../../cocoalib/autogen/ProgressController_UI.h; sourceTree = ""; }; CEE49F3F15B9F4E1002BD78B /* ProgressController_UI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProgressController_UI.m; path = ../../cocoalib/autogen/ProgressController_UI.m; sourceTree = ""; }; + CEE5B05215C1A2B20077BA7A /* ResultWindow_UI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultWindow_UI.h; sourceTree = ""; }; + CEE5B05315C1A2B20077BA7A /* ResultWindow_UI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultWindow_UI.m; sourceTree = ""; }; CEE7EA110FE675C80004E467 /* DetailsPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailsPanel.h; path = ../base/DetailsPanel.h; sourceTree = SOURCE_ROOT; }; CEE7EA120FE675C80004E467 /* DetailsPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailsPanel.m; path = ../base/DetailsPanel.m; sourceTree = SOURCE_ROOT; }; CEEACCF415BC63E200960A6A /* IgnoreListDialog_UI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreListDialog_UI.h; sourceTree = ""; }; @@ -409,6 +412,8 @@ CE1D091314BE0C6400CA6B8C /* autogen */ = { isa = PBXGroup; children = ( + CEE5B05215C1A2B20077BA7A /* ResultWindow_UI.h */, + CEE5B05315C1A2B20077BA7A /* ResultWindow_UI.m */, CEBAC7B315BEF3EE0012FDB2 /* PrioritizeDialog_UI.h */, CEBAC7B415BEF3EE0012FDB2 /* PrioritizeDialog_UI.m */, CEFC030615BDEFA5005A2559 /* DirectoryPanel_UI.h */, @@ -757,6 +762,7 @@ CE2EC62C15BD9D2C00698FF3 /* ProblemDialog_UI.m in Sources */, CEFC030815BDEFA5005A2559 /* DirectoryPanel_UI.m in Sources */, CEBAC7B515BEF3EE0012FDB2 /* PrioritizeDialog_UI.m in Sources */, + CEE5B05415C1A2B20077BA7A /* ResultWindow_UI.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };