From 155f0dfd8217fe5bd53e4e1db00b288c2827138a Mon Sep 17 00:00:00 2001 From: Miltiadis Vasilakis Date: Wed, 10 Aug 2011 17:53:06 +0300 Subject: [PATCH] Minor UI changes. Minor fixes. --- pithos-macos/PithosBrowserController.m | 46 +++++++++-- pithos-macos/PithosBrowserController.xib | 6 +- pithos-macos/PithosBrowserPreviewController.xib | 95 ++++++----------------- pithos-macos/PithosContainerNode.h | 2 + pithos-macos/PithosContainerNode.m | 24 ++++-- pithos-macos/PithosEmptyNode.h | 1 - pithos-macos/PithosEmptyNode.m | 3 +- pithos-macos/PithosNode.h | 2 + pithos-macos/PithosNode.m | 1 + pithos-macos/PithosObjectNode.h | 2 - pithos-macos/PithosObjectNode.m | 4 +- pithos-macos/PithosSubdirNode.m | 9 ++- pithos-macos/pithos_macosAppDelegate.m | 12 ++- 13 files changed, 104 insertions(+), 103 deletions(-) diff --git a/pithos-macos/PithosBrowserController.m b/pithos-macos/PithosBrowserController.m index f5d2738..c1dd936 100644 --- a/pithos-macos/PithosBrowserController.m +++ b/pithos-macos/PithosBrowserController.m @@ -135,16 +135,38 @@ self.outlineViewDataSourceArray = nil; // Create the outlineView tree - NSTreeNode *treeNode = [NSTreeNode treeNodeWithRepresentedObject: + // CONTAINERS + NSTreeNode *containersTreeNode = [NSTreeNode treeNodeWithRepresentedObject: [[[PithosEmptyNode alloc] initWithDisplayName:@"CONTAINERS" icon:nil] autorelease]]; - [[treeNode mutableChildNodes] addObject: + // CONTAINERS/pithos + [[containersTreeNode mutableChildNodes] addObject: [NSTreeNode treeNodeWithRepresentedObject: - [[[PithosContainerNode alloc] initWithContainerName:@"pithos"] autorelease]]]; - [[treeNode mutableChildNodes] addObject: + [[[PithosContainerNode alloc] initWithContainerName:@"pithos" + icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kToolbarHomeIcon)] + ] autorelease]]]; + // CONTAINERS/trash + [[containersTreeNode mutableChildNodes] addObject: [NSTreeNode treeNodeWithRepresentedObject: - [[[PithosContainerNode alloc] initWithContainerName:@"trash"] autorelease]]]; + [[[PithosContainerNode alloc] initWithContainerName:@"trash" + icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kFullTrashIcon)] + ] autorelease]]]; + // SHARED + NSTreeNode *sharedTreeNode = [NSTreeNode treeNodeWithRepresentedObject: + [[[PithosEmptyNode alloc] initWithDisplayName:@"SHARED" icon:nil] autorelease]]; + // SHARED/my shared + [[sharedTreeNode mutableChildNodes] addObject: + [NSTreeNode treeNodeWithRepresentedObject: + [[[PithosEmptyNode alloc] initWithDisplayName:@"my shared" + icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)] + ] autorelease]]]; + // SHARED/others shared + [[sharedTreeNode mutableChildNodes] addObject: + [NSTreeNode treeNodeWithRepresentedObject: + [[[PithosEmptyNode alloc] initWithDisplayName:@"others shared" + icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGuestUserIcon)] + ] autorelease]]]; - self.outlineViewDataSourceArray = [NSMutableArray arrayWithObject:treeNode]; + self.outlineViewDataSourceArray = [NSMutableArray arrayWithObjects:containersTreeNode, sharedTreeNode, nil]; // Expand the folder outline view [outlineView expandItem:nil expandChildren:YES]; @@ -200,8 +222,7 @@ NSLog(@"Authentication - storageURLPrefix:%@, authUser:%@, authToken:%@", storageURLPrefix, authUser, authToken); if ([authUser length] && [authToken length]) { - //if (authUser && ([authUser length] > 0) && authToken && ([authToken length] > 0)) { - [ASIPithosRequest setStorageURL:[storageURLPrefix stringByAppendingString:authUser]]; + [ASIPithosRequest setStorageURL:[storageURLPrefix stringByAppendingString:[authUser stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; [ASIPithosRequest setAuthToken:authToken]; [self resetContainers]; } else { @@ -283,6 +304,15 @@ return sharedPreviewController; } +//- (CGFloat)browser:(NSBrowser *)browser shouldSizeColumn:(NSInteger)columnIndex forUserResize:(BOOL)forUserResize toWidth:(CGFloat)suggestedWidth { +// if (!forUserResize) { +// id item = [browser parentForItemsInColumn:columnIndex]; +// if ([self browser:browser isLeafItem:item]) { +// suggestedWidth = 200; +// } +// } +// return suggestedWidth; +//} #pragma mark - #pragma NSSplitViewDelegate diff --git a/pithos-macos/PithosBrowserController.xib b/pithos-macos/PithosBrowserController.xib index d9e2794..7477f57 100644 --- a/pithos-macos/PithosBrowserController.xib +++ b/pithos-macos/PithosBrowserController.xib @@ -486,7 +486,7 @@ 4370 - {509, 422} + {{-1, -1}, {511, 402}} @@ -507,7 +507,7 @@ 2 170 YES - 469843968 + 134299648 17 @@ -739,7 +739,7 @@ 67239424 0 - Check + 1211912703 diff --git a/pithos-macos/PithosBrowserPreviewController.xib b/pithos-macos/PithosBrowserPreviewController.xib index f807ddc..8479596 100644 --- a/pithos-macos/PithosBrowserPreviewController.xib +++ b/pithos-macos/PithosBrowserPreviewController.xib @@ -52,7 +52,7 @@ 269 - {{59, 8}, {82, 19}} + {{59, 18}, {82, 19}} @@ -61,9 +61,9 @@ -2080244224 134217728 More info... - + LucidaGrande - 12 + 11 16 @@ -78,7 +78,7 @@ 271 - {{1, 35}, {98, 14}} + {{1, 45}, {98, 14}} @@ -117,7 +117,7 @@ 271 - {{1, 57}, {98, 14}} + {{1, 61}, {98, 14}} @@ -136,7 +136,7 @@ 271 - {{1, 79}, {98, 14}} + {{1, 77}, {98, 14}} @@ -155,7 +155,7 @@ 271 - {{1, 101}, {98, 14}} + {{1, 93}, {98, 14}} @@ -174,7 +174,7 @@ 271 - {{1, 123}, {98, 14}} + {{1, 109}, {98, 14}} @@ -193,7 +193,7 @@ 271 - {{1, 145}, {98, 14}} + {{1, 125}, {98, 14}} @@ -212,7 +212,7 @@ 271 - {{101, 35}, {98, 14}} + {{101, 45}, {98, 14}} @@ -221,11 +221,7 @@ 67239488 4196352 Version - - LucidaGrande - 11 - 16 - + @@ -242,7 +238,7 @@ 271 - {{101, 57}, {98, 14}} + {{101, 61}, {98, 14}} @@ -260,7 +256,7 @@ 271 - {{101, 79}, {98, 14}} + {{101, 77}, {98, 14}} @@ -278,7 +274,7 @@ 271 - {{101, 101}, {98, 14}} + {{101, 93}, {98, 14}} @@ -296,7 +292,7 @@ 271 - {{101, 123}, {98, 14}} + {{101, 109}, {98, 14}} @@ -314,7 +310,7 @@ 271 - {{101, 145}, {98, 14}} + {{101, 125}, {98, 14}} @@ -344,7 +340,7 @@ NeXT TIFF v4.0 pasteboard type - {{36, 167}, {128, 128}} + {{36, 147}, {128, 128}} @@ -359,33 +355,11 @@ YES - - - 268 - {{17, 303}, {56, 17}} - - - - YES - - 68288064 - 272630784 - Preview: - - LucidaGrande - 13 - 1044 - - - - - - - {200, 330} + {200, 295} - + NSView @@ -548,21 +522,20 @@ YES - - - - - - + + + + + @@ -587,20 +560,6 @@ - 25 - - - YES - - - - - - 26 - - - - 29 @@ -808,8 +767,6 @@ 1.editorWindowContentRectSynchronizationRect 20.IBPluginDependency 21.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency 27.IBPluginDependency 28.IBPluginDependency 29.IBPluginDependency @@ -873,8 +830,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin @@ -889,7 +844,7 @@ - 75 + 76 0 diff --git a/pithos-macos/PithosContainerNode.h b/pithos-macos/PithosContainerNode.h index 1798280..1a3cb57 100644 --- a/pithos-macos/PithosContainerNode.h +++ b/pithos-macos/PithosContainerNode.h @@ -49,6 +49,8 @@ } - (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer; +- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer icon:(NSImage *)anIcon; - (id)initWithContainerName:(NSString *)aContainerName; +- (id)initWithContainerName:(NSString *)aContainerName icon:(NSImage *)anIcon; @end diff --git a/pithos-macos/PithosContainerNode.m b/pithos-macos/PithosContainerNode.m index bfa527c..8e94ddb 100644 --- a/pithos-macos/PithosContainerNode.m +++ b/pithos-macos/PithosContainerNode.m @@ -42,31 +42,41 @@ #import "ASIPithosObject.h" #import "ASIDownloadCache.h" -static NSImage *icon = nil; +static NSImage *classIcon = nil; @implementation PithosContainerNode + (void)initialize { if (self == [PithosContainerNode class]) - icon = [[NSImage imageNamed:@"container"] retain]; + classIcon = [[NSImage imageNamed:@"container"] retain]; } #pragma mark - #pragma mark Object Lifecycle -- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer { +- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer icon:(NSImage *)anIcon { if ((self = [super init])) { pithosContainer = [aPithosContainer retain]; refreshing = NO; prefix = nil; + + icon = [anIcon retain]; } return self; } -- (id)initWithContainerName:(NSString *)aContainerName { +- (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer { + return [self initWithPithosContainer:aPithosContainer icon:nil]; +} + +- (id)initWithContainerName:(NSString *)aContainerName icon:(NSImage *)anIcon { ASIPithosContainer *container = [ASIPithosContainer container]; container.name = aContainerName; - return [self initWithPithosContainer:container]; + return [self initWithPithosContainer:container icon:anIcon]; +} + +- (id)initWithContainerName:(NSString *)aContainerName { + return [self initWithContainerName:aContainerName icon:nil]; } - (void)dealloc { @@ -189,7 +199,9 @@ static NSImage *icon = nil; } - (NSImage *)icon { - return icon; + if (icon) + return icon; + return classIcon; } @end diff --git a/pithos-macos/PithosEmptyNode.h b/pithos-macos/PithosEmptyNode.h index 6c5b489..90f62a2 100644 --- a/pithos-macos/PithosEmptyNode.h +++ b/pithos-macos/PithosEmptyNode.h @@ -38,7 +38,6 @@ #import "PithosNode.h" @interface PithosEmptyNode : PithosNode { - NSImage *icon; } - (id)initWithDisplayName:(NSString *)aDisplayName icon:(NSImage *)anIcon; diff --git a/pithos-macos/PithosEmptyNode.m b/pithos-macos/PithosEmptyNode.m index aa537eb..928562a 100644 --- a/pithos-macos/PithosEmptyNode.m +++ b/pithos-macos/PithosEmptyNode.m @@ -47,13 +47,12 @@ displayName = [aDisplayName copy]; icon = [anIcon retain]; - isLeafItem = YES; +// isLeafItem = YES; } return self; } - (void)dealloc { - [icon release]; [super dealloc]; } diff --git a/pithos-macos/PithosNode.h b/pithos-macos/PithosNode.h index 8440a3f..8889561 100644 --- a/pithos-macos/PithosNode.h +++ b/pithos-macos/PithosNode.h @@ -44,6 +44,8 @@ NSString *displayName; BOOL isLeafItem; + + NSImage *icon; } @property(readonly) NSString *url; diff --git a/pithos-macos/PithosNode.m b/pithos-macos/PithosNode.m index 344a5c3..bc1cc4e 100644 --- a/pithos-macos/PithosNode.m +++ b/pithos-macos/PithosNode.m @@ -53,6 +53,7 @@ } - (void)dealloc { + [icon release]; [displayName release]; [previousChildren release]; [children release]; diff --git a/pithos-macos/PithosObjectNode.h b/pithos-macos/PithosObjectNode.h index 6bdb3e7..f51f68d 100644 --- a/pithos-macos/PithosObjectNode.h +++ b/pithos-macos/PithosObjectNode.h @@ -42,8 +42,6 @@ @interface PithosObjectNode : PithosNode { ASIPithosContainer *pithosContainer; ASIPithosObject *pithosObject; - - NSImage *icon; } - (id)initWithPithosContainer:(ASIPithosContainer *)aPithosContainer pithosObject:(ASIPithosObject *)aPithosObject; diff --git a/pithos-macos/PithosObjectNode.m b/pithos-macos/PithosObjectNode.m index 490881e..8cd4774 100644 --- a/pithos-macos/PithosObjectNode.m +++ b/pithos-macos/PithosObjectNode.m @@ -53,7 +53,6 @@ } - (void)dealloc { - [icon release]; [pithosObject release]; [pithosContainer release]; [super dealloc]; @@ -83,9 +82,8 @@ } - (NSImage *)icon { - if (icon == nil) { + if (icon == nil) icon = [[[NSWorkspace sharedWorkspace] iconForFileType:[pithosObject.name pathExtension]] retain]; - } return icon; } diff --git a/pithos-macos/PithosSubdirNode.m b/pithos-macos/PithosSubdirNode.m index 78be1f2..058c996 100644 --- a/pithos-macos/PithosSubdirNode.m +++ b/pithos-macos/PithosSubdirNode.m @@ -38,14 +38,13 @@ #import "PithosSubdirNode.h" #import "ASIPithosRequest.h" -static NSImage *icon = nil; +static NSImage *classIcon = nil; @implementation PithosSubdirNode + (void)initialize { if (self == [PithosSubdirNode class]) - // XXX this should point to something we know has the proper icon, maybe something in then app bundle - icon = [[[NSWorkspace sharedWorkspace] iconForFile:@"/private/"] retain]; + classIcon = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)] retain]; } #pragma mark - @@ -80,7 +79,9 @@ static NSImage *icon = nil; } - (NSImage *)icon { - return icon; + if (icon) + return icon; + return classIcon; } @end diff --git a/pithos-macos/pithos_macosAppDelegate.m b/pithos-macos/pithos_macosAppDelegate.m index e734bc4..42d731e 100644 --- a/pithos-macos/pithos_macosAppDelegate.m +++ b/pithos-macos/pithos_macosAppDelegate.m @@ -66,9 +66,11 @@ NSRange userEndRange = [query rangeOfString:@"&" options:NSCaseInsensitiveSearch range:NSMakeRange(authUserStartLocation, [query length] - authUserStartLocation)]; if (userEndRange.length) { - authUser = [query substringWithRange:NSMakeRange(authUserStartLocation, userEndRange.location - authUserStartLocation)]; + authUser = [[query substringWithRange:NSMakeRange(authUserStartLocation, userEndRange.location - authUserStartLocation)] + stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } else { - authUser = [query substringFromIndex:authUserStartLocation]; + authUser = [[query substringFromIndex:authUserStartLocation] + stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } // token= NSString *authToken; @@ -80,9 +82,11 @@ NSRange tokenEndRange = [query rangeOfString:@"&" options:NSCaseInsensitiveSearch range:NSMakeRange(authTokenStartLocation, [query length] - authTokenStartLocation)]; if (tokenEndRange.length) { - authToken = [query substringWithRange:NSMakeRange(authTokenStartLocation, tokenEndRange.location - authTokenStartLocation)]; + authToken = [[query substringWithRange:NSMakeRange(authTokenStartLocation, tokenEndRange.location - authTokenStartLocation)] + stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } else { - authToken = [query substringFromIndex:authTokenStartLocation]; + authToken = [[query substringFromIndex:authTokenStartLocation] + stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } NSLog(@"query authUser: '%@', authToken: '%@'", authUser, authToken); [pithosBrowserController authenticateFromURLWithAuthUser:authUser authToken:authToken]; -- 1.7.10.4