*** empty log message ***

svn path=/trunk/boinc/; revision=4397
This commit is contained in:
Rom Walton 2004-10-22 19:23:09 +00:00
parent 8c357f3b2f
commit 9a20ade026
5 changed files with 106 additions and 28 deletions

View File

@ -1203,3 +1203,33 @@ bool CMainDocument::IsTransferGeneratedLocally( wxInt32 iIndex )
return bRetVal; return bRetVal;
} }
wxInt32 CMainDocument::TransferRetryNow( wxInt32 iIndex )
{
FILE_TRANSFER* pFT = NULL;
wxInt32 iRetVal = 0;
if ( !ft.file_transfers.empty() )
pFT = ft.file_transfers.at( iIndex );
if ( NULL != pFT )
iRetVal = rpc.file_transfer_op( (*pFT), wxT("retry") );
return iRetVal;
}
wxInt32 CMainDocument::TransferAbort( wxInt32 iIndex )
{
FILE_TRANSFER* pFT = NULL;
wxInt32 iRetVal = 0;
if ( !ft.file_transfers.empty() )
pFT = ft.file_transfers.at( iIndex );
if ( NULL != pFT )
iRetVal = rpc.file_transfer_op( (*pFT), wxT("abort") );
return iRetVal;
}

View File

@ -193,10 +193,12 @@ public:
wxInt32 GetTransferTime( wxInt32 iIndex, float& fBuffer ); wxInt32 GetTransferTime( wxInt32 iIndex, float& fBuffer );
wxInt32 GetTransferNextRequestTime( wxInt32 iIndex, wxInt32& iBuffer ); wxInt32 GetTransferNextRequestTime( wxInt32 iIndex, wxInt32& iBuffer );
wxInt32 GetTransferStatus( wxInt32 iIndex, wxInt32& iBuffer ); wxInt32 GetTransferStatus( wxInt32 iIndex, wxInt32& iBuffer );
bool IsTransferActive( wxInt32 iIndex ); bool IsTransferActive( wxInt32 iIndex );
bool IsTransferGeneratedLocally( wxInt32 iIndex ); bool IsTransferGeneratedLocally( wxInt32 iIndex );
wxInt32 TransferRetryNow( wxInt32 iIndex );
wxInt32 TransferAbort( wxInt32 iIndex );
}; };
#endif #endif

View File

@ -316,19 +316,56 @@ wxString CViewTransfers::OnListGetItemText(long item, long column) const
void CViewTransfers::OnTaskLinkClicked( const wxHtmlLinkInfo& link ) void CViewTransfers::OnTaskLinkClicked( const wxHtmlLinkInfo& link )
{ {
wxInt32 iAnswer = 0;
wxInt32 iProjectIndex = 0;
wxInt32 iWebsiteIndex = 0;
wxString strName = wxEmptyString;
wxString strMessage = wxEmptyString;
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(NULL != pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pTaskPane);
wxASSERT(NULL != m_pListPane); wxASSERT(NULL != m_pListPane);
wxString strMessage; if ( link.GetHref() == SECTION_TASK )
if ( link.GetHref() == SECTION_TASK )
m_bTaskHeaderHidden ? m_bTaskHeaderHidden = false : m_bTaskHeaderHidden = true; m_bTaskHeaderHidden ? m_bTaskHeaderHidden = false : m_bTaskHeaderHidden = true;
else if ( link.GetHref() == LINK_TASKRETRY )
{
iProjectIndex = m_pListPane->GetFirstSelected();
if ( link.GetHref() == SECTION_TIPS ) pDoc->TransferRetryNow(
iProjectIndex
);
}
else if ( link.GetHref() == LINK_TASKABORT )
{
iProjectIndex = m_pListPane->GetFirstSelected();
pDoc->GetTransferFileName(iProjectIndex, strName);
strMessage.Printf(
_("Are you sure you wish to abort this file transfer '%s'?"),
strName.c_str());
iAnswer = wxMessageBox(
strMessage,
_("Abort File Transfer"),
wxYES_NO | wxICON_QUESTION,
this
);
if ( wxYES == iAnswer )
{
pDoc->TransferAbort(
iProjectIndex
);
}
}
else if ( link.GetHref() == SECTION_TIPS )
m_bTipsHeaderHidden ? m_bTipsHeaderHidden = false : m_bTipsHeaderHidden = true; m_bTipsHeaderHidden ? m_bTipsHeaderHidden = false : m_bTipsHeaderHidden = true;
UpdateSelection(); UpdateSelection();
m_pListPane->Refresh();
} }
@ -551,9 +588,10 @@ wxInt32 CViewTransfers::FormatSize( wxInt32 item, wxString& strBuffer ) const
wxInt32 CViewTransfers::FormatTime( wxInt32 item, wxString& strBuffer ) const wxInt32 CViewTransfers::FormatTime( wxInt32 item, wxString& strBuffer ) const
{ {
float fBuffer = 0; float fBuffer = 0;
int xhour = 0; wxInt32 iHour = 0;
int xmin = 0; wxInt32 iMin = 0;
int xsec = 0; wxInt32 iSec = 0;
wxTimeSpan ts;
CMainDocument* pDoc = wxGetApp().GetDocument(); CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(NULL != pDoc); wxASSERT(NULL != pDoc);
@ -563,11 +601,13 @@ wxInt32 CViewTransfers::FormatTime( wxInt32 item, wxString& strBuffer ) const
pDoc->GetTransferTime(item, fBuffer); pDoc->GetTransferTime(item, fBuffer);
xhour = (int)(fBuffer / (60 * 60)); iHour = (wxInt32)(fBuffer / (60 * 60));
xmin = (int)(fBuffer / 60) % 60; iMin = (wxInt32)(fBuffer / 60) % 60;
xsec = (int)(fBuffer) % 60; iSec = (wxInt32)(fBuffer) % 60;
strBuffer.Printf(wxT("%0.2d:%0.2d:%0.2d"), xhour, xmin, xsec); ts = wxTimeSpan( iHour, iMin, iSec );
strBuffer = ts.Format();
return 0; return 0;
} }

View File

@ -573,9 +573,10 @@ wxInt32 CViewWork::FormatName( wxInt32 item, wxString& strBuffer ) const
wxInt32 CViewWork::FormatCPUTime( wxInt32 item, wxString& strBuffer ) const wxInt32 CViewWork::FormatCPUTime( wxInt32 item, wxString& strBuffer ) const
{ {
float fBuffer = 0; float fBuffer = 0;
int cpuhour = 0; wxInt32 iHour = 0;
int cpumin = 0; wxInt32 iMin = 0;
int cpusec = 0; wxInt32 iSec = 0;
wxTimeSpan ts;
CMainDocument* pDoc = wxGetApp().GetDocument(); CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(NULL != pDoc); wxASSERT(NULL != pDoc);
@ -601,11 +602,13 @@ wxInt32 CViewWork::FormatCPUTime( wxInt32 item, wxString& strBuffer ) const
} }
else else
{ {
cpuhour = (int)(fBuffer / (60 * 60)); iHour = (wxInt32)(fBuffer / (60 * 60));
cpumin = (int)(fBuffer / 60) % 60; iMin = (wxInt32)(fBuffer / 60) % 60;
cpusec = (int)(fBuffer) % 60; iSec = (wxInt32)(fBuffer) % 60;
strBuffer.Printf(wxT("%0.2d:%0.2d:%0.2d"), cpuhour, cpumin, cpusec); ts = wxTimeSpan( iHour, iMin, iSec );
strBuffer = ts.Format();
} }
return 0; return 0;
@ -642,9 +645,10 @@ wxInt32 CViewWork::FormatProgress( wxInt32 item, wxString& strBuffer ) const
wxInt32 CViewWork::FormatTimeToCompletion( wxInt32 item, wxString& strBuffer ) const wxInt32 CViewWork::FormatTimeToCompletion( wxInt32 item, wxString& strBuffer ) const
{ {
float fBuffer = 0; float fBuffer = 0;
int cpuhour = 0; wxInt32 iHour = 0;
int cpumin = 0; wxInt32 iMin = 0;
int cpusec = 0; wxInt32 iSec = 0;
wxTimeSpan ts;
CMainDocument* pDoc = wxGetApp().GetDocument(); CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(NULL != pDoc); wxASSERT(NULL != pDoc);
@ -660,11 +664,13 @@ wxInt32 CViewWork::FormatTimeToCompletion( wxInt32 item, wxString& strBuffer ) c
} }
else else
{ {
cpuhour = (int)(fBuffer / (60 * 60)); iHour = (wxInt32)(fBuffer / (60 * 60));
cpumin = (int)(fBuffer / 60) % 60; iMin = (wxInt32)(fBuffer / 60) % 60;
cpusec = (int)(fBuffer) % 60; iSec = (wxInt32)(fBuffer) % 60;
strBuffer.Printf(wxT("%0.2d:%0.2d:%0.2d"), cpuhour, cpumin, cpusec); ts = wxTimeSpan( iHour, iMin, iSec );
strBuffer = ts.Format();
} }
return 0; return 0;

View File

@ -1317,7 +1317,7 @@ int RPC_CLIENT::file_transfer_op(FILE_TRANSFER& ft, char* op) {
" <filename>%s</filename>\n" " <filename>%s</filename>\n"
"</%s>\n", "</%s>\n",
tag, tag,
ft.project->master_url.c_str(), ft.project_url.c_str(),
ft.name.c_str(), ft.name.c_str(),
tag tag
); );