diff options
author | Arno <arno@disconnect.de> | 2017-08-26 08:04:07 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-08-26 08:04:07 +0200 |
commit | e38a221858d932aab81e04c5a95188a3e705ed12 (patch) | |
tree | 8c65edc749e8434d42a03345e2c5328fb483ce8e | |
parent | 1285456abe4be9a22dc42498a1d0a1a43a0a00be (diff) | |
download | BeetPlayer-e38a221858d932aab81e04c5a95188a3e705ed12.tar.gz BeetPlayer-e38a221858d932aab81e04c5a95188a3e705ed12.tar.bz2 BeetPlayer-e38a221858d932aab81e04c5a95188a3e705ed12.zip |
Play the doubleClicked url
Shit, it worked on the first attempt!
-rw-r--r-- | playerwidget.cpp | 10 | ||||
-rw-r--r-- | playerwidget.h | 1 |
2 files changed, 11 insertions, 0 deletions
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); diff --git a/playerwidget.h b/playerwidget.h index 2087311..2fb218a 100644 --- a/playerwidget.h +++ b/playerwidget.h @@ -107,6 +107,7 @@ class PlayerWidget : public QWidget { void recurse(const QModelIndex &parent); void addSong(const QModelIndex &idx); void play(const QString &fullPath); + void playUrl(const QString &url); void advance(int numSongs); void expandRecursive(const QModelIndex &idx); void adjustVolume(int by); |