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
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
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
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
95
Telegram/SourceFiles/ui/widgets/participants_check_view.cpp
Normal file
95
Telegram/SourceFiles/ui/widgets/participants_check_view.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
#include "ui/widgets/participants_check_view.h"
|
||||
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/effects/toggle_arrow.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/rect.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
ParticipantsCheckView::ParticipantsCheckView(
|
||||
int count,
|
||||
int duration,
|
||||
bool checked,
|
||||
Fn<void()> updateCallback)
|
||||
: Ui::AbstractCheckView(duration, checked, std::move(updateCallback))
|
||||
, _text(QString::number(std::abs(count)))
|
||||
, _count(count) {
|
||||
}
|
||||
|
||||
QSize ParticipantsCheckView::ComputeSize(int count) {
|
||||
return QSize(
|
||||
st::moderateBoxExpandHeight
|
||||
+ st::moderateBoxExpand.width()
|
||||
+ st::moderateBoxExpandInnerSkip * 4
|
||||
+ st::moderateBoxExpandFont->width(
|
||||
QString::number(std::abs(count)))
|
||||
+ st::moderateBoxExpandToggleSize,
|
||||
st::moderateBoxExpandHeight);
|
||||
}
|
||||
|
||||
QSize ParticipantsCheckView::getSize() const {
|
||||
return ComputeSize(_count);
|
||||
}
|
||||
|
||||
void ParticipantsCheckView::paint(
|
||||
QPainter &p,
|
||||
int left,
|
||||
int top,
|
||||
int outerWidth) {
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto size = getSize();
|
||||
const auto radius = size.height() / 2;
|
||||
p.setPen(Qt::NoPen);
|
||||
st::moderateBoxExpand.paint(
|
||||
p,
|
||||
radius,
|
||||
left + (size.height() - st::moderateBoxExpand.height()) / 2,
|
||||
top + size.width());
|
||||
|
||||
const auto innerSkip = st::moderateBoxExpandInnerSkip;
|
||||
|
||||
p.setBrush(Qt::NoBrush);
|
||||
p.setPen(st::boxTextFg);
|
||||
p.setFont(st::moderateBoxExpandFont);
|
||||
p.drawText(
|
||||
QRect(
|
||||
left + innerSkip + radius + st::moderateBoxExpand.width(),
|
||||
top,
|
||||
size.width(),
|
||||
size.height()),
|
||||
_text,
|
||||
style::al_left);
|
||||
|
||||
const auto path = Ui::ToggleUpDownArrowPath(
|
||||
left + size.width() - st::moderateBoxExpandToggleSize - radius,
|
||||
top + size.height() / 2,
|
||||
st::moderateBoxExpandToggleSize,
|
||||
st::moderateBoxExpandToggleFourStrokes,
|
||||
Ui::AbstractCheckView::currentAnimationValue());
|
||||
p.fillPath(path, st::boxTextFg);
|
||||
}
|
||||
|
||||
QImage ParticipantsCheckView::prepareRippleMask() const {
|
||||
const auto size = getSize();
|
||||
return Ui::RippleAnimation::RoundRectMask(size, size.height() / 2);
|
||||
}
|
||||
|
||||
bool ParticipantsCheckView::checkRippleStartPosition(QPoint position) const {
|
||||
return Rect(getSize()).contains(position);
|
||||
}
|
||||
|
||||
void ParticipantsCheckView::checkedChangedHook(anim::type animated) {
|
||||
}
|
||||
|
||||
ParticipantsCheckView::~ParticipantsCheckView() = default;
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user