Re: NSDocument and Large File Import?
Re: NSDocument and Large File Import?
- Subject: Re: NSDocument and Large File Import?
- From: Mike Abdullah <email@hidden>
- Date: Fri, 21 Jun 2013 10:05:17 +0100
On 20 Jun 2013, at 23:50, Quincey Morris <email@hidden> wrote:
> 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.
There's no requirement to create the document's window controller at this stage. You're perfectly entitled to create a document without any UI and hang onto it privately until ready to present to the user.
>
> 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