From c2bd0bbb05cb5d11838a1075d8e744d1deee8923 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 25 Dec 2010 00:33:53 +0000 Subject: [PATCH] Make the rating widget work --- src/ui/edittagdialog.cpp | 14 ++++++++++++++ src/ui/edittagdialog.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index 37d478172..5d60cad2f 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -106,6 +106,8 @@ EditTagDialog::EditTagDialog(QWidget* parent) SLOT(SelectionChanged())); connect(ui_->button_box, SIGNAL(clicked(QAbstractButton*)), SLOT(ButtonClicked(QAbstractButton*))); + connect(ui_->rating, SIGNAL(RatingChanged(float)), + SLOT(SongRated(float))); // Set up the album cover menu cover_menu_ = new QMenu(this); @@ -612,3 +614,15 @@ void EditTagDialog::showEvent(QShowEvent* e) { QDialog::showEvent(e); } + +void EditTagDialog::SongRated(float rating) { + const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes(); + if (sel.isEmpty()) + return; + Song& song = data_[sel.first().row()].original_; + if (!song.is_valid() || song.id() == -1) + return; + + song.set_rating(rating); + backend_->UpdateSongRatingAsync(song.id(), rating); +} diff --git a/src/ui/edittagdialog.h b/src/ui/edittagdialog.h index e56d800aa..602047d38 100644 --- a/src/ui/edittagdialog.h +++ b/src/ui/edittagdialog.h @@ -68,6 +68,7 @@ private slots: void FieldValueEdited(); void ResetField(); void ButtonClicked(QAbstractButton* button); + void SongRated(float rating); void ArtLoaded(quint64 id, const QImage& image);