File indexing completed on 2024-05-19 03:56:21

0001 /*
0002     This file is part of the KDE project
0003 
0004     SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #include "kjobtrackerinterface.h"
0010 
0011 #include "kjob.h"
0012 
0013 class KJobTrackerInterfacePrivate
0014 {
0015 public:
0016     KJobTrackerInterfacePrivate(KJobTrackerInterface *interface)
0017         : q(interface)
0018     {
0019     }
0020 
0021     KJobTrackerInterface *const q;
0022 };
0023 
0024 KJobTrackerInterface::KJobTrackerInterface(QObject *parent)
0025     : QObject(parent)
0026     , d(new KJobTrackerInterfacePrivate(this))
0027 {
0028     qRegisterMetaType<KJob::Unit>();
0029     qRegisterMetaType<QPair<QString, QString>>();
0030 }
0031 
0032 KJobTrackerInterface::~KJobTrackerInterface() = default;
0033 
0034 void KJobTrackerInterface::registerJob(KJob *job)
0035 {
0036     connect(job, &KJob::finished, this, &KJobTrackerInterface::unregisterJob);
0037     connect(job, &KJob::finished, this, &KJobTrackerInterface::finished);
0038     connect(job, &KJob::suspended, this, &KJobTrackerInterface::suspended);
0039     connect(job, &KJob::resumed, this, &KJobTrackerInterface::resumed);
0040 
0041     connect(job, &KJob::description, this, &KJobTrackerInterface::description);
0042     connect(job, &KJob::infoMessage, this, &KJobTrackerInterface::infoMessage);
0043     connect(job, &KJob::warning, this, &KJobTrackerInterface::warning);
0044     connect(job, &KJob::totalAmountChanged, this, &KJobTrackerInterface::totalAmount);
0045     connect(job, &KJob::processedAmountChanged, this, &KJobTrackerInterface::processedAmount);
0046     connect(job, &KJob::percentChanged, this, &KJobTrackerInterface::percent);
0047     connect(job, &KJob::speed, this, &KJobTrackerInterface::speed);
0048 }
0049 
0050 void KJobTrackerInterface::unregisterJob(KJob *job)
0051 {
0052     job->disconnect(this);
0053 }
0054 
0055 void KJobTrackerInterface::finished(KJob *job)
0056 {
0057     Q_UNUSED(job)
0058 }
0059 
0060 void KJobTrackerInterface::suspended(KJob *job)
0061 {
0062     Q_UNUSED(job)
0063 }
0064 
0065 void KJobTrackerInterface::resumed(KJob *job)
0066 {
0067     Q_UNUSED(job)
0068 }
0069 
0070 void KJobTrackerInterface::description(KJob *job, const QString &title, const QPair<QString, QString> &field1, const QPair<QString, QString> &field2)
0071 {
0072     Q_UNUSED(job)
0073     Q_UNUSED(title)
0074     Q_UNUSED(field1)
0075     Q_UNUSED(field2)
0076 }
0077 
0078 void KJobTrackerInterface::infoMessage(KJob *job, const QString &text)
0079 {
0080     Q_UNUSED(job)
0081     Q_UNUSED(text)
0082 }
0083 
0084 void KJobTrackerInterface::warning(KJob *job, const QString &message)
0085 {
0086     Q_UNUSED(job)
0087     Q_UNUSED(message)
0088 }
0089 
0090 void KJobTrackerInterface::totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
0091 {
0092     Q_UNUSED(job)
0093     Q_UNUSED(unit)
0094     Q_UNUSED(amount)
0095 }
0096 
0097 void KJobTrackerInterface::processedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
0098 {
0099     Q_UNUSED(job)
0100     Q_UNUSED(unit)
0101     Q_UNUSED(amount)
0102 }
0103 
0104 void KJobTrackerInterface::percent(KJob *job, unsigned long percent)
0105 {
0106     Q_UNUSED(job)
0107     Q_UNUSED(percent)
0108 }
0109 
0110 void KJobTrackerInterface::speed(KJob *job, unsigned long value)
0111 {
0112     Q_UNUSED(job)
0113     Q_UNUSED(value)
0114 }
0115 
0116 #include "moc_kjobtrackerinterface.cpp"