1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-10-31 22:05:58 +00:00

Began a long overdue overhaul of the columns system. Cocoa-only so far, but it will affect the Qt part.

This commit is contained in:
Virgil Dupras 2011-11-26 10:55:14 -05:00
parent 0b1bf79796
commit eb83b830df
17 changed files with 233 additions and 428 deletions

View File

@ -158,14 +158,6 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{ {
[[ProgressController mainProgressController] setWorker:py]; [[ProgressController mainProgressController] setWorker:py];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
//Restore Columns
NSArray *columnsOrder = [ud arrayForKey:@"columnsOrder"];
NSDictionary *columnsWidth = [ud dictionaryForKey:@"columnsWidth"];
if ([columnsOrder count])
[[self resultWindow] restoreColumnsPosition:columnsOrder widths:columnsWidth];
else
[[self resultWindow] resetColumnsToDefault:nil];
[py initialRegistrationSetup]; [py initialRegistrationSetup];
[py loadSession]; [py loadSession];
} }
@ -191,8 +183,6 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)applicationWillTerminate:(NSNotification *)aNotification - (void)applicationWillTerminate:(NSNotification *)aNotification
{ {
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setObject: [[self resultWindow] getColumnsOrder] forKey:@"columnsOrder"];
[ud setObject: [[self resultWindow] getColumnsWidth] forKey:@"columnsWidth"];
NSInteger sc = [ud integerForKey:@"sessionCountSinceLastIgnorePurge"]; NSInteger sc = [ud integerForKey:@"sessionCountSinceLastIgnorePurge"];
if (sc >= 10) { if (sc >= 10) {
sc = -1; sc = -1;

View File

@ -15,7 +15,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (BOOL)deltaValuesMode; - (BOOL)deltaValuesMode;
- (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode; - (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode;
- (NSString *)valueForRow:(NSInteger)rowIndex column:(NSInteger)aColumn; - (NSString *)valueForRow:(NSInteger)rowIndex column:(NSString *)aColumn;
- (BOOL)renameSelected:(NSString *)aNewName; - (BOOL)renameSelected:(NSString *)aNewName;
- (void)sortBy:(NSInteger)aIdentifier ascending:(BOOL)aAscending; - (void)sortBy:(NSInteger)aIdentifier ascending:(BOOL)aAscending;
- (void)markSelected; - (void)markSelected;

View File

@ -9,14 +9,17 @@ http://www.hardcoded.net/licenses/bsd_license
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h> #import <Quartz/Quartz.h>
#import "HSTable.h" #import "HSTable.h"
#import "HSColumns.h"
#import "PyResultTable.h" #import "PyResultTable.h"
@interface ResultTable : HSTable <QLPreviewPanelDataSource, QLPreviewPanelDelegate> @interface ResultTable : HSTable <QLPreviewPanelDataSource, QLPreviewPanelDelegate>
{ {
NSIndexSet *_deltaColumns; NSIndexSet *_deltaColumns;
HSColumns *columns;
} }
- (id)initWithPyParent:(id)aPyParent view:(NSTableView *)aTableView; - (id)initWithPyParent:(id)aPyParent view:(NSTableView *)aTableView;
- (PyResultTable *)py; - (PyResultTable *)py;
- (HSColumns *)columns;
- (BOOL)powerMarkerMode; - (BOOL)powerMarkerMode;
- (void)setPowerMarkerMode:(BOOL)aPowerMarkerMode; - (void)setPowerMarkerMode:(BOOL)aPowerMarkerMode;
- (BOOL)deltaValuesMode; - (BOOL)deltaValuesMode;

View File

@ -21,6 +21,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (id)initWithPyParent:(id)aPyParent view:(NSTableView *)aTableView - (id)initWithPyParent:(id)aPyParent view:(NSTableView *)aTableView
{ {
self = [super initWithPyClassName:@"PyResultTable" pyParent:aPyParent view:aTableView]; self = [super initWithPyClassName:@"PyResultTable" pyParent:aPyParent view:aTableView];
columns = [[HSColumns alloc] initWithPy:[[self py] columns] tableView:aTableView];
[self connect]; [self connect];
return self; return self;
} }
@ -28,6 +29,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)dealloc - (void)dealloc
{ {
[self disconnect]; [self disconnect];
[columns release];
[_deltaColumns release]; [_deltaColumns release];
[super dealloc]; [super dealloc];
} }
@ -58,6 +60,11 @@ http://www.hardcoded.net/licenses/bsd_license
} }
/* Public */ /* Public */
- (HSColumns *)columns
{
return columns;
}
- (BOOL)powerMarkerMode - (BOOL)powerMarkerMode
{ {
return [[self py] powerMarkerMode]; return [[self py] powerMarkerMode];
@ -108,8 +115,7 @@ http://www.hardcoded.net/licenses/bsd_license
if ([identifier isEqual:@"marked"]) { if ([identifier isEqual:@"marked"]) {
return [[self py] valueForColumn:@"marked" row:row]; return [[self py] valueForColumn:@"marked" row:row];
} }
NSInteger columnId = [identifier integerValue]; return [[self py] valueForRow:row column:identifier];
return [[self py] valueForRow:row column:columnId];
} }
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)column row:(NSInteger)row - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)column row:(NSInteger)row
@ -118,8 +124,8 @@ http://www.hardcoded.net/licenses/bsd_license
if ([identifier isEqual:@"marked"]) { if ([identifier isEqual:@"marked"]) {
[[self py] setValue:object forColumn:identifier row:row]; [[self py] setValue:object forColumn:identifier row:row];
} }
else if ([identifier isEqual:@"0"]) { else if ([identifier isEqual:@"name"]) {
NSString *oldName = [[self py] valueForRow:row column:0]; NSString *oldName = [[self py] valueForRow:row column:identifier];
NSString *newName = object; NSString *newName = object;
if (![newName isEqual:oldName]) { if (![newName isEqual:oldName]) {
BOOL renamed = [[self py] renameSelected:newName]; BOOL renamed = [[self py] renameSelected:newName];

View File

@ -27,7 +27,6 @@ http://www.hardcoded.net/licenses/bsd_license
AppDelegateBase *app; AppDelegateBase *app;
PyDupeGuruBase *py; PyDupeGuruBase *py;
NSMenu *columnsMenu; NSMenu *columnsMenu;
NSMutableArray *_resultColumns;
ResultTable *table; ResultTable *table;
StatsLabel *statsLabel; StatsLabel *statsLabel;
ProblemDialog *problemDialog; ProblemDialog *problemDialog;
@ -41,10 +40,7 @@ http://www.hardcoded.net/licenses/bsd_license
/* Helpers */ /* Helpers */
- (void)fillColumnsMenu; - (void)fillColumnsMenu;
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn;
- (NSArray *)getColumnsOrder; - (NSArray *)getColumnsOrder;
- (NSDictionary *)getColumnsWidth;
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted; - (void)sendMarkedToTrash:(BOOL)hardlinkDeleted;
- (void)updateOptionSegments; - (void)updateOptionSegments;

View File

@ -50,9 +50,6 @@ http://www.hardcoded.net/licenses/bsd_license
/* Virtual */ /* Virtual */
- (void)initResultColumns - (void)initResultColumns
{ {
NSUserDefaults *udc = [NSUserDefaultsController sharedUserDefaultsController];
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"];
[refCol bind:@"fontSize" toObject:udc withKeyPath:@"values.TableFontSize" options:nil];
} }
- (void)setScanOptions - (void)setScanOptions
@ -62,14 +59,15 @@ http://www.hardcoded.net/licenses/bsd_license
/* Helpers */ /* Helpers */
- (void)fillColumnsMenu - (void)fillColumnsMenu
{ {
// The columns menu is supposed to be empty and initResultColumns must have been called NSArray *menuItems = [[[table columns] py] menuItems];
for (NSTableColumn *col in _resultColumns) for (NSInteger i=0; i < [menuItems count]; i++) {
{ NSArray *pair = [menuItems objectAtIndex:i];
NSMenuItem *mi = [columnsMenu addItemWithTitle:[[col headerCell] stringValue] action:@selector(toggleColumn:) keyEquivalent:@""]; NSString *display = [pair objectAtIndex:0];
[mi setTag:[[col identifier] integerValue]]; BOOL marked = n2b([pair objectAtIndex:1]);
NSMenuItem *mi = [columnsMenu addItemWithTitle:display action:@selector(toggleColumn:) keyEquivalent:@""];
[mi setTarget:self]; [mi setTarget:self];
if ([[matches tableColumns] containsObject:col]) [mi setState:marked ? NSOnState : NSOffState];
[mi setState:NSOnState]; [mi setTag:i];
} }
[columnsMenu addItem:[NSMenuItem separatorItem]]; [columnsMenu addItem:[NSMenuItem separatorItem]];
NSMenuItem *mi = [columnsMenu addItemWithTitle:TR(@"Reset to Default") NSMenuItem *mi = [columnsMenu addItemWithTitle:TR(@"Reset to Default")
@ -77,21 +75,6 @@ http://www.hardcoded.net/licenses/bsd_license
[mi setTarget:self]; [mi setTarget:self];
} }
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn
{
NSNumber *n = [NSNumber numberWithInteger: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]];
NSUserDefaults *udc = [NSUserDefaultsController sharedUserDefaultsController];
[col bind:@"fontSize" toObject:udc withKeyPath:@"values.TableFontSize" options:nil];
return col;
}
//Returns an array of identifiers, in order. //Returns an array of identifiers, in order.
- (NSArray *)getColumnsOrder - (NSArray *)getColumnsOrder
{ {
@ -103,40 +86,6 @@ http://www.hardcoded.net/licenses/bsd_license
return result; return result;
} }
- (NSDictionary *)getColumnsWidth
{
NSMutableDictionary *result = [NSMutableDictionary dictionary];
for (NSTableColumn *col in [matches tableColumns]) {
NSString *colId = [col identifier];
NSNumber *width = [NSNumber numberWithDouble:[col width]];
[result setObject:width forKey:colId];
}
return result;
}
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth
{
for (NSMenuItem *mi in [columnsMenu itemArray]) {
if ([mi state] == NSOnState) {
[self toggleColumn:mi];
}
}
//Add columns and set widths
for (NSString *colId in aColumnsOrder) {
NSInteger colIndex = [colId integerValue];
if ((colIndex == 0) && (![colId isEqual:@"0"])) {
continue;
}
NSTableColumn *col = [_resultColumns objectAtIndex:colIndex];
NSNumber *width = [aColumnsWidth objectForKey:[col identifier]];
NSMenuItem *mi = [columnsMenu itemWithTag:colIndex];
if (width) {
[col setWidth:[width floatValue]];
}
[self toggleColumn:mi];
}
}
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted - (void)sendMarkedToTrash:(BOOL)hardlinkDeleted
{ {
NSInteger mark_count = [[py getMarkCount] intValue]; NSInteger mark_count = [[py getMarkCount] intValue];
@ -223,6 +172,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)exportToXHTML:(id)sender - (IBAction)exportToXHTML:(id)sender
{ {
// XXX No need to get column order from GUI anymore.
NSString *exported = [py exportToXHTMLwithColumns:[self getColumnsOrder]]; NSString *exported = [py exportToXHTMLwithColumns:[self getColumnsOrder]];
[[NSWorkspace sharedWorkspace] openFile:exported]; [[NSWorkspace sharedWorkspace] openFile:exported];
} }
@ -346,7 +296,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)resetColumnsToDefault:(id)sender - (IBAction)resetColumnsToDefault:(id)sender
{ {
// Virtual [[[table columns] py] resetToDefaults];
} }
- (IBAction)revealSelected:(id)sender - (IBAction)revealSelected:(id)sender
@ -384,19 +334,8 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)toggleColumn:(id)sender - (IBAction)toggleColumn:(id)sender
{ {
NSMenuItem *mi = sender; NSMenuItem *mi = sender;
NSString *colId = [NSString stringWithFormat:@"%d",[mi tag]]; BOOL checked = [[[table columns] py] toggleMenuItem:[mi tag]];
NSTableColumn *col = [matches tableColumnWithIdentifier:colId]; [mi setState:checked ? NSOnState : NSOffState];
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)toggleDetailsPanel:(id)sender - (IBAction)toggleDetailsPanel:(id)sender

View File

@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data> <data>
<int key="IBDocument.SystemTarget">1060</int> <int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">11B26</string> <string key="IBDocument.SystemVersion">11C74</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string> <string key="IBDocument.InterfaceBuilderVersion">1938</string>
<string key="IBDocument.AppKitVersion">1138</string> <string key="IBDocument.AppKitVersion">1138.23</string>
<string key="IBDocument.HIToolboxVersion">566.00</string> <string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1617</string> <string key="NS.object.0">1938</string>
</object> </object>
<array key="IBDocument.IntegratedClassDependencies"> <array key="IBDocument.IntegratedClassDependencies">
<string>NSPopUpButton</string> <string>NSPopUpButton</string>
@ -18,13 +18,12 @@
<string>NSToolbarFlexibleSpaceItem</string> <string>NSToolbarFlexibleSpaceItem</string>
<string>NSCustomObject</string> <string>NSCustomObject</string>
<string>NSTableView</string> <string>NSTableView</string>
<string>NSTextField</string>
<string>NSSearchField</string> <string>NSSearchField</string>
<string>NSTextField</string>
<string>NSSearchFieldCell</string> <string>NSSearchFieldCell</string>
<string>NSWindowTemplate</string> <string>NSWindowTemplate</string>
<string>NSTextFieldCell</string> <string>NSTextFieldCell</string>
<string>NSButtonCell</string> <string>NSButtonCell</string>
<string>NSTableColumn</string>
<string>NSSegmentedControl</string> <string>NSSegmentedControl</string>
<string>NSToolbarSpaceItem</string> <string>NSToolbarSpaceItem</string>
<string>NSPopUpButtonCell</string> <string>NSPopUpButtonCell</string>
@ -40,7 +39,10 @@
<array key="IBDocument.PluginDependencies"> <array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array> </array>
<dictionary class="NSMutableDictionary" key="IBDocument.Metadata"/> <object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001"> <object class="NSCustomObject" id="1001">
<string key="NSClassName">ResultWindow</string> <string key="NSClassName">ResultWindow</string>
@ -162,7 +164,7 @@
<object class="NSSegmentedCell" key="NSCell" id="993391476"> <object class="NSSegmentedCell" key="NSCell" id="993391476">
<int key="NSCellFlags">67239424</int> <int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int> <int key="NSCellFlags2">0</int>
<object class="NSFont" key="NSSupport" id="241613967"> <object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string> <string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double> <double key="NSSize">11</double>
<int key="NSfFlags">16</int> <int key="NSfFlags">16</int>
@ -240,7 +242,7 @@
<int key="NSColorSpace">6</int> <int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string> <string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string> <string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor" id="300787132"> <object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int> <int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes> <bytes key="NSWhite">MAA</bytes>
</object> </object>
@ -703,94 +705,7 @@
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="607866053"/> <reference key="NSNextKeyView" ref="607866053"/>
</object> </object>
<array class="NSMutableArray" key="NSTableColumns"> <array class="NSMutableArray" key="NSTableColumns"/>
<object class="NSTableColumn" id="442382151">
<string key="NSIdentifier">marked</string>
<double key="NSWidth">26</double>
<double key="NSMinWidth">26</double>
<double key="NSMaxWidth">26</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75628096</int>
<int key="NSCellFlags2">134219776</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="26">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double>
<int key="NSfFlags">3100</int>
</object>
<object class="NSColor" key="NSBackgroundColor" id="980928921">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">headerColor</string>
<reference key="NSColor" ref="552368973"/>
</object>
<object class="NSColor" key="NSTextColor" id="532863179">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">headerTextColor</string>
<reference key="NSColor" ref="300787132"/>
</object>
</object>
<object class="NSButtonCell" key="NSDataCell" id="777504751">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">131072</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="387493015"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
<object class="NSButtonImageSource" key="NSAlternateImage">
<string key="NSImageName">NSSwitch</string>
</object>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSIsEditable">YES</bool>
<reference key="NSTableView" ref="387493015"/>
</object>
<object class="NSTableColumn" id="418301244">
<string key="NSIdentifier">0</string>
<double key="NSWidth">195</double>
<double key="NSMinWidth">16</double>
<double key="NSMaxWidth">3.4028234663852886e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75628096</int>
<int key="NSCellFlags2">2048</int>
<string key="NSContents">Name</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSBackgroundColor" ref="980928921"/>
<reference key="NSTextColor" ref="532863179"/>
</object>
<object class="NSTextFieldCell" key="NSDataCell" id="270170598">
<int key="NSCellFlags">337772096</int>
<int key="NSCellFlags2">2048</int>
<string key="NSContents">Text Cell</string>
<reference key="NSSupport" ref="241613967"/>
<reference key="NSControlView" ref="387493015"/>
<object class="NSColor" key="NSBackgroundColor" id="1072464721">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
<reference key="NSColor" ref="359204506"/>
</object>
<reference key="NSTextColor" ref="453389366"/>
</object>
<int key="NSResizingMask">2</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="387493015"/>
<object class="NSSortDescriptor" key="NSSortDescriptorPrototype">
<string key="NSKey">0</string>
<bool key="NSAscending">YES</bool>
<string key="NSSelector">compare:</string>
</object>
</object>
</array>
<double key="NSIntercellSpacingWidth">3</double> <double key="NSIntercellSpacingWidth">3</double>
<double key="NSIntercellSpacingHeight">2</double> <double key="NSIntercellSpacingHeight">2</double>
<reference key="NSBackgroundColor" ref="552368973"/> <reference key="NSBackgroundColor" ref="552368973"/>
@ -821,7 +736,12 @@
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="387493015"/> <reference key="NSNextKeyView" ref="387493015"/>
<reference key="NSDocView" ref="387493015"/> <reference key="NSDocView" ref="387493015"/>
<reference key="NSBGColor" ref="1072464721"/> <object class="NSColor" key="NSBGColor" id="1072464721">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
<reference key="NSColor" ref="359204506"/>
</object>
<int key="NScvFlags">4</int> <int key="NScvFlags">4</int>
</object> </object>
<object class="NSScroller" id="777138208"> <object class="NSScroller" id="777138208">
@ -894,14 +814,6 @@
</array> </array>
<object class="IBObjectContainer" key="IBDocument.Objects"> <object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords"> <array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="866620243"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">45</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">window</string> <string key="label">window</string>
@ -1094,6 +1006,14 @@
</object> </object>
<int key="connectionID">81</int> <int key="connectionID">81</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleQuicklookPanel:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="831294603"/>
</object>
<int key="connectionID">87</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">showDirectoryWindow:</string> <string key="label">showDirectoryWindow:</string>
@ -1102,6 +1022,14 @@
</object> </object>
<int key="connectionID">82</int> <int key="connectionID">82</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="866620243"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">45</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">menu</string> <string key="label">menu</string>
@ -1110,14 +1038,6 @@
</object> </object>
<int key="connectionID">83</int> <int key="connectionID">83</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleQuicklookPanel:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="831294603"/>
</object>
<int key="connectionID">87</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection"> <object class="IBBindingConnection" key="connection">
<string key="label">rowHeight: values.TableFontSize</string> <string key="label">rowHeight: values.TableFontSize</string>
@ -1216,10 +1136,7 @@
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">8</int> <int key="objectID">8</int>
<reference key="object" ref="387493015"/> <reference key="object" ref="387493015"/>
<array class="NSMutableArray" key="children"> <array class="NSMutableArray" key="children"/>
<reference ref="418301244"/>
<reference ref="442382151"/>
</array>
<reference key="parent" ref="489091452"/> <reference key="parent" ref="489091452"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
@ -1232,32 +1149,6 @@
<reference key="object" ref="777138208"/> <reference key="object" ref="777138208"/>
<reference key="parent" ref="489091452"/> <reference key="parent" ref="489091452"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="418301244"/>
<array class="NSMutableArray" key="children">
<reference ref="270170598"/>
</array>
<reference key="parent" ref="387493015"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="442382151"/>
<array class="NSMutableArray" key="children">
<reference ref="777504751"/>
</array>
<reference key="parent" ref="387493015"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="777504751"/>
<reference key="parent" ref="442382151"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="270170598"/>
<reference key="parent" ref="418301244"/>
</object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">67</int> <int key="objectID">67</int>
<reference key="object" ref="593436906"/> <reference key="object" ref="593436906"/>
@ -1530,10 +1421,6 @@
<string key="1.IBWindowTemplateEditedContentRect">{{324, 305}, {557, 400}}</string> <string key="1.IBWindowTemplateEditedContentRect">{{324, 305}, {557, 400}}</string>
<boolean value="NO" key="1.NSWindowTemplate.visibleAtLaunch"/> <boolean value="NO" key="1.NSWindowTemplate.visibleAtLaunch"/>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="10.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -1905,7 +1792,7 @@
</object> </object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/> <real value="1060" key="NS.object.0"/>
</object> </object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
@ -1918,7 +1805,6 @@
<string key="NSMenuCheckmark">{9, 8}</string> <string key="NSMenuCheckmark">{9, 8}</string>
<string key="NSMenuMixedState">{7, 2}</string> <string key="NSMenuMixedState">{7, 2}</string>
<string key="NSQuickLookTemplate">{21, 16}</string> <string key="NSQuickLookTemplate">{21, 16}</string>
<string key="NSSwitch">{15, 15}</string>
<string key="folder32">{32, 32}</string> <string key="folder32">{32, 32}</string>
</dictionary> </dictionary>
</data> </data>

View File

@ -21,7 +21,7 @@ class PyResultTable(PyTable):
def setDeltaValuesMode_(self, value): def setDeltaValuesMode_(self, value):
self.py.delta_values = value self.py.delta_values = value
@signature('@@:ii') @signature('@@:i@')
def valueForRow_column_(self, row_index, column): def valueForRow_column_(self, row_index, column):
return self.py.get_row_value(row_index, column) return self.py.get_row_value(row_index, column)

View File

@ -34,33 +34,39 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)initResultColumns - (void)initResultColumns
{ {
[super initResultColumns]; HSColumnDef defs[] = {
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"]; {@"marked", 26, 26, 26, NO, [NSButtonCell class]},
_resultColumns = [[NSMutableArray alloc] init]; {@"name", 235, 16, 0, YES, nil},
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name {@"folder_path", 120, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:1 title:TRCOL(@"Folder") width:120 refCol:refCol]]; {@"size", 63, 16, 0, YES, nil},
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:TRCOL(@"Size (MB)") width:63 refCol:refCol]; {@"duration", 50, 16, 0, YES, nil},
[[sizeCol dataCell] setAlignment:NSRightTextAlignment]; {@"bitrate", 50, 16, 0, YES, nil},
[_resultColumns addObject:sizeCol]; {@"samplerate", 60, 16, 0, YES, nil},
NSTableColumn *timeCol = [self getColumnForIdentifier:3 title:TRCOL(@"Time") width:50 refCol:refCol]; {@"extension", 40, 16, 0, YES, nil},
[[timeCol dataCell] setAlignment:NSRightTextAlignment]; {@"mtime", 120, 16, 0, YES, nil},
[_resultColumns addObject:timeCol]; {@"title", 120, 16, 0, YES, nil},
NSTableColumn *brCol = [self getColumnForIdentifier:4 title:TRCOL(@"Bitrate") width:50 refCol:refCol]; {@"artist", 120, 16, 0, YES, nil},
[[brCol dataCell] setAlignment:NSRightTextAlignment]; {@"album", 120, 16, 0, YES, nil},
[_resultColumns addObject:brCol]; {@"genre", 80, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:5 title:TRCOL(@"Sample Rate") width:60 refCol:refCol]]; {@"year", 40, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:6 title:TRCOL(@"Kind") width:40 refCol:refCol]]; {@"track", 40, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:7 title:TRCOL(@"Modification") width:120 refCol:refCol]]; {@"comment", 120, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:8 title:TRCOL(@"Title") width:120 refCol:refCol]]; {@"percentage", 57, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:9 title:TRCOL(@"Artist") width:120 refCol:refCol]]; {@"words", 120, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:10 title:TRCOL(@"Album") width:120 refCol:refCol]]; {@"dupe_count", 80, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:11 title:TRCOL(@"Genre") width:80 refCol:refCol]]; nil
[_resultColumns addObject:[self getColumnForIdentifier:12 title:TRCOL(@"Year") width:40 refCol:refCol]]; };
[_resultColumns addObject:[self getColumnForIdentifier:13 title:TRCOL(@"Track Number") width:40 refCol:refCol]]; [[self columns] initializeColumns:defs];
[_resultColumns addObject:[self getColumnForIdentifier:14 title:TRCOL(@"Comment") width:120 refCol:refCol]]; NSTableColumn *c = [matches tableColumnWithIdentifier:@"marked"];
[_resultColumns addObject:[self getColumnForIdentifier:15 title:TRCOL(@"Match %") width:57 refCol:refCol]]; [[c dataCell] setButtonType:NSSwitchButton];
[_resultColumns addObject:[self getColumnForIdentifier:16 title:TRCOL(@"Words Used") width:120 refCol:refCol]]; [[c dataCell] setControlSize:NSSmallControlSize];
[_resultColumns addObject:[self getColumnForIdentifier:17 title:TRCOL(@"Dupe Count") width:80 refCol:refCol]]; c = [[self tableView] tableColumnWithIdentifier:@"size"];
[[c dataCell] setAlignment:NSRightTextAlignment];
c = [[self tableView] tableColumnWithIdentifier:@"duration"];
[[c dataCell] setAlignment:NSRightTextAlignment];
c = [[self tableView] tableColumnWithIdentifier:@"bitrate"];
[[c dataCell] setAlignment:NSRightTextAlignment];
[[table columns] restoreColumns];
} }
/* Actions */ /* Actions */
@ -69,25 +75,6 @@ http://www.hardcoded.net/licenses/bsd_license
[(PyDupeGuru *)py scanDeadTracks]; [(PyDupeGuru *)py scanDeadTracks];
} }
- (IBAction)resetColumnsToDefault:(id)sender
{
NSMutableArray *columnsOrder = [NSMutableArray array];
[columnsOrder addObject:@"0"];
[columnsOrder addObject:@"2"];
[columnsOrder addObject:@"3"];
[columnsOrder addObject:@"4"];
[columnsOrder addObject:@"6"];
[columnsOrder addObject:@"15"];
NSMutableDictionary *columnsWidth = [NSMutableDictionary dictionary];
[columnsWidth setObject:i2n(235) forKey:@"0"];
[columnsWidth setObject:i2n(63) forKey:@"2"];
[columnsWidth setObject:i2n(50) forKey:@"3"];
[columnsWidth setObject:i2n(50) forKey:@"4"];
[columnsWidth setObject:i2n(40) forKey:@"6"];
[columnsWidth setObject:i2n(57) forKey:@"15"];
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
}
/* Notifications */ /* Notifications */
- (void)jobCompleted:(NSNotification *)aNotification - (void)jobCompleted:(NSNotification *)aNotification
{ {

View File

@ -16,19 +16,25 @@ http://www.hardcoded.net/licenses/bsd_license
/* Override */ /* Override */
- (void)initResultColumns - (void)initResultColumns
{ {
[super initResultColumns]; HSColumnDef defs[] = {
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"]; {@"marked", 26, 26, 26, NO, [NSButtonCell class]},
_resultColumns = [[NSMutableArray alloc] init]; {@"name", 162, 16, 0, YES, nil},
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name {@"folder_path", 142, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:1 title:TRCOL(@"Folder") width:120 refCol:refCol]]; {@"size", 63, 16, 0, YES, nil},
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:TRCOL(@"Size (KB)") width:63 refCol:refCol]; {@"extension", 40, 16, 0, YES, nil},
[[sizeCol dataCell] setAlignment:NSRightTextAlignment]; {@"dimensions", 73, 16, 0, YES, nil},
[_resultColumns addObject:sizeCol]; {@"mtime", 120, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:3 title:TRCOL(@"Kind") width:40 refCol:refCol]]; {@"percentage", 58, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:4 title:TRCOL(@"Dimensions") width:80 refCol:refCol]]; {@"dupe_count", 80, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:5 title:TRCOL(@"Modification") width:120 refCol:refCol]]; nil
[_resultColumns addObject:[self getColumnForIdentifier:6 title:TRCOL(@"Match %") width:58 refCol:refCol]]; };
[_resultColumns addObject:[self getColumnForIdentifier:7 title:TRCOL(@"Dupe Count") width:80 refCol:refCol]]; [[self columns] initializeColumns:defs];
NSTableColumn *c = [matches tableColumnWithIdentifier:@"marked"];
[[c dataCell] setButtonType:NSSwitchButton];
[[c dataCell] setControlSize:NSSmallControlSize];
c = [[self tableView] tableColumnWithIdentifier:@"size"];
[[c dataCell] setAlignment:NSRightTextAlignment];
[[table columns] restoreColumns];
} }
- (void)setScanOptions - (void)setScanOptions
@ -50,21 +56,4 @@ http://www.hardcoded.net/licenses/bsd_license
return; return;
[(PyDupeGuru *)py clearPictureCache]; [(PyDupeGuru *)py clearPictureCache];
} }
- (IBAction)resetColumnsToDefault:(id)sender
{
NSMutableArray *columnsOrder = [NSMutableArray array];
[columnsOrder addObject:@"0"];
[columnsOrder addObject:@"1"];
[columnsOrder addObject:@"2"];
[columnsOrder addObject:@"4"];
[columnsOrder addObject:@"6"];
NSMutableDictionary *columnsWidth = [NSMutableDictionary dictionary];
[columnsWidth setObject:i2n(162) forKey:@"0"];
[columnsWidth setObject:i2n(142) forKey:@"1"];
[columnsWidth setObject:i2n(63) forKey:@"2"];
[columnsWidth setObject:i2n(73) forKey:@"4"];
[columnsWidth setObject:i2n(58) forKey:@"6"];
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
}
@end @end

View File

@ -15,19 +15,25 @@ http://www.hardcoded.net/licenses/bsd_license
/* Override */ /* Override */
- (void)initResultColumns - (void)initResultColumns
{ {
[super initResultColumns]; HSColumnDef defs[] = {
NSTableColumn *refCol = [matches tableColumnWithIdentifier:@"0"]; {@"marked", 26, 26, 26, NO, [NSButtonCell class]},
_resultColumns = [[NSMutableArray alloc] init]; {@"name", 195, 16, 0, YES, nil},
[_resultColumns addObject:[matches tableColumnWithIdentifier:@"0"]]; // File Name {@"folder_path", 183, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:1 title:TRCOL(@"Folder") width:120 refCol:refCol]]; {@"size", 63, 16, 0, YES, nil},
NSTableColumn *sizeCol = [self getColumnForIdentifier:2 title:TRCOL(@"Size (KB)") width:63 refCol:refCol]; {@"extension", 40, 16, 0, YES, nil},
[[sizeCol dataCell] setAlignment:NSRightTextAlignment]; {@"mtime", 120, 16, 0, YES, nil},
[_resultColumns addObject:sizeCol]; {@"percentage", 60, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:3 title:TRCOL(@"Kind") width:40 refCol:refCol]]; {@"words", 120, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:4 title:TRCOL(@"Modification") width:120 refCol:refCol]]; {@"dupe_count", 80, 16, 0, YES, nil},
[_resultColumns addObject:[self getColumnForIdentifier:5 title:TRCOL(@"Match %") width:60 refCol:refCol]]; nil
[_resultColumns addObject:[self getColumnForIdentifier:6 title:TRCOL(@"Words Used") width:120 refCol:refCol]]; };
[_resultColumns addObject:[self getColumnForIdentifier:7 title:TRCOL(@"Dupe Count") width:80 refCol:refCol]]; [[table columns] initializeColumns:defs];
NSTableColumn *c = [matches tableColumnWithIdentifier:@"marked"];
[[c dataCell] setButtonType:NSSwitchButton];
[[c dataCell] setControlSize:NSSmallControlSize];
c = [matches tableColumnWithIdentifier:@"size"];
[[c dataCell] setAlignment:NSRightTextAlignment];
[[table columns] restoreColumns];
} }
- (void)setScanOptions - (void)setScanOptions
@ -44,20 +50,4 @@ http://www.hardcoded.net/licenses/bsd_license
int sizeThreshold = [ud boolForKey:@"ignoreSmallFiles"] ? smallFileThreshold * 1024 : 0; // The py side wants bytes int sizeThreshold = [ud boolForKey:@"ignoreSmallFiles"] ? smallFileThreshold * 1024 : 0; // The py side wants bytes
[_py setSizeThreshold:sizeThreshold]; [_py setSizeThreshold:sizeThreshold];
} }
/* Actions */
- (IBAction)resetColumnsToDefault:(id)sender
{
NSMutableArray *columnsOrder = [NSMutableArray array];
[columnsOrder addObject:@"0"];
[columnsOrder addObject:@"1"];
[columnsOrder addObject:@"2"];
[columnsOrder addObject:@"5"];
NSMutableDictionary *columnsWidth = [NSMutableDictionary dictionary];
[columnsWidth setObject:i2n(195) forKey:@"0"];
[columnsWidth setObject:i2n(183) forKey:@"1"];
[columnsWidth setObject:i2n(63) forKey:@"2"];
[columnsWidth setObject:i2n(60) forKey:@"5"];
[self restoreColumnsPosition:columnsOrder widths:columnsWidth];
}
@end @end

View File

@ -22,6 +22,7 @@
CE4557B40AE3BC50005A9546 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CE45579A0AE3BC2B005A9546 /* Sparkle.framework */; }; CE4557B40AE3BC50005A9546 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CE45579A0AE3BC2B005A9546 /* Sparkle.framework */; };
CE5335FC142BBFAF008E5374 /* HSQuicklook.m in Sources */ = {isa = PBXBuildFile; fileRef = CE5335FB142BBFAF008E5374 /* HSQuicklook.m */; }; CE5335FC142BBFAF008E5374 /* HSQuicklook.m in Sources */ = {isa = PBXBuildFile; fileRef = CE5335FB142BBFAF008E5374 /* HSQuicklook.m */; };
CE533603142BC034008E5374 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE533602142BC034008E5374 /* Quartz.framework */; }; CE533603142BC034008E5374 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE533602142BC034008E5374 /* Quartz.framework */; };
CE54A87E148046F9008EEA77 /* HSColumns.m in Sources */ = {isa = PBXBuildFile; fileRef = CE54A87D148046F9008EEA77 /* HSColumns.m */; };
CE647E571173024A006D28BA /* ProblemDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CE647E551173024A006D28BA /* ProblemDialog.m */; }; CE647E571173024A006D28BA /* ProblemDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CE647E551173024A006D28BA /* ProblemDialog.m */; };
CE665B3013225ADD003F5CFB /* ExtraFairwareReminder.m in Sources */ = {isa = PBXBuildFile; fileRef = CE665B2E13225ADD003F5CFB /* ExtraFairwareReminder.m */; }; CE665B3013225ADD003F5CFB /* ExtraFairwareReminder.m in Sources */ = {isa = PBXBuildFile; fileRef = CE665B2E13225ADD003F5CFB /* ExtraFairwareReminder.m */; };
CE665B3313225AF8003F5CFB /* ExtraFairwareReminder.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE665B3113225AF8003F5CFB /* ExtraFairwareReminder.xib */; }; CE665B3313225AF8003F5CFB /* ExtraFairwareReminder.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE665B3113225AF8003F5CFB /* ExtraFairwareReminder.xib */; };
@ -126,6 +127,9 @@
CE5335FA142BBFAF008E5374 /* HSQuicklook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSQuicklook.h; path = ../../cocoalib/HSQuicklook.h; sourceTree = "<group>"; }; CE5335FA142BBFAF008E5374 /* HSQuicklook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSQuicklook.h; path = ../../cocoalib/HSQuicklook.h; sourceTree = "<group>"; };
CE5335FB142BBFAF008E5374 /* HSQuicklook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSQuicklook.m; path = ../../cocoalib/HSQuicklook.m; sourceTree = "<group>"; }; CE5335FB142BBFAF008E5374 /* HSQuicklook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSQuicklook.m; path = ../../cocoalib/HSQuicklook.m; sourceTree = "<group>"; };
CE533602142BC034008E5374 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; CE533602142BC034008E5374 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
CE54A87A14804687008EEA77 /* PyColumns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PyColumns.h; sourceTree = "<group>"; };
CE54A87C148046F9008EEA77 /* HSColumns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSColumns.h; sourceTree = "<group>"; };
CE54A87D148046F9008EEA77 /* HSColumns.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSColumns.m; sourceTree = "<group>"; };
CE647E541173024A006D28BA /* ProblemDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProblemDialog.h; path = ../base/ProblemDialog.h; sourceTree = SOURCE_ROOT; }; CE647E541173024A006D28BA /* ProblemDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProblemDialog.h; path = ../base/ProblemDialog.h; sourceTree = SOURCE_ROOT; };
CE647E551173024A006D28BA /* ProblemDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProblemDialog.m; path = ../base/ProblemDialog.m; sourceTree = SOURCE_ROOT; }; CE647E551173024A006D28BA /* ProblemDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProblemDialog.m; path = ../base/ProblemDialog.m; sourceTree = SOURCE_ROOT; };
CE647E561173024A006D28BA /* PyProblemDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PyProblemDialog.h; path = ../base/PyProblemDialog.h; sourceTree = SOURCE_ROOT; }; CE647E561173024A006D28BA /* PyProblemDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PyProblemDialog.h; path = ../base/PyProblemDialog.h; sourceTree = SOURCE_ROOT; };
@ -386,6 +390,8 @@
CE76FDC7111EE38E006618EA /* controllers */ = { CE76FDC7111EE38E006618EA /* controllers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CE54A87C148046F9008EEA77 /* HSColumns.h */,
CE54A87D148046F9008EEA77 /* HSColumns.m */,
CEBE4D72111F0EE1009AAC6D /* HSWindowController.h */, CEBE4D72111F0EE1009AAC6D /* HSWindowController.h */,
CEBE4D73111F0EE1009AAC6D /* HSWindowController.m */, CEBE4D73111F0EE1009AAC6D /* HSWindowController.m */,
CE76FDDD111EE42F006618EA /* HSOutline.h */, CE76FDDD111EE42F006618EA /* HSOutline.h */,
@ -406,6 +412,7 @@
CE76FDCC111EE38E006618EA /* proxies */ = { CE76FDCC111EE38E006618EA /* proxies */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CE54A87A14804687008EEA77 /* PyColumns.h */,
CE76FDCD111EE38E006618EA /* PyGUI.h */, CE76FDCD111EE38E006618EA /* PyGUI.h */,
CE76FDCE111EE38E006618EA /* PyOutline.h */, CE76FDCE111EE38E006618EA /* PyOutline.h */,
CE8C53B61173248F0011B41F /* PyTable.h */, CE8C53B61173248F0011B41F /* PyTable.h */,
@ -636,6 +643,7 @@
CE41672D141FE1E5004F3F0B /* HSSelectableList.m in Sources */, CE41672D141FE1E5004F3F0B /* HSSelectableList.m in Sources */,
CE89240A14239CC30024CE4E /* PrioritizeList.m in Sources */, CE89240A14239CC30024CE4E /* PrioritizeList.m in Sources */,
CE5335FC142BBFAF008E5374 /* HSQuicklook.m in Sources */, CE5335FC142BBFAF008E5374 /* HSQuicklook.m in Sources */,
CE54A87E148046F9008EEA77 /* HSColumns.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -41,8 +41,6 @@ class JobType:
Copy = 'job_copy' Copy = 'job_copy'
Delete = 'job_delete' Delete = 'job_delete'
Column = namedtuple('Column', 'attr display')
def format_timestamp(t, delta): def format_timestamp(t, delta):
if delta: if delta:
return format_time_decimal(t) return format_time_decimal(t)
@ -68,10 +66,10 @@ def format_dupe_count(c):
return str(c) if c else '---' return str(c) if c else '---'
def cmp_value(dupe, column): def cmp_value(dupe, column):
if column.attr == 'name': if column.name == 'name':
value = rem_file_ext(dupe.name) value = rem_file_ext(dupe.name)
else: else:
value = getattr(dupe, column.attr, '') value = getattr(dupe, column.name, '')
return value.lower() if isinstance(value, str) else value return value.lower() if isinstance(value, str) else value
class DupeGuru(RegistrableApplication, Broadcaster): class DupeGuru(RegistrableApplication, Broadcaster):
@ -411,6 +409,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.directories.save_to_file(op.join(self.appdata, 'last_directories.xml')) self.directories.save_to_file(op.join(self.appdata, 'last_directories.xml'))
p = op.join(self.appdata, 'ignore_list.xml') p = op.join(self.appdata, 'ignore_list.xml')
self.scanner.ignore_list.save_to_xml(p) self.scanner.ignore_list.save_to_xml(p)
self.notify('save_session')
def save_as(self, filename): def save_as(self, filename):
self.results.save_to_xml(filename) self.results.save_to_xml(filename)

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras # Created By: Virgil Dupras
# Created On: 2010-02-11 # Created On: 2010-02-11
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net) # Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
@ -10,6 +9,7 @@
from operator import attrgetter from operator import attrgetter
from hscommon.gui.table import GUITable, Row from hscommon.gui.table import GUITable, Row
from hscommon.gui.column import Columns
from .base import GUIObject from .base import GUIObject
@ -55,6 +55,8 @@ class ResultTable(GUIObject, GUITable):
def __init__(self, view, app): def __init__(self, view, app):
GUIObject.__init__(self, view, app) GUIObject.__init__(self, view, app)
GUITable.__init__(self) GUITable.__init__(self)
self.COLUMNS = app.COLUMNS
self.columns = Columns(self, prefaccess=app, savename='ResultTable')
self._power_marker = False self._power_marker = False
self._delta_values = False self._delta_values = False
self._sort_descriptors = (0, True) self._sort_descriptors = (0, True)
@ -63,6 +65,7 @@ class ResultTable(GUIObject, GUITable):
def connect(self): def connect(self):
GUIObject.connect(self) GUIObject.connect(self)
self._refresh_with_view() self._refresh_with_view()
self.columns.restore_columns()
def _restore_selection(self, previous_selection): def _restore_selection(self, previous_selection):
if self.app.selected_dupes: if self.app.selected_dupes:
@ -162,3 +165,6 @@ class ResultTable(GUIObject, GUITable):
self.select(indexes) self.select(indexes)
self.view.refresh() self.view.refresh()
def save_session(self):
self.columns.save_columns()

View File

@ -7,8 +7,9 @@
from hscommon.trans import trget from hscommon.trans import trget
from hscommon.util import format_size, format_time from hscommon.util import format_size, format_time
from hscommon.gui.column import Column
from core.app import (DupeGuru as DupeGuruBase, Column, format_timestamp, from core.app import (DupeGuru as DupeGuruBase, format_timestamp,
format_perc, format_words, format_dupe_count, cmp_value) format_perc, format_words, format_dupe_count, cmp_value)
from . import prioritize from . import prioritize
from . import __appname__ from . import __appname__
@ -19,24 +20,25 @@ coltr = trget('columns')
class DupeGuru(DupeGuruBase): class DupeGuru(DupeGuruBase):
NAME = __appname__ NAME = __appname__
COLUMNS = [ COLUMNS = [
Column('marked', ''),
Column('name', coltr("Filename")), Column('name', coltr("Filename")),
Column('folder_path', coltr("Folder")), Column('folder_path', coltr("Folder"), visible=False, optional=True),
Column('size', coltr("Size (MB)")), Column('size', coltr("Size (MB)"), optional=True),
Column('duration', coltr("Time")), Column('duration', coltr("Time"), optional=True),
Column('bitrate', coltr("Bitrate")), Column('bitrate', coltr("Bitrate"), optional=True),
Column('samplerate', coltr("Sample Rate")), Column('samplerate', coltr("Sample Rate"), visible=False, optional=True),
Column('extension', coltr("Kind")), Column('extension', coltr("Kind"), optional=True),
Column('mtime', coltr("Modification")), Column('mtime', coltr("Modification"), visible=False, optional=True),
Column('title', coltr("Title")), Column('title', coltr("Title"), visible=False, optional=True),
Column('artist', coltr("Artist")), Column('artist', coltr("Artist"), visible=False, optional=True),
Column('album', coltr("Album")), Column('album', coltr("Album"), visible=False, optional=True),
Column('genre', coltr("Genre")), Column('genre', coltr("Genre"), visible=False, optional=True),
Column('year', coltr("Year")), Column('year', coltr("Year"), visible=False, optional=True),
Column('track', coltr("Track Number")), Column('track', coltr("Track Number"), visible=False, optional=True),
Column('comment', coltr("Comment")), Column('comment', coltr("Comment"), visible=False, optional=True),
Column('percentage', coltr("Match %")), Column('percentage', coltr("Match %"), optional=True),
Column('words', coltr("Words Used")), Column('words', coltr("Words Used"), visible=False, optional=True),
Column('dupe_count', coltr("Dupe Count")), Column('dupe_count', coltr("Dupe Count"), visible=False, optional=True),
] ]
DELTA_COLUMNS = {2, 3, 4, 5, 7} DELTA_COLUMNS = {2, 3, 4, 5, 7}
METADATA_TO_READ = ['size', 'mtime', 'duration', 'bitrate', 'samplerate', 'title', 'artist', METADATA_TO_READ = ['size', 'mtime', 'duration', 'bitrate', 'samplerate', 'title', 'artist',
@ -69,26 +71,26 @@ class DupeGuru(DupeGuruBase):
else: else:
percentage = group.percentage percentage = group.percentage
dupe_count = len(group.dupes) dupe_count = len(group.dupes)
return [ return {
dupe.name, 'name': dupe.name,
str(dupe.folder_path), 'folder_path': str(dupe.folder_path),
format_size(size, 2, 2, False), 'size': format_size(size, 2, 2, False),
format_time(duration, with_hours=False), 'duration': format_time(duration, with_hours=False),
str(bitrate), 'bitrate': str(bitrate),
str(samplerate), 'samplerate': str(samplerate),
dupe.extension, 'extension': dupe.extension,
format_timestamp(mtime,delta and m), 'mtime': format_timestamp(mtime,delta and m),
dupe.title, 'title': dupe.title,
dupe.artist, 'artist': dupe.artist,
dupe.album, 'album': dupe.album,
dupe.genre, 'genre': dupe.genre,
dupe.year, 'year': dupe.year,
str(dupe.track), 'track': str(dupe.track),
dupe.comment, 'comment': dupe.comment,
format_perc(percentage), 'percentage': format_perc(percentage),
format_words(dupe.words) if hasattr(dupe, 'words') else '', 'words': format_words(dupe.words) if hasattr(dupe, 'words') else '',
format_dupe_count(dupe_count) 'dupe_count': format_dupe_count(dupe_count),
] }
def _get_dupe_sort_key(self, dupe, get_group, key, delta): def _get_dupe_sort_key(self, dupe, get_group, key, delta):
if key == self.MATCHPERC_COL: if key == self.MATCHPERC_COL:

View File

@ -9,8 +9,9 @@ import os.path as op
from hscommon.trans import trget from hscommon.trans import trget
from hscommon.util import format_size from hscommon.util import format_size
from hscommon.gui.column import Column
from core.app import (DupeGuru as DupeGuruBase, Column, format_timestamp, format_perc, from core.app import (DupeGuru as DupeGuruBase, format_timestamp, format_perc,
format_dupe_count, cmp_value) format_dupe_count, cmp_value)
from .scanner import ScannerPE from .scanner import ScannerPE
from . import prioritize from . import prioritize
@ -27,14 +28,15 @@ def get_delta_dimensions(value, ref_value):
class DupeGuru(DupeGuruBase): class DupeGuru(DupeGuruBase):
NAME = __appname__ NAME = __appname__
COLUMNS = [ COLUMNS = [
Column('marked', ''),
Column('name', coltr("Filename")), Column('name', coltr("Filename")),
Column('folder_path', coltr("Folder")), Column('folder_path', coltr("Folder"), optional=True),
Column('size', coltr("Size (KB)")), Column('size', coltr("Size (KB)"), optional=True),
Column('extension', coltr("Kind")), Column('extension', coltr("Kind"), visible=False, optional=True),
Column('dimensions', coltr("Dimensions")), Column('dimensions', coltr("Dimensions"), optional=True),
Column('mtime', coltr("Modification")), Column('mtime', coltr("Modification"), visible=False, optional=True),
Column('percentage', coltr("Match %")), Column('percentage', coltr("Match %"), optional=True),
Column('dupe_count', coltr("Dupe Count")), Column('dupe_count', coltr("Dupe Count"), visible=False, optional=True),
] ]
DELTA_COLUMNS = {2, 4, 5} DELTA_COLUMNS = {2, 4, 5}
METADATA_TO_READ = ['size', 'mtime', 'dimensions'] METADATA_TO_READ = ['size', 'mtime', 'dimensions']
@ -64,16 +66,16 @@ class DupeGuru(DupeGuruBase):
percentage = group.percentage percentage = group.percentage
dupe_count = len(group.dupes) dupe_count = len(group.dupes)
dupe_folder_path = getattr(dupe, 'display_folder_path', dupe.folder_path) dupe_folder_path = getattr(dupe, 'display_folder_path', dupe.folder_path)
return [ return {
dupe.name, 'name': dupe.name,
str(dupe_folder_path), 'folder_path': str(dupe_folder_path),
format_size(size, 0, 1, False), 'size': format_size(size, 0, 1, False),
dupe.extension, 'extension': dupe.extension,
format_dimensions(dimensions), 'dimensions': format_dimensions(dimensions),
format_timestamp(mtime, delta and m), 'mtime': format_timestamp(mtime, delta and m),
format_perc(percentage), 'percentage': format_perc(percentage),
format_dupe_count(dupe_count) 'dupe_count': format_dupe_count(dupe_count),
] }
def _get_dupe_sort_key(self, dupe, get_group, key, delta): def _get_dupe_sort_key(self, dupe, get_group, key, delta):
if key == self.MATCHPERC_COL: if key == self.MATCHPERC_COL:

View File

@ -7,8 +7,9 @@
from hscommon.trans import trget from hscommon.trans import trget
from hscommon.util import format_size from hscommon.util import format_size
from hscommon.gui.column import Column
from core.app import (DupeGuru as DupeGuruBase, Column, format_timestamp, format_perc, from core.app import (DupeGuru as DupeGuruBase, format_timestamp, format_perc,
format_words, format_dupe_count, cmp_value) format_words, format_dupe_count, cmp_value)
from core import prioritize from core import prioritize
from . import __appname__ from . import __appname__
@ -18,14 +19,15 @@ coltr = trget('columns')
class DupeGuru(DupeGuruBase): class DupeGuru(DupeGuruBase):
NAME = __appname__ NAME = __appname__
COLUMNS = [ COLUMNS = [
Column('marked', ''),
Column('name', coltr("Filename")), Column('name', coltr("Filename")),
Column('folder_path', coltr("Folder")), Column('folder_path', coltr("Folder"), optional=True),
Column('size', coltr("Size (KB)")), Column('size', coltr("Size (KB)"), optional=True),
Column('extension', coltr("Kind")), Column('extension', coltr("Kind"), visible=False, optional=True),
Column('mtime', coltr("Modification")), Column('mtime', coltr("Modification"), visible=False, optional=True),
Column('percentage', coltr("Match %")), Column('percentage', coltr("Match %"), optional=True),
Column('words', coltr("Words Used")), Column('words', coltr("Words Used"), visible=False, optional=True),
Column('dupe_count', coltr("Dupe Count")), Column('dupe_count', coltr("Dupe Count"), visible=False, optional=True),
] ]
DELTA_COLUMNS = {2, 4} DELTA_COLUMNS = {2, 4}
METADATA_TO_READ = ['size', 'mtime'] METADATA_TO_READ = ['size', 'mtime']
@ -49,16 +51,16 @@ class DupeGuru(DupeGuruBase):
else: else:
percentage = group.percentage percentage = group.percentage
dupe_count = len(group.dupes) dupe_count = len(group.dupes)
return [ return {
dupe.name, 'name': dupe.name,
str(dupe.folder_path), 'folder_path': str(dupe.folder_path),
format_size(size, 0, 1, False), 'size': format_size(size, 0, 1, False),
dupe.extension, 'extension': dupe.extension,
format_timestamp(mtime, delta and m), 'mtime': format_timestamp(mtime, delta and m),
format_perc(percentage), 'percentage': format_perc(percentage),
format_words(dupe.words) if hasattr(dupe, 'words') else '', 'words': format_words(dupe.words) if hasattr(dupe, 'words') else '',
format_dupe_count(dupe_count) 'dupe_count': format_dupe_count(dupe_count),
] }
def _get_dupe_sort_key(self, dupe, get_group, key, delta): def _get_dupe_sort_key(self, dupe, get_group, key, delta):
if key == self.MATCHPERC_COL: if key == self.MATCHPERC_COL: