KCoreAddons

kjobtrackerinterface.cpp
1 /*
2  This file is part of the KDE project
3 
4  SPDX-FileCopyrightText: 2007 Kevin Ottens <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-only
7 */
8 
9 #include "kjobtrackerinterface.h"
10 
11 #include "kjob.h"
12 
13 class Q_DECL_HIDDEN KJobTrackerInterface::Private
14 {
15 public:
16  Private(KJobTrackerInterface *interface) : q(interface)
17  {
18 
19  }
20 
21  KJobTrackerInterface *const q;
22 };
23 
25  : QObject(parent), d(new Private(this))
26 {
27  qRegisterMetaType<QPair<QString,QString>>();
28 }
29 
31 {
32  delete d;
33 }
34 
36 {
37  QObject::connect(job, SIGNAL(finished(KJob*)),
38  this, SLOT(unregisterJob(KJob*)));
39  QObject::connect(job, SIGNAL(finished(KJob*)),
40  this, SLOT(finished(KJob*)));
41 
42  QObject::connect(job, SIGNAL(suspended(KJob*)),
43  this, SLOT(suspended(KJob*)));
44  QObject::connect(job, SIGNAL(resumed(KJob*)),
45  this, SLOT(resumed(KJob*)));
46 
47  QObject::connect(job, SIGNAL(description(KJob *, const QString &,
49  const QPair<QString, QString> &)),
50  this, SLOT(description(KJob *, const QString &,
52  const QPair<QString, QString> &)));
54  this, SLOT(infoMessage(KJob*,QString,QString)));
56  this, SLOT(warning(KJob*,QString,QString)));
57 
58  QObject::connect(job, SIGNAL(totalAmount(KJob*,KJob::Unit,qulonglong)),
59  this, SLOT(totalAmount(KJob*,KJob::Unit,qulonglong)));
60  QObject::connect(job, SIGNAL(processedAmount(KJob*,KJob::Unit,qulonglong)),
61  this, SLOT(processedAmount(KJob*,KJob::Unit,qulonglong)));
62  QObject::connect(job, SIGNAL(percent(KJob*,ulong)),
63  this, SLOT(percent(KJob*,ulong)));
64  QObject::connect(job, SIGNAL(speed(KJob*,ulong)),
65  this, SLOT(speed(KJob*,ulong)));
66 }
67 
69 {
70  job->disconnect(this);
71 }
72 
74 {
75  Q_UNUSED(job)
76 }
77 
79 {
80  Q_UNUSED(job)
81 }
82 
84 {
85  Q_UNUSED(job)
86 }
87 
89  const QPair<QString, QString> &field1,
90  const QPair<QString, QString> &field2)
91 {
92  Q_UNUSED(job)
93  Q_UNUSED(title)
94  Q_UNUSED(field1)
95  Q_UNUSED(field2)
96 
97 }
98 
99 void KJobTrackerInterface::infoMessage(KJob *job, const QString &plain, const QString &rich)
100 {
101  Q_UNUSED(job)
102  Q_UNUSED(plain)
103  Q_UNUSED(rich)
104 }
105 
106 void KJobTrackerInterface::warning(KJob *job, const QString &plain, const QString &rich)
107 {
108  Q_UNUSED(job)
109  Q_UNUSED(plain)
110  Q_UNUSED(rich)
111 }
112 
113 void KJobTrackerInterface::totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
114 {
115  Q_UNUSED(job)
116  Q_UNUSED(unit)
117  Q_UNUSED(amount)
118 }
119 
120 void KJobTrackerInterface::processedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
121 {
122  Q_UNUSED(job)
123  Q_UNUSED(unit)
124  Q_UNUSED(amount)
125 }
126 
127 void KJobTrackerInterface::percent(KJob *job, unsigned long percent)
128 {
129  Q_UNUSED(job)
130  Q_UNUSED(percent)
131 }
132 
133 void KJobTrackerInterface::speed(KJob *job, unsigned long value)
134 {
135  Q_UNUSED(job)
136  Q_UNUSED(value)
137 }
138 
139 #include "moc_kjobtrackerinterface.cpp"
virtual void resumed(KJob *job)
Called when a job is resumed.
KJobTrackerInterface(QObject *parent=nullptr)
Creates a new KJobTrackerInterface.
virtual void suspended(KJob *job)
Called when a job is suspended.
virtual void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
Called when we know the amount a job will have to process.
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
virtual void description(KJob *job, const QString &title, const QPair< QString, QString > &field1, const QPair< QString, QString > &field2)
Called to display general description of a job.
virtual void finished(KJob *job)
Called when a job is finished, in any case.
virtual void speed(KJob *job, unsigned long value)
Called to show the speed of the job.
Unit
Describes the unit used in the methods that handle reporting the job progress info.
Definition: kjob.h:89
virtual void warning(KJob *job, const QString &plain, const QString &rich)
Emitted to display a warning about a job.
The interface to implement to track the progresses of a job.
virtual void infoMessage(KJob *job, const QString &plain, const QString &rich)
Called to display state information about a job.
virtual void percent(KJob *job, unsigned long percent)
Called to show the overall progress of the job.
virtual void unregisterJob(KJob *job)
Unregister a job from this tracker.
virtual void registerJob(KJob *job)
Register a new job in this tracker.
virtual void processedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
Regularly called to show the progress of a job by giving the current amount.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
The base class for all jobs.
Definition: kjob.h:75
~KJobTrackerInterface() override
Destroys a KJobTrackerInterface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 23:01:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.