CDelegatedProgressManager.h
Go to the documentation of this file.
1 #ifndef ibase_CDelegatedProgressManager_included
2 #define ibase_CDelegatedProgressManager_included
3 
4 
5 // Qt includes
6 #include <QtCore/QMap>
7 
8 // ACF includes
9 #include <istd/IChangeable.h>
10 
11 #include <ibase/IProgressManager.h>
12 
13 
14 namespace ibase
15 {
16 
17 
22  virtual public ibase::IProgressManager,
23  virtual public istd::IChangeable
24 {
25 public:
27  {
28  CF_SESSIONS_NUMBER = 0x8621d0,
30  };
31 
43  IProgressManager* slaveManagerPtr,
44  const QByteArray& progressId,
45  const QString& description,
46  bool isCancelable = false);
48 
49  double GetCumulatedProgress() const;
50 
51  // reimplemented (ibase::IProgressManager)
52  virtual int BeginProgressSession(const QByteArray& progressId, const QString& description, bool isCancelable = false);
53  virtual void EndProgressSession(int sessionId);
54  virtual void OnProgress(int sessionId, double currentProgress);
55  virtual bool IsCanceled(int sessionId) const;
56 
57 protected:
58  int GetOpenSessionsCount() const;
59 
63  virtual void OnCancelable(bool cancelState);
64 
65  // reimplemented (istd::IChangeable)
66  virtual void OnEndChanges(const ChangeSet& changeSet);
67 
68 private:
69  struct ProgressInfo
70  {
71  double progress;
72  bool isCancelable;
73  };
74 
75  typedef QMap<int, ProgressInfo> ProgressMap;
76 
77  ProgressMap m_progressMap;
78 
79  int m_nextSessionId;
80  double m_progressSum;
81 
82  int m_cancelableSessionsCount;
83 
84  IProgressManager* m_slaveManagerPtr;
85  int m_slaveSessionId;
86 };
87 
88 
89 } // namespace ibase
90 
91 
92 #endif // !ibase_CDelegatedProgressManager_included
93 
94 
virtual void EndProgressSession(int sessionId)
Close progress report session.
virtual void OnCancelable(bool cancelState)
Called when state of cancel operation has changed.
virtual bool IsCanceled(int sessionId) const
Check if this processing operation should be canceled.
CDelegatedProgressManager()
Create progress manager without slave manager.
virtual int BeginProgressSession(const QByteArray &progressId, const QString &description, bool isCancelable=false)
Begin progress report session.
virtual void OnEndChanges(const ChangeSet &changeSet)
Callback function for end change event.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
Progress manager delegating cumulated progress result to another manager.
virtual void OnProgress(int sessionId, double currentProgress)
Callback function for a progress event.
Consume information about progress of some process.
double GetCumulatedProgress() const

© 2007-2017 Witold Gantzke and Kirill Lepskiy