当前位置: 首页>>代码示例>>C++>>正文


C++ ContactList::group方法代码示例

本文整理汇总了C++中ContactList::group方法的典型用法代码示例。如果您正苦于以下问题:C++ ContactList::group方法的具体用法?C++ ContactList::group怎么用?C++ ContactList::group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContactList的用法示例。


在下文中一共展示了ContactList::group方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fill

void UserListBase::fill()
{
    m_pressedItem = NULL;
    clear();
    GroupItem *grpItem;
    ContactItem *contactItem;
    UserViewItemBase *divItem;
    UserViewItemBase *divItemOnline = NULL;
    UserViewItemBase *divItemOffline = NULL;
    ContactList *list = getContacts();
    ContactList::GroupIterator grp_it;
    ContactList::ContactIterator contact_it;
    Group *grp;
    Contact *contact;
    switch (m_groupMode){
    case 0:
        divItemOnline  = NULL;
        divItemOffline = NULL;
        while ((contact = ++contact_it) != NULL){
            if (contact->getIgnore() || contact->getTemporary())
                continue;
            unsigned style;
            string icons;
            unsigned status = getUserStatus(contact, style, icons);
            unsigned unread = getUnread(contact->id());
			bool bShow = false;
			ListUserData *data = (ListUserData*)contact->getUserData(CorePlugin::m_plugin->list_data_id);
			if (data && data->ShowAllways)
				bShow = true;
            if ((unread == 0) && !bShow && (status == STATUS_OFFLINE) && m_bShowOnline)
                continue;
            divItem = (status == STATUS_OFFLINE) ? divItemOffline : divItemOnline;
            if (divItem == NULL){
                if (status == STATUS_OFFLINE){
                    divItemOffline = new DivItem(this, DIV_OFFLINE);
                    setOpen(divItemOffline, true);
                    divItem = divItemOffline;
                }else{
                    divItemOnline = new DivItem(this, DIV_ONLINE);
                    setOpen(divItemOnline, true);
                    divItem = divItemOnline;
                }
            }
            new ContactItem(divItem, contact, status, style, icons.c_str(), unread);
        }
        break;
    case 1:
        while ((grp = ++grp_it) != NULL){
            if (grp->id() == 0)
                continue;
            grpItem = new GroupItem(this, grp, true);
        }
        grp = list->group(0);
        if (grp){
            grpItem = new GroupItem(this, grp, true);
        }
        while ((contact = ++contact_it) != NULL){
            if (contact->getIgnore() || contact->getTemporary())
                continue;
            unsigned style;
            string icons;
            unsigned status = getUserStatus(contact, style, icons);
            unsigned unread = getUnread(contact->id());
			bool bShow = false;
			ListUserData *data = (ListUserData*)contact->getUserData(CorePlugin::m_plugin->list_data_id);
			if (data && data->ShowAllways)
				bShow = true;
            if ((status == STATUS_OFFLINE) && !bShow && (unread == 0) && m_bShowOnline)
                continue;
            grpItem = findGroupItem(contact->getGroup());
            if (grpItem == NULL)
                continue;
            contactItem = new ContactItem(grpItem, contact, status, style, icons.c_str(), unread);
            grpItem->m_nContacts++;
            if ((status != STATUS_OFFLINE) && !m_bShowOnline){
                grpItem->m_nContactsOnline++;
                contactItem->m_bOnline = true;
            }
        }
        break;
    case 2:
        divItemOnline = new DivItem(this, DIV_ONLINE);
        setOpen(divItemOnline, true);
        while ((grp = ++grp_it) != NULL){
            if (grp->id() == 0)
                continue;
            grpItem = new GroupItem(divItemOnline, grp, false);
        }
        grp = list->group(0);
        if (grp){
            grpItem = new GroupItem(divItemOnline, grp, false);
        }
        if (!m_bShowOnline){
            divItemOffline = new DivItem(this, DIV_OFFLINE);
            setOpen(divItemOffline, true);
            grp_it.reset();
            while ((grp = ++grp_it) != NULL){
                if (grp->id() == 0)
                    continue;
                grpItem = new GroupItem(divItemOffline, grp, true);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的ContactList::group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。