File indexing completed on 2025-03-09 04:24:21

0001 /****************************************************************************************
0002  * Copyright (c) 2012 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 IPODDELETETRACKSJOB_H
0018 #define IPODDELETETRACKSJOB_H
0019 
0020 #include "IpodCollection.h"
0021 #include "core/meta/forward_declarations.h"
0022 
0023 #include <ThreadWeaver/Job>
0024 
0025 
0026 class IpodDeleteTracksJob : public QObject, public ThreadWeaver::Job
0027 {
0028     Q_OBJECT
0029 
0030     public:
0031         explicit IpodDeleteTracksJob( const Meta::TrackList &sources,
0032                                       const QPointer<IpodCollection> &collection );
0033         void run(ThreadWeaver::JobPointer self = QSharedPointer<ThreadWeaver::Job>(), ThreadWeaver::Thread *thread = nullptr) override;
0034 
0035     Q_SIGNALS:
0036         // signals for progress operation:
0037         void incrementProgress();
0038         void endProgressOperation( QObject *obj );
0039         void totalSteps( int steps ); // not used, defined to keep QObject::connect warning quiet
0040 
0041         /** This signal is emitted when this job is being processed by a thread. */
0042         void started(ThreadWeaver::JobPointer);
0043         /** This signal is emitted when the job has been finished (no matter if it succeeded or not). */
0044         void done(ThreadWeaver::JobPointer);
0045         /** This job has failed.
0046          * This signal is emitted when success() returns false after the job is executed. */
0047         void failed(ThreadWeaver::JobPointer);
0048 
0049     protected:
0050         void defaultBegin(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override;
0051         void defaultEnd(const ThreadWeaver::JobPointer& job, ThreadWeaver::Thread *thread) override;
0052 
0053     private:
0054         Meta::TrackList m_sources;
0055         QPointer<IpodCollection> m_coll;
0056 };
0057 
0058 #endif // IPODDELETETRACKSJOB_H