]> Creatis software - clitk.git/blob - vv/vvQProgressDialogITKCommand.cxx
Reformatted using new coding style
[clitk.git] / vv / vvQProgressDialogITKCommand.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef VVQPROGRESSDIALOGITKCOMMAND_CXX
19 #define VVQPROGRESSDIALOGITKCOMMAND_CXX
20 #include "clitkImageCommon.h"
21 #include "vvQProgressDialogITKCommand.h"
22
23 //====================================================================
24 vvQProgressDialogITKCommand::vvQProgressDialogITKCommand()
25 {
26   progress.setWindowModality(Qt::WindowModal);
27   progress.setCancelButtonText("Cancel");
28 }
29 //====================================================================
30
31 //====================================================================
32 void vvQProgressDialogITKCommand::Initialize(QString title, float sec, int max)
33 {
34   progress.setMinimumDuration((int)lrint(1000.0*sec)); // number of seconds to wait before displaying dialog
35   progress.setLabelText(title);
36   i=0;
37   progress.setMaximum(max);
38 }
39 //====================================================================
40
41 //====================================================================
42 void vvQProgressDialogITKCommand::Execute(itk::Object *caller, const itk::EventObject & event)
43 {
44   i++;
45   progress.setValue(i);
46   if (progress.wasCanceled()) {
47     itk::ProcessObject * o = dynamic_cast<itk::ProcessObject *>(caller);
48     o->SetAbortGenerateData(true);
49   }
50 }
51 //====================================================================
52
53 //====================================================================
54 void vvQProgressDialogITKCommand::Execute(const itk::Object *caller, const itk::EventObject & event)
55 {
56   i++;
57   progress.setValue(i);
58 }
59 //====================================================================
60
61 #endif /* end #define VVQPROGRESSDIALOGITKCOMMAND_CXX */
62