From: Michael J. Rubinsky Date: Sat, 9 May 2009 17:55:34 +0000 (-0400) Subject: Set the status text and start the spinner when getting the ansel X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e7f21ba4d2952cbb9c7ee434ce8acd84bfd10ed7;p=horde.git Set the status text and start the spinner when getting the ansel gallery's default photo, and when listing the ansel gallery's thumbnails for viewing in the photo viewer. Also, rough out some stubs for building a proper gallery tree so we can display the galleries in a hierarchical manner in the combo box. Not working yet. --- diff --git a/iPhoto2Ansel/AnselExportController.h b/iPhoto2Ansel/AnselExportController.h index 9b3321efe..0a098c6c0 100644 --- a/iPhoto2Ansel/AnselExportController.h +++ b/iPhoto2Ansel/AnselExportController.h @@ -43,6 +43,7 @@ extern NSString * const TURAnselServerPasswordKey; IBOutlet NSButton *mNewGalleryButton; IBOutlet NSPopUpButton *mServersPopUp; IBOutlet NSButton *mCancelConnect; + IBOutlet NSTextField *mImageCountLabel; // Gallery View IBOutlet NSButton *viewGallery; diff --git a/iPhoto2Ansel/AnselExportController.m b/iPhoto2Ansel/AnselExportController.m index b1a56f08d..a77dbb7e2 100644 --- a/iPhoto2Ansel/AnselExportController.m +++ b/iPhoto2Ansel/AnselExportController.m @@ -104,8 +104,20 @@ NSString * const TURAnselServerPasswordKey = @"password"; #pragma mark Actions - (IBAction)clickViewGallery: (id)sender { + [spinner startAnimation: self]; + [self setStatusText: @"Getting image list..."]; [browserData removeAllObjects]; NSMutableArray *images = [currentGallery listImages]; + if ([images count] == 0) { + [browserView reloadData]; + //TODO: Show a panel showing there are no images? Or just disable the + // view gallery button? + + [spinner stopAnimation: self]; + [self setStatusText: @"Connected" withColor: [NSColor greenColor]]; + return; + } + for (NSDictionary *image in images) { NSString *caption = [image objectForKey:@"caption"]; if (caption == nil) { @@ -125,7 +137,11 @@ NSString * const TURAnselServerPasswordKey = @"password"; didEndSelector: nil contextInfo: nil]; + [spinner stopAnimation: self]; + [self setStatusText: @"Connected" withColor: [NSColor greenColor]]; + [browserView reloadData]; + } - (IBAction) closeGalleryView: (id)sender @@ -686,6 +702,8 @@ NSString * const TURAnselServerPasswordKey = @"password"; #pragma mark comboBoxDelegate - (void)comboBoxSelectionDidChange:(NSNotification *)notification { + [spinner startAnimation: self]; + [self setStatusText: @"Loading gallery data..."]; int row = [galleryCombo indexOfSelectedItem]; [currentGallery setDelegate:nil]; [currentGallery autorelease]; @@ -697,8 +715,11 @@ NSString * const TURAnselServerPasswordKey = @"password"; [defaultImageView setImage: theImage]; [theImage release]; [self canExport]; - [viewGallery setEnabled: YES]; + [spinner stopAnimation: self]; + // TODO: Check this. Assume we can set back to connected since we obviously + // are connected if we're getting gallery info. + [self setStatusText: @"Connected" withColor: [NSColor greenColor]]; } #pragma mark TURAnselGalleryPanel Notifications diff --git a/iPhoto2Ansel/English.lproj/Panel.nib/designable.nib b/iPhoto2Ansel/English.lproj/Panel.nib/designable.nib index 10fc594cc..2942f7325 100644 --- a/iPhoto2Ansel/English.lproj/Panel.nib/designable.nib +++ b/iPhoto2Ansel/English.lproj/Panel.nib/designable.nib @@ -8,8 +8,8 @@ 353.00 YES - + YES @@ -1009,7 +1009,7 @@ 268 - {{135, 144}, {92, 32}} + {{135, 165}, {92, 32}} YES @@ -1034,7 +1034,7 @@ 268 - {{18, 122}, {211, 26}} + {{18, 143}, {211, 26}} YES @@ -1108,7 +1108,7 @@ 268 - {{15, 152}, {103, 16}} + {{15, 173}, {103, 16}} YES @@ -1136,7 +1136,7 @@ NeXT TIFF v4.0 pasteboard type - {{258, 38}, {214, 118}} + {{258, 59}, {214, 118}} YES @@ -1152,7 +1152,7 @@ 268 - {{258, 154}, {158, 16}} + {{258, 175}, {158, 16}} YES @@ -1168,7 +1168,7 @@ 256 - {{15, 100}, {114, 17}} + {{15, 121}, {114, 17}} YES @@ -1184,7 +1184,7 @@ 256 - {{15, 72}, {130, 26}} + {{15, 93}, {130, 26}} YES @@ -1273,7 +1273,7 @@ 268 - {{256, 10}, {96, 28}} + {{256, 7}, {96, 28}} YES @@ -1293,7 +1293,7 @@ 12 - {{237, 9}, {5, 161}} + {{237, 30}, {5, 161}} {0, 0} @@ -1312,12 +1312,28 @@ 0 NO + + + 268 + {{258, 42}, {207, 17}} + + YES + + 68288064 + 272630784 + Image Count: + + + + + + - {{1, 1}, {480, 176}} + {{1, 1}, {480, 197}} - {{14, 57}, {482, 192}} + {{14, 36}, {482, 213}} {0, 0} @@ -1638,6 +1654,14 @@ 576 + + + mImageCountLabel + + + + 583 + @@ -2038,8 +2062,8 @@ YES - + @@ -2057,6 +2081,7 @@ + @@ -2360,6 +2385,20 @@ + + 581 + + + YES + + + + + + 582 + + + @@ -2476,6 +2515,8 @@ 546.IBPluginDependency 547.IBPluginDependency 574.IBPluginDependency + 581.IBPluginDependency + 582.IBPluginDependency 6.IBPluginDependency 6.ImportedFromIB2 7.CustomClassName @@ -2597,6 +2638,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.imagekit.ibplugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin AnselExportPluginBox com.apple.InterfaceBuilder.CocoaPlugin @@ -2625,7 +2668,7 @@ - 580 + 583 @@ -2671,6 +2714,7 @@ galleryCombo mCancelConnect mExportMgr + mImageCountLabel mMakeNewServerDefault mNewGalleryButton mServerSheetHostURL @@ -2697,6 +2741,7 @@ NSComboBox NSButton id + NSTextField NSButton NSButton NSTextField diff --git a/iPhoto2Ansel/English.lproj/Panel.nib/keyedobjects.nib b/iPhoto2Ansel/English.lproj/Panel.nib/keyedobjects.nib index b3a9b2472..7e0308bd5 100644 Binary files a/iPhoto2Ansel/English.lproj/Panel.nib/keyedobjects.nib and b/iPhoto2Ansel/English.lproj/Panel.nib/keyedobjects.nib differ diff --git a/iPhoto2Ansel/TURAnsel.m b/iPhoto2Ansel/TURAnsel.m index 7c0138e79..be94d5590 100644 --- a/iPhoto2Ansel/TURAnsel.m +++ b/iPhoto2Ansel/TURAnsel.m @@ -247,7 +247,7 @@ objectValueForTableColumn:(NSTableColumn *)tc id galleries = [self callRPCMethod:@"images.listGalleries" withParams:params]; - + NSLog(@"%@", galleries); if (state != TURAnselStateError) { state = TURAnselStateConnected; for (NSString *gal in galleries) { diff --git a/iPhoto2Ansel/TURAnselGalleryNode.h b/iPhoto2Ansel/TURAnselGalleryNode.h new file mode 100644 index 000000000..91ae5c091 --- /dev/null +++ b/iPhoto2Ansel/TURAnselGalleryNode.h @@ -0,0 +1,22 @@ +// +// TURAnselGalleryNode.h +// iPhoto2Ansel +// +// Created by Michael Rubinsky on 5/9/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import +@class TURAnselGallery; + +@interface TURAnselGalleryNode : NSObject { + TURAnselGallery *data; // Pointer to the data for this gallery + NSArray *children; // This gallery's children +} + +- (NSArray *)children; +- (TURAnselGallery *)data; + +-(void)addChild: (TURAnselGallery *)anselGallery; +-(void)setData: (TURAnselGallery *)anselGallery; +@end diff --git a/iPhoto2Ansel/TURAnselGalleryNode.m b/iPhoto2Ansel/TURAnselGalleryNode.m new file mode 100644 index 000000000..7d8d49189 --- /dev/null +++ b/iPhoto2Ansel/TURAnselGalleryNode.m @@ -0,0 +1,22 @@ +// +// TURAnselGalleryNode.m +// iPhoto2Ansel +// +// Created by Michael Rubinsky on 5/9/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "TURAnselGalleryNode.h" + + +@implementation TURAnselGalleryNode +- (void)setData: (TURAnselGallery *)anselGallery +{ + +} + +-(void)addChild: (TURAnselGallery *)anselGallery +{ + +} +@end diff --git a/iPhoto2Ansel/iPhoto2Ansel.xcodeproj/project.pbxproj b/iPhoto2Ansel/iPhoto2Ansel.xcodeproj/project.pbxproj index 86ca39bf9..554bdcea7 100644 --- a/iPhoto2Ansel/iPhoto2Ansel.xcodeproj/project.pbxproj +++ b/iPhoto2Ansel/iPhoto2Ansel.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; B00EF55A0EF5DD5900A9D71C /* AnselServers.nib in Resources */ = {isa = PBXBuildFile; fileRef = B00EF5580EF5DD5900A9D71C /* AnselServers.nib */; }; B00EF5670EF5E22900A9D71C /* TURAnselServersPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = B00EF5660EF5E22900A9D71C /* TURAnselServersPanelController.m */; }; + B03B92BC0FB5F43600F628AF /* TURAnselGalleryNode.m in Sources */ = {isa = PBXBuildFile; fileRef = B03B92BB0FB5F43600F628AF /* TURAnselGalleryNode.m */; }; B04FC1A90EEB4A2B008EEB0E /* AnselGalleryPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = B04FC1A70EEB4A2B008EEB0E /* AnselGalleryPanel.nib */; }; B05C4A060EE9E001005B4B28 /* ImageResizer.m in Sources */ = {isa = PBXBuildFile; fileRef = B05C4A050EE9E001005B4B28 /* ImageResizer.m */; }; B06C1E030EB1644600BFAFCB /* AnselExportPluginBox.m in Sources */ = {isa = PBXBuildFile; fileRef = B06C1E020EB1644600BFAFCB /* AnselExportPluginBox.m */; }; @@ -82,6 +83,8 @@ B00EF5590EF5DD5900A9D71C /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/AnselServers.nib; sourceTree = ""; }; B00EF5650EF5E22900A9D71C /* TURAnselServersPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselServersPanelController.h; sourceTree = ""; }; B00EF5660EF5E22900A9D71C /* TURAnselServersPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselServersPanelController.m; sourceTree = ""; }; + B03B92BA0FB5F43600F628AF /* TURAnselGalleryNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselGalleryNode.h; sourceTree = ""; }; + B03B92BB0FB5F43600F628AF /* TURAnselGalleryNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselGalleryNode.m; sourceTree = ""; }; B03D3B590ED5BB3800CF5B92 /* XMLRPC-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "XMLRPC-Info.plist"; sourceTree = SOURCE_ROOT; }; B04FC1A80EEB4A2B008EEB0E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/AnselGalleryPanel.nib; sourceTree = ""; }; B05C4A040EE9E001005B4B28 /* ImageResizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageResizer.h; sourceTree = ""; }; @@ -268,6 +271,8 @@ B07D426F0EC230B100B59765 /* TURAnselGallery.m */, B00EF5650EF5E22900A9D71C /* TURAnselServersPanelController.h */, B00EF5660EF5E22900A9D71C /* TURAnselServersPanelController.m */, + B03B92BA0FB5F43600F628AF /* TURAnselGalleryNode.h */, + B03B92BB0FB5F43600F628AF /* TURAnselGalleryNode.m */, ); name = AnselToolkit; sourceTree = ""; @@ -433,6 +438,7 @@ B0CCED420EEC6E810012D3D3 /* TURAnselGalleryPanelController.m in Sources */, B00EF5670EF5E22900A9D71C /* TURAnselServersPanelController.m in Sources */, B0B6669B0FB357B3009459D5 /* AnselGalleryViewItem.m in Sources */, + B03B92BC0FB5F43600F628AF /* TURAnselGalleryNode.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };