File indexing completed on 2024-04-28 04:20:53
0001 // SPDX-FileCopyrightText: 2012-2022 Jesper K. Pedersen <blackie@kde.org> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 #ifndef JOBINFO_H 0006 #define JOBINFO_H 0007 #include "Priority.h" 0008 0009 #include <QElapsedTimer> 0010 #include <QObject> 0011 #include <QString> 0012 0013 namespace BackgroundTaskManager 0014 { 0015 0016 class JobInfo : public QObject 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 explicit JobInfo(BackgroundTaskManager::Priority priority); 0022 explicit JobInfo(const JobInfo *other); 0023 ~JobInfo() override; 0024 0025 virtual QString title() const = 0; 0026 virtual QString details() const = 0; 0027 BackgroundTaskManager::Priority priority() const; 0028 0029 enum State { NotStarted, 0030 Running, 0031 Completed }; 0032 State state; 0033 0034 QString elapsed() const; 0035 int jobIndex() const; 0036 0037 protected Q_SLOTS: 0038 void start(); 0039 void stop(); 0040 0041 Q_SIGNALS: 0042 void changed() const; 0043 0044 private: 0045 BackgroundTaskManager::Priority m_priority; 0046 QElapsedTimer m_timer; 0047 uint m_elapsed; 0048 int m_jobIndex; 0049 static int s_jobCounter; 0050 }; 0051 0052 } 0053 #endif // JOBINFO_H 0054 // vi:expandtab:tabstop=4 shiftwidth=4: