18 #include "progressindicatorwidget.h"
24 IndicatorProgress::IndicatorProgress(ProgressIndicatorWidget *widget, QObject *parent)
29 mProgressPix = KPixmapSequence(QLatin1String(
"process-working"), KIconLoader::SizeSmallMedium);
30 mProgressTimer =
new QTimer(
this);
31 connect(mProgressTimer, SIGNAL(timeout()),
this, SLOT(slotTimerDone()));
34 IndicatorProgress::~IndicatorProgress()
38 void IndicatorProgress::slotTimerDone()
40 mIndicator->setPixmap(mProgressPix.frameAt(mProgressCount));
42 if (mProgressCount == 8)
45 mProgressTimer->start(300);
48 void IndicatorProgress::startAnimation()
51 mProgressTimer->start(300);
54 void IndicatorProgress::stopAnimation()
56 if (mProgressTimer->isActive())
57 mProgressTimer->stop();
61 class ProgressIndicatorWidgetPrivate
64 ProgressIndicatorWidgetPrivate(ProgressIndicatorWidget *qq)
67 indicator =
new IndicatorProgress(q);
70 ~ProgressIndicatorWidgetPrivate()
75 IndicatorProgress *indicator;
76 ProgressIndicatorWidget *q;
79 ProgressIndicatorWidget::ProgressIndicatorWidget(QWidget *parent)
81 d(new ProgressIndicatorWidgetPrivate(this))
83 setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
86 ProgressIndicatorWidget::~ProgressIndicatorWidget()
91 void ProgressIndicatorWidget::start()
93 d->indicator->startAnimation();
96 void ProgressIndicatorWidget::stop()
98 d->indicator->stopAnimation();
103 #include "progressindicatorwidget.moc"