1 /*****************************************************************************
2 * Copyright (C) 2019 VLC authors and VideoLAN
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * ( at your option ) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17 *****************************************************************************/
19 #ifndef MLQMLTYPES_HPP
20 #define MLQMLTYPES_HPP
27 #include <vlc_common.h>
28 #include <vlc_media_library.h>
34 MLItemId() : id(0), type( VLC_ML_PARENT_UNKNOWN
) {}
35 MLItemId( int64_t i
, vlc_ml_parent_type t
) : id( i
), type( t
) {}
36 bool operator==( const MLItemId
& other
)
38 return id
== other
.id
&& type
== other
.type
;
40 bool operator!=( const MLItemId
& other
)
42 return !(*this == other
);
45 vlc_ml_parent_type type
;
47 Q_INVOKABLE
inline QString
toString() const {
49 #define ML_PARENT_TYPE_CASE(type) case type: return QString("%1 - %2").arg(#type).arg(id)
51 ML_PARENT_TYPE_CASE(VLC_ML_PARENT_ALBUM
);
52 ML_PARENT_TYPE_CASE(VLC_ML_PARENT_ARTIST
);
53 ML_PARENT_TYPE_CASE(VLC_ML_PARENT_SHOW
);
54 ML_PARENT_TYPE_CASE(VLC_ML_PARENT_GENRE
);
55 ML_PARENT_TYPE_CASE(VLC_ML_PARENT_GROUP
);
56 ML_PARENT_TYPE_CASE(VLC_ML_PARENT_PLAYLIST
);
58 return QString("UNKNONW - %2").arg(id
);
60 #undef ML_PARENT_TYPE_CASE
64 Q_DECLARE_METATYPE(MLItemId
)
69 MLItem(MLItemId id
) : m_id(id
) {}
70 virtual ~MLItem() = default;
72 MLItemId
getId() const { return m_id
; };
78 #endif // MLQMLTYPES_HPP