]> Creatis software - clitk.git/blob - vv/vvProgressDialog.cxx
Fusion windows level is now 4 decimals
[clitk.git] / vv / vvProgressDialog.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
19 // vv
20 #include "vvProgressDialog.h"
21
22 //------------------------------------------------------------------------------
23 vvProgressDialog::vvProgressDialog(std::string message, bool show_progress) 
24 {
25   setupUi(this);
26   connect(mCancelButton, SIGNAL(rejected()), this, SLOT(reject()));
27   SetCancelButtonEnabled(false);
28   textLabel->setText(message.c_str());
29   if (show_progress) 
30     progressBar->show();
31   else 
32     progressBar->hide();
33   this->show();
34 }
35 //------------------------------------------------------------------------------
36
37
38 //------------------------------------------------------------------------------
39 void vvProgressDialog::SetCancelButtonEnabled(bool b)
40 {
41   if (b) {
42     mCancelButton->show();
43     //setMaximumHeight(500);
44     //setMinimumHeight(80);
45     //QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
46     // sizePolicy.setHorizontalStretch(0);
47     // sizePolicy.setVerticalStretch(0);
48     // sizePolicy.setHeightForWidth(sizePolicy().hasHeightForWidth());
49     //setSizePolicy(sizePolicy);
50   }
51   else {
52     mCancelButton->hide();
53     //    setFixedHeight(80); // fixe the size when no cancel button
54   }
55 }
56 //------------------------------------------------------------------------------
57
58 //------------------------------------------------------------------------------
59 void vvProgressDialog::SetText(std::string message)
60 {
61   textLabel->setText(message.c_str());
62 }
63 //------------------------------------------------------------------------------
64
65
66 //------------------------------------------------------------------------------
67 void vvProgressDialog::AddToText(std::string message)
68 {
69   textLabel->setText(QString("%1\n%2").arg(textLabel->text()).arg(message.c_str()));
70 }
71 //------------------------------------------------------------------------------
72
73
74 //------------------------------------------------------------------------------
75 void vvProgressDialog::SetProgress(unsigned int current,unsigned int max)
76 {
77   progressBar->setMaximum(max);
78   progressBar->setValue(current);
79 }
80 //------------------------------------------------------------------------------
81