File indexing completed on 2024-04-14 03:48:52

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef JOBQUEUE_H
0007 #define JOBQUEUE_H
0008 
0009 #include "job.h"
0010 
0011 #include <QObject>
0012 #include <QList>
0013 
0014 class JobQueue : public QObject
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit JobQueue(QObject *parent = nullptr);
0019 
0020     void addJob(Job* job);
0021 
0022     void setMaxConcurrentJobs(int size);
0023 
0024 private Q_SLOTS:
0025     void removeJob(Job* job);
0026 
0027 private:
0028     void startJob(Job *job);
0029 
0030     QList<Job*> m_jobs;
0031 
0032     QList<Job*> m_runningJobs;
0033 
0034     int m_maxConcurrentJobs;
0035 };
0036 
0037 #endif // JOBQUEUE_H