kget
jobqueue.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _JOBQUEUE_H
00013 #define _JOBQUEUE_H
00014
00026 #include <QList>
00027 #include "kget_export.h"
00028
00029 class Job;
00030 class Scheduler;
00031
00032 class KGET_EXPORT JobQueue
00033 {
00034 public:
00035 enum Status {Running, Stopped};
00036 typedef QList<Job *>::iterator iterator;
00037
00038 JobQueue(Scheduler * scheduler);
00039 virtual ~JobQueue();
00040
00046 virtual void setStatus(Status queueStatus);
00047
00051 Status status() const {return m_status;}
00052
00056 iterator begin() {return m_jobs.begin();}
00057
00061 iterator end() {return m_jobs.end();}
00062
00066 Job * last() {return m_jobs.last();}
00067
00071 int size() const {return m_jobs.size();}
00072
00079 int indexOf(Job * job) const {return m_jobs.indexOf(job);}
00080
00084 Job * operator[] (int i) const;
00085
00089 const QList<Job *> runningJobs();
00090
00097 void setMaxSimultaneousJobs(int n);
00098
00103 int maxSimultaneousJobs() const;
00104
00105 protected:
00111 void append(Job * job);
00112
00118 void prepend(Job * job);
00119
00126 void insert(Job * job, Job * after);
00127
00133 void remove(Job * job);
00134
00141 void move(Job * job, Job * after);
00142
00143 Scheduler * scheduler() {return m_scheduler;}
00144
00145 private:
00146 QList<Job *> m_jobs;
00147
00148 int m_maxSimultaneousJobs;
00149
00150 Scheduler * m_scheduler;
00151 Status m_status;
00152 };
00153
00154 #endif