summaryrefslogtreecommitdiff
path: root/synchronization.h
blob: c8ce10cda83019a95aa8a9d08d9adcabb43546aa (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 SYNCHRONIZATION_H_INCLUDED
#define SYNCHRONIZATION_H_INCLUDED

#include "structures.h"

class StatusHandler;


namespace FreeFileSync
{
    void calcTotalBytesToSync(const FolderComparison& folderCmp,
                              const SyncConfiguration& config,
                              int& objectsToCreate,
                              int& objectsToOverwrite,
                              int& objectsToDelete,
                              wxULongLong& dataToProcess);

    bool synchronizationNeeded(const FolderComparison& folderCmp, const SyncConfiguration& config);

    //class handling synchronization process
    class SyncProcess
    {
    public:
        SyncProcess(const bool useRecycler,
                    const bool copyFileSymLinks,
                    const bool traverseDirSymLinks,
                    bool& warningSignificantDifference,
                    bool& warningNotEnoughDiskSpace,
                    StatusHandler* handler);

        void startSynchronizationProcess(FolderComparison& folderCmp, const SyncConfiguration& config);

    private:
        bool synchronizeFile(const FileCompareLine& cmpLine, const SyncConfiguration& config, const FolderPair& folderPair);   //false if nothing was done
        bool synchronizeFolder(const FileCompareLine& cmpLine, const SyncConfiguration& config, const FolderPair& folderPair); //false if nothing was done

        void copyFileUpdating(const Zstring& source, const Zstring& target, const wxULongLong& sourceFileSize);

        const bool m_useRecycleBin;
        const bool m_copyFileSymLinks;
        const bool m_traverseDirSymLinks;
        bool& m_warningSignificantDifference;
        bool& m_warningNotEnoughDiskSpace;
        StatusHandler* statusUpdater;

        //preload status texts
        const Zstring txtCopyingFile;
        const Zstring txtOverwritingFile;
        const Zstring txtCreatingFolder;
        const Zstring txtDeletingFile;
        const Zstring txtDeletingFolder;
    };
}

#endif // SYNCHRONIZATION_H_INCLUDED
bgstack15