Task #1170 Progress bar for meeting details pop-up
[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->setRange( 0, 0 );
21         iProgress->reset();
22         iProgress->setTextVisible( false );
23         
24         QVBoxLayout *mainLayout = new QVBoxLayout;
25         iLabel = new QLabel();
26         mainLayout->addWidget( iLabel );
27         QHBoxLayout *subLayout = new QHBoxLayout;
28         subLayout->addWidget( iProgress );
29         if( aCancellable ) {
30                 QPushButton *buttonCancel = new QPushButton( tr( "Cancel" ) );
31                 subLayout->addSpacing( 5 );
32                 subLayout->addWidget( buttonCancel );
33                 connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
34         }
35         mainLayout->addLayout( subLayout );
36         setLayout( mainLayout );
37 }
38
39 ProgressBar::~ProgressBar()
40 {
41         qDebug() << "ProgressBar::~ProgressBar()";
42 }
43
44 void ProgressBar::update( const QString &aMessage )
45 {
46         qDebug() << "ProgressBar::update( const QString & )";
47         iLabel->setText( aMessage );
48 }