ProgressViewerWidget.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/progress/ProgressViewerWidget.h
22 
23  \brief A class that defines the interface of a qt widget to group a set of ProgressWidgetItem.
24  */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERWIDGET_H
28 
29 // TerraLib
30 #include "../../../common/progress/AbstractProgressViewer.h"
31 #include "../../../common/progress/TaskProgress.h"
32 #include "../Config.h"
33 
34 //Qt
35 #include <QDialog>
36 #include <QGridLayout>
37 #include <QScrollArea>
38 
39 // STL
40 #include <map>
41 #include <string>
42 
43 namespace te
44 {
45  namespace qt
46  {
47  namespace widgets
48  {
49 // Forward declarations
50  class ProgressWidgetItem;
51 
52  /*!
53  \class ProgressViewerWidget
54 
55  \brief A class that defines the interface of a qt widget to group a set of ProgressWidgetItem.
56 
57  This viewer is made using ProgressWidgetItem. Feed back will be generated
58  over a custom widget. Multiples tasks will be displayed using individual
59  progress widgets
60 
61  The proportional value is informed by each task.
62 
63  \ingroup widgets
64 
65  \sa AbstractProgressViewer, QtProgressBar
66 
67  \note In this viewer, tasks can be deleted.
68  */
70  {
71  Q_OBJECT
72 
73  public:
74 
75  /*! \brief Default constructor. */
76  ProgressViewerWidget(QWidget* parent);
77 
78  /*! \brief Virtual destructor. */
79  virtual ~ProgressViewerWidget();
80 
81  /*!
82  \brief Insert a new taks to progress viewer container.
83 
84  \param t Task pointer.
85  \param id Task identifier.
86  */
87  virtual void addTask(te::common::TaskProgress* t, int id);
88 
89  /*!
90  \brief Removes a task from progress viewer container.
91 
92  \param taskId Task identifier.
93  */
94  virtual void removeTask(int taskId);
95 
96  /*!
97  \brief Cancel a task.
98 
99  \param taskId Task identifier.
100  */
101  virtual void cancelTask(int taskId);
102 
103  /*!
104  \brief Set task total steps.
105 
106  \param taskId Task identifier.
107  */
108  virtual void setTotalValues(int taskId);
109 
110  /*!
111  \brief Update the progress evaluation.
112 
113  \param taskId Task identifier.
114  */
115  virtual void updateValue(int taskId);
116 
117  /*!
118  \brief Update the progress message.
119 
120  \param taskId Task identifier.
121  */
122  virtual void updateMessage(int taskId);
123 
124  protected slots:
125 
126  virtual void onSetProgressMessage(const std::string& message);
127 
128  virtual void onSetProgressRange(int min, int max);
129 
130  virtual void onSetProgressValue(int value);
131 
132  virtual void onResetProgress();
133 
134  void onAddProgressItem(int taskId, int totalSteps, QString Label);
135 
136  void onRemoveProgressItem(int taskId);
137 
138  public slots:
139 
140  /*!
141  \brief This slot is connect to all cancel buttons of each progress items
142 
143  \param id value used to inform what task was canceled.
144  */
145  void cancel(int id);
146 
147  signals:
148 
149  void setProgressMessage(const std::string& message);
150 
151  void setProgressRange(int min, int max);
152 
153  void setProgressValue(int value);
154 
155  void resetProgress();
156 
157  void addProgressItem(int taskId, int totalSteps, QString Label);
158 
159  void removeProgressItem(int taskId);
160 
161  protected:
162 
163  std::map<int, te::common::TaskProgress*> m_tasks; //!< Task container.
164  std::map<int, ProgressWidgetItem*> m_items; //!< Custom widget progress item container.
165  QGridLayout* m_MainLayout; //!< GUI Objects used to build the custom widget.
166  QGridLayout* m_widgetLayout; //!< GUI Objects used to build the custom widget.
167  QScrollArea* m_scroll; //!< GUI Objects used to build the custom widget.
168  QWidget* m_widget; //!< GUI Objects used to build the custom widget.
169  };
170  } // end namespace widgets
171  } // end namespace qt
172 } // end namespace te
173 
174 #endif //__TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERWIDGET_H
175 
#define slots
A class that defines the interface of a qt widget to group a set of ProgressWidgetItem.
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
A class that defines the interface of an abstract progress viewer.
TerraLib.
std::map< int, te::common::TaskProgress * > m_tasks
Task container.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
QGridLayout * m_widgetLayout
GUI Objects used to build the custom widget.
QGridLayout * m_MainLayout
GUI Objects used to build the custom widget.
QWidget * m_widget
GUI Objects used to build the custom widget.
QScrollArea * m_scroll
GUI Objects used to build the custom widget.
std::map< int, ProgressWidgetItem * > m_items
Custom widget progress item container.