tdesktop/Telegram/SourceFiles/media/view/media_clip_playback.h
John Preston dd81f5d59f Replace base::lambda with shorter term.
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.
2018-06-04 18:38:27 +03:00

57 lines
1.3 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/widgets/continuous_sliders.h"
namespace Media {
namespace Player {
struct TrackState;
} // namespace Player
namespace Clip {
class Playback {
public:
Playback();
void setValueChangedCallback(Fn<void(float64)> callback) {
_valueChanged = std::move(callback);
}
void setInLoadingStateChangedCallback(Fn<void(bool)> callback) {
_inLoadingStateChanged = std::move(callback);
}
void setValue(float64 value, bool animated);
float64 value() const;
float64 value(TimeMs ms);
void updateState(const Player::TrackState &state);
void updateLoadingState(float64 progress);
private:
void step_value(float64 ms, bool timer);
// This can animate for a very long time (like in music playing),
// so it should be a BasicAnimation, not an Animation.
anim::value a_value;
BasicAnimation _a_value;
Fn<void(float64)> _valueChanged;
bool _inLoadingState = false;
Fn<void(bool)> _inLoadingStateChanged;
int64 _position = 0;
int64 _length = 0;
bool _playing = false;
};
} // namespace Clip
} // namespace Media