Ejemplo n.º 1
0
void CFileDetailDialog::UpdateData()
{
	wxString bufferS;
	CastChild(IDC_FNAME,wxStaticText)->SetLabel(MakeStringEscaped(
		TruncateFilename(m_file->GetFileName(),60)));
	CastChild(IDC_METFILE,wxStaticText)->SetLabel(MakeStringEscaped(
		TruncateFilename(m_file->GetFullName(),60,true)));

	wxString tmp = CastChild(IDC_FILENAME, wxTextCtrl)->GetValue();
	if (tmp.Length() < 3) {
		resetValueForFilenameTextEdit();
	}

	CastChild(IDC_FHASH,wxStaticText)->SetLabel(m_file->GetFileHash().Encode());
	bufferS = wxString::Format(wxT("%llu bytes ("), m_file->GetFileSize())
			+ CastItoXBytes(m_file->GetFileSize())
			+ wxT(")");
	CastChild(IDC_FSIZE,wxControl)->SetLabel(bufferS);
	CastChild(IDC_PFSTATUS,wxControl)->SetLabel(m_file->getPartfileStatus());
	bufferS = wxString::Format(wxT("%i (%i)"),m_file->GetPartCount(),m_file->GetHashCount());
	CastChild(IDC_PARTCOUNT,wxControl)->SetLabel(bufferS);
	CastChild(IDC_TRANSFERRED,wxControl)->SetLabel(CastItoXBytes(m_file->GetTransferred()));
	CastChild(IDC_FD_STATS1,wxControl)->SetLabel(CastItoXBytes(m_file->GetLostDueToCorruption()));
	CastChild(IDC_FD_STATS2,wxControl)->SetLabel(CastItoXBytes(m_file->GetGainDueToCompression()));
	CastChild(IDC_FD_STATS3,wxControl)->SetLabel(CastItoIShort(m_file->TotalPacketsSavedDueToICH()));
	CastChild(IDC_COMPLSIZE,wxControl)->SetLabel(CastItoXBytes(m_file->GetCompletedSize()));
	bufferS = wxString::Format(_("%.2f%% done"),m_file->GetPercentCompleted());
	CastChild(IDC_PROCCOMPL,wxControl)->SetLabel(bufferS);
	bufferS = wxString::Format(_("%.2f kB/s"),(float)m_file->GetKBpsDown());
	CastChild(IDC_DATARATE,wxControl)->SetLabel(bufferS);
	bufferS = wxString::Format(wxT("%i"),m_file->GetSourceCount());
	CastChild(IDC_SOURCECOUNT,wxControl)->SetLabel(bufferS);
	bufferS = wxString::Format(wxT("%i"),m_file->GetTransferingSrcCount());
	CastChild(IDC_SOURCECOUNT2,wxControl)->SetLabel(bufferS);
	bufferS = wxString::Format(wxT("%i (%.1f%%)"),
		m_file->GetAvailablePartCount(),
		((m_file->GetAvailablePartCount() * 100.0f)/ m_file->GetPartCount()));
	CastChild(IDC_PARTAVAILABLE,wxControl)->SetLabel(bufferS);
	bufferS = CastSecondsToHM(m_file->GetDlActiveTime());
	CastChild(IDC_DLACTIVETIME, wxControl)->SetLabel(bufferS);
	
	if (m_file->lastseencomplete==0) {
		bufferS = wxString(_("Unknown")).MakeLower();
	} else {
		wxDateTime last_seen(m_file->lastseencomplete);
		bufferS = last_seen.FormatISODate() + wxT(" ") + last_seen.FormatISOTime();
	}

	CastChild(IDC_LASTSEENCOMPL,wxControl)->SetLabel(bufferS);
	setEnableForApplyButton();
	// disable "Show all comments" button if there are no comments
	FileRatingList list;
	m_file->GetRatingAndComments(list);
	CastChild(IDC_CMTBT, wxControl)->Enable(!list.empty());
	FillSourcenameList();
	Layout();
}
Ejemplo n.º 2
0
void CFileDetailDialogName::RefreshData()
{
	bool bEnableRename = CanRenameFile();
	GetDlgItem(IDC_FILENAME)->EnableWindow(bEnableRename);
	GetDlgItem(IDC_BUTTONSTRIP)->EnableWindow(bEnableRename);
	GetDlgItem(IDC_TAKEOVER)->EnableWindow(bEnableRename);

	FillSourcenameList();
}
Ejemplo n.º 3
0
BOOL CFileDetailDialogName::OnCommand(WPARAM wParam,LPARAM lParam )
{
	int iSel = m_listFileNames.GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED);
	if (iSel != -1)
	{
		switch (wParam)
		{
		case MP_MESSAGE:
			TakeOver();
			return true;
		case MP_COPYSELECTED:
			Copy();
			return true;
		case MP_RESTORE:
			FillSourcenameList();
			return true;
		}
	}
	return CResizablePage::OnCommand(wParam, lParam);
}