Compare commits

...

30 Commits

Author SHA1 Message Date
John Preston
8fc35e45e4 Beta version 4.2.1: Fix build with GCC. 2022-09-22 22:44:28 +04:00
John Preston
2931e754c3 Beta version 4.2.1.
- Improve scaling / cropping for photos / video files.
- Improve touch support in channel comments.
- Nice animation for spoilers.
2022-09-22 20:15:55 +04:00
John Preston
4e7a5eeffb Use Python 3.10 and GYP supporting it. 2022-09-22 15:31:46 +04:00
John Preston
6fcafeff5b Don't repeat premium stickers in fake-pack. 2022-09-22 14:58:40 +04:00
Ilya Fedin
3165ef9f0b Implement target_compile_options_if_exists, target_link_options_if_exists 2022-09-22 12:58:07 +04:00
John Preston
ec992ae552 Fix reactions menu on Retina screens. 2022-09-22 12:33:48 +04:00
John Preston
f0a36d6460 Show only first row of colored default statuses. 2022-09-22 12:27:46 +04:00
John Preston
ffb024a5f7 Move Ui::Text::String to HistoryView::Element. 2022-09-22 11:07:48 +04:00
Ilya Fedin
140dcb033b Fix snap building on snapcraft 2022-09-20 10:20:07 +04:00
Ilya Fedin
06d9d04787 Remove explicit setting of paths for cmake in snapcraft.yaml
This is reported as fixed in snapcraft, thus these paths should be set automatically
2022-09-19 19:12:16 +04:00
John Preston
a7c29991db Hide toggle silent send in channels on msg edit. 2022-09-19 18:49:46 +04:00
John Preston
e3d79d46f7 Fix new format of direct post links in channels. 2022-09-19 18:28:53 +04:00
John Preston
476a864be2 Improve cropping for videos a bit.
Partially fixes #25061 for videos as well.
2022-09-19 18:05:03 +04:00
John Preston
fc3810fd7f Improve scaling / expanding for photos.
Fixes #25061.
2022-09-19 17:44:59 +04:00
John Preston
f5bff22bb8 Improve touch support in popup menus. 2022-09-19 17:29:28 +04:00
Ilya Fedin
157b4c43ee Update lib_ui 2022-09-19 14:23:27 +04:00
Ilya Fedin
f2d2826fc7 Make InstallLauncher accessible on any platform 2022-09-19 14:23:27 +04:00
Ilya Fedin
cfa12fb0cc Move AppRuntimeDirectory to private namespace 2022-09-19 14:23:27 +04:00
Ilya Fedin
d9318c9935 Move icon name getter to cross-platform header 2022-09-19 14:23:27 +04:00
Ilya Fedin
5132fd5010 Use KSandbox to check flatpak/snap environment 2022-09-19 14:23:27 +04:00
Ilya Fedin
89879e355d Replace EscapeShell with KShell::joinArgs 2022-09-19 14:20:02 +04:00
Ilya Fedin
278ab5ebaf Add support for AVIF, HEIF and JPEG XL (only on Linux yet) 2022-09-19 11:20:50 +04:00
John Preston
39294a7fe1 Use touch handling from HistoryInner in ListWidget.
Fixes #24880.
2022-09-19 11:16:09 +04:00
John Preston
7727cdff92 Fix build with Xcode. 2022-09-18 17:12:16 +04:00
John Preston
8bd0ff7925 Opimize spoiler revealing. 2022-09-18 16:52:31 +04:00
John Preston
4f948699c0 Correct spoiler selections. 2022-09-18 16:52:31 +04:00
John Preston
cd00d41cca Correct spoiler colors in fully selected messages. 2022-09-18 16:52:31 +04:00
John Preston
749fb52113 Implement animated spoilers. 2022-09-18 16:52:30 +04:00
Ilya Fedin
4975254cc1 Avoid building qttools
Removing po folder from kcoreaddons allows that
2022-09-18 15:55:56 +04:00
Ilya Fedin
b36063e086 Update kcoreaddons to 5.98.0
And patch to cache portal result
2022-09-17 06:23:05 +04:00
358 changed files with 2060 additions and 1263 deletions

View File

@@ -80,7 +80,7 @@ jobs:
path: ${{ env.TBUILD }}\${{ env.REPO_NAME }}
- name: Python installs.
run: py -m pip install pywin32
run: py -m pip install pywin32 six
- name: Set up environment paths.
shell: bash

3
.gitmodules vendored
View File

@@ -91,3 +91,6 @@
[submodule "Telegram/ThirdParty/wayland-protocols"]
path = Telegram/ThirdParty/wayland-protocols
url = https://github.com/gitlab-freedesktop-mirrors/wayland-protocols.git
[submodule "Telegram/ThirdParty/kimageformats"]
path = Telegram/ThirdParty/kimageformats
url = https://github.com/KDE/kimageformats.git

View File

@@ -38,6 +38,8 @@ get_filename_component(cmake_helpers_loc "cmake" REALPATH)
include(cmake/variables.cmake)
include(cmake/nice_target_sources.cmake)
include(cmake/target_compile_options_if_exists.cmake)
include(cmake/target_link_options_if_exists.cmake)
include(cmake/target_link_static_libraries.cmake)
include(cmake/target_link_frameworks.cmake)
include(cmake/init_target.cmake)

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="4.2.0.0" />
Version="4.2.1.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,2,0,0
PRODUCTVERSION 4,2,0,0
FILEVERSION 4,2,1,0
PRODUCTVERSION 4,2,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "4.2.0.0"
VALUE "FileVersion", "4.2.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.2.0.0"
VALUE "ProductVersion", "4.2.1.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,2,0,0
PRODUCTVERSION 4,2,0,0
FILEVERSION 4,2,1,0
PRODUCTVERSION 4,2,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "4.2.0.0"
VALUE "FileVersion", "4.2.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.2.0.0"
VALUE "ProductVersion", "4.2.1.0"
END
END
BLOCK "VarFileInfo"

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

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/stickers_emoji_pack.h"
#include "chat_helpers/stickers_emoji_image_loader.h"
#include "history/view/history_view_element.h"
#include "history/history_item.h"
#include "history/history.h"
#include "lottie/lottie_common.h"
@@ -101,10 +102,10 @@ EmojiPack::EmojiPack(not_null<Main::Session*> session)
: _session(session) {
refresh();
session->data().itemRemoved(
) | rpl::filter([](not_null<const HistoryItem*> item) {
return item->isIsolatedEmoji();
}) | rpl::start_with_next([=](not_null<const HistoryItem*> item) {
session->data().viewRemoved(
) | rpl::filter([](not_null<const ViewElement*> view) {
return view->isIsolatedEmoji() || view->isOnlyCustomEmoji();
}) | rpl::start_with_next([=](not_null<const ViewElement*> item) {
remove(item);
}, _lifetime);
@@ -122,26 +123,26 @@ EmojiPack::EmojiPack(not_null<Main::Session*> session)
EmojiPack::~EmojiPack() = default;
bool EmojiPack::add(not_null<HistoryItem*> item) {
if (const auto custom = item->onlyCustomEmoji()) {
_onlyCustomItems.emplace(item);
bool EmojiPack::add(not_null<ViewElement*> view) {
if (const auto custom = view->onlyCustomEmoji()) {
_onlyCustomItems.emplace(view);
return true;
} else if (const auto emoji = item->isolatedEmoji()) {
_items[emoji].emplace(item);
} else if (const auto emoji = view->isolatedEmoji()) {
_items[emoji].emplace(view);
return true;
}
return false;
}
void EmojiPack::remove(not_null<const HistoryItem*> item) {
Expects(item->isIsolatedEmoji() || item->isOnlyCustomEmoji());
void EmojiPack::remove(not_null<const ViewElement*> view) {
Expects(view->isIsolatedEmoji() || view->isOnlyCustomEmoji());
if (item->isOnlyCustomEmoji()) {
_onlyCustomItems.remove(item);
} else if (const auto emoji = item->isolatedEmoji()) {
if (view->isOnlyCustomEmoji()) {
_onlyCustomItems.remove(view);
} else if (const auto emoji = view->isolatedEmoji()) {
const auto i = _items.find(emoji);
Assert(i != end(_items));
const auto j = i->second.find(item);
const auto j = i->second.find(view);
Assert(j != end(i->second));
i->second.erase(j);
if (i->second.empty()) {
@@ -436,9 +437,20 @@ auto EmojiPack::collectAnimationsIndices(
}
void EmojiPack::refreshAll() {
auto items = base::flat_set<not_null<HistoryItem*>>();
auto count = 0;
for (const auto &[emoji, list] : _items) {
refreshItems(list);
// refreshItems(list); // This call changes _items!
count += int(list.size());
}
items.reserve(count);
for (const auto &[emoji, list] : _items) {
// refreshItems(list); // This call changes _items!
for (const auto &view : list) {
items.emplace(view->data());
}
}
refreshItems(items);
refreshItems(_onlyCustomItems);
}
@@ -458,8 +470,18 @@ void EmojiPack::refreshItems(EmojiPtr emoji) {
}
void EmojiPack::refreshItems(
const base::flat_set<not_null<HistoryItem*>> &list) {
for (const auto &item : list) {
const base::flat_set<not_null<ViewElement*>> &list) {
auto items = base::flat_set<not_null<HistoryItem*>>();
items.reserve(list.size());
for (const auto &view : list) {
items.emplace(view->data());
}
refreshItems(items);
}
void EmojiPack::refreshItems(
const base::flat_set<not_null<HistoryItem*>> &items) {
for (const auto &item : items) {
_session->data().requestItemViewRefresh(item);
}
}

View File

@@ -35,6 +35,10 @@ class UniversalImages;
} // namespace Emoji
} // namespace Ui
namespace HistoryView {
class Element;
} // namespace HistoryView
namespace Stickers {
using IsolatedEmoji = Ui::Text::IsolatedEmoji;
@@ -48,6 +52,8 @@ struct LargeEmojiImage {
class EmojiPack final {
public:
using ViewElement = HistoryView::Element;
struct Sticker {
DocumentData *document = nullptr;
const Lottie::ColorReplacements *replacements = nullptr;
@@ -63,8 +69,8 @@ public:
explicit EmojiPack(not_null<Main::Session*> session);
~EmojiPack();
bool add(not_null<HistoryItem*> item);
void remove(not_null<const HistoryItem*> item);
bool add(not_null<ViewElement*> view);
void remove(not_null<const ViewElement*> view);
[[nodiscard]] Sticker stickerForEmoji(EmojiPtr emoji);
[[nodiscard]] Sticker stickerForEmoji(const IsolatedEmoji &emoji);
@@ -106,17 +112,18 @@ private:
-> base::flat_map<uint64, base::flat_set<int>>;
void refreshAll();
void refreshItems(EmojiPtr emoji);
void refreshItems(const base::flat_set<not_null<HistoryItem*>> &list);
void refreshItems(const base::flat_set<not_null<ViewElement*>> &list);
void refreshItems(const base::flat_set<not_null<HistoryItem*>> &items);
not_null<Main::Session*> _session;
const not_null<Main::Session*> _session;
base::flat_map<EmojiPtr, not_null<DocumentData*>> _map;
base::flat_map<
IsolatedEmoji,
base::flat_set<not_null<HistoryItem*>>> _items;
base::flat_set<not_null<HistoryView::Element*>>> _items;
base::flat_map<EmojiPtr, std::weak_ptr<LargeEmojiImage>> _images;
mtpRequestId _requestId = 0;
base::flat_set<not_null<HistoryItem*>> _onlyCustomItems;
base::flat_set<not_null<HistoryView::Element*>> _onlyCustomItems;
int _animationsVersion = 0;
base::flat_map<

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"
@@ -2041,8 +2042,12 @@ bool StickersListWidget::appendSet(
for (const auto &sticker : to.back().stickers) {
const auto document = sticker.document;
if (document->isPremiumSticker()) {
to[_premiumsIndex].stickers.push_back(Sticker{ document });
++to[_premiumsIndex].count;
auto &set = to[_premiumsIndex];
auto &list = set.stickers;
if (!ranges::contains(list, document, &Sticker::document)) {
list.push_back(Sticker{ document });
++set.count;
}
}
}
}

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

@@ -60,6 +60,14 @@ std::map<int, const char*> BetaLogs() {
"- Premium: Set any custom emoji as your profile status.\n"
"- Insert or copy custom emoji from pack preview.\n"
},
{
4002001,
"- Improve scaling / cropping for photos / video files.\n"
"- Improve touch support in channel comments.\n"
"- Nice animation for spoilers.\n"
}
};
};

View File

@@ -876,7 +876,7 @@ QString TryConvertUrlToLocal(QString url) {
using namespace qthelp;
auto matchOptions = RegExOption::CaseInsensitive;
auto subdomainMatch = regex_match(qsl("^(https?://)?([a-zA-Z0-9\\_]+)\\.t\\.me/?(\\?.+)?"), url, matchOptions);
auto subdomainMatch = regex_match(qsl("^(https?://)?([a-zA-Z0-9\\_]+)\\.t\\.me(/\\d+)?/?(\\?.+)?"), url, matchOptions);
if (subdomainMatch) {
const auto name = subdomainMatch->captured(2);
if (name.size() > 1 && name != "www") {
@@ -884,7 +884,8 @@ QString TryConvertUrlToLocal(QString url) {
subdomainMatch->captured(1)
+ "t.me/"
+ name
+ subdomainMatch->captured(3));
+ subdomainMatch->captured(3)
+ subdomainMatch->captured(4));
return result.startsWith("tg://resolve?domain=")
? result
: url;

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

@@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <KSandbox>
extern "C" {
#include <openssl/rsa.h>
@@ -1634,16 +1635,14 @@ void UpdateApplication() {
return "https://www.microsoft.com/en-us/store/p/telegram-desktop/9nztwsqntd0s";
#elif defined OS_MAC_STORE // OS_WIN_STORE
return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090";
#elif defined Q_OS_UNIX && !defined Q_OS_MAC // OS_WIN_STORE || OS_MAC_STORE
if (Platform::InFlatpak()) {
#else // OS_WIN_STORE || OS_MAC_STORE
if (KSandbox::isFlatpak()) {
return "https://flathub.org/apps/details/org.telegram.desktop";
} else if (Platform::InSnap()) {
} else if (KSandbox::isSnap()) {
return "https://snapcraft.io/telegram-desktop";
}
return "https://desktop.telegram.org";
#else // OS_WIN_STORE || OS_MAC_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC)
return "https://desktop.telegram.org";
#endif // OS_WIN_STORE || OS_MAC_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC)
#endif // OS_WIN_STORE || OS_MAC_STORE
}();
UrlClickHandler::Open(url);
} else {

View File

@@ -26,6 +26,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <KUrlMimeData>
#endif
#if __has_include(<KSandbox>)
#include <KSandbox>
#endif
#define qsl(s) QStringLiteral(s)
namespace base {
@@ -45,6 +49,27 @@ inline auto GetMimeUrls(const QMimeData *data) {
#endif
}
#if __has_include(<KSandbox>) && defined DeclareReadSetting
inline QString FlatpakID() {
static const auto Result = [] {
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
return qEnvironmentVariable("FLATPAK_ID");
} else {
return cExeName();
}
}();
return Result;
}
inline QString IconName() {
static const auto Result = KSandbox::isFlatpak()
? FlatpakID()
: qsl("telegram");
return Result;
}
#endif
} // namespace base
static const int32 ScrollMax = INT_MAX;

View File

@@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 4002000;
constexpr auto AppVersionStr = "4.2";
constexpr auto AppBetaVersion = false;
constexpr auto AppVersion = 4002001;
constexpr auto AppVersionStr = "4.2.1";
constexpr auto AppBetaVersion = true;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

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

@@ -1529,11 +1529,10 @@ rpl::producer<not_null<HistoryItem*>> Session::itemDataChanges() const {
void Session::requestItemTextRefresh(not_null<HistoryItem*> item) {
if (const auto i = _views.find(item); i != _views.end()) {
for (const auto view : i->second) {
if (const auto media = view->media()) {
media->parentTextUpdated();
}
for (const auto &view : i->second) {
view->itemTextUpdated();
}
requestItemResize(item);
}
}
@@ -1573,6 +1572,7 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved(
}
void Session::notifyViewRemoved(not_null<const ViewElement*> view) {
_shownSpoilers.remove(view);
_viewRemoved.fire_copy(view);
}
@@ -1672,24 +1672,15 @@ void Session::unloadHeavyViewParts(
}
}
void Session::registerShownSpoiler(FullMsgId id) {
if (const auto item = message(id)) {
_shownSpoilers.emplace(item);
}
}
void Session::unregisterShownSpoiler(FullMsgId id) {
if (const auto item = message(id)) {
_shownSpoilers.remove(item);
}
void Session::registerShownSpoiler(not_null<ViewElement*> view) {
_shownSpoilers.emplace(view);
}
void Session::hideShownSpoilers() {
for (const auto &item : _shownSpoilers) {
item->hideSpoilers();
requestItemTextRefresh(item);
for (const auto &view : base::take(_shownSpoilers)) {
view->hideSpoilers();
requestViewRepaint(view);
}
_shownSpoilers = base::flat_set<not_null<HistoryItem*>>();
}
void Session::removeMegagroupParticipant(
@@ -2156,7 +2147,6 @@ void Session::removeDependencyMessage(not_null<HistoryItem*> item) {
void Session::unregisterMessage(not_null<HistoryItem*> item) {
const auto peerId = item->history()->peer->id;
const auto itemId = item->id;
_shownSpoilers.remove(item);
_itemRemoved.fire_copy(item);
session().changes().messageUpdated(
item,

View File

@@ -296,8 +296,7 @@ public:
int from,
int till);
void registerShownSpoiler(FullMsgId id);
void unregisterShownSpoiler(FullMsgId id);
void registerShownSpoiler(not_null<ViewElement*> view);
void hideShownSpoilers();
using MegagroupParticipant = std::tuple<
@@ -956,7 +955,7 @@ private:
rpl::event_stream<InviteToCall> _invitesToCalls;
base::flat_map<uint64, base::flat_set<not_null<UserData*>>> _invitedToCallUsers;
base::flat_set<not_null<HistoryItem*>> _shownSpoilers;
base::flat_set<not_null<ViewElement*>> _shownSpoilers;
History *_topPromoted = nullptr;

View File

@@ -220,68 +220,71 @@ struct StickerSetIdentifier {
}
};
enum class MessageFlag : uint32 {
HideEdited = (1U << 0),
Legacy = (1U << 1),
HasReplyMarkup = (1U << 2),
HasFromId = (1U << 3),
HasPostAuthor = (1U << 4),
HasViews = (1U << 5),
HasReplyInfo = (1U << 6),
CanViewReactions = (1U << 7),
AdminLogEntry = (1U << 8),
Post = (1U << 9),
Silent = (1U << 10),
Outgoing = (1U << 11),
Pinned = (1U << 12),
MediaIsUnread = (1U << 13),
HasUnreadReaction = (1U << 14),
MentionsMe = (1U << 15),
IsOrWasScheduled = (1U << 16),
NoForwards = (1U << 17),
enum class MessageFlag : uint64 {
HideEdited = (1ULL << 0),
Legacy = (1ULL << 1),
HasReplyMarkup = (1ULL << 2),
HasFromId = (1ULL << 3),
HasPostAuthor = (1ULL << 4),
HasViews = (1ULL << 5),
HasReplyInfo = (1ULL << 6),
CanViewReactions = (1ULL << 7),
AdminLogEntry = (1ULL << 8),
Post = (1ULL << 9),
Silent = (1ULL << 10),
Outgoing = (1ULL << 11),
Pinned = (1ULL << 12),
MediaIsUnread = (1ULL << 13),
HasUnreadReaction = (1ULL << 14),
MentionsMe = (1ULL << 15),
IsOrWasScheduled = (1ULL << 16),
NoForwards = (1ULL << 17),
// Needs to return back to inline mode.
HasSwitchInlineButton = (1U << 18),
HasSwitchInlineButton = (1ULL << 18),
// For "shared links" indexing.
HasTextLinks = (1U << 19),
HasTextLinks = (1ULL << 19),
// Group / channel create or migrate service message.
IsGroupEssential = (1U << 20),
IsGroupEssential = (1ULL << 20),
// Edited media is generated on the client
// and should not update media from server.
IsLocalUpdateMedia = (1U << 21),
IsLocalUpdateMedia = (1ULL << 21),
// Sent from inline bot, need to re-set media when sent.
FromInlineBot = (1U << 22),
FromInlineBot = (1ULL << 22),
// Generated on the client side and should be unread.
ClientSideUnread = (1U << 23),
ClientSideUnread = (1ULL << 23),
// In a supergroup.
HasAdminBadge = (1U << 24),
HasAdminBadge = (1ULL << 24),
// Outgoing message that is being sent.
BeingSent = (1U << 25),
BeingSent = (1ULL << 25),
// Outgoing message and failed to be sent.
SendingFailed = (1U << 26),
SendingFailed = (1ULL << 26),
// No media and only a several emoji or an only custom emoji text.
SpecialOnlyEmoji = (1U << 27),
SpecialOnlyEmoji = (1ULL << 27),
// Message existing in the message history.
HistoryEntry = (1U << 28),
HistoryEntry = (1ULL << 28),
// Local message, not existing on the server.
Local = (1U << 29),
Local = (1ULL << 29),
// Fake message for some UI element.
FakeHistoryItem = (1U << 30),
FakeHistoryItem = (1ULL << 30),
// Contact sign-up message, notification should be skipped for Silent.
IsContactSignUp = (1U << 31),
IsContactSignUp = (1ULL << 31),
// Optimization for item text custom emoji repainting.
CustomEmojiRepainting = (1ULL << 32),
};
inline constexpr bool is_flag_type(MessageFlag) { return true; }
using MessageFlags = base::flags<MessageFlag>;

View File

@@ -55,49 +55,62 @@ dialogsTextWidthMin: 150px;
dialogsTextPalette: TextPalette(defaultTextPalette) {
linkFg: dialogsTextFgService;
monoFg: dialogsTextFg;
spoilerFg: dialogsTextFg;
}
dialogsTextPaletteOver: TextPalette(defaultTextPalette) {
linkFg: dialogsTextFgServiceOver;
monoFg: dialogsTextFgOver;
spoilerFg: dialogsTextFgOver;
}
dialogsTextPaletteActive: TextPalette(defaultTextPalette) {
linkFg: dialogsTextFgServiceActive;
monoFg: dialogsTextFgActive;
spoilerFg: dialogsTextFgActive;
}
dialogsTextPaletteDraft: TextPalette(defaultTextPalette) {
linkFg: dialogsDraftFg;
monoFg: dialogsTextFg;
spoilerFg: dialogsTextFg;
}
dialogsTextPaletteDraftOver: TextPalette(defaultTextPalette) {
linkFg: dialogsDraftFgOver;
monoFg: dialogsTextFgOver;
spoilerFg: dialogsTextFgOver;
}
dialogsTextPaletteDraftActive: TextPalette(defaultTextPalette) {
linkFg: dialogsDraftFgActive;
monoFg: dialogsTextFgActive;
spoilerFg: dialogsTextFgActive;
}
dialogsTextPaletteTaken: TextPalette(defaultTextPalette) {
linkFg: boxTextFgGood;
monoFg: dialogsTextFg;
spoilerFg: dialogsTextFg;
}
dialogsTextPaletteTakenOver: TextPalette(defaultTextPalette) {
linkFg: boxTextFgGood;
monoFg: dialogsTextFgOver;
spoilerFg: dialogsTextFgOver;
}
dialogsTextPaletteTakenActive: TextPalette(defaultTextPalette) {
linkFg: dialogsDraftFgActive;
monoFg: dialogsTextFgActive;
spoilerFg: dialogsTextFgActive;
}
dialogsTextPaletteArchive: TextPalette(defaultTextPalette) {
linkFg: dialogsArchiveFg;
monoFg: dialogsArchiveFg;
spoilerFg: dialogsArchiveFg;
}
dialogsTextPaletteArchiveOver: TextPalette(defaultTextPalette) {
linkFg: dialogsArchiveFgOver;
monoFg: dialogsArchiveFgOver;
spoilerFg: dialogsArchiveFgOver;
}
dialogsTextPaletteArchiveActive: TextPalette(defaultTextPalette) {
linkFg: dialogsTextFgActive;
monoFg: dialogsTextFgActive;
spoilerFg: dialogsTextFgActive;
}
dialogsEmptyHeight: 160px;

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"
@@ -687,6 +688,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
active,
selected,
ms,
videoPaused,
showUnreadInSearchResults);
p.translate(0, st::dialogsRowHeight);
}

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,
@@ -258,37 +259,38 @@ void PaintListEntryText(
QRect rect,
bool active,
bool selected,
not_null<const Row*> row) {
not_null<const Row*> row,
crl::time now,
bool paused) {
if (rect.isEmpty()) {
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(),
.now = now,
.paused = paused,
.elisionLines = rect.height() / st::dialogsTextFont->height,
});
}
enum class Flag {
@@ -434,7 +436,14 @@ 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(),
.now = ms,
.paused = bool(flags & Flag::VideoPaused),
.elisionLines = 1,
});
} else if (draft
|| (supportMode
&& entry->session().supportHelper().isOccupiedBySomeone(history))) {
@@ -485,13 +494,25 @@ 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(),
.now = ms,
.paused = bool(flags & Flag::VideoPaused),
.elisionLines = 1,
});
}
} else if (!item) {
auto availableWidth = namewidth;
@@ -692,7 +713,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 +805,7 @@ QSize CountUnreadBadgeSize(
}
QRect PaintUnreadBadge(
Painter &p,
QPainter &p,
const QString &unreadCount,
int x,
int y,
@@ -940,7 +961,7 @@ void RowPainter::paint(
ms)
: false;
if (const auto folder = row->folder()) {
PaintListEntryText(p, rect, active, selected, row);
PaintListEntryText(p, rect, active, selected, row, ms, paused);
} else if (history && !actionWasPainted) {
if (!history->lastItemDialogsView.prepared(item)) {
history->lastItemDialogsView.prepare(
@@ -948,7 +969,13 @@ void RowPainter::paint(
[=] { history->updateChatListEntry(); },
{});
}
history->lastItemDialogsView.paint(p, rect, active, selected);
history->lastItemDialogsView.paint(
p,
rect,
active,
selected,
ms,
paused);
}
};
const auto paintCounterCallback = [&] {
@@ -993,6 +1020,7 @@ void RowPainter::paint(
bool active,
bool selected,
crl::time ms,
bool paused,
bool displayUnreadInfo) {
auto item = row->item();
auto history = item->history();
@@ -1075,7 +1103,7 @@ void RowPainter::paint(
if (!view.prepared(item)) {
view.prepare(item, row->repaint(), previewOptions);
}
row->itemView().paint(p, itemRect, active, selected);
row->itemView().paint(p, itemRect, active, selected, ms, paused);
};
const auto paintCounterCallback = [&] {
PaintNarrowCounter(
@@ -1098,7 +1126,8 @@ void RowPainter::paint(
| (selected ? Flag::Selected : Flag(0))
| Flag::SearchResult
| (showSavedMessages ? Flag::SavedMessages : Flag(0))
| (showRepliesMessages ? Flag::RepliesMessages : Flag(0));
| (showRepliesMessages ? Flag::RepliesMessages : Flag(0))
| (paused ? Flag::VideoPaused : Flag(0));
paintRow(
p,
row,

View File

@@ -46,6 +46,7 @@ public:
bool active,
bool selected,
crl::time ms,
bool paused,
bool displayUnreadInfo);
static QRect sendActionAnimationRect(
int animationLeft,
@@ -94,7 +95,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"
@@ -175,33 +176,32 @@ void MessageView::paint(
Painter &p,
const QRect &geometry,
bool active,
bool selected) const {
bool selected,
crl::time now,
bool paused) const {
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 +224,15 @@ 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(),
.now = now,
.paused = paused,
.elisionLines = rect.height() / st::dialogsTextFont->height,
});
}
HistoryView::ItemPreview PreviewWithSender(

View File

@@ -49,14 +49,16 @@ public:
Painter &p,
const QRect &geometry,
bool active,
bool selected) const;
bool selected,
crl::time now,
bool paused) const;
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);

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