28 #define YUILogComponent "qt-ui"
29 #include <yui/YUILog.h>
33 #include "YQDownloadProgress.h"
34 #include "YQWidgetCaption.h"
35 #include <QVBoxLayout>
36 #include <QProgressBar>
39 const std::string & label,
40 const std::string & filename,
41 YFileSize_t expectedSize )
42 : QFrame( (QWidget *) parent->widgetRep() )
43 , YDownloadProgress( parent, label, filename, expectedSize )
45 QVBoxLayout* layout =
new QVBoxLayout(
this );
49 layout->setMargin( YQWidgetMargin );
52 YUI_CHECK_NEW( _caption );
53 layout->addWidget( _caption );
55 _qt_progressBar =
new QProgressBar(
this );
56 YUI_CHECK_NEW( _qt_progressBar );
57 layout->addWidget( _qt_progressBar );
59 _qt_progressBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
60 _qt_progressBar->setRange( 0, 100 );
61 _qt_progressBar->setValue( currentPercent() );
63 _timer =
new QTimer(
this );
65 connect( _timer, &pclass(_timer)::timeout,
68 _timer->setSingleShot(
false);
83 YDownloadProgress::setLabel( label );
90 YDownloadProgress::setFilename( filename );
91 _qt_progressBar->setValue( currentPercent() );
98 _qt_progressBar->setValue( currentPercent() );
99 YDownloadProgress::setExpectedSize( expectedSize );
106 _qt_progressBar->setValue( currentPercent() );
113 _caption->setEnabled( enabled );
114 _qt_progressBar->setEnabled( enabled );
115 YWidget::setEnabled( enabled );
122 return sizeHint().width();
129 return sizeHint().height();
136 resize( newWidth, newHeight );
140 #include "YQDownloadProgress.moc"