diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-04-03 18:44:18 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-04-03 18:44:18 +0000 |
| commit | 245027ffccb6dd722b1c928b0d53a62f095c466e (patch) | |
| tree | 294413fcc3da4d6bec3b023995f94151cdbd32e4 /src | |
| parent | c5f29e360410f5f0de93e76282bbed9fcdbeca7e (diff) | |
| download | qmmp-245027ffccb6dd722b1c928b0d53a62f095c466e.tar.gz qmmp-245027ffccb6dd722b1c928b0d53a62f095c466e.tar.bz2 qmmp-245027ffccb6dd722b1c928b0d53a62f095c466e.zip | |
streambrowser: add track with title and genre
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8769 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -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); |
