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
|
|
|
|
|
2017-12-08 18:27:28 +00:00
|
|
|
#include "ui/rp_widget.h"
|
|
|
|
|
2016-09-23 16:04:26 +00:00
|
|
|
class AudioMsgId;
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2016-09-17 19:28:33 +00:00
|
|
|
namespace Ui {
|
2016-11-16 10:44:06 +00:00
|
|
|
class FlatLabel;
|
2016-09-17 19:28:33 +00:00
|
|
|
class LabelSimple;
|
|
|
|
class IconButton;
|
2017-05-18 16:10:39 +00:00
|
|
|
class MediaSlider;
|
2016-09-17 19:28:33 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-09-15 16:32:49 +00:00
|
|
|
namespace Media {
|
2016-09-23 16:04:26 +00:00
|
|
|
namespace Clip {
|
|
|
|
class Playback;
|
|
|
|
} // namespace Clip
|
|
|
|
|
2016-09-15 16:32:49 +00:00
|
|
|
namespace Player {
|
|
|
|
|
2016-09-17 19:28:33 +00:00
|
|
|
class VolumeController;
|
2017-01-24 21:24:39 +00:00
|
|
|
struct TrackState;
|
2016-09-17 19:28:33 +00:00
|
|
|
|
2017-12-08 18:27:28 +00:00
|
|
|
class CoverWidget : public Ui::RpWidget, private base::Subscriber {
|
2016-09-17 19:28:33 +00:00
|
|
|
public:
|
|
|
|
CoverWidget(QWidget *parent);
|
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
using ButtonCallback = Fn<void()>;
|
2016-10-18 15:19:13 +00:00
|
|
|
void setPinCallback(ButtonCallback &&callback);
|
|
|
|
void setCloseCallback(ButtonCallback &&callback);
|
2016-10-12 19:34:25 +00:00
|
|
|
|
2016-09-17 19:28:33 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2016-10-18 15:19:13 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
2017-02-11 11:24:37 +00:00
|
|
|
void leaveEventHook(QEvent *e) override;
|
2016-09-17 19:28:33 +00:00
|
|
|
|
|
|
|
private:
|
2016-10-18 15:19:13 +00:00
|
|
|
void setCloseVisible(bool visible);
|
2016-09-23 16:04:26 +00:00
|
|
|
void handleSeekProgress(float64 progress);
|
|
|
|
void handleSeekFinished(float64 progress);
|
|
|
|
|
2016-09-17 19:28:33 +00:00
|
|
|
void updatePlayPrevNextPositions();
|
2016-09-23 16:04:26 +00:00
|
|
|
void updateLabelPositions();
|
|
|
|
void updateRepeatTrackIcon();
|
|
|
|
void createPrevNextButtons();
|
|
|
|
void destroyPrevNextButtons();
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
void updateVolumeToggleIcon();
|
|
|
|
|
2017-01-24 21:24:39 +00:00
|
|
|
void handleSongUpdate(const TrackState &state);
|
2016-09-23 16:04:26 +00:00
|
|
|
void handleSongChange();
|
|
|
|
void handlePlaylistUpdate();
|
|
|
|
|
2017-01-24 21:24:39 +00:00
|
|
|
void updateTimeText(const TrackState &state);
|
2016-09-23 16:04:26 +00:00
|
|
|
void updateTimeLabel();
|
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _seekPositionMs = -1;
|
|
|
|
crl::time _lastDurationMs = 0;
|
2016-09-23 16:04:26 +00:00
|
|
|
QString _time;
|
2016-09-17 19:28:33 +00:00
|
|
|
|
2016-10-08 18:28:43 +00:00
|
|
|
class PlayButton;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _nameLabel;
|
|
|
|
object_ptr<Ui::LabelSimple> _timeLabel;
|
|
|
|
object_ptr<Ui::IconButton> _close;
|
2017-05-18 16:10:39 +00:00
|
|
|
object_ptr<Ui::MediaSlider> _playbackSlider;
|
2017-02-21 13:45:56 +00:00
|
|
|
std::unique_ptr<Clip::Playback> _playback;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> _previousTrack = { nullptr };
|
|
|
|
object_ptr<PlayButton> _playPause;
|
|
|
|
object_ptr<Ui::IconButton> _nextTrack = { nullptr };
|
|
|
|
object_ptr<Ui::IconButton> _volumeToggle;
|
|
|
|
object_ptr<VolumeController> _volumeController;
|
|
|
|
object_ptr<Ui::IconButton> _pinPlayer;
|
|
|
|
object_ptr<Ui::IconButton> _repeatTrack;
|
2016-09-17 19:28:33 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-09-15 16:32:49 +00:00
|
|
|
} // namespace Clip
|
|
|
|
} // namespace Media
|