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 ONEWAYSYNCHRONIZATIONJOB_H
0018 #define ONEWAYSYNCHRONIZATIONJOB_H
0019 
0020 #include "SynchronizationBaseJob.h"
0021 
0022 namespace Amarok
0023 {
0024     class Collection;
0025 }
0026 /**
0027  * @class OneWaySynchronizationJob
0028  * Ensures that all tracks that are in the
0029  * source collection are present in the target collection as well, i.e.
0030  * it adds tracks that are in source but not in target to target. It does
0031  * not remove any tracks from target. It is one half of UnionJob.
0032 */
0033 class OneWaySynchronizationJob : public SynchronizationBaseJob
0034 {
0035     Q_OBJECT
0036 public:
0037     OneWaySynchronizationJob();
0038     ~OneWaySynchronizationJob() override;
0039 
0040     //source/target are not settable in the ctor
0041     //to make explicit which collection is the source and which is the target
0042     //for this synchronization
0043     void setSource( Collections::Collection *source );
0044     void setTarget( Collections::Collection *target );
0045 
0046 protected:
0047     void doSynchronization( const Meta::TrackList &tracks, InSet syncDirection, Collections::Collection *collA, Collections::Collection *collB ) override;
0048 
0049 private:
0050     Collections::Collection *m_source;
0051     Collections::Collection *m_target;
0052 };
0053 
0054 #endif // ONEWAYSYNCHRONIZATIONJOB_H