mixxxdj/mixxx — pull request #169 by rryan (2014-01-27 21:36:02+00:00)
Title: Support Mac OS X Sandboxing

This branch implements Apple's sandboxing and security scoped bookmarks. This fixes Bug #1257340 and should complete the Mac App Store blueprint.

I have a few more things to do but the code is in a pretty stable state so I'd appreciate some extra eyes or testers.

Summary:
* Maintain a security bookmark while a TrackInfoObject or SoundSourceProxy is active for it.
* Register security bookmarks every time we open a QFileDialog.
* Provide wrapper classes for QFile and QDir that open bookmarks.
* Provide an "ask for access" flow for letting users grant access when upgrading from a pre-sandbox library.
* Fix browse mode to only add quick links we have access to.
* Cache and reference-count active security bookmarks and only close it when the last reference expires.
* Store bookmarks base64-encoded in a new config file "sandbox.cfg" in the settings path.

Cases currently handled:
* Adding or relocating a library directory.
* Loading a file to a deck.
* Recording.
* Changing the recording path.
* Library scanner (only one bookmark open per library directory -- very efficient)
* Browse feature (if you pick a volume that we don't have access to it starts the "ask for access" flow)
* iTunes feature
* Traktor feature (we have to ask for access to the Traktor folder on the first use).

Migration:
* On bootup, we check for permissions to every library directory. If we can't access one we prompt for access.
* If the iTunes saved library path is not accessible, we ask for access.
* As a last-chance, if a track is about to be loaded to a deck that we don't have access to we pop up the "ask for access" flow.

Still TODO:
* Make sure we create bookmarks when a file is dropped into Mixxx from outside.
* Vamp and SoundSource plugin paths
* DlgTrackInfo
* AudioTagger
* Browse mode selection of volumes is still a little wonky.
* Text in the ask-for-access flow needs tightening.

[1] https://developer.apple.com/library/mac/documentation/security/conceptual/AppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html#//apple_ref/doc/uid/TP40011183-CH1-SW1
[2] https://bugs.launchpad.net/mixxx/+bug/1257340
[3] https://blueprints.launchpad.net/mixxx/+spec/macappstore