From b654dbfa5f3e4a4d02f72023f7c5895635aa6396 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:12:17 +0200 Subject: 3.18 --- ui/grid_view.cpp | 96 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'ui/grid_view.cpp') diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp index 4db921fa..59bfb767 100644 --- a/ui/grid_view.cpp +++ b/ui/grid_view.cpp @@ -326,7 +326,7 @@ void GridView::setData(FolderComparison& newData) //------------------------------------ SORTING TEMPLATES ------------------------------------------------ template -class GridView::SortByDirectory : public std::binary_function +class GridView::LessDirectoryPair : public std::binary_function { public: bool operator()(const RefIndex a, const RefIndex b) const @@ -339,10 +339,10 @@ public: template -class GridView::SortByRelName : public std::binary_function +class GridView::LessRelativeName : public std::binary_function { public: - SortByRelName(const GridView& view) : m_view(view) {} + LessRelativeName(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -359,7 +359,7 @@ public: else if (fsObjB == NULL) return true; - return sortByRelativeName(*fsObjA, *fsObjB); + return lessRelativeName(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -367,10 +367,10 @@ private: template -class GridView::SortByFileName : public std::binary_function +class GridView::LessShortFileName : public std::binary_function { public: - SortByFileName(const GridView& view) : m_view(view) {} + LessShortFileName(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -381,7 +381,7 @@ public: else if (fsObjB == NULL) return true; - return sortByFileName(*fsObjA, *fsObjB); + return lessShortFileName(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -389,10 +389,10 @@ private: template -class GridView::SortByFileSize : public std::binary_function +class GridView::LessFilesize : public std::binary_function { public: - SortByFileSize(const GridView& view) : m_view(view) {} + LessFilesize(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -403,7 +403,7 @@ public: else if (fsObjB == NULL) return true; - return sortByFileSize(*fsObjA, *fsObjB); + return lessFilesize(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -411,10 +411,10 @@ private: template -class GridView::SortByDate : public std::binary_function +class GridView::LessFiletime : public std::binary_function { public: - SortByDate(const GridView& view) : m_view(view) {} + LessFiletime(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -425,7 +425,7 @@ public: else if (fsObjB == NULL) return true; - return sortByDate(*fsObjA, *fsObjB); + return lessFiletime(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -433,10 +433,10 @@ private: template -class GridView::SortByExtension : public std::binary_function +class GridView::LessExtension : public std::binary_function { public: - SortByExtension(const GridView& view) : m_view(view) {} + LessExtension(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -447,7 +447,7 @@ public: else if (fsObjB == NULL) return true; - return sortByExtension(*fsObjA, *fsObjB); + return lessExtension(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -455,10 +455,10 @@ private: template -class GridView::SortByCmpResult : public std::binary_function +class GridView::LessCmpResult : public std::binary_function { public: - SortByCmpResult(const GridView& view) : m_view(view) {} + LessCmpResult(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -469,7 +469,7 @@ public: else if (fsObjB == NULL) return true; - return sortByCmpResult(*fsObjA, *fsObjB); + return lessCmpResult(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -477,10 +477,10 @@ private: template -class GridView::SortBySyncDirection : public std::binary_function +class GridView::LessSyncDirection : public std::binary_function { public: - SortBySyncDirection(const GridView& view) : m_view(view) {} + LessSyncDirection(const GridView& view) : m_view(view) {} bool operator()(const RefIndex a, const RefIndex b) const { @@ -491,7 +491,7 @@ public: else if (fsObjB == NULL) return true; - return sortBySyncDirection(*fsObjA, *fsObjB); + return lessSyncDirection(*fsObjA, *fsObjB); } private: const GridView& m_view; @@ -526,46 +526,46 @@ void GridView::sortView(SortType type, bool onLeft, bool ascending) switch (type) { case SORT_BY_REL_NAME: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName(*this)); + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessRelativeName(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessRelativeName(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessRelativeName(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessRelativeName(*this)); break; case SORT_BY_FILENAME: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName(*this)); + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessShortFileName(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessShortFileName(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessShortFileName(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessShortFileName(*this)); break; case SORT_BY_FILESIZE: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize(*this)); + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFilesize(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFilesize(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFilesize(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFilesize(*this)); break; case SORT_BY_DATE: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate(*this)); + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFiletime(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFiletime(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFiletime(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), LessFiletime(*this)); break; case SORT_BY_EXTENSION: - if ( ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension(*this)); - else if ( ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension(*this)); - else if (!ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension(*this)); - else if (!ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension(*this)); + if ( ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessExtension(*this)); + else if ( ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessExtension(*this)); + else if (!ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessExtension(*this)); + else if (!ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessExtension(*this)); break; case SORT_BY_CMP_RESULT: - if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByCmpResult(*this)); - else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByCmpResult(*this)); + if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessCmpResult(*this)); + else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessCmpResult(*this)); break; case SORT_BY_SYNC_DIRECTION: - if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortBySyncDirection(*this)); - else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortBySyncDirection(*this)); + if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessSyncDirection(*this)); + else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessSyncDirection(*this)); break; case SORT_BY_DIRECTORY: - if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByDirectory()); - else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByDirectory()); + if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessDirectoryPair()); + else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), LessDirectoryPair()); break; } } -- cgit