diff --git a/modules/gui/qt/network/networkdevicemodel.cpp b/modules/gui/qt/network/networkdevicemodel.cpp index 07e2dd4f69e8d785c512897aa4f264ab06262a74..ff9aa5d97e22d8b48fef12cd8c2fbac2f99ae71a 100644 --- a/modules/gui/qt/network/networkdevicemodel.cpp +++ b/modules/gui/qt/network/networkdevicemodel.cpp @@ -204,6 +204,16 @@ bool NetworkDeviceModel::addAndPlay(const QModelIndexList& itemIdList) return ret; } +QMap<QString, QVariant> NetworkDeviceModel::getDataAt(int idx) +{ + QMap<QString, QVariant> dataDict; + QHash<int,QByteArray> roles = roleNames(); + for (auto role: roles.keys()) { + dataDict[roles[role]] = data(index(idx), role); + } + return dataDict; +} + 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 bc662f5c62f284ae15848bba180ce6227635a054..166870361f94323a534336690862618d1105ade1 100644 --- a/modules/gui/qt/network/networkdevicemodel.hpp +++ b/modules/gui/qt/network/networkdevicemodel.hpp @@ -89,6 +89,8 @@ public: Q_INVOKABLE bool addAndPlay(const QVariantList& itemIdList); Q_INVOKABLE bool addAndPlay(const QModelIndexList& itemIdList); + Q_INVOKABLE QMap<QString, QVariant> getDataAt(int index); + signals: void ctxChanged(); void sdSourceChanged(); diff --git a/modules/gui/qt/network/networkmediamodel.cpp b/modules/gui/qt/network/networkmediamodel.cpp index bd1ccda102ec3144c4c5b5e21b187c8e8f72d015..ddb87b5e2b1655cd5918aec36f2915fa4723a3e4 100644 --- a/modules/gui/qt/network/networkmediamodel.cpp +++ b/modules/gui/qt/network/networkmediamodel.cpp @@ -106,6 +106,18 @@ QHash<int, QByteArray> NetworkMediaModel::roleNames() const }; } + +QMap<QString, QVariant> NetworkMediaModel::getDataAt(int idx) +{ + QMap<QString, QVariant> dataDict; + QHash<int,QByteArray> roles = roleNames(); + for (auto role: roles.keys()) { + dataDict[roles[role]] = data(index(idx), role); + } + return dataDict; +} + + int NetworkMediaModel::rowCount(const QModelIndex& parent) const { if ( parent.isValid() ) diff --git a/modules/gui/qt/network/networkmediamodel.hpp b/modules/gui/qt/network/networkmediamodel.hpp index ebf4634f862f4ff238f588c33f490913e36ae1bd..ee368c184831393926a6d72f93d6660a55e5739c 100644 --- a/modules/gui/qt/network/networkmediamodel.hpp +++ b/modules/gui/qt/network/networkmediamodel.hpp @@ -124,6 +124,8 @@ public: inline bool getParsingPending() const { return m_parsingPending; } int getCount() const; + Q_INVOKABLE QMap<QString, QVariant> getDataAt(int idx); + Q_INVOKABLE bool addToPlaylist( int index ); Q_INVOKABLE bool addToPlaylist(const QVariantList& itemIdList); Q_INVOKABLE bool addToPlaylist(const QModelIndexList& itemIdList);