forked from qt-creator/qt-creator
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:
@@ -113,6 +113,18 @@ auto transform(const QList<T> &container, F function) -> QList<decltype(function
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
inline void sort(Container &c)
|
||||
{
|
||||
std::sort(c.begin(), c.end());
|
||||
}
|
||||
|
||||
template <typename Container, typename Predicate>
|
||||
inline void sort(Container &c, Predicate p)
|
||||
{
|
||||
std::sort(c.begin(), c.end(), p);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ALGORITHM_H
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/sleep.h>
|
||||
|
||||
@@ -248,7 +249,7 @@ void AndroidConfig::updateNdkInformation() const
|
||||
const QString &fileName = it.next();
|
||||
m_availableNdkPlatforms.push_back(fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt());
|
||||
}
|
||||
qSort(m_availableNdkPlatforms.begin(), m_availableNdkPlatforms.end(), qGreater<int>());
|
||||
Utils::sort(m_availableNdkPlatforms, std::greater<int>());
|
||||
|
||||
// detect toolchain host
|
||||
QStringList hostPatterns;
|
||||
@@ -494,7 +495,7 @@ QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(QString *error) const
|
||||
devices.push_back(dev);
|
||||
}
|
||||
|
||||
qSort(devices.begin(), devices.end(), androidDevicesLessThan);
|
||||
Utils::sort(devices, androidDevicesLessThan);
|
||||
if (devices.isEmpty() && error)
|
||||
*error = QApplication::translate("AndroidConfiguration",
|
||||
"No devices found in output of: %1")
|
||||
@@ -631,7 +632,7 @@ QVector<AndroidDeviceInfo> AndroidConfig::androidVirtualDevices() const
|
||||
dev.type = AndroidDeviceInfo::Emulator;
|
||||
devices.push_back(dev);
|
||||
}
|
||||
qSort(devices.begin(), devices.end(), androidDevicesLessThan);
|
||||
Utils::sort(devices, androidDevicesLessThan);
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileSystemWatcher>
|
||||
@@ -868,7 +869,11 @@ QVector<AndroidManager::Library> AndroidManager::availableQtLibsWithDependencies
|
||||
}
|
||||
qtLibraries.push_back(library);
|
||||
}
|
||||
qSort(qtLibraries.begin(), qtLibraries.end(), qtLibrariesLessThan);
|
||||
Utils::sort(qtLibraries, [](const Library &a, const Library &b) -> bool {
|
||||
if (a.level == b.level)
|
||||
return a.name < b.name;
|
||||
return a.level < b.level;
|
||||
});
|
||||
|
||||
return qtLibraries;
|
||||
|
||||
@@ -1171,13 +1176,6 @@ int AndroidManager::setLibraryLevel(const QString &library, LibrariesMap &mapLib
|
||||
return maxlevel + 1;
|
||||
}
|
||||
|
||||
bool AndroidManager::qtLibrariesLessThan(const Library &a, const Library &b)
|
||||
{
|
||||
if (a.level == b.level)
|
||||
return a.name < b.name;
|
||||
return a.level < b.level;
|
||||
}
|
||||
|
||||
QString AndroidManager::libGnuStl(const QString &arch, const QString &ndkToolChainVersion)
|
||||
{
|
||||
return AndroidConfigurations::currentConfig().ndkLocation().toString()
|
||||
|
@@ -158,7 +158,7 @@ private:
|
||||
|
||||
static QStringList dependencies(const Utils::FileName &readelfPath, const QString &lib);
|
||||
static int setLibraryLevel(const QString &library, LibrariesMap &mapLibs);
|
||||
static bool qtLibrariesLessThan(const Library &a, const Library &b);
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <qmakeprojectmanager/qmakeproject.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QFileInfo>
|
||||
@@ -1348,7 +1349,7 @@ void PermissionsModel::setPermissions(const QStringList &permissions)
|
||||
{
|
||||
beginResetModel();
|
||||
m_permissions = permissions;
|
||||
qSort(m_permissions);
|
||||
Utils::sort(m_permissions);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
@@ -173,7 +173,7 @@ static QList<CodeCompletionResult> unfilteredCompletion(const ClangCompletionAss
|
||||
}
|
||||
|
||||
QList<CodeCompletionResult> result = wrapper->codeCompleteAt(line, column + 1, unsavedFiles);
|
||||
qSort(result);
|
||||
std::sort(result);
|
||||
|
||||
if (DebugTiming)
|
||||
qDebug() << "... Completion done in" << t.elapsed() << "ms, with" << result.count() << "items.";
|
||||
|
@@ -56,6 +56,7 @@
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/iprojectmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/fileutils.h>
|
||||
@@ -1906,7 +1907,7 @@ QList<QStringPair> ClearCasePlugin::ccGetActivities() const
|
||||
result.append(QStringPair(actName, act.at(1).trimmed()));
|
||||
}
|
||||
}
|
||||
qSort(result);
|
||||
Utils::sort(result);
|
||||
if (!rebaseAct.first.isEmpty())
|
||||
result.append(rebaseAct);
|
||||
if (!deliverAct.first.isEmpty())
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include <qtsupport/uicodemodelsupport.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -432,8 +433,8 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::
|
||||
// Gather old list
|
||||
QList<ProjectExplorer::FileNode *> oldList;
|
||||
gatherFileNodes(rootNode, oldList);
|
||||
qSort(oldList.begin(), oldList.end(), sortNodesByPath);
|
||||
qSort(newList.begin(), newList.end(), sortNodesByPath);
|
||||
Utils::sort(oldList, sortNodesByPath);
|
||||
Utils::sort(newList, sortNodesByPath);
|
||||
|
||||
QList<ProjectExplorer::FileNode *> added;
|
||||
QList<ProjectExplorer::FileNode *> deleted;
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "externaltoolconfig.h"
|
||||
#include "ui_externaltoolconfig.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -257,7 +258,7 @@ bool ExternalToolModel::setData(const QModelIndex &modelIndex, const QVariant &v
|
||||
int previousIndex = categories.indexOf(category);
|
||||
categories.removeAt(previousIndex);
|
||||
categories.append(string);
|
||||
qSort(categories);
|
||||
Utils::sort(categories);
|
||||
int newIndex = categories.indexOf(string);
|
||||
if (newIndex != previousIndex) {
|
||||
// we have same parent so we have to do special stuff for beginMoveRows...
|
||||
@@ -327,7 +328,7 @@ QModelIndex ExternalToolModel::addCategory()
|
||||
}
|
||||
QList<QString> categories = m_tools.keys();
|
||||
categories.append(category);
|
||||
qSort(categories);
|
||||
Utils::sort(categories);
|
||||
int pos = categories.indexOf(category);
|
||||
|
||||
beginInsertRows(QModelIndex(), pos, pos);
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "helpmanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/filesystemwatcher.h>
|
||||
|
||||
#include <QDateTime>
|
||||
@@ -263,7 +264,7 @@ QStringList HelpManager::findKeywords(const QString &key, Qt::CaseSensitivity ca
|
||||
}
|
||||
|
||||
QStringList keywordsSorted = keywordsToSort.toList();
|
||||
qSort(keywordsSorted.begin(), keywordsSorted.end());
|
||||
Utils::sort(keywordsSorted);
|
||||
return keywordsSorted + keywords.toList();
|
||||
}
|
||||
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/progressmanager/futureprogress.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/QtConcurrentTools>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -57,17 +58,6 @@
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
static bool filterLessThan(const ILocatorFilter *first, const ILocatorFilter *second)
|
||||
{
|
||||
if (first->priority() < second->priority())
|
||||
return true;
|
||||
if (first->priority() > second->priority())
|
||||
return false;
|
||||
return first->id().alphabeticallyBefore(second->id());
|
||||
}
|
||||
}
|
||||
|
||||
Locator::Locator()
|
||||
: m_settingsInitialized(false)
|
||||
{
|
||||
@@ -151,7 +141,11 @@ void Locator::openLocator()
|
||||
void Locator::extensionsInitialized()
|
||||
{
|
||||
m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>();
|
||||
qSort(m_filters.begin(), m_filters.end(), filterLessThan);
|
||||
Utils::sort(m_filters, [](const ILocatorFilter *first, const ILocatorFilter *second) -> bool {
|
||||
if (first->priority() != second->priority())
|
||||
return first->priority() < second->priority();
|
||||
return first->id().alphabeticallyBefore(second->id());
|
||||
});
|
||||
setFilters(m_filters);
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <coreplugin/editormanager/iexternaleditor.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/headerviewstretcher.h>
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
@@ -47,19 +48,10 @@
|
||||
#include <QSet>
|
||||
#include <QStringList>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
struct MimeTypeComp
|
||||
{
|
||||
bool operator()(const MimeType &a, const MimeType &b)
|
||||
{ return a.type().compare(b.type(), Qt::CaseInsensitive) < 0; }
|
||||
};
|
||||
|
||||
// MimeTypeSettingsModel
|
||||
class MimeTypeSettingsModel : public QAbstractTableModel
|
||||
{
|
||||
@@ -125,7 +117,9 @@ QVariant MimeTypeSettingsModel::data(const QModelIndex &modelIndex, int role) co
|
||||
void MimeTypeSettingsModel::load()
|
||||
{
|
||||
m_mimeTypes = MimeDatabase::mimeTypes();
|
||||
qSort(m_mimeTypes.begin(), m_mimeTypes.end(), MimeTypeComp());
|
||||
Utils::sort(m_mimeTypes, [](const MimeType &a, const MimeType &b) {
|
||||
return a.type().compare(b.type(), Qt::CaseInsensitive) < 0;
|
||||
});
|
||||
m_knownPatterns = QSet<QString>::fromList(
|
||||
MimeDatabase::fromGlobPatterns(MimeDatabase::globPatterns()));
|
||||
|
||||
@@ -498,7 +492,7 @@ void MimeTypeSettingsPrivate::updateMimeDatabase()
|
||||
|
||||
// For this case it is a better approach to simply use a list and to remove duplicates
|
||||
// afterwards than to keep a more complex data structure like a hash table.
|
||||
qSort(m_modifiedMimeTypes.begin(), m_modifiedMimeTypes.end());
|
||||
Utils::sort(m_modifiedMimeTypes);
|
||||
m_modifiedMimeTypes.erase(std::unique(m_modifiedMimeTypes.begin(), m_modifiedMimeTypes.end()),
|
||||
m_modifiedMimeTypes.end());
|
||||
|
||||
|
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -75,11 +76,6 @@ static char outputPaneVisibleKeyC[] = "visible";
|
||||
|
||||
static OutputPaneManager *m_instance = 0;
|
||||
|
||||
bool comparePanes(IOutputPane *p1, IOutputPane *p2)
|
||||
{
|
||||
return p1->priorityInStatusBar() > p2->priorityInStatusBar();
|
||||
}
|
||||
|
||||
void OutputPaneManager::create()
|
||||
{
|
||||
m_instance = new OutputPaneManager;
|
||||
@@ -239,7 +235,9 @@ void OutputPaneManager::init()
|
||||
int minTitleWidth = 0;
|
||||
|
||||
m_panes = ExtensionSystem::PluginManager::getObjects<IOutputPane>();
|
||||
qSort(m_panes.begin(), m_panes.end(), &comparePanes);
|
||||
Utils::sort(m_panes, [](IOutputPane *p1, IOutputPane *p2) {
|
||||
return p1->priorityInStatusBar() > p2->priorityInStatusBar();
|
||||
});
|
||||
const int n = m_panes.size();
|
||||
|
||||
int shortcutNumber = 1;
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "sidebarwidget.h"
|
||||
|
||||
#include "actionmanager/command.h"
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QPointer>
|
||||
@@ -152,7 +153,7 @@ void SideBar::makeItemAvailable(SideBarItem *item)
|
||||
d->m_availableItemIds.append(it.key());
|
||||
d->m_availableItemTitles.append(it.value().data()->title());
|
||||
d->m_unavailableItemIds.removeAll(it.key());
|
||||
qSort(d->m_availableItemTitles);
|
||||
Utils::sort(d->m_availableItemTitles);
|
||||
emit availableItemsChanged();
|
||||
//updateWidgets();
|
||||
break;
|
||||
@@ -178,7 +179,7 @@ void SideBar::setUnavailableItemIds(const QStringList &itemIds)
|
||||
d->m_availableItemIds.removeAll(id);
|
||||
d->m_availableItemTitles.removeAll(d->m_itemMap.value(id).data()->title());
|
||||
}
|
||||
qSort(d->m_availableItemTitles);
|
||||
Utils::sort(d->m_availableItemTitles);
|
||||
updateWidgets();
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "navigationsubwidget.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
@@ -91,7 +92,7 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &id)
|
||||
lay->addWidget(m_toolbar);
|
||||
|
||||
QStringList titleList = m_sideBar->availableItemTitles();
|
||||
qSort(titleList);
|
||||
Utils::sort(titleList);
|
||||
QString t = id;
|
||||
if (titleList.count()) {
|
||||
foreach (const QString &itemTitle, titleList)
|
||||
@@ -158,7 +159,7 @@ void SideBarWidget::updateAvailableItems()
|
||||
QStringList titleList = m_sideBar->availableItemTitles();
|
||||
if (!currentTitle.isEmpty() && !titleList.contains(currentTitle))
|
||||
titleList.append(currentTitle);
|
||||
qSort(titleList);
|
||||
Utils::sort(titleList);
|
||||
|
||||
foreach (const QString &itemTitle, titleList)
|
||||
m_comboBox->addItem(itemTitle, m_sideBar->idForTitle(itemTitle));
|
||||
|
@@ -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!
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "cppeditorplugin.h"
|
||||
|
||||
#include <coreplugin/find/treeviewfind.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/navigationtreeview.h>
|
||||
#include <utils/annotateditemdelegate.h>
|
||||
|
||||
@@ -69,17 +70,14 @@ QStandardItem *itemForClass(const CppClass &cppClass)
|
||||
return item;
|
||||
}
|
||||
|
||||
bool compareCppClassNames(const CppClass &c1, const CppClass &c2)
|
||||
{
|
||||
const QString key1 = c1.name + QLatin1String("::") + c1.qualifiedName;
|
||||
const QString key2 = c2.name + QLatin1String("::") + c2.qualifiedName;
|
||||
return key1 < key2;
|
||||
}
|
||||
|
||||
QList<CppClass> sortClasses(const QList<CppClass> &cppClasses)
|
||||
{
|
||||
QList<CppClass> sorted = cppClasses;
|
||||
qSort(sorted.begin(), sorted.end(), compareCppClassNames);
|
||||
Utils::sort(sorted, [](const CppClass &c1, const CppClass &c2) {
|
||||
const QString key1 = c1.name + QLatin1String("::") + c1.qualifiedName;
|
||||
const QString key2 = c2.name + QLatin1String("::") + c2.qualifiedName;
|
||||
return key1 < key2;
|
||||
});
|
||||
return sorted;
|
||||
}
|
||||
|
||||
|
@@ -42,13 +42,13 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cplusplus/TranslationUnit.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTextDocument>
|
||||
#include <QtAlgorithms>
|
||||
#include <QtTest>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
@@ -168,7 +168,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
|
||||
TestActionsTestCase::allProjectsConfigured = true;
|
||||
}
|
||||
|
||||
qSort(filesToOpen);
|
||||
Utils::sort(filesToOpen);
|
||||
|
||||
// Process all files from the projects
|
||||
foreach (const QString filePath, filesToOpen) {
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "cpplocalsymbols.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -330,7 +331,7 @@ void CheckSymbols::run()
|
||||
_potentialFunctions = collectTypes.functions();
|
||||
_potentialStatics = collectTypes.statics();
|
||||
|
||||
qSort(_macroUses.begin(), _macroUses.end(), sortByLinePredicate);
|
||||
Utils::sort(_macroUses, sortByLinePredicate);
|
||||
_doc->clearDiagnosticMessages();
|
||||
|
||||
if (!isCanceled()) {
|
||||
@@ -1415,7 +1416,7 @@ void CheckSymbols::flush()
|
||||
if (_usages.isEmpty())
|
||||
return;
|
||||
|
||||
qSort(_usages.begin(), _usages.end(), sortByLinePredicate);
|
||||
Utils::sort(_usages, sortByLinePredicate);
|
||||
reportResults(_usages);
|
||||
int cap = _usages.capacity();
|
||||
_usages.clear();
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <cpptools/cppprojectfile.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cplusplus/Token.h>
|
||||
@@ -149,7 +150,7 @@ QString Utils::toString(const QList<ProjectFile> &projectFiles)
|
||||
QStringList filesList;
|
||||
foreach (const ProjectFile &projectFile, projectFiles)
|
||||
filesList << QDir::toNativeSeparators(projectFile.path);
|
||||
qSort(filesList);
|
||||
::Utils::sort(filesList);
|
||||
return filesList.join(QLatin1String("\n"));
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "ui_cppcodemodelsettingspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
@@ -70,7 +71,7 @@ void CppCodeModelSettingsWidget::applyToWidget(QComboBox *chooser, const QString
|
||||
chooser->clear();
|
||||
|
||||
QStringList names = m_settings->availableModelManagerSupportersByName().keys();
|
||||
qSort(names);
|
||||
Utils::sort(names);
|
||||
foreach (const QString &name, names) {
|
||||
const QString &id = m_settings->availableModelManagerSupportersByName()[name];
|
||||
chooser->addItem(name, id);
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <cplusplus/PreprocessorClient.h>
|
||||
#include <cplusplus/PreprocessorEnvironment.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -51,9 +52,6 @@ using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
bool includeLineLessThan(const Include &left, const Include &right)
|
||||
{ return left.line() < right.line(); }
|
||||
|
||||
bool includeFileNamelessThen(const Include & left, const Include & right)
|
||||
{ return left.unresolvedFileName() < right.unresolvedFileName(); }
|
||||
|
||||
@@ -293,7 +291,9 @@ QList<IncludeGroup> LineForNewIncludeDirective::getGroupsByIncludeType(
|
||||
QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByNewLines(QList<Document::Include> &includes)
|
||||
{
|
||||
// Sort by line
|
||||
qSort(includes.begin(), includes.end(), includeLineLessThan);
|
||||
Utils::sort(includes, [](const Include &left, const Include &right) {
|
||||
return left.line() < right.line();
|
||||
});
|
||||
|
||||
// Create groups
|
||||
QList<IncludeGroup> result;
|
||||
|
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/SymbolVisitor.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -48,12 +49,6 @@ Q_DECLARE_METATYPE(QList<Tests::TestDocument>)
|
||||
|
||||
namespace {
|
||||
|
||||
bool hierarchySorter(const TypeHierarchy &h1, const TypeHierarchy &h2)
|
||||
{
|
||||
Overview oo;
|
||||
return oo.prettyName(h1.symbol()->name()) < oo.prettyName(h2.symbol()->name());
|
||||
}
|
||||
|
||||
QString toString(const TypeHierarchy &hierarchy, int indent = 0)
|
||||
{
|
||||
Symbol *symbol = hierarchy.symbol();
|
||||
@@ -61,7 +56,10 @@ QString toString(const TypeHierarchy &hierarchy, int indent = 0)
|
||||
+ Overview().prettyName(symbol->name()) + QLatin1Char('\n');
|
||||
|
||||
QList<TypeHierarchy> sortedHierarchy = hierarchy.hierarchy();
|
||||
qSort(sortedHierarchy.begin(), sortedHierarchy.end(), hierarchySorter);
|
||||
Overview oo;
|
||||
Utils::sort(sortedHierarchy, [&oo](const TypeHierarchy &h1, const TypeHierarchy &h2) -> bool {
|
||||
return oo.prettyName(h1.symbol()->name()) < oo.prettyName(h2.symbol()->name());
|
||||
});
|
||||
foreach (TypeHierarchy childHierarchy, sortedHierarchy)
|
||||
result += toString(childHierarchy, indent + 2);
|
||||
return result;
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "debuggercore.h"
|
||||
#include "debuggerrunconfigurationaspect.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/appmainwindow.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -440,14 +441,11 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
|
||||
return dockWidget;
|
||||
}
|
||||
|
||||
static bool sortCommands(Command *cmd1, Command *cmd2)
|
||||
{
|
||||
return cmd1->action()->text() < cmd2->action()->text();
|
||||
}
|
||||
|
||||
void DebuggerMainWindow::addStagedMenuEntries()
|
||||
{
|
||||
qSort(d->m_menuCommandsToAdd.begin(), d->m_menuCommandsToAdd.end(), &sortCommands);
|
||||
Utils::sort(d->m_menuCommandsToAdd, [](Command *cmd1, Command *cmd2) {
|
||||
return cmd1->action()->text() < cmd2->action()->text();
|
||||
});
|
||||
foreach (Command *cmd, d->m_menuCommandsToAdd)
|
||||
d->m_viewsMenu->addAction(cmd);
|
||||
d->m_menuCommandsToAdd.clear();
|
||||
|
@@ -68,6 +68,7 @@
|
||||
#include <projectexplorer/itaskhandler.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -1000,7 +1001,7 @@ int GdbEngine::commandTimeoutTime() const
|
||||
void GdbEngine::commandTimeout()
|
||||
{
|
||||
QList<int> keys = m_cookieForToken.keys();
|
||||
qSort(keys);
|
||||
Utils::sort(keys);
|
||||
bool killIt = false;
|
||||
foreach (int key, keys) {
|
||||
const GdbCommand &cmd = m_cookieForToken.value(key);
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "debuggerprotocol.h"
|
||||
#include "watchutils.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -253,30 +254,18 @@ Qt::ItemFlags ThreadsHandler::flags(const QModelIndex &index) const
|
||||
return stopped ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0);
|
||||
}
|
||||
|
||||
struct Sorter
|
||||
{
|
||||
Sorter(int column, Qt::SortOrder order)
|
||||
: m_column(column), m_order(order)
|
||||
{}
|
||||
|
||||
bool operator()(const ThreadData &t1, const ThreadData &t2) const
|
||||
{
|
||||
const QVariant v1 = threadPart(t1, m_column);
|
||||
const QVariant v2 = threadPart(t2, m_column);
|
||||
if (v1 == v2)
|
||||
return false;
|
||||
// FIXME: Use correct toXXX();
|
||||
return (v1.toString() < v2.toString()) ^ (m_order == Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
int m_column;
|
||||
Qt::SortOrder m_order;
|
||||
};
|
||||
|
||||
void ThreadsHandler::sort(int column, Qt::SortOrder order)
|
||||
{
|
||||
layoutAboutToBeChanged();
|
||||
qSort(m_threads.begin(), m_threads.end(), Sorter(column, order));
|
||||
Utils::sort(m_threads, [&](const ThreadData &t1, const ThreadData &t2) -> bool {
|
||||
const QVariant v1 = threadPart(t1, column);
|
||||
const QVariant v2 = threadPart(t2, column);
|
||||
if (v1 == v2)
|
||||
return false;
|
||||
// FIXME: Use correct toXXX();
|
||||
return (v1.toString() < v2.toString()) ^ (order == Qt::DescendingOrder);
|
||||
}
|
||||
);
|
||||
layoutChanged();
|
||||
}
|
||||
|
||||
|
@@ -40,13 +40,13 @@
|
||||
#include "imageviewer.h"
|
||||
#include "watchutils.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/savedaction.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QtAlgorithms>
|
||||
#include <QTabWidget>
|
||||
#include <QTextEdit>
|
||||
|
||||
@@ -2120,7 +2120,7 @@ void WatchHandler::editTypeFormats(bool includeLocals, const QByteArray &iname)
|
||||
|
||||
//QHashIterator<QString, QStringList> it(m_reportedTypeFormats);
|
||||
QList<QString> l = m_model->m_reportedTypeFormats.keys();
|
||||
qSort(l.begin(), l.end());
|
||||
Utils::sort(l);
|
||||
foreach (const QString &ba, l) {
|
||||
int f = iname.isEmpty() ? AutomaticFormat : format(iname);
|
||||
dlg.addTypeFormats(ba, m_model->m_reportedTypeFormats.value(ba), f);
|
||||
|
@@ -28,6 +28,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "commitdata.h"
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -166,7 +167,7 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
|
||||
files.append(qMakePair(yState, newFile));
|
||||
}
|
||||
}
|
||||
qSort(files);
|
||||
Utils::sort(files);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "gitutils.h"
|
||||
#include "ui_stashdialog.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -367,7 +368,7 @@ QList<int> StashDialog::selectedRows() const
|
||||
if (index.isValid())
|
||||
rc.push_back(index.row());
|
||||
}
|
||||
qSort(rc);
|
||||
Utils::sort(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,8 @@
|
||||
#include "session.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
@@ -61,7 +63,7 @@ void AllProjectsFilter::updateFiles()
|
||||
files().clear();
|
||||
foreach (Project *project, SessionManager::projects())
|
||||
files().append(project->files(Project::AllFiles));
|
||||
qSort(files());
|
||||
Utils::sort(files());
|
||||
generateFileNames();
|
||||
}
|
||||
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "target.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
/*!
|
||||
@@ -59,7 +61,7 @@ BuildConfigurationModel::BuildConfigurationModel(Target *target, QObject *parent
|
||||
m_target(target)
|
||||
{
|
||||
m_buildConfigurations = m_target->buildConfigurations();
|
||||
qSort(m_buildConfigurations.begin(), m_buildConfigurations.end(), BuildConfigurationComparer());
|
||||
Utils::sort(m_buildConfigurations, BuildConfigurationComparer());
|
||||
|
||||
connect(target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
|
||||
this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "projectexplorer.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
using namespace Core;
|
||||
@@ -64,7 +66,7 @@ void CurrentProjectFilter::updateFiles()
|
||||
if (!m_project)
|
||||
return;
|
||||
files() = m_project->files(Project::AllFiles);
|
||||
qSort(files());
|
||||
Utils::sort(files());
|
||||
generateFileNames();
|
||||
}
|
||||
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "target.h"
|
||||
#include "deployconfiguration.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
/*!
|
||||
@@ -57,7 +59,7 @@ DeployConfigurationModel::DeployConfigurationModel(Target *target, QObject *pare
|
||||
m_target(target)
|
||||
{
|
||||
m_deployConfigurations = m_target->deployConfigurations();
|
||||
qSort(m_deployConfigurations.begin(), m_deployConfigurations.end(), DeployConfigurationComparer());
|
||||
Utils::sort(m_deployConfigurations, DeployConfigurationComparer());
|
||||
|
||||
connect(target, SIGNAL(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)),
|
||||
this, SLOT(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "ioutputparser.h"
|
||||
#include "osparser.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QApplication>
|
||||
@@ -254,7 +255,7 @@ QList<Task> Kit::validate() const
|
||||
}
|
||||
result.append(tmp);
|
||||
}
|
||||
qSort(result);
|
||||
Utils::sort(result);
|
||||
d->m_hasValidityInfo = true;
|
||||
return result;
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "kitmanager.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
@@ -731,23 +732,6 @@ bool MiniProjectTargetSelector::event(QEvent *event)
|
||||
|
||||
}
|
||||
|
||||
class IndexSorter
|
||||
{
|
||||
public:
|
||||
enum SortOrder { Less = 0, Greater = 1};
|
||||
|
||||
IndexSorter(QVector<int> result, SortOrder order)
|
||||
: m_result(result), m_order(order)
|
||||
{ }
|
||||
|
||||
bool operator()(int i, int j)
|
||||
{ return (m_result[i] < m_result[j]) ^ bool(m_order); }
|
||||
|
||||
private:
|
||||
QVector<int> m_result;
|
||||
SortOrder m_order;
|
||||
};
|
||||
|
||||
// does some fancy calculations to ensure proper widths for the list widgets
|
||||
QVector<int> MiniProjectTargetSelector::listWidgetWidths(int minSize, int maxSize)
|
||||
{
|
||||
@@ -796,8 +780,9 @@ QVector<int> MiniProjectTargetSelector::listWidgetWidths(int minSize, int maxSiz
|
||||
if (result[i] != -1)
|
||||
indexes.append(i);
|
||||
|
||||
IndexSorter indexSorter(result, tooSmall ? IndexSorter::Less : IndexSorter::Greater);
|
||||
qSort(indexes.begin(), indexes.end(), indexSorter);
|
||||
Utils::sort(indexes, [&](int i, int j) -> bool {
|
||||
return (result[i] > result[j]) ^ tooSmall;
|
||||
});
|
||||
|
||||
int i = 0;
|
||||
int first = result[indexes.first()]; // biggest or smallest
|
||||
|
@@ -117,6 +117,7 @@
|
||||
#include <coreplugin/fileutils.h>
|
||||
#include <coreplugin/removefiledialog.h>
|
||||
#include <texteditor/findinfiles.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -1966,7 +1967,7 @@ QStringList ProjectExplorerPlugin::allFilesWithDependencies(Project *pro)
|
||||
p->rootProjectNode()->accept(&filesVisitor);
|
||||
filesToSave << filesVisitor.filePaths();
|
||||
}
|
||||
qSort(filesToSave);
|
||||
Utils::sort(filesToSave);
|
||||
return filesToSave;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
@@ -444,7 +445,7 @@ QList<Node*> FlatModel::childNodes(FolderNode *parentNode, const QSet<Node*> &bl
|
||||
recursiveAddFolderNodes(parentNode, &nodeList, blackList);
|
||||
recursiveAddFileNodes(parentNode, &nodeList, blackList + nodeList.toSet());
|
||||
}
|
||||
qSort(nodeList.begin(), nodeList.end(), sortNodes);
|
||||
Utils::sort(nodeList, sortNodes);
|
||||
return nodeList;
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
@@ -406,7 +407,7 @@ void FolderNode::removeFileNodes(const QList<FileNode *> &files)
|
||||
return;
|
||||
|
||||
QList<FileNode*> toRemove = files;
|
||||
qSort(toRemove.begin(), toRemove.end());
|
||||
Utils::sort(toRemove);
|
||||
|
||||
foreach (NodesWatcher *watcher, pn->watchers())
|
||||
emit watcher->filesAboutToBeRemoved(this, toRemove);
|
||||
@@ -486,7 +487,7 @@ void FolderNode::removeFolderNodes(const QList<FolderNode*> &subFolders)
|
||||
return;
|
||||
|
||||
QList<FolderNode*> toRemove = subFolders;
|
||||
qSort(toRemove.begin(), toRemove.end());
|
||||
Utils::sort(toRemove);
|
||||
|
||||
foreach (NodesWatcher *watcher, pn->watchers())
|
||||
emit watcher->foldersAboutToBeRemoved(this, toRemove);
|
||||
@@ -690,8 +691,8 @@ void ProjectNode::addProjectNodes(const QList<ProjectNode*> &subProjects)
|
||||
m_subFolderNodes.append(project);
|
||||
m_subProjectNodes.append(project);
|
||||
}
|
||||
qSort(m_subFolderNodes.begin(), m_subFolderNodes.end());
|
||||
qSort(m_subProjectNodes.begin(), m_subProjectNodes.end());
|
||||
Utils::sort(m_subFolderNodes);
|
||||
Utils::sort(m_subProjectNodes);
|
||||
|
||||
foreach (NodesWatcher *watcher, m_watchers)
|
||||
emit watcher->foldersAdded();
|
||||
@@ -711,7 +712,7 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects)
|
||||
QList<FolderNode*> toRemove;
|
||||
foreach (ProjectNode *projectNode, subProjects)
|
||||
toRemove << projectNode;
|
||||
qSort(toRemove.begin(), toRemove.end());
|
||||
Utils::sort(toRemove);
|
||||
|
||||
foreach (NodesWatcher *watcher, m_watchers)
|
||||
emit watcher->foldersAboutToBeRemoved(this, toRemove);
|
||||
@@ -835,8 +836,8 @@ void SessionNode::addProjectNodes(const QList<ProjectNode*> &projectNodes)
|
||||
m_projectNodes.append(project);
|
||||
}
|
||||
|
||||
qSort(m_subFolderNodes);
|
||||
qSort(m_projectNodes);
|
||||
Utils::sort(m_subFolderNodes);
|
||||
Utils::sort(m_projectNodes);
|
||||
|
||||
foreach (NodesWatcher *watcher, m_watchers)
|
||||
emit watcher->foldersAdded();
|
||||
@@ -850,7 +851,7 @@ void SessionNode::removeProjectNodes(const QList<ProjectNode*> &projectNodes)
|
||||
foreach (ProjectNode *projectNode, projectNodes)
|
||||
toRemove << projectNode;
|
||||
|
||||
qSort(toRemove);
|
||||
Utils::sort(toRemove);
|
||||
|
||||
foreach (NodesWatcher *watcher, m_watchers)
|
||||
emit watcher->foldersAboutToBeRemoved(this, toRemove);
|
||||
|
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
@@ -340,7 +341,7 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
|
||||
|
||||
// Add the project specific pages
|
||||
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
||||
qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
|
||||
Utils::sort(factories, &IPanelFactory::prioritySort);
|
||||
foreach (IProjectPanelFactory *panelFactory, factories) {
|
||||
if (panelFactory->supports(project))
|
||||
subtabs << panelFactory->displayName();
|
||||
@@ -405,7 +406,7 @@ void ProjectWindow::showProperties(int index, int subIndex)
|
||||
}
|
||||
|
||||
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
||||
qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
|
||||
Utils::sort(factories, &IPanelFactory::prioritySort);
|
||||
foreach (IProjectPanelFactory *panelFactory, factories) {
|
||||
if (panelFactory->supports(project)) {
|
||||
if (subIndex == pos) {
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "ui_projectwizardpage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/wizard.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
@@ -162,18 +163,6 @@ void ProjectWizardPage::setVersionControlIndex(int idx)
|
||||
m_ui->addToVersionControlComboBox->setCurrentIndex(idx);
|
||||
}
|
||||
|
||||
// Alphabetically, and files in sub-directories first
|
||||
static bool generatedFilePathLessThan(const QString &filePath1, const QString &filePath2)
|
||||
{
|
||||
const bool filePath1HasDir = filePath1.contains(QLatin1Char('/'));
|
||||
const bool filePath2HasDir = filePath2.contains(QLatin1Char('/'));
|
||||
|
||||
if (filePath1HasDir == filePath2HasDir)
|
||||
return Utils::FileName::fromString(filePath1) < Utils::FileName::fromString(filePath2);
|
||||
else
|
||||
return filePath1HasDir;
|
||||
}
|
||||
|
||||
void ProjectWizardPage::setFilesDisplay(const QString &commonPath, const QStringList &files)
|
||||
{
|
||||
QString fileMessage;
|
||||
@@ -192,7 +181,16 @@ void ProjectWizardPage::setFilesDisplay(const QString &commonPath, const QString
|
||||
foreach (const QString &f, files)
|
||||
formattedFiles.append(f.right(f.size() - prefixSize));
|
||||
}
|
||||
qSort(formattedFiles.begin(), formattedFiles.end(), generatedFilePathLessThan);
|
||||
// Alphabetically, and files in sub-directories first
|
||||
Utils::sort(formattedFiles, [](const QString &filePath1, const QString &filePath2) -> bool {
|
||||
const bool filePath1HasDir = filePath1.contains(QLatin1Char('/'));
|
||||
const bool filePath2HasDir = filePath2.contains(QLatin1Char('/'));
|
||||
|
||||
if (filePath1HasDir == filePath2HasDir)
|
||||
return Utils::FileName::fromString(filePath1) < Utils::FileName::fromString(filePath2);
|
||||
return filePath1HasDir;
|
||||
}
|
||||
);
|
||||
|
||||
foreach (const QString &f, formattedFiles)
|
||||
str << QDir::toNativeSeparators(f) << '\n';
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "target.h"
|
||||
#include "runconfiguration.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
/*!
|
||||
@@ -57,7 +59,7 @@ RunConfigurationModel::RunConfigurationModel(Target *target, QObject *parent)
|
||||
m_target(target)
|
||||
{
|
||||
m_runConfigurations = m_target->runConfigurations();
|
||||
qSort(m_runConfigurations.begin(), m_runConfigurations.end(), RunConfigurationComparer());
|
||||
Utils::sort(m_runConfigurations, RunConfigurationComparer());
|
||||
|
||||
connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
|
||||
this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QVariant>
|
||||
@@ -274,11 +275,6 @@ RunSettingsWidget::~RunSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
static bool actionLessThan(const QAction *action1, const QAction *action2)
|
||||
{
|
||||
return action1->text() < action2->text();
|
||||
}
|
||||
|
||||
void RunSettingsWidget::aboutToShowAddMenu()
|
||||
{
|
||||
m_addRunMenu->clear();
|
||||
@@ -306,7 +302,9 @@ void RunSettingsWidget::aboutToShowAddMenu()
|
||||
}
|
||||
}
|
||||
|
||||
qSort(menuActions.begin(), menuActions.end(), actionLessThan);
|
||||
Utils::sort(menuActions, [](const QAction *l, const QAction *r) {
|
||||
return l->text() < r->text();
|
||||
});
|
||||
foreach (QAction *action, menuActions)
|
||||
m_addRunMenu->addAction(action);
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
@@ -539,13 +540,6 @@ void TargetSettingsPanelWidget::activeTargetChanged(ProjectExplorer::Target *tar
|
||||
m_selector->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool diplayNameSorter(Kit *a, Kit *b)
|
||||
{
|
||||
return a->displayName() < b->displayName();
|
||||
}
|
||||
}
|
||||
|
||||
void TargetSettingsPanelWidget::createAction(Kit *k, QMenu *menu)
|
||||
{
|
||||
QAction *action = new QAction(k->displayName(), menu);
|
||||
@@ -598,7 +592,9 @@ void TargetSettingsPanelWidget::updateTargetButtons()
|
||||
connect(removeAction, SIGNAL(triggered()), this, SLOT(removeTarget()));
|
||||
|
||||
QList<Kit *> kits = KitManager::kits();
|
||||
qSort(kits.begin(), kits.end(), diplayNameSorter);
|
||||
Utils::sort(kits, [](const Kit *a, const Kit *b) {
|
||||
return a->displayName() < b->displayName();
|
||||
});
|
||||
foreach (Kit *k, kits) {
|
||||
if (m_project->target(k))
|
||||
continue;
|
||||
|
@@ -56,11 +56,11 @@
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
#include <cpptools/cpptoolsconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <proparser/prowriter.h>
|
||||
#include <proparser/qmakevfs.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
@@ -501,8 +501,8 @@ struct InternalNode
|
||||
QStringList filesToAdd;
|
||||
|
||||
SortByPath sortByPath;
|
||||
qSort(files.begin(), files.end(), sortByPath);
|
||||
qSort(existingFileNodes.begin(), existingFileNodes.end(), sortByPath);
|
||||
Utils::sort(files, sortByPath);
|
||||
Utils::sort(existingFileNodes, sortByPath);
|
||||
|
||||
ProjectExplorer::compareSortedLists(existingFileNodes, files, filesToRemove, filesToAdd, sortByPath);
|
||||
|
||||
@@ -527,8 +527,8 @@ struct InternalNode
|
||||
QStringList resourcesToAdd;
|
||||
|
||||
SortByPath sortByPath;
|
||||
qSort(files.begin(), files.end(), sortByPath);
|
||||
qSort(existingResourceNodes.begin(), existingResourceNodes.end(), sortByPath);
|
||||
Utils::sort(files, sortByPath);
|
||||
Utils::sort(existingResourceNodes, sortByPath);
|
||||
|
||||
ProjectExplorer::compareSortedLists(existingResourceNodes, files, resourcesToRemove, resourcesToAdd, sortByPath);
|
||||
|
||||
@@ -1854,10 +1854,9 @@ void QmakeProFileNode::applyEvaluate(EvalResult evalResult, bool async)
|
||||
}
|
||||
|
||||
SortByPath sortByPath;
|
||||
qSort(existingProjectNodes.begin(), existingProjectNodes.end(),
|
||||
sortByPath);
|
||||
qSort(newProjectFilesExact.begin(), newProjectFilesExact.end(), sortByPath);
|
||||
qSort(newProjectFilesCumlative.begin(), newProjectFilesCumlative.end(), sortByPath);
|
||||
Utils::sort(existingProjectNodes, sortByPath);
|
||||
Utils::sort(newProjectFilesExact, sortByPath);
|
||||
Utils::sort(newProjectFilesCumlative, sortByPath);
|
||||
|
||||
QList<ProjectNode*> toAdd;
|
||||
QList<ProjectNode*> toRemove;
|
||||
|
@@ -241,10 +241,10 @@ void ProjectFilesVisitor::findProjectFiles(QmakeProFileNode *rootNode, QmakeProj
|
||||
ProjectFilesVisitor visitor(files);
|
||||
rootNode->accept(&visitor);
|
||||
for (int i = 0; i < FileTypeSize; ++i) {
|
||||
qSort(files->files[i]);
|
||||
qSort(files->generatedFiles[i]);
|
||||
Utils::sort(files->files[i]);
|
||||
Utils::sort(files->generatedFiles[i]);
|
||||
}
|
||||
qSort(files->proFiles);
|
||||
Utils::sort(files->proFiles);
|
||||
}
|
||||
|
||||
void ProjectFilesVisitor::visitProjectNode(ProjectNode *projectNode)
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/detailswidget.h>
|
||||
|
||||
using namespace QmakeProjectManager;
|
||||
@@ -248,7 +249,7 @@ void QmakeProjectConfigWidget::updateProblemLabel()
|
||||
buildDirectory = m_buildConfiguration->buildDirectory().toString();
|
||||
QList<ProjectExplorer::Task> issues;
|
||||
issues = version->reportIssues(proFileName, buildDirectory);
|
||||
qSort(issues);
|
||||
Utils::sort(issues);
|
||||
|
||||
if (!issues.isEmpty() || !shadowBuildWarning.isEmpty()) {
|
||||
QString text = QLatin1String("<nobr>") + shadowBuildWarning;
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <qtsupport/debugginghelperbuildtask.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
@@ -275,7 +276,7 @@ bool QMakeStep::init()
|
||||
QString proFile = node->path();
|
||||
|
||||
QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory);
|
||||
qSort(tasks);
|
||||
Utils::sort(tasks);
|
||||
|
||||
if (!tasks.isEmpty()) {
|
||||
bool canContinue = true;
|
||||
|
@@ -34,6 +34,8 @@
|
||||
|
||||
#include <modelnode.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QSet>
|
||||
|
||||
namespace QmlDesigner {
|
||||
@@ -43,11 +45,6 @@ ModelNodeContextMenu::ModelNodeContextMenu(AbstractView *view) :
|
||||
{
|
||||
}
|
||||
|
||||
static bool sortFunction(AbstractDesignerAction * abstractDesignerAction01, AbstractDesignerAction *abstractDesignerAction02)
|
||||
{
|
||||
return abstractDesignerAction01->priority() > abstractDesignerAction02->priority();
|
||||
}
|
||||
|
||||
static QSet<AbstractDesignerAction* > findMembers(QSet<AbstractDesignerAction* > designerActionSet,
|
||||
const QString &category)
|
||||
{
|
||||
@@ -71,7 +68,9 @@ void populateMenu(QSet<AbstractDesignerAction* > &abstractDesignerActions,
|
||||
abstractDesignerActions.subtract(matchingFactories);
|
||||
|
||||
QList<AbstractDesignerAction* > matchingFactoriesList = matchingFactories.toList();
|
||||
qSort(matchingFactoriesList.begin(), matchingFactoriesList.end(), &sortFunction);
|
||||
Utils::sort(matchingFactoriesList, [](AbstractDesignerAction *l, AbstractDesignerAction *r) {
|
||||
return l->priority() > r->priority();
|
||||
});
|
||||
|
||||
foreach (AbstractDesignerAction* designerAction, matchingFactoriesList) {
|
||||
if (designerAction->type() == AbstractDesignerAction::Menu) {
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "modelnodecontextmenu_helper.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <QByteArray>
|
||||
#include <nodeabstractproperty.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <modelnode.h>
|
||||
@@ -43,6 +42,10 @@
|
||||
#include <qmlanchors.h>
|
||||
#include <limits>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QByteArray>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
const PropertyName auxDataString("anchors_");
|
||||
@@ -479,7 +482,7 @@ static void layoutHelperFunction(const SelectionContext &selectionContext,
|
||||
RewriterTransaction transaction(selectionContext.view(), QByteArrayLiteral("DesignerActionManager|layoutHelperFunction2"));
|
||||
|
||||
QList<ModelNode> sortedSelectedNodes = selectionContext.selectedModelNodes();
|
||||
qSort(sortedSelectedNodes.begin(), sortedSelectedNodes.end(), lessThan);
|
||||
Utils::sort(sortedSelectedNodes, lessThan);
|
||||
|
||||
setUpperLeftPostionToNode(layoutNode, sortedSelectedNodes);
|
||||
reparentToNodeAndRemovePositionForModelNodes(layoutNode, sortedSelectedNodes);
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "onedimensionalcluster.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace QmlDesigner {
|
||||
@@ -92,7 +94,7 @@ QList<OneDimensionalCluster> OneDimensionalCluster::reduceOneDimensionalClusterL
|
||||
QList<OneDimensionalCluster> reducedList;
|
||||
while (true)
|
||||
{
|
||||
qSort(workingList);
|
||||
Utils::sort(workingList);
|
||||
reducedList.clear();
|
||||
bool clusterMerged = false;
|
||||
QListIterator<OneDimensionalCluster> clusterIterator(workingList);
|
||||
|
@@ -30,13 +30,15 @@
|
||||
#include "snapper.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <limits>
|
||||
#include <QLineF>
|
||||
#include <QPen>
|
||||
#include <QApplication>
|
||||
|
||||
#include <limits>
|
||||
#include <qmlanchors.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Snapper::Snapper()
|
||||
@@ -452,17 +454,6 @@ double Snapper::snappingDistance() const
|
||||
return m_snappingDistance;
|
||||
}
|
||||
|
||||
static bool lineXLessThan(const QLineF &firstLine, const QLineF &secondLine)
|
||||
{
|
||||
return firstLine.x1() < secondLine.x2();
|
||||
}
|
||||
|
||||
static bool lineYLessThan(const QLineF &firstLine, const QLineF &secondLine)
|
||||
{
|
||||
return firstLine.y1() < secondLine.y2();
|
||||
}
|
||||
|
||||
|
||||
static QLineF mergedHorizontalLine(const QList<QLineF> &lineList)
|
||||
{
|
||||
if (lineList.count() == 1)
|
||||
@@ -504,7 +495,9 @@ static QList<QLineF> mergedHorizontalLines(const QList<QLineF> &lineList)
|
||||
QList<QLineF> mergedLineList;
|
||||
|
||||
QList<QLineF> sortedLineList(lineList);
|
||||
qSort(sortedLineList.begin(), sortedLineList.end(), lineYLessThan);
|
||||
Utils::sort(sortedLineList, [](const QLineF &firstLine, const QLineF &secondLine) {
|
||||
return firstLine.y1() < secondLine.y2();
|
||||
});
|
||||
|
||||
QList<QLineF> lineWithTheSameY;
|
||||
QListIterator<QLineF> sortedLineListIterator(sortedLineList);
|
||||
@@ -531,7 +524,9 @@ static QList<QLineF> mergedVerticalLines(const QList<QLineF> &lineList)
|
||||
QList<QLineF> mergedLineList;
|
||||
|
||||
QList<QLineF> sortedLineList(lineList);
|
||||
qSort(sortedLineList.begin(), sortedLineList.end(), lineXLessThan);
|
||||
Utils::sort(sortedLineList, [](const QLineF &firstLine, const QLineF &secondLine) {
|
||||
return firstLine.x1() < secondLine.x2();
|
||||
});
|
||||
|
||||
QList<QLineF> lineWithTheSameX;
|
||||
QListIterator<QLineF> sortedLineListIterator(sortedLineList);
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "importlabel.h"
|
||||
#include "importmanagercombobox.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QComboBox>
|
||||
|
||||
@@ -118,7 +120,7 @@ void ImportsWidget::setImports(const QList<Import> &imports)
|
||||
|
||||
QList<Import> sortedImports = imports;
|
||||
|
||||
qSort(sortedImports.begin(), sortedImports.end(), importLess);
|
||||
Utils::sort(sortedImports, importLess);
|
||||
|
||||
foreach (const Import &import, sortedImports) {
|
||||
ImportLabel *importLabel = new ImportLabel(this);
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <qmljs/qmljssimplereader.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QApplication>
|
||||
@@ -342,7 +343,7 @@ QString PropertyEditorQmlBackend::templateGeneration(NodeMetaInfo type,
|
||||
qmlTemplate += QStringLiteral("SectionLayout {\n");
|
||||
|
||||
QList<PropertyName> orderedList = type.propertyNames();
|
||||
qSort(orderedList);
|
||||
Utils::sort(orderedList);
|
||||
|
||||
bool emptyTemplate = true;
|
||||
|
||||
|
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <qmldesignerwarning.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -50,7 +51,7 @@ enum { debug = false };
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Allow usage of QFileInfo in qSort
|
||||
// Allow usage of QFileInfo in Utils::sort
|
||||
|
||||
static bool operator<(const QFileInfo &file1, const QFileInfo &file2)
|
||||
{
|
||||
@@ -282,8 +283,8 @@ void SubComponentManager::parseDirectory(const QString &canonicalDirPath, bool a
|
||||
newList << qmlFile;
|
||||
}
|
||||
|
||||
qSort(monitoredList);
|
||||
qSort(newList);
|
||||
Utils::sort(monitoredList);
|
||||
Utils::sort(newList);
|
||||
|
||||
if (debug)
|
||||
qDebug() << "monitored list " << monitoredList.size() << "new list " << newList.size();
|
||||
|
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <QHashIterator>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include "abstractview.h"
|
||||
#include "nodeinstanceview.h"
|
||||
#include "metainfo.h"
|
||||
@@ -1302,7 +1304,7 @@ void ModelPrivate::setSelectedNodes(const QList<InternalNode::Pointer> &selected
|
||||
}
|
||||
|
||||
sortedSelectedList = sortedSelectedList.toSet().toList();
|
||||
qSort(sortedSelectedList);
|
||||
Utils::sort(sortedSelectedList);
|
||||
|
||||
if (sortedSelectedList == m_selectedInternalNodeList)
|
||||
return;
|
||||
|
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <nodelistproperty.h>
|
||||
#include <nodeproperty.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -294,7 +295,7 @@ void ModelToTextMerger::applyChanges()
|
||||
void ModelToTextMerger::reindent(const QMap<int, int> &dirtyAreas) const
|
||||
{
|
||||
QList<int> offsets = dirtyAreas.keys();
|
||||
qSort(offsets);
|
||||
Utils::sort(offsets);
|
||||
TextModifier *textModifier = m_rewriterView->textModifier();
|
||||
|
||||
foreach (const int offset, offsets) {
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "crumblebar.h"
|
||||
|
||||
#include <qmldesigner/qmldesignerplugin.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
|
||||
namespace QmlDesigner {
|
||||
@@ -198,11 +199,6 @@ void ViewManager::setNodeInstanceViewKit(ProjectExplorer::Kit *kit)
|
||||
d->nodeInstanceView.setKit(kit);
|
||||
}
|
||||
|
||||
static bool widgetInfoLessThan(const WidgetInfo &firstWidgetInfo, const WidgetInfo &secondWidgetInfo)
|
||||
{
|
||||
return firstWidgetInfo.placementPriority < secondWidgetInfo.placementPriority;
|
||||
}
|
||||
|
||||
QList<WidgetInfo> ViewManager::widgetInfos()
|
||||
{
|
||||
QList<WidgetInfo> widgetInfoList;
|
||||
@@ -220,7 +216,9 @@ QList<WidgetInfo> ViewManager::widgetInfos()
|
||||
widgetInfoList.append(abstractView->widgetInfo());
|
||||
}
|
||||
|
||||
qSort(widgetInfoList.begin(), widgetInfoList.end(), widgetInfoLessThan);
|
||||
Utils::sort(widgetInfoList, [](const WidgetInfo &firstWidgetInfo, const WidgetInfo &secondWidgetInfo) {
|
||||
return firstWidgetInfo.placementPriority < secondWidgetInfo.placementPriority;
|
||||
});
|
||||
|
||||
return widgetInfoList;
|
||||
}
|
||||
|
@@ -59,7 +59,6 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QtAlgorithms>
|
||||
#include <QDirIterator>
|
||||
#include <QStringList>
|
||||
#include <QIcon>
|
||||
@@ -1034,7 +1033,7 @@ void QmlJSAssistProposalModel::filter(const QString &prefix)
|
||||
|
||||
void QmlJSAssistProposalModel::sort(const QString &prefix)
|
||||
{
|
||||
qSort(currentItems().first, currentItems().second, QmlJSLessThan(prefix));
|
||||
std::sort(currentItems().first, currentItems().second, QmlJSLessThan(prefix));
|
||||
}
|
||||
|
||||
bool QmlJSAssistProposalModel::keepPerfectMatch(TextEditor::AssistReason reason) const
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFutureInterface>
|
||||
@@ -444,7 +445,7 @@ private:
|
||||
addMessages(m_semanticInfo.semanticMessages, m_semanticInfo.document);
|
||||
addMessages(m_semanticInfo.staticAnalysisMessages, m_semanticInfo.document);
|
||||
|
||||
qSort(m_delayedUses.begin(), m_delayedUses.end(), sortByLinePredicate);
|
||||
Utils::sort(m_delayedUses, sortByLinePredicate);
|
||||
}
|
||||
m_currentDelayedUse = 0;
|
||||
|
||||
@@ -513,7 +514,7 @@ private:
|
||||
if (m_uses.isEmpty())
|
||||
return;
|
||||
|
||||
qSort(m_uses.begin(), m_uses.end(), sortByLinePredicate);
|
||||
Utils::sort(m_uses, sortByLinePredicate);
|
||||
reportResults(m_uses);
|
||||
m_uses.clear();
|
||||
m_uses.reserve(chunkSize);
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "qmljslocatordata.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QStringMatcher>
|
||||
|
||||
@@ -101,9 +102,9 @@ QList<Core::LocatorFilterEntry> FunctionFilter::matchesFor(QFutureInterface<Core
|
||||
}
|
||||
|
||||
if (goodEntries.size() < 1000)
|
||||
qSort(goodEntries.begin(), goodEntries.end(), compareLexigraphically);
|
||||
Utils::sort(goodEntries, compareLexigraphically);
|
||||
if (betterEntries.size() < 1000)
|
||||
qSort(betterEntries.begin(), betterEntries.end(), compareLexigraphically);
|
||||
Utils::sort(betterEntries, compareLexigraphically);
|
||||
|
||||
betterEntries += goodEntries;
|
||||
return betterEntries;
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerdatamodel.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QVector>
|
||||
@@ -214,7 +215,7 @@ void QmlProfilerEventsModelProxy::loadData(qint64 rangeStart, qint64 rangeEnd)
|
||||
|
||||
QVector<qint64> eventDurations = durations[it.key()];
|
||||
if (!eventDurations.isEmpty()) {
|
||||
qSort(eventDurations);
|
||||
Utils::sort(eventDurations);
|
||||
stats->medianTime = eventDurations.at(eventDurations.count()/2);
|
||||
}
|
||||
|
||||
|
@@ -31,6 +31,8 @@
|
||||
|
||||
#include "qnxdeviceprocesslist.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -75,6 +77,6 @@ QList<ProjectExplorer::DeviceProcessItem> QnxDeviceProcessList::buildProcessList
|
||||
}
|
||||
}
|
||||
|
||||
qSort(processes);
|
||||
Utils::sort(processes);
|
||||
return processes;
|
||||
}
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <qtsupport/debugginghelperbuildtask.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/runextensions.h>
|
||||
@@ -1180,7 +1181,7 @@ QList<Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QStrin
|
||||
QList<Task> BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const
|
||||
{
|
||||
QList<Task> results = reportIssuesImpl(proFile, buildDir);
|
||||
qSort(results);
|
||||
Utils::sort(results);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <proparser/qmakevfs.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
using namespace QtSupport;
|
||||
@@ -42,17 +43,10 @@ using namespace QtSupport::Internal;
|
||||
QtVersionFactory::QtVersionFactory(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QtVersionFactory::~QtVersionFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool sortByPriority(QtVersionFactory *a, QtVersionFactory *b)
|
||||
{
|
||||
return a->priority() > b->priority();
|
||||
}
|
||||
|
||||
BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error)
|
||||
@@ -73,7 +67,9 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
||||
evaluator.loadNamedSpec(mkspec.toString(), false);
|
||||
|
||||
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
||||
qSort(factories.begin(), factories.end(), &sortByPriority);
|
||||
Utils::sort(factories, [](const QtVersionFactory *l, const QtVersionFactory *r) {
|
||||
return l->priority() > r->priority();
|
||||
});
|
||||
|
||||
foreach (QtVersionFactory *factory, factories) {
|
||||
BaseQtVersion *ver = factory->create(qmakePath, &evaluator, isAutoDetected, autoDetectionSource);
|
||||
|
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/buildablehelperlibrary.h>
|
||||
#include <utils/filesystemwatcher.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -505,7 +506,7 @@ QList<BaseQtVersion *> QtVersionManager::versions()
|
||||
QTC_ASSERT(isLoaded(), return versions);
|
||||
foreach (BaseQtVersion *version, m_versions)
|
||||
versions << version;
|
||||
qSort(versions.begin(), versions.end(), &qtVersionNumberCompare);
|
||||
Utils::sort(versions, qtVersionNumberCompare);
|
||||
return versions;
|
||||
}
|
||||
|
||||
@@ -517,7 +518,7 @@ QList<BaseQtVersion *> QtVersionManager::validVersions()
|
||||
if (v->isValid())
|
||||
results.append(v);
|
||||
}
|
||||
qSort(results.begin(), results.end(), &qtVersionNumberCompare);
|
||||
Utils::sort(results, qtVersionNumberCompare);
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -536,15 +537,6 @@ BaseQtVersion *QtVersionManager::version(int id)
|
||||
return it.value();
|
||||
}
|
||||
|
||||
class SortByUniqueId
|
||||
{
|
||||
public:
|
||||
bool operator()(BaseQtVersion *a, BaseQtVersion *b)
|
||||
{
|
||||
return a->uniqueId() < b->uniqueId();
|
||||
}
|
||||
};
|
||||
|
||||
// This function is really simplistic...
|
||||
static bool equals(BaseQtVersion *a, BaseQtVersion *b)
|
||||
{
|
||||
@@ -556,8 +548,9 @@ void QtVersionManager::setNewQtVersions(QList<BaseQtVersion *> newVersions)
|
||||
// We want to preserve the same order as in the settings dialog
|
||||
// so we sort a copy
|
||||
QList<BaseQtVersion *> sortedNewVersions = newVersions;
|
||||
SortByUniqueId sortByUniqueId;
|
||||
qSort(sortedNewVersions.begin(), sortedNewVersions.end(), sortByUniqueId);
|
||||
Utils::sort(sortedNewVersions, [](const BaseQtVersion *l, const BaseQtVersion *r) {
|
||||
return l->uniqueId() < r->uniqueId();
|
||||
});
|
||||
|
||||
QList<int> addedVersions;
|
||||
QList<int> removedVersions;
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <coreplugin/id.h>
|
||||
#include <projectexplorer/devicesupport/sshdeviceprocesslist.h>
|
||||
#include <ssh/sshremoteprocessrunner.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QTimer>
|
||||
@@ -116,7 +117,7 @@ private:
|
||||
processes.append(process);
|
||||
}
|
||||
|
||||
qSort(processes);
|
||||
Utils::sort(processes);
|
||||
return processes;
|
||||
}
|
||||
};
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <texteditor/storagesettings.h>
|
||||
#include <texteditor/behaviorsettings.h>
|
||||
#include <texteditor/extraencodingsettings.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
@@ -43,7 +44,6 @@
|
||||
#include <QTextCodec>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
namespace TextEditor {
|
||||
@@ -61,7 +61,7 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent)
|
||||
d->m_ui.setupUi(this);
|
||||
|
||||
QList<int> mibs = QTextCodec::availableMibs();
|
||||
qSort(mibs);
|
||||
Utils::sort(mibs);
|
||||
QList<int>::iterator firstNonNegative =
|
||||
std::find_if(mibs.begin(), mibs.end(), std::bind2nd(std::greater_equal<int>(), 0));
|
||||
if (firstNonNegative != mibs.end())
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "codecselector.h"
|
||||
#include "basetextdocument.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/itemviews.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -84,7 +85,7 @@ CodecSelector::CodecSelector(QWidget *parent, BaseTextDocument *doc)
|
||||
QStringList encodings;
|
||||
|
||||
QList<int> mibs = QTextCodec::availableMibs();
|
||||
qSort(mibs);
|
||||
Utils::sort(mibs);
|
||||
QList<int> sortedMibs;
|
||||
foreach (int mib, mibs)
|
||||
if (mib >= 0)
|
||||
|
@@ -40,10 +40,10 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/QtConcurrentTools>
|
||||
#include <utils/networkaccessmanager.h>
|
||||
|
||||
#include <QtAlgorithms>
|
||||
#include <QString>
|
||||
#include <QLatin1Char>
|
||||
#include <QLatin1String>
|
||||
@@ -174,12 +174,6 @@ public:
|
||||
static const int kMaxProgress;
|
||||
};
|
||||
|
||||
bool priorityComp(const QSharedPointer<HighlightDefinitionMetaData> &a,
|
||||
const QSharedPointer<HighlightDefinitionMetaData> &b)
|
||||
{
|
||||
return a->priority > b->priority;
|
||||
}
|
||||
|
||||
const int ManagerProcessor::kMaxProgress = 200;
|
||||
|
||||
ManagerProcessor::ManagerProcessor()
|
||||
@@ -231,7 +225,10 @@ void ManagerProcessor::process(QFutureInterface<QPair<Manager::RegisterData,
|
||||
}
|
||||
|
||||
// Consider definitions with higher priority first.
|
||||
qSort(allMetaData.begin(), allMetaData.end(), &priorityComp);
|
||||
Utils::sort(allMetaData, [](const QSharedPointer<HighlightDefinitionMetaData> &l,
|
||||
const QSharedPointer<HighlightDefinitionMetaData> &r) {
|
||||
return l->priority > r->priority;
|
||||
});
|
||||
|
||||
foreach (const QSharedPointer<HighlightDefinitionMetaData> &metaData, allMetaData) {
|
||||
if (future.isCanceled())
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "texteditorsettings.h"
|
||||
#include "fontsettings.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <qtimer.h>
|
||||
@@ -659,7 +660,7 @@ void SyntaxHighlighter::setExtraAdditionalFormats(const QTextBlock& block,
|
||||
if (block.layout() == 0 || blockLength == 0)
|
||||
return;
|
||||
|
||||
qSort(formats.begin(), formats.end(), byStartOfRange);
|
||||
Utils::sort(formats, byStartOfRange);
|
||||
|
||||
const QList<QTextLayout::FormatRange> all = block.layout()->additionalFormats();
|
||||
QList<QTextLayout::FormatRange> previousSemanticFormats;
|
||||
@@ -678,7 +679,7 @@ void SyntaxHighlighter::setExtraAdditionalFormats(const QTextBlock& block,
|
||||
}
|
||||
|
||||
if (formats.size() == previousSemanticFormats.size()) {
|
||||
qSort(previousSemanticFormats.begin(), previousSemanticFormats.end(), byStartOfRange);
|
||||
Utils::sort(previousSemanticFormats, byStartOfRange);
|
||||
|
||||
int index = 0;
|
||||
for (; index != formats.size(); ++index) {
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "todoitemsmodel.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Todo {
|
||||
@@ -135,7 +137,7 @@ void TodoItemsModel::sort(int column, Qt::SortOrder order)
|
||||
m_currentSortOrder = order;
|
||||
|
||||
TodoItemSortPredicate predicate(m_currentSortColumn, m_currentSortOrder);
|
||||
qSort(m_todoItemsList->begin(), m_todoItemsList->end(), predicate);
|
||||
Utils::sort(*m_todoItemsList, predicate);
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "callgrindfunction.h"
|
||||
#include "callgrindcostitem.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QChar>
|
||||
@@ -68,23 +69,13 @@ public:
|
||||
QVector<const Function *> m_functions;
|
||||
};
|
||||
|
||||
struct SortFunctions {
|
||||
SortFunctions(int event)
|
||||
: m_event(event)
|
||||
{
|
||||
}
|
||||
bool operator()(const Function *left, const Function *right)
|
||||
{
|
||||
return left->inclusiveCost(m_event) > right->inclusiveCost(m_event);
|
||||
}
|
||||
int m_event;
|
||||
};
|
||||
|
||||
void DataModel::Private::updateFunctions()
|
||||
{
|
||||
if (m_data) {
|
||||
m_functions = m_data->functions(m_cycleDetection);
|
||||
qSort(m_functions.begin(), m_functions.end(), SortFunctions(m_event));
|
||||
Utils::sort(m_functions, [this](const Function *l, const Function *r) {
|
||||
return l->inclusiveCost(m_event) > r->inclusiveCost(m_event);
|
||||
});
|
||||
} else {
|
||||
m_functions.clear();
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -116,11 +117,6 @@ static bool equalSuppression(const Error &error, const Error &suppressed)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sortIndizesReverse(const QModelIndex &l, const QModelIndex &r)
|
||||
{
|
||||
return l.row() > r.row();
|
||||
}
|
||||
|
||||
SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error> &errors)
|
||||
: m_view(view),
|
||||
m_settings(view->settings()),
|
||||
@@ -224,7 +220,9 @@ void SuppressionDialog::accept()
|
||||
m_settings->addSuppressionFiles(QStringList(path));
|
||||
|
||||
QModelIndexList indices = m_view->selectionModel()->selectedRows();
|
||||
qSort(indices.begin(), indices.end(), sortIndizesReverse);
|
||||
Utils::sort(indices, [](const QModelIndex &l, const QModelIndex &r) {
|
||||
return l.row() > r.row();
|
||||
});
|
||||
QAbstractItemModel *model = m_view->model();
|
||||
foreach (const QModelIndex &index, indices) {
|
||||
bool removed = model->removeRow(index.row());
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "ui_valgrindconfigwidget.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -216,11 +217,6 @@ void ValgrindConfigWidget::slotSuppressionsAdded(const QStringList &files)
|
||||
m_model->appendRow(new QStandardItem(file));
|
||||
}
|
||||
|
||||
bool sortReverse(int l, int r)
|
||||
{
|
||||
return l > r;
|
||||
}
|
||||
|
||||
void ValgrindConfigWidget::slotRemoveSuppression()
|
||||
{
|
||||
// remove from end so no rows get invalidated
|
||||
@@ -232,7 +228,7 @@ void ValgrindConfigWidget::slotRemoveSuppression()
|
||||
removed << index.data().toString();
|
||||
}
|
||||
|
||||
qSort(rows.begin(), rows.end(), sortReverse);
|
||||
Utils::sort(rows, std::greater<int>());
|
||||
|
||||
foreach (int row, rows)
|
||||
m_model->removeRow(row);
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/iwizardfactory.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/styledbar.h>
|
||||
@@ -184,11 +185,6 @@ void WelcomeMode::sceneGraphError(QQuickWindow::SceneGraphError, const QString &
|
||||
}
|
||||
#endif // Qt 5.3
|
||||
|
||||
bool sortFunction(Utils::IWelcomePage * a, Utils::IWelcomePage *b)
|
||||
{
|
||||
return a->priority() < b->priority();
|
||||
}
|
||||
|
||||
void WelcomeMode::facilitateQml(QQmlEngine * /*engine*/)
|
||||
{
|
||||
}
|
||||
@@ -214,7 +210,9 @@ void WelcomeMode::initPlugins()
|
||||
ctx->setContextProperty(QLatin1String("welcomeMode"), this);
|
||||
|
||||
QList<Utils::IWelcomePage*> duplicatePlugins = PluginManager::getObjects<Utils::IWelcomePage>();
|
||||
qSort(duplicatePlugins.begin(), duplicatePlugins.end(), &sortFunction);
|
||||
Utils::sort(duplicatePlugins, [](const Utils::IWelcomePage *l, const Utils::IWelcomePage *r) {
|
||||
return l->priority() < r->priority();
|
||||
});
|
||||
|
||||
QList<Utils::IWelcomePage*> plugins;
|
||||
QHash<Utils::IWelcomePage::Id, Utils::IWelcomePage*> pluginHash;
|
||||
|
Reference in New Issue
Block a user