diff options
| author | Elvis Angelaccio <[email protected]> | 2020-07-05 18:21:20 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2020-07-06 07:16:27 +0000 |
| commit | 85241a9246171b11119f81de0974d6fb438a5a46 (patch) | |
| tree | 944c0d28b14d9d634799ae2f2277ee9f36fdb7df /src | |
| parent | ee97db4dfc10e87f637d8387fb3f4d3590d95697 (diff) | |
Port away from QLinkedList
`QLinkedList` has been deprecated and should not be used in new code. Port
to `std::list` instead.
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/private/kdirectorycontentscounter.cpp | 19 | ||||
| -rw-r--r-- | src/kitemviews/private/kdirectorycontentscounter.h | 5 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp index 4d6a4861c..608f9f582 100644 --- a/src/kitemviews/private/kdirectorycontentscounter.cpp +++ b/src/kitemviews/private/kdirectorycontentscounter.cpp @@ -103,10 +103,14 @@ void KDirectoryContentsCounter::slotResult(const QString& path, int count, long m_watchedDirs.insert(resolvedPath); } - if (!m_priorityQueue.isEmpty()) { - startWorker(m_priorityQueue.takeFirst()); - } else if (!m_queue.isEmpty()) { - startWorker(m_queue.takeFirst()); + if (!m_priorityQueue.empty()) { + const QString firstPath = m_priorityQueue.front(); + m_priorityQueue.pop_front(); + startWorker(firstPath); + } else if (!m_queue.empty()) { + const QString firstPath = m_queue.front(); + m_queue.pop_front(); + startWorker(firstPath); } if (s_cache->contains(resolvedPath)) { @@ -178,12 +182,13 @@ void KDirectoryContentsCounter::startWorker(const QString& path) } if (m_workerIsBusy) { - if (!m_queue.contains(path) && !m_priorityQueue.contains(path)) { + if (std::find(m_queue.begin(), m_queue.end(), path) == m_queue.end() && + std::find(m_priorityQueue.begin(), m_priorityQueue.end(), path) == m_priorityQueue.end()) { if (alreadyInCache) { - m_queue.append(path); + m_queue.push_back(path); } else { // append to priority queue - m_priorityQueue.append(path); + m_priorityQueue.push_back(path); } } } else { diff --git a/src/kitemviews/private/kdirectorycontentscounter.h b/src/kitemviews/private/kdirectorycontentscounter.h index 65c4bcb1b..d5baf3462 100644 --- a/src/kitemviews/private/kdirectorycontentscounter.h +++ b/src/kitemviews/private/kdirectorycontentscounter.h @@ -23,7 +23,6 @@ #include "kdirectorycontentscounterworker.h" -#include <QLinkedList> #include <QSet> #include <QHash> @@ -73,8 +72,8 @@ private: KFileItemModel* m_model; // Used as FIFO queues. - QLinkedList<QString> m_priorityQueue; - QLinkedList<QString> m_queue; + std::list<QString> m_priorityQueue; + std::list<QString> m_queue; static QThread* m_workerThread; |
