diff --git a/src/core/tagfetcher.cpp b/src/core/tagfetcher.cpp index fd7905375..acca3c084 100644 --- a/src/core/tagfetcher.cpp +++ b/src/core/tagfetcher.cpp @@ -110,15 +110,15 @@ TagFetcherItem::TagFetcherItem(const QString& _filename, int _fileId, tunepimp_t fileId_(_fileId), pimp_(_pimp), network_(_network), - already_tried_to_recognize(false) + already_tried_to_recognize_(false) { } void TagFetcherItem::Unrecognized() { - if(already_tried_to_recognize) { + if(already_tried_to_recognize_) { // We already tried to recognize this music and, apparently, nothing has been found: stopping here emit FetchFinishedSignal(fileId_); } else { - already_tried_to_recognize = true; + already_tried_to_recognize_ = true; char trm[255]; trm[0] = 0; track_t track = tp_GetTrack(pimp_, fileId_); diff --git a/src/core/tagfetcher.h b/src/core/tagfetcher.h index 7fab53b04..95d15ac92 100644 --- a/src/core/tagfetcher.h +++ b/src/core/tagfetcher.h @@ -93,7 +93,7 @@ class TagFetcherItem : public QObject { NetworkAccessManager *network_; char puid_[255]; SongList songs_fetched_; - bool already_tried_to_recognize; // to prevent infinite loops while always trying to recognize a file + bool already_tried_to_recognize_; // to prevent infinite loops while always trying to recognize a file #endif // HAVE_LIBTUNEPIMP }; diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index a24af5d54..521cc8913 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -56,7 +56,7 @@ EditTagDialog::EditTagDialog(QWidget* parent) cover_loader_(new BackgroundThreadImplementation(this)), cover_art_id_(0), cover_art_is_set_(false), - resultsDialog_(new TrackSelectionDialog(this)) + results_dialog_(new TrackSelectionDialog(this)) { cover_loader_->Start(true); cover_loader_->Worker()->SetDefaultOutputImage(QImage(":nocover.png")); @@ -65,7 +65,7 @@ EditTagDialog::EditTagDialog(QWidget* parent) #ifdef HAVE_LIBTUNEPIMP connect(tag_fetcher_, SIGNAL(FetchFinished(QString, SongList)), this, SLOT(FetchTagFinished(QString, SongList)), Qt::QueuedConnection); - connect(resultsDialog_, SIGNAL(SongChoosen(QString, Song)), SLOT(FetchTagSongChoosen(QString, Song))); + connect(results_dialog_, SIGNAL(SongChoosen(QString, Song)), SLOT(FetchTagSongChoosen(QString, Song))); #endif ui_->setupUi(this); @@ -711,13 +711,10 @@ void EditTagDialog::FetchTagFinished(const QString& filename, const SongList& so // If no songs have been guessed, just display a message if(songs_guessed.empty()) { - QMessageBox messageBox(this); - messageBox.setWindowTitle(tr("Sorry")); - messageBox.setText(tr("Clementine was unable to find results for this file")); - messageBox.exec(); + QMessageBox::information(this, tr("Sorry"), tr("Clementine was unable to find results for this file")); } else { // Else, display song's tags selection dialog only if edittagdialog is still opened - resultsDialog_->Init(filename, songs_guessed); - resultsDialog_->show(); + results_dialog_->Init(filename, songs_guessed); + results_dialog_->show(); } } #endif @@ -737,11 +734,12 @@ void EditTagDialog::FetchTagSongChoosen(const QString& filename, const Song& son return; } - if(song_choosen.title() != "") + // Fill tags' fields + if(!song_choosen.title().isEmpty()) ui_->title->set_text(song_choosen.title()); - if(song_choosen.album() != "") + if(!song_choosen.album().isEmpty()) ui_->album->set_text(song_choosen.album()); - if(song_choosen.album() != "") + if(!song_choosen.album().isEmpty()) ui_->artist->set_text(song_choosen.artist()); if(song_choosen.track() > 0) ui_->track->set_text(QString::number(song_choosen.track())); diff --git a/src/ui/edittagdialog.h b/src/ui/edittagdialog.h index 212505b64..3b6fca8a9 100644 --- a/src/ui/edittagdialog.h +++ b/src/ui/edittagdialog.h @@ -169,7 +169,7 @@ private: QPushButton* previous_button_; QPushButton* next_button_; - TrackSelectionDialog *resultsDialog_; + TrackSelectionDialog *results_dialog_; }; #endif // EDITTAGDIALOG_H diff --git a/src/ui/trackselectiondialog.cpp b/src/ui/trackselectiondialog.cpp index 2783a786b..ab0b6a9a0 100644 --- a/src/ui/trackselectiondialog.cpp +++ b/src/ui/trackselectiondialog.cpp @@ -30,7 +30,7 @@ TrackSelectionDialog::TrackSelectionDialog(QWidget *parent) } TrackSelectionDialog::~TrackSelectionDialog() { - Clean(); + ui_->resultsTreeWidget->clear(); delete ui_; } @@ -41,6 +41,9 @@ void TrackSelectionDialog::Init(const QString& filename, const SongList& songs) // Set filename ui_->filenameLabel->setText(current_filename_); //TODO: use basefilename, it's nicer + // Clear tree widget + ui_->resultsTreeWidget->clear(); + // Fill tree view with songs int song_index = 0; foreach(const Song& song, songs) { @@ -64,11 +67,6 @@ void TrackSelectionDialog::Init(const QString& filename, const SongList& songs) ui_->resultsTreeWidget->setColumnWidth(3, 50); // Track column } -void TrackSelectionDialog::Clean() { - // Remove and deleted all items - ui_->resultsTreeWidget->clear(); -} - void TrackSelectionDialog::accept() { QDialog::accept(); QTreeWidgetItem *item =ui_->resultsTreeWidget->currentItem(); diff --git a/src/ui/trackselectiondialog.h b/src/ui/trackselectiondialog.h index a9f223af3..b50fcce40 100644 --- a/src/ui/trackselectiondialog.h +++ b/src/ui/trackselectiondialog.h @@ -33,7 +33,6 @@ public: ~TrackSelectionDialog(); void Init(const QString& filename, const SongList& songs); - void Clean(); void accept();