From 6fdae108b851fdedbbd9f9cf41fca8f13fedbe9d Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Tue, 18 Aug 2015 23:45:03 +0100 Subject: [PATCH] Remove AudioCD tracks from playqueue when device removed --- devices/audiocddevice.cpp | 2 +- devices/device.h | 1 - models/devicesmodel.cpp | 1 - models/playqueuemodel.cpp | 1 - models/playqueuemodel.h | 2 +- 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/devices/audiocddevice.cpp b/devices/audiocddevice.cpp index 9f1c96d2a..8b16ec1f3 100644 --- a/devices/audiocddevice.cpp +++ b/devices/audiocddevice.cpp @@ -149,7 +149,7 @@ AudioCdDevice::~AudioCdDevice() } if (!tracks.isEmpty()) { - emit invalid(tracks); + PlayQueueModel::self()->remove(tracks); } #ifdef CDDB_FOUND diff --git a/devices/device.h b/devices/device.h index 9296a91dd..89826eb43 100644 --- a/devices/device.h +++ b/devices/device.h @@ -192,7 +192,6 @@ Q_SIGNALS: void cover(const Song &song, const QImage &img); void cacheSaved(); void configurationChanged(); - void invalid(const QList &songs); void play(const QList &songs); void updatedDetails(const QList &songs); void renamed(); diff --git a/models/devicesmodel.cpp b/models/devicesmodel.cpp index c8138a6e9..b7258583a 100644 --- a/models/devicesmodel.cpp +++ b/models/devicesmodel.cpp @@ -455,7 +455,6 @@ void DevicesModel::addLocalDevice(const QString &udi) connect(dev, SIGNAL(updating(const QString &, bool)), SLOT(deviceUpdating(const QString &, bool))); connect(dev, SIGNAL(error(const QString &)), SIGNAL(error(const QString &))); connect(dev, SIGNAL(cover(const Song &, const QImage &)), SLOT(setCover(const Song &, const QImage &))); - connect(dev, SIGNAL(invalid(QList)), SIGNAL(invalid(QList))); connect(dev, SIGNAL(updatedDetails(QList)), SIGNAL(updatedDetails(QList))); connect(dev, SIGNAL(play(QList)), SLOT(play(QList))); connect(dev, SIGNAL(renamed()), this, SLOT(updateItemMenu())); diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp index 4940b2d01..45bcb6183 100644 --- a/models/playqueuemodel.cpp +++ b/models/playqueuemodel.cpp @@ -227,7 +227,6 @@ PlayQueueModel::PlayQueueModel(QObject *parent) connect(MPDConnection::self(), SIGNAL(rating(QString,quint8)), SLOT(ratingResult(QString,quint8))); connect(MPDConnection::self(), SIGNAL(stickerDbChanged()), SLOT(stickerDbChanged())); #ifdef ENABLE_DEVICES_SUPPORT //TODO: Problems here with devices support!!! - connect(DevicesModel::self(), SIGNAL(invalid(QList)), SLOT(remove(QList))); connect(DevicesModel::self(), SIGNAL(updatedDetails(QList)), SLOT(updateDetails(QList))); #endif #if defined ENABLE_MODEL_TEST diff --git a/models/playqueuemodel.h b/models/playqueuemodel.h index 7a3055a2a..ccfbd5f90 100644 --- a/models/playqueuemodel.h +++ b/models/playqueuemodel.h @@ -140,6 +140,7 @@ public: void enableUndo(bool e); bool lastCommandWasUnodOrRedo() const { return Cmd_Other!=lastCommand; } qint32 totalTime() const { return time; } + void remove(const QList &rem); private: void saveHistory(const QList &prevList); @@ -160,7 +161,6 @@ public Q_SLOTS: private Q_SLOTS: void sortBy(); void stopAfterCurrentChanged(bool afterCurrent); - void remove(const QList &rem); void updateDetails(const QList &updated); void undo(); void redo();