Exemple #1
0
void P2PConnectionsWindow::refreshConnections()
{
	Connections connections;
	// Effettua una copia per evitare una lock durante il check
	getConnections(connections);

	wxWindowUpdateLocker windowLocker(m_connectionsCtrl);

	uint32 connectionsCount = static_cast<uint32>(connections.size());
	uint32 connectionsLimit = getConnectionsLimit();

	bool pendingRefresh = false;

	for(Connections::iterator i = connections.begin(); i != connections.end(); ++i)
	{
		if(i->second->getRemoved())
		{
			if(i->second->isElapsed() || (connectionsCount > connectionsLimit))
			{
				doRemoveConnection(i->first);
				connectionsCount--;
			}
			else
			{
				markConnectionRemoved(i->first);
			}
		}
		else
		{
			refreshConnectionItem(i->first);
		}
	}
}
Exemple #2
0
void LogWindow::logMessages(const list<shared_ptr<LogMessage> >::type &logs)
{
	wxWindowUpdateLocker windowLocker(this);

	for(list<shared_ptr<LogMessage> >::type::const_iterator i = logs.begin(); i != logs.end(); ++i)
	{
		logMessage(*i);
	}
}
Exemple #3
0
void IRCChannelPage::updatePage()
{
	WindowBase::updatePage();

	shared_ptr<IRCRoom> room = getRoom();
	if(room == nullptr)
		return;

	wxWindowUpdateLocker windowLocker(this);

	m_usersCtrl->DeleteAllItems();

	Locked<const IRCRoom::Users>::unique users = room->getUsers();
	for(IRCRoom::Users::const_iterator i = users->begin(); i != users->end(); ++i)
	{
		shared_ptr<IRCUser> user = i->second.first;
		shared_ptr<IRCRoom::UserDetails> userDetails = i->second.second;

		int32 index = m_usersCtrl->InsertItem(m_usersCtrl->GetItemCount(), wxEmptyString);
		if(index != -1)
		{
			m_usersCtrl->SetItemData(index, user->getID());
			m_usersCtrl->SetItem(index, 0, conversions::from_string<wxString>(user->getName()));

			uint32 icon = 0;

			IconsMap::const_iterator i = m_iconsMap.find(userDetails->getType());
			if(i == m_iconsMap.end())
			{
				OS_ASSERT(m_iconsMap.find(ircUserTypeNormal) != m_iconsMap.end());
				icon = m_iconsMap[ircUserTypeNormal];
			}
			else
			{
				icon = i->second;
			}

			m_usersCtrl->SetItemImage(index, icon);
		}
	}
}