2022-05-19 00:30:46 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui/widgets/buttons.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
|
|
|
class GradientButton final : public Ui::RippleButton {
|
|
|
|
public:
|
|
|
|
GradientButton(QWidget *widget, QGradientStops stops);
|
|
|
|
|
2022-06-12 05:23:23 +00:00
|
|
|
void startGlareAnimation();
|
2022-06-14 09:42:43 +00:00
|
|
|
void setGlarePaused(bool paused);
|
2022-06-12 05:23:23 +00:00
|
|
|
|
2022-05-19 00:30:46 +00:00
|
|
|
private:
|
|
|
|
void paintEvent(QPaintEvent *e);
|
2022-06-12 05:23:23 +00:00
|
|
|
void paintGlare(QPainter &p);
|
2022-05-19 00:30:46 +00:00
|
|
|
void validateBg();
|
2022-06-12 05:23:23 +00:00
|
|
|
void validateGlare();
|
|
|
|
|
|
|
|
struct Glare final {
|
|
|
|
crl::time birthTime = 0;
|
|
|
|
crl::time deathTime = 0;
|
|
|
|
};
|
2022-05-19 00:30:46 +00:00
|
|
|
|
|
|
|
QGradientStops _stops;
|
|
|
|
QImage _bg;
|
|
|
|
|
2022-06-12 05:23:23 +00:00
|
|
|
struct {
|
|
|
|
Ui::Animations::Basic animation;
|
|
|
|
Glare glare;
|
|
|
|
QPixmap pixmap;
|
2022-06-14 09:42:43 +00:00
|
|
|
int width = 0;
|
|
|
|
bool paused = false;
|
2022-06-12 05:23:23 +00:00
|
|
|
} _glare;
|
|
|
|
|
2022-05-19 00:30:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Ui
|