1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-27 04:21:53 +02:00

qt: Create MLGroup

Signed-off-by: Pierre Lamot <pierre@videolabs.io>
This commit is contained in:
Benjamin Arnaud 2021-03-23 09:30:02 +01:00 committed by Pierre Lamot
parent 7d0b66b5c2
commit 5b3f9a34d6
4 changed files with 139 additions and 0 deletions

View File

@ -157,6 +157,8 @@ libqt_plugin_la_SOURCES = \
gui/qt/medialibrary/mlgenre.hpp \
gui/qt/medialibrary/mlgenremodel.cpp \
gui/qt/medialibrary/mlgenremodel.hpp \
gui/qt/medialibrary/mlgroup.cpp \
gui/qt/medialibrary/mlgroup.hpp \
gui/qt/medialibrary/mlhelper.cpp \
gui/qt/medialibrary/mlhelper.hpp \
gui/qt/medialibrary/mlqmltypes.hpp \
@ -340,6 +342,7 @@ 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/mlqmltypes.moc.cpp \
gui/qt/medialibrary/mlrecentsmodel.moc.cpp \
gui/qt/medialibrary/mlrecentsvideomodel.moc.cpp \

View File

@ -0,0 +1,70 @@
/*****************************************************************************
* Copyright (C) 2021 VLC authors and VideoLAN
*
* Authors: Benjamin Arnaud <bunjee@omega.gg>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ( at your option ) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#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))
, m_ml(ml)
, m_name(qfu(data->psz_name))
, m_duration(data->i_duration)
, m_date(data->i_creation_date)
, m_count(data->i_nb_total_media)
{
assert(data);
}
//-------------------------------------------------------------------------------------------------
// Interface
//-------------------------------------------------------------------------------------------------
QString MLGroup::getName() const
{
return m_name;
}
QString MLGroup::getThumbnail()
{
return QString();
}
int64_t MLGroup::getDuration() const
{
return m_duration;
}
unsigned int MLGroup::getDate() const
{
return m_date;
}
unsigned int MLGroup::getCount() const
{
return m_count;
}

View File

@ -0,0 +1,64 @@
/*****************************************************************************
* Copyright (C) 2021 VLC authors and VideoLAN
*
* Authors: Benjamin Arnaud <bunjee@omega.gg>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ( at your option ) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MLGROUP_HPP
#define MLGROUP_HPP
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
// MediaLibrary includes
#include "mlqmltypes.hpp"
// Qt includes
#include <QObject>
class MLGroup : public QObject, public MLItem
{
Q_OBJECT
public:
MLGroup(vlc_medialibrary_t * ml, const vlc_ml_group_t * data, QObject * parent = nullptr);
public: // Interface
QString getName() const;
QString getThumbnail();
int64_t getDuration() const;
unsigned int getDate() const;
unsigned int getCount() const;
private:
vlc_medialibrary_t * m_ml;
QString m_name;
int64_t m_duration;
unsigned int m_date;
unsigned int m_count;
};
#endif

View File

@ -773,6 +773,8 @@ modules/gui/qt/medialibrary/mlbookmarkmodel.cpp
modules/gui/qt/medialibrary/mlbookmarkmodel.hpp
modules/gui/qt/medialibrary/mlfoldersmodel.cpp
modules/gui/qt/medialibrary/mlfoldersmodel.hpp
modules/gui/qt/medialibrary/mlgroup.cpp
modules/gui/qt/medialibrary/mlgroup.hpp
modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp
modules/gui/qt/medialibrary/mlplaylistlistmodel.hpp
modules/gui/qt/medialibrary/mlplaylistmedia.cpp