2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2017-09-10 12:58:00 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QColor>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2020-01-31 08:12:02 +03:00
|
|
|
class QPainter;
|
|
|
|
class QTimer;
|
|
|
|
class QPaintEvent;
|
2017-09-10 12:58:00 +03:00
|
|
|
class LoadingIndicator : public QWidget
|
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QColor color READ color WRITE setColor)
|
2017-09-10 12:58:00 +03:00
|
|
|
|
|
|
|
public:
|
2021-09-18 01:22:33 +03:00
|
|
|
LoadingIndicator(QWidget *parent = nullptr);
|
2017-09-10 12:58:00 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2017-09-10 12:58:00 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
void start();
|
|
|
|
void stop();
|
2017-09-10 12:58:00 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
QColor color() { return color_; }
|
|
|
|
void setColor(QColor color) { color_ = color; }
|
2017-10-23 00:19:35 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
int interval() { return interval_; }
|
|
|
|
void setInterval(int interval) { interval_ = interval; }
|
2017-09-10 12:58:00 +03:00
|
|
|
|
|
|
|
private slots:
|
2021-09-18 01:22:33 +03:00
|
|
|
void onTimeout();
|
2017-09-10 12:58:00 +03:00
|
|
|
|
|
|
|
private:
|
2021-09-18 01:22:33 +03:00
|
|
|
int interval_;
|
|
|
|
int angle_;
|
2017-09-10 12:58:00 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
QColor color_;
|
|
|
|
QTimer *timer_;
|
2017-09-10 12:58:00 +03:00
|
|
|
};
|