void CSpiderTaskTree::UpdateDownload(vmsDownloadSmartPtr dld)
{
	int iIndex = FindDownload (dld);
	if (iIndex == -1)
		return;

	int iImage = GetDownloadImage (m_vConfs [iIndex].wptree->GetData ());
	SetItemImage (m_vConfs [iIndex].hItem, iImage, iImage);
}
void CSpiderTaskTree::AddTree(fsDLWebPageTree tree, HTREEITEM hParent)
{
	fsDLWebPage *wp = tree->GetData ();
	int iImage = GetDownloadImage (wp);
	HTREEITEM hItem = InsertItem (wp->strURL, iImage,  iImage, hParent, TVI_SORT);
	
	_Conformity conf; 
	conf.hItem = hItem;
	conf.wptree = tree;
	m_vConfs.add (conf);

	SetItemData (hItem, (DWORD)tree);

	
	for (int i = 0; i < tree->GetLeafCount (); i++)
		AddTree (tree->GetLeaf (i), hItem);

	Expand (hItem, TVE_EXPAND);
}
Example #3
0
void CDownloads_Deleted::UpdateDownload(int iItem)
{
	vmsDownloadSmartPtr dld = (fsDownload*)GetItemData (iItem);

	CHAR szFile [10000];	
	CDownloads_Tasks::GetFileName (dld, szFile);
	lstrcat (szFile, " (");
	lstrcat (szFile, dld->pMgr->get_URL ());
	lstrcat (szFile, ")");
	SetItemText (iItem, 0, szFile);

	int cSects = dld->pMgr->GetNumberOfSections ();
	UINT64 uSize = dld->pMgr->GetLDFileSize ();
	UINT64 uDone = 0;

	
	SetItemImage (iItem, GetDownloadImage (dld));

	
	
	
	
	uDone = dld->pMgr->GetDownloadedBytesCount ();

	CString str;
	CHAR szDim [10];
	float val;

	

	if (cSects)
	{
		

		if (uSize != _UI64_MAX)
		{
			if (_pwndDownloads->IsSizesInBytes () == FALSE)
			{
				
				BytesToXBytes (uSize, &val, szDim);
				str.Format ("%.*g %s", val > 999 ? 4 : 3, val, szDim);
			}
			else
			{
				
				
				str = fsBytesToStr (uSize);
			}
			SetItemText (iItem, 1, str);
		}
		else
			SetItemText (iItem, 1, "?");	

		

		if (_pwndDownloads->IsSizesInBytes () == FALSE)
		{
			BytesToXBytes (uDone, &val, szDim);
			if (uSize != _UI64_MAX)
				str.Format ("%d%% [%.*g %s]", (int)((double)(INT64)uDone / (INT64)uSize * 100), val > 999 ? 4 : 3, val, szDim);
			else
				str.Format ("%.*g %s", val > 999 ? 4 : 3, val, szDim);
		}
		else
		{
			CString s = fsBytesToStr (uDone);
			if (uSize != _UI64_MAX)
				str.Format ("%d%% [%s]", (int)((double)(INT64)uDone / (INT64)uSize * 100), s);
			else
				str = s;
		}
		SetItemText (iItem, 2, str);
	}
	else
	{
		SetItemText (iItem, 1, "");
		SetItemText (iItem, 2, "");
	}

	

	str.Format ("%d", cSects);
	SetItemText (iItem, 3, str);

	
	str = dld->strComment;
	str.Replace ("\r", " ");
	str.Replace ("\n", " ");
	SetItemText (iItem, 4, str);
}