Tag Archives: linux

TokaTalks

BlaBla

Yesterday talks were wicked interesting, especially the Alexis talk about the new animation framework was really breathtaking.
Aaanyways, this is kinda a synopsis of what i talked about in my part during
the talk session yesterday at Tokamak, slides
here,
it’s quickly written in few minutes, so the english it’s a total horror,
but i feel it could be kinda interesting anyways 🙂

Themes

Pretty much everything you see in Plasma is based on SVG graphics,
this means that you have a really high degree of customizability
controlled by the Plasma theme. This also means that compared to
classical Qt themes the entry barrier is significantly lower, because
of course you have to be a good designer to make one, but not a
programmer, while to do a Qt theme you have to be both and this is a
really really rare thing.

Also, since themes are pure graphics without binary code they are
completely platform independent so they can be distributed trough the
GHNS framework.

Being vector graphics, we can display them without problem from
very little screen to huge monsters when we will have 600dpi screens
that won’t be a problem, specially for the theme elements based on
the FrameSvg concept.

From a programmer point of view using the theme graphics is quite
easy too, because the two main classes that manages Svg themes (Svg
and FrameSvg) are very abstracted, so you won’t have to bother that
the graphics is actually a Svg.

Plasma themes will be installed under your KDE installation prefix
under share/apps/desktopthemes. The filesystem structure inside the
theme has got two main subfolders: widgets, meant for element
drawn on canvas and dialogs, meant for elements that are
actually a top level window. There are two particular and optional
subfolders: the first is locolor, that will have the same two
widgets and dialogs subfolders meant to be used when the theme is
displayed on screens with less than 16 bit color depth.

The other folder is called opaque and has replacements for
the elements that are a top level widget when the desktop effects are
turned off, that’s because in this case we won’t be able to have a
semitransparent window, so we won’t be able to have luxuries like
antialiased borders or drop shadows, if you have a rounded border
there you should use the good old pixelart tecnique from the 80’s.

In order to load an Svg from the current theme is sufficient to
use the setImagePath() function of Plasma::Svg, where you don’t have
to worry neither of the path of the theme or the svg or svgz
extension, so something like “widgets/background” will suffice.

If you are writing a scripted applet you can also include the
graphics alongside the applet code and distribute everything in a
single package, from a javascript applet for instance it will be
sufficient to call the function plasmoid.findSvg(“foo”) and the
proper foo.svg file will be located for you.

That said however now i have to get a bit annoying with some
advices: you should be really really careful when you add custom
graphics in your applet, both when you install it alongside your c++
applet and also when you embed it in the package of your scripted
applet, because your additional graphics must work with as much
themes as possible, and this is an hell lot difficult. You should at
least try it with both a dark and a light theme, but in the end… if
you want to do that, think again 🙂

Boring implementation details

Usually in your applet won’t have to directly paint Svgs, because
if you just use the default plasma widgets you’ll have the svg
painting done for you, but if you have to draw some svg elements you
have to know two classes: Plasma::Svg and Plasma::FrameSvg.

The mighty machine that manages all the svg painting in Plasma is
the Plasma::svg class, that internally uses the QSvgRenderer class,
but optimizes it as much as possible: in the context of the whole
Plasma application for each svg file we get an unique shared svg
renderer and the rendering result is saved to disk thanks to a
KPixmapCache, that can avoid the creation of renderer to a satisfatry
degree: in the second plasma start won’t be created a single renderer
until you resize something, saving a bit of startup time and some
megs of ram.

The most important functions you are interested if you want to use
a Svg are its several paint functions (overloaded with QPoints or
QRects as parameters) the already mentioned setImagePath() resize()
and various functions to access the svg sub elements like
hasElement(), elementSize() and elementRect().

The other class used in plasma to render Svgs works at a slightly
higher level of abstraction and is Plasma::FrameSvg. Usually widgets
are mostly rectangular things, but even if Svg is scalable that
doesn’t mean the result will look pretty, take a look at the slides
example for instance, where a
default applet background is heavily vertically stretched, so the
horizontal borders become thicker that the vertical ones, and to make
things worse they usually aren’t even an integer number of pixels
making the result to look really blurred.

So, what is there in the default applet background? We can see
there are actually 9 pieces: the corners, the edges and the central
part (called with a great stretch of fantasy center, top, topleft,
topright, left,right,bottom, bottomright and bottomleft). When the
thing will get painted not all elements will be scaled, it’s
important that the corners won’t be never ever scaled, while the
horizontal edges will be scaled only horizontally and similarly the
vertical edges will be scaled only vertically, while the center
element will scale freely.

From a boring code standpoint FrameSvg inherit the Svg class, so
all the stuff that is available in Svg is available in FrameSvg too,
but with the difference that you want to resize the image with
resizeFrame() that uses the method i talked before and you’ll paint
the correctly resize Svg with paintFrame(), while paint() is still
useful to paint single elements in the Svg. Also a single Svg can
contain multiple series of 9 elements, with the names differentiated
by a proper prefix, that can be chosen with the setElementPrefix()
function.

Universe and everything

Software

KDE 4.2 has just been released, after many months of hard work by many people.

In this release the huge potentiality of the 4.0 platform is finally going to show up in the end user visible apps, so it’s where the good plans are starting to come together.

/me did just a tiny part, but nevertheless i like considering myself part of that wonderful community, they are wonderful people, congratulations to each one 😀

KDE 4.2

C’est magnifique

Software

This is a tiny plasmoid hacked on a boring sunday afternoon in about 20 mins, perhaps a too silly name but i think the effect is kinda fun 🙂

It’s an on-screen magnifying glass with the difference from the usual ones that it doesn’t actually grab the screen, but it just views the Plasma canvas (just another view on the scene, that is), that gives some peculiarities, shown in this video:


OGG version

All the windows are totally transparent to it, so while is useful to view/magnify just what there is on desktop it can give a quick access on it, when you need both your windows and stuff on desktop (think about a non-fullscreen dashboard, and then think about drag and drop between dolphin and folderview even when you have a maximized window :P)

And the more cute thing is due to the vector nature of the QGraphicsView, you see all the proper vector-based elements like the text to be smoothly scaled and still looking like text, not that usual pixelated/blurry mess that kinda hinders the utility of screen magnifiers as accessibility applications.

It’s amazing what it’s possible to do in plasma with a really limited amount of lines of code (here about 100, perhaps 20 or so could even still be saved:)

The thing now lives in playground and is still really rough, so not definitely 4.2 material, but who feels like can give it a try anyways:)

Rotating your adult content

BlaBla

After seeing total coolness like this and this, i of course decided that Plasma couldn’t lag behind that total ratio of awesomeness.

This is an idea from right the begin of Plasma (we always had the MediaCenter formfactor impatiently waiting to be actually used after all:)

At the begin a thing like what I did today was not possible for two reasons: throwing qwidgets on canvas is possible only from Qt 4.4 and before Phonon was not able to render over widgets. In fact the first version of the Amarok video applet had to embed a window in the applet with the video in, so no correct z ordering, no transforms etc.. but now the good plan come together and is possible to render video even on the walls of a wolfenstein 3d maze (hats off to Matthias Kretz) 😀

The cutie in this video is a plasma applet that embeds a video, it uses the X-Plasma-DropMimeTypes directive in its desktop file, so it’s sufficient to drop a video file on the desktop and the applet is automagically created.

OGG version

This applet that lives in playground is highly experimental: no config options, no audio, no seeking, just bare working.
But it’s just the beginning, for 4.3 there will be a generic widget usable with few lines of code (even scripted of course) and a basic applet. Yeah i know, 4.2 is still far and the 4.3 teasing is started already, we are soo evil :p

A FormFactorized Plasma Quake

Software

Plasma always had this really cute concept of “formfactor”: in brief different areas where plasmoids can reside have different behaviours, for instance a desktop is planar, i.e. the applets can grow anywhere they want.

The panel on the other hand can have a vertical or horizontal form factor, it means the applets in it can grow only in the vertical or horizontal direction, so an applet with a high quantity of content can’t display everything it would want…

In past releases of KDE4 the right behaviour of applets was still not really finished, so some applets like the device notifier were more kind to the panel, displaying the whole device list on the desktop and an icon+popup on the panel, other applets like the twitter applet hmm not soo good 🙂

Now with KDE 4.2 every standard applet distributed with kdewill fully use the form factor concept, so far we have 3 different classes of applets:

Applets that are just the same or with very little differences in different form factors, like simple icons or the taskbar.

Applets that diminishes their information quantity in horizontal or vertical form factors, here are two examples:
when in the panel the now playing applet just displays the control buttons, and the leave note applet switches to an horizontal layout, so it makes enough room for an horizontal panel.

Form factors

Some other applets, like the device notifier or kickoff wouldn’t mean that much without some of its contents, so in the panel will be an icon+popup and in the desktop the whole plasmoid will be shown. but what about very big panels, so big that the whole plasmoid could fit and a ginormous icon wouldn’t make so much sense?

OGG version

When the applet knows that it would fit into the panel, the icon goes away and the whole applet content is displayed, and goes back to an icon when the panel is shrinked again.

Now, since Plasma in KDE 4.2 supports also panels not always on top and autohide panels, you could have for instance a thing that looks like a Quake console with plasmoids in it, just like Konsole for terminals 🙂

Painless Drop

Software

Just a little thing, but it looked to me it kinda deserved a really short screencast 🙂
Adding applets to the panel with drag and drop in plasma was a bit of a pita, because you had to hit exactly that 4 pixels between an item and the other, so painful that wasn’t really obvious it was possible at all…
so here is how the current trunk behaves 🙂


Ogg version

In other news some days ago something like 7 applets (did i forgot some others?:) were merged for 4.2 release counting what is in the workspace module and in the addons module, so there will be a ton more stuff to play with :).

That’s the reason for the kabooms we are fixing right now, but no fear 🙂

Tabbed plasming

Software

Quick video: this is a proof of concept plasmoid i wrote quite some time ago and then forgotten to talk about 🙂
Is a little tabbar meant to be put in a panel that lists all your desktop activities and lets you switch them in a quick way, as seen in the video it also keeps itself syncronized if something changes, so if you switch with the zoom user interface it switches accordingly, it creates and remove tabs when desktops are created or removed.

The name of the tab is the name of the activity you can set in the desktop wallpaper/theme/etc configuration dialog.
The name it’s just the beginning of the activity concept, in the future the desktops and the applets in it will be aware and will react to their context, like what time is it, is the network attached or not, heck even what is our geographic coordinate…
But that’s another and more exciting story that just a teeeny tab bar :p


Ogg theora version

Handle things with style

BlaBla

Did some work on the code of that little tiny things that lets you move and configure the Plasma applets, the poor ol’applet handles that really needed some visual love(tm) and some speedups, so the result is the following:

KDE 4.2 applet handles

It’s started from a Nuno mockup he did quite some time ago, and while the graphics will probably be a lot more refined than they are now (i.e. become closer to the mockup), i think code wise we are definitely here 🙂

First of all the old icons were so-so, partly because we didn’t have the exactly right metaphore partly because they eren’t designed for that kind of background, so now they are Plasma-theme specific, the default is a set of very simple monocrome shapes but more recognizable. In the future these little thingies will be used all across Plasma, so more power to theme creators, yay 🙂

Now the handle also uses a svg background from the plasma theme, it behaves differently (so always in the right way i hope:) for different types and sizes of applets and has a new cute sliding animation that makes the thing to feel more “attached” to the applet itself.

And now in youtube-o-vision:

But you prefer Ogg-o-vision, don’tyou? 🙂

Lovin’ the dialogs

Software

Long time no blog as usual, so let’s do some Plasma Quickies:
I’ve decided to do some love to two configuration dialogs, the wallpaper one and my loved ultrascary panel configuration “Thing”.
A while ago the configuration dialog had some problems.

The monitor preview looked ugly and deformed on widescreens, but most annoying thing it wasn’t possible to chose the desired cropping or scaling method when in slideshow mode, so you had to chose between a single image or a series of horribly distorted images 🙂

now the thing looks like this:

wallpaper

Desktop activity and theme before the wallpaper section, because wallpaper configuration will be just one aspect, even secondary behind the concept of activity (oh and now there is a textbox t give them a name), explayned way better by aaron.
the monitor preview looks always good, not important what weird ratio your actual monitor has 🙂
All the controls are better aligned conforming the HIG and making less visual noise.
The folder list in the slideshow mode grows and shrinks when adding/removing folders, so there is no more a big white empty spot when it’s empty 🙂

Now, my favourite configuration little monster, the panel configuration:

Panel controller

The size handles have little arrows that should be a bit more intuitive what is the min and what is the max and
now the move and resize actions are buttons with a label, so should be more obvious how to do to move it and change the height, while the less frequent actions (or dangerous as in the case of remove panel) are moved in a submenu, so it gives a less crowded look.
And oh, now there is a config ui for the quite recent panel autohide too 🙂 you can chose between normal panel always visible as is now, autohide or a panel not always on top, that can go under other windows.
It still looks a bit ugly but will be given a way more plasmalove(tm) look in the next days, stay tuned 🙂

Misc plasmoids on n810

Software

The KDE install in my n810 is still not fully functional, but at least i’ve checked the plasmoids i was more curious and that i think are more interesting on a device like that, so here it is a little pr0n gallery of random stuff plamoids and not:

KDE4 splash screen yeeah, this photo is horrendously blurred, btw looks really nice (and good that looks nice because you will see it for a loong time :P)


boot

Browser applet, i like the idea that on devices like this the browser would be something like an applet


browser applet - kde.org


browser applet - notmart.org

Twitter applet, successfully retrieves and posts items, only two gliches: the proxywidget input bug i talked yesterday and seems to fetch only the user avatar, not the other ones


twitter

Weather applet: weell, not really much to see, aanyways works as expected, seems that