Re: NSDocument and Large File Import?
Re: NSDocument and Large File Import?
- Subject: Re: NSDocument and Large File Import?
- From: Quincey Morris <email@hidden>
- Date: Thu, 20 Jun 2013 15:50:08 -0700
On Jun 20, 2013, at 15:12 , Mike Abdullah <email@hidden> wrote:
> There should be no need to do this. If you need a location on disk for the document, just trigger an autosave so that the system effectively creates a temp location for you to use (-[NSDocument autosavedContentsFileURL])
In principle I agree this is a neat approach, but in practice I think it doesn't help that much.
If you take this approach, you have to do the following steps before you can actually import your data:
1. Ask the user for the source of the data (assuming a file or URL is being used as the source of the data).
2. Create a NSDocument instance.
3. Go through the document startup sequence, including creation of the window controller.
4. Put special handling in the window controller to deal with the special case of having no imported asset file yet.
5. Start importing the data.
6. Display progress/cancel UI while import proceeds, and (likely) prevent the user from interacting with the document window until it ends.
If you import to a temp file *first* you get rid of a lot of complexity of timing at the UI level, at the cost of having the document save know how to deal with an asset file that's a temp file. As I suggested earlier, you may have essentially that code in the save anyway.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden