Permalink
Browse files

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.
  • Loading branch information...
jbroadus authored and hatstand committed Nov 28, 2018
1 parent c6cb733 commit 122d28eab986bbe3d0241ca36747b373189147d7
Showing with 10 additions and 2 deletions.
  1. +5 −1 src/devices/gpoddevice.cpp
  2. +1 −0 src/devices/gpoddevice.h
  3. +3 −1 src/devices/mtpdevice.cpp
  4. +1 −0 src/devices/mtpdevice.h
@@ -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<Song::FileType>* ret) {
*ret << Song::Type_Mp4;
*ret << Song::Type_Mpeg;
@@ -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);
@@ -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<Song::FileType>* supported_types) {
// Ensure only one "organise files" can be active at any one time
db_busy_.lock();
@@ -60,6 +60,7 @@ class MtpDevice : public ConnectedDevice {

private slots:
void LoadFinished();
void LoaderError(const QString& message);

private:
bool GetSupportedFiletypes(QList<Song::FileType>* ret,

0 comments on commit 122d28e

Please sign in to comment.