Well, like you put it, you need KTp::Presence anyway, so it seems to me that you have already decided you want KTp::Presence as a QObject.
I don't think it would be much of a problem, since there aren't this much Presence instance anyway, so that it has a memory impact, no? Aleix PS: note that I don't know what I'm talking about On Mon, Apr 29, 2013 at 1:10 AM, David Edmundson <[email protected] > wrote: > I plan to convert the presence applet to QML for 0.7. > We need to do this before Plasma Workspace 5, otherwise it won't run. > So we may as well do it now. It also allows us to show a better > tooltip with account state via the AccountsModel. > Should be pretty trivial. > > I need to expose the GlobalPresence class to QML, however I'm unsure > on how to do this well. > > The problem: > - GlobalPresence deals with KTp::Presence objects for retrieving and > setting current presence > - QML cannot read KTp::Presence objects as they don't inherit from > QObject. > > Possible solutions: > > - Change KTp::Presence to inherit from QObject. > KTp::Presence stores data. Data has no clear parent so should always > be stored with shared pointers, otherwise you get in crazy situations > and things breaking all over the place. QObjects also have a lot of > overhead in creation and should be avoided when we don't need to. > > - Make a wrapper class around GlobalPresence that converts > KTp::Presence objects to QVariantMaps > Arbitrary QVariantMaps don't make for very readable code in the QML. > You have to read the C++ code to know how to use an object in QML. > > - Use a dataengine / serviceprovider > Basically exactly the same as above, but with 10 times as much code. > We used to have one, it made nwoki go insane and rewrite the whole > thing in C++. > > - Modify GlobalPresence to deal with the individual properties. > i.e > setPresenceType(Tp::ConnectionStatus) > setPresenceMessage(QString) > > KTp::Presence has convenient methods for i18n'ing words like "online" > and finding the right icon and such. This would lose that, we also > lose a 1-1 mapping with our C++ code, that we're moving towards (a > bit) > > - Any opinions/other ideas? > > > > Related: > - I'm also going to need to add methods to open the accounts KCM, > start chats and add contacts to the TelepathyManager QML class. Any > objections? > _______________________________________________ > KDE-Telepathy mailing list > [email protected] > https://mail.kde.org/mailman/listinfo/kde-telepathy >
_______________________________________________ KDE-Telepathy mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-telepathy
