summaryrefslogtreecommitdiff
path: root/algorithm.h
blob: b2b0a4ef8a4b15cfe1a03cffa1bdd6f864611453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef ALGORITHM_H_INCLUDED
#define ALGORITHM_H_INCLUDED

#include "fileHierarchy.h"


namespace FreeFileSync
{
void swapGrids(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 setSyncDirectionRec(SyncDirection newDirection, FileSystemObject& fsObj); //set new direction (recursively)

void applyFiltering(const MainConfiguration& currentMainCfg, FolderComparison& folderCmp);

//manual deletion of files on main grid
std::pair<wxString, int> deleteFromGridAndHDPreview(           //returns wxString with elements to be deleted and total count
    const std::vector<FileSystemObject*>& rowsToDeleteOnLeft,  //all pointers need to be bound!
    const std::vector<FileSystemObject*>& rowsToDeleteOnRight, //
    const bool deleteOnBothSides);

class DeleteFilesHandler
{
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

};
void deleteFromGridAndHD(FolderComparison& folderCmp,                        //attention: rows will be physically deleted!
                         std::vector<FileSystemObject*>& rowsToDeleteOnLeft,  //refresh GUI grid after deletion to remove invalid rows
                         std::vector<FileSystemObject*>& rowsToDeleteOnRight, //all pointers need to be bound!
                         const bool deleteOnBothSides,
                         const bool useRecycleBin,
                         const MainConfiguration& mainConfig,
                         DeleteFilesHandler* statusHandler);
}

#endif // ALGORITHM_H_INCLUDED
bgstack15