New Stuff again

Hi there,
now that the KDE Software Compilation 4.4 is branched, it’s time to think about the next iteration. Next to bug fixing that is.

I’ll keep fixing things I broke with the hot new stuff framework re-write that makes it’s first public appearance in 4.4.
Since this was the first release including KNewStuff3, not that many apps have been ported yet – I just didn’t want breakage all over the place, but only in a few chosen locations to be able to fix bugs ;)
If you’re curious about the new stuff (no pun intended whatsoever), check these: Plasma Image Wallpaper, Comic Plasma Applet, Kate’s Snippets NG (deep inside Kate’s config, you need to enable the new snippets plugin) and Parley. Parley features an upload dialog in addition to the download version. Here’s fun to play with and dreams coming true :D (we spoke about this on the first KDE meeting I was at – back in 2007 in Paris).

Jos poked me on the promo list, that maybe more information should be out there. I cannot agree more… so I’ll try to make up for that. Here is a quick update mostly for application developers wanting to use KNS3 or port apps already using the older version.

ghns_list

So why did we decide to redo something that was working? In such an intrusive manner even, that it now resides in it’s own namespace (KNS3 as opposed to just KNS)?

Well, I read over the old code and talked to Jeremy a lot (thanks dude!). In the end Jeremy created a branch to restart the hot new stuff framework with some binary incompatible changes that made a lot of sense. I started hacking away on the branch and since it was incompatible anyway, I could freely play with it. Later Dmitry also joined to help with lots of polishing and fixes :)
First up was the creation of a new “provider” type – that is a data source that hot new stuff uses – a server representation. Getting that to work was easier than expected since I could just hack away and change stuff as I saw fit.
Also there are surprisingly many crashes in the old framework. I didn’t know about that, but now I get cc’ed on the bug reports automagically… (ouch). Many thanks go to Dario who manages this incredible mass of bugs (how do you do that??).
One problem I think is that the engine class (that users of the old API had to use) set up an event loop that would take care of managing the dialog itself. Confusing? For sure. I’m not sure if it managed to set up yet another event loop in the dialog itself, but I suspect this is the cause for some of the little buggers. Anyway, the new version is just a subclass of KDialog, easy to use, little public API. And it reuses K/QDialog’s proven and tested event loop – less code, more robust. On the way it gained a few features – such as a details dialog, here you can vote for a stuff-item-thingy or become a fan of it. Which will be reflected in the openDesktop plasma applet where your friends can see that you now like the stuff-item-thingy you just became a fan of ;)

ghns_details

I wrote a little tutorial on techbase to get you started.
Porting apps that already use KNewStuff2 is dead easy:
Change the include to <KNS3/DownloadDialog>, use the download dialog like any dialog (show/exec) and check for installed or changed items when it is done.

This is described in more detail in the KNewStuff3 tutorial on techbase.

In addition you need to update your .knsrc file:
[KNewStuff3]
ProvidersUrl=http://download.kde.org/ocs/providers.xml
Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200
TargetDir=wallpapers

That’s it! (don’t forget to link to knewstuff3… and happiness ensues…)

If you need help on porting an application, let me know. You can ping me on #kde-devel on freenode.

There are some fun interesting todos (yeah, right) for KNewStuff3. Let me know if you want to dapple with the insides of KNewStuff3 :)
The upload dialog is still very basic. It needs love. Lots of it. Another feature that will be easy to implement but probably takes some thought and re-factoring to reuse things from the download dialog in the best way possible, is a class to automatically check for updates. The idea is that apps can let it contact the server on and notify the user that a new version of there favorite stuff is available.

On a totally unrelated note: I’m going to visit a KDE SC 4.4 release party! So should you! And if there’s none close by, how about just organizing one? It’s not much work but fun ;)

6 comments to New Stuff again

  • Stefan

    I installed KDE 4.4 RC1 from Kubuntu repositories. I like it. But it’s crashing on my system… Great work!!!

    • Frederik

      Hi Stefan,
      could you please file a bug report on bugs.kde.org then? Without a backtrace I cannot do much to improve the situation ;)

  • JR

    Looking great! I particularly like the enlarged preview (awkward zombie pic).

    Has scrolling been reworked? Mouse scrolling in the current KNewStuff is a pain, scrolling past more than one screen per tick. :<

  • slashdevdsp

    Instead of the pop-up window to show the preview, could you show the bigger preview within the KNS window upon clicking details. I think it would be much better.

    i.e., clicking details on a particular selection instead of the popup just load the popup contents below the clicked selection, as I don’t see the need for another window. Could be in for the 4.5sc :)

    thanks for the new KNS, although a progress bar upon startup (fetching default data from webservice) is painfully missing

  • You should include a feature to allow donating to the creator of whatever the user wants to download as “new stuff”. That way you would be going in the direction of a “KDE App Store” which could lead to an entire KDE “Hot New Stuff” ecosystem.