CProgressHistoryGuiComp.h
Go to the documentation of this file.
1 #ifndef iqwt_CProgressHistoryGuiComp_included
2 #define iqwt_CProgressHistoryGuiComp_included
3 
4 
5 // Qwt includes
6 #include "qwt_plot.h"
7 #include "qwt_plot_curve.h"
8 #include "qwt_scale_draw.h"
9 #include "qwt_plot_marker.h"
10 #include "qwt_plot_grid.h"
11 
12 // ACF includes
13 #include "ibase/IProgressManager.h"
15 
16 #include "GeneratedFiles/iqwt/ui_CProgressHistoryGuiComp.h"
17 
18 
19 namespace iqwt
20 {
21 
22 
23 
28  public iqtgui::TDesignerGuiCompBase<Ui::CProgressHistoryGuiComp>,
30 {
31 public:
33 
34  I_BEGIN_COMPONENT(CProgressHistoryGuiComp);
35  I_REGISTER_INTERFACE(ibase::IProgressManager);
36  I_ASSIGN(m_historyStepsCountAttrPtr, "HistoryStepsCount", "Number of steps shown in this history", true, 100);
37  I_ASSIGN(m_showTaskDescriptionAttrPtr, "ShowTaskDescription", "If true, description of current task will be shown", true, true);
38  I_ASSIGN(m_showCancelAttrPtr, "ShowCancel", "If true, cancel button will be shown", true, true);
39  I_ASSIGN_MULTI_0(m_progressIdsAttrPtr, "ProgressIds", "List of known progress ID's", true);
40  I_ASSIGN_MULTI_0(m_progressColorsAttrPtr, "ProgressColors", "Colors for known progress ID's,\nFormat: #RRGGBB or SVG color keyword names", true);
41  I_END_COMPONENT;
42 
44 
45  // reimplemented (ibase::IProgressManager)
46  virtual int BeginProgressSession(
47  const QByteArray& progressId,
48  const QString& description,
49  bool isCancelable = false);
50  virtual void EndProgressSession(int sessionId);
51  virtual void OnProgress(int sessionId, double currentProgress);
52  virtual bool IsCanceled(int sessionId) const;
53 
54 protected:
55  void UpdateState();
56 
57  // reimplemented (iqtgui::CGuiComponentBase)
58  virtual void OnGuiCreated();
59  virtual void OnGuiDestroyed();
60 
61  // reimplemented (icomp::CComponentBase)
62  virtual void OnComponentCreated();
63 
64 private:
65  I_ATTR(int, m_historyStepsCountAttrPtr);
66  I_ATTR(bool, m_showTaskDescriptionAttrPtr);
67  I_ATTR(bool, m_showCancelAttrPtr);
68  I_MULTIATTR(QByteArray, m_progressIdsAttrPtr);
69  I_MULTIATTR(QString, m_progressColorsAttrPtr);
70 
71  istd::TDelPtr<QwtPlot> m_plotPtr;
72  istd::TDelPtr<QwtPlotMarker> m_nowMarkerPtr;
74 
75  typedef QVector<double> SingleData;
76 
77  struct Session
78  {
79  SingleData axisY;
80  QwtPlotCurve curve;
81  bool isCancelable;
82  QString description;
83  };
84 
85  typedef istd::TDelPtr<Session> SessionPtr;
86 
87  typedef QMap<int, SessionPtr> IdToSessionMap;
88  IdToSessionMap m_idToSessionMap;
89 
90  SingleData m_axisXData;
91 
92  int m_currentId;
93  int m_cancelsCount;
94 };
95 
96 
97 } // namespace iqwt
98 
99 
100 #endif // !iqwt_CProgressHistoryGuiComp_included
101 
102 
virtual void EndProgressSession(int sessionId)
virtual void OnComponentCreated()
iqtgui::TDesignerGuiCompBase< Ui::CProgressHistoryGuiComp > BaseClass
virtual void OnProgress(int sessionId, double currentProgress)
Shows progress history for nonlinear and 'non-progressive' processes.
virtual bool IsCanceled(int sessionId) const
virtual int BeginProgressSession(const QByteArray &progressId, const QString &description, bool isCancelable=false)

© 2007-2011 Witold Gantzke and Kirill Lepskiy