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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#ifndef GRIDVIEW_H_INCLUDED
#define GRIDVIEW_H_INCLUDED
#include "../structures.h"
namespace FreeFileSync
{
//gui view of FolderComparison
class GridView
{
public:
GridView(FolderComparison& results) : folderCmp(results) {}
const FileCompareLine& operator[] (unsigned row) const;
//unsigned getResultsIndex(const unsigned viewIndex); //convert index on GridView to index on FolderComparison
unsigned int elementsOnView() const;
unsigned int elementsTotal() const;
//convert view references to FolderCompRef
void viewRefToFolderRef(const std::set<int>& viewRef, FolderCompRef& output);
const FolderPair getFolderPair(const unsigned int row) const;
struct StatusInfo
{
bool existsLeftOnly;
bool existsRightOnly;
bool existsLeftNewer;
bool existsRightNewer;
bool existsDifferent;
bool existsEqual;
unsigned int filesOnLeftView;
unsigned int foldersOnLeftView;
unsigned int filesOnRightView;
unsigned int foldersOnRightView;
wxULongLong filesizeLeftView;
wxULongLong filesizeRightView;
};
StatusInfo update(const bool includeLeftOnly,
const bool includeRightOnly,
const bool includeLeftNewer,
const bool includeRightNewer,
const bool includeDifferent,
const bool includeEqual,
const bool hideFiltered);
//sorting...
enum SortType
{
SORT_BY_REL_NAME,
SORT_BY_FILENAME,
SORT_BY_FILESIZE,
SORT_BY_DATE,
SORT_BY_CMP_RESULT,
SORT_BY_DIRECTORY
};
void sortView(const SortType type, const bool onLeft, const bool ascending);
private:
struct RefIndex
{
unsigned int folderIndex;
unsigned int rowIndex;
};
std::vector<RefIndex> refView;
FolderComparison& folderCmp;
};
//############################################################################
//inline implementation
inline
const FileCompareLine& GridView::operator[] (unsigned row) const
{
const unsigned int folderInd = refView[row].folderIndex;
const unsigned int rowInd = refView[row].rowIndex;
return folderCmp[folderInd].fileCmp[rowInd];
}
inline
unsigned int GridView::elementsOnView() const
{
return refView.size();
}
inline
const FolderPair GridView::getFolderPair(const unsigned int row) const
{
const unsigned int folderInd = refView[row].folderIndex;
const FolderCompareLine& folderCmpLine = folderCmp[folderInd];
return folderCmpLine.syncPair;
}
}
#endif // GRIDVIEW_H_INCLUDED
|