media_player_volume_controller.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "ui/rp_widget.h"
  9. #include "base/object_ptr.h"
  10. class QWheelEvent;
  11. namespace Ui {
  12. class MediaSlider;
  13. } // namespace Ui
  14. namespace Window {
  15. class SessionController;
  16. } // namespace Window
  17. namespace Media::Player {
  18. class Dropdown;
  19. class VolumeController final : public Ui::RpWidget {
  20. public:
  21. VolumeController(
  22. QWidget *parent,
  23. not_null<Window::SessionController*> controller);
  24. void setIsVertical(bool vertical);
  25. void outerWheelEvent(not_null<QWheelEvent*> e);
  26. protected:
  27. void resizeEvent(QResizeEvent *e) override;
  28. private:
  29. void setVolume(float64 volume);
  30. void applyVolumeChange(float64 volume);
  31. object_ptr<Ui::MediaSlider> _slider;
  32. };
  33. void PrepareVolumeDropdown(
  34. not_null<Dropdown*> dropdown,
  35. not_null<Window::SessionController*> controller,
  36. rpl::producer<not_null<QWheelEvent*>> outerWheelEvents);
  37. } // namespace Media::Player