#ifndef busy_icon_H
#define busy_icon_H

#include "qad_widgets_export.h"

#include <QDebug>
#include <QIcon>
#include <QWidget>

QT_BEGIN_NAMESPACE

class QAD_WIDGETS_EXPORT BusyIcon: public QWidget {
	Q_OBJECT
	Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
	Q_PROPERTY(qreal iconSize READ iconSize WRITE setIconSize)
	Q_PROPERTY(qreal iconScale READ iconScale WRITE setIconScale)
	Q_PROPERTY(qreal circleWidth READ circleWidth WRITE setCircleWidth)

public:
	explicit BusyIcon(QWidget * parent = 0);
	~BusyIcon();

	QIcon icon();
	void setIcon(QIcon i);

	qreal iconSize() { return icon_size; }
	void setIconSize(qreal s);

	qreal iconScale() { return icon_scale; }
	void setIconScale(qreal s);

	qreal circleWidth() { return circle_width; }
	void setCircleWidth(qreal s);

private:
	QSize sizeHint() const override;
	void timerEvent(QTimerEvent *) override;
	void paintEvent(QPaintEvent *) override;

	QIcon icon_;
	QImage image;
	qreal icon_size = 5.f, icon_scale = 75.f, circle_width = 20.f;
	int timer = 0, ang = 0;

private slots:

public slots:
	void start();
	void stop();

signals:
};

QT_END_NAMESPACE

#endif
