File indexing completed on 2024-05-19 04:49:13

0001 /****************************************************************************************
0002  * Copyright (c) 2011 Matěj Laitl <matej@laitl.cz>                                      *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef MEDIADEVICE_TRACK_EDITOR_H
0018 #define MEDIADEVICE_TRACK_EDITOR_H
0019 
0020 #include "core/meta/TrackEditor.h"
0021 #include "MediaDeviceMeta.h"
0022 
0023 namespace Meta
0024 {
0025 class MediaDeviceTrackEditor : public Meta::TrackEditor
0026 {
0027     public:
0028         explicit MediaDeviceTrackEditor( MediaDeviceTrack *track );
0029 
0030         void setAlbum( const QString &newAlbum ) override;
0031         void setAlbumArtist( const QString &newAlbumArtist ) override;
0032         void setArtist( const QString &newArtist ) override;
0033         void setComposer( const QString &newComposer ) override;
0034         void setGenre( const QString &newGenre ) override;
0035         void setYear( int newYear ) override;
0036         void setBpm( const qreal newBpm ) override;
0037         void setTitle( const QString &newTitle ) override;
0038         void setComment( const QString &newComment ) override;
0039         void setTrackNumber( int newTrackNumber ) override;
0040         void setDiscNumber( int newDiscNumber ) override;
0041 
0042         void beginUpdate() override;
0043         void endUpdate() override;
0044 
0045     private:
0046         /**
0047          * Tells the underlying track to write back changes if and only if current update
0048          * is not a part of a larger batch (initiated by beginUpdate())
0049          */
0050         void commitIfInNonBatchUpdate();
0051 
0052         bool m_inBatchUpdate;
0053         MediaDeviceTrackPtr m_track;
0054 };
0055 
0056 }
0057 
0058 #endif