Index: src/ch/ClipboardMonitor.cpp =================================================================== diff -u -N -r4cd45795025411a82006a94d9c7f7f2d9ecda421 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 4cd45795025411a82006a94d9c7f7f2d9ecda421) +++ src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -70,9 +70,6 @@ // bufor TCHAR path[_MAX_PATH]; - CTaskPtr spTask; // ptr to a task - CClipboardEntryPtr spEntry; - // register clipboard format UINT nFormat=RegisterClipboardFormat(_T("Preferred DropEffect")); UINT uiCounter=0, uiShutCounter=0; @@ -88,19 +85,20 @@ UINT nCount=DragQueryFile(static_cast(handle), 0xffffffff, NULL, 0); - spTask = pData->m_pTasks->CreateTask(); + TTaskDefinition tTaskDefinition; - for (UINT i=0;i(handle), i, path, _MAX_PATH); - spEntry.reset(new CClipboardEntry); - spEntry->SetPath(path); - spTask->AddClipboardData(spEntry); + DragQueryFile(static_cast(handle), stIndex, path, _MAX_PATH); + + tTaskDefinition.AddSourcePath(path); } + // operation type EOperationType eOperation = eOperation_Copy; - if (IsClipboardFormatAvailable(nFormat)) + if(IsClipboardFormatAvailable(nFormat)) { handle=GetClipboardData(nFormat); LPVOID addr=GlobalLock(handle); @@ -116,22 +114,11 @@ else eOperation = eOperation_Copy; // default - copy - spTask->SetOperationType(eOperation); // copy + tTaskDefinition.SetOperationType(eOperation); // copy EmptyClipboard(); CloseClipboard(); - BUFFERSIZES bs; - bs.m_bOnlyDefault=rConfig.get_bool(PP_BFUSEONLYDEFAULT); - bs.m_uiDefaultSize=(UINT)rConfig.get_signed_num(PP_BFDEFAULT); - bs.m_uiOneDiskSize=(UINT)rConfig.get_signed_num(PP_BFONEDISK); - bs.m_uiTwoDisksSize=(UINT)rConfig.get_signed_num(PP_BFTWODISKS); - bs.m_uiCDSize=(UINT)rConfig.get_signed_num(PP_BFCD); - bs.m_uiLANSize=(UINT)rConfig.get_signed_num(PP_BFLAN); - - spTask->SetBufferSizes(&bs); - spTask->SetPriority(boost::numeric_cast(rConfig.get_signed_num(PP_CMDEFAULTPRIORITY))); - // get dest folder CFolderDialog dlg; @@ -169,11 +156,11 @@ dlg.m_bdData.strText = GetResManager().LoadString(IDS_MAINBROWSETEXT_STRING); // set count of data to display - size_t stClipboardSize = spTask->GetClipboardDataSize(); + size_t stClipboardSize = tTaskDefinition.GetSourcePathCount(); size_t stEntries = (stClipboardSize > 3) ? 2 : stClipboardSize; - for(size_t i = 0; i < stEntries; i++) + for(size_t stIndex = 0; stIndex < stEntries; stIndex++) { - dlg.m_bdData.strText += spTask->GetClipboardData(i)->GetPath() + _T("\n"); + dlg.m_bdData.strText += tTaskDefinition.GetSourcePathNameAt(stIndex) + _T("\n"); } // add ... @@ -203,15 +190,27 @@ rConfig.set_bool(PP_FDIGNORESHELLDIALOGS, dlg.m_bdData.bIgnoreDialogs); rConfig.write(NULL); - if(iResult != IDOK) - spTask.reset(); - else + if(iResult == IDOK) { // get dest path CString strData; dlg.GetPath(strData); - spTask->SetDestPath(strData); + tTaskDefinition.SetDestinationPath(strData); + CTaskPtr spTask = pData->m_pTasks->CreateTask(); + spTask->SetTaskDefinition(tTaskDefinition); + + BUFFERSIZES bs; + bs.m_bOnlyDefault=rConfig.get_bool(PP_BFUSEONLYDEFAULT); + bs.m_uiDefaultSize=(UINT)rConfig.get_signed_num(PP_BFDEFAULT); + bs.m_uiOneDiskSize=(UINT)rConfig.get_signed_num(PP_BFONEDISK); + bs.m_uiTwoDisksSize=(UINT)rConfig.get_signed_num(PP_BFTWODISKS); + bs.m_uiCDSize=(UINT)rConfig.get_signed_num(PP_BFCD); + bs.m_uiLANSize=(UINT)rConfig.get_signed_num(PP_BFLAN); + + spTask->SetBufferSizes(&bs); + spTask->SetPriority(boost::numeric_cast(rConfig.get_signed_num(PP_CMDEFAULTPRIORITY))); + // add task to a list of tasks and start pData->m_pTasks->Add(spTask); Index: src/ch/FileInfo.cpp =================================================================== diff -u -N -r9ece817722b8a0568f28c4ae238e6b46a0e85628 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/FileInfo.cpp (.../FileInfo.cpp) (revision 9ece817722b8a0568f28c4ae238e6b46a0e85628) +++ src/ch/FileInfo.cpp (.../FileInfo.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -122,11 +122,30 @@ ////////////////////////////////////////////////////////////////////////////// // CClipboardArray +CClipboardArray::CClipboardArray() +{ +} + CClipboardArray::~CClipboardArray() { RemoveAll(); } +CClipboardArray::CClipboardArray(const CClipboardArray& rSrc) : + m_vEntries(rSrc.m_vEntries) +{ +} + +CClipboardArray& CClipboardArray::operator=(const CClipboardArray& rSrc) +{ + if(this != &rSrc) + { + m_vEntries = rSrc.m_vEntries; + } + + return *this; +} + CClipboardEntryPtr CClipboardArray::GetAt(size_t stPos) const { boost::shared_lock lock(m_lock); Index: src/ch/FileInfo.h =================================================================== diff -u -N -r0c8e64ca71144467eed1f1d6c32d59bc2150a004 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/FileInfo.h (.../FileInfo.h) (revision 0c8e64ca71144467eed1f1d6c32d59bc2150a004) +++ src/ch/FileInfo.h (.../FileInfo.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -88,8 +88,12 @@ class CClipboardArray { public: + CClipboardArray(); + CClipboardArray(const CClipboardArray& rSrc); ~CClipboardArray(); + CClipboardArray& operator=(const CClipboardArray& rSrc); + template void Store(Archive& ar, unsigned int /*uiVersion*/, bool bData) const { Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -r2996cfa8b8db93f1b06a4e5f142ab74a23f67235 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 2996cfa8b8db93f1b06a4e5f142ab74a23f67235) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -505,26 +505,25 @@ } // create new task - CTaskPtr spTask = m_tasks.CreateTask(); - spTask->SetDestPath(strDstPath); - CClipboardEntryPtr spEntry; + TTaskDefinition tTaskDefinition; + tTaskDefinition.SetDestinationPath(strDstPath); // files for(int i = 0; i < astrFiles.GetSize(); i++) { - spEntry.reset(new CClipboardEntry); - spEntry->SetPath(astrFiles.GetAt(i)); - spTask->AddClipboardData(spEntry); + tTaskDefinition.AddSourcePath(astrFiles.GetAt(i)); } - spTask->SetOperationType(bMove ? eOperation_Move : eOperation_Copy); + tTaskDefinition.SetOperationType(bMove ? eOperation_Move : eOperation_Copy); - // special status TTaskBasicConfiguration tTaskConfig; tTaskConfig.SetCreateEmptyFiles(bOnlyCreate != FALSE); tTaskConfig.SetCreateOnlyDirectories(bForceDirectories != FALSE); tTaskConfig.SetIgnoreDirectories(bIgnoreDirs != FALSE); + CTaskPtr spTask = m_tasks.CreateTask(); + + spTask->SetTaskDefinition(tTaskDefinition); spTask->SetTaskBasicConfiguration(tTaskConfig); // set some stuff related with task @@ -591,19 +590,23 @@ rConfig.set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); } - // new task - CTaskPtr spTask = m_tasks.CreateTask(); - spTask->SetDestPath(dlg.m_ccData.m_strDestPath); - CClipboardEntryPtr spEntry; - for (int i=0;iSetPath(dlg.m_ccData.m_astrPaths.GetAt(i)); - spTask->AddClipboardData(spEntry); + tTaskDefinition.AddSourcePath(dlg.m_ccData.m_astrPaths.GetAt(iIndex)); } - - spTask->SetOperationType((dlg.m_ccData.m_iOperation == 1) ? eOperation_Move : eOperation_Copy); + // new task + CTaskPtr spTask = m_tasks.CreateTask(); + + spTask->SetTaskDefinition(tTaskDefinition); + // special status TTaskBasicConfiguration tTaskConfig; tTaskConfig.SetCreateEmptyFiles(dlg.m_ccData.m_bCreateStructure); Index: src/ch/ReplacePathsDlg.cpp =================================================================== diff -u -N --- src/ch/ReplacePathsDlg.cpp (revision c435ab507c8b8280264188b49e9ada56d46c0261) +++ src/ch/ReplacePathsDlg.cpp (revision 0) @@ -1,121 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2001-2008 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ -#include "stdafx.h" -#include "resource.h" -#include "task.h" -#include "ReplacePathsDlg.h" -#include "dialogs.h" -#include "ch.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CReplacePathsDlg dialog - - -CReplacePathsDlg::CReplacePathsDlg() - : ictranslate::CLanguageDialog(CReplacePathsDlg::IDD) -{ - //{{AFX_DATA_INIT(CReplacePathsDlg) - m_strDest = _T(""); - m_strSource = _T(""); - //}}AFX_DATA_INIT -} - - -void CReplacePathsDlg::DoDataExchange(CDataExchange* pDX) -{ - CLanguageDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CReplacePathsDlg) - DDX_Control(pDX, IDC_PATHS_LIST, m_ctlPathsList); - DDX_Text(pDX, IDC_DESTINATION_EDIT, m_strDest); - DDX_Text(pDX, IDC_SOURCE_EDIT, m_strSource); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CReplacePathsDlg,ictranslate::CLanguageDialog) - //{{AFX_MSG_MAP(CReplacePathsDlg) - ON_LBN_SELCHANGE(IDC_PATHS_LIST, OnSelchangePathsList) - ON_BN_CLICKED(IDC_BROWSE_BUTTON, OnBrowseButton) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CReplacePathsDlg message handlers - -BOOL CReplacePathsDlg::OnInitDialog() -{ - CLanguageDialog::OnInitDialog(); - - AddResizableControl(IDC_001_STATIC, 0.0, 0.0, 1.0, 0.0); - AddResizableControl(IDC_PATHS_LIST, 0.0, 0.0, 1.0, 1.0); - AddResizableControl(IDC_SOURCE_EDIT, 0.0, 1.0, 1.0, 0.0); - - AddResizableControl(IDC_002_STATIC, 0.0, 1.0, 1.0, 0.0); - - AddResizableControl(IDC_DESTINATION_EDIT, 0.0, 1.0, 1.0, 0.0); - AddResizableControl(IDC_BROWSE_BUTTON, 1.0, 1.0, 0.0, 0.0); - AddResizableControl(IDOK, 1.0, 1.0, 0.0, 0.0); - AddResizableControl(IDCANCEL, 1.0, 1.0, 0.0, 0.0); - AddResizableControl(IDC_HELP_BUTTON, 1.0, 1.0, 0.0, 0.0); - - InitializeResizableControls(); - - for(size_t stIndex = 0; stIndex < m_spTask->GetClipboardDataSize(); ++stIndex) - { - m_ctlPathsList.AddString(m_spTask->GetClipboardData(stIndex)->GetPath()); - } - - return TRUE; -} - -void CReplacePathsDlg::OnSelchangePathsList() -{ - int iSel=m_ctlPathsList.GetCurSel(); - if (iSel == LB_ERR) - return; - - m_ctlPathsList.GetText(iSel, m_strSource); - UpdateData(FALSE); -} - -void CReplacePathsDlg::OnOK() -{ - UpdateData(TRUE); - if (m_strSource.IsEmpty()) - MsgBox(IDS_SOURCESTRINGMISSING_STRING); - else - CLanguageDialog::OnOK(); -} - -void CReplacePathsDlg::OnBrowseButton() -{ - CString strPath; - if (BrowseForFolder(GetResManager().LoadString(IDS_BROWSE_STRING), &strPath)) - { - UpdateData(TRUE); - m_strDest=strPath; - UpdateData(FALSE); - } -} Index: src/ch/ReplacePathsDlg.h =================================================================== diff -u -N --- src/ch/ReplacePathsDlg.h (revision f703b71b8c856e2538283555e9fdbc84918677c3) +++ src/ch/ReplacePathsDlg.h (revision 0) @@ -1,66 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2001-2008 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ -#ifndef __REPLACEPATHSDLG_H__ -#define __REPLACEPATHSDLG_H__ - -class CTask; - -///////////////////////////////////////////////////////////////////////////// -// CReplacePathsDlg dialog - -class CReplacePathsDlg : public ictranslate::CLanguageDialog -{ -// Construction -public: - CReplacePathsDlg(); // standard constructor - - CTaskPtr m_spTask; -// Dialog Data - //{{AFX_DATA(CReplacePathsDlg) - enum { IDD = IDD_REPLACE_PATHS_DIALOG }; - CListBox m_ctlPathsList; - CString m_strDest; - CString m_strSource; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CReplacePathsDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CReplacePathsDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnSelchangePathsList(); - virtual void OnOK(); - afx_msg void OnBrowseButton(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif Index: src/ch/StatusDlg.cpp =================================================================== diff -u -N -r61ed5f2f3084ba759ec27f61b4f909ed8ce305e9 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 61ed5f2f3084ba759ec27f61b4f909ed8ce305e9) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -21,7 +21,6 @@ #include "resource.h" #include "StatusDlg.h" #include "BufferSizeDlg.h" -#include "ReplacePathsDlg.h" #include "StringHelpers.h" #include "StaticEx.h" #include "Structs.h" @@ -82,8 +81,6 @@ ON_BN_CLICKED(IDC_REMOVE_FINISHED_BUTTON, OnRemoveFinishedButton) ON_NOTIFY(LVN_KEYDOWN, IDC_STATUS_LIST, OnKeydownStatusList) ON_NOTIFY(LVN_CHANGEDSELECTION, IDC_STATUS_LIST, OnSelectionChanged) - ON_BN_CLICKED(IDC_ADVANCED_BUTTON, OnAdvancedButton) - ON_COMMAND(ID_POPUP_REPLACE_PATHS, OnPopupReplacePaths) ON_BN_CLICKED(IDC_SHOW_LOG_BUTTON, OnShowLogButton) ON_BN_CLICKED(IDC_STICK_BUTTON, OnStickButton) ON_BN_CLICKED(IDC_RESUME_BUTTON, OnResumeButton) @@ -254,7 +251,7 @@ // insert 'file' subitem lvi.iSubItem=2; - m_strTemp=td.m_pdpDestPath->GetPath(); + m_strTemp=td.m_strDstPath; lvi.pszText=m_strTemp.GetBuffer(0); m_strTemp.ReleaseBuffer(); lvi.cchTextMax=lstrlen(lvi.pszText); @@ -317,9 +314,9 @@ // refresh only when there are new selected item // if (spTask != m_spLastSelected) { - GetDlgItem(IDC_DESTINATION_STATIC)->SetWindowText(td.m_pdpDestPath->GetPath()); + GetDlgItem(IDC_DESTINATION_STATIC)->SetWindowText(td.m_strDstPath); GetDlgItem(IDC_PRIORITY_STATIC)->SetWindowText(GetResManager().LoadString(IDS_PRIORITY0_STRING+PriorityToIndex(td.m_nPriority))); - GetDlgItem(IDC_ASSOCIATEDFILES__STATIC)->SetWindowText(*td.m_pstrUniqueName+_T(".atd (.atp, .log)")); + GetDlgItem(IDC_ASSOCIATEDFILES__STATIC)->SetWindowText(td.m_strUniqueName + _T(".atd (.atp, .log)")); } // refresh m_spLastSelected @@ -767,66 +764,6 @@ CLanguageDialog::OnCancel(); } -void CStatusDlg::OnAdvancedButton() -{ - CMenu menu; - HMENU hMenu=GetResManager().LoadMenu(MAKEINTRESOURCE(IDR_ADVANCED_MENU)); - if (!menu.Attach(hMenu)) - { - DestroyMenu(hMenu); - return; - } - - CMenu* pPopup = menu.GetSubMenu(0); - ASSERT(pPopup != NULL); - if(pPopup) - { - // get the point to show menu at - CRect rect; - GetDlgItem(IDC_ADVANCED_BUTTON)->GetWindowRect(&rect); - - pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.right+1, rect.top, this); - } -} - -void CStatusDlg::OnPopupReplacePaths() -{ - // check if there's a selection currently - if ( (m_spSelectedItem=GetSelectedItemPointer()) != NULL ) - { - if (m_spSelectedItem->GetTaskState() == eTaskState_Paused) - { - bool bContinue=false; - if (m_spSelectedItem->GetTaskState() == eTaskState_Error) - { - m_spSelectedItem->PauseProcessing(); - bContinue=true; - } - - // assuming here that there's selection and task is paused - CReplacePathsDlg dlg; - dlg.m_spTask=m_spSelectedItem; - if (dlg.DoModal() == IDOK) - { - // change 'no case' - int iClipboard=m_spSelectedItem->ReplaceClipboardStrings(dlg.m_strSource, dlg.m_strDest); - - ictranslate::CFormat fmt(GetResManager().LoadString(IDS_REPLACEPATHSTEXT_STRING)); - fmt.SetParam(_t("%count"), iClipboard); - AfxMessageBox(fmt); - } - - // resume if earlier was an error - if (bContinue) - m_spSelectedItem->ResumeProcessing(); - } - else - MsgBox(IDS_TASKNOTPAUSED_STRING); - } - else - MsgBox(IDS_TASKNOTSELECTED_STRING); -} - void CStatusDlg::OnShowLogButton() { // show log @@ -835,10 +772,10 @@ return; unsigned long lResult = (unsigned long)(ShellExecute(this->m_hWnd, _T("open"), _T("notepad.exe"), - CString(spTask->GetTaskPath()) + spTask->GetUniqueName() + _T(".log"), NULL, SW_SHOWNORMAL)); + CString(spTask->GetTaskPath()) + spTask->GetTaskDefinition().GetTaskUniqueID() + _T(".log"), NULL, SW_SHOWNORMAL)); if(lResult < 32) { - CString str = CString(spTask->GetTaskPath()) + spTask->GetUniqueName()+_T(".log"); + CString str = CString(spTask->GetTaskPath()) + spTask->GetTaskDefinition().GetTaskUniqueID()+_T(".log"); ictranslate::CFormat fmt(GetResManager().LoadString(IDS_SHELLEXECUTEERROR_STRING)); fmt.SetParam(_t("%errno"), lResult); fmt.SetParam(_t("%path"), str); @@ -966,7 +903,6 @@ AddResizableControl(IDC_CANCEL_ALL_BUTTON, 0, 1.0, 0, 0); AddResizableControl(IDC_REMOVE_FINISHED_BUTTON, 0, 1.0, 0, 0); AddResizableControl(IDC_RESTART_ALL_BUTTON, 0, 1.0, 0, 0); - AddResizableControl(IDC_ADVANCED_BUTTON, 0, 1.0, 0, 0); AddResizableControl(IDC_STICK_BUTTON, 1.0, 1.0, 0, 0); Index: src/ch/StatusDlg.h =================================================================== diff -u -N -r61ed5f2f3084ba759ec27f61b4f909ed8ce305e9 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/StatusDlg.h (.../StatusDlg.h) (revision 61ed5f2f3084ba759ec27f61b4f909ed8ce305e9) +++ src/ch/StatusDlg.h (.../StatusDlg.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -112,8 +112,6 @@ afx_msg void OnKeydownStatusList(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnSelectionChanged(NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/); virtual void OnCancel(); - afx_msg void OnAdvancedButton(); - afx_msg void OnPopupReplacePaths(); afx_msg void OnShowLogButton(); afx_msg void OnStickButton(); afx_msg void OnResumeButton(); Index: src/ch/TTaskConfiguration.cpp =================================================================== diff -u -N -rb7709acbab26fdb108b77d3e08d3872f54248af2 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/TTaskConfiguration.cpp (.../TTaskConfiguration.cpp) (revision b7709acbab26fdb108b77d3e08d3872f54248af2) +++ src/ch/TTaskConfiguration.cpp (.../TTaskConfiguration.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -34,10 +34,33 @@ { } +TSubTaskCommonConfig::TSubTaskCommonConfig(const TSubTaskCommonConfig& rSrc) : + m_nPriority(THREAD_PRIORITY_NORMAL), + m_bDeleteAllFilesAfterAllCopyings(true), + m_bIgnoreReadOnlyAttributes(false) +{ + *this = rSrc; +} + TSubTaskCommonConfig::~TSubTaskCommonConfig() { } +TSubTaskCommonConfig& TSubTaskCommonConfig::operator=(const TSubTaskCommonConfig& rSrc) +{ + if(this != &rSrc) + { + boost::shared_lock src_lock(rSrc.m_lock); + boost::unique_lock lock(m_lock); + + m_nPriority = rSrc.m_nPriority; + m_bDeleteAllFilesAfterAllCopyings = rSrc.m_bDeleteAllFilesAfterAllCopyings; + m_bIgnoreReadOnlyAttributes = rSrc.m_bIgnoreReadOnlyAttributes; + } + + return *this; +} + void TSubTaskCommonConfig::SetPriority(int iPriority) { boost::unique_lock lock(m_lock); @@ -77,14 +100,34 @@ //////////////////////////////////////////////////////////////////////////// // class TSubTaskScanDirectoriesConfig -TSubTaskScanDirectoriesConfig::TSubTaskScanDirectoriesConfig() +TSubTaskScanDirectoriesConfig::TSubTaskScanDirectoriesConfig() : + m_afFilters() { } +TSubTaskScanDirectoriesConfig::TSubTaskScanDirectoriesConfig(const TSubTaskScanDirectoriesConfig& rSrc) : + m_afFilters() +{ + *this = rSrc; +} + TSubTaskScanDirectoriesConfig::~TSubTaskScanDirectoriesConfig() { } +TSubTaskScanDirectoriesConfig& TSubTaskScanDirectoriesConfig::operator=(const TSubTaskScanDirectoriesConfig& rSrc) +{ + if(this != &rSrc) + { + boost::shared_lock src_lock(rSrc.m_lock); + boost::unique_lock lock(m_lock); + + m_afFilters = rSrc.m_afFilters; + } + + return *this; +} + void TSubTaskScanDirectoriesConfig::SetFilters(const CFiltersArray& rFilters) { boost::unique_lock lock(m_lock); @@ -111,10 +154,39 @@ m_bsSizes.m_bOnlyDefault = false; } +TSubTaskCopyMoveConfig::TSubTaskCopyMoveConfig(const TSubTaskCopyMoveConfig& rSrc) : + m_bDisableSystemBuffering(false), + m_ullMinSizeToDisableBuffering(0), + m_bPreserveFileDateTime(false), + m_bPreserveFileAttributes(false), + m_bIgnoreDirectories(false), + m_bCreateEmptyFiles(false), + m_bCreateOnlyDirectories(false) +{ + *this = rSrc; +} + TSubTaskCopyMoveConfig::~TSubTaskCopyMoveConfig() { } +TSubTaskCopyMoveConfig& TSubTaskCopyMoveConfig::operator=(const TSubTaskCopyMoveConfig& rSrc) +{ + if(this != &rSrc) + { + m_bDisableSystemBuffering = rSrc.m_bDisableSystemBuffering; + m_ullMinSizeToDisableBuffering = rSrc.m_ullMinSizeToDisableBuffering; + m_bPreserveFileDateTime = rSrc.m_bPreserveFileDateTime; + m_bPreserveFileAttributes = rSrc.m_bPreserveFileAttributes; + m_bIgnoreDirectories = rSrc.m_bIgnoreDirectories; + m_bCreateEmptyFiles = rSrc.m_bCreateEmptyFiles; + m_bCreateOnlyDirectories = rSrc.m_bCreateOnlyDirectories; + m_bsSizes = rSrc.m_bsSizes; + } + + return *this; +} + void TSubTaskCopyMoveConfig::SetDisableSystemBuffering(bool bDisableBuffering) { boost::unique_lock lock(m_lock); Index: src/ch/TTaskConfiguration.h =================================================================== diff -u -N -rb7709acbab26fdb108b77d3e08d3872f54248af2 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision b7709acbab26fdb108b77d3e08d3872f54248af2) +++ src/ch/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -33,8 +33,11 @@ { public: TSubTaskCommonConfig(); + TSubTaskCommonConfig(const TSubTaskCommonConfig& rSrc); ~TSubTaskCommonConfig(); + TSubTaskCommonConfig& operator=(const TSubTaskCommonConfig& rSrc); + void SetPriority(int iPriority); int GetPriority() const; @@ -45,7 +48,7 @@ bool GetIgnoreReadOnlyAttributes() const; template - void load(Archive& ar) + void load(Archive& ar, unsigned int /*uiVersion*/) { boost::unique_lock lock(m_lock); @@ -55,7 +58,7 @@ } template - void save(Archive& ar) + void save(Archive& ar, unsigned int /*uiVersion*/) const { boost::shared_lock lock(m_lock); @@ -81,21 +84,24 @@ { public: TSubTaskScanDirectoriesConfig(); + TSubTaskScanDirectoriesConfig(const TSubTaskScanDirectoriesConfig& rSrc); ~TSubTaskScanDirectoriesConfig(); + TSubTaskScanDirectoriesConfig& operator=(const TSubTaskScanDirectoriesConfig& rSrc); + // filtering rules void SetFilters(const CFiltersArray& rFilters); const CFiltersArray& GetFilters() const { return m_afFilters; } template - void load(Archive& ar) + void load(Archive& ar, unsigned int /*uiVersion*/) { boost::unique_lock lock(m_lock); ar >> m_afFilters; } template - void save(Archive& ar) + void save(Archive& ar, unsigned int /*uiVersion*/) const { boost::shared_lock lock(m_lock); ar << m_afFilters; @@ -116,8 +122,11 @@ { public: TSubTaskCopyMoveConfig(); + TSubTaskCopyMoveConfig(const TSubTaskCopyMoveConfig& rSrc); ~TSubTaskCopyMoveConfig(); + TSubTaskCopyMoveConfig& operator=(const TSubTaskCopyMoveConfig& rSrc); + void SetDisableSystemBuffering(bool bDisableBuffering); bool GetDisableSystemBuffering() const; @@ -142,6 +151,44 @@ void SetCreateOnlyDirectories(bool bCreateOnlyDirs); bool GetCreateOnlyDirectories() const; + template + void load(Archive& ar, unsigned int /*uiVersion*/) + { + boost::unique_lock lock(m_lock); + + ar & m_bDisableSystemBuffering; + ar & m_ullMinSizeToDisableBuffering; + + ar & m_bPreserveFileDateTime; + ar & m_bPreserveFileAttributes; + + ar & m_bsSizes; + + ar & m_bIgnoreDirectories; + ar & m_bCreateEmptyFiles; + ar & m_bCreateOnlyDirectories; + } + + template + void save(Archive& ar, unsigned int /*uiVersion*/) const + { + boost::shared_lock lock(m_lock); + + ar & m_bDisableSystemBuffering; + ar & m_ullMinSizeToDisableBuffering; + + ar & m_bPreserveFileDateTime; + ar & m_bPreserveFileAttributes; + + ar & m_bsSizes; + + ar & m_bIgnoreDirectories; + ar & m_bCreateEmptyFiles; + ar & m_bCreateOnlyDirectories; + } + + BOOST_SERIALIZATION_SPLIT_MEMBER(); + private: bool m_bDisableSystemBuffering; ///< Disables system buffering of files unsigned long long m_ullMinSizeToDisableBuffering; ///< Minimal file size to disable system buffering @@ -183,6 +230,15 @@ const TSubTaskCopyMoveConfig& GetCopyMoveConfig() const { return m_tCopyMoveConfig; } // const TSubTaskDeleteConfig& GetDeleteConfig() const { return m_tDeleteConfig; } + template + void serialize(Archive& ar, unsigned int /*uiVersion*/) + { + ar & m_tCommonConfig; + ar & m_tScanDirectoriesConfig; + ar & m_tCopyMoveConfig; +// ar & m_tDeleteConfig; + } + private: TSubTaskCommonConfig m_tCommonConfig; TSubTaskScanDirectoriesConfig m_tScanDirectoriesConfig; Index: src/ch/TTaskDefinition.cpp =================================================================== diff -u -N -rb7709acbab26fdb108b77d3e08d3872f54248af2 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision b7709acbab26fdb108b77d3e08d3872f54248af2) +++ src/ch/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -49,14 +49,20 @@ m_arrSourcePaths.Add(spEntry); } -CString TTaskDefinition::GetSourcePathAt(size_t stIndex) const +CString TTaskDefinition::GetSourcePathNameAt(size_t stIndex) const { CClipboardEntryPtr spEntry = m_arrSourcePaths.GetAt(stIndex); if(spEntry) return spEntry->GetPath(); return CString(); } +CClipboardEntryPtr TTaskDefinition::GetSourcePathAt(size_t stIndex) const +{ + CClipboardEntryPtr spEntry = m_arrSourcePaths.GetAt(stIndex); + return spEntry; +} + size_t TTaskDefinition::GetSourcePathCount() const { return m_arrSourcePaths.GetSize(); @@ -67,6 +73,11 @@ m_arrSourcePaths.RemoveAll(); } +CClipboardArray& TTaskDefinition::GetSourcePaths() +{ + return m_arrSourcePaths; +} + void TTaskDefinition::SetDestinationPath(const CString& strPath) { m_tDestinationPath.SetPath(strPath); @@ -77,16 +88,31 @@ return m_tDestinationPath.GetPath(); } +const CDestPath& TTaskDefinition::GetDestPath() const +{ + return m_tDestinationPath; +} + void TTaskDefinition::SetOperationType(EOperationType eOperation) { m_tOperationPlan.SetOperationType(eOperation); } +CString TTaskDefinition::GetTaskUniqueID() const +{ + return m_strTaskUniqueID.c_str(); +} + EOperationType TTaskDefinition::GetOperationType() const { return m_tOperationPlan.GetOperationType(); } +const TOperationPlan& TTaskDefinition::GetOperationPlan() const +{ + return m_tOperationPlan; +} + TTaskConfiguration& TTaskDefinition::GetConfiguration() { return m_tOperationConfiguration; Index: src/ch/TTaskDefinition.h =================================================================== diff -u -N -rb7709acbab26fdb108b77d3e08d3872f54248af2 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/TTaskDefinition.h (.../TTaskDefinition.h) (revision b7709acbab26fdb108b77d3e08d3872f54248af2) +++ src/ch/TTaskDefinition.h (.../TTaskDefinition.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -37,46 +37,62 @@ // initialize object with data (get/set, from cfg file?, from string(cmd line options)) void AddSourcePath(const CString& strPath); - CString GetSourcePathAt(size_t stIndex) const; + CString GetSourcePathNameAt(size_t stIndex) const; + CClipboardEntryPtr GetSourcePathAt(size_t stIndex) const; size_t GetSourcePathCount() const; void ClearSourcePaths(); + CClipboardArray& GetSourcePaths(); void SetDestinationPath(const CString& strPath); CString GetDestinationPath() const; + const CDestPath& GetDestPath() const; void SetOperationType(EOperationType eOperation); EOperationType GetOperationType() const; + const TOperationPlan& GetOperationPlan() const; TTaskConfiguration& GetConfiguration(); const TTaskConfiguration& GetConfiguration() const; + CString GetTaskUniqueID() const; + // serialize (from/to xml) template - void load(Archive& ar) + void Load(Archive& ar, bool bData, const unsigned int uiVersion) { - ar & m_strTaskUniqueID; - ar & m_arrSourcePaths; - ar & m_tDestinationPath; - ar & m_tOperationPlan; - ar & m_tOperationConfiguration; + if(bData) + { + ar & m_strTaskUniqueID; + m_arrSourcePaths.Load(ar, uiVersion, bData); + ar & m_tDestinationPath; + ar & m_tOperationPlan; + ar & m_tOperationConfiguration; + } + else + { + m_arrSourcePaths.Load(ar, uiVersion, bData); + } m_bNeedsSaving = false; } template - void save(Archive& ar) + void Save(Archive& ar, bool bData, const unsigned int uiVersion) const { - ar & m_strTaskUniqueID; - ar & m_arrSourcePaths; - ar & m_tDestinationPath; - ar & m_tOperationPlan; - ar & m_tOperationConfiguration; + if(bData) + { + ar & m_strTaskUniqueID; + m_arrSourcePaths.Store(ar, uiVersion, bData); + ar & m_tDestinationPath; + ar & m_tOperationPlan; + ar & m_tOperationConfiguration; + } + else + m_arrSourcePaths.Store(ar, uiVersion, bData); m_bNeedsSaving = false; } - BOOST_SERIALIZATION_SPLIT_MEMBER(); - private: std::wstring m_strTaskUniqueID; ///< Unique ID of the task that will process this request (generated automatically) @@ -90,7 +106,7 @@ TTaskConfiguration m_tOperationConfiguration; // Other info (volatile, not to be saved to xml) - bool m_bNeedsSaving; ///< Some parameters has been modified and this object needs to be serialized again + mutable bool m_bNeedsSaving; ///< Some parameters has been modified and this object needs to be serialized again }; #endif // __TTASKDEFINITION_H__ Index: src/ch/TTaskOperationPlan.cpp =================================================================== diff -u -N -rae09c8430aad5eaa8225df84878b7d9050bdccd6 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision ae09c8430aad5eaa8225df84878b7d9050bdccd6) +++ src/ch/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -31,10 +31,34 @@ { } +TOperationPlan::TOperationPlan(const TOperationPlan& rSrc) : + m_eOperation(eOperation_None), + m_vSubOperations() +{ + boost::shared_lock src_lock(rSrc.m_lock); + + m_eOperation = rSrc.m_eOperation; + m_vSubOperations = rSrc.m_vSubOperations; +} + TOperationPlan::~TOperationPlan() { } +TOperationPlan& TOperationPlan::operator=(const TOperationPlan& rSrc) +{ + if(this != &rSrc) + { + boost::shared_lock src_lock(rSrc.m_lock); + boost::unique_lock lock(m_lock); + + m_eOperation = rSrc.m_eOperation; + m_vSubOperations = rSrc.m_vSubOperations; + } + + return *this; +} + void TOperationPlan::SetOperationType(EOperationType eOperation) { switch(eOperation) Index: src/ch/TTaskOperationPlan.h =================================================================== diff -u -N -rae09c8430aad5eaa8225df84878b7d9050bdccd6 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/TTaskOperationPlan.h (.../TTaskOperationPlan.h) (revision ae09c8430aad5eaa8225df84878b7d9050bdccd6) +++ src/ch/TTaskOperationPlan.h (.../TTaskOperationPlan.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -53,8 +53,11 @@ { public: TOperationPlan(); + TOperationPlan(const TOperationPlan& rSrc); ~TOperationPlan(); + TOperationPlan& operator=(const TOperationPlan& rSrc); + void SetOperationType(EOperationType eOperation); EOperationType GetOperationType() const; Index: src/ch/ch.rc =================================================================== diff -u -N -r7d6b4eae7b58d17c4b554c25cc4cff875bd53161 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/ch.rc (.../ch.rc) (revision 7d6b4eae7b58d17c4b554c25cc4cff875bd53161) +++ src/ch/ch.rc (.../ch.rc) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -64,14 +64,6 @@ // Menu // -IDR_ADVANCED_MENU MENU -BEGIN - POPUP "_ADVANCED_POPUP_" - BEGIN - MENUITEM "&Change paths...", ID_POPUP_REPLACE_PATHS - END -END - IDR_POPUP_MENU MENU BEGIN POPUP "POPUP" @@ -186,22 +178,6 @@ PUSHBUTTON "&Help",IDHELP,340,193,50,14,0,0,HIDHELP END -IDD_REPLACE_PATHS_DIALOG DIALOGEX 0, 0, 343, 148 -STYLE DS_SETFONT | DS_CONTEXTHELP | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "Partial replace of source paths" -FONT 8, "Tahoma", 0, 0, 0x1 -BEGIN - LISTBOX IDC_PATHS_LIST,7,17,329,52,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP,0,HIDC_PATHS_LIST - EDITTEXT IDC_SOURCE_EDIT,7,70,329,14,ES_AUTOHSCROLL,0,HIDC_SOURCE_EDIT - EDITTEXT IDC_DESTINATION_EDIT,7,98,309,14,ES_AUTOHSCROLL,0,HIDC_DESTINATION_EDIT - PUSHBUTTON "...",IDC_BROWSE_BUTTON,320,98,16,14,0,0,HIDC_BROWSE_BUTTON - DEFPUSHBUTTON "OK",IDOK,173,127,50,14,0,0,HIDOK - PUSHBUTTON "&Cancel",IDCANCEL,229,127,50,14,0,0,HIDCANCEL - LTEXT "Source paths:",IDC_001_STATIC,7,7,329,8 - LTEXT "Change to:",IDC_002_STATIC,7,89,329,8 - PUSHBUTTON "&Help",IDC_HELP_BUTTON,286,127,50,14,0,0,HIDC_HELP_BUTTON -END - IDD_STATUS_DIALOG DIALOGEX 0, 0, 479, 250 STYLE DS_SETFONT | DS_CONTEXTHELP | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW @@ -218,7 +194,6 @@ PUSHBUTTON "Cancel/all",IDC_CANCEL_ALL_BUTTON,7,229,71,14,0,0,HIDC_CANCEL_ALL_BUTTON PUSHBUTTON "Remove/all",IDC_REMOVE_FINISHED_BUTTON,79,229,71,14,0,0,HIDC_REMOVE_FINISHED_BUTTON PUSHBUTTON "Restart/all",IDC_RESTART_ALL_BUTTON,151,229,71,14,0,0,HIDC_RESTART_ALL_BUTTON - PUSHBUTTON "&Advanced >",IDC_ADVANCED_BUTTON,160,212,71,14,0,0,HIDC_ADVANCED_BUTTON PUSHBUTTON "",IDC_STICK_BUTTON,472,243,7,7,BS_CENTER | BS_VCENTER | BS_FLAT,0,HIDC_STICK_BUTTON PUSHBUTTON "&<<",IDC_ROLL_UNROLL_BUTTON,212,7,19,12,NOT WS_VISIBLE,0,HIDC_ROLL_UNROLL_BUTTON PUSHBUTTON "...",IDC_SET_BUFFERSIZE_BUTTON,459,72,13,14,0,0,HIDC_SET_BUFFERSIZE_BUTTON @@ -525,14 +500,6 @@ BOTTOMMARGIN, 207 END - IDD_REPLACE_PATHS_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 336 - TOPMARGIN, 7 - BOTTOMMARGIN, 141 - END - IDD_STATUS_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 Index: src/ch/ch.vc90.vcproj =================================================================== diff -u -N -r151c47cd3e55e489cc9aa2e569e0bd28910ad42e -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision 151c47cd3e55e489cc9aa2e569e0bd28910ad42e) +++ src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -940,14 +940,6 @@ > - - - - Index: src/ch/resource.h =================================================================== diff -u -N -r7d6b4eae7b58d17c4b554c25cc4cff875bd53161 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/resource.h (.../resource.h) (revision 7d6b4eae7b58d17c4b554c25cc4cff875bd53161) +++ src/ch/resource.h (.../resource.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -24,8 +24,6 @@ #define IDD_FOLDER_BROWSING_DIALOG 150 #define IDD_NEW_FOLDER_DIALOG 151 #define IDD_NEW_QUICK_ACCESS_DIALOG 152 -#define IDR_ADVANCED_MENU 160 -#define IDD_REPLACE_PATHS_DIALOG 161 #define IDI_QUESTION_ICON 163 #define IDD_FEEDBACK_DSTFILE_DIALOG 167 #define IDD_FEEDBACK_FILE_ERROR_DIALOG 167 @@ -126,7 +124,6 @@ #define IDC_PRIORITY_COMBO 1071 #define IDC_IGNORE_FOLDERS_CHECK 1073 #define IDC_ONLY_CREATE_CHECK 1074 -#define IDC_ADVANCED_BUTTON 1077 #define IDC_PATHS_LIST 1078 #define IDC_DESTFILENAME_EDIT 1090 #define IDC_IGNORE_BUTTON 1097 @@ -569,7 +566,6 @@ #define ID_POPUP_OPTIONS 32802 #define ID_SHOW_MINI_VIEW 32803 #define ID_POPUP_CUSTOM_COPY 32804 -#define ID_POPUP_REPLACE_PATHS 32805 #define ID_POPUP_MONITORING 32806 #define ID_POPUP_SHUTAFTERFINISHED 32807 #define ID_POPUP_REGISTERDLL 32809 Index: src/ch/task.cpp =================================================================== diff -u -N -r2996cfa8b8db93f1b06a4e5f142ab74a23f67235 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/task.cpp (.../task.cpp) (revision 2996cfa8b8db93f1b06a4e5f142ab74a23f67235) +++ src/ch/task.cpp (.../task.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -418,75 +418,6 @@ } //////////////////////////////////////////////////////////////////////////// -// class TOperationDescription - -TOperationDescription::TOperationDescription() : - m_eOperation(eOperation_None) -{ -} - -TOperationDescription::~TOperationDescription() -{ -} - -void TOperationDescription::SetOperationType(EOperationType eOperation) -{ - switch(eOperation) - { - case eOperation_None: - THROW(_T("Cannot set operation type 'none'"), 0, 0, 0); - break; - - case eOperation_Copy: - { - boost::unique_lock lock(m_lock); - m_vSubOperations.clear(); - m_vSubOperations.push_back(eSubOperation_Scanning); - m_vSubOperations.push_back(eSubOperation_Copying); - break; - } - - case eOperation_Move: - { - boost::unique_lock lock(m_lock); - m_vSubOperations.clear(); - m_vSubOperations.push_back(eSubOperation_Scanning); - m_vSubOperations.push_back(eSubOperation_Copying); - m_vSubOperations.push_back(eSubOperation_Deleting); - break; - } - - BOOST_STATIC_ASSERT(eOperation_Move == eOperation_Max - 1); - - default: - THROW(_T("Unhandled case"), 0, 0, 0); - } - - m_eOperation = eOperation; -} - -EOperationType TOperationDescription::GetOperationType() const -{ - boost::shared_lock lock(m_lock); - return m_eOperation; -} - -size_t TOperationDescription::GetSubOperationsCount() const -{ - boost::shared_lock lock(m_lock); - return m_vSubOperations.size(); -} - -ESubOperationType TOperationDescription::GetSubOperationAt(size_t stIndex) const -{ - boost::shared_lock lock(m_lock); - if(stIndex >= m_vSubOperations.size()) - THROW(_T("Index out of bounds"), 0, 0, 0); - else - return m_vSubOperations[stIndex]; -} - -//////////////////////////////////////////////////////////////////////////// // class TTaskBasicConfiguration TTaskBasicConfiguration::TTaskBasicConfiguration() : @@ -542,7 +473,7 @@ CTask::CTask(chcore::IFeedbackHandler* piFeedbackHandler, size_t stSessionUniqueID) : m_log(), m_piFeedbackHandler(piFeedbackHandler), - m_files(m_clipboard), + m_files(m_tTaskDefinition.GetSourcePaths()), m_nPriority(THREAD_PRIORITY_NORMAL), m_bForce(false), m_bContinue(false), @@ -557,9 +488,6 @@ m_bsSizes.m_uiTwoDisksSize=262144; m_bsSizes.m_uiCDSize=262144; m_bsSizes.m_uiLANSize=65536; - - _itot((int)time(NULL), m_strUniqueName.GetBufferSetLength(16), 10); - m_strUniqueName.ReleaseBuffer(); } CTask::~CTask() @@ -579,27 +507,6 @@ m_localStats.DisconnectGlobalStats(); } -// m_clipboard -void CTask::AddClipboardData(const CClipboardEntryPtr& spEntry) -{ - m_clipboard.Add(spEntry); -} - -CClipboardEntryPtr CTask::GetClipboardData(size_t stIndex) -{ - return m_clipboard.GetAt(stIndex); -} - -size_t CTask::GetClipboardDataSize() -{ - return m_clipboard.GetSize(); -} - -int CTask::ReplaceClipboardStrings(CString strOld, CString strNew) -{ - return m_clipboard.ReplacePathsPrefix(strOld, strNew); -} - // m_files int CTask::ScanDirectory(CString strDirName, size_t stSrcIndex, bool bRecurse, bool bIncludeDirs) { @@ -621,7 +528,7 @@ if(!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { CFileInfoPtr spFileInfo(boost::make_shared()); - spFileInfo->SetClipboard(&m_clipboard); // this is the link table (CClipboardArray) + spFileInfo->SetClipboard(&m_tTaskDefinition.GetSourcePaths()); // this is the link table (CClipboardArray) spFileInfo->Create(&wfd, strDirName, stSrcIndex); if(m_afFilters.Match(spFileInfo)) @@ -632,7 +539,7 @@ if(bIncludeDirs) { CFileInfoPtr spFileInfo(boost::make_shared()); - spFileInfo->SetClipboard(&m_clipboard); // this is the link table (CClipboardArray) + spFileInfo->SetClipboard(&m_tTaskDefinition.GetSourcePaths()); // this is the link table (CClipboardArray) // Add directory itself spFileInfo->Create(&wfd, strDirName, stSrcIndex); @@ -657,26 +564,6 @@ return 0; } -// m_strDestPath - adds '\\' -void CTask::SetDestPath(LPCTSTR lpszPath) -{ - boost::unique_lock lock(m_lock); - m_dpDestPath.SetPath(lpszPath); -} - -// guaranteed '\\' -const CDestPath& CTask::GetDestPath() -{ - boost::shared_lock lock(m_lock); - return m_dpDestPath; -} - -int CTask::GetDestDriveNumber() -{ - boost::shared_lock lock(m_lock); - return m_dpDestPath.GetDriveNumber(); -} - void CTask::SetTaskState(ETaskCurrentState eTaskState) { // NOTE: we could check some transition rules here @@ -690,16 +577,6 @@ return m_eCurrentState; } -void CTask::SetOperationType(EOperationType eOperationType) -{ - m_tOperation.SetOperationType(eOperationType); -} - -EOperationType CTask::GetOperationType() const -{ - return m_tOperation.GetOperationType(); -} - void CTask::SetTaskBasicConfiguration(const TTaskBasicConfiguration& TTaskBasicConfiguration) { m_tTaskConfig = TTaskBasicConfiguration; @@ -726,7 +603,7 @@ int CTask::GetCurrentBufferIndex() { - return m_files.GetBufferIndexAt(m_TTaskBasicProgressInfo.GetCurrentIndex(),m_dpDestPath); + return m_files.GetBufferIndexAt(m_TTaskBasicProgressInfo.GetCurrentIndex(), m_tTaskDefinition.GetDestPath()); } // m_pThread @@ -769,14 +646,6 @@ m_localStats.SetProcessedSize(m_files.CalculatePartialSize(m_TTaskBasicProgressInfo.GetCurrentIndex())); } -// m_strUniqueName - -CString CTask::GetUniqueName() -{ - boost::shared_lock lock(m_lock); - return m_strUniqueName; -} - void CTask::Load(const CString& strPath, bool bData) { std::ifstream ifs(strPath, ios_base::in | ios_base::binary); @@ -785,28 +654,25 @@ boost::unique_lock lock(m_lock); if(bData) { - m_clipboard.Load(ar, 0, bData); - ar >> m_tOperation; + m_tTaskDefinition.Load(ar, bData, 0); ar >> m_tTaskConfig; m_files.Load(ar, 0, false); CalculateTotalSizeNL(); - ar >> m_dpDestPath; - - ar >> m_strUniqueName; ar >> m_afFilters; } else { - int iState = eTaskState_None; + m_tTaskDefinition.Load(ar, bData, 0); ar >> m_TTaskBasicProgressInfo; CalculateProcessedSizeNL(); // load task state, convert "waiting" state to "processing" + int iState = eTaskState_None; ar >> iState; if(iState >= eTaskState_None && iState < eTaskState_Max) { @@ -827,7 +693,6 @@ ar >> timeElapsed; m_localStats.SetTimeElapsed(timeElapsed); - m_clipboard.Load(ar, 0, bData); m_files.Load(ar, 0, true); ar >> m_bSaved; @@ -849,33 +714,23 @@ m_bSaved = true; } - CString strPath = m_strTaskBasePath.c_str() + m_strUniqueName + (bData ? _T(".atd") : _T(".atp")); + CString strPath = m_strTaskBasePath.c_str() + m_tTaskDefinition.GetTaskUniqueID() + (bData ? _T(".atd") : _T(".atp")); std::ofstream ofs(strPath, ios_base::out | ios_base::binary); boost::archive::binary_oarchive ar(ofs); if(bData) { - m_clipboard.Store(ar, 0, bData); - - ar << m_tOperation; + m_tTaskDefinition.Save(ar, bData, 0); ar << m_tTaskConfig; - ESubOperationType eSubOperation = m_tOperation.GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex()); - if(eSubOperation != eSubOperation_Scanning) - m_files.Store(ar, 0, false); - else - { - size_t st(0); - ar << st; - } + m_files.Store(ar, 0, false); - ar << m_dpDestPath; - ar << m_strUniqueName; ar << m_afFilters; } else { + m_tTaskDefinition.Save(ar, bData, 0); ar << m_TTaskBasicProgressInfo; // store current state (convert from waiting to processing state before storing) @@ -891,9 +746,7 @@ time_t timeElapsed = m_localStats.GetTimeElapsed(); ar << timeElapsed; - m_clipboard.Store(ar, 0, bData); - - ESubOperationType eSubOperation = m_tOperation.GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex()); + ESubOperationType eSubOperation = m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex()); if(eSubOperation != eSubOperation_Scanning) m_files.Store(ar, 0, true); else @@ -986,8 +839,8 @@ pData->m_strPath = m_files.GetAt(0)->GetFileName(); else { - if(m_clipboard.GetSize() > 0) - pData->m_strPath = m_clipboard.GetAt(0)->GetFileName(); + if(m_tTaskDefinition.GetSourcePathCount() > 0) + pData->m_strPath = m_tTaskDefinition.GetSourcePathAt(0)->GetFileName(); else pData->m_strPath = GetResManager().LoadString(IDS_NONEINPUTFILE_STRING); } @@ -1018,10 +871,10 @@ } else { - if(m_clipboard.GetSize() > 0) + if(m_tTaskDefinition.GetSourcePathCount() > 0) { - pData->m_strFullFilePath = m_clipboard.GetAt(0)->GetPath(); - pData->m_strFileName = m_clipboard.GetAt(0)->GetFileName(); + pData->m_strFullFilePath = m_tTaskDefinition.GetSourcePathAt(0)->GetPath(); + pData->m_strFileName = m_tTaskDefinition.GetSourcePathAt(0)->GetFileName(); } else { @@ -1033,17 +886,17 @@ pData->m_pbsSizes=&m_bsSizes; pData->m_nPriority=m_nPriority; - pData->m_pdpDestPath=&m_dpDestPath; + pData->m_strDstPath = m_tTaskDefinition.GetDestinationPath(); pData->m_pafFilters=&m_afFilters; pData->m_eTaskState = m_eCurrentState; pData->m_stIndex = stCurrentIndex; pData->m_ullProcessedSize = m_localStats.GetProcessedSize(); pData->m_stSize=m_files.GetSize(); pData->m_ullSizeAll = m_localStats.GetTotalSize(); - pData->m_pstrUniqueName=&m_strUniqueName; + pData->m_strUniqueName = m_tTaskDefinition.GetTaskUniqueID(); if(m_files.GetSize() > 0) - pData->m_iCurrentBufferIndex=m_bsSizes.m_bOnlyDefault ? 0 : m_files.GetAt((stCurrentIndex < m_files.GetSize()) ? stCurrentIndex : 0)->GetBufferIndex(m_dpDestPath); + pData->m_iCurrentBufferIndex=m_bsSizes.m_bOnlyDefault ? 0 : m_files.GetAt((stCurrentIndex < m_files.GetSize()) ? stCurrentIndex : 0)->GetBufferIndex(m_tTaskDefinition.GetDestPath()); else pData->m_iCurrentBufferIndex=0; @@ -1089,8 +942,8 @@ } // second part - EOperationType eOperationType = m_tOperation.GetOperationType(); - ESubOperationType eSubOperation = m_tOperation.GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex()); + EOperationType eOperationType = m_tTaskDefinition.GetOperationType(); + ESubOperationType eSubOperation = m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex()); if(eSubOperation == eSubOperation_Deleting) _tcscat(pData->m_szStatusText, GetResManager().LoadString(IDS_STATUS0_STRING+6)); else if(eSubOperation == eSubOperation_Scanning) @@ -1130,9 +983,9 @@ { m_lock.lock_shared(); - CString strDel1 = lpszDirectory+m_strUniqueName+_T(".atd"); - CString strDel2 = lpszDirectory+m_strUniqueName+_T(".atp"); - CString strDel3 = lpszDirectory+m_strUniqueName+_T(".log"); + CString strDel1 = lpszDirectory + m_tTaskDefinition.GetTaskUniqueID() + _T(".atd"); + CString strDel2 = lpszDirectory + m_tTaskDefinition.GetTaskUniqueID() + _T(".atp"); + CString strDel3 = lpszDirectory + m_tTaskDefinition.GetTaskUniqueID() + _T(".log"); m_lock.unlock_shared(); @@ -1178,7 +1031,7 @@ // but GetDiskFreeSpace returns false values // get free space - if(!GetDynamicFreeSpace(GetDestPath().GetPath(), pullAvailable, NULL)) + if(!GetDynamicFreeSpace(m_tTaskDefinition.GetDestinationPath(), pullAvailable, NULL)) return true; return (*pullNeeded <= *pullAvailable); @@ -1305,48 +1158,50 @@ m_files.Clear(); // enter some data to m_files - int iDestDrvNumber = GetDestDriveNumber(); + int iDestDrvNumber = m_tTaskDefinition.GetDestPath().GetDriveNumber(); bool bIgnoreDirs = m_tTaskConfig.GetIgnoreDirectories(); bool bForceDirectories = m_tTaskConfig.GetCreateOnlyDirectories(); - bool bMove = GetOperationType() == eOperation_Move; + bool bMove = m_tTaskDefinition.GetOperationType() == eOperation_Move; // add everything ictranslate::CFormat fmt; bool bRetry = true; bool bSkipInputPath = false; - size_t stSize = GetClipboardDataSize(); + size_t stSize = m_tTaskDefinition.GetSourcePathCount(); for(size_t stIndex = 0; stIndex < stSize ; stIndex++) { CFileInfoPtr spFileInfo; bSkipInputPath = false; spFileInfo.reset(new CFileInfo()); - spFileInfo->SetClipboard(GetClipboard()); + spFileInfo->SetClipboard(&m_tTaskDefinition.GetSourcePaths()); // try to get some info about the input path; let user know if the path does not exist. do { bRetry = false; // read attributes of src file/folder - bool bExists = spFileInfo->Create(GetClipboardData(stIndex)->GetPath(), stIndex); + bool bExists = spFileInfo->Create(m_tTaskDefinition.GetSourcePathNameAt(stIndex), stIndex); if(!bExists) { - CString strSrcFile = GetClipboardData(stIndex)->GetPath(); + CString strSrcFile = m_tTaskDefinition.GetSourcePathNameAt(stIndex); FEEDBACK_FILEERROR ferr = { (PCTSTR)strSrcFile, NULL, eFastMoveError, ERROR_FILE_NOT_FOUND }; CFeedbackHandler::EFeedbackResult frResult = (CFeedbackHandler::EFeedbackResult)m_piFeedbackHandler->RequestFeedback(CFeedbackHandler::eFT_FileError, &ferr); switch(frResult) { case CFeedbackHandler::eResult_Cancel: + m_files.Clear(); return eSubResult_CancelRequest; case CFeedbackHandler::eResult_Retry: bRetry = true; break; case CFeedbackHandler::eResult_Pause: + m_files.Clear(); return eSubResult_PauseRequest; case CFeedbackHandler::eResult_Skip: @@ -1367,21 +1222,21 @@ // log fmt.SetFormat(_T("Adding file/folder (clipboard) : %path ...")); - fmt.SetParam(_t("%path"), GetClipboardData(stIndex)->GetPath()); + fmt.SetParam(_t("%path"), m_tTaskDefinition.GetSourcePathNameAt(stIndex)); m_log.logi(fmt); // found file/folder - check if the dest name has been generated - if(!GetClipboardData(stIndex)->IsDestinationPathSet()) + if(!m_tTaskDefinition.GetSourcePathAt(stIndex)->IsDestinationPathSet()) { // generate something - if dest folder == src folder - search for copy - if(GetDestPath().GetPath() == spFileInfo->GetFileRoot()) + if(m_tTaskDefinition.GetDestinationPath() == spFileInfo->GetFileRoot()) { CString strSubst; - FindFreeSubstituteName(spFileInfo->GetFullFilePath(), GetDestPath().GetPath(), &strSubst); - GetClipboardData(stIndex)->SetDestinationPath(strSubst); + FindFreeSubstituteName(spFileInfo->GetFullFilePath(), m_tTaskDefinition.GetDestinationPath(), &strSubst); + m_tTaskDefinition.GetSourcePathAt(stIndex)->SetDestinationPath(strSubst); } else - GetClipboardData(stIndex)->SetDestinationPath(spFileInfo->GetFileName()); + m_tTaskDefinition.GetSourcePathAt(stIndex)->SetDestinationPath(spFileInfo->GetFileName()); } // add if needed @@ -1401,15 +1256,15 @@ // don't add folder contents when moving inside one disk boundary if(bIgnoreDirs || !bMove || iDestDrvNumber == -1 - || iDestDrvNumber != spFileInfo->GetDriveNumber() || CFileInfo::Exist(spFileInfo->GetDestinationPath(GetDestPath().GetPath(), ((int)bForceDirectories) << 1)) ) + || iDestDrvNumber != spFileInfo->GetDriveNumber() || CFileInfo::Exist(spFileInfo->GetDestinationPath(m_tTaskDefinition.GetDestinationPath(), ((int)bForceDirectories) << 1)) ) { // log fmt.SetFormat(_T("Recursing folder %path")); fmt.SetParam(_t("%path"), spFileInfo->GetFullFilePath()); m_log.logi(fmt); // no movefile possibility - use CustomCopyFile - GetClipboardData(stIndex)->SetMove(false); + m_tTaskDefinition.GetSourcePathAt(stIndex)->SetMove(false); ScanDirectory(spFileInfo->GetFullFilePath(), stIndex, true, !bIgnoreDirs || bForceDirectories); } @@ -1419,20 +1274,21 @@ { // log m_log.logi(_T("Kill request while adding data to files array (RecurseDirectories)")); + m_files.Clear(); return eSubResult_KillRequest; } } else { if(bMove && iDestDrvNumber != -1 && iDestDrvNumber == spFileInfo->GetDriveNumber() && - !CFileInfo::Exist(spFileInfo->GetDestinationPath(GetDestPath().GetPath(), ((int)bForceDirectories) << 1)) ) + !CFileInfo::Exist(spFileInfo->GetDestinationPath(m_tTaskDefinition.GetDestinationPath(), ((int)bForceDirectories) << 1)) ) { // if moving within one partition boundary set the file size to 0 so the overall size will // be ok spFileInfo->SetLength64(0); } else - GetClipboardData(stIndex)->SetMove(false); // no MoveFile + m_tTaskDefinition.GetSourcePathAt(stIndex)->SetMove(false); // no MoveFile // add file info if passes filters if(m_afFilters.Match(spFileInfo)) @@ -2171,7 +2027,7 @@ if(GetBufferSizes()->m_bOnlyDefault) iBufferIndex = BI_DEFAULT; else - iBufferIndex = pData->spSrcFile->GetBufferIndex(m_dpDestPath); + iBufferIndex = pData->spSrcFile->GetBufferIndex(m_tTaskDefinition.GetDestPath()); ulToRead = bNoBuffer ? ROUNDUP(pData->dbBuffer.GetSizes()->m_auiSizes[iBufferIndex], MAXSECTORSIZE) : pData->dbBuffer.GetSizes()->m_auiSizes[iBufferIndex]; @@ -2300,7 +2156,7 @@ size_t stSize = m_files.GetSize(); bool bIgnoreFolders = m_tTaskConfig.GetIgnoreDirectories(); bool bForceDirectories = m_tTaskConfig.GetCreateOnlyDirectories(); - const CDestPath& dpDestPath = GetDestPath(); + const CDestPath& dpDestPath = m_tTaskDefinition.GetDestPath(); // create a buffer of size m_nBufferSize CUSTOM_COPY_PARAMS ccp; @@ -2347,7 +2203,7 @@ ccp.strDstFile = spFileInfo->GetDestinationPath(dpDestPath.GetPath(), ((int)bForceDirectories) << 1 | (int)bIgnoreFolders); // are the files/folders lie on the same partition ? - bool bMove = GetOperationType() == eOperation_Move; + bool bMove = m_tTaskDefinition.GetOperationType() == eOperation_Move; if(bMove && dpDestPath.GetDriveNumber() != -1 && dpDestPath.GetDriveNumber() == spFileInfo->GetDriveNumber() && spFileInfo->GetMove()) { bool bRetry = true; @@ -2520,10 +2376,10 @@ fmt.SetParam(_t("%availablesize"), ullAvailableSize); m_log.logw(fmt); - if(GetClipboardDataSize() > 0) + if(m_tTaskDefinition.GetSourcePathCount() > 0) { - CString strSrcPath = GetClipboardData(0)->GetPath(); - CString strDstPath = GetDestPath().GetPath(); + CString strSrcPath = m_tTaskDefinition.GetSourcePathAt(0)->GetPath(); + CString strDstPath = m_tTaskDefinition.GetDestinationPath(); FEEDBACK_NOTENOUGHSPACE feedStruct = { ullNeededSize, (PCTSTR)strSrcPath, (PCTSTR)strDstPath }; CFeedbackHandler::EFeedbackResult frResult = (CFeedbackHandler::EFeedbackResult)m_piFeedbackHandler->RequestFeedback(CFeedbackHandler::eFT_NotEnoughSpace, &feedStruct); @@ -2573,7 +2429,7 @@ // initialize log file tstring_t strPath = GetTaskPath(); - strPath += GetUniqueName()+_T(".log"); + strPath += m_tTaskDefinition.GetTaskUniqueID() + _T(".log"); m_log.init(strPath.c_str(), 262144, icpf::log_file::level_debug, false, false); @@ -2589,18 +2445,18 @@ // wait for permission to really start (but only if search for files is not allowed to start regardless of the lock) size_t stSubOperationIndex = m_TTaskBasicProgressInfo.GetSubOperationIndex(); - if(!bReadTasksSize || stSubOperationIndex != 0 || m_tOperation.GetSubOperationsCount() == 0 || m_tOperation.GetSubOperationAt(0) != eSubOperation_Scanning) + if(!bReadTasksSize || stSubOperationIndex != 0 || m_tTaskDefinition.GetOperationPlan().GetSubOperationsCount() == 0 || m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(0) != eSubOperation_Scanning) eResult = CheckForWaitState(); // operation limiting // start tracking time for this thread m_localStats.EnableTimeTracking(); - for(; stSubOperationIndex < m_tOperation.GetSubOperationsCount() && eResult == eSubResult_Continue; ++stSubOperationIndex) + for(; stSubOperationIndex < m_tTaskDefinition.GetOperationPlan().GetSubOperationsCount() && eResult == eSubResult_Continue; ++stSubOperationIndex) { // set current sub-operation index to allow resuming m_TTaskBasicProgressInfo.SetSubOperationIndex(stSubOperationIndex); - ESubOperationType eSubOperation = m_tOperation.GetSubOperationAt(stSubOperationIndex); + ESubOperationType eSubOperation = m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(stSubOperationIndex); switch(eSubOperation) { case eSubOperation_Scanning: @@ -2678,7 +2534,7 @@ } // perform cleanup dependent on currently executing subtask - switch(m_tOperation.GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex())) + switch(m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex())) { case eSubOperation_Scanning: m_files.Clear(); // get rid of m_files contents Index: src/ch/task.h =================================================================== diff -u -N -r2996cfa8b8db93f1b06a4e5f142ab74a23f67235 -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 --- src/ch/task.h (.../task.h) (revision 2996cfa8b8db93f1b06a4e5f142ab74a23f67235) +++ src/ch/task.h (.../task.h) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) @@ -26,6 +26,7 @@ #include "../libchcore/FeedbackHandlerBase.h" #include "FileFilter.h" #include "DestPath.h" +#include "TTaskDefinition.h" // enum representing current processing state of the task enum ETaskCurrentState @@ -42,28 +43,6 @@ eTaskState_Max }; -// enum represents type of the operation handled by the task -enum EOperationType -{ - eOperation_None, - eOperation_Copy, - eOperation_Move, - - // add new operation types before this enum value - eOperation_Max -}; - -enum ESubOperationType -{ - eSubOperation_None, - eSubOperation_Scanning, - eSubOperation_Copying, - eSubOperation_Deleting, - - // add new operation types before this one - eSubOperation_Max -}; - // special value representing no task #define NO_TASK_SESSION_UNIQUE_ID 0 @@ -77,7 +56,7 @@ size_t m_stIndex; size_t m_stSize; - CDestPath* m_pdpDestPath; + CString m_strDstPath; CFiltersArray* m_pafFilters; ETaskCurrentState m_eTaskState; @@ -91,7 +70,7 @@ time_t m_timeElapsed; - const CString* m_pstrUniqueName; // doesn't change from first setting + CString m_strUniqueName; // doesn't change from first setting TCHAR m_szStatusText[_MAX_PATH]; }; @@ -264,45 +243,6 @@ mutable boost::shared_mutex m_lock; }; -/////////////////////////////////////////////////////////////////////////// -// TOperationDescription - -// class describes the sub-operations to be performed -class TOperationDescription -{ -public: - TOperationDescription(); - ~TOperationDescription(); - - void SetOperationType(EOperationType eOperation); - EOperationType GetOperationType() const; - - size_t GetSubOperationsCount() const; - ESubOperationType GetSubOperationAt(size_t stIndex) const; - - template - void load(Archive& ar, unsigned int /*uiVersion*/) - { - EOperationType eOperation = eOperation_None; - ar >> eOperation; - SetOperationType(eOperation); - } - - template - void save(Archive& ar, unsigned int /*uiVersion*/) const - { - ar << m_eOperation; - } - - BOOST_SERIALIZATION_SPLIT_MEMBER(); - -private: - EOperationType m_eOperation; - std::vector m_vSubOperations; - - mutable boost::shared_mutex m_lock; -}; - class TTaskBasicConfiguration { public: @@ -357,24 +297,14 @@ CTask(chcore::IFeedbackHandler* piFeedbackHandler, size_t stSessionUniqueID); ~CTask(); - // m_clipboard - void AddClipboardData(const CClipboardEntryPtr& spEntry); - CClipboardEntryPtr GetClipboardData(size_t stIndex); - size_t GetClipboardDataSize(); - int ReplaceClipboardStrings(CString strOld, CString strNew); + void SetTaskDefinition(const TTaskDefinition& rTaskDefinition) { m_tTaskDefinition = rTaskDefinition; } + const TTaskDefinition& GetTaskDefinition() const { return m_tTaskDefinition; } - // m_strDestPath - void SetDestPath(LPCTSTR lpszPath); - const CDestPath& GetDestPath(); - void SetFilters(const CFiltersArray* pFilters); void SetTaskState(ETaskCurrentState eTaskState); ETaskCurrentState GetTaskState() const; - void SetOperationType(EOperationType eOperationType); - EOperationType GetOperationType() const; - void SetTaskBasicConfiguration(const TTaskBasicConfiguration& TTaskBasicConfiguration); const TTaskBasicConfiguration& GetTaskBasicConfiguration() const; @@ -388,9 +318,6 @@ int GetPriority(); void SetPriority(int nPriority); - // m_strUniqueName - CString GetUniqueName(); - void Load(const CString& strPath, bool bData); void Store(bool bData); @@ -405,8 +332,6 @@ void GetSnapshot(TASK_DISPLAY_DATA *pData); void GetMiniSnapshot(TASK_MINI_DISPLAY_DATA *pData); - CClipboardArray* GetClipboard() { return &m_clipboard; }; - void SetTaskPath(const tchar_t* pszDir); const tchar_t* GetTaskPath() const; @@ -462,8 +387,6 @@ ESubOperationResult CheckForFreeSpaceFB(); - int GetDestDriveNumber(); - // m_nStatus void SetStatusNL(UINT nStatus, UINT nMask); UINT GetStatusNL(UINT nMask = 0xffffffff); @@ -499,13 +422,11 @@ private: // task initial information (needed to start a task); might be a bit processed. - CClipboardArray m_clipboard; // original paths with which we started operation - CDestPath m_dpDestPath; // destination path + TTaskDefinition m_tTaskDefinition; // task settings int m_nPriority; // task priority (really processing thread priority) - CString m_strUniqueName; // name for the task (should be something like uuid) CFiltersArray m_afFilters; // filtering settings for files (will be filtered according to the rules inside when searching for files) BUFFERSIZES m_bsSizes; // sizes of buffers used to copy (derived from the global @@ -517,8 +438,6 @@ // changing fast volatile ETaskCurrentState m_eCurrentState; // current state of processing this task represents - TOperationDescription m_tOperation; // manages the operation and its suboperations - TTaskBasicConfiguration m_tTaskConfig; // task configuration options TTaskBasicProgressInfo m_TTaskBasicProgressInfo; // task progress information