1 | /* |
2 | This file is part of the KDE project |
3 | |
4 | SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> |
5 | SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> |
6 | SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org> |
7 | |
8 | SPDX-License-Identifier: LGPL-2.0-or-later |
9 | */ |
10 | |
11 | #ifndef KJOB_P_H |
12 | #define KJOB_P_H |
13 | |
14 | #include "kjob.h" |
15 | #include <QEventLoopLocker> |
16 | #include <QMap> |
17 | |
18 | #include <array> |
19 | |
20 | class KJobUiDelegate; |
21 | class QTimer; |
22 | class QEventLoop; |
23 | class QElapsedTimer; |
24 | |
25 | class KJobPrivate |
26 | { |
27 | public: |
28 | KJobPrivate(); |
29 | virtual ~KJobPrivate(); |
30 | |
31 | void speedTimeout(); |
32 | |
33 | KJob *q_ptr = nullptr; |
34 | |
35 | KJobUiDelegate *uiDelegate = nullptr; |
36 | QString errorText; |
37 | int error = KJob::NoError; |
38 | KJob::Unit progressUnit = KJob::Bytes; |
39 | |
40 | struct Amounts { |
41 | qulonglong processedAmount = 0; |
42 | qulonglong totalAmount = 0; |
43 | }; |
44 | |
45 | std::array<Amounts, KJob::UnitsCount> m_jobAmounts; |
46 | |
47 | unsigned long percentage = 0; |
48 | QTimer *speedTimer = nullptr; |
49 | |
50 | std::unique_ptr<QElapsedTimer> elapsedTimer; |
51 | qint64 accumulatedElapsedTime = 0; |
52 | |
53 | QEventLoop *eventLoop = nullptr; |
54 | // eventLoopLocker prevents QCoreApplication from exiting when the last |
55 | // window is closed until the job has finished running |
56 | QEventLoopLocker eventLoopLocker; |
57 | KJob::Capabilities capabilities = KJob::NoCapabilities; |
58 | bool suspended = false; |
59 | bool isAutoDelete = true; |
60 | bool m_hideFinishedNotification = false; |
61 | bool isFinished = false; |
62 | bool m_startedWithExec = false; |
63 | |
64 | Q_DECLARE_PUBLIC(KJob) |
65 | }; |
66 | |
67 | #endif |
68 | |