Commit 74ffcb26 authored by Benjamin Arnaud's avatar Benjamin Arnaud Committed by Hugo Beauzée-Luyssen
Browse files

qt/mlgroup: Add CoverGenerator implementation

parent 22bc7af6
......@@ -347,7 +347,6 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/medialibrary/mlfoldersmodel.moc.cpp \
gui/qt/medialibrary/mlgenre.moc.cpp \
gui/qt/medialibrary/mlgenremodel.moc.cpp \
gui/qt/medialibrary/mlgroup.moc.cpp \
gui/qt/medialibrary/mlgrouplistmodel.moc.cpp \
gui/qt/medialibrary/mlqmltypes.moc.cpp \
gui/qt/medialibrary/mlrecentsmodel.moc.cpp \
......
......@@ -21,17 +21,16 @@
#include "mlgroup.hpp"
// VLC includes
#include <vlc_media_library.h>
#include "qt.hpp"
//-------------------------------------------------------------------------------------------------
// Ctor / dtor
//-------------------------------------------------------------------------------------------------
MLGroup::MLGroup(vlc_medialibrary_t * ml, const vlc_ml_group_t * data, QObject * parent)
: QObject(parent)
, MLItem(MLItemId(data->i_id, VLC_ML_PARENT_GROUP))
MLGroup::MLGroup(vlc_medialibrary_t * ml, const vlc_ml_group_t * data)
: MLItem(MLItemId(data->i_id, VLC_ML_PARENT_GROUP))
, m_ml(ml)
, m_generator(nullptr)
, m_name(qfu(data->psz_name))
, m_duration(data->i_duration)
, m_date(data->i_creation_date)
......@@ -44,16 +43,37 @@ MLGroup::MLGroup(vlc_medialibrary_t * ml, const vlc_ml_group_t * data, QObject *
// Interface
//-------------------------------------------------------------------------------------------------
bool MLGroup::hasGenerator() const
{
return m_generator.get();
}
void MLGroup::setGenerator(CoverGenerator * generator)
{
m_generator.reset(generator);
}
//-------------------------------------------------------------------------------------------------
QString MLGroup::getName() const
{
return m_name;
}
QString MLGroup::getThumbnail()
//-------------------------------------------------------------------------------------------------
QString MLGroup::getCover() const
{
return QString();
return m_cover;
}
void MLGroup::setCover(const QString & fileName)
{
m_cover = fileName;
}
//-------------------------------------------------------------------------------------------------
int64_t MLGroup::getDuration() const
{
return m_duration;
......
......@@ -25,23 +25,25 @@
#include "config.h"
#endif
// Util includes
#include "util/covergenerator.hpp"
// MediaLibrary includes
#include "mlqmltypes.hpp"
// Qt includes
#include <QObject>
class MLGroup : public QObject, public MLItem
class MLGroup : public MLItem
{
Q_OBJECT
public:
MLGroup(vlc_medialibrary_t * ml, const vlc_ml_group_t * data, QObject * parent = nullptr);
MLGroup(vlc_medialibrary_t * ml, const vlc_ml_group_t * data);
public: // Interface
bool hasGenerator() const;
void setGenerator(CoverGenerator * generator);
QString getName() const;
QString getThumbnail();
QString getCover() const;
void setCover(const QString & fileName);
int64_t getDuration() const;
......@@ -52,8 +54,12 @@ public: // Interface
private:
vlc_medialibrary_t * m_ml;
TaskHandle<CoverGenerator> m_generator;
QString m_name;
QString m_cover;
int64_t m_duration;
unsigned int m_date;
......
Supports Markdown
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