ProgressViewerTaskWidget.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/ProgressViewerTaskWidget.h
22 
23  \brief A progress dialog.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERTASKWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERTASKWIDGET_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 <QGridLayout>
36 #include <QLabel>
37 #include <QProgressBar>
38 #include <QToolButton>
39 
40 // STL
41 #include <map>
42 #include <string>
43 
44 namespace te
45 {
46  namespace qt
47  {
48  namespace widgets
49  {
50 
51  /*!
52  \class ProgressViewerTaskWidget
53 
54  \brief A progress viewer for a unique task.
55 
56  \ingroup widgets
57  */
59  {
60  Q_OBJECT
61 
62  public:
63 
64  /*! \brief Default constructor. */
65  ProgressViewerTaskWidget(QWidget* parent, bool hideToolBar, std::string message = "");
66 
67  /*! \brief Virtual destructor. */
68  virtual ~ProgressViewerTaskWidget();
69 
70  /*!
71  \brief Insert a new taks to progress viewer container
72 
73  \param t Task pointer.
74  \param id Task identifier.
75  */
76  void addTask(te::common::TaskProgress* t, int id);
77 
78  /*!
79  \brief Removes a task from progress viewer container.
80 
81  \param taskId Task identifier.
82  */
83  void removeTask(int taskId);
84 
85  /*!
86  \brief Cancel a task.
87 
88  \param taskId Task identifier.
89  */
90  void cancelTask(int taskId);
91 
92  /*!
93  \brief Set task total steps.
94 
95  \param taskId Task identifier.
96  */
97  void setTotalValues(int taskId);
98 
99  /*!
100  \brief Update the progress evaluation.
101 
102  \param taskId Task identifier.
103  */
104  void updateValue(int taskId);
105 
106  /*!
107  \brief Update the progress message.
108 
109  \param taskId Task identifier.
110  */
111  void updateMessage(int taskId);
112 
113  void setTask(te::common::TaskProgress* task);
114 
115  protected:
116 
117  /*!
118  \brief Used to receive custom progress events.
119 
120  \param e Event sent to this object.
121  */
122  virtual void customEvent(QEvent* e);
123 
124  public slots:
125 
126  /*! \brief Get the button clicked and cancel ALL tasks. */
127  virtual void cancel();
128 
129  protected:
130 
131  int m_taskId; //!< Task Identifier.
132  int m_totalSteps; //!< Attribute used to define the total steps of all tasks.
133  int m_currentStep; //!< Attribute used to define the current steps of all task.
134  int m_propStep; //!< Attribute used to define the proportional step (0-100).
135  std::string m_message; //!< Attribute used to define dialog message.
136  te::common::TaskProgress* m_task; //!< Task object.
137  QProgressBar* m_progressBar; //!< GUI Objects used to build the custom widget.
138  QToolButton* m_button; //!< GUI Objects used to build the custom widget.
139  QGridLayout* m_mainGridLayout; //!< GUI Objects used to build the custom widget.
140  QGridLayout* m_frameGridLayout; //!< GUI Objects used to build the custom widget.
141  QLabel* m_label; //!< GUI Objects used to build the custom widget.
142  };
143  } // end namespace widgets
144  } // end namespace qt
145 } // end namespace te
146 
147 #endif //__TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERTASKWIDGET_H
int m_totalSteps
Attribute used to define the total steps of all tasks.
int m_currentStep
Attribute used to define the current steps of all task.
int m_propStep
Attribute used to define the proportional step (0-100).
A progress viewer for a unique task.
QGridLayout * m_frameGridLayout
GUI Objects used to build the custom widget.
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.
QGridLayout * m_mainGridLayout
GUI Objects used to build the custom widget.
URI C++ Library.
QLabel * m_label
GUI Objects used to build the custom widget.
QToolButton * m_button
GUI Objects used to build the custom widget.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::common::TaskProgress * m_task
Task object.
std::string m_message
Attribute used to define dialog message.
QProgressBar * m_progressBar
GUI Objects used to build the custom widget.