1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef KUISERVERV2JOBTRACKER_H |
9 | #define KUISERVERV2JOBTRACKER_H |
10 | |
11 | #include <KJobTrackerInterface> |
12 | #include <kjobwidgets_export.h> |
13 | |
14 | #include <memory> |
15 | |
16 | class KJob; |
17 | class KUiServerV2JobTrackerPrivate; |
18 | |
19 | /** |
20 | * @class KUiServerV2JobTracker kuiserverv2jobtracker.h KUiServerV2JobTracker |
21 | * |
22 | * The interface to implement to track the progresses of a job. |
23 | * |
24 | * @since 5.81 |
25 | */ |
26 | class KJOBWIDGETS_EXPORT KUiServerV2JobTracker : public KJobTrackerInterface |
27 | { |
28 | Q_OBJECT |
29 | |
30 | public: |
31 | /** |
32 | * Creates a new KJobTrackerInterface |
33 | * |
34 | * @param parent the parent object |
35 | */ |
36 | explicit KUiServerV2JobTracker(QObject *parent = nullptr); |
37 | |
38 | /** |
39 | * Destroys a KJobTrackerInterface |
40 | */ |
41 | ~KUiServerV2JobTracker() override; |
42 | |
43 | /** |
44 | * Register a new job in this tracker. |
45 | * |
46 | * @param job the job to register |
47 | */ |
48 | void registerJob(KJob *job) override; |
49 | |
50 | /** |
51 | * Unregister a job from this tracker. |
52 | * |
53 | * @param job the job to unregister |
54 | */ |
55 | void unregisterJob(KJob *job) override; |
56 | |
57 | protected Q_SLOTS: |
58 | /** |
59 | * The following slots are inherited from KJobTrackerInterface. |
60 | */ |
61 | void finished(KJob *job) override; |
62 | void suspended(KJob *job) override; |
63 | void resumed(KJob *job) override; |
64 | virtual void description(KJob *job, const QString &title, |
65 | const QPair<QString, QString> &field1, |
66 | const QPair<QString, QString> &field2) override; |
67 | void infoMessage(KJob *job, const QString &message) override; |
68 | void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount) override; |
69 | void processedAmount(KJob *job, KJob::Unit unit, qulonglong amount) override; |
70 | void percent(KJob *job, unsigned long percent) override; |
71 | void speed(KJob *job, unsigned long value) override; |
72 | |
73 | private: |
74 | std::unique_ptr<KUiServerV2JobTrackerPrivate> const d; |
75 | }; |
76 | |
77 | #endif |
78 | |