summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/cachingreader/cachingreader.cpp6
-rw-r--r--src/engine/cachingreader/cachingreader.h9
-rw-r--r--src/engine/effects/engineeffectchain.h6
-rw-r--r--src/engine/readaheadmanager.cpp8
-rw-r--r--src/engine/readaheadmanager.h65
-rw-r--r--src/library/basesqltablemodel.cpp4
-rw-r--r--src/library/basesqltablemodel.h4
-rw-r--r--src/library/basetracktablemodel.cpp4
-rw-r--r--src/library/browse/browsetablemodel.cpp4
-rw-r--r--src/library/browse/browsetablemodel.h2
-rw-r--r--src/library/proxytrackmodel.cpp4
-rw-r--r--src/library/proxytrackmodel.h7
-rw-r--r--src/library/scanner/importfilestask.cpp14
-rw-r--r--src/library/scanner/importfilestask.h28
-rw-r--r--src/library/scanner/recursivescandirectorytask.cpp14
-rw-r--r--src/library/scanner/recursivescandirectorytask.h15
-rw-r--r--src/library/setlogfeature.cpp10
-rw-r--r--src/library/setlogfeature.h3
-rw-r--r--src/library/trackmodel.h8
-rw-r--r--src/util/movinginterquartilemean.cpp20
-rw-r--r--src/util/movinginterquartilemean.h10
-rw-r--r--src/widget/wtracktableview.cpp12
-rw-r--r--src/widget/wtracktableview.h5
23 files changed, 118 insertions, 144 deletions
diff --git a/src/engine/cachingreader/cachingreader.cpp b/src/engine/cachingreader/cachingreader.cpp
index 6a0296837f..3a655732ba 100644
--- a/src/engine/cachingreader/cachingreader.cpp
+++ b/src/engine/cachingreader/cachingreader.cpp
@@ -136,10 +136,12 @@ void CachingReader::freeAllChunks() {
}
CachingReaderChunkForOwner* CachingReader::allocateChunk(SINT chunkIndex) {
- if (m_freeChunks.isEmpty()) {
+ if (m_freeChunks.empty()) {
return nullptr;
}
- CachingReaderChunkForOwner* pChunk = m_freeChunks.takeFirst();
+ CachingReaderChunkForOwner* pChunk = m_freeChunks.front();
+ m_freeChunks.pop_front();
+
pChunk->init(chunkIndex);
m_allocatedCachingReaderChunks.insert(chunkIndex, pChunk);
diff --git a/src/engine/cachingreader/cachingreader.h b/src/engine/cachingreader/cachingreader.h
index acec6c0ec5..d0f971e6b8 100644
--- a/src/engine/cachingreader/cachingreader.h
+++ b/src/engine/cachingreader/cachingreader.h
@@ -1,12 +1,10 @@
// cachingreader.h
// Created 7/9/2009 by RJ Ryan (rryan@mit.edu)
-#ifndef ENGINE_CACHINGREADER_H
-#define ENGINE_CACHINGREADER_H
+#pragma once
#include <QAtomicInt>
#include <QHash>
-#include <QLinkedList>
#include <QList>
#include <QVarLengthArray>
#include <QVector>
@@ -164,7 +162,7 @@ class CachingReader : public QObject {
// List of free chunks. Linked list so that we have constant time insertions
// and deletions. Iteration is not necessary.
- QLinkedList<CachingReaderChunkForOwner*> m_freeChunks;
+ std::list<CachingReaderChunkForOwner*> m_freeChunks;
// Keeps track of what CachingReaderChunks we've allocated and indexes them based on what
// chunk number they are allocated to.
@@ -182,6 +180,3 @@ class CachingReader : public QObject {
CachingReaderWorker m_worker;
};
-
-
-#endif /* ENGINE_CACHINGREADER_H */
diff --git a/src/engine/effects/engineeffectchain.h b/src/engine/effects/engineeffectchain.h
index 51b971ffa7..8dd566f160 100644
--- a/src/engine/effects/engineeffectchain.h
+++ b/src/engine/effects/engineeffectchain.h
@@ -1,9 +1,7 @@
-#ifndef ENGINEEFFECTCHAIN_H
-#define ENGINEEFFECTCHAIN_H
+#pragma once
#include <QString>
#include <QList>
-#include <QLinkedList>
#include "util/class.h"
#include "util/types.h"
@@ -79,5 +77,3 @@ class EngineEffectChain : public EffectsRequestHandler {
DISALLOW_COPY_AND_ASSIGN(EngineEffectChain);
};
-
-#endif /* ENGINEEFFECTCHAIN_H */
diff --git a/src/engine/readaheadmanager.cpp b/src/engine/readaheadmanager.cpp
index be4ba13248..a7f2d95a83 100644
--- a/src/engine/readaheadmanager.cpp
+++ b/src/engine/readaheadmanager.cpp
@@ -221,12 +221,12 @@ void ReadAheadManager::addReadLogEntry(double virtualPlaypositionStart,
ReadLogEntry newEntry(virtualPlaypositionStart,
virtualPlaypositionEndNonInclusive);
if (m_readAheadLog.size() > 0) {
- ReadLogEntry& last = m_readAheadLog.last();
+ ReadLogEntry& last = m_readAheadLog.back();
if (last.merge(newEntry)) {
return;
}
}
- m_readAheadLog.append(newEntry);
+ m_readAheadLog.push_back(newEntry);
}
// Not thread-save, call from engine thread only
@@ -247,7 +247,7 @@ double ReadAheadManager::getFilePlaypositionFromLog(
double filePlayposition = 0;
bool shouldNotifySeek = false;
while (m_readAheadLog.size() > 0 && numConsumedSamples > 0) {
- ReadLogEntry& entry = m_readAheadLog.first();
+ ReadLogEntry& entry = m_readAheadLog.front();
// Notify EngineControls that we have taken a seek.
// Every new entry start with a seek
@@ -264,7 +264,7 @@ double ReadAheadManager::getFilePlaypositionFromLog(
if (entry.length() == 0) {
// This entry is empty now.
- m_readAheadLog.removeFirst();
+ m_readAheadLog.pop_front();
}
shouldNotifySeek = true;
}
diff --git a/src/engine/readaheadmanager.h b/src/engine/readaheadmanager.h
index 9d17efbe86..a436944fb4 100644
--- a/src/engine/readaheadmanager.h
+++ b/src/engine/readaheadmanager.h
@@ -1,10 +1,8 @@
// readaheadmanager.h
// Created 8/2/2009 by RJ Ryan (rryan@mit.edu)
-#ifndef READAHEADMANGER_H
-#define READAHEADMANGER_H
+#pragma once
-#include <QLinkedList>
#include <QList>
#include <QPair>
@@ -15,15 +13,15 @@
class LoopingControl;
class RateControl;
-// ReadAheadManager is a tool for keeping track of the engine's current position
-// in a file. In the case that the engine needs to read ahead of the current
-// play position (for example, to feed more samples into a library like
-// SoundTouch) then this will keep track of how many samples the engine has
-// consumed. The getNextSamples() method encapsulates the logic of determining
-// whether to take a loop or jump into a single method. Whenever the Engine
-// seeks or the current play position is invalidated somehow, the Engine must
-// call notifySeek to inform the ReadAheadManager to reset itself to the seek
-// point.
+/// ReadAheadManager is a tool for keeping track of the engine's current position
+/// in a file. In the case that the engine needs to read ahead of the current
+/// play position (for example, to feed more samples into a library like
+/// SoundTouch) then this will keep track of how many samples the engine has
+/// consumed. The getNextSamples() method encapsulates the logic of determining
+/// whether to take a loop or jump into a single method. Whenever the Engine
+/// seeks or the current play position is invalidated somehow, the Engine must
+/// call notifySeek to inform the ReadAheadManager to reset itself to the seek
+/// point.
class ReadAheadManager {
public:
ReadAheadManager(); // Only for testing: ReadAheadManagerMock
@@ -31,29 +29,28 @@ class ReadAheadManager {
LoopingControl* pLoopingControl);
virtual ~ReadAheadManager();
- // Call this method to fill buffer with requested_samples out of the
- // lookahead buffer. Provide rate as dRate so that the manager knows the
- // direction the audio is progressing in. Returns the total number of
- // samples read into buffer. Note that it is very common that the total
- // samples read is less than the requested number of samples.
+ /// Call this method to fill buffer with requested_samples out of the
+ /// lookahead buffer. Provide rate as dRate so that the manager knows the
+ /// direction the audio is progressing in. Returns the total number of
+ /// samples read into buffer. Note that it is very common that the total
+ /// samples read is less than the requested number of samples.
virtual SINT getNextSamples(double dRate, CSAMPLE* buffer, SINT requested_samples);
-
- // Used to add a new EngineControls that ReadAheadManager will use to decide
- // which samples to return.
+ /// Used to add a new EngineControls that ReadAheadManager will use to decide
+ /// which samples to return.
void addLoopingControl();
void addRateControl(RateControl* pRateControl);
- // Get the current read-ahead position in samples.
- // unused in Mixxx, but needed for testing
+ /// Get the current read-ahead position in samples.
+ /// unused in Mixxx, but needed for testing
virtual inline double getPlaypos() const {
return m_currentPosition;
}
virtual void notifySeek(double seekPosition);
- // hintReader allows the ReadAheadManager to provide hints to the reader to
- // indicate that the given portion of a song is about to be read.
+ /// hintReader allows the ReadAheadManager to provide hints to the reader to
+ /// indicate that the given portion of a song is about to be read.
virtual void hintReader(double dRate, HintVector* hintList);
virtual double getFilePlaypositionFromLog(
@@ -61,8 +58,8 @@ class ReadAheadManager {
double numConsumedSamples);
private:
- // An entry in the read log indicates the virtual playposition the read
- // began at and the virtual playposition it ended at.
+ /// An entry in the read log indicates the virtual playposition the read
+ /// began at and the virtual playposition it ended at.
struct ReadLogEntry {
double virtualPlaypositionStart;
double virtualPlaypositionEndNonInclusive;
@@ -87,10 +84,10 @@ class ReadAheadManager {
virtualPlaypositionStart);
}
- // Moves the start position forward or backward (depending on
- // direction()) by numSamples.
- // Caller should check if length() is 0 after consumption in
- // order to expire the ReadLogEntry.
+ /// Moves the start position forward or backward (depending on
+ /// direction()) by numSamples.
+ /// Caller should check if length() is 0 after consumption in
+ /// order to expire the ReadLogEntry.
double advancePlayposition(double* pNumConsumedSamples) {
double available = math_min(*pNumConsumedSamples, length());
virtualPlaypositionStart += (direction() ? 1 : -1) * available;
@@ -111,18 +108,16 @@ class ReadAheadManager {
}
};
- // virtualPlaypositionEnd is the first sample in the direction that was read
- // that was NOT read as part of this log entry. This is to simplify the
+ /// virtualPlaypositionEnd is the first sample in the direction that was
+ /// read that was NOT read as part of this log entry.
void addReadLogEntry(double virtualPlaypositionStart,
double virtualPlaypositionEndNonInclusive);
LoopingControl* m_pLoopingControl;
RateControl* m_pRateControl;
- QLinkedList<ReadLogEntry> m_readAheadLog;
+ std::list<ReadLogEntry> m_readAheadLog;
double m_currentPosition;
CachingReader* m_pReader;
CSAMPLE* m_pCrossFadeBuffer;
bool m_cacheMissHappened;
};
-
-#endif // READAHEADMANGER_H
diff --git a/src/library/basesqltablemodel.cpp b/src/library/basesqltablemodel.cpp
index 03035310fb..1923ff2b73 100644
--- a/src/library/basesqltablemodel.cpp
+++ b/src/library/basesqltablemodel.cpp
@@ -731,8 +731,8 @@ void BaseSqlTableModel::tracksChanged(QSet<TrackId> trackIds) {
const int numColumns = columnCount();
for (const auto& trackId : trackIds) {
- QLinkedList<int> rows = getTrackRows(trackId);
- foreach (int row, rows) {
+ std::list<int> rows = getTrackRows(trackId);
+ for (int row : rows) {
//qDebug() << "Row in this result set was updated. Signalling update. track:" << trackId << "row:" << row;
QModelIndex topLeft = index(row, 0);
QModelIndex bottomRight = index(row, numColumns);
diff --git a/src/library/basesqltablemodel.h b/src/library/basesqltablemodel.h
index be574d22c5..3f79551e0c 100644
--- a/src/library/basesqltablemodel.h
+++ b/src/library/basesqltablemodel.h
@@ -49,7 +49,7 @@ class BaseSqlTableModel : public BaseTrackTableModel {
TrackId getTrackId(const QModelIndex& index) const override;
QString getTrackLocation(const QModelIndex& index) const override;
- const QLinkedList<int> getTrackRows(TrackId trackId) const override {
+ const std::list<int> getTrackRows(TrackId trackId) const override {
return m_trackIdToRows.value(trackId);
}
@@ -136,7 +136,7 @@ class BaseSqlTableModel : public BaseTrackTableModel {
}
};
- typedef QHash<TrackId, QLinkedList<int>> TrackId2Rows;
+ typedef QHash<TrackId, std::list<int>> TrackId2Rows;
void clearRows();
void replaceRows(
diff --git a/src/library/basetracktablemodel.cpp b/src/library/basetracktablemodel.cpp
index 81e7c186e6..53695a314c 100644
--- a/src/library/basetracktablemodel.cpp
+++ b/src/library/basetracktablemodel.cpp
@@ -709,9 +709,9 @@ void BaseTrackTableModel::slotTrackLoaded(
// preview state will update.
if (m_previewDeckTrackId.isValid()) {
const int numColumns = columnCount();
- QLinkedList<int> rows = getTrackRows(m_previewDeckTrackId);
+ std::list<int> rows = getTrackRows(m_previewDeckTrackId);
m_previewDeckTrackId = TrackId(); // invalidate
- foreach (int row, rows) {
+ for (int row : rows) {
QModelIndex topLeft = index(row, 0);
QModelIndex bottomRight = index(row, numColumns);
emit dataChanged(topLeft, bottomRight);
diff --git a/src/library/browse/browsetablemodel.cpp b/src/library/browse/browsetablemodel.cpp
index 13ea7d4d2d..2e5de46b22 100644
--- a/src/library/browse/browsetablemodel.cpp
+++ b/src/library/browse/browsetablemodel.cpp
@@ -198,10 +198,10 @@ TrackId BrowseTableModel::getTrackId(const QModelIndex& index) const {
}
}
-const QLinkedList<int> BrowseTableModel::getTrackRows(TrackId trackId) const {
+const std::list<int> BrowseTableModel::getTrackRows(TrackId trackId) const {
Q_UNUSED(trackId);
// We can't implement this as it stands.
- return QLinkedList<int>();
+ return std::list<int>();
}
void BrowseTableModel::search(const QString& searchText, const QString& extraFilter) {
diff --git a/src/library/browse/browsetablemodel.h b/src/library/browse/browsetablemodel.h
index 0b61810f5d..b36e44b089 100644
--- a/src/library/browse/browsetablemodel.h
+++ b/src/library/browse/browsetablemodel.h
@@ -56,7 +56,7 @@ class BrowseTableModel final : public QStandardItemModel, public virtual TrackMo
QString getTrackLocation(const QModelIndex& index) const override;
TrackId getTrackId(const QModelIndex& index) const override;
- const QLinkedList<int> getTrackRows(TrackId trackId) const override;
+ const std::list<int> getTrackRows(TrackId trackId) const override;
void search(const QString& searchText,const QString& extraFilter = QString()) override;
void removeTracks(const QModelIndexList& indices) override;
QMimeData* mimeData(const QModelIndexList &indexes) const override;
diff --git a/src/library/proxytrackmodel.cpp b/src/library/proxytrackmodel.cpp
index 65b3e4b73a..dcaafb413f 100644
--- a/src/library/proxytrackmodel.cpp
+++ b/src/library/proxytrackmodel.cpp
@@ -38,8 +38,8 @@ TrackId ProxyTrackModel::getTrackId(const QModelIndex& index) const {
return m_pTrackModel ? m_pTrackModel->getTrackId(indexSource) : TrackId();
}
-const QLinkedList<int> ProxyTrackModel::getTrackRows(TrackId trackId) const {
- return m_pTrackModel ? m_pTrackModel->getTrackRows(trackId) : QLinkedList<int>();
+const std::list<int> ProxyTrackModel::getTrackRows(TrackId trackId) const {
+ return m_pTrackModel ? m_pTrackModel->getTrackRows(trackId) : std::list<int>();
}
TrackPointer ProxyTrackModel::getTrack(const QModelIndex& index) const {
diff --git a/src/library/proxytrackmodel.h b/src/library/proxytrackmodel.h
index 7ed49b25fd..2830a92f2c 100644
--- a/src/library/proxytrackmodel.h
+++ b/src/library/proxytrackmodel.h
@@ -1,5 +1,4 @@
-#ifndef MIXXX_PROXYTRACKMODEL_H
-#define MIXXX_PROXYTRACKMODEL_H
+#pragma once
#include <QSortFilterProxyModel>
#include <QAbstractItemModel>
@@ -28,7 +27,7 @@ class ProxyTrackModel : public QSortFilterProxyModel, public TrackModel {
TrackPointer getTrackByRef(const TrackRef& trackRef) const final;
QString getTrackLocation(const QModelIndex& index) const final;
TrackId getTrackId(const QModelIndex& index) const final;
- const QLinkedList<int> getTrackRows(TrackId trackId) const final;
+ const std::list<int> getTrackRows(TrackId trackId) const final;
void search(const QString& searchText,const QString& extraFilter = QString()) final;
const QString currentSearch() const final;
bool isColumnInternal(int column) final;
@@ -52,5 +51,3 @@ class ProxyTrackModel : public QSortFilterProxyModel, public TrackModel {
QString m_currentSearch;
bool m_bHandleSearches;
};
-
-#endif // MIXXX_PROXYTRACKMODEL_H
diff --git a/src/library/scanner/importfilestask.cpp b/src/library/scanner/importfilestask.cpp
index 86964dffe3..7d124cb286 100644
--- a/src/library/scanner/importfilestask.cpp
+++ b/src/library/scanner/importfilestask.cpp
@@ -5,13 +5,13 @@
#include "util/timer.h"
ImportFilesTask::ImportFilesTask(LibraryScanner* pScanner,
- const ScannerGlobalPointer scannerGlobal,
- const QString& dirPath,
- const bool prevHashExists,
- const mixxx::cache_key_t newHash,
- const QLinkedList<QFileInfo>& filesToImport,
- const QLinkedList<QFileInfo>& possibleCovers,
- SecurityTokenPointer pToken)
+ const ScannerGlobalPointer scannerGlobal,
+ const QString& dirPath,
+ const bool prevHashExists,
+ const mixxx::cache_key_t newHash,
+ const std::list<QFileInfo>& filesToImport,
+ const std::list<QFileInfo>& possibleCovers,
+ SecurityTokenPointer pToken)
: ScannerTask(pScanner, scannerGlobal),
m_dirPath(dirPath),
m_prevHashExists(prevHashExists),
diff --git a/src/library/scanner/importfilestask.h b/src/library/scanner/importfilestask.h
index c4d5e58f1f..c737b4a9dd 100644
--- a/src/library/scanner/importfilestask.h
+++ b/src/library/scanner/importfilestask.h
@@ -1,25 +1,23 @@
-#ifndef IMPORTFILESTASK_H
-#define IMPORTFILESTASK_H
+#pragma once
-#include <QLinkedList>
#include <QFileInfo>
#include "util/sandbox.h"
#include "library/scanner/scannertask.h"
-// Import the provided files. Successful if the scan completed without being
-// cancelled. False if the scan was cancelled part-way through.
+/// Import the provided files. Successful if the scan completed without being
+/// cancelled. False if the scan was cancelled part-way through.
class ImportFilesTask : public ScannerTask {
Q_OBJECT
public:
ImportFilesTask(LibraryScanner* pScanner,
- const ScannerGlobalPointer scannerGlobal,
- const QString& dirPath,
- const bool prevHashExists,
- const mixxx::cache_key_t newHash,
- const QLinkedList<QFileInfo>& filesToImport,
- const QLinkedList<QFileInfo>& possibleCovers,
- SecurityTokenPointer pToken);
+ const ScannerGlobalPointer scannerGlobal,
+ const QString& dirPath,
+ const bool prevHashExists,
+ const mixxx::cache_key_t newHash,
+ const std::list<QFileInfo>& filesToImport,
+ const std::list<QFileInfo>& possibleCovers,
+ SecurityTokenPointer pToken);
virtual ~ImportFilesTask() {}
virtual void run();
@@ -28,9 +26,7 @@ class ImportFilesTask : public ScannerTask {
const QString m_dirPath;
const bool m_prevHashExists;
const mixxx::cache_key_t m_newHash;
- const QLinkedList<QFileInfo> m_filesToImport;
- const QLinkedList<QFileInfo> m_possibleCovers;
+ const std::list<QFileInfo> m_filesToImport;
+ const std::list<QFileInfo> m_possibleCovers;
SecurityTokenPointer m_pToken;
};
-
-#endif /* IMPORTFILESTASK_H */
diff --git a/src/library/scanner/recursivescandirectorytask.cpp b/src/library/scanner/recursivescandirectorytask.cpp
index dcef6e1510..a2ce203f04 100644
--- a/src/library/scanner/recursivescandirectorytask.cpp
+++ b/src/library/scanner/recursivescandirectorytask.cpp
@@ -36,9 +36,9 @@ void RecursiveScanDirectoryTask::run() {
QString currentFile;
QFileInfo currentFileInfo;
- QLinkedList<QFileInfo> filesToImport;
- QLinkedList<QFileInfo> possibleCovers;
- QLinkedList<QDir> dirsToScan;
+ std::list<QFileInfo> filesToImport;
+ std::list<QFileInfo> possibleCovers;
+ std::list<QDir> dirsToScan;
QCryptographicHash hasher(QCryptographicHash::Sha256);
@@ -57,9 +57,9 @@ void RecursiveScanDirectoryTask::run() {
const QString& fileName = currentFileInfo.fileName();
if (supportedExtensionsRegex.indexIn(fileName) != -1) {
hasher.addData(currentFile.toUtf8());
- filesToImport.append(currentFileInfo);
+ filesToImport.push_back(currentFileInfo);
} else if (supportedCoverExtensionsRegex.indexIn(fileName) != -1) {
- possibleCovers.append(currentFileInfo);
+ possibleCovers.push_back(currentFileInfo);
}
} else {
// File is a directory
@@ -69,7 +69,7 @@ void RecursiveScanDirectoryTask::run() {
continue;
}
const QDir currentDir(currentFile);
- dirsToScan.append(currentDir);
+ dirsToScan.push_back(currentDir);
}
}
@@ -89,7 +89,7 @@ void RecursiveScanDirectoryTask::run() {
if (prevHash != newHash) {
// Rescan that mofo! If importing fails then the scan was cancelled so
// we return immediately.
- if (!filesToImport.isEmpty()) {
+ if (!filesToImport.empty()) {
m_pScanner->queueTask(
new ImportFilesTask(m_pScanner, m_scannerGlobal, dirPath,
prevHashExists, newHash, filesToImport,
diff --git a/src/library/scanner/recursivescandirectorytask.h b/src/library/scanner/recursivescandirectorytask.h
index 8ed45c4ecf..5a7440cb83 100644
--- a/src/library/scanner/recursivescandirectorytask.h
+++ b/src/library/scanner/recursivescandirectorytask.h
@@ -1,16 +1,15 @@
-#ifndef RECURSIVESCANDIRECTORYTASK_H
-#define RECURSIVESCANDIRECTORYTASK_H
+#pragma once
#include <QDir>
#include "library/scanner/scannertask.h"
#include "util/sandbox.h"
-// Recursively scan a music library. Doesn't import tracks for any directories
-// that have already been scanned and have not changed. Changes are tracked by
-// performing a hash of the directory's file list, and those hashes are stored
-// in the database. Successful if the scan completed without being
-// cancelled. False if the scan was cancelled part-way through.
+/// Recursively scan a music library. Doesn't import tracks for any directories
+/// that have already been scanned and have not changed. Changes are tracked by
+/// performing a hash of the directory's file list, and those hashes are stored
+/// in the database. Successful if the scan completed without being
+/// cancelled. False if the scan was cancelled part-way through.
class RecursiveScanDirectoryTask : public ScannerTask {
Q_OBJECT
public:
@@ -29,5 +28,3 @@ class RecursiveScanDirectoryTask : public ScannerTask {
SecurityTokenPointer m_pToken;
bool m_scanUnhashed;
};
-
-#endif /* RECURSIVESCANDIRECTORYTASK_H */
diff --git a/src/library/setlogfeature.cpp b/src/library/setlogfeature.cpp
index 3101b47139..d745753316 100644
--- a/src/library/setlogfeature.cpp
+++ b/src/library/setlogfeature.cpp
@@ -288,7 +288,15 @@ void SetlogFeature::slotPlayingTrackChanged(TrackPointer currentPlayingTrack) {
if (currentPlayingTrackId.isValid()) {
// Remove the track from the recent tracks list if it's present and put
// at the front of the list.
- track_played_recently = m_recentTracks.removeOne(currentPlayingTrackId);
+ auto it = std::find(std::begin(m_recentTracks),
+ std::end(m_recentTracks),
+ currentPlayingTrackId);
+ if (it == std::end(m_recentTracks)) {
+ track_played_recently = false;
+ } else {
+ track_played_recently = true;
+ m_recentTracks.erase(it);
+ }
m_recentTracks.push_front(currentPlayingTrackId);
// Keep a window of 6 tracks (inspired by 2 decks, 4 samplers)
diff --git a/src/library/setlogfeature.h b/src/library/setlogfeature.h
index 7cb5c2e541..cf7ccef933 100644
--- a/src/library/setlogfeature.h
+++ b/src/library/setlogfeature.h
@@ -1,7 +1,6 @@
#pragma once
#include <QAction>
-#include <QLinkedList>
#include <QPointer>
#include <QSqlTableModel>
@@ -42,7 +41,7 @@ class SetlogFeature : public BasePlaylistFeature {
private:
QString getRootViewHtml() const override;
- QLinkedList<TrackId> m_recentTracks;
+ std::list<TrackId> m_recentTracks;
QAction* m_pJoinWithPreviousAction;
QAction* m_pGetNewPlaylist;
int m_playlistId;
diff --git a/src/library/trackmodel.h b/src/library/trackmodel.h
index f717fe6e44..f2f2334de1 100644
--- a/src/library/trackmodel.h
+++ b/src/library/trackmodel.h
@@ -1,8 +1,6 @@
-#ifndef TRACKMODEL_H
-#define TRACKMODEL_H
+#pragma once
#include <QList>
-#include <QLinkedList>
#include <QItemDelegate>
#include <QtSql>
@@ -102,7 +100,7 @@ class TrackModel {
// Gets the rows of the track in the current result set. Returns an
// empty list if the track ID is not present in the result set.
- virtual const QLinkedList<int> getTrackRows(TrackId trackId) const = 0;
+ virtual const std::list<int> getTrackRows(TrackId trackId) const = 0;
bool isTrackModel() { return true;}
virtual void search(const QString& searchText, const QString& extraFilter=QString()) = 0;
@@ -207,5 +205,3 @@ class TrackModel {
int m_iDefaultSortColumn;
Qt::SortOrder m_eDefaultSortOrder;
};
-
-#endif
diff --git a/src/util/movinginterquartilemean.cpp b/src/util/movinginterquartilemean.cpp
index d15341a997..daa3a3571d 100644
--- a/src/util/movinginterquartilemean.cpp
+++ b/src/util/movinginterquartilemean.cpp
@@ -12,17 +12,17 @@ double MovingInterquartileMean::insert(double value) {
m_bChanged = true;
// Insert new value
- if (m_list.isEmpty()) {
- m_list.prepend(value);
+ if (m_list.empty()) {
+ m_list.push_front(value);
m_queue.enqueue(m_list.begin());
- } else if (value < m_list.first()) {
- m_list.prepend(value);
+ } else if (value < m_list.front()) {
+ m_list.push_front(value);
m_queue.enqueue(m_list.begin());
- } else if (value >= m_list.last()) {
- m_list.append(value);
+ } else if (value >= m_list.back()) {
+ m_list.push_back(value);
m_queue.enqueue(--m_list.end());
} else {
- QLinkedList<double>::iterator it = m_list.begin()++;
+ std::list<double>::iterator it = m_list.begin()++;
while (value >= *it) {
++it;
}
@@ -60,7 +60,8 @@ double MovingInterquartileMean::mean() {
int quartileSize = m_list.size() / 4;
double interQuartileRange = 2 * quartileSize;
double d_sum = 0;
- QLinkedList<double>::iterator it = m_list.begin() + quartileSize;
+ std::list<double>::iterator it = m_list.begin();
+ std::advance(it, quartileSize);
for (int k = 0; k < 2 * quartileSize; ++k, ++it) {
d_sum += *it;
}
@@ -71,7 +72,8 @@ double MovingInterquartileMean::mean() {
double interQuartileRange = 2 * quartileSize;
int nFullValues = m_list.size() - 2*static_cast<int>(quartileSize) - 2;
double quartileWeight = (interQuartileRange - nFullValues) / 2;
- QLinkedList<double>::iterator it = m_list.begin() + static_cast<int>(quartileSize);
+ std::list<double>::iterator it = m_list.begin();
+ std::advance(it, static_cast<int>(quartileSize));
double d_sum = *it * quartileWeight;
++it;
for (int k = 0; k < nFullValues; ++k, ++it) {
diff --git a/src/util/movinginterquartilemean.h b/src/util/movinginterquartilemean.h
index 5fce5f5a70..138c1aff55 100644
--- a/src/util/movinginterquartilemean.h
+++ b/src/util/movinginterquartilemean.h
@@ -1,7 +1,5 @@
-#ifndef MOVINGINTERQUARTILEMEAN_H
-#define MOVINGINTERQUARTILEMEAN_H
+#pragma once
-#include <QLinkedList>
#include <QQueue>
// Truncated Interquartile mean
@@ -32,13 +30,11 @@ class MovingInterquartileMean {
double m_dMean;
int m_iListMaxSize;
// The list keeps input doubles ordered by value.
- QLinkedList<double> m_list;
+ std::list<double> m_list;
// The queue keeps pointers to doubles in the list ordered
// by the order they were received.
- QQueue<QLinkedList<double>::iterator> m_queue;
+ QQueue<std::list<double>::iterator> m_queue;
// sum() checks this to know if it has to recalculate the mean.
bool m_bChanged;
};
-
-#endif /* MOVINGINTERQUARTILEMEAN_H */
diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp
index 057b312932..794c9f0e4f 100644
--- a/src/widget/wtracktableview.cpp
+++ b/src/widget/wtracktableview.cpp
@@ -1,7 +1,6 @@
#include "widget/wtracktableview.h"
#include <QDrag>
-#include <QLinkedList>
#include <QModelIndex>
#include <QScrollBar>
#include <QShortcut>
@@ -812,12 +811,11 @@ void WTrackTableView::setSelectedTracks(const QList<TrackId>& trackIds) {
}
for (const auto& trackId : trackIds) {
- const QLinkedList<int> gts = pTrackModel->getTrackRows(trackId);
+ const std::list<int> gts = pTrackModel->getTrackRows(trackId);
- QLinkedList<int>::const_iterator i;
- for (i = gts.constBegin(); i != gts.constEnd(); ++i) {
- pSelectionModel->select(model()->index(*i, 0),
- QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ for (int trackRow : gts) {
+ pSelectionModel->select(model()->index(trackRow, 0),
+ QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
}
}
@@ -868,7 +866,7 @@ void WTrackTableView::doSortByColumn(int headerSection, Qt::SortOrder sortOrder)
// the TrackModel. This