diff --git a/modules/gui/qt/network/networkdevicemodel.cpp b/modules/gui/qt/network/networkdevicemodel.cpp index 0501d2b95b7a278fae23ecfd1ba7a007bece8332..07e2dd4f69e8d785c512897aa4f264ab06262a74 100644 --- a/modules/gui/qt/network/networkdevicemodel.cpp +++ b/modules/gui/qt/network/networkdevicemodel.cpp @@ -147,6 +147,19 @@ bool NetworkDeviceModel::addToPlaylist(const QVariantList &itemIdList) return ret; } +bool NetworkDeviceModel::addToPlaylist(const QModelIndexList &itemIdList) +{ + bool ret = false; + for (const QModelIndex& index: itemIdList) + { + if (!index.isValid()) + continue; + ret |= addToPlaylist(index.row()); + } + return ret; +} + + bool NetworkDeviceModel::addAndPlay(int index) { if (!(m_ctx && m_sdSource != CAT_MYCOMPUTER)) @@ -176,6 +189,21 @@ bool NetworkDeviceModel::addAndPlay(const QVariantList& itemIdList) return ret; } +bool NetworkDeviceModel::addAndPlay(const QModelIndexList& itemIdList) +{ + bool ret = false; + for (const QModelIndex& index: itemIdList) + { + if (!index.isValid()) + continue; + if (!ret) + ret |= addAndPlay(index.row()); + else + ret |= addToPlaylist(index.row()); + } + return ret; +} + bool NetworkDeviceModel::initializeMediaSources() { auto libvlc = vlc_object_instance(m_ctx->getIntf()); diff --git a/modules/gui/qt/network/networkdevicemodel.hpp b/modules/gui/qt/network/networkdevicemodel.hpp index 8706f7ba0f2eae948a2c4367708e5a585718c88d..bc662f5c62f284ae15848bba180ce6227635a054 100644 --- a/modules/gui/qt/network/networkdevicemodel.hpp +++ b/modules/gui/qt/network/networkdevicemodel.hpp @@ -84,8 +84,10 @@ public: Q_INVOKABLE bool addToPlaylist( int index ); Q_INVOKABLE bool addToPlaylist(const QVariantList& itemIdList); + Q_INVOKABLE bool addToPlaylist(const QModelIndexList& itemIdList); Q_INVOKABLE bool addAndPlay( int index ); Q_INVOKABLE bool addAndPlay(const QVariantList& itemIdList); + Q_INVOKABLE bool addAndPlay(const QModelIndexList& itemIdList); signals: void ctxChanged(); diff --git a/modules/gui/qt/network/networkmediamodel.cpp b/modules/gui/qt/network/networkmediamodel.cpp index fd0a9f76cecfdb0acd8f70d2a17ea8b703f78900..bd1ccda102ec3144c4c5b5e21b187c8e8f72d015 100644 --- a/modules/gui/qt/network/networkmediamodel.cpp +++ b/modules/gui/qt/network/networkmediamodel.cpp @@ -217,6 +217,18 @@ bool NetworkMediaModel::addToPlaylist(const QVariantList &itemIdList) return ret; } +bool NetworkMediaModel::addToPlaylist(const QModelIndexList &itemIdList) +{ + bool ret = false; + for (const QModelIndex& index: itemIdList) + { + if (!index.isValid()) + continue; + ret |= addToPlaylist(index.row()); + } + return ret; +} + bool NetworkMediaModel::addAndPlay(int index) { if (!(m_ctx && m_hasTree)) @@ -251,6 +263,22 @@ bool NetworkMediaModel::addAndPlay(const QVariantList& itemIdList) return ret; } +bool NetworkMediaModel::addAndPlay(const QModelIndexList& itemIdList) +{ + bool ret = false; + for (const QModelIndex& index: itemIdList) + { + if (!index.isValid()) + continue; + + if (!ret) + ret |= addAndPlay(index.row()); + else + ret |= addToPlaylist(index.row()); + } + return ret; +} + bool NetworkMediaModel::initializeMediaSources() { diff --git a/modules/gui/qt/network/networkmediamodel.hpp b/modules/gui/qt/network/networkmediamodel.hpp index 13bece16cb697d0360221d7a4792b2e9c3435dbf..ebf4634f862f4ff238f588c33f490913e36ae1bd 100644 --- a/modules/gui/qt/network/networkmediamodel.hpp +++ b/modules/gui/qt/network/networkmediamodel.hpp @@ -126,8 +126,10 @@ public: Q_INVOKABLE bool addToPlaylist( int index ); Q_INVOKABLE bool addToPlaylist(const QVariantList& itemIdList); + Q_INVOKABLE bool addToPlaylist(const QModelIndexList& itemIdList); Q_INVOKABLE bool addAndPlay( int index ); Q_INVOKABLE bool addAndPlay(const QVariantList& itemIdList); + Q_INVOKABLE bool addAndPlay(const QModelIndexList& itemIdList); signals: void nameChanged();