Example #1
0
void CGroupsUI::SetChildVisible(Node* node, bool visible)
{
	if (!node || node == root_node_)
		return;

	if (node->data().child_visible_ == visible)
		return;

	node->data().child_visible_ = visible;

	TCHAR szBuf[MAX_PATH] = {0};
	CDuiString html_text;
	if (node->data().has_child_)
	{
		if (node->data().child_visible_)
			html_text += level_expand_image_;
		else
			html_text += level_collapse_image_;

		_stprintf_s(szBuf, MAX_PATH - 1, _T("<x %d>"), level_text_start_pos_);
		html_text += szBuf;

		html_text += node->data().text_;

		CLabelUI* nick_name = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(node->data().list_elment_, kNickNameControlName));
		if (nick_name != NULL)
		{
			nick_name->SetShowHtml(true);
			nick_name->SetText(html_text);
		}
	}

	if (!node->data().list_elment_->IsVisible())
		return;

	if (!node->has_children())
		return;

	Node* begin = node->child(0);
	Node* end = node->get_last_child();
	for (int i = begin->data().list_elment_->GetIndex(); i <= end->data().list_elment_->GetIndex(); ++i)
	{
		CControlUI* control = GetItemAt(i);
		if (_tcsicmp(control->GetClass(), _T("ListContainerElementUI")) == 0)
		{
			if (visible) 
			{
				Node* local_parent = ((Node*)control->GetTag())->parent();
				if (local_parent->data().child_visible_ && local_parent->data().list_elment_->IsVisible())
				{
					control->SetVisible(true);
				}
			}
			else
			{
				control->SetVisible(false);
			}
		}
	}
}
Example #2
0
/**
 * Modifies a style's property.
 * The method updates the property to which the index corresponds, as well as
 * the same property for all child styles that inherit this property.
 * @param  index Corresponds to a property node
 * @param  value The new value to set
 * @param  role  Must be Qt::EditRole
 * @return true if the property was updated, false otherwise
 */
bool LexerStyleModel::setData(const QModelIndex& index, const QVariant& value,
                              int role)
{
	// Can only modify property nodes.
	Node* node = nodeFromIndex(index);
	if (!node || !node->data() || !node->data()->type() == PropertyNode)
		return false;

	if (role != Qt::EditRole)
		return false;

	// Set the property's value.
	PropertyData* data = static_cast<PropertyData*>(node->data());
	Node* styleNode = data->styleNode_;
	setProperty(value, styleNode, data->prop_, QVariant());

	// Update changes.
	emit dataChanged(index, index);
	QModelIndex styleIndex = createIndex(styleNode->index(), 1, styleNode);
	emit dataChanged(styleIndex, styleIndex);

	// Apply property to inheriting styles.
	inheritProperty(value, styleNode, data->prop_, false);

	return true;
}
Example #3
0
/**
 * Forces all child styles to inherit the given property.
 * @param  index Corresponds to a property node in the parent style
 */
void LexerStyleModel::applyInheritance(const QModelIndex& index)
{
	// Ensure the index corresponds to a property node.
	Node* node = nodeFromIndex(index);
	if ((node == NULL) || (node->data() == NULL)
	    || (node->data()->type() != PropertyNode)) {
		return;
	}

	// Apply inheritance to child styles.
	PropertyData* data = static_cast<PropertyData*>(node->data());
	inheritProperty(data->value_, data->styleNode_, data->prop_, true);
}
Example #4
0
void Queue::dump() const
{
  std::cout << "QUEUE DUMP" << std::endl;
  for (Node* cursor = _front_ptr; cursor != 0; cursor = cursor->link()) {
    std::cout << "data: " << cursor->data() << std::endl;
  }
}// dump
Example #5
0
BOOL CUIRecentSessionList::UpdateItemConentBySId(IN const std::string& sId)
{
	Node* pNode = GetItemBySId(sId);
	PTR_FALSE(pNode);
	CControlUI* pListElement = pNode->data().list_elment_;
	PTR_FALSE(pListElement);

	CLabelUI* plastMsgTimeUI = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, lastContentTimeControlName));
	if (!plastMsgTimeUI)
	{
		return FALSE;
	}
	CLabelUI* plastMsgUI = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, klastmsgControlName));
	if (!plastMsgUI)
	{
		return FALSE;
	}
	CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName));
	if (!Unreadcnt_button)
	{
		return FALSE;
	}
	
	//更新会话的最后一条消息
	module::SessionEntity*  pSessionEntity = SessionEntityManager::getInstance()->getSessionEntityBySId(sId);
	if (!pSessionEntity)
	{
		LOG__(ERR, _T("Can't find the SessionEntity"));
		return FALSE;
	}
	std::string msgDecrptyCnt;
	DECRYPT_MSG(pSessionEntity->latestMsgContent, msgDecrptyCnt);
	CString strContent = util::stringToCString(msgDecrptyCnt);
	ReceiveMsgManage::getInstance()->parseContent(strContent, TRUE, 400);//需要转换成本地的格式

	module::UserInfoEntity userInfo;
	CString strMsgTalkName;
	if (module::SESSION_GROUPTYPE == pSessionEntity->sessionType &&//只有群需要展示 消息的发送者
		module::getUserListModule()->getUserInfoBySId(pSessionEntity->latestMsgFromId, userInfo))
	{
		strMsgTalkName = userInfo.getRealName();
		strMsgTalkName += CString(_T(":"));
	}
	strContent = strMsgTalkName + strContent;
	plastMsgUI->SetText(strContent);

	if (!SessionDialogManager::getInstance()->findSessionDialogBySId(sId))//窗口不存在的时候更新计数
	{
		//更新未读计数
		UInt32 nCnt = ReceiveMsgManage::getInstance()->getUnReadMsgCountBySId(sId);
        SetTextUICount(Unreadcnt_button, nCnt);
	}

	//更新消息的时间
	CString strTime = module::getMiscModule()->makeShortTimeDescription(pSessionEntity->updatedTime);
	plastMsgTimeUI->SetText(strTime);
	
	sort();
	return TRUE;
}
Example #6
0
void CRichEditWnd::OnItemClick(TNotifyUI& msg)
{
	CAnimationTabLayoutUI* m_pTabSwitch = static_cast<CAnimationTabLayoutUI*>(GetPaintMgr()->FindControl(_T("TAB_MAIN")));
	if (m_pTabSwitch != NULL)
	{
		if (m_pTabSwitch->GetCurSel() == 0)
		{
			
		}
		else if (m_pTabSwitch->GetCurSel() == 1)
		{
			CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(GetPaintMgr()->FindControl(_T("LIST_FRIEND")));
			if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					if (pFriendsList->CanExpand(node))
					{
						pFriendsList->SetChildVisible(node, !node->data().child_visible_);
					}
				}
			}
		}
	}
}
void CreateDiscussionGrpDialog::OnItemActive(TNotifyUI& msg)
{
	if (0 == _tcsicmp(msg.pSender->GetClass(),_T("ListContainerElementUI")))
	{
		if (0 == _tcsicmp(msg.pSender->GetName(), _T("ListCreatFromItem")))
		{
			Node* node = (Node*)msg.pSender->GetTag();
			if (!m_pListCreatFrom->CanExpand(node))
			{
				CString csId = node->data().sId;
				if (csId.IsEmpty())
					return;
				std::string sId = util::cStringToString(csId);
				
				_AddToGroupMemberList(sId);
				_refreshUIAddedNum();
			}
		}
		else if (0 == _tcsicmp(msg.pSender->GetName(), _T("SearchResultItem")))
		{
			CString csId = msg.pSender->GetUserData();
			if (csId.IsEmpty())
				return;
			std::string sId = util::cStringToString(csId);

			_AddToGroupMemberList(sId);
			_refreshUIAddedNum();
		}
	}
}
Example #8
0
	// The << operator is used to output the contents of each carriage
	// in the Train. It iterates throughout each Node in the LinkedList,
	// whilst appending the output and separating each element with a divider.
	ostream & operator<<(ostream & out, Train & value) {
		// Iterates foreach Node in the received Train.
		for (Node<Carriage>* current = value.getList()->getHead(); current != NULL; 
									current = current->link()) {
			// Appends the data, separating each element with a divider.
			out << current->data()->getCoal() << OUTPUT_DIVIDER;
		}
		return out; // Returns the output stream.
	}
float AdjacencyList::speed(int fromvert, int tovert){
  float rc=0;
  if(fromvert < size_ && tovert < size_){
    LList<EdgeInfo>& edgelist=edges(fromvert);
    Node<EdgeInfo>* curr;
    bool done=false;
    while(curr=edgelist.curr()){
      if(curr->data().to_==tovert){
        rc=curr->data().speed_;
        done=true;
      }
 //     fprintf(debug,"curr: %d\n",curr);
 //     fprintf(debug,"to: %d\n",curr->data().to_);
      edgelist.gonext();
    }
  }
  return rc;
}
Example #10
0
	// The totalLoad method is used to calculate the total amount of load in 
	// the Train. It iterates throughout each node element in the list adding
	// the value to the total. It returns the final calculated value.
	int Train::totalLoad() {
		int total = 0; // Stores the total.
		// Iterates foreach node in the list.
		for (Node<Carriage>* current = this->linked_list->getHead(); current != NULL; 
									current = current->link()) {
			// Adds the node data to the total.
			total += current->data()->getCoal();
		}
		return total; // Returns the total value.
	}
Example #11
0
bool Node::lookupAttribute( const std::string &name, int &data ) const
{
    for( unsigned int i = 0; i < getNodeCount(); ++i )
    {
        Node *node = getNode( i );
        if( node->nodeType() != Attribute || node->name() != name )
            continue;

        if( node->data().find( "0x" ) == 0 )
        {
            data = strtol( node->data().substr( 2, node->data().length() - 2 ).c_str(), 0, 16 );
        }
        else
            data = atoi( node->data().c_str() );
        return true;
    }

    return false;
}
Example #12
0
	// The countEmpty method is used to count the amount of carriages in the
	// Train with a empty load. It iterates throughout each node element
	// incrementing a counter value when a zero value has been spotted.
	// It returns the count of empty carriages.
	int Train::countEmpty() {
		int i = 0; // A counter used for the empty carriages.
		// Iterates foreach node in the list.
		for (Node<Carriage>* current = this->linked_list->getHead(); current != NULL; 
									current = current->link()) {
			// The carriage has no load.
			if (current->data()->getCoal() == 0) {
				i++; // Increment counter.
			}
		}
		return i; // Returns the counter value.
	}
Example #13
0
void dfs(const Node< pair<int, int> >& node, Graph<> &graph, const Node<>& fusion, Node< pair<int, int> > father = Node< pair<int, int> >()) {
    int size = node.data().first;

    Graph<> g;
    if (size <= 2) {
        g = chain(size);
    } else {
        if (size > 3 && randomElement({true, false})) { // bipartite
            g = randomBipartiteBiconnected(node.data().first, node.data().second);
        } else {
            g = randomBiconnected(node.data().first, node.data().second);
        }
    }
    g.Index();
    auto current = g[1];
    graph.fuseGraph(g, {{fusion, g[0]}});

    for (auto &x : node.edges())
        if (x.to() != father)
            dfs(x.to(), graph, current, node);
}
Example #14
0
void MainFrame::OnItemClick(TNotifyUI& msg)
{
	CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kMainTabControlName));
	if (pTabControl != NULL)
	{
		if (pTabControl->GetCurSel() == 0)
		{
			CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(m_PaintManager.FindControl(kFriendsListControlName));
			if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					if (pFriendsList->CanExpand(node))
					{
						pFriendsList->SetChildVisible(node, !node->data().child_visible_);
					}
				}
			}
		}
		else if (pTabControl->GetCurSel() == 1)
		{
			CGroupsUI* pGroupsList = static_cast<CGroupsUI*>(m_PaintManager.FindControl(kGroupsListControlName));
			if ((pGroupsList != NULL) && pGroupsList->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					if (pGroupsList->CanExpand(node))
					{
						pGroupsList->SetChildVisible(node, !node->data().child_visible_);
					}
				}
			}
		}
	}
}
Example #15
0
		inline data_t pop(){
			if( not this->is_empty() ){
				data_t ret = end->data();
				Node *n=end->next();
				delete end;
				end=n;
				--size;
				return ret;
			}else{
				printf("cabou lista\n");
				exit(-1);
			}
		}
Example #16
0
		inline data pop(){
			if( begin ){
				data ret = begin->data();
				Node *n=begin->next();
				delete begin;
				begin=n;
				--size;
				return ret;
			}else{
				fprintf(stderr, "Chuck Norris dislikes pilha\n");
				exit(-1);
			}
		}
Example #17
0
bool Node::lookupAttribute( const std::string &name, std::string &data ) const
{
    for( unsigned int i = 0; i < getNodeCount(); ++i )
    {
        Node *node = getNode( i );
        if( node->nodeType() != Attribute || node->name() != name )
            continue;

        data = node->data();
        return true;
    }

    return false;
}
void CMainWindow::OnItemClick(TNotifyUI& msg)
{
	if (m_pTabSwitch != NULL)
	{
		if (m_pTabSwitch->GetCurSel() == 0)
		{
			if ((m_pFriendTree != NULL) &&  m_pFriendTree ->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					if (m_pFriendTree ->CanExpand(node))
					{
						m_pFriendTree ->SetChildVisible(node, !node->data().child_visible_);
					}
				}
			}
		}
		else if (m_pTabSwitch->GetCurSel() == 1)
		{
			if ((m_pGroupTree != NULL) &&  m_pGroupTree ->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					if (m_pGroupTree ->CanExpand(node))
					{
						m_pGroupTree ->SetChildVisible(node, !node->data().child_visible_);
					}
				}
			}
		}
	}
}
Example #19
0
TEST_F(SorterTest, DoesNotMergeGroups)
{
    auto_ptr<BuddyListSorter> sorter(newSorter());

    // Check that two subgroups with different names are not merged.
    GroupPtr g(new Group(L"root"));
    g->addChild(new Group(L"subroot1"));
    g->addChild(new Group(L"subroot2"));
    sorter->setRoot(g.get());

    Node* n = sorter->root();
    ASSERT_EQ(n->data()->name(), g->name());
    ASSERT_EQ(n->numChildren(), 2);
    ASSERT_EQ(n->children()[0]->data()->name(), g->children()[0]->name());
}
Example #20
0
	std::string TowerHanoi::showTowers() {
		std::string lines[this->rods][this->discs + 1];
		for (int i = 0; i < (int)sizeof(this->towers); i++) {
			if ((this->towers[i] != NULL) && (i < this->rods)) {
				LStack<Disc>* stack = this->towers[i];
				LinkedList<Disc>* list = stack->getList();
				int space_lines = (this->discs - list->getSize());
				int index = 0;
				
				for (int l = 0; l < space_lines; l++) {
					string white_space; 
					for (int s = 0; s < ((2 * this->discs - 1) + 2); s++) {
						white_space += ' ';
					}
					lines[i][index++] = white_space;
				}
				
				for (Node<Disc>* current = list->getHead(); current != NULL; current = current->link()) {
					if (current != NULL) {
						lines[i][index++] = current->data()->getValue();
					}
				}
				
				string separator_space;
				int separator_count = ((2 * this->discs - 1) + 2);
				for (int s = 0; s < separator_count; s++) {
					if (s == (separator_count / 2)) {
						stringstream result;
						result << (i + 1);
						separator_space += result.str();
					} else {
						separator_space += '-';
					}
					
				}
				lines[i][index++] = separator_space;
			}	
		}
		
		std::string tower_str;
		for (int i = 0; i < this->discs + 1; i++) {
			for (int rod = 0; rod < this->rods; rod++) {
				tower_str += lines[rod][i];
			}
			tower_str += "\n";
		}
		return tower_str;
	}
Example #21
0
    void
    bootstrap() {
        // Create initial nodes

        static Node bootstrap_type_nodes[] = {
            {  0, 9, { CALI_TYPE_USR    },  },
            {  1, 9, { CALI_TYPE_INT    },  },
            {  2, 9, { CALI_TYPE_UINT   },  },
            {  3, 9, { CALI_TYPE_STRING },  },
            {  4, 9, { CALI_TYPE_ADDR   },  },
            {  5, 9, { CALI_TYPE_DOUBLE },  },
            {  6, 9, { CALI_TYPE_BOOL   },  },
            {  7, 9, { CALI_TYPE_TYPE   },  },
            { CALI_INV_ID, CALI_INV_ID, { } } 
        };
        static Node bootstrap_attr_nodes[] = {
            {  8, 8,  { CALI_TYPE_STRING, "cali.attribute.name",  19 } },
            {  9, 8,  { CALI_TYPE_STRING, "cali.attribute.type",  19 } },
            { 10, 8,  { CALI_TYPE_STRING, "cali.attribute.prop",  19 } },
            { CALI_INV_ID, CALI_INV_ID, { } } 
        };

        m_node_id.store(11);

        // Fill type map

        for (Node* node = bootstrap_type_nodes ; node->id() != CALI_INV_ID; ++node)
            m_type_nodes[node->data().to_attr_type()] = node;

        // Initialize bootstrap attributes

        const MetaAttributeIDs keys = { 8, 9, 10 };
        m_meta_attributes = keys;

        struct attr_node_t { 
            Node* node; cali_attr_type type;
        } attr_nodes[] = { 
            { &bootstrap_attr_nodes[0], CALI_TYPE_STRING },
            { &bootstrap_attr_nodes[1], CALI_TYPE_TYPE   },
            { &bootstrap_attr_nodes[2], CALI_TYPE_INT    }
        };

        for ( attr_node_t p : attr_nodes ) {
            // Append to type node
            m_type_nodes[p.type]->append(p.node);
        }
    }
Example #22
0
TEST_F(SorterTest, MergesGroups)
{
    auto_ptr<BuddyListSorter> sorter(newSorter());

    // Check that two subgroups with the same name are merged.
    GroupPtr g(new Group(L"root"));
    Group* c1 = new Group(L"subroot");
    Group* c2 = new Group(L"subroot");

    g->addChild(c1);
    g->addChild(c2);
    sorter->setRoot(g.get());

    Node* n = sorter->root();
    ASSERT_EQ(n->data()->name(), g->name());
    ASSERT_EQ(n->numChildren(), 1);
}
Example #23
0
/**
 * Recursively deteles style nodes.
 * @param  node The node to delete
 */
void LexerStyleModel::deleteStyleNode(Node* node)
{
	// Recursive call first.
	for (int i = 0; i < node->childCount(); i++)
		deleteStyleNode(node->child(i));

	// Delete all property data.
	StyleData* data = static_cast<StyleData*>(node->data());
	for (int i = 0; i < data->propRoot_.childCount(); i++) {
		Node* child = data->propRoot_.child(i);
		delete child->data();
		data->propRoot_.clear();
	}

	// Delete the node's data.
	delete data;
}
void CreateDiscussionGrpDialog::OnItemClick(TNotifyUI& msg)
{
	CDuiString cname = msg.pSender->GetClass();
	CDuiString name = msg.pSender->GetName();
	if (0 == _tcsicmp(msg.pSender->GetClass(),_T("ListContainerElementUI")))
	{
		if (0 == _tcsicmp(msg.pSender->GetName(),_T("ListCreatFromItem")))
		{
			Node* node = (Node*)msg.pSender->GetTag();

			if (m_pListCreatFrom->CanExpand(node))
			{
				m_pListCreatFrom->SetChildVisible(node, !node->data().child_visible_);
			}
		}
	}
}
Example #25
0
void MainFrame::OnItemActivate(TNotifyUI& msg)
{
	CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kMainTabControlName));
	if (pTabControl != NULL)
	{
		if (pTabControl->GetCurSel() == 0)
		{
			CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(m_PaintManager.FindControl(kFriendsListControlName));
			if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
					if (!pFriendsList->CanExpand(node) && (background != NULL))
					{
						FriendListItemInfo friend_info;

						for (std::vector<FriendListItemInfo>::const_iterator citer = friends_.begin(); citer != friends_.end(); ++citer)
						{
							if (_tcsicmp(citer->id, node->data().value) == 0)
							{
								friend_info = *citer;
								break;
							}
						}
						TCHAR szBuf[MAX_PATH] = { 0 };
						if (_tcslen(background->GetBkImage()) > 0)
						{
							_stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_);
						}

						ChatDialog* pChatDialog = new ChatDialog(szBuf, background->GetBkColor(), myself_info_, friend_info);
						if (pChatDialog == NULL)
							return;
						pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0);
						skin_changed_observer_.AddReceiver(pChatDialog);
						pChatDialog->CenterWindow();
						::ShowWindow(*pChatDialog, SW_SHOW);
					}
				}
			}
		}
	}
}
Example #26
0
TEST_F(SorterTest, TestContactAttributes)
{
    auto_ptr<BuddyListSorter> sorter(newSorter());

    Buddy* b = sorter->account(L"digsby01", L"aim")->buddy(L"digsby03");

    // Check that two subgroups with different names are not merged.
    GroupPtr g(new Group(L"root"));
    g->addChild(new Group(L"subroot1"));
    g->addChild(new Group(L"subroot2"));
    sorter->setRoot(g.get());

    Node* n = sorter->root();
    ASSERT_EQ(n->data()->name(), g->name());
    ASSERT_EQ(n->numChildren(), 2);
    ASSERT_EQ(n->children()[0]->data()->name(), g->children()[0]->name());
}
Example #27
0
void CRichEditWnd::OnItemActive(TNotifyUI& msg)
{
	CAnimationTabLayoutUI* pTabControl = static_cast<CAnimationTabLayoutUI*>(GetPaintMgr()->FindControl(_T("TAB_MAIN")));
	if (pTabControl != NULL)
	{
		if (pTabControl->GetCurSel() == 1)
		{
			CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(GetPaintMgr()->FindControl(_T("LIST_FRIEND")));
			if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1)
			{
				if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)
				{
					Node* node = (Node*)msg.pSender->GetTag();

					CControlUI* background = GetPaintMgr()->FindControl(_T("bg"));
					if (!pFriendsList->CanExpand(node) && (background != NULL))
					{
						FriendListItemInfo friend_info;

						for (std::vector<FriendListItemInfo>::const_iterator citer = friends_.begin(); citer != friends_.end(); ++citer)
						{
							if (_tcsicmp(citer->id, node->data().value) == 0)
							{
								friend_info = *citer;
								break;
							}
						}

						ChatDialog* pChatDialog = new ChatDialog(background->GetBkImage(), background->GetBkColor(), myself_info_, friend_info);
						if (pChatDialog == NULL)
							return;
#if defined(WIN32) && !defined(UNDER_CE)
						pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0);
#else
						pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0);
#endif

						pChatDialog->CenterWindow();
						::ShowWindow(*pChatDialog, SW_SHOW);
					}
				}
			}
		}
	}
}
Example #28
0
BOOL CUIRecentSessionList::UpdateItemInfo(IN const SessionListItemInfo& item)
{
	std::string sid = util::cStringToString(CString(item.id));
	Node* pNode = GetItemBySId(sid);
	if (nullptr == pNode)
	{
		return FALSE;
	}
	CControlUI* pListElement = pNode->data().list_elment_;
	PTR_FALSE(pListElement);
	CContainerUI* logo_Button = static_cast<CContainerUI*>(paint_manager_.FindSubControlByName(pListElement, kLogoButtonControlName));
	if (logo_Button != NULL)
		logo_Button->SetBkImage(item.avatarPath);

	CLabelUI* nick_name = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kNickNameControlName));
	if (nick_name != NULL)
		nick_name->SetText(item.nickName);
	return TRUE;
}
Example #29
0
void CUIRecentSessionList::ClearItemMsgCount(IN const std::string& sId)
{
	Node* pNode = GetItemBySId(sId);
	if (!pNode)
		return;
	CControlUI* pListElement = pNode->data().list_elment_;
	PTR_VOID(pListElement);
	//清除未读计数
	CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName));
	if (!Unreadcnt_button)
	{
		LOG__(DEBG, _T("can't find the Unreadcnt_button"));
		return;
	}
	Unreadcnt_button->SetText(_T(""));
	Unreadcnt_button->SetVisible(false);

	return;
}
Example #30
0
TEST_F(SorterTest, MergesGroupsCaseInsensitive)
{
    auto_ptr<BuddyListSorter> sorter(new BuddyListSorter());
    sorter->addSorter(new ByGroup(true, 2));

    // Check that two subgroups with the same name (case insensitive) are merged.
    GroupPtr g(new Group(L"root"));
    Group* r1 = new Group(L"subroot");
    Group* r2 = new Group(L"subroot2");
    Group* r3 = new Group(L"subroot3");
    Group* r4 = new Group(L"subroot4");

    // Lots of groups with different case
    Group* dotsyntax1 = new Group(L"dotsyntax");
    Group* dotsyntax2 = new Group(L"dotSyntax");
    Group* dotsyntax3 = new Group(L"dOTSyntaX");
    Group* dotsyntax4 = new Group(L"dotsyntax");

    Buddy* b1 = sorter->account(L"digsby01", L"aim")->buddy(L"buddy1");
    Buddy* b2 = sorter->account(L"digsby01", L"gtalk")->buddy(L"buddy2");

    dotsyntax1->addChild(b1);
    dotsyntax2->addChild(b2);
    r1->addChild(dotsyntax1);
    r2->addChild(dotsyntax2);
    r3->addChild(dotsyntax3);
    r4->addChild(dotsyntax4);
    g->addChild(r1); g->addChild(r2); g->addChild(r3); g->addChild(r4);
    sorter->setRoot(g.get());

    NodePtr n(sorter->gather());
    ASSERT_EQ(1, n->numChildren());

    Node* groupNode = n->children()[0];

    // The most-cased group name should be the one we see.
    EXPECT_EQ(L"dOTSyntaX", groupNode->name());
    ASSERT_EQ(2, groupNode->numChildren());

    ASSERT_TRUE(groupNode->data());
}