Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-groupedprogressmanager.h
1#ifndef QX_GROUPEDPROGRESSMANAGER_H
2#define QX_GROUPEDPROGRESSMANAGER_H
3
4// Shared Lib Support
5#include "qx/core/qx_core_export.h"
6
7// Qt Includes
8#include <QObject>
9#include <QHash>
10
11// Intra-component Includes
12#include "qx/core/qx-progressgroup.h"
13
14namespace Qx
15{
16
17class QX_CORE_EXPORT GroupedProgressManager : public QObject
18{
19//-QObject Macro (Required for all QObject Derived Classes)-----------------------------------------------------------
20 Q_OBJECT
21
22//-Class Members---------------------------------------------------------------------------------------------
23private:
24 // TODO: Consider increasing this to 100,000 for finer granularity of overall progress and more
25 // frequent emissions of valueChanged() (for things like QProgressBar::setValue())
26 static const quint64 UNIFIED_MAXIMUM = 100;
27
28//-Instance Properties-------------------------------------------------------------------------------------------------------
29private:
30 Q_PROPERTY(quint64 value READ value NOTIFY valueChanged);
31 Q_PROPERTY(quint64 maximum READ maximum CONSTANT);
32
33//-Instance Members------------------------------------------------------------------------------------------
34private:
35 quint64 mCurrentValue;
37 QHash<QString, quint64> mRelativePortions;
38
39//-Constructor----------------------------------------------------------------------------------------------
40public:
41 explicit GroupedProgressManager(QObject* parent = nullptr);
42
43//-Instance Functions----------------------------------------------------------------------------------------------
44private:
45 void updateRelativePortions();
46 void updateValue();
47
48public:
49 void addGroup(ProgressGroup* progressGroup);
50 ProgressGroup* addGroup(const QString& name);
51 ProgressGroup* group(const QString& name);
52 void removeGroup(const QString& name);
53
54 quint64 value() const;
55 quint64 maximum() const;
56
57//-Slots------------------------------------------------------------------------------------------------------------
58private slots:
59 void childValueChanged(quint64 value);
60 void childMaximumChanged(quint64 maximum);
61 void childWeightChanged();
62
63//-Signals------------------------------------------------------------------------------------------------------------
64signals:
65 void valueChanged(quint64 value);
66 void progressUpdated(quint64 currentValue);
67 void groupValueChanged(Qx::ProgressGroup* group, quint64 value);
68 void groupMaximumChanged(Qx::ProgressGroup* group, quint64 maximum);
69};
70
71}
72
73#endif // QX_GROUPEDPROGRESSMANAGER_H
The GroupedProgressManager class produces an overall progress value from a collection of progress gro...
Definition qx-groupedprogressmanager.h:18
void valueChanged(quint64 value)
void groupValueChanged(Qx::ProgressGroup *group, quint64 value)
void groupMaximumChanged(Qx::ProgressGroup *group, quint64 maximum)
void progressUpdated(quint64 currentValue)
The ProgressGroup class represents a distinct portion of overall progress to be mediated by GroupedPr...
Definition qx-progressgroup.h:16
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5