/* 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/wrap/slide_wrap.h" #include "ui/effects/radial_animation.h" #include "ui/widgets/shadow.h" #include "ui/text/text.h" namespace Ui { class RippleButton; struct DownloadBarProgress { int64 ready = 0; int64 total = 0; }; struct DownloadBarContent { QString singleName; QImage singleThumbnail; int count = 0; int done = 0; }; class DownloadBar final { public: DownloadBar( not_null parent, rpl::producer progress); ~DownloadBar(); void show(DownloadBarContent &&content); [[nodiscard]] bool isHidden() const; [[nodiscard]] int height() const; [[nodiscard]] rpl::producer heightValue() const; [[nodiscard]] rpl::producer shownValue() const; void setGeometry(int left, int top, int width, int height); [[nodiscard]] rpl::producer<> clicks() const; [[nodiscard]] rpl::lifetime &lifetime(); private: void paint(Painter &p, QRect clip); void refreshInfo(const DownloadBarProgress &progress); void radialAnimationCallback(crl::time now); [[nodiscard]] float64 computeProgress() const; SlideWrap _button; PlainShadow _shadow; DownloadBarContent _content; rpl::variable _progress; Text::String _title; Text::String _info; RadialAnimation _radial; }; } // namespace Ui