Speed up playqueue searches.

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

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()));
}