From 122d28eab986bbe3d0241ca36747b373189147d7 Mon Sep 17 00:00:00 2001 From: Jim Broadus Date: Wed, 28 Nov 2018 02:23:31 -0800 Subject: [PATCH] Fix device loader error messages. (#6215) GPodLoader and MtpLoader Error signals were connected to Error signals in their repective device classes, but the actual signal definition in ConnectedDevice was removed in a refactor several years ago. This change adds LoaderError slots to these device classes and reports the error in the manner of the refactored code. --- src/devices/gpoddevice.cpp | 6 +++++- src/devices/gpoddevice.h | 1 + src/devices/mtpdevice.cpp | 4 +++- src/devices/mtpdevice.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/devices/gpoddevice.cpp b/src/devices/gpoddevice.cpp index 2a0429243..cacfb14ec 100644 --- a/src/devices/gpoddevice.cpp +++ b/src/devices/gpoddevice.cpp @@ -47,7 +47,7 @@ void GPodDevice::Init() { shared_from_this()); loader_->moveToThread(loader_thread_); - connect(loader_, SIGNAL(Error(QString)), SIGNAL(Error(QString))); + connect(loader_, SIGNAL(Error(QString)), SLOT(LoaderError(QString))); connect(loader_, SIGNAL(TaskStarted(int)), SIGNAL(TaskStarted(int))); connect(loader_, SIGNAL(LoadFinished(Itdb_iTunesDB*)), SLOT(LoadFinished(Itdb_iTunesDB*))); @@ -223,6 +223,10 @@ void GPodDevice::FinishDelete(bool success) { ConnectedDevice::FinishDelete(success); } +void GPodDevice::LoaderError(const QString& message) { + app_->AddError(message); +} + bool GPodDevice::GetSupportedFiletypes(QList* ret) { *ret << Song::Type_Mp4; *ret << Song::Type_Mpeg; diff --git a/src/devices/gpoddevice.h b/src/devices/gpoddevice.h index b40333053..e2c6eb0e6 100644 --- a/src/devices/gpoddevice.h +++ b/src/devices/gpoddevice.h @@ -53,6 +53,7 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage { protected slots: void LoadFinished(Itdb_iTunesDB* db); + void LoaderError(const QString& message); protected: Itdb_Track* AddTrackToITunesDb(const Song& metadata); diff --git a/src/devices/mtpdevice.cpp b/src/devices/mtpdevice.cpp index 252289fa9..cfd879ef2 100644 --- a/src/devices/mtpdevice.cpp +++ b/src/devices/mtpdevice.cpp @@ -54,7 +54,7 @@ void MtpDevice::Init() { new MtpLoader(url_, app_->task_manager(), backend_, shared_from_this()); loader_->moveToThread(loader_thread_); - connect(loader_, SIGNAL(Error(QString)), SIGNAL(Error(QString))); + connect(loader_, SIGNAL(Error(QString)), SLOT(LoaderError(QString))); connect(loader_, SIGNAL(TaskStarted(int)), SIGNAL(TaskStarted(int))); connect(loader_, SIGNAL(LoadFinished()), SLOT(LoadFinished())); connect(loader_thread_, SIGNAL(started()), loader_, SLOT(LoadDatabase())); @@ -69,6 +69,8 @@ void MtpDevice::LoadFinished() { db_busy_.unlock(); } +void MtpDevice::LoaderError(const QString& message) { app_->AddError(message); } + bool MtpDevice::StartCopy(QList* supported_types) { // Ensure only one "organise files" can be active at any one time db_busy_.lock(); diff --git a/src/devices/mtpdevice.h b/src/devices/mtpdevice.h index c3577cfc4..1a9ab1efe 100644 --- a/src/devices/mtpdevice.h +++ b/src/devices/mtpdevice.h @@ -60,6 +60,7 @@ class MtpDevice : public ConnectedDevice { private slots: void LoadFinished(); + void LoaderError(const QString& message); private: bool GetSupportedFiletypes(QList* ret,