Alo Sarv
lead developer

Donate via
MoneyBookers

Latest Builds

version 0.3
tar.gz tar.bz2
Boost 1.33.1 Headers
MLDonkey Downloads Import Module Development
Payment completed
Development in progress.
Developer's Diary
irc.hydranode.com/#hydranode

Thursday, March 09, 2006

RSS reading capabilities

I finally started to implement the "Home" page of the interface today, based on my last reference design. While it hasn't been reviewed and approved by our designer yet, I figured I can at least write up the rss-parsing code and test my skills at Qt painting APIs.

The hardest part was to get the background picture properly displayed on the home page. On all other pages, the backgrounds are drawn on QTreeWidget, which is a single widget, so merely overriding paintEvent() did it. However, on the "Home" page there are multiple widgets (some QHtmlBrowsers, some panels, labels and such), some of which draw their own background, so painting on the lowest-level widget doesn't work, since the child widgets draw on top of the parent.

After numerous attempts and surfing around the net and Qt manual, the solution turned out to be rather simple ("everything is simple, once someone has told you how"):
  1. Set the background color role in child widget's palette to transparent.
  2. Install event filter for child widgets which draw their background.
  3. When the child widget draws it's background, repaint the parent widgets background on top of the child widgets background (remember - the background image is painted at ~30% transparency level).
  4. Let the child widget paint itself now.
This results in child widget's data being drawn clearly, but their background becomes transparent, showing the background image beneath.

Once that was in place, I used QXmlSimpleReader and QXmlDefaultHandler-derived parser to implement a simple rss reader. As it turns out, every rss feed I got my hands on has slightly different format and completely different date/time formatting system - I implemented support for three (this blog, RespectP2P and Slyck), and had to use different code for each of them. Oh well.

Since custom feeds will be possible in the future as well, I already implemented the stuff as generic classes, so we can easily add user-customizability later on.

Madcat, ZzZz



Comments:
That's weird, why custom code per each RSS?
 
Will the RSS reading be something that can be installed seperately or opt-outed during install? I like to keep programs to the minimum of what they need, and my interest for Hydranode is pure downloading. I can already browse RSS feeds with my browser or e-mail client, both of wich are always open anyway.
 
That's weird, why custom code per each RSS?
This affects only post date format parsing, since each RSS feed I'v gotten my hands on uses different formatting. However, I expect the number of different formats to be ~5-10 tops, so this isn't big overhead.

Will the RSS reading be something that can be installed seperately or opt-outed during install?
Currently there are no plans on making it optional. Anyhow, I wouldn't consider 200 lines of code bloat.

Madcat.
 
Fair enough. I have no idea what such a feature costs in terms of code. 200 lines is not a problem.
 
Perhaps I have no experiences in RSS's stuff.
But what is the usefulness of RSS impleemntation inner a p2p application exactly?
Thanks
Fabtar
 
Some nice site of torrents have the habbit of have new torrents show in RSS form...

Nice to open the program and find ur favorite P... ehmm... Game in that nice RSS ready to be donwloaded ;)
 
thanks tagoth for explanation.
Fabtar
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?