Jump to content

KTp/Tasks/ModelRoles: Difference between revisions

From KDE Community Wiki
D ed (talk | contribs)
Created page with "{| ! align="left" class="wikitable"| Original Role !! Type !! Comment |- |- | AliasRole ||returns Tp::AccountPtr |- | AudioCallCapabilityRole |- | AvatarRole |- | BlockedRole ..."
 
D ed (talk | contribs)
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{|
===Old Roles===
! align="left" class="wikitable"| Original Role !! Type !! Comment
 
{| class="wikitable" border="1"  
|-
|-
! Original Role !! Type !! Comment
|-
|-
| AliasRole ||returns Tp::AccountPtr
| Qt::DisplayRole || Contact's alias OR account name OR readable group name ||
|-
|-
| AudioCallCapabilityRole
| AccountRole||Tp::AccountPtr ||
|-
|-
| AvatarRole
| AliasRole || Contact's alias ||
|-
|-
| BlockedRole
| AudioCallCapabilityRole || bool || both you can remote can audio call
|-
|-
| ClientTypesRole
| AvatarRole || TODO || contact's avatar
|-
|-
| ContactRole
| BlockedRole || bool || isBlocked
|-
|-
| DesktopSharingCapabilityRole
| ClientTypesRole || QStringList || client types from Tp::Contact
|-
|-
| FileTransferCapabilityRole
| ContactRole || Tp::ContactPtr ||
|-
|-
| GroupsRole ||no idea, probably deprecated :S
| DesktopSharingCapabilityRole || bool || both you and remote can desktop share.. I Want to kill this, and expose QStringList streamTubeRoles
|-
|-
| IconRole
| FileTransferCapabilityRole || bool || both you and remote can file transfer
|-
|-
| IdRole || string || contact ID or account ID or group ID appropriate
| GroupsRole ||no idea, probably deprecated || KILL IT! (EDIT: Don't dave is an idiot, we need this)
|-
|-
| index || ????  || ? ? ? ? ? ? ?
| IconRole || ?? || KILL IT!
|-
|-
| ItemRole || deprecated
| IdRole || string || contact ID or account ID or group ID as appropriate
|-
|-
| MediaCallCapabilityRole || bool || both you +remote can audio call
| index || ????  || KILL IT!
|-
|-
| NicknameRole ||  ||no idea...
| ItemRole || deprecated || KILL IT!
|-
| MediaCallCapabilityRole || bool || ???
|-
| NicknameRole ||  || KILL IT!
|-
|-
| OnlineUsersCountRole || number of online contacts in this group
| OnlineUsersCountRole || number of online contacts in this group
Line 43: Line 49:
| RowType ||enum  || either AccountsRowType, ContactsRowType, GroupRowType
| RowType ||enum  || either AccountsRowType, ContactsRowType, GroupRowType
|-
|-
| SSHContactCapabilityRole ||bool  ||both you + remote can SSH contact
| SSHContactCapabilityRole ||bool  ||both you + remote can SSH contact. I Want to kill this, and expose QStringList streamTubeRoles
|-
|-
| TextChatCapabilityRole ||bool  ||both you + remote can text chat
| TextChatCapabilityRole ||bool  ||both you + remote can text chat
Line 49: Line 55:
| TotalUsersCountRole ||int  ||total users in this group
| TotalUsersCountRole ||int  ||total users in this group
|-
|-
| TypeRole  ||mystery to me.
| TypeRole  || ??? || KILL IT!
|-
|-
| VideoCallCapabilityRole ||bool || both you + remote can video call
| VideoCallCapabilityRole ||bool || both you + remote can video call
|}
|}
===NEW Role Requests===
Roles for:
- unread message count
- hasTextChannel
- tubesRoles (QVariantMap of stream + dbus tubes) Rationale - hardcoding types into the model is bad
===Proposed Enum===
<pre>
namespace MainModel {
enum Roles {
//core
Qt::DisplayRole // returns Contact Alias, Account displayName or Group Name
RowTypeRole,= Qt::UserRole //returns one of KTp::ContactRowType, KTp::PersonRowType, KTp::GroupRowType, KTp::AccountRowType
IdRole, //returns Contact ID, Account UID, or group ID (group name or "_ungrouped")
//telepathy roles
ContactRole = Qt::UserRole + 1000,  //returns Tp::ContactPtr
AccountRole, // Tp::AccountPtr
CustomTelepathyRole, //future extensibility without breaking ABI
//contact/person roles
ContactClientTypesRole = Qt::UserRole + 2000, //
ContactAvatarRole,
ContactGroupsRole,
ContactPresenceRole,
ContactPresenceMessageRole,
ContactPresenceTypeRole,
ContactPresenceIconRole,
ContactHasTextChannelRole,
ContactUnreadMessageCountRole,
//FIXME caps
CustomContactRole
//heading roles
HeaderTotalUsersRole = Qt::UserRole  + 3000,
HeaderOnlineUsersRole,
CustomHeaderRole
};
}
TODO list:
- contact caps:
- account icon in account group header... DecorationRole or HeaderIconRole?
- docs on contact roles
- learn how to document an enum in Doxygen :)
- poke mck182 to see if metacontacts need any more roles
- don't put Qt::DisplayRole in our enum! that's silly
</pre>

Latest revision as of 01:16, 25 January 2013

Old Roles

Original Role Type Comment
Qt::DisplayRole Contact's alias OR account name OR readable group name
AccountRole Tp::AccountPtr
AliasRole Contact's alias
AudioCallCapabilityRole bool both you can remote can audio call
AvatarRole TODO contact's avatar
BlockedRole bool isBlocked
ClientTypesRole QStringList client types from Tp::Contact
ContactRole Tp::ContactPtr
DesktopSharingCapabilityRole bool both you and remote can desktop share.. I Want to kill this, and expose QStringList streamTubeRoles
FileTransferCapabilityRole bool both you and remote can file transfer
GroupsRole no idea, probably deprecated KILL IT! (EDIT: Don't dave is an idiot, we need this)
IconRole ?? KILL IT!
IdRole string contact ID or account ID or group ID as appropriate
index ???? KILL IT!
ItemRole deprecated KILL IT!
MediaCallCapabilityRole bool ???
NicknameRole KILL IT!
OnlineUsersCountRole number of online contacts in this group
PresenceMessageRole string - status message
PresenceRole Tp::Presence Should use KTp::Presence
PresenceTypeRole enum
RowType enum either AccountsRowType, ContactsRowType, GroupRowType
SSHContactCapabilityRole bool both you + remote can SSH contact. I Want to kill this, and expose QStringList streamTubeRoles
TextChatCapabilityRole bool both you + remote can text chat
TotalUsersCountRole int total users in this group
TypeRole ??? KILL IT!
VideoCallCapabilityRole bool both you + remote can video call

NEW Role Requests

Roles for:

- unread message count
- hasTextChannel
- tubesRoles (QVariantMap of stream + dbus tubes) Rationale - hardcoding types into the model is bad

Proposed Enum


namespace MainModel {

enum Roles {

//core
Qt::DisplayRole // returns Contact Alias, Account displayName or Group Name
RowTypeRole,= Qt::UserRole //returns one of KTp::ContactRowType, KTp::PersonRowType, KTp::GroupRowType, KTp::AccountRowType
IdRole, //returns Contact ID, Account UID, or group ID (group name or "_ungrouped")

//telepathy roles
ContactRole = Qt::UserRole + 1000,  //returns Tp::ContactPtr
AccountRole, // Tp::AccountPtr
CustomTelepathyRole, //future extensibility without breaking ABI

//contact/person roles
ContactClientTypesRole = Qt::UserRole + 2000, //
ContactAvatarRole,
ContactGroupsRole,
ContactPresenceRole,
ContactPresenceMessageRole,
ContactPresenceTypeRole,
ContactPresenceIconRole,
ContactHasTextChannelRole,
ContactUnreadMessageCountRole,
//FIXME caps
CustomContactRole

//heading roles
HeaderTotalUsersRole = Qt::UserRole  + 3000,
HeaderOnlineUsersRole,
CustomHeaderRole

};

}

TODO list:
 - contact caps:
 - account icon in account group header... DecorationRole or HeaderIconRole?
 - docs on contact roles
 - learn how to document an enum in Doxygen :)
 - poke mck182 to see if metacontacts need any more roles
 - don't put Qt::DisplayRole in our enum! that's silly