2016-09-15 16:32:49 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-09-15 16:32:49 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-09-15 16:32:49 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-11-11 13:46:04 +00:00
|
|
|
#include "ui/abstract_button.h"
|
2016-10-08 18:28:43 +00:00
|
|
|
#include "styles/style_media_player.h"
|
2016-09-16 12:49:36 +00:00
|
|
|
|
2016-09-15 16:32:49 +00:00
|
|
|
namespace Media {
|
|
|
|
namespace Player {
|
|
|
|
|
2016-10-08 18:28:43 +00:00
|
|
|
class PlayButtonLayout {
|
2016-09-16 12:49:36 +00:00
|
|
|
public:
|
2016-10-08 18:28:43 +00:00
|
|
|
enum class State {
|
|
|
|
Play,
|
|
|
|
Pause,
|
|
|
|
Cancel,
|
|
|
|
};
|
2018-06-04 15:35:11 +00:00
|
|
|
PlayButtonLayout(const style::MediaPlayerButton &st, Fn<void()> callback);
|
2016-09-16 12:49:36 +00:00
|
|
|
|
2016-10-08 18:28:43 +00:00
|
|
|
void setState(State state);
|
2016-10-09 17:08:16 +00:00
|
|
|
void finishTransform();
|
2016-10-08 18:28:43 +00:00
|
|
|
void paint(Painter &p, const QBrush &brush);
|
2016-09-16 12:49:36 +00:00
|
|
|
|
2016-10-08 18:28:43 +00:00
|
|
|
private:
|
|
|
|
void animationCallback();
|
|
|
|
void startTransform(float64 from, float64 to);
|
2016-09-16 12:49:36 +00:00
|
|
|
|
2016-10-08 18:28:43 +00:00
|
|
|
void paintPlay(Painter &p, const QBrush &brush);
|
|
|
|
void paintPlayToPause(Painter &p, const QBrush &brush, float64 progress);
|
|
|
|
void paintPlayToCancel(Painter &p, const QBrush &brush, float64 progress);
|
|
|
|
void paintPauseToCancel(Painter &p, const QBrush &brush, float64 progress);
|
2016-09-16 12:49:36 +00:00
|
|
|
|
2016-10-08 18:28:43 +00:00
|
|
|
const style::MediaPlayerButton &_st;
|
2016-09-16 12:49:36 +00:00
|
|
|
|
2016-10-09 17:08:16 +00:00
|
|
|
State _state = State::Play;
|
|
|
|
State _oldState = State::Play;
|
|
|
|
State _nextState = State::Play;
|
2016-12-07 13:32:25 +00:00
|
|
|
Animation _transformProgress;
|
2016-10-08 18:28:43 +00:00
|
|
|
bool _transformBackward = false;
|
2016-09-23 16:04:26 +00:00
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void()> _callback;
|
2016-09-16 12:49:36 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-09-15 16:32:49 +00:00
|
|
|
} // namespace Clip
|
|
|
|
} // namespace Media
|