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

qt: Create MLFolder

This commit is contained in:
Benjamin Arnaud 2022-01-07 18:47:21 +01:00 committed by Jean-Baptiste Kempf
parent c536126d16
commit fd3245c227
4 changed files with 125 additions and 0 deletions

View File

@ -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 \

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.
*****************************************************************************/
#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;
}

View File

@ -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

View File

@ -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