Port qSort to std::sort

This commit is contained in:
Laurent Montel 2019-03-12 13:13:53 +01:00
parent 50bfd9fe86
commit 5a3a49c310
10 changed files with 22 additions and 22 deletions

View File

@ -607,7 +607,7 @@ QList< QAction * > BookmarkManager::actionsForUrl(const QUrl &url ) const
}
break;
}
qSort( ret.begin(), ret.end(), okularBookmarkActionLessThan );
std::sort(ret.begin(), ret.end(), okularBookmarkActionLessThan);
return ret;
}
@ -705,7 +705,7 @@ bool BookmarkManager::isBookmarked( const DocumentViewport &viewport ) const
KBookmark BookmarkManager::nextBookmark( const DocumentViewport &viewport) const
{
KBookmark::List bmarks = bookmarks();
qSort( bmarks.begin(), bmarks.end(), bookmarkLessThan);
std::sort(bmarks.begin(), bmarks.end(), bookmarkLessThan);
KBookmark bookmark;
foreach ( const KBookmark &bm, bmarks )
@ -724,7 +724,7 @@ KBookmark BookmarkManager::nextBookmark( const DocumentViewport &viewport) const
KBookmark BookmarkManager::previousBookmark( const DocumentViewport &viewport ) const
{
KBookmark::List bmarks = bookmarks();
qSort( bmarks.begin(), bmarks.end(), bookmarkLessThan );
std::sort(bmarks.begin(), bmarks.end(), bookmarkLessThan);
KBookmark bookmark;
for ( KBookmark::List::const_iterator it = bmarks.constEnd(); it != bmarks.constBegin(); --it )

View File

@ -4569,7 +4569,7 @@ QStringList Document::supportedMimeTypes() const
// Sorting by mimetype name doesn't make a ton of sense,
// but ensures that the list is ordered the same way every time
qSort(result);
std::sort(result.begin(), result.end());
d->m_supportedMimeTypes = result;
}

View File

@ -241,7 +241,7 @@ class Okular::FormFieldChoicePrivate : public Okular::FormFieldPrivate
{
Q_Q( const FormFieldChoice );
QList<int> choices = q->currentChoices();
qSort( choices );
std::sort(choices.begin(), choices.end());
QStringList list;
foreach ( int c, choices )
{

View File

@ -1295,7 +1295,7 @@ QList< QPair<WordsWithCharacters, QRect> > makeAndSortLines(const WordsWithChara
QList<WordWithCharacters> words = wordsTmp;
// Step 1
qSort(words.begin(),words.end(),compareTinyTextEntityY);
std::sort(words.begin(),words.end(), compareTinyTextEntityY);
// Step 2
QList<WordWithCharacters>::Iterator it = words.begin(), itEnd = words.end();
@ -1358,7 +1358,7 @@ QList< QPair<WordsWithCharacters, QRect> > makeAndSortLines(const WordsWithChara
for(int i = 0 ; i < lines.length() ; i++)
{
WordsWithCharacters &list = lines[i].first;
qSort(list.begin(), list.end(), compareTinyTextEntityX);
std::sort(list.begin(), list.end(), compareTinyTextEntityX);
}
return lines;

View File

@ -471,7 +471,7 @@ void TilesManager::cleanupPixmapMemory( qulonglong numberOfBytes, const Normaliz
{
d->rankTiles( d->tiles[ i ], rankedTiles, visibleRect, visiblePageNumber );
}
qSort( rankedTiles.begin(), rankedTiles.end(), rankedTilesLessThan );
std::sort(rankedTiles.begin(), rankedTiles.end(), rankedTilesLessThan);
while ( numberOfBytes > 0 && !rankedTiles.isEmpty() )
{

View File

@ -380,7 +380,7 @@ QList< QUrl > Index::query(const QStringList &terms, const QStringList &termSeq,
if ( !termList.count() )
return QList< QUrl >();
qSort( termList );
std::sort(termList.begin(), termList.end());
QVector<Document> minDocs = termList.takeFirst().documents;
for(QList<Term>::Iterator it = termList.begin(); it != termList.end(); ++it) {
@ -403,7 +403,7 @@ QList< QUrl > Index::query(const QStringList &terms, const QStringList &termSeq,
}
QList< QUrl > results;
qSort( minDocs );
std::sort(minDocs.begin(), minDocs.end());
if ( termSeq.isEmpty() ) {
for(QVector<Document>::Iterator it = minDocs.begin(); it != minDocs.end(); ++it)
results << docList.at((int)(*it).docNumber);

View File

@ -163,7 +163,7 @@ bool Document::processArchive() {
void Document::pages( QVector<Okular::Page*> * pagesVector )
{
qSort( mEntries.begin(), mEntries.end(), caseSensitiveNaturalOrderLessThen );
std::sort(mEntries.begin(), mEntries.end(), caseSensitiveNaturalOrderLessThen);
QScopedPointer< QIODevice > dev;
int count = 0;

View File

@ -507,7 +507,7 @@ static QByteArray readFileOrDirectoryParts( const KArchiveEntry *entry, QString
if ( entry->isDirectory() ) {
const KArchiveDirectory* relDir = static_cast<const KArchiveDirectory *>( entry );
QStringList entries = relDir->entries();
qSort( entries );
std::sort(entries.begin(), entries.end());
Q_FOREACH ( const QString &entry, entries ) {
const KArchiveEntry* relSubEntry = relDir->entry( entry );
if ( !relSubEntry->isFile() )
@ -552,7 +552,7 @@ static const KArchiveEntry* loadEntry( KZip *archive, const QString &fileName, Q
if ( newEntry->isDirectory() ) {
const KArchiveDirectory* relDir = static_cast< const KArchiveDirectory * >( newEntry );
QStringList relEntries = relDir->entries();
qSort( relEntries );
std::sort(relEntries.begin(), relEntries.end());
Q_FOREACH ( const QString &relEntry, relEntries ) {
if ( relEntry.compare( entryName, Qt::CaseInsensitive ) == 0 ) {
return relDir->entry( relEntry );

View File

@ -144,7 +144,7 @@ QVariantList DocumentItem::bookmarkedPages() const
pages << viewport.pageNumber;
}
list = pages.toList();
qSort(list);
std::sort(list.begin(), list.end());
QVariantList variantList;
foreach (const int page, list) {

View File

@ -905,7 +905,7 @@ QString PageViewPrivate::selectedText() const
QString text;
QList< int > selpages = pagesWithTextSelection.toList();
qSort( selpages );
std::sort(selpages.begin(), selpages.end());
const Okular::Page * pg = nullptr;
if ( selpages.count() == 1 )
{
@ -2435,7 +2435,7 @@ void PageView::mousePressEvent( QMouseEvent * e )
col += tsp.rectInSelection.left; // at this point, it's normalised within the whole table
d->tableSelectionCols.append(col);
qSort(d->tableSelectionCols);
std::sort(d->tableSelectionCols.begin(), d->tableSelectionCols.end());
}
} else {
bool deleted=false;
@ -2456,7 +2456,7 @@ void PageView::mousePressEvent( QMouseEvent * e )
row += tsp.rectInSelection.top; // at this point, it's normalised within the whole table
d->tableSelectionRows.append(row);
qSort(d->tableSelectionRows);
std::sort(d->tableSelectionRows.begin(), d->tableSelectionRows.end());
}
}
}
@ -3207,8 +3207,8 @@ void PageView::guessTableDividers()
int tally = 0;
qSort( colSelectionTicks );
qSort( rowSelectionTicks );
std::sort(colSelectionTicks.begin(), colSelectionTicks.end());
std::sort(rowSelectionTicks.begin(), rowSelectionTicks.end());
for (int i = 0; i < colSelectionTicks.length(); ++i)
{
@ -3231,8 +3231,8 @@ void PageView::guessTableDividers()
}
Q_ASSERT( tally == 0 );
qSort( colTicks );
qSort( rowTicks );
std::sort(colTicks.begin(), colTicks.end());
std::sort(rowTicks.begin(), rowTicks.end());
for (int i = 0; i < colTicks.length(); ++i)
{
@ -3991,7 +3991,7 @@ void PageView::updateZoom( ZoomMode newZoomMode )
qCopy(kZoomValues, kZoomValues + 13, zoomValue.begin());
zoomValue[13] = zoomFactorFitWidth;
zoomValue[14] = zoomFactorFitPage;
qSort(zoomValue.begin(), zoomValue.end());
std::sort(zoomValue.begin(), zoomValue.end());
QVector<float>::iterator i;
if ( newZoomMode == ZoomOut )
{