vlc | branch: master | Benjamin Arnaud <benjamin.arn...@videolabs.io> | Tue Mar 23 09:30:02 2021 +0100| [5b3f9a34d686be2fce5adfaaf0d1a03a212d8a6e] | committer: Pierre Lamot
qt: Create MLGroup Signed-off-by: Pierre Lamot <pie...@videolabs.io> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b3f9a34d686be2fce5adfaaf0d1a03a212d8a6e --- modules/gui/qt/Makefile.am | 3 ++ modules/gui/qt/medialibrary/mlgroup.cpp | 70 +++++++++++++++++++++++++++++++++ modules/gui/qt/medialibrary/mlgroup.hpp | 64 ++++++++++++++++++++++++++++++ po/POTFILES.in | 2 + 4 files changed, 139 insertions(+) diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 1195de8cc6..fe9ac33221 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -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 \ diff --git a/modules/gui/qt/medialibrary/mlgroup.cpp b/modules/gui/qt/medialibrary/mlgroup.cpp new file mode 100644 index 0000000000..8f1bd8664f --- /dev/null +++ b/modules/gui/qt/medialibrary/mlgroup.cpp @@ -0,0 +1,70 @@ +/***************************************************************************** + * Copyright (C) 2021 VLC authors and VideoLAN + * + * Authors: Benjamin Arnaud <bun...@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; +} diff --git a/modules/gui/qt/medialibrary/mlgroup.hpp b/modules/gui/qt/medialibrary/mlgroup.hpp new file mode 100644 index 0000000000..62da5a840a --- /dev/null +++ b/modules/gui/qt/medialibrary/mlgroup.hpp @@ -0,0 +1,64 @@ +/***************************************************************************** + * Copyright (C) 2021 VLC authors and VideoLAN + * + * Authors: Benjamin Arnaud <bun...@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 diff --git a/po/POTFILES.in b/po/POTFILES.in index 6a97844082..83679ba718 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits