From 9a2a524f1e311853d08050be2dcdddc09ac7759a Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:01:29 +0200 Subject: 3.0 --- algorithm.h | 86 ++++++++++++++++++++++++++----------------------------------- 1 file changed, 36 insertions(+), 50 deletions(-) (limited to 'algorithm.h') diff --git a/algorithm.h b/algorithm.h index 25fc6338..b2b0a4ef 100644 --- a/algorithm.h +++ b/algorithm.h @@ -3,67 +3,53 @@ #include "fileHierarchy.h" -class ErrorHandler; -class wxComboBox; -class wxTextCtrl; -class wxDirPickerCtrl; -class wxScrolledWindow; - namespace FreeFileSync { - wxString formatFilesizeToShortString(const wxLongLong& filesize); - wxString formatFilesizeToShortString(const wxULongLong& filesize); - wxString formatFilesizeToShortString(const double filesize); - - wxString includeNumberSeparator(const wxString& number); - - void setDirectoryName(const wxString& dirname, wxTextCtrl* txtCtrl, wxDirPickerCtrl* dirPicker); - void setDirectoryName(const wxString& dirname, wxComboBox* txtCtrl, wxDirPickerCtrl* dirPicker); - void scrollToBottom(wxScrolledWindow* scrWindow); +void swapGrids(const MainConfiguration& config, FolderComparison& folderCmp); - void swapGrids2(const MainConfiguration& config, FolderComparison& folderCmp); +struct DeterminationProblem //callback +{ + virtual ~DeterminationProblem() {} + virtual void reportWarning(const wxString& text) = 0; +}; +void redetermineSyncDirection(const SyncConfiguration& config, BaseDirMapping& baseDirectory, DeterminationProblem* handler); //handler may be NULL +void redetermineSyncDirection(const MainConfiguration& currentMainCfg, FolderComparison& folderCmp, DeterminationProblem* handler); - void redetermineSyncDirection(const SyncConfiguration& config, HierarchyObject& baseDirectory); - void redetermineSyncDirection(const MainConfiguration& currentMainCfg, FolderComparison& folderCmp); +void setSyncDirectionRec(SyncDirection newDirection, FileSystemObject& fsObj); //set new direction (recursively) - void setSyncDirection(SyncDirection newDirection, FileSystemObject& fsObj); //set new direction (recursively) +void applyFiltering(const MainConfiguration& currentMainCfg, FolderComparison& folderCmp); - void applyFiltering(const MainConfiguration& currentMainCfg, FolderComparison& folderCmp); +//manual deletion of files on main grid +std::pair deleteFromGridAndHDPreview( //returns wxString with elements to be deleted and total count + const std::vector& rowsToDeleteOnLeft, //all pointers need to be bound! + const std::vector& rowsToDeleteOnRight, // + const bool deleteOnBothSides); - //manual deletion of files on main grid - std::pair deleteFromGridAndHDPreview( //returns wxString with elements to be deleted and total count - const std::vector& rowsToDeleteOnLeft, //all pointers need to be bound! - const std::vector& rowsToDeleteOnRight, // - const bool deleteOnBothSides); +class DeleteFilesHandler +{ +public: + DeleteFilesHandler() {} + virtual ~DeleteFilesHandler() {} - class DeleteFilesHandler + enum Response { - public: - DeleteFilesHandler() {} - virtual ~DeleteFilesHandler() {} - - enum Response - { - IGNORE_ERROR = 10, - RETRY - }; - virtual Response reportError(const wxString& errorMessage) = 0; - - //virtual void totalFilesToDelete(int objectsTotal) = 0; //informs about the total number of files to be deleted - virtual void deletionSuccessful() = 0; //called for each file/folder that has been deleted - + IGNORE_ERROR = 10, + RETRY }; - void deleteFromGridAndHD(FolderComparison& folderCmp, //attention: rows will be physically deleted! - std::vector& rowsToDeleteOnLeft, //refresh GUI grid after deletion to remove invalid rows - std::vector& rowsToDeleteOnRight, //all pointers need to be bound! - const bool deleteOnBothSides, - const bool useRecycleBin, - const MainConfiguration& mainConfig, - DeleteFilesHandler* statusHandler); - - - wxString utcTimeToLocalString(const wxLongLong& utcTime, const Zstring& filename); + virtual Response reportError(const wxString& errorMessage) = 0; + + //virtual void totalFilesToDelete(int objectsTotal) = 0; //informs about the total number of files to be deleted + virtual void deletionSuccessful() = 0; //called for each file/folder that has been deleted + +}; +void deleteFromGridAndHD(FolderComparison& folderCmp, //attention: rows will be physically deleted! + std::vector& rowsToDeleteOnLeft, //refresh GUI grid after deletion to remove invalid rows + std::vector& rowsToDeleteOnRight, //all pointers need to be bound! + const bool deleteOnBothSides, + const bool useRecycleBin, + const MainConfiguration& mainConfig, + DeleteFilesHandler* statusHandler); } #endif // ALGORITHM_H_INCLUDED -- cgit