[vlc-devel] [PATCH 02/17] qt/medialibrary: Create MLPlaylist
Benjamin Arnaud
benjamin.arnaud at videolabs.io
Fri Feb 19 10:25:26 UTC 2021
---
modules/gui/qt/Makefile.am | 3 ++
modules/gui/qt/medialibrary/mlplaylist.cpp | 60 ++++++++++++++++++++++
modules/gui/qt/medialibrary/mlplaylist.hpp | 55 ++++++++++++++++++++
3 files changed, 118 insertions(+)
create mode 100644 modules/gui/qt/medialibrary/mlplaylist.cpp
create mode 100644 modules/gui/qt/medialibrary/mlplaylist.hpp
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 7d6d60bf66..ffb2fdc658 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -168,6 +168,8 @@ libqt_plugin_la_SOURCES = \
gui/qt/medialibrary/mlvideo.hpp \
gui/qt/medialibrary/mlvideomodel.cpp \
gui/qt/medialibrary/mlvideomodel.hpp \
+ gui/qt/medialibrary/mlplaylist.cpp \
+ gui/qt/medialibrary/mlplaylist.hpp \
gui/qt/menus/custom_menus.cpp \
gui/qt/menus/custom_menus.hpp \
gui/qt/menus/qml_menu_wrapper.cpp \
@@ -329,6 +331,7 @@ 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/menus/custom_menus.moc.cpp \
gui/qt/menus/qml_menu_wrapper.moc.cpp \
gui/qt/menus/menus.moc.cpp \
diff --git a/modules/gui/qt/medialibrary/mlplaylist.cpp b/modules/gui/qt/medialibrary/mlplaylist.cpp
new file mode 100644
index 0000000000..03cc44face
--- /dev/null
+++ b/modules/gui/qt/medialibrary/mlplaylist.cpp
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (C) 2021 VLC authors and VideoLAN
+ *
+ * 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 "mlplaylist.hpp"
+
+// VLC includes
+#include "qt.hpp"
+
+//-------------------------------------------------------------------------------------------------
+// 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))
+ , m_ml(ml)
+{
+ assert(data);
+
+ m_name = qfu(data->psz_name);
+
+ // TODO m_cover
+
+ // TODO m_count
+ m_count = 0;//data->i_nb_tracks;
+}
+
+//-------------------------------------------------------------------------------------------------
+// Interface
+//-------------------------------------------------------------------------------------------------
+
+QString MLPlaylist::getName() const
+{
+ return m_name;
+}
+
+QString MLPlaylist::getCover() const
+{
+ return m_cover;
+}
+
+unsigned int MLPlaylist::getCount() const
+{
+ return m_count;
+}
diff --git a/modules/gui/qt/medialibrary/mlplaylist.hpp b/modules/gui/qt/medialibrary/mlplaylist.hpp
new file mode 100644
index 0000000000..41a5a97939
--- /dev/null
+++ b/modules/gui/qt/medialibrary/mlplaylist.hpp
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * 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 MLPLAYLIST_HPP
+#define MLPLAYLIST_HPP
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// MediaLibrary includes
+#include "mlqmltypes.hpp"
+
+// Qt includes
+#include <QObject>
+
+class MLPlaylist : public QObject, public MLItem
+{
+ Q_OBJECT
+
+public:
+ MLPlaylist(vlc_medialibrary_t * ml,
+ const vlc_ml_playlist_t * data, QObject * parent = nullptr);
+
+public: // Interface
+ QString getName () const;
+ QString getCover() const;
+
+ unsigned int getCount() const;
+
+private:
+ vlc_medialibrary_t * m_ml;
+
+ QString m_name;
+ QString m_cover;
+
+ unsigned int m_count;
+};
+
+#endif
--
2.25.1
More information about the vlc-devel
mailing list