28 #define YUILogComponent "qt-ui"
29 #include <yui/YUILog.h>
33 #include "YQDownloadProgress.h"
34 #include "YQWidgetCaption.h"
35 #include <QVBoxLayout>
36 #include <QProgressBar>
43 const string & filename,
44 YFileSize_t expectedSize )
45 : QFrame( (QWidget *) parent->widgetRep() )
46 , YDownloadProgress( parent, label, filename, expectedSize )
48 QVBoxLayout* layout =
new QVBoxLayout(
this );
52 layout->setMargin( YQWidgetMargin );
55 YUI_CHECK_NEW( _caption );
56 layout->addWidget( _caption );
58 _qt_progressBar =
new QProgressBar(
this );
59 YUI_CHECK_NEW( _qt_progressBar );
60 layout->addWidget( _qt_progressBar );
62 _qt_progressBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
63 _qt_progressBar->setRange( 0, 100 );
64 _qt_progressBar->setValue( currentPercent() );
66 _timer =
new QTimer(
this );
68 connect( _timer, &pclass(_timer)::timeout,
71 _timer->setSingleShot(
false);
86 YDownloadProgress::setLabel( label );
93 YDownloadProgress::setFilename( filename );
94 _qt_progressBar->setValue( currentPercent() );
101 _qt_progressBar->setValue( currentPercent() );
102 YDownloadProgress::setExpectedSize( expectedSize );
109 _qt_progressBar->setValue( currentPercent() );
116 _caption->setEnabled( enabled );
117 _qt_progressBar->setEnabled( enabled );
118 YWidget::setEnabled( enabled );
125 return sizeHint().width();
132 return sizeHint().height();
139 resize( newWidth, newHeight );