summary refs log tree commit diff
path: root/include/ui/LoadingIndicator.h
blob: 2641955a998c9a4be1b1baaf83c96536dc49659b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include <QColor>
#include <QPaintEvent>
#include <QPainter>
#include <QTimer>
#include <QWidget>

class LoadingIndicator : public QWidget
{
        Q_OBJECT

public:
        LoadingIndicator(QWidget *parent = 0);
        virtual ~LoadingIndicator();

        void paintEvent(QPaintEvent *e);

        void start();
        void stop();

        QColor color()
        {
                return color_;
        }
        void setColor(QColor color)
        {
                color_ = color;
        }

        int interval()
        {
                return interval_;
        }
        void setInterval(int interval)
        {
                interval_ = interval;
        }

private slots:
        void onTimeout();

private:
        int interval_;
        int angle_;

        QColor color_;
        QTimer *timer_;
};