From d906d8f402e656ae008b5ebd5296aee1339db4e5 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Mon, 29 Apr 2013 18:34:30 +0000 Subject: [PATCH] Speed up playqueue searches. BUG: 209 --- ChangeLog | 2 +- models/playqueuemodel.cpp | 2 +- models/playqueuemodel.h | 5 ++--- models/playqueueproxymodel.cpp | 5 +++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2aad6fe95..b8e251672 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,7 +43,7 @@ that they always match consume and single icons. 21. Re-enable animation when showing messagewidget, for Qt-only builds and for non 4.9.4 KDE builds. -22. Slightly speed up playqueue searches. +22. Speed up playqueue searches. 23. Add prompt before removing playlists. 24. When dropping files onto playqueue, check that they have a recognized extension (mp3, ogg, flac, wma, m4a, m4b, mp4, m4p, wav, wv, wvp, aiff, diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp index 3bc6a147c..337ba8965 100644 --- a/models/playqueuemodel.cpp +++ b/models/playqueuemodel.cpp @@ -107,7 +107,7 @@ QString PlayQueueModel::headerText(int col) } PlayQueueModel::PlayQueueModel(QObject *parent) - : ActionModel(parent) + : QAbstractItemModel(parent) , currentSongId(-1) , currentSongRowNum(-1) , mpdState(MPDState_Inactive) diff --git a/models/playqueuemodel.h b/models/playqueuemodel.h index a7c394815..10622a674 100644 --- a/models/playqueuemodel.h +++ b/models/playqueuemodel.h @@ -30,14 +30,14 @@ #include #include #include +#include #include "song.h" #include "mpdstatus.h" #include "config.h" -#include "actionmodel.h" class StreamFetcher; -class PlayQueueModel : public ActionModel +class PlayQueueModel : public QAbstractItemModel { Q_OBJECT @@ -95,7 +95,6 @@ public: bool isGrouped() const { return grouped; } void setGrouped(bool g); void update(const QList &songList); - Action * getAction(const QModelIndex &, int) { return 0; } void setStopAfterTrack(qint32 track); void clearStopAfterTrack() { setStopAfterTrack(-1); } diff --git a/models/playqueueproxymodel.cpp b/models/playqueueproxymodel.cpp index 4ab063ba9..83700fba0 100644 --- a/models/playqueueproxymodel.cpp +++ b/models/playqueueproxymodel.cpp @@ -41,6 +41,11 @@ bool PlayQueueProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou return true; } + // Why is this sometimes called with a parent row??? + if (-1!=sourceParent.row()) { + return false; + } + const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); return matchesFilter(*static_cast(index.internalPointer())); }