ProgressBar connections modified + Progress Bar class itself updated
[qtmeetings] / src / UserInterface / Utils / ProgressBar.cpp
1 #include "ProgressBar.h"
2 #include "ObservedWidget.h"
3
4 #include <QProgressBar>
5 #include <QVBoxLayout>
6 #include <QHBoxLayout>
7 #include <QPushButton>
8 #include <QLabel>
9 #include <QtDebug>
10
11 ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aParent ) :
12         QDialog( aParent )
13 {
14         qDebug() << "ProgressBar::ProgressBar( const QString &, bool, QWidget *)";
15         setWindowTitle( aText );
16         setModal( true );
17
18         iProgress = new QProgressBar();
19         iProgress->setMinimumWidth( 200 );
20         iProgress->setMaximum( 0 );
21         iProgress->setTextVisible( false );
22         
23         QVBoxLayout *mainLayout = new QVBoxLayout;
24         iLabel = new QLabel();
25         mainLayout->addWidget( iLabel );
26         QHBoxLayout *subLayout = new QHBoxLayout;
27         subLayout->addWidget( iProgress );
28         if( aCancellable ) {
29                 QPushButton *buttonCancel = new QPushButton( tr( "Cancel" ) );
30                 subLayout->addSpacing( 5 );
31                 subLayout->addWidget( buttonCancel );
32                 connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
33         }
34         
35         setLayout( mainLayout );
36 }
37
38 ProgressBar::~ProgressBar()
39 {
40         qDebug() << "ProgressBar::~ProgressBar()";
41 }
42
43 void ProgressBar::update( const QString &aMessage )
44 {
45         qDebug() << "ProgressBar::update( const QString & )";
46         iLabel->setText( aMessage );
47 }