File indexing completed on 2025-01-05 04:25:59
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 #include "IpodWriteDatabaseJob.h" 0018 0019 #include "IpodCollection.h" 0020 0021 IpodWriteDatabaseJob::IpodWriteDatabaseJob( IpodCollection *collection ) 0022 : QObject() 0023 , ThreadWeaver::Job() 0024 , m_coll( collection ) 0025 { 0026 } 0027 0028 void 0029 IpodWriteDatabaseJob::run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) 0030 { 0031 Q_UNUSED(self); 0032 Q_UNUSED(thread); 0033 m_coll->writeDatabase(); 0034 } 0035 0036 void 0037 IpodWriteDatabaseJob::defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) 0038 { 0039 Q_EMIT started(self); 0040 ThreadWeaver::Job::defaultBegin(self, thread); 0041 } 0042 0043 void 0044 IpodWriteDatabaseJob::defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) 0045 { 0046 ThreadWeaver::Job::defaultEnd(self, thread); 0047 if (!self->success()) { 0048 Q_EMIT failed(self); 0049 } 0050 Q_EMIT done(self); 0051 }