Speed up playqueue searches.

BUG: 209
This commit is contained in:
craig.p.drummond
2013-04-29 18:34:30 +00:00
committed by craig.p.drummond
parent d4e5592ca6
commit 717b280d0a
4 changed files with 9 additions and 5 deletions

View File

@@ -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,

View File

@@ -107,7 +107,7 @@ QString PlayQueueModel::headerText(int col)
}
PlayQueueModel::PlayQueueModel(QObject *parent)
: ActionModel(parent)
: QAbstractItemModel(parent)
, currentSongId(-1)
, currentSongRowNum(-1)
, mpdState(MPDState_Inactive)

View File

@@ -30,14 +30,14 @@
#include <QList>
#include <QStringList>
#include <QSet>
#include <QAbstractItemModel>
#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<Song> &songList);
Action * getAction(const QModelIndex &, int) { return 0; }
void setStopAfterTrack(qint32 track);
void clearStopAfterTrack() { setStopAfterTrack(-1); }

View File

@@ -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<Song *>(index.internalPointer()));
}