• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • core
job.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2005 Dario Massarin <nekkar@libero.it>
4  Copyright (C) 2009 Lukas Appelhans <l.appelhans@gmx.de>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 */
11 
12 #ifndef JOB_H
13 #define JOB_H
14 
26 #include "../kget_export.h"
27 
28 #include <QPixmap>
29 
30 class QDomNode;
31 
32 class Scheduler;
33 class JobQueue;
34 
35 class KGET_EXPORT Job : public QObject
36 {
37  Q_OBJECT
38  public:
42  enum Status {
43  Running = 0,
44  Stopped = 2,
45  Aborted = 3,
46  Finished = 4,
48  FinishedKeepAlive = 5,
49  Moving = 6
51  };
53 
57  enum Policy {
58  Start,
59  Stop,
61  None
63  };
68  enum ErrorType {
69  AutomaticRetry,
70  ManualSolve,
71  NotSolveable
72  };
73  struct Error {
74  int id;
75  QString text;
76  QPixmap pixmap;
77  ErrorType type;
78  };
79  Job(Scheduler * scheduler, JobQueue * parent);
80  virtual ~Job();
81 
82  //Job commands
83  virtual void start()=0;
84  virtual void stop()=0;
85 
86  JobQueue * jobQueue() {return m_jobQueue;}
87 
88  //Job properties
89  void setStatus(Status jobStatus);
90  void setPolicy(Policy jobPolicy);
91  void setError(const QString &text, const QPixmap &pixmap, ErrorType type = AutomaticRetry, int errorId = -1);
92 
93  Status status() const {return m_status;}
94  Status startStatus() const { return m_startStatus;}
95  Policy policy() const {return m_policy;}
96  Error error() const {return m_error;}
97 
98  virtual int elapsedTime() const =0;
99  virtual int remainingTime() const =0;
100  virtual bool isStalled() const =0;
101  virtual bool isWorking() const =0;
102 
103  virtual void resolveError(int errorId);
104 
105  protected:
106  Scheduler * scheduler() const {return m_scheduler;}
107 
108  void read(QDomNode * n);
109  void write(QDomNode * n);
110 
111  void setStartStatus(Status jobStatus);
112 
116  void postJobEvent(Status); //do we need a JobEvent instead of JobStatus?
117 
118  JobQueue * m_jobQueue;
119  Scheduler * m_scheduler;
120 
121  private:
122  Status m_status;
123  // our status when KGet is started
124  Status m_startStatus;
125  Policy m_policy;
126  Error m_error;
127 };
128 
129 #endif
Job::Error::pixmap
QPixmap pixmap
Definition: job.h:76
Scheduler
Scheduler class: what handle all the jobs in kget.
Definition: scheduler.h:32
Job::ErrorType
ErrorType
Describes different types of errors and how the scheduler should manage them.
Definition: job.h:68
Job::AutomaticRetry
Definition: job.h:69
Job::error
Error error() const
Definition: job.h:96
Job::Status
Status
The status property describes the current job status.
Definition: job.h:42
Job::ManualSolve
Definition: job.h:70
Job::Error::type
ErrorType type
Definition: job.h:77
Job
Definition: job.h:35
Job::scheduler
Scheduler * scheduler() const
Definition: job.h:106
QObject
Job::policy
Policy policy() const
Definition: job.h:95
Job::startStatus
Status startStatus() const
Definition: job.h:94
Job::jobQueue
JobQueue * jobQueue()
Definition: job.h:86
Job::Policy
Policy
The policy property describes how the scheduler should manage this job.
Definition: job.h:57
Job::Error::id
int id
Definition: job.h:74
Job::m_scheduler
Scheduler * m_scheduler
Definition: job.h:119
Job::status
Status status() const
Definition: job.h:93
JobQueue
Definition: jobqueue.h:32
Job::Error
Definition: job.h:73
KGET_EXPORT
#define KGET_EXPORT
Definition: kget_export.h:24
Job::Error::text
QString text
Definition: job.h:75
Job::m_jobQueue
JobQueue * m_jobQueue
Definition: job.h:118
Job::Start
Definition: job.h:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal