File indexing completed on 2024-05-12 07:57:48
0001 /* -*- C++ -*- 0002 A decorator to make jobs into QObjects in ThreadWeaver. 0003 0004 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #include "qobjectdecorator.h" 0010 #include "collection.h" 0011 #include "managedjobpointer.h" 0012 #include "sequence.h" 0013 0014 namespace ThreadWeaver 0015 { 0016 QObjectDecorator::QObjectDecorator(JobInterface *decoratee, QObject *parent) 0017 : QObject(parent) 0018 , IdDecorator(decoratee) 0019 { 0020 } 0021 0022 QObjectDecorator::QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent) 0023 : QObject(parent) 0024 , IdDecorator(decoratee, autoDelete) 0025 { 0026 } 0027 0028 void QObjectDecorator::defaultBegin(const JobPointer &self, Thread *thread) 0029 { 0030 Q_ASSERT(job()); 0031 Q_EMIT started(self); 0032 job()->defaultBegin(self, thread); 0033 } 0034 0035 void QObjectDecorator::defaultEnd(const JobPointer &self, Thread *thread) 0036 { 0037 Q_ASSERT(job()); 0038 job()->defaultEnd(self, thread); 0039 if (!self->success()) { 0040 Q_EMIT failed(self); 0041 } 0042 Q_EMIT done(self); 0043 } 0044 0045 } 0046 0047 #include "moc_qobjectdecorator.cpp"