1 2 3 #ifndef TAGENGINE_H 4 #define TAGENGINE_H 5 6 #include <KUrl> 7 8 #include <QStringList> 9 10 class Config; 11 12 class CoverData 13 { 14 public: 15 /*! 16 * This describes the function or content of the picture. 17 * copyright: (C) 2002 - 2008 by Scott Wheeler <wheeler@kde.org> 18 */ 19 enum Role { 20 //! A type not enumerated below 21 Other = 0x00, 22 //! 32x32 PNG image that should be used as the file icon 23 FileIcon = 0x01, 24 //! File icon of a different size or format 25 OtherFileIcon = 0x02, 26 //! Front cover image of the album 27 FrontCover = 0x03, 28 //! Back cover image of the album 29 BackCover = 0x04, 30 //! Inside leaflet page of the album 31 LeafletPage = 0x05, 32 //! Image from the album itself 33 Media = 0x06, 34 //! Picture of the lead artist or soloist 35 LeadArtist = 0x07, 36 //! Picture of the artist or performer 37 Artist = 0x08, 38 //! Picture of the conductor 39 Conductor = 0x09, 40 //! Picture of the band or orchestra 41 Band = 0x0A, 42 //! Picture of the composer 43 Composer = 0x0B, 44 //! Picture of the lyricist or text writer 45 Lyricist = 0x0C, 46 //! Picture of the recording location or studio 47 RecordingLocation = 0x0D, 48 //! Picture of the artists during recording 49 DuringRecording = 0x0E, 50 //! Picture of the artists during performance 51 DuringPerformance = 0x0F, 52 //! Picture from a movie or video related to the track 53 MovieScreenCapture = 0x10, 54 //! Picture of a large, coloured fish 55 ColouredFish = 0x11, 56 //! Illustration related to the track 57 Illustration = 0x12, 58 //! Logo of the band or performer 59 BandLogo = 0x13, 60 //! Logo of the publisher (record company) 61 PublisherLogo = 0x14 62 }; 63 64 CoverData( const QByteArray& _data = QByteArray(), const QString& _mimyType = QString::null, Role _role = Other, const QString& _description = QString::null ); 65 ~CoverData(); 66 67 QByteArray data; 68 QString mimeType; 69 Role role; 70 QString description; 71 72 static QString roleName( Role role ); 73 }; 74 75 76 class TagData 77 { 78 public: 79 TagData(); 80 ~TagData(); 81 82 /** The tags */ 83 QString artist; 84 QString albumArtist; 85 QString composer; 86 QString album; 87 QString title; 88 QString genre; 89 QString comment; 90 short track; 91 short trackTotal; 92 short disc; 93 short discTotal; 94 short year; 95 float trackGain; 96 float albumGain; 97 98 QString musicBrainzTrackId; 99 QString musicBrainzReleaseId; 100 101 /** Covers */ 102 QList<CoverData*> covers; 103 104 enum TagsRead { 105 TrackGain = 0x01, 106 AlbumGain = 0x02, 107 Covers = 0x04 108 } tagsRead; 109 110 /** The technical information */ 111 int length; 112 int samplingRate; 113 bool isEncrypted; 114 }; 115 116 117 class TagEngine : public QObject 118 { 119 Q_OBJECT 120 121 public: 122 explicit TagEngine( Config *_config ); 123 ~TagEngine(); 124 125 /** A list of all genre */ 126 QStringList genreList; 127 128 TagData* readTags( const KUrl& fileName ); 129 bool writeTags( const KUrl& fileName, TagData *tagData ); 130 131 QList<CoverData*> readCovers( const KUrl& fileName ); 132 bool writeCovers( const KUrl& fileName, QList<CoverData*> covers ); 133 bool writeCoversToDirectory( const QString& directoryName, TagData *tags ); 134 135 private: 136 Config *config; 137 }; 138 139 #endif // TAGENGINE_H 140