File indexing completed on 2025-01-19 04:24:19

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
0003  * Copyright (c) 2009 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017 
0018 #ifndef AUDIOCDMETA_H
0019 #define AUDIOCDMETA_H
0020 
0021 #include "core/meta/Meta.h"
0022 
0023 namespace Collections {
0024     class AudioCdCollection;
0025 }
0026 
0027 namespace Meta
0028 {
0029 
0030 class AudioCdTrack;
0031 class AudioCdAlbum;
0032 class AudioCdArtist;
0033 class AudioCdGenre;
0034 class AudioCdComposer;
0035 class AudioCdYear;
0036 
0037 typedef AmarokSharedPointer<AudioCdTrack> AudioCdTrackPtr;
0038 typedef AmarokSharedPointer<AudioCdArtist> AudioCdArtistPtr;
0039 typedef AmarokSharedPointer<AudioCdAlbum> AudioCdAlbumPtr;
0040 typedef AmarokSharedPointer<AudioCdGenre> AudioCdGenrePtr;
0041 typedef AmarokSharedPointer<AudioCdComposer> AudioCdComposerPtr;
0042 typedef AmarokSharedPointer<AudioCdYear> AudioCdYearPtr;
0043 
0044 class AudioCdTrack : public Meta::Track
0045 {
0046     public:
0047         AudioCdTrack( Collections::AudioCdCollection *collection, const QString &name, const QUrl &url );
0048         ~AudioCdTrack() override;
0049 
0050         QString name() const override;
0051 
0052         QUrl playableUrl() const override;
0053         QString uidUrl() const override;
0054         QString prettyUrl() const override;
0055         QString notPlayableReason() const override;
0056 
0057         AlbumPtr album() const override;
0058         ArtistPtr artist() const override;
0059         GenrePtr genre() const override;
0060         ComposerPtr composer() const override;
0061         YearPtr year() const override;
0062 
0063         virtual void setTitle( const QString &newTitle );
0064 
0065         qreal bpm() const override;
0066 
0067         QString comment() const override;
0068         virtual void setComment ( const QString &newComment );
0069 
0070         qint64 length() const override;
0071 
0072         int filesize() const override;
0073         int sampleRate() const override;
0074         int bitrate() const override;
0075 
0076         int trackNumber() const override;
0077         virtual void setTrackNumber ( int newTrackNumber );
0078 
0079         int discNumber() const override;
0080         virtual void setDiscNumber ( int newDiscNumber );
0081 
0082         QString type() const override;
0083 
0084         bool inCollection() const override;
0085         Collections::Collection* collection() const override;
0086 
0087         //AudioCdTrack specific methods
0088         void setAlbum( AudioCdAlbumPtr album );
0089         void setArtist( AudioCdArtistPtr artist );
0090         void setComposer( AudioCdComposerPtr composer );
0091         void setGenre( AudioCdGenrePtr genre );
0092         void setYear( AudioCdYearPtr year );
0093 
0094         void setLength( qint64 length );
0095 
0096         void setFileNameBase( const QString &fileNameBase );
0097         QString fileNameBase();
0098 
0099     private:
0100         Collections::AudioCdCollection *m_collection;
0101 
0102         AudioCdArtistPtr m_artist;
0103         AudioCdAlbumPtr m_album;
0104         AudioCdGenrePtr m_genre;
0105         AudioCdComposerPtr m_composer;
0106         AudioCdYearPtr m_year;
0107 
0108         QString m_name;
0109         qint64 m_length;
0110         int m_trackNumber;
0111         QUrl m_playableUrl;
0112         QString m_fileNameBase;
0113 };
0114 
0115 class AudioCdArtist : public Meta::Artist
0116 {
0117     public:
0118         explicit AudioCdArtist( const QString &name );
0119         ~AudioCdArtist() override;
0120 
0121         QString name() const override;
0122 
0123         TrackList tracks() override;
0124 
0125         virtual AlbumList albums();
0126 
0127         //AudioCdArtist specific methods
0128         void addTrack( AudioCdTrackPtr track );
0129 
0130     private:
0131         QString m_name;
0132         TrackList m_tracks;
0133 };
0134 
0135 class AudioCdAlbum : public Meta::Album
0136 {
0137     public:
0138         explicit AudioCdAlbum( const QString &name );
0139         ~AudioCdAlbum() override;
0140 
0141         QString name() const override;
0142 
0143         bool isCompilation() const override;
0144         bool canUpdateCompilation() const override;
0145         void setCompilation( bool compilation ) override;
0146 
0147         bool hasAlbumArtist() const override;
0148         ArtistPtr albumArtist() const override;
0149         TrackList tracks() override;
0150 
0151         QImage image( int size = 0 ) const override;
0152         bool hasImage( int size = 0 ) const override;
0153         bool canUpdateImage() const override;
0154         void setImage( const QImage &image ) override;
0155 
0156         //AudioCdAlbum specific methods
0157         void addTrack( AudioCdTrackPtr track );
0158         void setAlbumArtist( AudioCdArtistPtr artist );
0159 
0160     private:
0161         QString m_name;
0162         TrackList m_tracks;
0163         bool m_isCompilation;
0164         AudioCdArtistPtr m_albumArtist;
0165         QImage m_cover;
0166 };
0167 
0168 class AudioCdGenre : public Meta::Genre
0169 {
0170     public:
0171         explicit AudioCdGenre( const QString &name );
0172         ~AudioCdGenre() override;
0173 
0174         QString name() const override;
0175 
0176         TrackList tracks() override;
0177 
0178         //AudioCdGenre specific methods
0179         void addTrack( AudioCdTrackPtr track );
0180 
0181     private:
0182         QString m_name;
0183         TrackList m_tracks;
0184 };
0185 
0186 class AudioCdComposer : public Meta::Composer
0187 {
0188     public:
0189         explicit AudioCdComposer( const QString &name );
0190         ~AudioCdComposer() override;
0191 
0192         QString name() const override;
0193 
0194         TrackList tracks() override;
0195 
0196         //AudioCdComposer specific methods
0197         void addTrack( AudioCdTrackPtr track );
0198 
0199     private:
0200         QString m_name;
0201         TrackList m_tracks;
0202 };
0203 
0204 class AudioCdYear : public Meta::Year
0205 {
0206     public:
0207         explicit AudioCdYear( const QString &name );
0208         ~AudioCdYear() override;
0209 
0210         QString name() const override;
0211 
0212         TrackList tracks() override;
0213 
0214         //AudioCdYear specific methods
0215         void addTrack( AudioCdTrackPtr track );
0216 
0217     private:
0218         QString m_name;
0219         TrackList m_tracks;
0220 };
0221 
0222 }
0223 
0224 #endif
0225