LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
ijobholder.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QtPlugin>
12 #include "interfaces/structures.h"
13 
14 class QAbstractItemModel;
15 class QWidget;
16 
17 namespace LC
18 {
25  {
30 
35 
40  };
41 
51  {
56 
61 
69 
77  };
78 
93  {
100  qlonglong Done_ = 0;
101 
108  qlonglong Total_ = 0;
109 
118  TaskParameters Params_ = {};
119 
122  enum class State
123  {
126  Unknown,
127 
130  Running,
131 
134  Paused,
135 
138  Error
140 
143  ProcessStateInfo () = default;
144 
155  ProcessStateInfo (qlonglong done, qlonglong total, TaskParameters params)
156  : ProcessStateInfo { done, total, params, State::Unknown }
157  {
158  }
159 
173  ProcessStateInfo (qlonglong done, qlonglong total, TaskParameters params, State state)
174  : Done_ { done }
175  , Total_ { total }
176  , Params_ { params }
177  , State_ { state }
178  {
179  }
180  };
181 
185  {
197 
199  };
200 }
201 
203 using IJobHolderRepresentationHandler_ptr = std::shared_ptr<IJobHolderRepresentationHandler>;
204 
229 class Q_DECL_EXPORT IJobHolder
230 {
231 public:
261  virtual QAbstractItemModel* GetRepresentation () const = 0;
262 
264 
267  virtual ~IJobHolder () {}
268 };
269 
272 
273 Q_DECLARE_INTERFACE (IJobHolder, "org.Deviant.LeechCraft.IJobHolder/1.0")
LC::ProcessStateInfo::Params_
TaskParameters Params_
The flags of the task as it was originally added to the downloader, if relevant.
Definition: ijobholder.h:118
LC::JobName
@ JobName
The column with the name of the task, like a torrent name or an RSS feed name.
Definition: ijobholder.h:29
LC::ProcessStateInfo::State
State
Describes the state of the process.
Definition: ijobholder.h:122
LC::RoleMAX
@ RoleMAX
Definition: structures.h:211
LC::ProcessStateInfo::Total_
qlonglong Total_
The total amount of items to be processed or downloaded.
Definition: ijobholder.h:108
LC::Other
@ Other
Definition: ijobholder.h:55
IJobHolder::CreateRepresentationHandler
virtual IJobHolderRepresentationHandler_ptr CreateRepresentationHandler()
Definition: ijobholder.h:263
IJobHolderRepresentationHandler_ptr
std::shared_ptr< IJobHolderRepresentationHandler > IJobHolderRepresentationHandler_ptr
Definition: ijobholder.h:203
LC::ProcessStateInfo::ProcessStateInfo
ProcessStateInfo(qlonglong done, qlonglong total, TaskParameters params, State state)
Constructs the description with the given values and state.
Definition: ijobholder.h:173
LC::ProcessStateInfo::ProcessStateInfo
ProcessStateInfo()=default
Default-constructs a process description.
structures.h
LC::ProcessStateInfo::State::Running
@ Running
The process is running just fine.
LC::JobProgress
@ JobProgress
The column with the progress of the task, like the amount of data downloaded so far or last update.
Definition: ijobholder.h:39
LC::DownloadProgress
@ DownloadProgress
Definition: ijobholder.h:68
LC::ProcessStateInfo
State of a single process represented in a IJobHolder model.
Definition: ijobholder.h:92
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QVariantList *)
LC::ProcessState
@ ProcessState
Describes the state of a process.
Definition: ijobholder.h:196
LC::JobStatus
@ JobStatus
The column with the status of the task, like the download status or the unread items count of an RSS ...
Definition: ijobholder.h:34
LC::JobHolderRole
JobHolderRole
This enum contains roles that are used to query job states.
Definition: ijobholder.h:184
LC::JobHolderRoleMax
@ JobHolderRoleMax
Definition: ijobholder.h:198
LC::ProcessStateInfo::Done_
qlonglong Done_
The amount of items already processed or downloaded.
Definition: ijobholder.h:100
LC::News
@ News
Definition: ijobholder.h:60
LC
Definition: constants.h:14
LC::ProcessStateInfo::State::Error
@ Error
There was an error completing the process.
IJobHolderRepresentationHandler
Definition: ijobholderrepresentationhandler.h:18
LC::ProcessStateInfo::State_
enum LC::ProcessStateInfo::State State_
LC::JobHolderColumn
JobHolderColumn
Describes the columns in a job holder model.
Definition: ijobholder.h:24
LC::ProcessStateInfo::ProcessStateInfo
ProcessStateInfo(qlonglong done, qlonglong total, TaskParameters params)
Constructs the description with the given values.
Definition: ijobholder.h:155
LC::ProcessStateInfo::State::Paused
@ Paused
The process is paused.
LC::ProcessStateInfo::State::Unknown
@ Unknown
Unknown state.
IJobHolder
Interface for plugins holding jobs or persistent notifications.
Definition: ijobholder.h:229
LC::JobHolderRow
JobHolderRow
Describes the semantics of a row in a job holder model.
Definition: ijobholder.h:50
IJobHolder::~IJobHolder
virtual ~IJobHolder()
Virtual destructor.
Definition: ijobholder.h:267
LC::ProcessProgress
@ ProcessProgress
Definition: ijobholder.h:76