Commit b23998a5 authored by Benjamin Arnaud's avatar Benjamin Arnaud Committed by Jean-Baptiste Kempf
Browse files

qt/mlplaylist: Add CoverGenerator support and proper duration

parent 27eb7756
......@@ -353,7 +353,6 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/medialibrary/mlurlmodel.moc.cpp \
gui/qt/medialibrary/mlvideo.moc.cpp \
gui/qt/medialibrary/mlvideomodel.moc.cpp \
gui/qt/medialibrary/mlplaylist.moc.cpp \
gui/qt/medialibrary/mlplaylistlistmodel.moc.cpp \
gui/qt/medialibrary/mlplaylistmodel.moc.cpp \
gui/qt/menus/custom_menus.moc.cpp \
......
......@@ -199,7 +199,6 @@ void MainUI::registerQMLTypes()
registerAnonymousType<MLAlbum>("org.videolan.medialib", 1);
registerAnonymousType<MLArtist>("org.videolan.medialib", 1);
registerAnonymousType<MLAlbumTrack>("org.videolan.medialib", 1);
registerAnonymousType<MLPlaylist>("org.videolan.medialib", 1);
qmlRegisterType<AlbumContextMenu>( "org.videolan.medialib", 0, 1, "AlbumContextMenu" );
qmlRegisterType<ArtistContextMenu>( "org.videolan.medialib", 0, 1, "ArtistContextMenu" );
......
......@@ -25,23 +25,31 @@
// Ctor / dtor
//-------------------------------------------------------------------------------------------------
MLPlaylist::MLPlaylist(vlc_medialibrary_t * ml, const vlc_ml_playlist_t * data, QObject * parent)
: QObject(parent)
, MLItem(MLItemId(data->i_id, VLC_ML_PARENT_PLAYLIST))
MLPlaylist::MLPlaylist(vlc_medialibrary_t * ml, const vlc_ml_playlist_t * data)
: MLItem(MLItemId(data->i_id, VLC_ML_PARENT_PLAYLIST))
, m_ml(ml)
, m_generator(nullptr)
, m_name(qfu(data->psz_name))
, m_duration(0) // TODO m_duration
, m_count(data->i_nb_media)
{
assert(data);
}
m_name = qfu(data->psz_name);
//-------------------------------------------------------------------------------------------------
// Interface
//-------------------------------------------------------------------------------------------------
// TODO m_cover
bool MLPlaylist::hasGenerator() const
{
return m_generator.get();
}
// TODO m_count
m_count = 0;//data->i_nb_tracks;
void MLPlaylist::setGenerator(CoverGenerator * generator)
{
m_generator.reset(generator);
}
//-------------------------------------------------------------------------------------------------
// Interface
//-------------------------------------------------------------------------------------------------
QString MLPlaylist::getName() const
......@@ -49,11 +57,25 @@ QString MLPlaylist::getName() const
return m_name;
}
//-------------------------------------------------------------------------------------------------
QString MLPlaylist::getCover() const
{
return m_cover;
}
void MLPlaylist::setCover(const QString & fileName)
{
m_cover = fileName;
}
//-------------------------------------------------------------------------------------------------
int64_t MLPlaylist::getDuration() const
{
return m_duration;
}
unsigned int MLPlaylist::getCount() const
{
return m_count;
......
......@@ -23,32 +23,40 @@
#include "config.h"
#endif
// Util includes
#include "util/covergenerator.hpp"
// MediaLibrary includes
#include "mlqmltypes.hpp"
// Qt includes
#include <QObject>
class MLPlaylist : public QObject, public MLItem
class MLPlaylist : public MLItem
{
Q_OBJECT
public:
MLPlaylist(vlc_medialibrary_t * ml,
const vlc_ml_playlist_t * data, QObject * parent = nullptr);
MLPlaylist(vlc_medialibrary_t * ml, const vlc_ml_playlist_t * data);
public: // Interface
QString getName () const;
bool hasGenerator() const;
void setGenerator(CoverGenerator * generator);
QString getName() const;
QString getCover() const;
void setCover(const QString & fileName);
int64_t getDuration() const;
unsigned int getCount() const;
private:
vlc_medialibrary_t * m_ml;
TaskHandle<CoverGenerator> m_generator;
QString m_name;
QString m_cover;
int64_t m_duration;
unsigned int m_count;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment