diff options
| -rw-r--r-- | src/plugins/General/streambrowser/streamwindow.cpp | 16 | ||||
| -rw-r--r-- | src/qmmpui/playlistmanager.cpp | 5 | ||||
| -rw-r--r-- | src/qmmpui/playlistmanager.h | 4 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/plugins/General/streambrowser/streamwindow.cpp b/src/plugins/General/streambrowser/streamwindow.cpp index c662b5ea0..504914025 100644 --- a/src/plugins/General/streambrowser/streamwindow.cpp +++ b/src/plugins/General/streambrowser/streamwindow.cpp @@ -179,14 +179,18 @@ void StreamWindow::on_updatePushButton_clicked() void StreamWindow::on_addPushButton_clicked() { - QStringList urls; + QList<PlayListTrack *> tracks; if(m_ui->tabWidget->currentIndex() == 0) { QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0); foreach(QModelIndex index, indexes) { QModelIndex source_index = m_favoritesFilterModel->mapToSource(index); - urls.append(m_favoritesModel->item(source_index.row(),0)->data().toString()); + tracks << new PlayListTrack(); + tracks.last()->setPath(m_favoritesModel->item(source_index.row(),0)->data().toString()); + tracks.last()->setValue(Qmmp::TITLE, m_favoritesModel->item(source_index.row(),0)->text()); + tracks.last()->setValue(Qmmp::GENRE, m_favoritesModel->item(source_index.row(),1)->text()); + } } else @@ -195,11 +199,13 @@ void StreamWindow::on_addPushButton_clicked() foreach(QModelIndex index, indexes) { QModelIndex source_index = m_iceCastFilterModel->mapToSource(index); - urls.append(m_iceCastModel->item(source_index.row(),0)->data().toString()); + tracks << new PlayListTrack(); + tracks.last()->setPath(m_iceCastModel->item(source_index.row(),0)->data().toString()); + tracks.last()->setValue(Qmmp::TITLE, m_iceCastModel->item(source_index.row(),0)->text()); + tracks.last()->setValue(Qmmp::GENRE, m_iceCastModel->item(source_index.row(),1)->text()); } } - urls.removeDuplicates(); - PlayListManager::instance()->add(urls); + PlayListManager::instance()->add(tracks); } void StreamWindow::on_filterLineEdit_textChanged(const QString &text) diff --git a/src/qmmpui/playlistmanager.cpp b/src/qmmpui/playlistmanager.cpp index 52028e4d2..f93858355 100644 --- a/src/qmmpui/playlistmanager.cpp +++ b/src/qmmpui/playlistmanager.cpp @@ -428,6 +428,11 @@ void PlayListManager::showDetails() m_selected->showDetails(); } +void PlayListManager::add(QList<PlayListTrack *> tracks) +{ + m_selected->add(tracks); +} + void PlayListManager::add(const QString &path) { m_selected->add(path); diff --git a/src/qmmpui/playlistmanager.h b/src/qmmpui/playlistmanager.h index b8df71137..be39f11be 100644 --- a/src/qmmpui/playlistmanager.h +++ b/src/qmmpui/playlistmanager.h @@ -204,6 +204,10 @@ public slots: */ void showDetails(); /*! + * This is a convenience function and is the same as calling \b selectedPlayList()->add(tracks) + */ + void add(QList <PlayListTrack *> tracks); + /*! * This is a convenience function and is the same as calling \b selectedPlayList()->add(path) */ void add(const QString &path); |
