From fd3245c227b67acce90142398774e9f1cf209ba6 Mon Sep 17 00:00:00 2001 From: Benjamin Arnaud <benjamin.arnaud@videolabs.io> Date: Fri, 7 Jan 2022 18:47:21 +0100 Subject: [PATCH] qt: Create MLFolder --- modules/gui/qt/Makefile.am | 2 + modules/gui/qt/medialibrary/mlfolder.cpp | 64 ++++++++++++++++++++++++ modules/gui/qt/medialibrary/mlfolder.hpp | 57 +++++++++++++++++++++ po/POTFILES.in | 2 + 4 files changed, 125 insertions(+) create mode 100644 modules/gui/qt/medialibrary/mlfolder.cpp create mode 100644 modules/gui/qt/medialibrary/mlfolder.hpp diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 222517bbb530..32a4c3de7e3f 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -162,6 +162,8 @@ libqt_plugin_la_SOURCES = \ gui/qt/medialibrary/mlbookmarkmodel.cpp \ gui/qt/medialibrary/mlbookmarkmodel.hpp \ gui/qt/medialibrary/mlevent.hpp \ + gui/qt/medialibrary/mlfolder.cpp \ + gui/qt/medialibrary/mlfolder.hpp \ gui/qt/medialibrary/mlfoldersmodel.cpp \ gui/qt/medialibrary/mlfoldersmodel.hpp \ gui/qt/medialibrary/mlgenre.cpp \ diff --git a/modules/gui/qt/medialibrary/mlfolder.cpp b/modules/gui/qt/medialibrary/mlfolder.cpp new file mode 100644 index 000000000000..7a20dc370b32 --- /dev/null +++ b/modules/gui/qt/medialibrary/mlfolder.cpp @@ -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. + *****************************************************************************/ + +#include "mlfolder.hpp" + +// Ctor / dtor + +MLFolder::MLFolder(const vlc_ml_folder_t * data) + : MLItemCover(MLItemId(data->i_id, VLC_ML_PARENT_FOLDER)) + , m_present(data->b_present) + , m_banned(data->b_banned) + , m_title(data->psz_name) + , m_mrl(data->psz_mrl) + , m_duration(0) // FIXME: We should have a duration field in vlc_ml_folder_t. + , m_count(data->i_nb_media) {} + +// Interface + +bool MLFolder::isPresent() const +{ + return m_present; +} + +bool MLFolder::isBanned() const +{ + return m_banned; +} + +QString MLFolder::getTitle() const +{ + return m_title; +} + +QString MLFolder::getMRL() const +{ + return m_mrl; +} + +int64_t MLFolder::getDuration() const +{ + return m_duration; +} + +unsigned int MLFolder::getCount() const +{ + return m_count; +} diff --git a/modules/gui/qt/medialibrary/mlfolder.hpp b/modules/gui/qt/medialibrary/mlfolder.hpp new file mode 100644 index 000000000000..4738f81e9ecc --- /dev/null +++ b/modules/gui/qt/medialibrary/mlfolder.hpp @@ -0,0 +1,57 @@ +/***************************************************************************** + * 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 MLFOLDER_HPP +#define MLFOLDER_HPP + +// MediaLibrary includes +#include "mlitemcover.hpp" + +class MLFolder : public MLItemCover +{ +public: + MLFolder(const vlc_ml_folder_t * data); + +public: // Interface + bool isPresent() const; + bool isBanned() const; + + QString getTitle() const; + + QString getMRL() const; + + int64_t getDuration() const; + + unsigned int getCount() const; + +private: + bool m_present; + bool m_banned; + + QString m_title; + + QString m_mrl; + + int64_t m_duration; + + unsigned int m_count; +}; + +#endif diff --git a/po/POTFILES.in b/po/POTFILES.in index 2671f259c4f5..9080dc30ecc8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -770,6 +770,8 @@ modules/gui/qt/dialogs/plugins/addons_manager.cpp modules/gui/qt/dialogs/plugins/addons_manager.hpp modules/gui/qt/medialibrary/mlbookmarkmodel.cpp modules/gui/qt/medialibrary/mlbookmarkmodel.hpp +modules/gui/qt/medialibrary/mlfolder.cpp +modules/gui/qt/medialibrary/mlfolder.hpp modules/gui/qt/medialibrary/mlfoldersmodel.cpp modules/gui/qt/medialibrary/mlfoldersmodel.hpp modules/gui/qt/medialibrary/mlgroup.cpp -- GitLab