So, GSoC has officially started :) A week has passed already and I have started hacking on my project, kcall. Here is the result of the first week in an image:
This is a screenshot of what I have coded so far. It presents a contact list in a tree view. The first level of the tree shows the available accounts (here, “gkiagia” refers to my jabber account) and the second level shows the contacts of this account. I also wanted to have one more level for the contact groups, but I haven’t found yet how to get the contact groups using the TelepathyQt4 library. Right clicking the items in that list brings a popup menu with options. For account items, it allows you to set the account status (online, offline, away, etc…) and for contacts, it allows you to call them. The call function is not yet working, though. I expect to spend my next week implementing this functionality.
This is just a draft implementation of the contact list and I don’t expect it to be the same in the final version. There are a couple of things that are still troubling me about it, so I decided to leave it as it is for now, which is usable enough for me, and proceed with implementing making and receiving audio/video calls, which is the most interesting part of the project. Later, I can come back and polish the contact list and the rest of the GUI. (To tell the truth, I don’t like designing GUI’s, so this week I just did the very basics to make it usable for me so that I can forget about it for now and start working on real stuff!)
The implementation was rather easy. Telepathy provides all the stuff I need, so essentially the code does the following: It connects through dbus to the telepathy account manager (I am using mission-control 5 from git as an account manager), it gets the list of available accounts and adds them in the first level of the tree model. For each account then, if the account is connected, it fetches its contacts and adds them in the second level, or else it connects to a signal that notifies it when the account gets online and fetches the contacts when this signal is emitted. In addition, it connects to a couple of other signals to track changes in accounts and contacts, so that it updates the tree when there is some change. The interesting part was implementing the tree. The implementation consists of an abstract “tree model”, which inherits QAbstractItemModel and implements the necessary functions to export a tree, a couple of “tree item” classes, that represent items in that tree, a controller class, which exports actions on the items and handles the popup context menu internally, and an unmodified QTreeView for visualizing the model.
Some of you may wonder now, how does telepathy work? It is rather simple. Different parts of an IM/VoIP client are split into various processes. There are the connection managers, that implement the various protocols (jabber, sip, msn, whatever…), a central account manager that stores all the accounts and the various GUI frontends (there is also the channel dispatcher, but I still haven’t made use of that in kcall and I don’t feel confident talking about how it works, as I don’t really know yet). All of them speak to each other over dbus, so to get information about an account or a contact (like what I did this week) is just a matter of talking to the other processes over dbus and getting the information. This is really cool, because it allows us programmers to reuse code from other projects. For instance, I didn’t write any protocol-specific code for kcall, and this very simple contact list that I wrote can work with *any* protocol for which there is a telepathy connection manager available :) The code was tested with the “gabble” connection manager, which exports the jabber protocol, but I could have used anything else…
So, that’s all I have for now about kcall… I will blog again next week with my progress on making calls :)