File indexing completed on 2024-04-14 07:31:22

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