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 #include "MediaDeviceTrackEditor.h" 0018 0019 using namespace Meta; 0020 0021 MediaDeviceTrackEditor::MediaDeviceTrackEditor( MediaDeviceTrack *track ) 0022 : Meta::TrackEditor() 0023 , m_inBatchUpdate( false ) 0024 , m_track( track ) 0025 { 0026 } 0027 0028 void 0029 MediaDeviceTrackEditor::setAlbum( const QString &newAlbum ) 0030 { 0031 m_track->setAlbum( newAlbum ); 0032 commitIfInNonBatchUpdate(); 0033 } 0034 0035 void 0036 MediaDeviceTrackEditor::setAlbumArtist( const QString &newAlbumArtist ) 0037 { 0038 m_track->setAlbumArtist( newAlbumArtist ); 0039 commitIfInNonBatchUpdate(); 0040 } 0041 0042 void 0043 MediaDeviceTrackEditor::setArtist( const QString &newArtist ) 0044 { 0045 m_track->setArtist( newArtist ); 0046 commitIfInNonBatchUpdate(); 0047 } 0048 0049 void 0050 MediaDeviceTrackEditor::setComposer( const QString &newComposer ) 0051 { 0052 m_track->setComposer( newComposer ); 0053 commitIfInNonBatchUpdate(); 0054 } 0055 0056 void 0057 MediaDeviceTrackEditor::setGenre( const QString &newGenre ) 0058 { 0059 m_track->setGenre( newGenre ); 0060 commitIfInNonBatchUpdate(); 0061 } 0062 0063 void 0064 MediaDeviceTrackEditor::setYear( int newYear ) 0065 { 0066 m_track->setYear( newYear ); 0067 commitIfInNonBatchUpdate(); 0068 } 0069 0070 void 0071 MediaDeviceTrackEditor::setBpm( const qreal newBpm ) 0072 { 0073 m_track->setBpm( newBpm ); 0074 commitIfInNonBatchUpdate(); 0075 } 0076 0077 void 0078 MediaDeviceTrackEditor::setTitle( const QString &newTitle ) 0079 { 0080 m_track->setTitle( newTitle ); 0081 commitIfInNonBatchUpdate(); 0082 } 0083 0084 void 0085 MediaDeviceTrackEditor::setComment( const QString &newComment ) 0086 { 0087 m_track->setComment( newComment ); 0088 commitIfInNonBatchUpdate(); 0089 } 0090 0091 void 0092 MediaDeviceTrackEditor::setTrackNumber( int newTrackNumber ) 0093 { 0094 m_track->setTrackNumber( newTrackNumber ); 0095 commitIfInNonBatchUpdate(); 0096 } 0097 0098 void 0099 MediaDeviceTrackEditor::setDiscNumber( int newDiscNumber ) 0100 { 0101 m_track->setDiscNumber( newDiscNumber ); 0102 commitIfInNonBatchUpdate(); 0103 } 0104 0105 void 0106 MediaDeviceTrackEditor::beginUpdate() 0107 { 0108 m_inBatchUpdate = true; 0109 } 0110 0111 void 0112 MediaDeviceTrackEditor::endUpdate() 0113 { 0114 m_inBatchUpdate = false; 0115 m_track->commitChanges(); 0116 } 0117 0118 void 0119 MediaDeviceTrackEditor::commitIfInNonBatchUpdate() 0120 { 0121 if( m_inBatchUpdate ) 0122 return; 0123 m_track->commitChanges(); 0124 }