From e38a221858d932aab81e04c5a95188a3e705ed12 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 26 Aug 2017 08:04:07 +0200 Subject: Play the doubleClicked url Shit, it worked on the first attempt! --- playerwidget.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'playerwidget.cpp') diff --git a/playerwidget.cpp b/playerwidget.cpp index 37c6d5c..3dd8b87 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -811,6 +811,11 @@ void PlayerWidget::viewDoubleClicked(const QModelIndex &idx){ addToPlayList(); return; } + if(model == mWebRadioModel){ + QString url(idx.data(UrlRole).toString()); + playUrl(url); + return; + } QString fp(idx.data(FullPathRole).toString()); QFileInfo fi(fp); if(fi.isDir()){ @@ -1391,6 +1396,11 @@ void PlayerWidget::play(const QString &fullPath){ emit playModeChanged(tr("Playing")); } +void PlayerWidget::playUrl(const QString &url){ + mPlayer->setMedia(QUrl(url)); + mPlayer->play(); +} + void PlayerWidget::volumeChanged(int volume){ QString s = QString("%1 %").arg(volume, 3, 10, QChar('0')); mVolumePos->setText(s); -- cgit v1.2.3-70-g09d2