File indexing completed on 2024-05-05 04:38:45
0001 /* 0002 SPDX-FileCopyrightText: 2015 Kevin Funk <kfunk@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "utilexport.h" 0010 0011 #include <interfaces/istatus.h> 0012 0013 #include <QObject> 0014 0015 class KJob; 0016 0017 namespace KDevelop { 0018 class JobStatusPrivate; 0019 0020 /** 0021 * @brief Class for making KJobs exposable to the IStatus interface 0022 * 0023 * Using this class you use any KJob-based class as source for IStatus updates 0024 */ 0025 class KDEVPLATFORMUTIL_EXPORT JobStatus : public QObject 0026 , public IStatus 0027 { 0028 Q_OBJECT 0029 Q_INTERFACES(KDevelop::IStatus) 0030 0031 public: 0032 /** 0033 * Construct a JobStatus observing the job @p job 0034 * 0035 * @note As soon as @p job finished, this object will be auto-deleted 0036 */ 0037 explicit JobStatus(KJob* job, const QString& statusName = QString(), QObject* parent = nullptr); 0038 ~JobStatus() override; 0039 0040 QString statusName() const override; 0041 0042 Q_SIGNALS: 0043 void clearMessage(KDevelop::IStatus*) override; 0044 void hideProgress(KDevelop::IStatus*) override; 0045 void showErrorMessage(const QString& message, int timeout = 5) override; 0046 void showMessage(KDevelop::IStatus*, const QString& message, int timeout = 0) override; 0047 void showProgress(KDevelop::IStatus*, int minimum, int maximum, int value) override; 0048 0049 private Q_SLOTS: 0050 void slotPercent(KJob* job, unsigned long percent); 0051 0052 private: 0053 const QScopedPointer<class JobStatusPrivate> d_ptr; 0054 Q_DECLARE_PRIVATE(JobStatus) 0055 }; 0056 0057 }