blob: 2a4d4e29a19fa7c4ce1f50c3feac3eb9b520f010 (
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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
#ifndef GRIDVIEW_H_INCLUDED
#define GRIDVIEW_H_INCLUDED
#include "../structures.h"
namespace FreeFileSync
{
//gui view of FolderComparison
class GridView
{
public:
GridView(FolderComparison& results);
const FileCompareLine& operator[] (unsigned row) const;
FileCompareLine& operator[] (unsigned row);
//unsigned getResultsIndex(const unsigned viewIndex); //convert index on GridView to index on FolderComparison
unsigned int elementsOnView() const; //only the currently visible elements
bool refGridIsEmpty() 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
{
StatusInfo();
bool existsLeftOnly;
bool existsRightOnly;
bool existsLeftNewer;
bool existsRightNewer;
bool existsDifferent;
bool existsEqual;
bool existsConflict;
bool existsSyncDirLeft;
bool existsSyncDirRight;
bool existsSyncDirNone;
unsigned int filesOnLeftView;
unsigned int foldersOnLeftView;
unsigned int filesOnRightView;
unsigned int foldersOnRightView;
unsigned int objectsTotal;
wxULongLong filesizeLeftView;
wxULongLong filesizeRightView;
};
StatusInfo update(const bool hideFiltered, const bool syncPreviewActive);
//UI View Filter settings
//compare result
bool leftOnlyFilesActive;
bool rightOnlyFilesActive;
bool leftNewerFilesActive;
bool rightNewerFilesActive;
bool differentFilesActive;
bool equalFilesActive;
bool conflictFilesActive;
//sync preview
bool syncDirLeftActive;
bool syncDirRightActive;
bool syncDirNoneActive;
//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:
template <bool syncPreviewActive>
StatusInfo update_sub(const bool hideFiltered);
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
FileCompareLine& GridView::operator[] (unsigned row)
{
//code re-use of const method: see Meyers Effective C++
return const_cast<FileCompareLine&>(static_cast<const GridView&>(*this).operator[](row));
}
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
|