Operation mode changing related defects corrected.
[qtmeetings] / src / UserInterface / Utils / ProgressBar.cpp
index 6ab9fe2..dd9f94f 100755 (executable)
@@ -8,11 +8,12 @@
 #include <QLabel>
 #include <QtDebug>
 
-ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aParent ) :
+ProgressBar::ProgressBar( const QString &aTitle, bool aCancellable, QWidget *aParent ) :
        QDialog( aParent )
 {
        qDebug() << "ProgressBar::ProgressBar( const QString &, bool, QWidget *)";
-       setWindowTitle( aText );
+       setWindowTitle( aTitle );
+       
        setModal( true );
 
        iProgress = new QProgressBar();
@@ -26,12 +27,15 @@ ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aPar
        mainLayout->addWidget( iLabel );
        QHBoxLayout *subLayout = new QHBoxLayout;
        subLayout->addWidget( iProgress );
-       if( aCancellable ) {
-               QPushButton *buttonCancel = new QPushButton( tr( "Cancel" ) );
-               subLayout->addSpacing( 5 );
-               subLayout->addWidget( buttonCancel );
-               connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+       
+       iButton = new QPushButton( tr( "Cancel" ) );
+       subLayout->addSpacing( 5 );
+       subLayout->addWidget( iButton );
+       connect( iButton, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+       if( !aCancellable ) {
+               iButton->setVisible( false );
        }
+       
        mainLayout->addLayout( subLayout );
        mainLayout->setAlignment( Qt::AlignCenter );
        setLayout( mainLayout );
@@ -42,8 +46,18 @@ ProgressBar::~ProgressBar()
        qDebug() << "ProgressBar::~ProgressBar()";
 }
 
-void ProgressBar::update( const QString &aMessage )
+void ProgressBar::update( const QString &aMessage, const QString &aTitle )
 {
        qDebug() << "ProgressBar::update( const QString & )";
        iLabel->setText( aMessage );
+       if( aTitle != "" )
+               setWindowTitle( aTitle );
+}
+
+void ProgressBar::toggleCancellable( bool aEnable )
+{
+       if( aEnable )
+               iButton->setVisible( true );
+       else
+               iButton->setVisible( false );
 }