Reinvent deprecated qSort as Utils::sort

Change-Id: I4f6011cc2b6127037249aabc2426a88ad7108ebf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Nikita Baryshnikov
2014-06-16 18:25:52 +04:00
committed by hjk
parent eefd0f4332
commit 12103e0f67
75 changed files with 275 additions and 307 deletions

View File

@@ -40,6 +40,7 @@
#include <vcsbase/vcsbaseconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QDir>
@@ -221,11 +222,6 @@ void VcsManager::extensionsInitialized()
}
}
static bool longerThanPath(QPair<QString, IVersionControl *> &pair1, QPair<QString, IVersionControl *> &pair2)
{
return pair1.first.size() > pair2.first.size();
}
void VcsManager::resetVersionControlForDirectory(const QString &inputDirectory)
{
if (inputDirectory.isEmpty())
@@ -273,7 +269,10 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
// To properly find a nested repository (say, git checkout inside SVN),
// we need to select the version control with the longest toplevel pathname.
qSort(allThatCanManage.begin(), allThatCanManage.end(), longerThanPath);
Utils::sort(allThatCanManage, [](const StringVersionControlPair &l,
const StringVersionControlPair &r) {
return l.first.size() > r.first.size();
});
if (allThatCanManage.isEmpty()) {
d->cache(0, QString(), directory); // register that nothing was found!