← Back to team overview

ubuntu-phone team mailing list archive

Re: QML ContentStore example?

 

On Fri, Oct 23, 2015 at 1:06 PM, Michael Zanetti <michael.zanetti@xxxxxxxxxxxxx> wrote:
 If that's not the problem, let me know.  I have an example using the
 ContentStore somewhere around here....

I'd be interested in that. Can you share please?

I've had a git repository sitting around with some content hub examples for a while. I keep meaning to finish them off, document them, and share them, but I never got around to it. So I'm going to skip the first two steps and go straight to sharing.

An important detail that the official docs elide over is that there are two types of transfers. I've dubbed them "push" transfers, initiated by the app sending the content, and "pull" transfers, initiated by the receiving app. To try to produce minimal examples, I've written separate examples for each case. At the moment, I only have apps that import content. The pull-import branch [1] requests content from either the default picture source or from a picture source of your choosing. The push-import branch [2] can receive pictures exported from any source.

An important limitation of the ContentStore system is that it only works for pull transfers [3]. Therefore this system is only used in the pull-import branch. I added it in this commit [4]. As you'll see, it's pretty easy to use. You just need to create a ContentStore object and pass it as an argument to the peer.request() calls.

On Fri, Oct 23, 2015 at 1:40 PM, Jani Monoses <jani.monoses@xxxxxxxxx> wrote:
I had even looked at beru sources on github but saw you do not actually use the ContentStore but build upon item.move().

I do this because of the failure of the ContentStore system to work with push transfers. I have to use item.move() in this case. And once I've written that code, it works just fine for the pull transfer case, so I see no reason to switch that to using the ContentStore.

And that's my general recommendation. If you have any plans to support push imports, don't bother with ContentStore.

Robert

[1] https://github.com/rschroll/chtest/tree/pull-import
[2] https://github.com/rschroll/chtest/tree/push-import
[3] https://bugs.launchpad.net/ubuntu/+source/content-hub/+bug/1430075
[4] https://github.com/rschroll/chtest/commit/d8796be6f25ed0e4d904b0fed38c1dcc487f5265



Follow ups

References