LeechCraft 0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
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 <memory>
12#include <QtPlugin>
14
15class QAbstractItemModel;
16class QMenu;
17class QModelIndex;
18class QToolBar;
19
20template<typename>
21class QList;
22
23namespace LC
24{
25 enum class ProcessKind : std::uint8_t
26 {
30 };
31
42 {
43 TaskParameters Parameters_ {};
44
46
47 bool operator== (const ProcessInfo& other) const = default;
48 };
49
50 struct NewsInfo
51 {
52 qlonglong Count_ = 0;
53 QDateTime LastUpdate_;
54
55 bool operator== (const NewsInfo& other) const = default;
56 };
57
58 using SpecificInfo = std::variant<
61 >;
62
63 struct RowInfo
64 {
65 QString Name_;
67
68 bool operator== (const RowInfo& other) const = default;
69 };
70
71 enum class ProcessState : std::uint8_t
72 {
78 };
79
90
91 constexpr int operator+ (JobHolderRole role) noexcept
92 {
93 return static_cast<int> (role);
94 }
95
96 template<>
98
100 {
102 Total, // qint64
104 State, // ProcessState
105 StateCustomText, // QString
106 };
107
108 constexpr int operator+ (JobHolderProcessRole role) noexcept
109 {
110 return static_cast<int> (role);
111 }
112
113 template<>
115}
116
118{
119public:
121
154 virtual QAbstractItemModel& GetRepresentation () = 0;
155
156 virtual void HandleCurrentChanged (const QModelIndex&) {}
157 virtual void HandleCurrentColumnChanged (const QModelIndex&) {}
158 virtual void HandleCurrentRowChanged (const QModelIndex&) {}
160
161 virtual void HandleActivated (const QModelIndex&) {}
162 virtual void HandleClicked (const QModelIndex&) {}
163 virtual void HandleDoubleClicked (const QModelIndex&) {}
164 virtual void HandleEntered (const QModelIndex&) {}
165 virtual void HandlePressed (const QModelIndex&) {}
166
167 virtual QWidget* GetInfoWidget () { return nullptr; }
168 virtual QToolBar* GetControls () { return nullptr; }
169 virtual QMenu* GetContextMenu () { return nullptr; }
170};
171
172using IJobHolderRepresentationHandler_ptr = std::unique_ptr<IJobHolderRepresentationHandler>;
173
198class Q_DECL_EXPORT IJobHolder
199{
200protected:
201 virtual ~IJobHolder () = default;
202public:
204};
205
208
209Q_DECLARE_INTERFACE (IJobHolder, "org.Deviant.LeechCraft.IJobHolder/1.0")
Interface for plugins holding jobs or persistent notifications.
Definition ijobholder.h:199
virtual ~IJobHolder()=default
virtual IJobHolderRepresentationHandler_ptr CreateRepresentationHandler()=0
virtual void HandleActivated(const QModelIndex &)
Definition ijobholder.h:161
virtual void HandleCurrentChanged(const QModelIndex &)
Definition ijobholder.h:156
virtual void HandleCurrentColumnChanged(const QModelIndex &)
Definition ijobholder.h:157
virtual ~IJobHolderRepresentationHandler()=default
virtual QMenu * GetContextMenu()
Definition ijobholder.h:169
virtual QAbstractItemModel & GetRepresentation()=0
Returns the item representation model.
virtual QToolBar * GetControls()
Definition ijobholder.h:168
virtual void HandleSelectedRowsChanged(const QList< QModelIndex > &)
Definition ijobholder.h:159
virtual void HandleClicked(const QModelIndex &)
Definition ijobholder.h:162
virtual void HandleEntered(const QModelIndex &)
Definition ijobholder.h:164
virtual QWidget * GetInfoWidget()
Definition ijobholder.h:167
virtual void HandleCurrentRowChanged(const QModelIndex &)
Definition ijobholder.h:158
virtual void HandleDoubleClicked(const QModelIndex &)
Definition ijobholder.h:163
virtual void HandlePressed(const QModelIndex &)
Definition ijobholder.h:165
std::unique_ptr< IJobHolderRepresentationHandler > IJobHolderRepresentationHandler_ptr
Definition ijobholder.h:172
Definition constants.h:15
constexpr int operator+(JobHolderRole role) noexcept
Definition ijobholder.h:91
constexpr int MaxValue
Definition maxvalue.h:14
ProcessState
Definition ijobholder.h:72
JobHolderProcessRole
Definition ijobholder.h:100
JobHolderRole
This enum contains roles that are used to query job states.
Definition ijobholder.h:83
std::variant< ProcessInfo, NewsInfo > SpecificInfo
Definition ijobholder.h:58
ProcessKind
Definition ijobholder.h:26
qlonglong Count_
Definition ijobholder.h:52
bool operator==(const NewsInfo &other) const =default
QDateTime LastUpdate_
Definition ijobholder.h:53
Describes a process represented by a row in an IJobHolder model.
Definition ijobholder.h:42
bool operator==(const ProcessInfo &other) const =default
TaskParameters Parameters_
Definition ijobholder.h:43
ProcessKind Kind_
Definition ijobholder.h:45
SpecificInfo Specific_
Definition ijobholder.h:66
bool operator==(const RowInfo &other) const =default
QString Name_
Definition ijobholder.h:65
Q_DECLARE_METATYPE(QVariantList *)