Review Request: Add static methods to retrieve icon, iconName and displaystring from a Tp::ConnectionPresenceType to KTp presence

David Edmundson kde at davidedmundson.co.uk
Sun Feb 26 11:58:15 UTC 2012



> On Feb. 24, 2012, 9:41 p.m., David Edmundson wrote:
> > Code is absolutely fine, especially the documentation.
> > 
> > I would like to know the reason we need this though. I'm not aware of anywhere in TpQt that gives you a Tp::ConnectionPresenceType.
> > 
> > I don't want people to start writing:
> > Ktp::Presence::iconName(myPresence.connectionPresenceType())
> > 
> > instead of the current:
> > KTp::Presence(myPresence).iconName();
> > 
> > Drop me a message sometime (XMPP or IRC).
> 
> Daniele Elmo Domenichelli wrote:
>     The reason is to be able to create a menu very quickly and have coherence in icons and text, saving unneeded translatable strings in different components (that might be translated in a different way). It can (and actually I'm planning to do it as soon as this is merged) be used in the presence plasmoid and in the contact list.
>     
>     Actually I don't think it is a problem if people uses the static method if they just need the icon, it actually saves you from allocating a KTp::Presence object

>Actually I don't think it is a problem if people uses the static method if they just need the icon, it actually saves you from allocating a KTp::Presence object 

The cost of "allocating" a KTp::Presence object is practically 0. You always create it on the stack so no expensive memory allocation, and all the constructor does is copy one QSharedDataPointer. Not doing this is super super micro optimisation, at the cost of harder to read, inconsistent code and would result in (more of) a mixture of Tp::Presence and KTp::Presence internally.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104069/#review10874
-----------------------------------------------------------


On Feb. 24, 2012, 6:01 p.m., Daniele Elmo Domenichelli wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104069/
> -----------------------------------------------------------
> 
> (Updated Feb. 24, 2012, 6:01 p.m.)
> 
> 
> Review request for Telepathy.
> 
> 
> Description
> -------
> 
> Add static methods to retrieve icon, iconName and displaystring from a Tp::ConnectionPresenceType to KTp presence and use them internally
> 
> 
> Diffs
> -----
> 
>   KTp/presence.h d116530c318586ef290f7193c9f1956f4e47b77d 
>   KTp/presence.cpp 35bc0dc6088b875bf719a22f45938184b1f96bb2 
> 
> Diff: http://git.reviewboard.kde.org/r/104069/diff/
> 
> 
> Testing
> -------
> 
> Built, installed, and run components using them.
> Everything seems ok.
> 
> 
> Thanks,
> 
> Daniele Elmo Domenichelli
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20120226/e1759c13/attachment.html>


More information about the KDE-Telepathy mailing list