init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
77
Telegram/SourceFiles/ui/controls/download_bar.h
Normal file
77
Telegram/SourceFiles/ui/controls/download_bar.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
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 {
|
||||
TextWithEntities singleName;
|
||||
QImage singleThumbnail;
|
||||
int count = 0;
|
||||
int done = 0;
|
||||
};
|
||||
|
||||
class DownloadBar final {
|
||||
public:
|
||||
DownloadBar(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<DownloadBarProgress> progress);
|
||||
~DownloadBar();
|
||||
|
||||
void show(DownloadBarContent &&content);
|
||||
|
||||
[[nodiscard]] bool isHidden() const;
|
||||
[[nodiscard]] int height() const;
|
||||
[[nodiscard]] rpl::producer<int> heightValue() const;
|
||||
[[nodiscard]] rpl::producer<bool> 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 refreshIcon();
|
||||
void refreshThumbnail();
|
||||
void refreshInfo(const DownloadBarProgress &progress);
|
||||
void radialAnimationCallback(crl::time now);
|
||||
[[nodiscard]] float64 computeProgress() const;
|
||||
|
||||
SlideWrap<RippleButton> _button;
|
||||
PlainShadow _shadow;
|
||||
DownloadBarContent _content;
|
||||
rpl::variable<DownloadBarProgress> _progress;
|
||||
Ui::Animations::Simple _finishedAnimation;
|
||||
bool _finished = false;
|
||||
QImage _documentIconLarge;
|
||||
QImage _documentIcon;
|
||||
QImage _documentIconDone;
|
||||
qint64 _thumbnailCacheKey = 0;
|
||||
QImage _thumbnailLarge;
|
||||
QImage _thumbnail;
|
||||
QImage _thumbnailDone;
|
||||
Text::String _title;
|
||||
Text::String _info;
|
||||
RadialAnimation _radial;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user