File indexing completed on 2024-04-28 07:45:07

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KUISERVERJOBTRACKER_H
0009 #define KUISERVERJOBTRACKER_H
0010 
0011 #include <KJobTrackerInterface>
0012 #include <kjobwidgets_export.h>
0013 
0014 #include <memory>
0015 
0016 class KJob;
0017 
0018 /**
0019  * @class KUiServerJobTracker kuiserverjobtracker.h KUiServerJobTracker
0020  *
0021  * The interface to implement to track the progresses of a job.
0022  */
0023 class KJOBWIDGETS_EXPORT KUiServerJobTracker : public KJobTrackerInterface
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     /**
0029      * Creates a new KJobTrackerInterface
0030      *
0031      * @param parent the parent object
0032      */
0033     explicit KUiServerJobTracker(QObject *parent = nullptr);
0034 
0035     /**
0036      * Destroys a KJobTrackerInterface
0037      */
0038     ~KUiServerJobTracker() override;
0039 
0040     /**
0041      * Register a new job in this tracker.
0042      *
0043      * @param job the job to register
0044      */
0045     void registerJob(KJob *job) override;
0046 
0047     /**
0048      * Unregister a job from this tracker.
0049      *
0050      * @param job the job to unregister
0051      */
0052     void unregisterJob(KJob *job) override;
0053 
0054 protected Q_SLOTS:
0055     /**
0056      * The following slots are inherited from KJobTrackerInterface.
0057      */
0058     void finished(KJob *job) override;
0059     void suspended(KJob *job) override;
0060     void resumed(KJob *job) override;
0061     virtual void description(KJob *job, const QString &title, const QPair<QString, QString> &field1, const QPair<QString, QString> &field2) override;
0062     void infoMessage(KJob *job, const QString &message) override;
0063     void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount) override;
0064     void processedAmount(KJob *job, KJob::Unit unit, qulonglong amount) override;
0065     void percent(KJob *job, unsigned long percent) override;
0066     void speed(KJob *job, unsigned long value) override;
0067 
0068 private:
0069     class Private;
0070     std::unique_ptr<Private> const d;
0071 
0072     Q_PRIVATE_SLOT(d, void _k_killJob())
0073 };
0074 
0075 #endif