20#include "progressindicatorwidget.h"
26IndicatorProgress::IndicatorProgress(ProgressIndicatorWidget *widget, QObject *parent)
32 mProgressPix = KPixmapSequence(QLatin1String(
"process-working"), KIconLoader::SizeSmallMedium);
33 mProgressTimer =
new QTimer(
this);
34 connect(mProgressTimer, SIGNAL(timeout()),
this, SLOT(slotTimerDone()));
37IndicatorProgress::~IndicatorProgress()
41void IndicatorProgress::slotTimerDone()
43 mIndicator->setPixmap(mProgressPix.frameAt(mProgressCount));
45 if (mProgressCount == 8)
48 mProgressTimer->start(300);
51void IndicatorProgress::startAnimation()
54 mProgressTimer->start(300);
58void IndicatorProgress::stopAnimation()
61 if (mProgressTimer->isActive())
62 mProgressTimer->stop();
66bool IndicatorProgress::isActive()
const
71class ProgressIndicatorWidgetPrivate
74 ProgressIndicatorWidgetPrivate(ProgressIndicatorWidget *qq)
77 indicator =
new IndicatorProgress(q);
80 ~ProgressIndicatorWidgetPrivate()
85 IndicatorProgress *indicator;
86 ProgressIndicatorWidget *q;
89ProgressIndicatorWidget::ProgressIndicatorWidget(QWidget *parent)
91 d(new ProgressIndicatorWidgetPrivate(this))
93 setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
96ProgressIndicatorWidget::~ProgressIndicatorWidget()
101void ProgressIndicatorWidget::start()
103 d->indicator->startAnimation();
106void ProgressIndicatorWidget::stop()
108 d->indicator->stopAnimation();
111bool ProgressIndicatorWidget::isActive()
const
113 return d->indicator->isActive();