Loading...
Searching...
No Matches
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
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
44namespace 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 = "", std::string iconName = "");
66
67 /*! \brief Virtual destructor. */
69
70 /*!
71 \brief Insert a new taks to progress viewer container
72
73 \param t Task pointer.
74 \param id Task identifier.
75 */
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
114
115 void setMessage(const std::string& message);
116
117 protected slots:
118
119 virtual void onSetProgressMessage(const std::string& message);
120
121 virtual void onSetProgressRange(int min, int max);
122
123 virtual void onSetProgressValue(int value);
124
125 virtual void onResetProgress();
126
127 /*! \brief Get the button clicked and cancel ALL tasks. */
128 virtual void cancel();
129
130 signals:
131
132 //!< Signal emitted when the task is cancelled
134
135 protected:
136
137 int m_taskId; //!< Task Identifier.
138 int m_totalSteps; //!< Attribute used to define the total steps of all tasks.
139 int m_currentStep; //!< Attribute used to define the current steps of all task.
140 int m_propStep; //!< Attribute used to define the proportional step (0-100).
141 std::string m_message; //!< Attribute used to define dialog message.
143 QProgressBar* m_progressBar; //!< GUI Objects used to build the custom widget.
144 QToolButton* m_button; //!< GUI Objects used to build the custom widget.
145 QGridLayout* m_mainGridLayout; //!< GUI Objects used to build the custom widget.
146 QGridLayout* m_frameGridLayout; //!< GUI Objects used to build the custom widget.
147 QLabel* m_label; //!< GUI Objects used to build the custom widget.
148 };
149 } // end namespace widgets
150 } // end namespace qt
151} // end namespace te
152
153#endif //__TERRALIB_QT_WIDGETS_PROGRESS_INTERNAL_PROGRESSVIEWERTASKWIDGET_H
A class that defines the interface of an abstract qt progress viewer.
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:54
A class that defines the interface of an abstract qt progress viewer.
A progress viewer for a unique task.
QGridLayout * m_frameGridLayout
GUI Objects used to build the custom widget.
virtual void onSetProgressMessage(const std::string &message)
int m_currentStep
Attribute used to define the current steps of all task.
void removeTask(int taskId)
Removes a task from progress viewer container.
void setTask(te::common::TaskProgress *task)
QLabel * m_label
GUI Objects used to build the custom widget.
virtual void onSetProgressRange(int min, int max)
void taskCancelled()
< Signal emitted when the task is cancelled
int m_totalSteps
Attribute used to define the total steps of all tasks.
void cancelTask(int taskId)
Cancel a task.
QToolButton * m_button
GUI Objects used to build the custom widget.
void updateMessage(int taskId)
Update the progress message.
std::string m_message
Attribute used to define dialog message.
int m_propStep
Attribute used to define the proportional step (0-100).
ProgressViewerTaskWidget(QWidget *parent, bool hideToolBar, std::string message="", std::string iconName="")
Default constructor.
void setTotalValues(int taskId)
Set task total steps.
QProgressBar * m_progressBar
GUI Objects used to build the custom widget.
te::common::TaskProgress * m_task
Task object.
QGridLayout * m_mainGridLayout
GUI Objects used to build the custom widget.
void updateValue(int taskId)
Update the progress evaluation.
virtual void onSetProgressValue(int value)
void addTask(te::common::TaskProgress *t, int id)
Insert a new taks to progress viewer container.
virtual void cancel()
Get the button clicked and cancel ALL tasks.
void setMessage(const std::string &message)
virtual ~ProgressViewerTaskWidget()
Virtual destructor.
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63