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:
125 
126  /*!
127  \brief Used to receive custom progress events.
128 
129  \param e Event sent to this object.
130  */
131  void customEvent(QEvent* e);
132 
133  public slots:
134 
135  /*!
136  \brief This slot is connect to all cancel buttons of each progress items
137 
138  \param id value used to inform what task was canceled.
139  */
140  void cancel(int id);
141 
142  protected:
143 
144  std::map<int, te::common::TaskProgress*> m_tasks; //!< Task container.
145  std::map<int, ProgressWidgetItem*> m_items; //!< Custom widget progress item container.
146  QGridLayout* m_MainLayout; //!< GUI Objects used to build the custom widget.
147  QGridLayout* m_widgetLayout; //!< GUI Objects used to build the custom widget.
148  QScrollArea* m_scroll; //!< GUI Objects used to build the custom widget.
149  QWidget* m_widget; //!< GUI Objects used to build the custom widget.
150  };
151  } // end namespace widgets
152  } // end namespace qt
153 } // end namespace te
154 
155 #endif //__TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERWIDGET_H
156 
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.
URI C++ Library.
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.