File indexing completed on 2024-12-01 09:54:13

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 class KJob;
0015 class KUiServerV2JobTrackerPrivate;
0016 
0017 /**
0018  * @class KUiServerV2JobTracker kuiserverv2jobtracker.h KUiServerV2JobTracker
0019  *
0020  * The interface to implement to track the progresses of a job.
0021  *
0022  * @since 5.81
0023  */
0024 class KJOBWIDGETS_EXPORT KUiServerV2JobTracker : public KJobTrackerInterface
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     /**
0030      * Creates a new KJobTrackerInterface
0031      *
0032      * @param parent the parent object
0033      */
0034     explicit KUiServerV2JobTracker(QObject *parent = nullptr);
0035 
0036     /**
0037      * Destroys a KJobTrackerInterface
0038      */
0039     ~KUiServerV2JobTracker() override;
0040 
0041     /**
0042      * Register a new job in this tracker.
0043      *
0044      * @param job the job to register
0045      */
0046     void registerJob(KJob *job) override;
0047 
0048     /**
0049      * Unregister a job from this tracker.
0050      *
0051      * @param job the job to unregister
0052      */
0053     void unregisterJob(KJob *job) override;
0054 
0055 protected Q_SLOTS:
0056     /**
0057      * The following slots are inherited from KJobTrackerInterface.
0058      */
0059     void finished(KJob *job) override;
0060     void suspended(KJob *job) override;
0061     void resumed(KJob *job) override;
0062     virtual void description(KJob *job, const QString &title,
0063                              const QPair<QString, QString> &field1,
0064                              const QPair<QString, QString> &field2) override;
0065     void infoMessage(KJob *job, const QString &plain, const QString &rich) override;
0066     void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount) override;
0067     void processedAmount(KJob *job, KJob::Unit unit, qulonglong amount) override;
0068     void percent(KJob *job, unsigned long percent) override;
0069     void speed(KJob *job, unsigned long value) override;
0070 
0071 private:
0072     KUiServerV2JobTrackerPrivate *const d;
0073 
0074 };
0075 
0076 #endif