LeechCraft 0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
progressmanager.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 <QIcon>
14#include "xpcconfig.h"
15
16namespace LC::Util
17{
18 class ProgressManager;
19
21 {
22 ProgressManager& Manager_;
23 QPersistentModelIndex Index_;
24 public:
25 explicit ProgressModelRow (ProgressManager&, const QModelIndex&);
27
28 void Disengage ();
29
30 void SetDone (qint64);
31 void SetTotal (qint64);
32 void ChangeTotalBy (qint64 delta);
33 void SetState (ProcessState state, QString customText = {});
34
35 void SetCustomData (const QVariant&);
36
37 void operator++ ();
38 };
39
40 class UTIL_XPC_API ProgressManager : public QObject
41 {
42 friend class ProgressModelRow;
43 public:
45
46 constexpr static auto MaxRole = CustomDataRole;
47 private:
48 struct Item
49 {
56
58
60 };
62 public:
63 explicit ProgressManager (QObject *parent = nullptr);
64
65 void SetGlobalData (const QVariant& data, int role);
66
67 QAbstractItemModel& GetModel ();
68 IJobHolderRepresentationHandler_ptr CreateDefaultHandler ();
69
71 {
73 qint64 Total_ = 0;
74 QString CustomStateText_ {};
75 QIcon Icon_ {};
76 QVariant CustomData_ {};
77 };
78
79 [[nodiscard]] std::unique_ptr<ProgressModelRow> AddRow (RowInfo);
80 [[nodiscard]] std::unique_ptr<ProgressModelRow> AddRow (RowInfo, Initializers);
81
82 QVariant GetCustomData (const QModelIndex&) const;
83 };
84}
ProgressManager(QObject *parent=nullptr)
static constexpr auto CustomDataRole
static constexpr auto MaxRole
void ChangeTotalBy(qint64 delta)
void SetCustomData(const QVariant &)
ProgressModelRow(ProgressManager &, const QModelIndex &)
void SetState(ProcessState state, QString customText={})
std::unique_ptr< IJobHolderRepresentationHandler > IJobHolderRepresentationHandler_ptr
Definition ijobholder.h:172
constexpr int MaxValue
Definition maxvalue.h:14
ProcessState
Definition ijobholder.h:72
#define UTIL_XPC_API
Definition xpcconfig.h:16