1/*
2 Copyright (c) 2013 Montel Laurent <montel@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef PROGRESSINDICATORWIDGET_H
21#define PROGRESSINDICATORWIDGET_H
22
23#include "kpimutils_export.h"
24
25#include <KPixmapSequence>
26
27#include <QLabel>
28
29class QTimer;
30namespace KPIMUtils {
31class ProgressIndicatorWidgetPrivate;
32class ProgressIndicatorWidget;
33class IndicatorProgress : public QObject
34{
35 Q_OBJECT
36public:
37 explicit IndicatorProgress(ProgressIndicatorWidget *widget, QObject *parent = 0);
38 ~IndicatorProgress();
39
40 bool isActive() const;
41
42 void startAnimation();
43 void stopAnimation();
44
45
46private Q_SLOTS:
47 void slotTimerDone();
48
49private:
50 int mProgressCount;
51 KPixmapSequence mProgressPix;
52 QTimer *mProgressTimer;
53 ProgressIndicatorWidget *mIndicator;
54 bool mIsActive;
55};
56
57class KPIMUTILS_EXPORT ProgressIndicatorWidget : public QLabel
58{
59 Q_OBJECT
60public:
61 explicit ProgressIndicatorWidget(QWidget *parent = 0);
62 ~ProgressIndicatorWidget();
63
64public:
65 /**
66 * @since 4.12
67 */
68 bool isActive() const;
69
70public Q_SLOTS:
71 void start();
72 void stop();
73
74private:
75 friend class ProgressIndicatorWidgetPrivate;
76 ProgressIndicatorWidgetPrivate * const d;
77};
78
79}
80
81#endif // PROGRESSINDICATORWIDGET_H
82