mirror of
https://github.com/vale981/tdesktop
synced 2025-03-08 19:21:39 -05:00

base::lambda -> Fn (type alias for std::function). base::lambda_once -> FnMut (type alias for base::unique_function). base::lambda_guarded -> crl::guard. base::lambda_call_type_t -> crl::deduced_call_type.
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
/*
|
|
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/abstract_button.h"
|
|
#include "styles/style_media_player.h"
|
|
|
|
namespace Media {
|
|
namespace Player {
|
|
|
|
class PlayButtonLayout {
|
|
public:
|
|
enum class State {
|
|
Play,
|
|
Pause,
|
|
Cancel,
|
|
};
|
|
PlayButtonLayout(const style::MediaPlayerButton &st, Fn<void()> callback);
|
|
|
|
void setState(State state);
|
|
void finishTransform();
|
|
void paint(Painter &p, const QBrush &brush);
|
|
|
|
private:
|
|
void animationCallback();
|
|
void startTransform(float64 from, float64 to);
|
|
|
|
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);
|
|
|
|
const style::MediaPlayerButton &_st;
|
|
|
|
State _state = State::Play;
|
|
State _oldState = State::Play;
|
|
State _nextState = State::Play;
|
|
Animation _transformProgress;
|
|
bool _transformBackward = false;
|
|
|
|
Fn<void()> _callback;
|
|
|
|
};
|
|
|
|
} // namespace Clip
|
|
} // namespace Media
|