Improve playqueue handling when we have 1000s of entries.
This commit is contained in:
27
ChangeLog
27
ChangeLog
@@ -1,18 +1,19 @@
|
||||
0.3.0
|
||||
-----
|
||||
1. Basic copy to/from device support - USB mass storage (UMS) and MTP support
|
||||
only. MTP is *very* slow. (KDE only)
|
||||
2. When refreshing library/albums, only affect parts of the model that have
|
||||
changed. (Previously the whole model was replaced).
|
||||
3. When changing name of playlist, show the original name in the line-edit.
|
||||
4. Fix adding songs with spaces in their filenames to stored playlists
|
||||
5. When we recieve an updated signal frmo MPD, refresh library view.
|
||||
6. When disaplying songs of various artists albums, show as 'track number -
|
||||
artist - song'
|
||||
7. German translation - thanks to Lutz Lüttke
|
||||
8. Rename 'Update Database' action to 'Refresh', as the curent view is now also
|
||||
refreshed.
|
||||
9. When determining cache filename, replace slashes with underscores.
|
||||
1. Basic copy to/from device support - USB mass storage (UMS) and MTP support
|
||||
only. MTP is *very* slow. (KDE only)
|
||||
2. When refreshing library/albums, only affect parts of the model that have
|
||||
changed. (Previously the whole model was replaced).
|
||||
3. When changing name of playlist, show the original name in the line-edit.
|
||||
4. Fix adding songs with spaces in their filenames to stored playlists
|
||||
5. When we recieve an updated signal frmo MPD, refresh library view.
|
||||
6. When disaplying songs of various artists albums, show as 'track number -
|
||||
artist - song'
|
||||
7. German translation - thanks to Lutz Lüttke
|
||||
8. Rename 'Update Database' action to 'Refresh', as the curent view is now also
|
||||
refreshed.
|
||||
9. When determining cache filename, replace slashes with underscores.
|
||||
10. Improve playqueue handling when we have 1000s of entries.
|
||||
|
||||
0.2.1
|
||||
-----
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QResizeEvent>
|
||||
#include <QtGui/QMoveEvent>
|
||||
#include <QtGui/QClipboard>
|
||||
@@ -83,6 +84,7 @@
|
||||
#include "timeslider.h"
|
||||
#include "mpris.h"
|
||||
#include "dockmanager.h"
|
||||
#include "debugtimer.h"
|
||||
|
||||
enum Tabs
|
||||
{
|
||||
@@ -240,7 +242,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
nowPlayingFactor(0),
|
||||
draggingPositionSlider(false),
|
||||
dock(0),
|
||||
mpris(0)
|
||||
mpris(0),
|
||||
playlistSearchTimer(0)
|
||||
{
|
||||
loaded=0;
|
||||
trayItem = 0;
|
||||
@@ -688,6 +691,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
|
||||
playQueueProxyModel.setSourceModel(&playQueueModel);
|
||||
playQueue->setModel(&playQueueProxyModel);
|
||||
playQueueProxyModel.setFilterKeyColumn(-1);
|
||||
playQueue->setAcceptDrops(true);
|
||||
playQueue->setDropIndicatorShown(true);
|
||||
playQueue->addAction(removeFromPlaylistAction);
|
||||
@@ -1104,16 +1108,33 @@ void MainWindow::decreaseVolume()
|
||||
|
||||
void MainWindow::searchPlaylist()
|
||||
{
|
||||
if (searchPlaylistLineEdit->text().isEmpty()) {
|
||||
playQueueProxyModel.setFilterRegExp("");
|
||||
return;
|
||||
if (!playlistSearchTimer) {
|
||||
playlistSearchTimer=new QTimer(this);
|
||||
connect(playlistSearchTimer, SIGNAL(timeout()), SLOT(realSearchPlaylist()));
|
||||
}
|
||||
playlistSearchTimer->start(500);
|
||||
}
|
||||
|
||||
playQueueProxyModel.setFilterRegExp(searchPlaylistLineEdit->text());
|
||||
void MainWindow::realSearchPlaylist()
|
||||
{
|
||||
if (playlistSearchTimer) {
|
||||
playlistSearchTimer->stop();
|
||||
}
|
||||
QString text=searchPlaylistLineEdit->text().trimmed();
|
||||
if (text.length()<4) {
|
||||
playQueueProxyModel.setEnabled(false);
|
||||
if (!playQueueProxyModel.filterRegExp().isEmpty()) {
|
||||
playQueueProxyModel.setFilterRegExp(QString());
|
||||
}
|
||||
} else if (text!=playQueueProxyModel.filterRegExp().pattern()) {
|
||||
playQueueProxyModel.setEnabled(true);
|
||||
playQueueProxyModel.setFilterRegExp(text);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updatePlaylist(const QList<Song> &songs)
|
||||
{
|
||||
TF_DEBUG
|
||||
QList<qint32> selectedSongIds;
|
||||
qint32 firstSelectedSongId = -1;
|
||||
qint32 firstSelectedRow = -1;
|
||||
|
||||
@@ -75,6 +75,7 @@ class QThread;
|
||||
class QAbstractItemView;
|
||||
class DockManager;
|
||||
class Mpris;
|
||||
class QTimer;
|
||||
|
||||
class DeleteKeyEventHandler : public QObject
|
||||
{
|
||||
@@ -223,6 +224,7 @@ private Q_SLOTS:
|
||||
void decreaseVolume();
|
||||
void setPosition();
|
||||
void searchPlaylist();
|
||||
void realSearchPlaylist();
|
||||
void updatePlaylist(const QList<Song> &songs);
|
||||
void updateCurrentSong(const Song &song);
|
||||
void updateStats();
|
||||
@@ -366,6 +368,7 @@ private:
|
||||
QThread *mpdThread;
|
||||
DockManager *dock;
|
||||
Mpris *mpris;
|
||||
QTimer *playlistSearchTimer;
|
||||
friend class VolumeSliderEventHandler;
|
||||
friend class CoverEventHandler;
|
||||
friend class LibraryPage;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "mpdstats.h"
|
||||
#include "mpdstatus.h"
|
||||
#include "streamfetcher.h"
|
||||
#include "debugtimer.h"
|
||||
|
||||
static QStringList reverseList(const QStringList &orig)
|
||||
{
|
||||
@@ -390,14 +391,17 @@ void PlayQueueModel::updateCurrentSong(quint32 id)
|
||||
|
||||
void PlayQueueModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
songs=QList<Song>();
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void PlayQueueModel::updatePlaylist(const QList<Song> &songs)
|
||||
{
|
||||
TF_DEBUG
|
||||
beginResetModel();
|
||||
this->songs = songs;
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,11 +34,12 @@ PlayQueueProxyModel::PlayQueueProxyModel(QObject *parent) : QSortFilterProxyMode
|
||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
//setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
//setSortLocaleAware(true);
|
||||
enabled=false;
|
||||
}
|
||||
|
||||
bool PlayQueueProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
if (filterRegExp().isEmpty()) {
|
||||
if (!enabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ public:
|
||||
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
||||
void setEnabled(bool e) { enabled=e; }
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <KDE/KGlobal>
|
||||
#endif
|
||||
#include <QtGui/QApplication>
|
||||
#include "debugtimer.h"
|
||||
|
||||
//#undef qDebug
|
||||
//#define qDebug qWarning
|
||||
@@ -661,6 +662,7 @@ void MPDConnection::update()
|
||||
*/
|
||||
void MPDConnection::listAllInfo(const QDateTime &dbUpdate)
|
||||
{
|
||||
TF_DEBUG
|
||||
emit updatingLibrary();
|
||||
Response response=sendCommand("listallinfo");
|
||||
if(response.ok) {
|
||||
@@ -676,6 +678,7 @@ void MPDConnection::listAllInfo(const QDateTime &dbUpdate)
|
||||
*/
|
||||
void MPDConnection::listAll()
|
||||
{
|
||||
TF_DEBUG
|
||||
emit updatingFileList();
|
||||
Response response=sendCommand("listall");
|
||||
if(response.ok) {
|
||||
@@ -694,6 +697,7 @@ void MPDConnection::listPlaylist()
|
||||
|
||||
void MPDConnection::listPlaylists()
|
||||
{
|
||||
TF_DEBUG
|
||||
Response response=sendCommand("listplaylists");
|
||||
if(response.ok) {
|
||||
emit playlistsRetrieved(MPDParseUtils::parsePlaylists(response.data));
|
||||
@@ -702,6 +706,7 @@ void MPDConnection::listPlaylists()
|
||||
|
||||
void MPDConnection::playlistInfo(const QString &name)
|
||||
{
|
||||
TF_DEBUG
|
||||
QByteArray data = "listplaylistinfo ";
|
||||
data += encodeName(name);
|
||||
Response response=sendCommand(data);
|
||||
|
||||
Reference in New Issue
Block a user