Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/library/browse/browsetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,31 @@
#include "mixer/playermanager.h"
#include "moc_browsetablemodel.cpp"
#include "track/track.h"
#include "util/compatibility.h"
#include "widget/wlibrarytableview.h"

namespace {

/// Helper to insert values into a QList with specific indices.
///
/// *For legacy code only - Do not use for new code!*
template<typename T>
void listAppendOrReplaceAt(QList<T>* pList, int index, const T& value) {
VERIFY_OR_DEBUG_ASSERT(index <= pList->size()) {
qWarning() << "listAppendOrReplaceAt: Padding list with"
<< (index - pList->size()) << "default elements";
while (index > pList->size()) {
pList->append(T());
}
}
VERIFY_OR_DEBUG_ASSERT(index == pList->size()) {
pList->replace(index, value);
return;
}
pList->append(value);
}

} // anonymous namespace

BrowseTableModel::BrowseTableModel(QObject* parent,
TrackCollectionManager* pTrackCollectionManager,
RecordingManager* pRecordingManager)
Expand Down
20 changes: 0 additions & 20 deletions src/util/compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <QCoreApplication>
#include <QGuiApplication>
#include <QList>
#include <QScreen>
#include <QUuid>
#include <QWidget>
Expand Down Expand Up @@ -121,22 +120,3 @@ inline void atomicStoreRelaxed(QAtomicPointer<T>& atomicPtr, T* newValue) {
atomicPtr.store(newValue);
#endif
}

/// Helper to insert values into a QList with specific indices.
///
/// *For legacy code only - Do not use for new code!*
template<typename T>
inline void listAppendOrReplaceAt(QList<T>* pList, int index, const T& value) {
VERIFY_OR_DEBUG_ASSERT(index <= pList->size()) {
qWarning() << "listAppendOrReplaceAt: Padding list with"
<< (index - pList->size()) << "default elements";
while (index > pList->size()) {
pList->append(T());
}
}
VERIFY_OR_DEBUG_ASSERT(index == pList->size()) {
pList->replace(index, value);
return;
}
pList->append(value);
}