File indexing completed on 2024-05-19 04:49:29
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com> * 0003 * Copyright (c) 2013 Matěj Laitl <matej@laitl.cz> * 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 META_TRACKEDITOR_H 0019 #define META_TRACKEDITOR_H 0020 0021 #include "core/amarokcore_export.h" 0022 0023 #include "AmarokSharedPointer.h" 0024 0025 namespace Meta 0026 { 0027 /** 0028 * Capability to edit meta-data of a track. 0029 * 0030 * If you are calling more than one setter method, you should call beginUpdate() 0031 * before calling any setter methods and endUpdate() when you're done. 0032 * 0033 * This class is memory-managed exclusively using AmarokSharedPointers: always use 0034 * TrackEditorPtr to store or pass pointer to this class. This class must be 0035 * implemented in a reentrant manner. Additionally, underlying Meta::Track must 0036 * be thread-safe -- if you return same instance of TrackEditor every time then it 0037 * means that even the instance must be thread-safe. 0038 */ 0039 class AMAROKCORE_EXPORT TrackEditor : public virtual QSharedData // virtual inheritance 0040 // so that Track implementations can inherit both Meta::Track and Meta::TrackEditor 0041 { 0042 public: 0043 virtual ~TrackEditor(); 0044 0045 virtual void setAlbum( const QString &newAlbum ) = 0; 0046 virtual void setAlbumArtist( const QString &newAlbumArtist ) = 0; 0047 virtual void setArtist( const QString &newArtist ) = 0; 0048 virtual void setComposer( const QString &newComposer ) = 0; 0049 virtual void setGenre( const QString &newGenre ) = 0; 0050 virtual void setYear( int newYear ) = 0; 0051 virtual void setTitle( const QString &newTitle ) = 0; 0052 virtual void setComment( const QString &newComment ) = 0; 0053 virtual void setTrackNumber( int newTrackNumber ) = 0; 0054 virtual void setDiscNumber( int newDiscNumber ) = 0; 0055 virtual void setBpm( const qreal newBpm ) = 0; 0056 0057 /** 0058 * The track object should not store changed meta data immediately but cache 0059 * the changes until endUpdate() is called 0060 */ 0061 virtual void beginUpdate() = 0; 0062 0063 /** 0064 * All meta data has been updated and the object should commit the changes 0065 */ 0066 virtual void endUpdate() = 0; 0067 }; 0068 0069 typedef AmarokSharedPointer<TrackEditor> TrackEditorPtr; 0070 } 0071 0072 #endif // META_TRACKEDITOR_H