ProgressWidgetItem.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/ProgressWidgetItem.h
22 
23  \brief Custom widget used to represent a single task.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSWIDGETITEM_H
27 #define __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSWIDGETITEM_H
28 
29 //TerraLib
31 #include "../../widgets/Config.h"
32 
33 //Qt
34 #include <QFrame>
35 #include <QGridLayout>
36 #include <QLabel>
37 #include <QProgressBar>
38 #include <QToolButton>
39 #include <QWidget>
40 
41 namespace te
42 {
43  namespace qt
44  {
45  namespace widgets
46  {
47 
48  /*!
49  \class ProgressWidgetItem
50 
51  \brief Custom widget used to represent a single task.
52 
53  \ingroup widgets
54 
55  \sa ProgressViewerWidget
56  */
57  class TEQTWIDGETSEXPORT ProgressWidgetItem : public QWidget
58  {
59  Q_OBJECT
60 
61  public:
62 
63  /*! \brief Default constructor. */
64  ProgressWidgetItem(QWidget* parent, int taskId, int totalSteps, QString label);
65 
66  /*! \brief Virtual destructor. */
68 
69  /*!
70  \brief Set the current value in progress bar.
71 
72  \param step Step value as integer.
73  */
74  virtual void setValue(int step);
75 
76  /*!
77  \brief Set task total steps
78  */
79  void setTotalValues(int values);
80 
81  /*!
82  \brief Set the progress label information.
83 
84  \param message String with the label information.
85  */
86  virtual void setLabel(const std::string& message);
87 
88  /*! \brief Reset the progress bar. */
89  virtual void reset();
90 
91  public slots:
92 
93  /*! \brief Get the button clicked and cancel ALL tasks. */
94  virtual void cancel();
95 
96  protected slots:
97 
98  virtual void onSetProgressMessage(const std::string& message);
99 
100  virtual void onSetProgressRange(int min, int max);
101 
102  virtual void onSetProgressValue(int value);
103 
104  virtual void onResetProgress();
105 
106  signals:
107 
108  /*!
109  \brief Inform that a task was canceled.
110 
111  \param id taskId.
112  */
113  void taskCanceled(int id);
114 
115  void setProgressMessage(const std::string& message);
116 
117  void setProgressRange(int min, int max);
118 
119  void setProgressValue(int value);
120 
121  void resetProgress();
122 
123  protected:
124 
125  int m_taskId; //!< Task Identifier.
126  int m_totalSteps; //!< Attribute used to define the total steps of all tasks.
127  int m_currentStep; //!< Attribute used to define the current steps of all task.
128  int m_propStep; //!< Attribute used to define the proportional step (0-100).
129  QLabel* m_label; //!< GUI Objects used to build the custom widget.
130  QProgressBar* m_progressBar; //!< GUI Objects used to build the custom widget.
131  QToolButton* m_button; //!< GUI Objects used to build the custom widget.
132  QFrame* m_frame; //!< GUI Objects used to build the custom widget.
133  QGridLayout* m_mainGridLayout; //!< GUI Objects used to build the custom widget.
134  QGridLayout* m_frameGridLayout; //!< GUI Objects used to build the custom widget.
135  };
136 
137  } // end namespace widgets
138  } // end namespave qt
139 } // end namespave te
140 
141 #endif // __TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSWIDGETITEM_H
142 
#define slots
int m_propStep
Attribute used to define the proportional step (0-100).
QProgressBar * m_progressBar
GUI Objects used to build the custom widget.
QGridLayout * m_frameGridLayout
GUI Objects used to build the custom widget.
int m_totalSteps
Attribute used to define the total steps of all tasks.
QFrame * m_frame
GUI Objects used to build the custom widget.
QToolButton * m_button
GUI Objects used to build the custom widget.
Custom widget used to represent a single task.
QLabel * m_label
GUI Objects used to build the custom widget.
TerraLib.
QGridLayout * m_mainGridLayout
GUI Objects used to build the custom widget.
A class that defines the interface of an abstract qt progress viewer.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
int m_currentStep
Attribute used to define the current steps of all task.