Skip to content
Snippets Groups Projects
Commit cd305426 authored by Benjamin Arnaud's avatar Benjamin Arnaud Committed by Pierre Lamot
Browse files

qt/playlist_controller: Add the 'insert' function


Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
parent f474d6e0
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@
#include "playlist_controller_p.hpp"
#include "vlc_player.h"
#include "vlc_url.h"
#include "util/qmlinputitem.hpp"
#include <algorithm>
#include <QVariant>
#include <QDesktopServices>
......@@ -441,6 +442,24 @@ PlaylistControllerModel::remove(const QVector<PlaylistItem> &items, ssize_t inde
throw std::bad_alloc();
}
void
PlaylistControllerModel::insert(int index, const QVariantList & items)
{
QVector<vlc::playlist::Media> medias;
for (const QVariant & variant : items)
{
if (variant.canConvert<QmlInputItem>() == false)
continue;
const QmlInputItem & item = variant.value<QmlInputItem>();
medias.push_back(vlc::playlist::Media(item.item.get()));
}
insert(index, medias, false);
}
void
PlaylistControllerModel::shuffle()
{
......
......@@ -112,6 +112,8 @@ public:
void move(const QVector<PlaylistItem> &, size_t target, ssize_t indexHint);
void remove(const QVector<PlaylistItem> &, ssize_t indexHint);
Q_INVOKABLE void insert(int index, const QVariantList & items /* QList<QmlInputItem> */);
Q_INVOKABLE void shuffle();
void sort(const QVector<vlc_playlist_sort_criterion> &);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment