From b338e29fd3eaf700f8c8360aa0310048ba941d54 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:12:46 +0200 Subject: 3.19 --- algorithm.cpp | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'algorithm.cpp') diff --git a/algorithm.cpp b/algorithm.cpp index 3b210d49..cfc2997a 100644 --- a/algorithm.cpp +++ b/algorithm.cpp @@ -1240,6 +1240,9 @@ private: void operator()(zen::DirMapping& dirObj) const { + if (Eval().process(dirObj)) + dirObj.setActive(timeSizeFilter_.matchFolder()); //if date filter is active we deactivate all folders: effectively gets rid of empty folders! + execute(dirObj); //recursion } @@ -1260,11 +1263,10 @@ private: } -void zen::addExcludeFiltering(FolderComparison& folderCmp, const Zstring& excludeFilter) +void zen::addHardFiltering(BaseDirMapping& baseMap, const Zstring& excludeFilter) { - for (std::vector::iterator i = folderCmp.begin(); i != folderCmp.end(); ++i) - ApplyHardFilter(*HardFilter::FilterRef( - new NameFilter(FilterConfig().includeFilter, excludeFilter))).execute(*i); + ApplyHardFilter(*HardFilter::FilterRef( + new NameFilter(FilterConfig().includeFilter, excludeFilter))).execute(baseMap); } @@ -1311,7 +1313,10 @@ std::pair zen::deleteFromGridAndHDPreview( //assemble message con const std::vector& rowsToDeleteOnRight, const bool deleteOnBothSides) { - wxString filesToDelete; + //fast replacement for wxString modelling exponential growth + typedef Zbase zxString; //for use with UI texts + + zxString filesToDelete; int totalDelCount = 0; if (deleteOnBothSides) @@ -1320,51 +1325,48 @@ std::pair zen::deleteFromGridAndHDPreview( //assemble message con std::set rowsToDelete(rowsToDeleteOnLeft.begin(), rowsToDeleteOnLeft.end()); rowsToDelete.insert(rowsToDeleteOnRight.begin(), rowsToDeleteOnRight.end()); - for (std::set::const_iterator i = rowsToDelete.begin(); i != rowsToDelete.end(); ++i) + std::for_each(rowsToDelete.begin(), rowsToDelete.end(), + [&](const FileSystemObject* fsObj) { - const FileSystemObject& currObj = *(*i); - - if (!currObj.isEmpty()) + if (!fsObj->isEmpty()) { - filesToDelete += zToWx(currObj.getFullName()) + wxT("\n"); + filesToDelete += utf8CvrtTo(fsObj->getFullName()) + wxT("\n"); ++totalDelCount; } - if (!currObj.isEmpty()) + if (!fsObj->isEmpty()) { - filesToDelete += zToWx(currObj.getFullName()) + wxT("\n"); + filesToDelete += utf8CvrtTo(fsObj->getFullName()) + wxT("\n"); ++totalDelCount; } filesToDelete += wxT("\n"); - } + }); } else //delete selected files only { - for (std::vector::const_iterator i = rowsToDeleteOnLeft.begin(); i != rowsToDeleteOnLeft.end(); ++i) + std::for_each(rowsToDeleteOnLeft.begin(), rowsToDeleteOnLeft.end(), + [&](const FileSystemObject* fsObj) { - const FileSystemObject& currObj = *(*i); - - if (!currObj.isEmpty()) + if (!fsObj->isEmpty()) { - filesToDelete += zToWx(currObj.getFullName()) + wxT("\n"); + filesToDelete += utf8CvrtTo(fsObj->getFullName()) + wxT("\n"); ++totalDelCount; } - } + }); - for (std::vector::const_iterator i = rowsToDeleteOnRight.begin(); i != rowsToDeleteOnRight.end(); ++i) + std::for_each(rowsToDeleteOnRight.begin(), rowsToDeleteOnRight.end(), + [&](const FileSystemObject* fsObj) { - const FileSystemObject& currObj = *(*i); - - if (!currObj.isEmpty()) + if (!fsObj->isEmpty()) { - filesToDelete += zToWx(currObj.getFullName()) + wxT("\n"); + filesToDelete += utf8CvrtTo(fsObj->getFullName()) + wxT("\n"); ++totalDelCount; } - } + }); } - return std::make_pair(filesToDelete, totalDelCount); + return std::make_pair(cvrtString(filesToDelete), totalDelCount); } -- cgit