tdesktop/Telegram/SourceFiles/media/player/media_player_volume_control...

84 lines
1.6 KiB
C
Raw Normal View History

2016-09-15 16:32:49 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2016-09-15 16:32:49 +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
2019-04-02 09:13:30 +00:00
#include "ui/effects/animations.h"
#include "ui/rp_widget.h"
2019-09-13 12:22:54 +00:00
#include "base/object_ptr.h"
2019-04-02 09:13:30 +00:00
#include <QtCore/QTimer>
namespace Ui {
class IconButton;
class MediaSlider;
} // namespace Ui
2016-09-15 16:32:49 +00:00
namespace Media {
namespace Player {
class VolumeController : public TWidget, private base::Subscriber {
2016-09-17 19:28:33 +00:00
public:
VolumeController(QWidget *parent);
void setIsVertical(bool vertical);
2016-09-17 19:28:33 +00:00
protected:
void resizeEvent(QResizeEvent *e) override;
2016-09-17 19:28:33 +00:00
private:
void setVolume(float64 volume);
void applyVolumeChange(float64 volume);
object_ptr<Ui::MediaSlider> _slider;
};
class VolumeWidget : public Ui::RpWidget {
Q_OBJECT
public:
VolumeWidget(QWidget *parent);
bool overlaps(const QRect &globalRect);
QMargins getMargin() const;
protected:
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void enterEventHook(QEvent *e) override;
void leaveEventHook(QEvent *e) override;
bool eventFilter(QObject *obj, QEvent *e) override;
private slots:
void onShowStart();
void onHideStart();
private:
void otherEnter();
void otherLeave();
void appearanceCallback();
void hidingFinished();
void startAnimation();
bool _hiding = false;
QPixmap _cache;
2019-04-02 09:13:30 +00:00
Ui::Animations::Simple _a_appearance;
QTimer _hideTimer, _showTimer;
object_ptr<VolumeController> _controller;
2016-09-17 19:28:33 +00:00
};
2019-02-27 11:36:19 +00:00
} // namespace Player
2016-09-15 16:32:49 +00:00
} // namespace Media