make playlists shareable
This commit is contained in:
1 parent
813f522f2c
commit
d303fc34fe
3 files changed
+33
No files matched your search
@@ -16,6 +16,11 @@ Kirigami.ScrollablePage {
|
||||
SongMenu {
|
||||
id: menu
|
||||
}
|
||||
ShareMenu {
|
||||
id: shareMenu
|
||||
inputTitle: playlistModel.title
|
||||
url: playlistModel.webUrl
|
||||
}
|
||||
ListView {
|
||||
id: songList
|
||||
|
||||
@@ -36,6 +41,21 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
}
|
||||
]
|
||||
overflowActions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Open in Browser")
|
||||
icon.name: "internet-services"
|
||||
onTriggered: Qt.openUrlExternally(playlistModel.webUrl)
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Share")
|
||||
icon.name: "emblem-shared-symbolic"
|
||||
onTriggered:{
|
||||
shareMenu.open()
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
title: playlistModel.title
|
||||
imageSourceURL: playlistModel.thumbnailUrl
|
||||
width: songList.width
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "asyncytmusic.h"
|
||||
#include "playlistutils.h"
|
||||
|
||||
#include <QStringBuilder>
|
||||
|
||||
|
||||
PlaylistModel::PlaylistModel(QObject *parent)
|
||||
: AbstractYTMusicModel(parent)
|
||||
{
|
||||
@@ -99,3 +102,8 @@ QString PlaylistModel::title() const
|
||||
{
|
||||
return QString::fromStdString(m_playlist.title);
|
||||
}
|
||||
|
||||
QUrl PlaylistModel::webUrl() const
|
||||
{
|
||||
return QUrl(YTMUSIC_WEB_BASE_URL % "playlist?list=" % playlistId());
|
||||
}
|
||||
@@ -19,6 +19,8 @@ class PlaylistModel : public AbstractYTMusicModel
|
||||
// output
|
||||
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl NOTIFY thumbnailUrlChanged)
|
||||
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
|
||||
Q_PROPERTY(QUrl webUrl READ webUrl NOTIFY playlistIdChanged)
|
||||
|
||||
|
||||
public:
|
||||
explicit PlaylistModel(QObject *parent = nullptr);
|
||||
@@ -45,6 +47,9 @@ public:
|
||||
QString title() const;
|
||||
Q_SIGNAL void titleChanged();
|
||||
|
||||
QUrl webUrl() const;
|
||||
|
||||
|
||||
private:
|
||||
QString m_playlistId;
|
||||
|
||||
|
||||
Reference in new issue
Block a user