1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
20 #include "vvProgressDialog.h"
22 //------------------------------------------------------------------------------
23 vvProgressDialog::vvProgressDialog(std::string message, bool show_progress)
26 connect(mCancelButton, SIGNAL(rejected()), this, SLOT(reject()));
27 SetCancelButtonEnabled(false);
28 textLabel->setText(message.c_str());
35 //------------------------------------------------------------------------------
38 //------------------------------------------------------------------------------
39 void vvProgressDialog::SetCancelButtonEnabled(bool 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);
52 mCancelButton->hide();
53 // setFixedHeight(80); // fixe the size when no cancel button
56 //------------------------------------------------------------------------------
58 //------------------------------------------------------------------------------
59 void vvProgressDialog::SetText(std::string message)
61 textLabel->setText(message.c_str());
63 //------------------------------------------------------------------------------
66 //------------------------------------------------------------------------------
67 void vvProgressDialog::AddToText(std::string message)
69 textLabel->setText(QString("%1\n%2").arg(textLabel->text()).arg(message.c_str()));
71 //------------------------------------------------------------------------------
74 //------------------------------------------------------------------------------
75 void vvProgressDialog::SetProgress(unsigned int current,unsigned int max)
77 progressBar->setMaximum(max);
78 progressBar->setValue(current);
80 //------------------------------------------------------------------------------