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

Wednesday, December 21, 2005

CGComm thoughts

Few days ago chemical requested a small app that would display the contents of hydranode internal metadatabase (info, e.g. meta data about files, such as size, hashes, known names etc), so I whopped up a small up in 2 hrs that displays the contents. The code is here, if anyone is interested. Basically it just links against hnbase/hncore libs, has the hncore library load the metadatabase, and then converts the contents into GUI objects; pretty straight-forward.

However, that got me thinking. In the hncgcomm library implementation, I was strictly avoiding the usage of Boost.Signals library, since the namespace name signals broke with QT's pre-defined name signals. And the lack of Boost.Signals made hncgcomm library really boring, and inconvenient to use. However, there are actually workarounds for this issue both on QT (4.1 beta) and Boost.Signals library. And using Boost.Signals would allow us to use Boost.Lambda unnamed functors, which can result in rather interesting code, like this:
data->onUpdated.connect(
boost::bind(&DownloadListItem::onUpdated, this)
);
data->onDeleted.connect(
boost::lambda::bind(boost::lambda::delete_ptr(), this)
);
m_downloadList->onAdded.connect(
boost::lambda::bind(
boost::lambda::new_ptr(), m_ui->allList, __1
)
);
The first two lines could go to a GUI download list item, first of which enables automatic display updating as soon as the hncgcomm library reports updates, second removes element from the list when the hncgcomm object is destroyed (download removed). The last line creates an unnamed lambda functor which constructs new DownloadListItem object, passing m_ui->allList parameter (the parent list for the object) as argument, so whenever a new download is detected by hncgcomm library, a GUI object is automatically created. This results in a LOT more interesting and compact code.

Anyway, the GUI topic became bit more interesting with this finding, so I'v been fiddling around with QT and our existing gui-related code pieces (quite a bit of those - thousands of lines of code across various places in the code tree), and testing some of the concepts that have been designed / developed over the past months (the GUI design has been an active topic for a long time already behind the scenes). Don't have anything that I can show you yet, but I might check in some hncgcomm updates in the next few days. I'v got few new ideas for the protocol improvement, such as allowing GUI to select which fields of bigger objects it's interested in (as optimization), and variable-rate updating (a constant update-rate gives bit strange feeling in the GUI, so I'm thinking variable-rate, say, 500ms to 1500ms, would create more smooth user experience.

Madcat, ZzZz



Comments:
Your experiments are becoming a fascinating novel.
Your blog has(for me) the same prirority of my newspaper. Keep writin' !!!
Thx
fabtar
 
I just sent a few bucks your way, I hope you receive them before christmas (think of it as a gift ;)

sca
 
Post a Comment



<< Home

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