Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "QmitkProgressBar.h"
00019
00020 #include "mitkProgressBar.h"
00021 #include "mitkRenderingManager.h"
00022
00023 #include <qprogressbar.h>
00024 #include <qapplication.h>
00025
00026
00030 void QmitkProgressBar::Reset()
00031 {
00032 this->reset();
00033 this->hide();
00034 m_TotalSteps = 0;
00035 m_Progress = 0;
00036 }
00037
00041 void QmitkProgressBar::SetPercentageVisible(bool visible)
00042 {
00043 emit SignalSetPercentageVisible(visible);
00044 }
00045
00050 void QmitkProgressBar::AddStepsToDo(unsigned int steps)
00051 {
00052 emit SignalAddStepsToDo(steps);
00053 }
00054
00060 void QmitkProgressBar::Progress(unsigned int steps)
00061 {
00062 emit SignalProgress(steps);
00063 }
00064
00065
00066 QmitkProgressBar::QmitkProgressBar(QWidget * parent, const char * )
00067 :QProgressBar(parent), ProgressBarImplementation()
00068 {
00069 m_TotalSteps = 0; m_Progress = 0;
00070 this->hide();
00071 this->SetPercentageVisible(true);
00072
00073 connect( this, SIGNAL(SignalAddStepsToDo(unsigned int)), this, SLOT(SlotAddStepsToDo(unsigned int)) );
00074 connect( this, SIGNAL(SignalProgress(unsigned int)), this, SLOT(SlotProgress(unsigned int)) );
00075 connect( this, SIGNAL(SignalSetPercentageVisible(bool)), this, SLOT(SlotSetPercentageVisible(bool)) );
00076
00077 mitk::ProgressBar::SetImplementationInstance(this);
00078 }
00079
00080 QmitkProgressBar::~QmitkProgressBar()
00081 {
00082 }
00083
00084 void QmitkProgressBar::SlotProgress(unsigned int steps)
00085 {
00086 m_Progress += steps;
00087 this->setValue(m_Progress);
00088
00089 if (m_Progress >= m_TotalSteps)
00090 Reset();
00091 else
00092 {
00093 this->show();
00094 }
00095
00096
00097
00098
00099 mitk::RenderingManager::GetInstance()->ExecutePendingRequests();
00100 }
00101
00102 void QmitkProgressBar::SlotAddStepsToDo(unsigned int steps)
00103 {
00104 m_TotalSteps += steps;
00105 this->setMaximum(m_TotalSteps);
00106 this->setValue(m_Progress);
00107 if (m_TotalSteps > 0)
00108 {
00109 this->show();
00110 }
00111
00112
00113
00114
00115 mitk::RenderingManager::GetInstance()->ExecutePendingRequests();
00116 }
00117
00118 void QmitkProgressBar::SlotSetPercentageVisible(bool visible)
00119 {
00120 this->setTextVisible(visible);
00121 }
00122
00123