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.
This commit is contained in:
Jim Broadus 2018-11-28 02:23:31 -08:00 committed by John Maguire
parent c6cb7333a6
commit 122d28eab9
4 changed files with 10 additions and 2 deletions

View File

@ -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;

View File

@ -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);

View File

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

View File

@ -60,6 +60,7 @@ class MtpDevice : public ConnectedDevice {
private slots:
void LoadFinished();
void LoaderError(const QString& message);
private:
bool GetSupportedFiletypes(QList<Song::FileType>* ret,