From 245027ffccb6dd722b1c928b0d53a62f095c466e Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 3 Apr 2019 18:44:18 +0000 Subject: 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 --- src/plugins/General/streambrowser/streamwindow.cpp | 16 +++++++++++----- src/qmmpui/playlistmanager.cpp | 5 +++++ src/qmmpui/playlistmanager.h | 4 ++++ 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src') 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 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 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 @@ -203,6 +203,10 @@ public slots: * This is a convenience function and is the same as calling \b selectedPlayList()->showDetails() */ void showDetails(); + /*! + * This is a convenience function and is the same as calling \b selectedPlayList()->add(tracks) + */ + void add(QList tracks); /*! * This is a convenience function and is the same as calling \b selectedPlayList()->add(path) */ -- cgit v1.2.3-13-gbd6f