20 #include "progressindicatorwidget.h"
26 IndicatorProgress::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()));
37 IndicatorProgress::~IndicatorProgress()
41 void IndicatorProgress::slotTimerDone()
43 mIndicator->setPixmap(mProgressPix.frameAt(mProgressCount));
45 if (mProgressCount == 8)
48 mProgressTimer->start(300);
51 void IndicatorProgress::startAnimation()
54 mProgressTimer->start(300);
58 void IndicatorProgress::stopAnimation()
61 if (mProgressTimer->isActive())
62 mProgressTimer->stop();
66 bool IndicatorProgress::isActive()
const
71 class ProgressIndicatorWidgetPrivate
74 ProgressIndicatorWidgetPrivate(ProgressIndicatorWidget *qq)
77 indicator =
new IndicatorProgress(q);
80 ~ProgressIndicatorWidgetPrivate()
85 IndicatorProgress *indicator;
86 ProgressIndicatorWidget *q;
89 ProgressIndicatorWidget::ProgressIndicatorWidget(
QWidget *parent)
91 d(new ProgressIndicatorWidgetPrivate(this))
93 setSizePolicy(
QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
96 ProgressIndicatorWidget::~ProgressIndicatorWidget()
101 void ProgressIndicatorWidget::start()
103 d->indicator->startAnimation();
106 void ProgressIndicatorWidget::stop()
108 d->indicator->stopAnimation();
111 bool ProgressIndicatorWidget::isActive()
const
113 return d->indicator->isActive();
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)