Index: src/ch/FileInfo.cpp =================================================================== diff -u -r22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1 -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/FileInfo.cpp (.../FileInfo.cpp) (revision 22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1) +++ src/ch/FileInfo.cpp (.../FileInfo.cpp) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -88,6 +88,14 @@ m_iBufferIndex=BI_DEFAULT; } +CString CClipboardEntry::GetFileName() const +{ + TCHAR szName[_MAX_FNAME]; + TCHAR szExt[_MAX_EXT]; + _tsplitpath(m_strPath, NULL, NULL, szName, szExt); + return CString(szName) + szExt; +} + void CClipboardEntry::AddDestinationPath(const CString& strPath) { m_vDstPaths.push_back(strPath); Index: src/ch/FileInfo.h =================================================================== diff -u -rb13e3052f13b2f0a8c53c37a7b9246418b88bebd -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/FileInfo.h (.../FileInfo.h) (revision b13e3052f13b2f0a8c53c37a7b9246418b88bebd) +++ src/ch/FileInfo.h (.../FileInfo.h) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -45,6 +45,7 @@ void SetPath(const CString& strPath); void CalcBufferIndex(const CDestPath& dpDestPath); const CString& GetPath() const { return m_strPath; } + CString GetFileName() const; void SetMove(bool bValue) { m_bMove=bValue; } bool GetMove() { return m_bMove; } Index: src/ch/MiniViewDlg.cpp =================================================================== diff -u -r22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1 -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision 22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1) +++ src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -184,24 +184,24 @@ for(size_t stIndex = 0; stIndex < m_pTasks->GetSize(); ++stIndex) { CTaskPtr spTask = m_pTasks->GetAt(stIndex); - spTask->GetMiniSnapshot(&dd); + spTask->GetMiniSnapshot(&m_tMiniDisplayData); - if((dd.m_uiStatus & ST_STEP_MASK) != ST_FINISHED && (dd.m_uiStatus & ST_STEP_MASK) != ST_CANCELLED) + if((m_tMiniDisplayData.m_uiStatus & ST_STEP_MASK) != ST_FINISHED && (m_tMiniDisplayData.m_uiStatus & ST_STEP_MASK) != ST_CANCELLED) { pItem = m_ctlStatus.GetItemAddress(index++); // load - if ((dd.m_uiStatus & ST_WORKING_MASK) == ST_ERROR) + if ((m_tMiniDisplayData.m_uiStatus & ST_WORKING_MASK) == ST_ERROR) pItem->m_crColor=RGB(255, 0, 0); - else if ((dd.m_uiStatus & ST_WORKING_MASK) == ST_PAUSED) + else if ((m_tMiniDisplayData.m_uiStatus & ST_WORKING_MASK) == ST_PAUSED) pItem->m_crColor=RGB(255, 255, 0); - else if ((dd.m_uiStatus & ST_WAITING_MASK) == ST_WAITING) + else if ((m_tMiniDisplayData.m_uiStatus & ST_WAITING_MASK) == ST_WAITING) pItem->m_crColor=RGB(50, 50, 50); else pItem->m_crColor=RGB(0, 255, 0); - pItem->m_strText = dd.m_spFileInfo->GetFileName(); - pItem->m_uiPos=dd.m_nPercent; + pItem->m_strText = m_tMiniDisplayData.m_strPath; + pItem->m_uiPos=m_tMiniDisplayData.m_nPercent; pItem->m_spTask = spTask; } } Index: src/ch/MiniViewDlg.h =================================================================== diff -u -r449a5b399ab21ca0d06050b47b264f2f704af966 -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/MiniViewDlg.h (.../MiniViewDlg.h) (revision 449a5b399ab21ca0d06050b47b264f2f704af966) +++ src/ch/MiniViewDlg.h (.../MiniViewDlg.h) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -73,7 +73,7 @@ _PROGRESSITEM_ item; // cache - TASK_MINI_DISPLAY_DATA dd; + TASK_MINI_DISPLAY_DATA m_tMiniDisplayData; bool m_bActive; // lock Index: src/ch/StatusDlg.cpp =================================================================== diff -u -r22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1 -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -252,7 +252,7 @@ // status subitem lvi.mask=LVIF_TEXT; lvi.iSubItem=1; - m_strTemp=td.m_spFileInfo->GetFileName(); + m_strTemp = td.m_strFileName; lvi.pszText=m_strTemp.GetBuffer(0); m_strTemp.ReleaseBuffer(); lvi.cchTextMax=lstrlen(lvi.pszText); @@ -279,7 +279,7 @@ { // data that can be changed by a thread GetDlgItem(IDC_OPERATION_STATIC)->SetWindowText(td.m_szStatusText); // operation - GetDlgItem(IDC_SOURCE_STATIC)->SetWindowText(td.m_spFileInfo->GetFullFilePath()); // src object + GetDlgItem(IDC_SOURCE_STATIC)->SetWindowText(td.m_strFullFilePath); // src object // error message if ( (td.m_uiStatus & ST_WORKING_MASK) == ST_ERROR ) Index: src/ch/task.cpp =================================================================== diff -u -r074c36e6d7abda459bfbca0a8bf98ae531fbc1aa -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/task.cpp (.../task.cpp) (revision 074c36e6d7abda459bfbca0a8bf98ae531fbc1aa) +++ src/ch/task.cpp (.../task.cpp) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -887,27 +887,17 @@ { boost::shared_lock lock(m_lock); if(m_stCurrentIndex >= 0 && m_stCurrentIndex < m_files.GetSize()) - pData->m_spFileInfo = m_files.GetAt(m_stCurrentIndex); + pData->m_strPath = m_files.GetAt(m_stCurrentIndex)->GetFileName(); else { if(m_files.GetSize() > 0) - { - pData->m_spFileInfo = m_files.GetAt(0); - pData->m_spFileInfo->SetFilePath(pData->m_spFileInfo->GetFullFilePath()); - pData->m_spFileInfo->SetSrcIndex(std::numeric_limits::max()); - } + pData->m_strPath = m_files.GetAt(0)->GetFileName(); else { if(m_clipboard.GetSize() > 0) - { - pData->m_spFileInfo->SetFilePath(m_clipboard.GetAt(0)->GetPath()); - pData->m_spFileInfo->SetSrcIndex(std::numeric_limits::max()); - } + pData->m_strPath = m_clipboard.GetAt(0)->GetFileName(); else - { - pData->m_spFileInfo->SetFilePath(GetResManager().LoadString(IDS_NONEINPUTFILE_STRING)); - pData->m_spFileInfo->SetSrcIndex(std::numeric_limits::max()); - } + pData->m_strPath = GetResManager().LoadString(IDS_NONEINPUTFILE_STRING); } } @@ -922,27 +912,29 @@ boost::unique_lock lock(m_lock); if(m_stCurrentIndex >= 0 && m_stCurrentIndex < m_files.GetSize()) - pData->m_spFileInfo = m_files.GetAt(m_stCurrentIndex); + { + pData->m_strFullFilePath = m_files.GetAt(m_stCurrentIndex)->GetFullFilePath(); + pData->m_strFileName = m_files.GetAt(m_stCurrentIndex)->GetFileName(); + } else { if(m_files.GetSize() > 0) - { - pData->m_spFileInfo = m_files.GetAt(0); - pData->m_spFileInfo->SetFilePath(pData->m_spFileInfo->GetFullFilePath()); - pData->m_spFileInfo->SetSrcIndex(std::numeric_limits::max()); - } + { + pData->m_strFullFilePath = m_files.GetAt(0)->GetFullFilePath(); + pData->m_strFileName = m_files.GetAt(0)->GetFileName(); + } else { if(m_clipboard.GetSize() > 0) - { - pData->m_spFileInfo->SetFilePath(m_clipboard.GetAt(0)->GetPath()); - pData->m_spFileInfo->SetSrcIndex(std::numeric_limits::max()); - } + { + pData->m_strFullFilePath = m_clipboard.GetAt(0)->GetPath(); + pData->m_strFileName = m_clipboard.GetAt(0)->GetFileName(); + } else - { - pData->m_spFileInfo->SetFilePath(GetResManager().LoadString(IDS_NONEINPUTFILE_STRING)); - pData->m_spFileInfo->SetSrcIndex(std::numeric_limits::max()); - } + { + pData->m_strFullFilePath = GetResManager().LoadString(IDS_NONEINPUTFILE_STRING); + pData->m_strFileName = pData->m_strFullFilePath; + } } } @@ -2316,22 +2308,15 @@ pTask->m_log.init(strPath.c_str(), 262144, icpf::log_file::level_debug, false, false); + pTask->OnBeginOperation(); + // set thread boost HANDLE hThread=GetCurrentThread(); ::SetThreadPriorityBoost(hThread, GetConfig().get_bool(PP_CMDISABLEPRIORITYBOOST)); CTime tm=CTime::GetCurrentTime(); ictranslate::CFormat fmt; - fmt.SetFormat(_T("\r\n# COPYING THREAD STARTED #\r\nBegan processing data (dd:mm:yyyy) %day.%month.%year at %hour:%minute.%second")); - fmt.SetParam(_t("%year"), tm.GetYear()); - fmt.SetParam(_t("%month"), tm.GetMonth()); - fmt.SetParam(_t("%day"), tm.GetDay()); - fmt.SetParam(_t("%hour"), tm.GetHour()); - fmt.SetParam(_t("%minute"), tm.GetMinute()); - fmt.SetParam(_t("%second"), tm.GetSecond()); - pTask->m_log.logi(fmt); - try { // to make the value stable @@ -2434,15 +2419,7 @@ // play sound piFeedbackHandler->RequestFeedback(CFeedbackHandler::eFT_OperationFinished, NULL); - tm=CTime::GetCurrentTime(); - fmt.SetFormat(_T("Finished processing data (dd:mm:yyyy) %day.%month.%year at %hour:%minute.%second")); - fmt.SetParam(_t("%year"), tm.GetYear()); - fmt.SetParam(_t("%month"), tm.GetMonth()); - fmt.SetParam(_t("%day"), tm.GetDay()); - fmt.SetParam(_t("%hour"), tm.GetHour()); - fmt.SetParam(_t("%minute"), tm.GetMinute()); - fmt.SetParam(_t("%second"), tm.GetSecond()); - pTask->m_log.logi(fmt); + pTask->OnEndOperation(); // we have been killed - the last operation pTask->CleanupAfterKill(); @@ -2502,8 +2479,11 @@ pTask->m_localStats.MarkTaskAsNotRunning(); pTask->SetContinueFlag(false); pTask->SetForceFlag(false); - pTask->SetKilledFlag(); + + pTask->OnEndOperation(); + pTask->CleanupAfterKill(); + pTask->SetKilledFlag(); delete e; @@ -2513,6 +2493,36 @@ return 0; } +void CTask::OnBeginOperation() +{ + CTime tm=CTime::GetCurrentTime(); + + ictranslate::CFormat fmt; + fmt.SetFormat(_T("\r\n# COPYING THREAD STARTED #\r\nBegan processing data (dd:mm:yyyy) %day.%month.%year at %hour:%minute.%second")); + fmt.SetParam(_t("%year"), tm.GetYear()); + fmt.SetParam(_t("%month"), tm.GetMonth()); + fmt.SetParam(_t("%day"), tm.GetDay()); + fmt.SetParam(_t("%hour"), tm.GetHour()); + fmt.SetParam(_t("%minute"), tm.GetMinute()); + fmt.SetParam(_t("%second"), tm.GetSecond()); + m_log.logi(fmt); +} + +void CTask::OnEndOperation() +{ + CTime tm=CTime::GetCurrentTime(); + + ictranslate::CFormat fmt; + fmt.SetFormat(_T("Finished processing data (dd:mm:yyyy) %day.%month.%year at %hour:%minute.%second")); + fmt.SetParam(_t("%year"), tm.GetYear()); + fmt.SetParam(_t("%month"), tm.GetMonth()); + fmt.SetParam(_t("%day"), tm.GetDay()); + fmt.SetParam(_t("%hour"), tm.GetHour()); + fmt.SetParam(_t("%minute"), tm.GetMinute()); + fmt.SetParam(_t("%second"), tm.GetSecond()); + m_log.logi(fmt); +} + //////////////////////////////////////////////////////////////////////////////// // CTaskArray members CTaskArray::CTaskArray() : Index: src/ch/task.h =================================================================== diff -u -r074c36e6d7abda459bfbca0a8bf98ae531fbc1aa -r22573f5fa8bfbf68a19deb7631962e026f028045 --- src/ch/task.h (.../task.h) (revision 074c36e6d7abda459bfbca0a8bf98ae531fbc1aa) +++ src/ch/task.h (.../task.h) (revision 22573f5fa8bfbf68a19deb7631962e026f028045) @@ -72,7 +72,9 @@ // structure for getting status of a task struct TASK_DISPLAY_DATA { - CFileInfoPtr m_spFileInfo; // fi at CurrIndex + CString m_strFullFilePath; + CString m_strFileName; + //CFileInfoPtr m_spFileInfo; // fi at CurrIndex int m_iCurrentBufferIndex; size_t m_stIndex; size_t m_stSize; @@ -103,10 +105,11 @@ struct TASK_MINI_DISPLAY_DATA { - CFileInfoPtr m_spFileInfo; // fi at CurrIndex + CString m_strPath; +// CFileInfoPtr m_spFileInfo; // fi at CurrIndex - UINT m_uiStatus; - int m_nPercent; + UINT m_uiStatus; + int m_nPercent; }; struct CUSTOM_COPY_PARAMS @@ -396,6 +399,10 @@ protected: static UINT ThrdProc(LPVOID pParam); + + void OnBeginOperation(); + void OnEndOperation(); + void CheckForWaitState(); void ProcessFiles(); void CustomCopyFile(CUSTOM_COPY_PARAMS* pData);