20class QAbstractItemModel;
97 return static_cast<int> (role);
114 return static_cast<int> (role);
177 return { .Rows_ { row }, .Current_ { row } };
299 template<std::derived_from<IJobHolderRepresentationHandler>... Handlers>
300 static std::vector<IJobHolderRepresentationHandler_ptr>
MakeHandlers (std::unique_ptr<Handlers>... handlers)
302 std::vector<IJobHolderRepresentationHandler_ptr> result;
303 result.reserve (
sizeof... (Handlers));
304 (result.push_back (std::move (handlers)), ...);
312Q_DECLARE_INTERFACE (
IJobHolder,
"org.Deviant.LeechCraft.IJobHolder/1.0")
Interface for plugins holding jobs or persistent notifications.
virtual std::vector< IJobHolderRepresentationHandler_ptr > CreateRepresentationHandlers(const ViewCallbacks &callbacks)=0
Creates the handlers representing the jobs of this plugin.
virtual ~IJobHolder()=default
static std::vector< IJobHolderRepresentationHandler_ptr > MakeHandlers(std::unique_ptr< Handlers >... handlers)
Wraps the given handlers into the list to be returned from CreateRepresentationHandlers().
virtual void HandleActivated(const QModelIndex &)
virtual ~IJobHolderRepresentationHandler()=default
virtual void HandleSelectedRowsChanging(const RowSelection &selection)
Called from a clean stack whenever the selection or the current row changes.
virtual void HandleSelectedRowsSettled(const RowSelection &selection)
Called from a clean stack once the selection has settled.
virtual QMenu * GetContextMenu()
virtual QAbstractItemModel & GetRepresentation()=0
Returns the item representation model.
virtual QToolBar * GetControls()
virtual void HandleClicked(const QModelIndex &)
virtual QWidget * GetInfoWidget()
virtual void HandleDoubleClicked(const QModelIndex &)
virtual void HandlePressed(const QModelIndex &)
std::unique_ptr< IJobHolderRepresentationHandler > IJobHolderRepresentationHandler_ptr
constexpr int operator+(JobHolderRole role) noexcept
JobHolderRole
This enum contains roles that are used to query job states.
std::variant< ProcessInfo, NewsInfo > SpecificInfo
The callbacks into the view showing the handlers' representations.
std::function< void(IJobHolderRepresentationHandler::RowSelection)> SetSelection_
Selects the given rows of the handler's representation.
The rows of this handler's representation selected in the view.
static RowSelection FromSingle(const QModelIndex &row)
QModelIndex Current_
One of Rows_ (at the 0'th column), or invalid.
static RowSelection FromMaybe(const std::optional< QModelIndex > &row)
QList< QModelIndex > Rows_
The selected rows, at the 0'th column, in the view's order.
bool operator==(const NewsInfo &other) const =default
Describes a process represented by a row in an IJobHolder model.
bool operator==(const ProcessInfo &other) const =default
TaskParameters Parameters_
bool operator==(const RowInfo &other) const =default
Q_DECLARE_METATYPE(QVariantList *)