Orfeo Toolbox  4.0
otbWrapperQtWidgetProgressReport.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 
21 #include "itksys/SystemTools.hxx"
22 
24 
25 namespace otb
26 {
27 namespace Wrapper
28 {
29 
31 {
32  m_Model = model;
33  connect(model, SIGNAL(SetProgressReportBegin()), this, SLOT(show()) );
34  connect(model, SIGNAL(SetProgressReportDone()), this, SLOT(close()) );
35  connect(model, SIGNAL(SetProgressReportDone()), this, SLOT(RemoveLayout()) );
36  connect(this, SIGNAL(AddNewProcessToReport()), this, SLOT(ReportProcess()) );
37 
38  m_Layout = new QVBoxLayout;
39  this->setLayout(m_Layout);
40 
42  m_AddProcessCommand->SetCallbackFunction( this, &QtWidgetProgressReport::ProcessEvent );
43 
44  this->show();
45 }
46 
48 {
49  delete m_Layout;
50 }
51 
53 {
54  m_Application = app;
56 }
57 
58 void
60  const itk::EventObject & event )
61 {
62  if( typeid( otb::Wrapper::AddProcessToWatchEvent ) == typeid( event ) )
63  {
64  const AddProcessToWatchEvent* eventToWacth = dynamic_cast< const AddProcessToWatchEvent*> ( &event );
65 
66  m_CurrentProcess = eventToWacth->GetProcess();
68  emit AddNewProcessToReport();
69  }
70 }
71 
73 {
74  // Build the widget containing the QtProgressBar for the current
75  // process
76 
77  // Create a itk::QtProgressBar, observing the event ProgressEvent
78  itk::QtProgressBar * bar = new itk::QtProgressBar(this);
79  connect( bar, SIGNAL(SetValueChanged(int)), bar, SLOT(setValue(int)) );
80  connect( m_Model, SIGNAL(SetProgressReportDone()), bar, SLOT(reset()) );
82 
83  // label
84  QLabel *label = new QLabel(QString(m_CurrentDescription.c_str()));
85 
86  // Build the layout and store the pointers
87  m_Layout->addWidget(label);
88  m_Layout->addWidget(bar);
89 }
90 
92 {
93  // Remove the children of the layout (progress bar widgets)
94  QLayoutItem *child;
95  while ((child = this->layout()->takeAt(0)) != 0)
96  {
97  delete child->widget();
98  delete child;
99  }
100 }
101 
102 }
103 }

Generated at Sat Mar 8 2014 16:28:52 for Orfeo Toolbox with doxygen 1.8.3.1