1 /* 2 * Cantata 3 * 4 * Copyright (c) 2011-2020 Craig Drummond <craig.p.drummond@gmail.com> 5 * 6 */ 7 /* 8 * Copyright (c) 2008 Sander Knopper (sander AT knopper DOT tk) and 9 * Roeland Douma (roeland AT rullzer DOT com) 10 * 11 * This file is part of QtMPC. 12 * 13 * QtMPC is free software: you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by 15 * the Free Software Foundation, either version 2 of the License, or 16 * (at your option) any later version. 17 * 18 * QtMPC is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with QtMPC. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 #ifndef MUSIC_LIBRARY_ITEM_SONG_H 28 #define MUSIC_LIBRARY_ITEM_SONG_H 29 30 #include <QList> 31 #include <QVariant> 32 #include "musiclibraryitem.h" 33 #include "mpd-interface/song.h" 34 35 class MusicLibraryItemAlbum; 36 37 class MusicLibraryItemSong : public MusicLibraryItem 38 { 39 public: MusicLibraryItemSong(const Song & s,MusicLibraryItemContainer * parent)40 MusicLibraryItemSong(const Song &s, MusicLibraryItemContainer *parent) 41 : MusicLibraryItem(parent), m_song(s) { } 42 ~MusicLibraryItemSong()43 ~MusicLibraryItemSong() override { } 44 data()45 QString data() const override { return m_song.displayTitle(); } file()46 const QString & file() const { return m_song.file; } setSong(const Song & s)47 void setSong(const Song &s) { m_song=s; } setFile(const QString & f)48 void setFile(const QString &f) { m_song.file=f; } track()49 quint16 track() const { return m_song.track; } setTrack(quint16 t)50 void setTrack(quint16 t) { m_song.track=t; } setPlayed(bool p)51 void setPlayed(bool p) { m_song.setPlayed(p); } disc()52 quint16 disc() const { return m_song.disc; } time()53 quint32 time() const { return m_song.time; } genre()54 QString genre() const { return m_song.firstGenre(); } song()55 const Song & song() const { return m_song; } itemType()56 Type itemType() const override { return Type_Song; } 57 58 protected: 59 Song m_song; 60 }; 61 62 #endif 63