ThreadWeaver

qobjectdecorator.cpp
1/* -*- C++ -*-
2 A decorator to make jobs into QObjects in ThreadWeaver.
3
4 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "qobjectdecorator.h"
10#include "collection.h"
11#include "managedjobpointer.h"
12#include "sequence.h"
13
14namespace ThreadWeaver
15{
16QObjectDecorator::QObjectDecorator(JobInterface *decoratee, QObject *parent)
17 : QObject(parent)
18 , IdDecorator(decoratee)
19{
20}
21
22QObjectDecorator::QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent)
23 : QObject(parent)
24 , IdDecorator(decoratee, autoDelete)
25{
26}
27
28void QObjectDecorator::defaultBegin(const JobPointer &self, Thread *thread)
29{
30 Q_ASSERT(job());
31 Q_EMIT started(self);
32 job()->defaultBegin(self, thread);
33}
34
35void QObjectDecorator::defaultEnd(const JobPointer &self, Thread *thread)
36{
37 Q_ASSERT(job());
38 job()->defaultEnd(self, thread);
39 if (!self->success()) {
40 Q_EMIT failed(self);
41 }
42 Q_EMIT done(self);
43}
44
45}
46
47#include "moc_qobjectdecorator.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.