Implement animated spoilers.

This commit is contained in:
John Preston 2022-09-17 00:23:27 +04:00
parent 4975254cc1
commit 749fb52113
291 changed files with 814 additions and 556 deletions

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/empty_userpic.h"
#include "ui/painter.h"
#include "core/application.h"
#include "data/data_session.h"
#include "data/data_photo.h"

View file

@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/unread_badge.h"
#include "ui/ui_utility.h"
#include "ui/painter.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_user.h"
@ -269,7 +270,7 @@ void AddContactBox::setInnerFocus() {
void AddContactBox::paintEvent(QPaintEvent *e) {
BoxContent::paintEvent(e);
Painter p(this);
auto p = QPainter(this);
if (_retrying) {
p.setPen(st::boxTextFg);
p.setFont(st::boxTextFont);

View file

@ -111,7 +111,7 @@ private:
void requestPapers();
void sortPapers();
void paintPaper(
Painter &p,
QPainter &p,
const Paper &paper,
int column,
int row) const;
@ -289,7 +289,7 @@ void BackgroundBox::Inner::resizeToContentAndPreload() {
void BackgroundBox::Inner::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
Painter p(this);
auto p = QPainter(this);
if (_papers.empty()) {
p.setFont(st::noContactsFont);
@ -361,7 +361,7 @@ void BackgroundBox::Inner::validatePaperThumbnail(
}
void BackgroundBox::Inner::paintPaper(
Painter &p,
QPainter &p,
const Paper &paper,
int column,
int row) const {

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/image/image.h"
#include "ui/widgets/checkbox.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "history/history.h"
#include "history/history_message.h"

View file

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/basic_click_handlers.h"
#include "ui/painter.h"
#include "boxes/abstract_box.h" // Ui::show().
#include "styles/style_layers.h"
#include "styles/style_boxes.h"

View file

@ -48,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/scroll_content_shadow.h"
#include "ui/image/image.h"
#include "ui/toast/toast.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/input_fields.h"

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/widgets/shadow.h"
#include "ui/widgets/input_fields.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "base/platform/base_platform_info.h"
#include "styles/style_boxes.h"
@ -72,7 +73,7 @@ QCursor EditColorBox::Picker::generateCursor() {
cursor.setDevicePixelRatio(cRetinaFactor());
cursor.fill(Qt::transparent);
{
Painter p(&cursor);
auto p = QPainter(&cursor);
PainterHighQualityEnabler hq(p);
p.setBrush(Qt::NoBrush);
@ -102,7 +103,7 @@ EditColorBox::Picker::Picker(QWidget *parent, Mode mode, QColor color)
}
void EditColorBox::Picker::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
preparePalette();
@ -360,7 +361,7 @@ void EditColorBox::Slider::prepareMinSize() {
}
void EditColorBox::Slider::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
auto to = rect().marginsRemoved(QMargins(st::colorSliderSkip, st::colorSliderSkip, st::colorSliderSkip, st::colorSliderSkip));
Ui::Shadow::paint(p, to, width(), st::defaultRoundShadow);
if (_type == Type::Opacity) {
@ -573,7 +574,7 @@ public:
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p) override;
void paintAdditionalPlaceholder(QPainter &p) override;
void wheelEvent(QWheelEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
@ -632,7 +633,7 @@ void EditColorBox::Field::correctValue(const QString &was, int wasCursor, QStrin
}
}
void EditColorBox::Field::paintAdditionalPlaceholder(Painter &p) {
void EditColorBox::Field::paintAdditionalPlaceholder(QPainter &p) {
p.setFont(_st.font);
p.setPen(_st.placeholderFg);
auto inner = QRect(_st.textMargins.right(), _st.textMargins.top(), width() - 2 * _st.textMargins.right(), height() - _st.textMargins.top() - _st.textMargins.bottom());
@ -696,7 +697,7 @@ public:
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p) override;
void paintAdditionalPlaceholder(QPainter &p) override;
};
@ -737,7 +738,7 @@ void EditColorBox::ResultField::correctValue(const QString &was, int wasCursor,
}
}
void EditColorBox::ResultField::paintAdditionalPlaceholder(Painter &p) {
void EditColorBox::ResultField::paintAdditionalPlaceholder(QPainter &p) {
p.setFont(_st.font);
p.setPen(_st.placeholderFg);
p.drawText(QRect(_st.textMargins.right(), _st.textMargins.top(), width(), height() - _st.textMargins.top() - _st.textMargins.bottom()), "#", style::al_topleft);

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/panel_animation.h"
#include "ui/filter_icons.h"
#include "ui/filter_icon_panel.h"
#include "ui/painter.h"
#include "data/data_chat_filters.h"
#include "data/data_peer.h"
#include "data/data_peer_values.h" // Data::AmPremiumValue.

View file

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/widgets/labels.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/painter.h"
#include "main/main_app_config.h"
#include "main/main_account.h"
#include "main/main_session.h"
@ -125,7 +126,7 @@ QString TypeRow::generateShortName() {
PaintRoundImageCallback TypeRow::generatePaintUserpicCallback() {
const auto flag = this->flag();
return [=](Painter &p, int x, int y, int outerWidth, int size) {
return [=](QPainter &p, int x, int y, int outerWidth, int size) {
PaintFilterChatsTypeIcon(p, flag, x, y, outerWidth, size);
};
}
@ -241,7 +242,7 @@ auto TypeController::rowSelectionChanges() const
}
void PaintFilterChatsTypeIcon(
Painter &p,
QPainter &p,
Data::ChatFilter::Flag flag,
int x,
int y,

View file

@ -28,7 +28,7 @@ class Painter;
[[nodiscard]] QString FilterChatsTypeName(Data::ChatFilter::Flag flag);
void PaintFilterChatsTypeIcon(
Painter &p,
QPainter &p,
Data::ChatFilter::Flag flag,
int x,
int y,

View file

@ -108,7 +108,7 @@ void GiftBox(
top->paintRequest(
) | rpl::start_with_next([=](const QRect &r) {
Painter p(top);
auto p = QPainter(top);
p.fillRect(r, Qt::transparent);
stars->paint(p);

View file

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/toast/toast.h"
#include "ui/text/text_options.h"
#include "ui/painter.h"
#include "storage/localstorage.h"
#include "ui/boxes/confirm_box.h"
#include "mainwidget.h"

View file

@ -242,7 +242,7 @@ void LocalStorageBox::Row::paintEvent(QPaintEvent *e) {
if (!_progress || true) {
return;
}
Painter p(this);
auto p = QPainter(this);
const auto padding = st::localStorageRowPadding;
const auto height = st::localStorageRowHeight;
const auto bottom = height - padding.bottom() - _description->height();
@ -595,12 +595,3 @@ void LocalStorageBox::save() {
_session->data().cache().updateSettings(update);
closeBox();
}
void LocalStorageBox::paintEvent(QPaintEvent *e) {
BoxContent::paintEvent(e);
Painter p(this);
p.setFont(st::boxTextFont);
p.setPen(st::windowFg);
}

View file

@ -45,8 +45,6 @@ public:
protected:
void prepare() override;
void paintEvent(QPaintEvent *e) override;
private:
class Row;

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/generic_box.h"
#include "ui/text/text_utilities.h"
#include "ui/toast/toast.h"
#include "ui/painter.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"

View file

@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/sent_code_field.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/fade_wrap.h"
#include "ui/painter.h"
#include "passport/passport_encryption.h"
#include "passport/passport_panel_edit_contact.h"
#include "settings/settings_privacy_security.h"

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/empty_userpic.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/text/text_options.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "storage/file_download.h"
#include "data/data_peer_values.h"
@ -37,11 +38,11 @@ PaintRoundImageCallback PaintUserpicCallback(
bool respectSavedMessagesChat) {
if (respectSavedMessagesChat) {
if (peer->isSelf()) {
return [](Painter &p, int x, int y, int outerWidth, int size) {
return [](QPainter &p, int x, int y, int outerWidth, int size) {
Ui::EmptyUserpic::PaintSavedMessages(p, x, y, outerWidth, size);
};
} else if (peer->isRepliesChat()) {
return [](Painter &p, int x, int y, int outerWidth, int size) {
return [](QPainter &p, int x, int y, int outerWidth, int size) {
Ui::EmptyUserpic::PaintRepliesMessages(p, x, y, outerWidth, size);
};
}
@ -206,7 +207,7 @@ void PeerListBox::resizeEvent(QResizeEvent *e) {
}
void PeerListBox::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto &bg = (_controller->listSt()
? *_controller->listSt()

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/random.h"
#include "ui/boxes/confirm_box.h"
#include "ui/widgets/checkbox.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "main/main_session.h"
#include "data/data_session.h"

View file

@ -278,7 +278,7 @@ void PeerListsBox::resizeEvent(QResizeEvent *e) {
}
void PeerListsBox::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto &bg = (firstController()->listSt()
? *firstController()->listSt()

View file

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/text/text_options.h"
#include "ui/special_buttons.h"
#include "ui/painter.h"
#include "chat_helpers/emoji_suggestions_widget.h"
#include "settings/settings_privacy_security.h"
#include "ui/boxes/choose_date_time.h"

View file

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toasts/common_toasts.h"
#include "ui/text/text_utilities.h"
#include "ui/boxes/edit_invite_link.h"
#include "ui/painter.h"
#include "boxes/share_box.h"
#include "history/view/history_view_group_call_bar.h" // GenerateUserpics...
#include "history/history_message.h" // GetErrorTextForSending.

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/popup_menu.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "ui/boxes/confirm_box.h"
#include "boxes/peer_list_controllers.h"
@ -328,7 +329,7 @@ QString Row::generateShortName() {
PaintRoundImageCallback Row::generatePaintUserpicCallback() {
return [=](
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,

View file

@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/sender.h"
#include "ui/text/text_utilities.h"
#include "ui/toasts/common_toasts.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "window/window_session_controller.h"
#include "apiwrap.h"

View file

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/wrap.h"
#include "ui/image/image_prepare.h"
#include "ui/text/text_utilities.h"
#include "ui/painter.h"
#include "info/profile/info_profile_text.h"
#include "media/streaming/media_streaming_instance.h"
#include "media/streaming/media_streaming_player.h"

View file

@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/gradient_round_button.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/boxes/confirm_box.h"
#include "ui/painter.h"
#include "settings/settings_premium.h"
#include "lottie/lottie_single_player.h"
#include "history/view/media/history_view_sticker.h"

View file

@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/animated_icon.h"
#include "ui/painter.h"
#include "window/section_widget.h"
#include "window/window_session_controller.h"
#include "styles/style_boxes.h"

View file

@ -45,6 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_options.h"
#include "ui/toast/toast.h"
#include "ui/controls/emoji_button.h"
#include "ui/painter.h"
#include "lottie/lottie_single_player.h"
#include "data/data_document.h"
#include "data/data_user.h"

View file

@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/padding_wrap.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/layers/generic_box.h"
#include "ui/painter.h"
#include "lottie/lottie_icon.h"
#include "core/application.h"
#include "core/core_settings.h"
@ -521,7 +522,7 @@ QString Row::generateShortName() {
PaintRoundImageCallback Row::generatePaintUserpicCallback() {
return [=](
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,

View file

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/painter.h"
#include "chat_helpers/message_field.h"
#include "menu/menu_check_item.h"
#include "menu/menu_send.h"

View file

@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/custom_emoji_instance.h"
#include "ui/effects/path_shift_gradient.h"
#include "ui/emoji_config.h"
#include "ui/painter.h"
#include "ui/toast/toast.h"
#include "ui/widgets/popup_menu.h"
#include "ui/cached_round_corners.h"

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/input_fields.h"
#include "ui/image/image.h"
#include "ui/cached_round_corners.h"
#include "ui/painter.h"
#include "window/window_session_controller.h"
#include "media/clip/media_clip_reader.h"
#include "main/main_session.h"
@ -330,7 +331,7 @@ StickersBox::CounterWidget::CounterWidget(
void StickersBox::CounterWidget::setCounter(int counter) {
_text = (counter > 0) ? QString::number(counter) : QString();
auto dummy = QImage(1, 1, QImage::Format_ARGB32_Premultiplied);
Painter p(&dummy);
auto p = QPainter(&dummy);
const auto badge = Dialogs::Ui::PaintUnreadBadge(p, _text, 0, 0, _st);

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/fields/special_fields.h"
#include "ui/toast/toast.h"
#include "ui/text/text_utilities.h"
#include "ui/painter.h"
#include "main/main_session.h"
#include "data/data_session.h"
#include "data/data_user.h"

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/popup_menu.h"
#include "ui/painter.h"
#include "core/application.h"
#include "calls/calls_instance.h"
#include "history/history.h"

View file

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "ui/widgets/tooltip.h"
#include "ui/emoji_config.h"
#include "ui/painter.h"
#include "ui/rp_widget.h"
#include "styles/style_calls.h"

View file

@ -38,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/empty_userpic.h"
#include "ui/emoji_config.h"
#include "ui/painter.h"
#include "core/application.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
@ -771,7 +772,7 @@ void Panel::updateStatusGeometry() {
}
void Panel::paint(QRect clip) {
Painter p(widget());
auto p = QPainter(widget());
auto region = QRegion(clip);
if (!_incoming->widget()->isHidden()) {

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/calls_signal_bars.h"
#include "calls/calls_call.h"
#include "ui/painter.h"
#include "styles/style_calls.h"
namespace Calls {
@ -29,7 +30,7 @@ SignalBars::SignalBars(
}
void SignalBars::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);

View file

@ -204,7 +204,7 @@ public:
protected:
bool eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::Paint) {
Painter p(this);
auto p = QPainter(this);
paintRipple(
p,
_st.rippleAreaPosition.x(),
@ -545,7 +545,7 @@ void TopBar::initBlobsUnder(
return;
}
Painter p(_blobs);
auto p = QPainter(_blobs);
if (hidden > 0.) {
p.setOpacity(1. - hidden);
}
@ -751,7 +751,7 @@ void TopBar::updateControlsGeometry() {
}
void TopBar::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
auto brush = _groupCall
? _groupBrush
: (_muted ? st::callBarBgMuted : st::callBarBg);

View file

@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_photo_media.h"
#include "data/data_file_origin.h"
#include "ui/empty_userpic.h"
#include "ui/painter.h"
#include "apiwrap.h" // requestFullPeer.
#include "styles/style_calls.h"
@ -90,7 +91,7 @@ void Userpic::setMuteLayout(QPoint position, int size, int stroke) {
}
void Userpic::paint() {
Painter p(&_content);
auto p = QPainter(&_content);
p.drawPixmap(0, 0, _userPhoto);
if (_muted && _muteSize > 0) {
@ -194,7 +195,7 @@ void Userpic::createCache(Image *image) {
filled.setDevicePixelRatio(cRetinaFactor());
filled.fill(Qt::transparent);
{
Painter p(&filled);
auto p = QPainter(&filled);
Ui::EmptyUserpic(
Data::PeerUserpicColor(_peer->id),
_peer->name()

View file

@ -119,7 +119,7 @@ void VideoBubble::applySizeConstraints(QSize min, QSize max) {
}
void VideoBubble::paint() {
Painter p(&_content);
auto p = QPainter(&_content);
prepareFrame();
if (!_frame.isNull()) {

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/gl/gl_shader.h"
#include "ui/gl/gl_image.h"
#include "ui/gl/gl_primitives.h"
#include "ui/painter.h"
#include "media/view/media_view_pip.h"
#include "webrtc/webrtc_video_track.h"
#include "styles/style_calls.h"

View file

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h"
#include "ui/effects/ripple_animation.h"
#include "ui/effects/cross_line.h"
#include "ui/painter.h"
#include "core/application.h" // Core::App().domain, .activeWindow.
#include "main/main_domain.h" // Core::App().domain().activate.
#include "main/main_session.h"
@ -86,11 +87,11 @@ public:
void rowUpdateRow(not_null<Row*> row) override;
void rowScheduleRaisedHandStatusRemove(not_null<Row*> row) override;
void rowPaintIcon(
Painter &p,
QPainter &p,
QRect rect,
const IconState &state) override;
int rowPaintStatusIcon(
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,
@ -962,7 +963,7 @@ void Members::Controller::scheduleRaisedHandStatusRemove() {
}
void Members::Controller::rowPaintIcon(
Painter &p,
QPainter &p,
QRect rect,
const IconState &state) {
if (_mode == PanelMode::Wide
@ -1074,7 +1075,7 @@ void Members::Controller::rowPaintIcon(
}
int Members::Controller::rowPaintStatusIcon(
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,

View file

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/paint/blobs.h"
#include "ui/text/text_options.h"
#include "ui/effects/ripple_animation.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "webrtc/webrtc_video_track.h"
#include "styles/style_calls.h"
@ -441,7 +442,7 @@ void MembersRow::paintScaledUserpic(
}
void MembersRow::paintMuteIcon(
Painter &p,
QPainter &p,
QRect iconRect,
MembersRowStyle style) {
_delegate->rowPaintIcon(p, iconRect, computeIconState(style));

View file

@ -47,11 +47,11 @@ public:
virtual void rowScheduleRaisedHandStatusRemove(
not_null<MembersRow*> row) = 0;
virtual void rowPaintIcon(
Painter &p,
QPainter &p,
QRect rect,
const IconState &state) = 0;
virtual int rowPaintStatusIcon(
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,
@ -150,7 +150,7 @@ public:
bool selected,
MembersRowStyle style);
void paintMuteIcon(
Painter &p,
QPainter &p,
QRect iconRect,
MembersRowStyle style = MembersRowStyle::Default);
[[nodiscard]] MembersRowDelegate::IconState computeIconState(

View file

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/input_fields.h"
#include "ui/effects/ripple_animation.h"
#include "ui/layers/generic_box.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "base/unixtime.h"
#include "base/timer_rpl.h"

View file

@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/toasts/common_toasts.h"
#include "ui/image/image_prepare.h"
#include "ui/painter.h"
#include "ui/round_rect.h"
#include "ui/special_buttons.h"
#include "info/profile/info_profile_values.h" // Info::Profile::Value.
@ -2528,7 +2529,7 @@ void Panel::refreshTitleColors() {
}
void Panel::paint(QRect clip) {
Painter p(widget());
auto p = QPainter(widget());
auto region = QRegion(clip);
for (const auto &rect : region) {

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/group/calls_group_members_row.h"
#include "lang/lang_keys.h"
#include "ui/gl/gl_shader.h"
#include "ui/painter.h"
#include "data/data_peer.h"
#include "styles/style_calls.h"

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/view/media_view_pip.h"
#include "webrtc/webrtc_video_track.h"
#include "ui/image/image_prepare.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "styles/style_calls.h"
#include "styles/palette.h"

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "webrtc/webrtc_video_track.h"
#include "lang/lang_keys.h"
#include "ui/round_rect.h"
#include "ui/painter.h"
#include "ui/effects/cross_line.h"
#include "styles/style_calls.h"

View file

@ -88,7 +88,7 @@ MenuVolumeItem::MenuVolumeItem(
paintRequest(
) | rpl::start_with_next([=](const QRect &clip) {
Painter p(this);
auto p = QPainter(this);
const auto volume = _localMuted
? 0

View file

@ -107,7 +107,7 @@ void GraphicButton::setToggled(bool value) {
}
void GraphicButton::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto progress = _animation.value(_toggled ? 1. : 0.);
p.setOpacity(progress);
_roundRectSelect.paint(p, rect());

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/group/ui/calls_group_scheduled_labels.h"
#include "ui/rp_widget.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "base/unixtime.h"
#include "base/timer_rpl.h"

View file

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/image/image.h"
#include "ui/platform/ui_platform_window_title.h"
#include "ui/painter.h"
#include "base/platform/base_platform_info.h"
#include "webrtc/webrtc_video_track.h"
#include "lang/lang_keys.h"

View file

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "window/window_session_controller.h"
#include "ui/cached_round_corners.h"
#include "ui/painter.h"
#include "api/api_bot.h"
#include "styles/style_widgets.h"
#include "styles/style_chat.h"
@ -29,24 +30,24 @@ public:
int buttonRadius() const override;
void startPaint(Painter &p, const Ui::ChatStyle *st) const override;
void startPaint(QPainter &p, const Ui::ChatStyle *st) const override;
const style::TextStyle &textStyle() const override;
void repaint(not_null<const HistoryItem*> item) const override;
protected:
void paintButtonBg(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect,
float64 howMuchOver) const override;
void paintButtonIcon(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect,
int outerWidth,
HistoryMessageMarkupButton::Type type) const override;
void paintButtonLoading(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect) const override;
int minButtonWidth(HistoryMessageMarkupButton::Type type) const override;
@ -62,7 +63,7 @@ Style::Style(
: ReplyKeyboard::Style(st), _parent(parent) {
}
void Style::startPaint(Painter &p, const Ui::ChatStyle *st) const {
void Style::startPaint(QPainter &p, const Ui::ChatStyle *st) const {
p.setPen(st::botKbColor);
p.setFont(st::botKbStyle.font);
}
@ -80,7 +81,7 @@ int Style::buttonRadius() const {
}
void Style::paintButtonBg(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect,
float64 howMuchOver) const {
@ -88,7 +89,7 @@ void Style::paintButtonBg(
}
void Style::paintButtonIcon(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect,
int outerWidth,
@ -97,7 +98,7 @@ void Style::paintButtonIcon(
}
void Style::paintButtonLoading(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect) const {
// Buttons with loading progress should not appear here.

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/effects/premium_graphics.h"
#include "ui/emoji_config.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "ui/cached_round_corners.h"
#include "boxes/sticker_set_box.h"
@ -77,7 +78,7 @@ private:
void animationCallback();
void updateSize();
void drawVariant(Painter &p, int variant);
void drawVariant(QPainter &p, int variant);
void updateSelected();
void setSelected(int newSelected);
@ -152,7 +153,7 @@ void EmojiColorPicker::updateSize() {
}
void EmojiColorPicker::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
auto opacity = _a_opacity.value(_hiding ? 0. : 1.);
if (opacity < 1.) {
@ -336,7 +337,7 @@ void EmojiColorPicker::setSelected(int newSelected) {
setCursor((_selected >= 0) ? style::cur_pointer : style::cur_default);
}
void EmojiColorPicker::drawVariant(Painter &p, int variant) {
void EmojiColorPicker::drawVariant(QPainter &p, int variant) {
const auto w = QPoint(
st::emojiPanMargins.left(),
st::emojiPanMargins.top()
@ -825,7 +826,7 @@ base::unique_qptr<Ui::PopupMenu> EmojiListWidget::fillContextMenu(
}
void EmojiListWidget::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto clip = e ? e->rect() : rect();

View file

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/animations.h"
#include "ui/effects/radial_animation.h"
#include "ui/emoji_config.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "core/application.h"
#include "lang/lang_keys.h"
@ -93,8 +94,8 @@ private:
void setupLabels(const Set &set);
void setupPreview(const Set &set);
void setupAnimation();
void paintPreview(Painter &p) const;
void paintRadio(Painter &p);
void paintPreview(QPainter &p) const;
void paintRadio(QPainter &p);
void setupHandler();
void load();
void radialAnimationCallback(crl::time now);
@ -230,7 +231,7 @@ Row::Row(QWidget *widget, not_null<Main::Session*> session, const Set &set)
}
void Row::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto over = showOver();
const auto bg = over ? st::windowBgOver : st::windowBg;
@ -241,7 +242,7 @@ void Row::paintEvent(QPaintEvent *e) {
paintRadio(p);
}
void Row::paintPreview(Painter &p) const {
void Row::paintPreview(QPainter &p) const {
const auto x = st::manageEmojiPreviewPadding.left();
const auto y = st::manageEmojiPreviewPadding.top();
const auto width = st::manageEmojiPreviewWidth;
@ -256,7 +257,7 @@ void Row::paintPreview(Painter &p) const {
}
}
void Row::paintRadio(Painter &p) {
void Row::paintRadio(QPainter &p) {
if (_loading && !_loading->animating()) {
_loading = nullptr;
}

View file

@ -315,7 +315,7 @@ void SuggestionsWidget::scrollByWheelEvent(not_null<QWheelEvent*> e) {
}
void SuggestionsWidget::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
_repaintScheduled = false;
@ -363,7 +363,7 @@ void SuggestionsWidget::paintEvent(QPaintEvent *e) {
paintFadings(p);
}
void SuggestionsWidget::paintFadings(Painter &p) const {
void SuggestionsWidget::paintFadings(QPainter &p) const {
const auto scroll = scrollCurrent();
const auto o_left = std::clamp(
scroll / float64(st::emojiSuggestionsFadeAfter),

View file

@ -77,7 +77,7 @@ private:
void leaveEventHook(QEvent *e) override;
void scrollByWheelEvent(not_null<QWheelEvent*> e);
void paintFadings(Painter &p) const;
void paintFadings(QPainter &p) const;
[[nodiscard]] std::vector<Row> getRowsByQuery(const QString &text) const;
[[nodiscard]] base::flat_multi_map<int, Custom> lookupCustom(

View file

@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_options.h"
#include "ui/image/image.h"
#include "ui/effects/path_shift_gradient.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "ui/cached_round_corners.h"
#include "base/unixtime.h"

View file

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h"
#include "ui/effects/ripple_animation.h"
#include "ui/image/image.h"
#include "ui/painter.h"
#include "boxes/stickers_box.h"
#include "inline_bots/inline_bot_result.h"
#include "storage/localstorage.h"

View file

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_single_player.h"
#include "ui/widgets/input_fields.h"
#include "ui/widgets/buttons.h"
#include "ui/painter.h"
#include "ui/rect_part.h"
#include "styles/style_chat_helpers.h"

View file

@ -38,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/sticker_set_box.h"
#include "boxes/stickers_box.h"
#include "ui/boxes/confirm_box.h"
#include "ui/painter.h"
#include "window/window_session_controller.h" // GifPauseReason.
#include "main/main_session.h"
#include "main/main_session_settings.h"

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/media/history_view_media_common.h"
#include "media/clip/media_clip_reader.h"
#include "ui/effects/path_shift_gradient.h"
#include "ui/painter.h"
#include "main/main_session.h"
namespace ChatHelpers {

View file

@ -196,7 +196,7 @@ void TabbedPanel::updateContentHeight() {
}
void TabbedPanel::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
// This call can finish _a_show animation and destroy _showAnimation.
auto opacityAnimating = _a_opacity.animating();

View file

@ -163,7 +163,7 @@ void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64
_frame.fill(Qt::transparent);
}
{
Painter p(&_frame);
auto p = QPainter(&_frame);
p.setOpacity(opacity);
p.fillRect(_painterInnerLeft, _painterInnerTop, _painterInnerWidth, _painterCategoriesTop - _painterInnerTop, st::emojiPanBg);
p.fillRect(_painterInnerLeft, _painterCategoriesTop, _painterInnerWidth, _painterInnerBottom - _painterCategoriesTop, _wasSectionIcons ? st::emojiPanCategories : st::emojiPanBg);
@ -620,7 +620,7 @@ void TabbedSelector::updateRestrictedLabelGeometry() {
}
void TabbedSelector::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
auto switching = (_slideAnimation != nullptr);
if (switching) {
@ -635,7 +635,7 @@ void TabbedSelector::paintEvent(QPaintEvent *e) {
}
}
void TabbedSelector::paintSlideFrame(Painter &p) {
void TabbedSelector::paintSlideFrame(QPainter &p) {
if (_roundRadius > 0) {
paintBgRoundedPart(p);
} else if (_tabsSlider) {
@ -645,7 +645,7 @@ void TabbedSelector::paintSlideFrame(Painter &p) {
_slideAnimation->paintFrame(p, slideDt, 1.);
}
void TabbedSelector::paintBgRoundedPart(Painter &p) {
void TabbedSelector::paintBgRoundedPart(QPainter &p) {
const auto threeRadius = 3 * _roundRadius;
const auto topOrBottomPart = _dropDown
? QRect(0, height() - threeRadius, width(), threeRadius)
@ -668,7 +668,7 @@ void TabbedSelector::paintBgRoundedPart(Painter &p) {
: RectPart::FullTop));
}
void TabbedSelector::paintContent(Painter &p) {
void TabbedSelector::paintContent(QPainter &p) {
auto &footerBg = hasSectionIcons()
? st::emojiPanCategories
: st::emojiPanBg;

View file

@ -207,9 +207,9 @@ private:
bool hasMasksTab() const;
Tab createTab(SelectorTab type, int index);
void paintSlideFrame(Painter &p);
void paintBgRoundedPart(Painter &p);
void paintContent(Painter &p);
void paintSlideFrame(QPainter &p);
void paintBgRoundedPart(QPainter &p);
void paintContent(QPainter &p);
void checkRestrictedPeer();
bool isRestrictedView();

View file

@ -256,7 +256,7 @@ void Application::run() {
Ui::InitTextOptions();
Ui::StartCachedCorners();
Ui::Emoji::Init();
Ui::PrepareDefaultSpoilerMess();
Ui::PrepareTextSpoilerMask();
startEmojiImageLoader();
startSystemDarkModeViewer();
Media::Player::start(_audio.get());

View file

@ -254,6 +254,11 @@ std::unique_ptr<Ui::Text::CustomEmoji> UiIntegration::createCustomEmoji(
my->customEmojiRepaint);
}
Fn<void()> UiIntegration::createSpoilerRepaint(const std::any &context) {
const auto my = std::any_cast<MarkedTextContext>(&context);
return my ? my->customEmojiRepaint : nullptr;
}
rpl::producer<> UiIntegration::forcePopupMenuHideRequests() {
return Core::App().passcodeLockChanges() | rpl::to_empty;
}

View file

@ -59,6 +59,7 @@ public:
std::unique_ptr<Ui::Text::CustomEmoji> createCustomEmoji(
const QString &data,
const std::any &context) override;
Fn<void()> createSpoilerRepaint(const std::any &context) override;
QString phraseContextCopyText() override;
QString phraseContextCopyEmail() override;

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/dialogs_key.h"
#include "history/history.h"
#include "history/history_item.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "storage/storage_facade.h"
#include "core/application.h"

View file

@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/media/history_view_service_media_gift.h"
#include "dialogs/ui/dialogs_message_view.h"
#include "ui/image/image.h"
#include "ui/effects/spoiler_mess.h"
#include "ui/text/format_song_document_name.h"
#include "ui/text/format_values.h"
#include "ui/text/text_entity.h"
@ -1541,6 +1542,9 @@ MediaInvoice::MediaInvoice(
.photo = data.photo,
.isTest = data.isTest,
} {
if (_invoice.extendedPreview && !_invoice.extendedMedia) {
Ui::PrepareImageSpoiler();
}
}
std::unique_ptr<Media> MediaInvoice::clone(not_null<HistoryItem*> parent) {

View file

@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/empty_userpic.h"
#include "ui/text/text_options.h"
#include "ui/toasts/common_toasts.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "history/history.h"
#include "history/view/history_view_element.h"

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h"
#include "ui/text/text_utilities.h"
#include "ui/text/text_options.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "data/data_drafts.h"
#include "data/data_folder.h"

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/painter.h"
#include "dialogs/dialogs_entry.h"
#include "dialogs/ui/dialogs_video_userpic.h"
#include "data/data_folder.h"
@ -107,7 +108,7 @@ void BasicRow::stopLastRipple() {
}
void BasicRow::paintRipple(
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,

View file

@ -53,7 +53,7 @@ public:
void stopLastRipple();
void paintRipple(
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/fade_wrap.h"
#include "ui/effects/radial_animation.h"
#include "ui/controls/download_bar.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "lang/lang_keys.h"
#include "mainwindow.h"
@ -137,7 +138,7 @@ void Widget::BottomButton::onStateChanged(State was, StateChangeSource source) {
}
void Widget::BottomButton::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto over = isOver() && !isDisabled();

View file

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/unread_badge.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "core/ui_integration.h"
#include "lang/lang_keys.h"
@ -53,7 +54,7 @@ const auto kPsaBadgePrefix = "cloud_lng_badge_psa_";
|| history->peer->asUser()->onlineTill > 0);
}
void PaintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool active, bool selected) {
void PaintRowTopRight(QPainter &p, const QString &text, QRect &rectForName, bool active, bool selected) {
const auto width = st::dialogsDateFont->width(text);
rectForName.setWidth(rectForName.width() - width - st::dialogsDateSkip);
p.setFont(st::dialogsDateFont);
@ -61,7 +62,7 @@ void PaintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool
p.drawText(rectForName.left() + rectForName.width() + st::dialogsDateSkip, rectForName.top() + st::msgNameFont->height - st::msgDateFont->descent, text);
}
void PaintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, bool selected) {
void PaintRowDate(QPainter &p, QDateTime date, QRect &rectForName, bool active, bool selected) {
const auto now = QDateTime::currentDateTime();
const auto &lastTime = date;
const auto nowDate = now.date();
@ -83,7 +84,7 @@ void PaintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, b
}
void PaintNarrowCounter(
Painter &p,
QPainter &p,
bool displayUnreadCounter,
bool displayUnreadMark,
bool displayMentionBadge,
@ -160,7 +161,7 @@ void PaintNarrowCounter(
}
int PaintWideCounter(
Painter &p,
QPainter &p,
int texttop,
int availableWidth,
int fullWidth,
@ -263,32 +264,29 @@ void PaintListEntryText(
return;
}
row->validateListEntryCache();
const auto &palette = row->folder()
? (active
? st::dialogsTextPaletteArchiveActive
: selected
? st::dialogsTextPaletteArchiveOver
: st::dialogsTextPaletteArchive)
: (active
? st::dialogsTextPaletteActive
: selected
? st::dialogsTextPaletteOver
: st::dialogsTextPalette);
const auto &color = active
p.setFont(st::dialogsTextFont);
p.setPen(active
? st::dialogsTextFgActive
: selected
? st::dialogsTextFgOver
: st::dialogsTextFg;
p.setTextPalette(palette);
p.setFont(st::dialogsTextFont);
p.setPen(color);
row->listEntryCache().drawElided(
p,
rect.left(),
rect.top(),
rect.width(),
rect.height() / st::dialogsTextFont->height);
p.restoreTextPalette();
: st::dialogsTextFg);
row->listEntryCache().draw(p, {
.position = rect.topLeft(),
.availableWidth = rect.width(),
.palette = &(row->folder()
? (active
? st::dialogsTextPaletteArchiveActive
: selected
? st::dialogsTextPaletteArchiveOver
: st::dialogsTextPaletteArchive)
: (active
? st::dialogsTextPaletteActive
: selected
? st::dialogsTextPaletteOver
: st::dialogsTextPalette)),
.spoiler = Text::DefaultSpoilerCache(),
.elisionLines = rect.height() / st::dialogsTextFont->height,
});
}
enum class Flag {
@ -434,7 +432,12 @@ void paintRow(
DialogTextOptions());
}
p.setPen(active ? st::dialogsTextFgActive : (selected ? st::dialogsTextFgOver : st::dialogsTextFg));
history->cloudDraftTextCache.drawElided(p, nameleft, texttop, availableWidth, 1);
history->cloudDraftTextCache.draw(p, {
.position = { nameleft, texttop },
.availableWidth = availableWidth,
.spoiler = Text::DefaultSpoilerCache(),
.elisionLines = 1,
});
} else if (draft
|| (supportMode
&& entry->session().supportHelper().isOccupiedBySomeone(history))) {
@ -485,13 +488,23 @@ void paintRow(
context);
}
p.setPen(active ? st::dialogsTextFgActive : (selected ? st::dialogsTextFgOver : st::dialogsTextFg));
if (supportMode) {
p.setTextPalette(active ? st::dialogsTextPaletteTakenActive : (selected ? st::dialogsTextPaletteTakenOver : st::dialogsTextPaletteTaken));
} else {
p.setTextPalette(active ? st::dialogsTextPaletteDraftActive : (selected ? st::dialogsTextPaletteDraftOver : st::dialogsTextPaletteDraft));
}
history->cloudDraftTextCache.drawElided(p, nameleft, texttop, availableWidth, 1);
p.restoreTextPalette();
history->cloudDraftTextCache.draw(p, {
.position = { nameleft, texttop },
.availableWidth = availableWidth,
.palette = &(supportMode
? (active
? st::dialogsTextPaletteTakenActive
: selected
? st::dialogsTextPaletteTakenOver
: st::dialogsTextPaletteTaken)
: (active
? st::dialogsTextPaletteDraftActive
: selected
? st::dialogsTextPaletteDraftOver
: st::dialogsTextPaletteDraft)),
.spoiler = Text::DefaultSpoilerCache(),
.elisionLines = 1,
});
}
} else if (!item) {
auto availableWidth = namewidth;
@ -692,7 +705,7 @@ QImage colorizeCircleHalf(UnreadBadgeSizeData *data, int size, int half, int xof
return result;
}
void PaintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
void PaintUnreadBadge(QPainter &p, const QRect &rect, const UnreadBadgeStyle &st) {
Assert(rect.height() == st.size);
int index = (st.muted ? 0x03 : 0x00) + (st.active ? 0x02 : (st.selected ? 0x01 : 0x00));
@ -784,7 +797,7 @@ QSize CountUnreadBadgeSize(
}
QRect PaintUnreadBadge(
Painter &p,
QPainter &p,
const QString &unreadCount,
int x,
int y,

View file

@ -94,7 +94,7 @@ struct UnreadBadgeStyle {
const UnreadBadgeStyle &st,
int allowDigits = 0);
QRect PaintUnreadBadge(
Painter &p,
QPainter &p,
const QString &t,
int x,
int y,

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/image/image.h"
#include "ui/painter.h"
#include "core/ui_integration.h"
#include "lang/lang_keys.h"
#include "styles/style_dialogs.h"
@ -179,29 +180,26 @@ void MessageView::paint(
if (geometry.isEmpty()) {
return;
}
p.setTextPalette(active
? st::dialogsTextPaletteActive
: selected
? st::dialogsTextPaletteOver
: st::dialogsTextPalette);
p.setFont(st::dialogsTextFont);
p.setPen(active
? st::dialogsTextFgActive
: selected
? st::dialogsTextFgOver
: st::dialogsTextFg);
const auto guard = gsl::finally([&] {
p.restoreTextPalette();
});
const auto palette = &(active
? st::dialogsTextPaletteActive
: selected
? st::dialogsTextPaletteOver
: st::dialogsTextPalette);
auto rect = geometry;
if (!_senderCache.isEmpty()) {
_senderCache.drawElided(
p,
rect.left(),
rect.top(),
rect.width(),
rect.height() / st::dialogsTextFont->height);
_senderCache.draw(p, {
.position = rect.topLeft(),
.availableWidth = rect.width(),
.palette = palette,
.elisionLines = rect.height() / st::dialogsTextFont->height,
});
const auto skip = st::dialogsMiniPreviewSkip
+ st::dialogsMiniPreviewRight;
rect.setLeft(rect.x() + _senderCache.maxWidth() + skip);
@ -224,12 +222,13 @@ void MessageView::paint(
if (rect.isEmpty()) {
return;
}
_textCache.drawElided(
p,
rect.left(),
rect.top(),
rect.width(),
rect.height() / st::dialogsTextFont->height);
_textCache.draw(p, {
.position = rect.topLeft(),
.availableWidth = rect.width(),
.palette = palette,
.spoiler = Text::DefaultSpoilerCache(),
.elisionLines = rect.height() / st::dialogsTextFont->height,
});
}
HistoryView::ItemPreview PreviewWithSender(

View file

@ -55,8 +55,8 @@ private:
struct LoadingContext;
mutable const HistoryItem *_textCachedFor = nullptr;
mutable Ui::Text::String _senderCache;
mutable Ui::Text::String _textCache;
mutable Text::String _senderCache;
mutable Text::String _textCache;
mutable std::vector<ItemPreviewImage> _imagesCache;
mutable std::unique_ptr<LoadingContext> _loadingContext;

View file

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "dialogs/ui/dialogs_video_userpic.h"
#include "ui/painter.h"
#include "core/file_location.h"
#include "data/data_peer.h"
#include "data/data_photo.h"

View file

@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "editor/color_picker.h"
#include "ui/painter.h"
#include "ui/rp_widget.h"
#include "styles/style_editor.h"
#include <QtGui/QLinearGradient>
@ -114,7 +114,7 @@ ColorPicker::ColorPicker(
_colorLine->paintRequest(
) | rpl::start_with_next([=] {
Painter p(_colorLine);
auto p = QPainter(_colorLine);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
@ -126,7 +126,7 @@ ColorPicker::ColorPicker(
_canvasForCircle->paintRequest(
) | rpl::start_with_next([=] {
Painter p(_canvasForCircle);
auto p = QPainter(_canvasForCircle);
paintCircle(p);
}, _canvasForCircle->lifetime());
@ -226,7 +226,7 @@ QColor ColorPicker::positionToColor(int x) const {
return QColor();
}
void ColorPicker::paintCircle(Painter &p) {
void ColorPicker::paintCircle(QPainter &p) {
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
@ -263,7 +263,7 @@ void ColorPicker::paintCircle(Painter &p) {
p.drawEllipse(innerRect);
}
void ColorPicker::paintOutline(Painter &p, const QRectF &rect) {
void ColorPicker::paintOutline(QPainter &p, const QRectF &rect) {
const auto &s = _outlinedStop;
if (!s.stopPos) {
return;

View file

@ -34,8 +34,8 @@ public:
rpl::producer<Brush> saveBrushRequests() const;
private:
void paintCircle(Painter &p);
void paintOutline(Painter &p, const QRectF &rect);
void paintCircle(QPainter &p);
void paintOutline(QPainter &p, const QRectF &rect);
QColor positionToColor(int x) const;
int colorToPosition(const QColor &color) const;
int circleHeight(float64 progress = 0.) const;

View file

@ -66,7 +66,7 @@ Crop::Crop(
paintRequest(
) | rpl::start_with_next([=] {
Painter p(this);
auto p = QPainter(this);
p.fillPath(_painterPath, st::photoCropFadeBg);
paintPoints(p);
@ -126,7 +126,7 @@ void Crop::applyTransform(
}
}
void Crop::paintPoints(Painter &p) {
void Crop::paintPoints(QPainter &p) {
p.save();
p.setPen(Qt::NoPen);
p.setBrush(st::photoCropPointFg);

View file

@ -51,7 +51,7 @@ private:
} borders;
};
void paintPoints(Painter &p);
void paintPoints(QPainter &p);
void updateEdges();
[[nodiscard]] QPoint pointOfEdge(Qt::Edges e) const;

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "editor/photo_editor_common.h"
#include "editor/scene/scene.h"
#include "ui/painter.h"
namespace Editor {

View file

@ -84,12 +84,10 @@ PhotoEditorContent::PhotoEditorContent(
paintRequest(
) | rpl::start_with_next([=](const QRect &clip) {
Painter p(this);
auto p = QPainter(this);
p.fillRect(clip, Qt::transparent);
p.setTransform(_imageMatrix);
p.drawPixmap(_imageRect, _photo->pix(_imageRect.size()));
}, lifetime());

View file

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/image/image_prepare.h"
#include "ui/widgets/buttons.h"
#include "ui/painter.h"
#include "styles/style_editor.h"
namespace Editor {
@ -156,8 +156,7 @@ ButtonBar::ButtonBar(
paintRequest(
) | rpl::start_with_next([=] {
Painter p(this);
auto p = QPainter(this);
p.drawImage(QPoint(), _roundedBg);
}, lifetime());
}

View file

@ -169,8 +169,7 @@ LayerWidget::LayerWidget(
paintRequest(
) | rpl::start_with_next([=](const QRect &clip) {
Painter p(this);
auto p = QPainter(this);
p.fillRect(clip, st::photoEditorBg);
}, lifetime());

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "editor/scene/scene.h"
#include "lang/lang_keys.h"
#include "ui/widgets/popup_menu.h"
#include "ui/painter.h"
#include "styles/style_editor.h"
#include "styles/style_menu_icons.h"

View file

@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "ui/painter.h"
#include <QGraphicsItem>
class QGraphicsSceneMouseEvent;

View file

@ -53,7 +53,7 @@ private:
void toggleInstance(Instance &data, bool shown);
void instanceOpacityCallback(QPointer<Ui::FlatLabel> label);
void removeOldInstance(QPointer<Ui::FlatLabel> label);
void paintInstance(Painter &p, const Instance &data);
void paintInstance(QPainter &p, const Instance &data);
void updateControlsGeometry(int newWidth);
void updateInstanceGeometry(const Instance &instance, int newWidth);
@ -185,7 +185,7 @@ int ProgressWidget::Row::resizeGetHeight(int newWidth) {
}
void ProgressWidget::Row::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto thickness = st::exportProgressWidth;
const auto top = height() - thickness;
@ -197,7 +197,7 @@ void ProgressWidget::Row::paintEvent(QPaintEvent *e) {
paintInstance(p, _current);
}
void ProgressWidget::Row::paintInstance(Painter &p, const Instance &data) {
void ProgressWidget::Row::paintInstance(QPainter &p, const Instance &data) {
const auto opacity = data.opacity.value(data.hiding ? 0. : 1.);
if (!opacity) {

View file

@ -62,7 +62,7 @@ void TopBar::resizeEvent(QResizeEvent *e) {
}
void TopBar::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
auto fill = e->rect().intersected(
QRect(0, 0, width(), st::mediaPlayerHeight));
if (!fill.isEmpty()) {

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/checkbox.h"
#include "ui/effects/ripple_animation.h"
#include "ui/text/text_options.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "data/data_peer_values.h"
#include "data/data_channel.h"

View file

@ -39,6 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image.h"
#include "ui/text/text_utilities.h"
#include "ui/inactive_press.h"
#include "ui/painter.h"
#include "ui/effects/path_shift_gradient.h"
#include "core/click_handler_types.h"
#include "core/file_utilities.h"

View file

@ -259,7 +259,7 @@ void FixedBar::setAnimatingMode(bool enabled) {
void FixedBar::paintEvent(QPaintEvent *e) {
if (!_animatingMode) {
Painter p(this);
auto p = QPainter(this);
p.fillRect(e->rect(), st::topBarBg);
}
}

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/localstorage.h"
#include "lang/lang_keys.h"
#include "ui/widgets/shadow.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "ui/cached_round_corners.h"
#include "mainwindow.h"

View file

@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/generic_box.h"
#include "ui/controls/delete_message_context_action.h"
#include "ui/controls/who_reacted_context_action.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "ui/cached_round_corners.h"
#include "ui/inactive_press.h"

View file

@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/chat/chat_style.h"
#include "ui/chat/chat_theme.h"
#include "ui/painter.h"
#include "history/history.h"
#include "history/history_message.h"
#include "history/view/history_view_service_message.h"
@ -457,11 +458,18 @@ void HistoryMessageReply::paint(
p.setPen(inBubble
? stm->historyTextFg
: st->msgImgReplyBarColor());
p.setTextPalette(inBubble
? stm->replyTextPalette
: st->imgReplyTextPalette());
holder->prepareCustomEmojiPaint(p, context, replyToText);
replyToText.drawLeftElided(p, x + st::msgReplyBarSkip + previewSkip, y + st::msgReplyPadding.top() + st::msgServiceNameFont->height, w - st::msgReplyBarSkip - previewSkip, w + 2 * x);
replyToText.draw(p, {
.position = QPoint(
x + st::msgReplyBarSkip + previewSkip,
y + st::msgReplyPadding.top() + st::msgServiceNameFont->height),
.availableWidth = w - st::msgReplyBarSkip - previewSkip,
.palette = &(inBubble
? stm->replyTextPalette
: st->imgReplyTextPalette()),
.spoiler = Ui::Text::DefaultSpoilerCache(),
.elisionLines = 1,
});
p.setTextPalette(stm->textPalette);
}
} else {

View file

@ -288,7 +288,7 @@ public:
}
virtual void startPaint(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st) const = 0;
virtual const style::TextStyle &textStyle() const = 0;
@ -303,18 +303,18 @@ public:
protected:
virtual void paintButtonBg(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect,
float64 howMuchOver) const = 0;
virtual void paintButtonIcon(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect,
int outerWidth,
HistoryMessageMarkupButton::Type type) const = 0;
virtual void paintButtonLoading(
Painter &p,
QPainter &p,
const Ui::ChatStyle *st,
const QRect &rect) const = 0;
virtual int minButtonWidth(

View file

@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/chat/attach/attach_send_files_way.h"
#include "ui/chat/choose_send_as.h"
#include "ui/image/image.h"
#include "ui/painter.h"
#include "ui/special_buttons.h"
#include "ui/controls/emoji_button.h"
#include "ui/controls/send_button.h"
@ -7689,9 +7690,15 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
_replyToName.drawElided(p, replyLeft, backy + st::msgReplyPadding.top(), width() - replyLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
}
p.setPen(st::historyComposeAreaFg);
p.setTextPalette(st::historyComposeAreaPalette);
_replyEditMsgText.drawElided(p, replyLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - replyLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
p.restoreTextPalette();
_replyEditMsgText.draw(p, {
.position = QPoint(
replyLeft,
backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height),
.availableWidth = width() - replyLeft - _fieldBarCancel->width() - st::msgReplyPadding.right(),
.palette = &st::historyComposeAreaPalette,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.elisionLines = 1,
});
} else {
p.setFont(st::msgDateFont);
p.setPen(st::historyComposeAreaFgService);
@ -7720,9 +7727,15 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
p.setPen(st::historyReplyNameFg);
_toForwardFrom.drawElided(p, forwardLeft, backy + st::msgReplyPadding.top(), width() - forwardLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
p.setPen(st::historyComposeAreaFg);
p.setTextPalette(st::historyComposeAreaPalette);
_toForwardText.drawElided(p, forwardLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - forwardLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
p.restoreTextPalette();
_toForwardText.draw(p, {
.position = QPoint(
forwardLeft,
backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height),
.availableWidth = width() - forwardLeft - _fieldBarCancel->width() - st::msgReplyPadding.right(),
.palette = &st::historyComposeAreaPalette,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.elisionLines = 1,
});
}
}
if (drawWebPagePreview) {

Some files were not shown because too many files have changed in this diff Show more