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
|
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2019-04-05 10:13:54 +00:00
|
|
|
#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
|
|
|
|
2019-09-13 06:06:02 +00:00
|
|
|
#include <QtCore/QTimer>
|
|
|
|
|
2016-09-23 16:04:26 +00:00
|
|
|
namespace Ui {
|
|
|
|
class IconButton;
|
|
|
|
class MediaSlider;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2020-06-08 15:17:33 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-09-15 16:32:49 +00:00
|
|
|
namespace Media {
|
|
|
|
namespace Player {
|
|
|
|
|
2021-07-15 11:12:38 +00:00
|
|
|
class VolumeController final : public Ui::RpWidget {
|
2016-09-17 19:28:33 +00:00
|
|
|
public:
|
2020-06-08 15:17:33 +00:00
|
|
|
VolumeController(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::SessionController*> controller);
|
2016-09-17 19:28:33 +00:00
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
void setIsVertical(bool vertical);
|
|
|
|
|
2016-09-17 19:28:33 +00:00
|
|
|
protected:
|
2016-09-23 16:04:26 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2016-09-17 19:28:33 +00:00
|
|
|
|
|
|
|
private:
|
2017-05-18 16:10:39 +00:00
|
|
|
void setVolume(float64 volume);
|
2016-09-23 16:04:26 +00:00
|
|
|
void applyVolumeChange(float64 volume);
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::MediaSlider> _slider;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-04-05 10:13:54 +00:00
|
|
|
class VolumeWidget : public Ui::RpWidget {
|
2016-10-12 19:34:25 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-06-08 15:17:33 +00:00
|
|
|
VolumeWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::SessionController*> controller);
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
bool overlaps(const QRect &globalRect);
|
|
|
|
|
|
|
|
QMargins getMargin() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2017-02-11 11:24:37 +00:00
|
|
|
void enterEventHook(QEvent *e) override;
|
|
|
|
void leaveEventHook(QEvent *e) override;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
bool eventFilter(QObject *obj, QEvent *e) override;
|
|
|
|
|
2021-03-03 18:22:42 +00:00
|
|
|
private Q_SLOTS:
|
2016-10-12 19:34:25 +00:00
|
|
|
void onShowStart();
|
|
|
|
void onHideStart();
|
|
|
|
|
|
|
|
private:
|
2016-10-26 16:43:13 +00:00
|
|
|
void otherEnter();
|
|
|
|
void otherLeave();
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
void appearanceCallback();
|
|
|
|
void hidingFinished();
|
|
|
|
void startAnimation();
|
|
|
|
|
|
|
|
bool _hiding = false;
|
|
|
|
|
|
|
|
QPixmap _cache;
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _a_appearance;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
QTimer _hideTimer, _showTimer;
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
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
|