[vlc-devel] [PATCH 03/12] qt: Create MLGroup
Benjamin Arnaud
benjamin.arnaud at videolabs.io
Wed Apr 14 08:05:50 UTC 2021
---
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(+)
create mode 100644 modules/gui/qt/medialibrary/mlgroup.cpp
create mode 100644 modules/gui/qt/medialibrary/mlgroup.hpp
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index ca5509a76b..eb4d07d841 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 <bunjee at 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 <bunjee at 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
--
2.25.1
More information about the vlc-devel
mailing list