Notes from "Async and representation"

Sebastian Kügler sebas at kde.org
Thu Jan 16 11:59:28 UTC 2014


On Wednesday, January 15, 2014 20:36:24 Mark Gaiser wrote:
> On Wed, Jan 15, 2014 at 6:19 PM, Marco Martin <notmart at gmail.com> wrote:
> > On Wednesday 15 January 2014 16:43:43 Mark Gaiser wrote:
> >> As for the Applet name. Why that name? I'm making a plasmoid, right?
> >> So name it as such:
> >> Plasmoid {
> >>
> >>   ...
> >>
> >> }
> >> 
> >> That is also easier to explain to a user:
> >> "To create a plasmoid you have to create a root QML item named
> >> Plasmoid { ... } which must contain the following properties ... bla
> >> bla, you get the point."
> > 
> > i would call it Plasmoid if i can merge it with the plasmoid object, that
> > is now an object registered in the root context. i'm not sure it's
> > possible, would like to tough.
> 
> From my "relative outsider view" Plasmoid {} seems far more obvious
> then Applet {} so if the plasma folks agree on that then i would go
> for that.

Applet is the API name for this, so it should be called Applet, cf. 
Plasma::Applet, which is what this really implements. Plasmoid is more like 
the package format we ship these things in.

> As for the current Plasmoid in the root context.. That can go and be
> merged in this Plasmoid {}. You always need to have that object anyway
> thus the result will be the same. Only now it will be created
> "because" you defined it and not just injected in the root context :)
> 
> Sounds like a win/win to me.
> 
> The only downside is required refactoring :p
> 
> >> Then yet another note.
> >> You say users must provide a:
> >> minimumWidth: ...
> >> minimumHeight: ...
> >> 
> >> which is being defined in the root item (whatever it ends up being).
> >> But why there? I mean, the compactRepresentation and
> >> fullRepresentation are likely to have their own different minimal
> >> width/height. It "could" be the same, yes. But it could also be wildly

The idea is that compactrepresentation does not have a minimum size, it's the 
fallback when things don't fit. Applets don't control their own size, they 
have to deal with the space they get.

> > good point, compactRepresentation and fullRepresentation should export
> > those as attached properties, and the root object should not.
> 
> Just so that it's clear. So you just basically decided that the bare
> minimum for a plasmoid (in plasma 2) is likely going to look like
> this:
> 
> Plasmoid {
>      compactRepresentation: Component {
>          minimumWidth: ...
>          minimumHeight: ...
>      }
>      fullRepresentation: Component {
>          minimumWidth: ...
>          minimumHeight: ...
>      }
> }
> 
> right?

Nope, even simpler:

Applet {

	mininumWidth: ...
	minimumHeight: ...
	
	compactRepresentation: Component { }
	fullRepresenation: Component { }

	/* shared logic goes here, for example: */

	DataSource {
		...
	}

	function fooMyBar(argument) {
		...
	}
}

The point of having minimum* in the Applet object is easy: it's the Item's 
size (as allowed by the containment) fits within minumum*, fullRepresentation 
is loaded and rendered (and parented to the surrounding Item, if not, 
compactRepresentation is used. Only one of them is loaded, reducing overhead 
in many cases.

> Now i'm starting to like it since - to me - it now makes sense.
> For those two representations. I would say that one must exist.
> Neither is mandatory on it's own, but one must be there at all time.

-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Plasma-devel mailing list