My blog has been moved to

Tuesday, November 04, 2008

visual google

Remember the tradition that I started in Redwood City? Well, the parallax sliding demo was for the graphics talk. For my QtWebKit presentation, the challenge was different. Basically it boils down to a visual version of Google Search. Instead only getting the hits and some text snippet, you should also get the web snapshot of the hits. There are apparently browser extensions out there which implement this kind of functionality.

Before going further, let us see first how we can get a preview of any web page. With QtWebKit, it is as easy as creating a QWebPage and using it to render the content to a painter that operates on an image. Check out websnap example, if you think this is not easy enough. Running websnap to several popular web sites gives the following:

Coming back to visual search. So while rehearsing my talk in the night before, I created the search and snap demo. What is presented as the next dojo example is however a slightly better version (afterall, I have more than just one night to polish it), as I added some text snippet to make it more attractive. The result is as follows, the code can be checkout from the usual graphics corner. As you can see, a third of the code is just reusing the WebSnap class.

A screencast is worth a thousand screenshots. Thus, for your pleasure, check the following 1-minute video, too. Or view it on (high quality), YouTube (low quality, more bandwidth-friendly), or download the Ogg Theora file (3.3 MB).

So who is going to turn it into a plasmoid?


Anonymous said...

A plasma integration sounds like a nice extension for the KDE desktop.
I think, I will start this week with turning the rendering stuff into a Plasma::DataEngine and creating an webpage-preview plasmoid (a bit like the already known picture frame plasmoid).

If all runs good, I will see how to the whole thing could be turned into a nice plasmoid.

This would be my first experience with plasma programming. Lets see, how it works :-)

trueg said...

Nice. How about using ThreadWeaver to fetch all pages at the same time?

Ariya Hidayat said...

@trueg: The thumbnailing is probably network-bound, not CPU-bound. Beside, it would complicate the code (so it is left as an exercise for the reader :-)