File indexing completed on 2024-05-05 04:49:22
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Maximilian Kossick <maximilian.kossick@googlemail.com> * 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 MASTERSLAVESYNCHRONIZATIONJOB_H 0018 #define MASTERSLAVESYNCHRONIZATIONJOB_H 0019 0020 #include "SynchronizationBaseJob.h" 0021 0022 namespace Amarok 0023 { 0024 class Collection; 0025 } 0026 0027 /** 0028 * @class MasterSlaveSynchronizationJob 0029 * Ensures that the slave collection 0030 * contains exactly the same tracks as the master collection, i.e. it 0031 * adds tracks that are in master but not in slave to slave and removes 0032 * tracks that are in slave but not in master from slave. 0033 */ 0034 class MasterSlaveSynchronizationJob : public SynchronizationBaseJob 0035 { 0036 Q_OBJECT 0037 public: 0038 MasterSlaveSynchronizationJob(); 0039 ~MasterSlaveSynchronizationJob() override; 0040 0041 //master/slave are not settable in the ctor 0042 //to make explicit which collection is the master and which is the slave 0043 //for this synchronization 0044 void setMaster( Collections::Collection *master ); 0045 void setSlave( Collections::Collection *slave ); 0046 0047 protected: 0048 void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ) override; 0049 0050 private: 0051 Collections::Collection *m_master; 0052 Collections::Collection *m_slave; 0053 }; 0054 0055 #endif