summaryrefslogtreecommitdiff
path: root/ui/gridView.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 16:57:45 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 16:57:45 +0200
commit2a3ebac62eb6dd88122c0f447ea90ce368373d3a (patch)
treefae5c18deaecfb6f39d4d66dd3de8ce730b2025b /ui/gridView.h
parent1.17 (diff)
downloadFreeFileSync-2a3ebac62eb6dd88122c0f447ea90ce368373d3a.tar.gz
FreeFileSync-2a3ebac62eb6dd88122c0f447ea90ce368373d3a.tar.bz2
FreeFileSync-2a3ebac62eb6dd88122c0f447ea90ce368373d3a.zip
1.18
Diffstat (limited to 'ui/gridView.h')
-rw-r--r--ui/gridView.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/ui/gridView.h b/ui/gridView.h
new file mode 100644
index 00000000..b4101da7
--- /dev/null
+++ b/ui/gridView.h
@@ -0,0 +1,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
bgstack15